Skip to content

Instantly share code, notes, and snippets.

Justin Hileman bobthecow

View GitHub Profile
@mikehale
mikehale / jquery.copyable.js
Created Jan 21, 2010
A jquery API for ZeroClipBoard
View jquery.copyable.js
/*
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 Apr 9, 2010
jQuery version of deferred Google Analytics. See http://neil.fraser.name/news/2010/04/07/ for more details.
View deferred_google_analytics.html
<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 Jun 21, 2010
Change directories really fast
View cdd.bash
#!/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 Jul 6, 2010
`git todo` alias is the hotness.
View .gitconfig
[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
View bench1
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%
View MustacheCallTest.php
<?php
require_once '../Mustache.php';
class MustacheCallTest extends PHPUnit_Framework_TestCase {
public function testCallEatsContext() {
$foo = new Foo();
$foo->name = 'Bob';
View gist:706970
<?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();
View gist:722508
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
View php.rb
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 Jan 11, 2011
A Nanoc filter for minifying CSS and Javascript using the YUI Compressor
View yui_compressor.rb
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
You can’t perform that action at this time.