Skip to content

Instantly share code, notes, and snippets.

View elvishp2006's full-sized avatar
🏠
Working from home!

Elvis Henrique Pereira elvishp2006

🏠
Working from home!
View GitHub Profile
@timkelty
timkelty / docker-compose.yml
Created August 28, 2020 13:19
Craft-Compose-Mutagen
version: "3.7"
networks:
backend:
frontend:
volumes:
app:
db_data:
@seanhandley
seanhandley / docker-compose.yml
Last active April 9, 2024 04:05
How To Set Up Docker For Mac (Mojave) with Native NFS
version: '2'
services:
api:
volumes:
- "nfsmount:${CONTAINER_DIR}"
volumes:
nfsmount:
driver: local
driver_opts:
@ksuzushima
ksuzushima / wws2.md
Created October 31, 2017 03:05
WordPress + Webpack + Select2(jQuery dependencies)
  1. WordPressがデフォルトで読み込んでるjQueryは活用(プラグインなど使うとどうしてもjQuery依存してるものが出てくる)
  2. それでもバンドルツール入れないとシンドイ
  3. jQueryに依存してるけど、便利なSelect2をadmin画面に導入したい
// webpack.config.js

externals: {
  jquery: 'jQuery'
}
@wvpv
wvpv / sfmc-asc-json.html
Last active April 25, 2023 20:48
Parse ASC JSON payload
<html>
<head>
<style>
body, a, input {font-family:sans-serif;}
</style>
</head>
<body style="font-family:sans-serif">
%%=now()=%%
<h1>JSON Parse with GTL</h1>
%%[
@cwhittl
cwhittl / fetch_plugin.js
Created April 13, 2017 14:42
Using Fetch with Wordpress Plugins Ajax
fetch(ajax_url, {
method: 'POST',
credentials: 'same-origin',
headers: new Headers({'Content-Type': 'application/x-www-form-urlencoded'}),
body: 'action=zget_profile_user'
})
.then((resp) => resp.json())
.then(function(data) {
if(data.status == "success"){
_this.setState({loaded:true,user:data.user});
@EricBusch
EricBusch / get_object_terms_hierarchical.php
Last active June 27, 2023 03:38
Make terms retrieved by wp_get_object_terms() organized hierarchically. [wordpress]
<?php
/**
* Make terms retrieved by wp_get_object_terms() organized hierarchically.
*
* Use this function instead of wp_get_object_terms() to get a hierarchically
* structured array or term data.
*
* This function takes the terms returned by wp_get_object_terms() and organizes
* them into a hierarchical array with the parent's children (and grandchildren)
@marioluan
marioluan / remover-acentos.js
Created October 10, 2013 18:27
Funcao marota para remover acentos de strings. Foi utilizado expressao regular em cima de caracteres representados na base hexadecimal.
/**
* Remove acentos de caracteres
* @param {String} stringComAcento [string que contem os acentos]
* @return {String} [string sem acentos]
*/
function removerAcentos( newStringComAcento ) {
var string = newStringComAcento;
var mapaAcentosHex = {
a : /[\xE0-\xE6]/g,
e : /[\xE8-\xEB]/g,
@marek-saji
marek-saji / dev-tld.md
Last active February 26, 2024 16:12
Configure local DNS server to serve #dev #TLD #ubuntu #linux

Configure local wildcard DNS server

  1. Install Dnsmasq: sudo apt-get install dnsmasq
  2. Since Ubuntu's NetworkManager uses dnsmasq, and since that messes things up a little for us, open up /etc/NetworkManager/NetworkManager.conf and comment out (#) the line that reads dns=dnsmasq. Restart NetworkManager afterwards: sudo restart network-manager.
  3. Make sure Dnsmasq listens to local DNS queries by editing /etc/dnsmasq.conf, and adding the line listen-address=127.0.0.1.
  4. Create a new file in /etc/dnsmasq.d (eg. /etc/dnsmasq.d/dev), and add the line address=/dev/127.0.0.1 to have dnsmasq resolve requests for *.dev domains. Restart Dnsmasq: sudo /etc/init.d/dnsmasq restart.

source: http://brunodbo.be/blog/2013/04/setting-up-wildcard-apache-virtual-host-wildcard-dns

@unfulvio
unfulvio / functions.php
Last active July 15, 2021 05:17
WordPress HTML Minification Class to compress HTML (removal of whitespaces, line breaks, new lines, comments). Preserves script comments (if removed might break some javascripts like Google Analytics or Adsense) and IE specific tags.
/* Minifies HTML and removes comments (except IE tags and comments within script tags)
*
* To disable compression of code portions, use '<!--wp-html-compression no compression-->' tag
*
* @see http://forrst.com/posts/Wordpress_Minify_output_HTML-29q
* @see http://www.intert3chmedia.net/2011/12/minify-html-javascript-css-without.html
*/
class WP_HTML_Compression
{
// Settings
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: