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 / 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%
<?php
require_once '../Mustache.php';
class MustacheCallTest extends PHPUnit_Framework_TestCase {
public function testCallEatsContext() {
$foo = new Foo();
$foo->name = 'Bob';
<?php
$please['don\'t']='tell me';
$that['your']=$code->isMore->readable_than_mine;
$simply['because']=you::put()->brackets;
$onNew->lines=$when->everythingElse($you,'write',$looks->likeThis); // (no spaces, everything smashed together)
$i_want['to']->punch($you)->inTheFace();
FROM: Harvey Ball <me@harveyball.com>
-------------------------------------
Hi,
Why does doctrine piss memory up the wall like a drunken slag on a saturday night?
I built a basic test such as....
Sku table
require 'formula'
def mysql_installed?
`which mysql_config`.length > 0
end
class Php <Formula
url 'http://www.php.net/get/php-5.3.4.tar.gz/from/this/mirror'
homepage 'http://php.net/'
@seth
seth / yui_compressor.rb
Created January 11, 2011 04:23
A Nanoc filter for minifying CSS and Javascript using the YUI Compressor
YUI_JAR = File.dirname(__FILE__) + "/../tools/yuicompressor-2.4.2.jar"
class YuiCompressor < Nanoc3::Filter
identifier :yui_compress
type :text => :binary
def run(content, params={})
type = type_from_extension
cmd = "java -jar #{YUI_JAR} --type #{type} -o #{output_filename}"
IO.popen(cmd, 'w') { |f| f.write(content) }
raise "yuicompressor exited with #{$?} for '#{cmd}'" unless $? == 0