Skip to content

Instantly share code, notes, and snippets.

View brettsmason's full-sized avatar

Brett Mason brettsmason

View GitHub Profile
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@Rarst
Rarst / composer.json
Last active January 27, 2023 12:40
Test project for WordPress stack via Composer
{
"name" : "rarst/install-test",
"description" : "Test project for WordPress stack via Composer",
"authors" : [
{
"name" : "Andrey Savchenko",
"homepage": "http://www.Rarst.net/"
}
],
"type" : "project",
@thenbrent
thenbrent / subscription-sync.php
Last active August 26, 2021 08:22
Example code to sync a subscription to a specific date. All the good parts are thanks to @peterwilsoncc, all the bad parts are my own. This is not intended to be a complete and working snippet. Instead, treat it as a guide to what needs to be changed for syncing a payment date.
<?php
/**
* Plugin Name: WooCommerce Subscriptions Date Sync
* Plugin URI:
* Description: Sets the start date of a subscription to September 13, 2013
* Author: Peter Wilson
* Author URI: http://peterwilson.cc/
* Version: 1.0.0
*/
@schilke
schilke / functions.php
Last active February 23, 2023 18:53
How to load CSS files asynchronously in WordPress (using Scott Jehl's "loadCSS")
<?php
// This is the cleaner code per request of a thread in the LinkedIn group "WordPress"
// ...
// register and enqueue loadCSS
function load_scripts_and_styles() {
// register loadCSS
wp_register_script( 'load-css-async', get_stylesheet_directory_uri() . '/path/to/js/loadCSS.js', array(), '', false );
@bendc
bendc / nodelist-iteration.js
Created January 13, 2015 14:39
ES6: Iterating over a NodeList
var elements = document.querySelectorAll("div"),
callback = (el) => { console.log(el); };
// Spread operator
[...elements].forEach(callback);
// Array.from()
Array.from(elements).forEach(callback);
// for...of statement
@yratof
yratof / load.php
Last active January 30, 2023 08:41
ACF Load layouts into flex field
<?php
add_filter( 'acf/load_field/name=flex_layout', __CLASS__ . '::craft_content_layouts' );
static function craft_content_layouts( $field ) {
// Remove the layouts
// that are named in this list
$remove_list = [
'paragraph',
'banner',
<?php
add_filter( 'gridable_row_options', function ( $options ) {
$options['bg_color'] = array(
'type' => 'color',
'label' => 'Row Background Color',
'default' => 'transparent'
);
@jacobdubail
jacobdubail / php
Created January 30, 2017 23:44
Function to auto-set your ACF5 Pro license key
function jtd_acf_auto_set_license_keys() {
if ( !get_option('acf_pro_license') && defined('ACF_5_KEY') ) {
$save = array(
'key' => ACF_5_KEY,
'url' => home_url()
);
$save = maybe_serialize($save);
@martinherweg
martinherweg / browserSync.js
Last active May 29, 2021 08:07
Webpack + BrowserSync + HMR
/**
|--------------------------------------------------------------------------
| gulp browser-sync
|--------------------------------------------------------------------------
*
* Browser Sync
* @description Refresh the Brwoser after File Change.
* Combined with webpack for HMR or Content Reload
*
* @package generator-mh-boilerplate
@nunomorgadinho
nunomorgadinho / gist:b2d8e5b8f5fec5b0ed946b24fa288a91
Created February 10, 2017 13:30
PHPCS + WordPress Coding Standards
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install composer
brew install homebrew/php/composer
### PHPCS
composer global require "squizlabs/php_codesniffer=*"
# Add to your .bash_profile