Skip to content

Instantly share code, notes, and snippets.

@jcdarwin
jcdarwin / Open Folder with Sublime Text 2 (Win7)
Created August 21, 2012 00:59
Windows reg file to add "Open Folder with Sublime Text 2" to Windows 7 context menu
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\sublime]
@="Open Folder with &Sublime Text 2"
[HKEY_CLASSES_ROOT\Directory\shell\sublime\command]
@="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\" \"%1\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\sublime]
@="Open Folder with &Sublime Text 2"
@jcdarwin
jcdarwin / gist:6738906
Last active December 24, 2015 03:39
Profile DocPad using Apache Benchmark

#DocPad Benchmark

In one terminal window run:

git clone git://github.com/docpad/kitchensink.docpad.git docpad-benchmark
cd docpad-benchmark
npm install
docpad run
@jcdarwin
jcdarwin / keep_releases.sh
Created December 5, 2013 00:52
A bash script to only retain a specified number of releases, a la Capistrano's keep_releases
#!/bin/bash
# http://commanigy.com/blog/2012/03/31/a-bash-version-of-keep-releases-known-from-capistrano-ruby-scripts
keep_releases=3
#versions=`find ./cwp* -maxdepth 0 -type d -exec echo '{}' +`
#versions=`ls -xrt`
versions=`find ./cwp* -maxdepth 0 -type d | tac`
releases=(${versions// / })
# check available number of versions in releases directory
@jcdarwin
jcdarwin / boxstarter.ie8win7
Last active August 29, 2015 13:57
A Boxstarter script for provisioning a IE8Win7 OVM sourced from modern.ie
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
Disable-UAC
Disable-MicrosoftUpdate
cinst git.install
cinst git-credential-winstore
cinst console-devel
cinst sublimetext2
@jcdarwin
jcdarwin / push_git_multiple
Last active August 29, 2015 13:59
Pushing to multiple git repos simultaneously
# setup our remotes
git remote add all git@myrepo:pathtorepo
git remote set-url all --add [email protected]:me/myrepo
git remote set-url all --add [email protected]:me/myrepo
git remote set-url all --add https://gitlab.cwp.govt.nz/pathtorepo
# do work
git add .
git commit -m "Commiting work"
@jcdarwin
jcdarwin / open_powershell_here.reg
Created May 11, 2014 22:07
Add 'Open Powershell here' to Windows context menu
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\powershell]
@="Open Powershell here"
[HKEY_CLASSES_ROOT\Directory\shell\powershell\command]
@="C:\\\\WINDOWS\\\\system32\\\\cmd.exe /c start powershell -NoExit -Command Set-Location -LiteralPath '%L'"
@jcdarwin
jcdarwin / php_under_WAMP
Created August 5, 2014 04:53
Running PHP under WAMP
We prefer to point to our WAMP PHP CLI as our system-wide PHP CLI version, and we do this by
including the following script at /usr/local/bin/php:
#!/bin/bash
# e.g. php="/cygdrive/c/Program Files (x86)/php/php.exe"
php="/cygdrive/c/wamp/bin/php/current/php.exe"
for ((n=1; n <= $#; n++)); do
if [ -e "${!n}" ]; then
@jcdarwin
jcdarwin / gist:6b86e0cd58d26987d8ce
Created October 29, 2014 02:40
OSX screencast to animated gif

Appropriated from dergachev

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

@jcdarwin
jcdarwin / css-classnames
Created January 28, 2015 04:13
Return every classname in the current document, one per line.
// Requires jQuery.
// Return every classname in the current document, one per line
// (i.e. splitting multiple classnames where they appear)
$('*').each(
function(i, e) {
var classNames = e.className.split(/\s+/);
classNames.map(function(className){
console.log(className);
});
}
@jcdarwin
jcdarwin / git_aliases
Last active May 31, 2022 07:16
Use git aliases
################################################################################
# Once the following has been added to the .gitconfig and .extra, we can view
# all our git aliases by either using
#
# gla # List git aliases without comments
#
# galias # List git aliases with comments
#
# Refer to the following for more information:
# https://gist.github.com/mwhite/6887990