Skip to content

Instantly share code, notes, and snippets.

View dancameron's full-sized avatar
💭
🍻Cheersing

Dan Cameron dancameron

💭
🍻Cheersing
View GitHub Profile
<?php
add_filter( 'hsd_get_user_customer_ids', 'check_hsd_customer_id', 999, 2 );
check_hsd_customer_id( $hsd_ids, $user_id ) {
if ( $hsd_ids ) {
$now = current_time( 'timestamp' );
$last_sync = get_user_meta( $user_id, 'pp_hsd_last_sync', true );
if ( ! $last_sync || $last_sync <= ( $now - ( HOUR_IN_SECONDS * 6 ) ) ) {
@chourobin
chourobin / configure_sublime.sh
Last active December 19, 2015 14:09
Install mHTML and mCSS TextMate bundles in ST
# Install SublimeText
# ST2
cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
# ST3
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages
# Install mCSS
git clone git://github.com/minimaldesign/mCSS.tmbundle.git "mCSS.tmbundle"
@markjaquith
markjaquith / gist:2653957
Created May 10, 2012 15:36
WordPress Fragment Caching convenience wrapper
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
@dancameron
dancameron / gist:2380052
Created April 13, 2012 20:45 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@helen
helen / wp-chosen-tax-metabox.php
Last active April 24, 2022 02:25
Use Chosen for a replacement WordPress taxonomy metabox
<?php
/**
* WordPress Chosen Taxonomy Metabox
* Author: Helen Hou-Sandi
*
* Use Chosen for a replacement taxonomy metabox in WordPress
* Useful for taxonomies that aren't changed much on the fly and are
* non-hierarchical in nature, as Chosen is for flat selection only.
* You can always use the taxonomy admin screen to add/edit taxonomy terms.
* Categories need slightly different treatment from the rest in order to