Skip to content

Instantly share code, notes, and snippets.

View bobthecow's full-sized avatar

Justin Hileman bobthecow

View GitHub Profile
@mikehale
mikehale / jquery.copyable.js
Created January 21, 2010 21:11
A jquery API for ZeroClipBoard
/*
Requirements:
This script requires the jquery.includeMany plugin and ZeroClipboard.
Example:
$("#elementToClickOn").copyable(function(e, clip) {
clip.setText($("#elementWithText").html());
});
@stephanschubert
stephanschubert / deferred_google_analytics.html
Created April 9, 2010 10:57
jQuery version of deferred Google Analytics. See http://neil.fraser.name/news/2010/04/07/ for more details.
<script type="text/javascript">
(function($) {
$("body").load(function() {
setTimeout(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
}, 1);
});
})(jQuery);
@bobthecow
bobthecow / cdg.bash
Created April 29, 2010 15:45
cd relative to the current Git repo
#!/bin/bash
#
# cd relative to the current Git repo
#
# Author: Justin Hileman (http://justinhileman.com)
#
# Installation:
# Add the following function to your `.bashrc` or `.bash_profile`,
# or save it somewhere (e.g. `~/.cdg.bash`) and source it in `.bashrc`
#
@bobthecow
bobthecow / .gitconfig
Created June 10, 2010 15:30
Git aliases
[alias]
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; $EDITOR `f`"
add-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"
lc = log ORIG_HEAD.. --stat --no-merges
smash = merge --no-commit --log
eat = branch -M
prune-all = !git remote | xargs -n 1 git remote prune
whois = "!sh -c 'git log -i --pretty=\"format:%an <%ae>\" --author=\"$1\" | sort -u' -"
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
@bobthecow
bobthecow / cdd.bash
Created June 21, 2010 23:37
Change directories really fast
#!/bin/bash
#
# Change directories really really fast
#
# Author: Justin Hileman (http://justinhileman.com)
#
# Installation:
# Add the following function to your `.bashrc` or `.bash_profile`,
# or save it somewhere (e.g. `~/.cdd.bash`) and source it in `.bashrc`
#
@bobthecow
bobthecow / .gitconfig
Created July 6, 2010 00:56
`git todo` alias is the hotness.
[alias]
# install t first: http://github.com/sjl/t
todo = !python ~/path/to/t.py --task-dir "$(git rev-parse --show-toplevel)" --list TODO
bug = !python ~/path/to/t.py --task-dir "$(git rev-parse --show-toplevel)" --list BUGS
PASS #1 - SMALL FILE
=============================================
HTMLPurifier Pass #1 - Small File:
----------------------------------------------------
marker time index ex time perct
----------------------------------------------------
Start 1278617711.57713300 - 0.00%
----------------------------------------------------
Stop 1278617715.11053700 3.533404 100.00%
#! /usr/bin/env ruby
# this script takes your current commit, finds all the submodules in it,
# makes them static files in a new tree and updates a branch called 'heroku'
# - this way you can push a project with submodules to heroku easily
# just run this, then run "git push heroku heroku:master"
current_commit = `git rev-parse HEAD`
current_tree = `git rev-parse HEAD^{tree}`
puts "Starting at tree #{current_tree}"
@kennethreitz
kennethreitz / sync.py
Created October 10, 2010 19:08
GitHub Syncer. Clones or Pulls all GitHub repos (including watched list).
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Kenneth Reitz's GitHub Syncer
This script uses the GitHub API to get a list of all forked, mirrored, public, and
private repos in your GitHub account. If the repo already exists locally, it will
update it via git-pull. Otherwise, it will properly clone the repo.
It will organize your repos into the following directory structure:
<?php
require_once '../Mustache.php';
class MustacheCallTest extends PHPUnit_Framework_TestCase {
public function testCallEatsContext() {
$foo = new Foo();
$foo->name = 'Bob';