Skip to content

Instantly share code, notes, and snippets.

View jqr's full-sized avatar

Elijah Miller jqr

View GitHub Profile
@jqr
jqr / bertmark.rb
Created October 23, 2009 12:40 — forked from brianmario/bertmark.rb
require 'rubygems'
require 'bert'
require 'json'
require 'yajl'
require 'benchmark'
ITER = 1_000
tiny = t[:ok, :awesome]
small = t[:ok, :answers, [42] * 42]
@jqr
jqr / gist:223107
Created October 31, 2009 15:29 — forked from bkeepers/gist:223062
// easy refresh-css keybinding to alt-w
// alt-r was taken in IE, so consider this a CSS Weefresh
// original code from http://paulirish.com/2008/how-to-iterate-quickly-when-debugging-css/
$(document).keyup(function(e){
if (e.which == 87 && e.altKey) {
$('link').each(function() {
if((/stylesheet/i).test(this.rel) && this.href) {
var href = this.href.replace(/(&|\?)forceReload=\d+/,'');
this.href = href + ((/\?/).test(href) ? '&' : '?' ) + 'forceReload=' + new Date;
require 'activesupport'
{:one => 1, :two => 2}.slice(:one) #=> {:one=>1}
#!/usr/bin/env ruby
home = File.expand_path('~')
Dir["#{home}/Library/Application Support/TextMate{,/Pristine Copy}/Bundles/*/.git"].each do |bundle|
dir = bundle.gsub(/\.git/, '')
puts "Updating #{File.basename(dir)}"
Dir.chdir(dir) { `git pull` }
end
`osascript -e 'tell app "TextMate" to reload bundles'`
# In ruby 1.9
{:one => 1, :two => 2}.select {|k,v| k == :one} #=> {:one=>1}
{:one => 1, :two => 2}.reject {|k,v| k == :one} #=> {:two=>2}
package main
import (
"fmt"
"net"
"bufio"
"time"
)
const apiKey string = "your api key"
@jqr
jqr / setup-statsd.sh
Created July 6, 2011 02:04 — forked from howardr/setup-statsd.sh
Minor changes to statsd installation
# install git
sudo apt-get install -y g++ curl libssl-dev apache2-utils
sudo apt-get install -y git-core
mkdir ~/src
cd ~/src
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
@jqr
jqr / README.md
Created February 28, 2014 21:51 — forked from mbostock/.block
# This example will create a sample asynchronous pdf document with the authentication information as part of the POST data
curl http://docraptor.com/docs \
--fail --silent --show-error \
--header "Content-Type: application/json" \
--data '{
"user_credentials": "YOUR_API_KEY_HERE",
"doc": {
"name": "async_example.pdf",
"document_type":"pdf",
"async":"true",
module Breadcrumb
def breadcrumbs
if parent
parent.breadcrumbs << self
else
[self]
end
end
end