Skip to content

Instantly share code, notes, and snippets.

View twitchy's full-sized avatar

Reeve Jolliffe twitchy

View GitHub Profile
@twitchy
twitchy / mac-dnsflush
Created November 22, 2014 02:36
Flush Yosemite DNS caches
sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches;say flushed
@twitchy
twitchy / wordpress-tags.php
Created June 24, 2014 16:17
wordpress-tags
<h3>Random remix tag cloud:</h3>
<?php wp_tag_cloud('number=50&format=list&order=RAND'); ?>
<h3>Most common tags:</h3>
<?php wp_tag_cloud('number=50&format=list&orderby=count'); ?>
<h3>All <?php if (function_exists('tagstats')) { tagstats(); } ?> tags in alphabetical order:</h3>
<?php wp_tag_cloud('smallest=10&largest=10&number=0&format=list'); ?>
@twitchy
twitchy / gulpfile.js
Last active August 29, 2015 14:02
gulpfile-wordpress-themedev
var gulp = require('gulp');
// Include Our Plugins
var jshint = require('gulp-jshint');
var compass = require('gulp-compass');
var minifyCSS = require('gulp-minify-css');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var rev = require('gulp-rev');
@twitchy
twitchy / for-loop-optimized.js
Created June 11, 2014 21:27
Optimized for loop
var len = thing.length;
for( var i = len; i--; ) {
// stuff
}
@twitchy
twitchy / dispatchTables.js
Created June 11, 2014 05:07
Dispatch Tables
var thingsWeCanDo = {
doThisThing : function() { /* behavior */ },
doThatThing : function() { /* behavior */ },
doThisOtherThing : function() { /* behavior */ },
default : function() { /* behavior */ }
};
var doSomething = function(doWhat) {
var thingToDo = thingsWeCanDo.hasOwnProperty(doWhat) ? doWhat : "default"
thingsWeCanDo[thingToDo]();
@twitchy
twitchy / js-method-in-callback.js
Created June 6, 2014 05:24
Invoke method in from within a callback
function MyClass() {
this.myCallback = function() {
alert("MyClass.myCallback()");
};
this.startRequest = function() {
var myself = this;
GM_xmlhttpRequest({
'method': 'GET',
'url': "http://www.google.com/",
@twitchy
twitchy / grunt-useful-tasks
Created February 9, 2014 18:00
useful grunt tasks
https://github.com/jrcryer/grunt-pagespeed
https://npmjs.org/package/grunt-responsive-images
https://npmjs.org/package/grunt-modernizr
https://github.com/globaldev/grunt-montage
https://github.com/nicholasstephan/grunt-spritesheet
https://npmjs.org/package/grunt-autoshot
@twitchy
twitchy / git-autocorrect
Created February 9, 2014 16:41
git autocorrect
git config --global help.autocorrect 1
@twitchy
twitchy / grunt-build-control
Last active August 29, 2015 13:56
grunt-build-control
// GRUNT-BUILD-CONTROL
// https://npmjs.org/package/grunt-build-control
// http://curtisblackwell.com/blog/my-deploy-method-brings-most-of-the-boys-to-the-yard
//
// use grunt to auto push /dist to live, stage, whatever on build
//
- npm install grunt-build-control --save-dev
- // grunt.loadNpmTasks('grunt-build-control'); ( not needed with yeoman )
- configuration:
@twitchy
twitchy / system-nobounce.txt
Created January 20, 2014 17:14
Prevent bouncing dock icon nag alert
defaults write com.apple.dock no-bouncing -bool TRUE
killall Dock