Skip to content

Instantly share code, notes, and snippets.

View maxjf1's full-sized avatar
🏠
Working from home

Maxwell maxjf1

🏠
Working from home
  • UFJF
  • Juiz de Fora, Minas Gerais - Brazil
View GitHub Profile
@peter-schmalfeldt
peter-schmalfeldt / convertStringToEmoji.js
Created October 26, 2023 04:07
Convert String to Emoji for SFCC XML Site Imports
/**
* Convert String to Emoji
* Most emoji's start with �
* If you have these in your SFCC Site Import XML File, you might get an import error.
*
* @usage convertStringToEmoji('��') => 🙂
* @param {String} str Raw URL Encoded String
*/
function convertStringToEmoji(str) {
// Regex matching either a surrogate or a character.
@maxjf1
maxjf1 / docker-compose.yml
Last active May 21, 2020 20:54
Docker Compose for WordPress Development
version: "3.1"
services:
wordpress:
image: wordpress
restart: unless-stopped
ports:
- 8080:80
environment:
WORDPRESS_DB_HOST: db
@callumlocke
callumlocke / .zshrc
Last active May 14, 2024 07:09
ZSH function to auto-switch to correct Node version
####
# ZSH function to auto-switch to correct Node version
# https://gist.github.com/callumlocke/30990e247e52ab6ac1aa98e5f0e5bbf5
#
# - Searches up your directory tree for the closest .nvmrc, just like `nvm use` does.
#
# - If you are already on the right Node version, IT DOES NOTHING, AND PRINTS NOTHING.
#
# - Works correctly if your .nvmrc file contains something relaxed/generic,
# like "4" or "v12.0" or "stable".
@mattheu
mattheu / block.js
Created April 18, 2018 09:41
Gutenberg - Test case custom block for passing content to render callback
const el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
InnerBlocks = wp.blocks.InnerBlocks;
registerBlockType( 'gutenberg-boilerplate-es5/hello-world-step-01', {
title: 'Hello World (Step 1)',
icon: 'universal-access-alt',
category: 'layout',
@Shelob9
Shelob9 / serve-side-block.js
Last active February 4, 2024 20:38
Example Gutenberg block with server-side rendering. Gutenberg edit() block creates interface. Gutenberg saves settings automatically, the PHP function passed as `render_callback` to `register_block_type` is used to create HTML for front-end rendering of block.
const { __ } = wp.i18n;
const { registerBlockType } = wp.blocks;
const el = wp.element.createElement;
registerBlockType( 'hiRoy/serverSide', {
title: __( 'Server Side Block', 'text-domain' ),
icon: 'networking',
category: 'common',
attributes: {
@marcelo-ribeiro
marcelo-ribeiro / javascript-remove-accents.js
Last active May 21, 2023 09:17 — forked from fabiofdsantos/angularJS_removeAccents.js
An Javascript function to remove accents and others characters from an input string.
// Example: https://codepen.io/marcelo-ribeiro/pen/OJmVOyW
const accentsMap = new Map([
["A", "Á|À|Ã|Â|Ä"],
["a", "á|à|ã|â|ä"],
["E", "É|È|Ê|Ë"],
["e", "é|è|ê|ë"],
["I", "Í|Ì|Î|Ï"],
["i", "í|ì|î|ï"],
["O", "Ó|Ò|Ô|Õ|Ö"],
google-chrome --use-fake-device-for-media-stream --use-file-for-fake-video-capture=/path/to/video.y4m
@ricog
ricog / Dockerfile
Created November 8, 2016 15:54
Docker wait for mysql to be ready and then load sql
FROM mysql:5.6
MAINTAINER Your Name <you@yourplace.com>
COPY wait-for-mysql.sh /
CMD /wait-for-mysql.sh
@sam-artuso
sam-artuso / setting-up-babel-nodemon.md
Last active November 3, 2023 08:52
Setting up Babel and nodemon

Setting up Babel and nodemon

Inital set-up

Set up project:

mkdir project
cd project
npm init -y
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE