Skip to content

Instantly share code, notes, and snippets.

@cowboy
cowboy / gist:1981174
Created March 5, 2012 21:19 — 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
@cowboy
cowboy / gist:1926484
Created February 27, 2012 19:31 — forked from jnordberg/gist:1926447
npm plugin system
npm = require 'npm'
npm.load {global: true}, (error, npm) ->
npm.commands.ls [], true, (error, result) ->
for moduleName, module of result.dependencies
if moduleName[..8] == 'clitool-'
# load module as a plugin
@cowboy
cowboy / pre-commit
Created January 5, 2012 19:08 — forked from miketaylr/pre-commit
#!/bin/bash
# pre-commit hook to prevent html5 video or audio files from being checked
# into the repo. because large binary files in a git repo sucks. bad.
media_files=$(git diff --cached --name-only --diff-filter=ACR | \
egrep -i '\.(webm|mp4|ogg|mp3|ogv|m4v|avi|vp8|mov|oga|mp1|mp2|mpeg|3gp|wav)$')
if [[ "$media_files" ]]; then
echo 'Commit failed. Are you trying to check in media files into the repo?'
exit 1
@cowboy
cowboy / Folder Preferences
Created December 21, 2011 13:25 — forked from chrisyour/Folder Preferences
Show hidden files and hidden folders (except .git) in your TextMate project drawer
# Want to show hidden files and folders in your TextMate project drawer? Simple, just modify the file and folder patterns in TextMate's preferences.
# Instructions:
# Go to TextMate > Preferences...
# Click Advanced
# Select Folder References
# Replace the following:
# File Pattern
@cowboy
cowboy / Custom.css
Created August 17, 2011 15:20 — forked from bentruyman/Custom.css
IR_Black Theme for Chrome Developer Tools
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@cowboy
cowboy / ago.js
Created June 2, 2011 20:21 — forked from gf3/ago.js
Super small relative dates
module.exports = (function(){
const MS =
{ seconds: 1000
, minutes: 60 * 1000
, hours: 60 * 60 * 1000
, days: 24 * 60 * 60 * 1000
, weeks: 7 * 24 * 60 * 60 * 1000
, months: 30 * 7 * 24 * 60 * 60 * 1000
, years: 365 * 24 * 60 * 60 * 1000 }
@cowboy
cowboy / utmstrip.user.js
Created May 20, 2011 20:37 — forked from paulirish/utmstrip.user.js
userscript: Drop the UTM params from a URL when the page loads
// ==UserScript==
// @name UTM param stripper
// @author Paul Irish
// @namespace http://github.com/paulirish
// @description Drop the UTM params from a URL when the page loads.
// @extra Cuz you know they're all ugly n shit.
// @include http://*
// ==/UserScript==
// save this as utmstrip.user.js and drag it into Chrome or Firebug (with greasemonkey)
@cowboy
cowboy / noteval.js
Created February 20, 2011 13:16 — forked from phiggins42/noteval.js
JavaScript noteval (from phiggins)
// Untested mod of phiggins' original gist. Maybe I'll actually try it someday.
function noteval( code, doc ) {
// add some javascript to a document, like an iframe
//
// var iframe = document.getElementById('theframe'),
// iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
//
// noteval('alert("hi")', iframeDoc);
$ git clone github:lenary/guides.git
Cloning into guides...
remote: Counting objects: 255, done.
remote: Compressing objects: 100% (216/216), done.
remote: Total 255 (delta 111), reused 163 (delta 35)
Receiving objects: 100% (255/255), 1.49 MiB | 564 KiB/s, done.
Resolving deltas: 100% (111/111), done.
$ cd guides
$ git remote -v
@cowboy
cowboy / pubsub-demo.js
Created December 16, 2010 20:04 — forked from rmurphey/pubsub-demo.js
Two approaches: "Traditional" vs Pub/Sub (via rmurphey)
// Note that this uses my Pub/Sub implementation, which is slightly different than
// phiggins' in that jQuery custom events are used, and as such the first event handler
// argument passed is the event object.
//
// jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery
// https://gist.github.com/661855
// The "traditional" way.