Skip to content

Instantly share code, notes, and snippets.

@leerob
leerob / settings.json
Created January 8, 2023 17:15
VSCode settings (2023)
{
// NORMAL SETTINGS
// ===============
"editor.quickSuggestions": {
"comments": "on",
"strings": "on",
"other": "on"
},
"editor.suggestOnTriggerCharacters": true,
"editor.wordBasedSuggestions": true,
@bikramchettri
bikramchettri / alignment-options.js
Created January 4, 2023 07:50 — forked from wpmark/alignment-options.js
Add alignment options for WordPress core blocks.
// set alignment options for cover, video, and paragraph blocks.
wp.hooks.addFilter(
'blocks.registerBlockType',
'hd-theme/hd-theme',
function( settings, name ) {
if ( name === 'core/cover' || name === 'core/video' || name === 'core/paragraph' || name === 'core/list' ) {
return lodash.assign( {}, settings, {
supports: lodash.assign( {}, settings.supports, {
// allow support for full and wide alignment.
align: ['full', 'wide'],
@carlodaniele
carlodaniele / CustomSidebar.js
Created January 2, 2023 17:24
A custom Gutenberg block with a custom sidebar to add and manage custom meta fields in WordPress
import { __ } from '@wordpress/i18n';
import { compose } from '@wordpress/compose';
import { withSelect, withDispatch } from '@wordpress/data';
import { PluginSidebar, PluginSidebarMoreMenuItem } from '@wordpress/edit-post';
import { PanelBody, PanelRow, TextControl, DateTimePicker } from '@wordpress/components';
const CustomSidebar = ( { postType, metaFields, setMetaFields } ) => {
if ( 'post' !== postType ) return null;
@carlodaniele
carlodaniele / edit.js
Created January 2, 2023 16:21
A custom Gutenberg block to add and manage custom meta fields in WordPress
/**
* Retrieves the translation of text.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-i18n/
*/
import { __ } from '@wordpress/i18n';
/**
* React hook that is used to mark the block wrapper element.
* It provides all the necessary props like the class name.
@Klerith
Klerith / instalaciones.md
Last active April 25, 2025 16:07
Instalaciones recomendadas - Curso de Angular de cero a experto
@codigoconjuan
codigoconjuan / app.js
Created October 6, 2022 22:32
Validar email
const regex = /^\w+([.-_+]?\w+)*@\w+([.-]?\w+)*(\.\w{2,10})+$/
@codigoconjuan
codigoconjuan / NuevoCliente.jsx
Created September 19, 2022 23:46
Validar emails
let regex = new RegExp("([!#-'*+/-9=?A-Z^-~-]+(\.[!#-'*+/-9=?A-Z^-~-]+)*|\"\(\[\]!#-[^-~ \t]|(\\[\t -~]))+\")@([!#-'*+/-9=?A-Z^-~-]+(\.[!#-'*+/-9=?A-Z^-~-]+)*|\[[\t -Z^-~]*])");
<?php
/**
* WooCommerce functions
*/
add_shortcode( 'wc_reg_form', 'dwc_separate_registration_form' );
function dwc_separate_registration_form() {
if ( is_admin() ) return;
if ( is_user_logged_in() ) return;
@bradtraversy
bradtraversy / mern-server-setup.md
Last active April 17, 2025 05:39
Setup Ubuntu & Deploy MERN app

Linux Server Setup & MERN App Deployment

These are the steps to setup an Ubuntu server from scratch and deploy a MERN app with the PM2 process manager and Nginx. We are using Linode, but you could just as well use a different cloud provider or your own machine or VM.

Create an account at Linode

Click on Create Linode

Choose your server options (OS, region, etc)

SSH Keys

@adrianhajdin
adrianhajdin / eslintrc.js
Created May 18, 2022 14:38
ESLint Configuration
// eslintrc.js
module.exports = {
env: {
browser: true,
es6: true,
},
extends: [
'plugin:react/recommended',
'airbnb',
],