Skip to content

Instantly share code, notes, and snippets.


Toby Hede tobyhede

Block or report user

Report or block tobyhede

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View vsjsonp.js
// VSJONP ― Very Simple JSONP
// ==========================
// Usage:
// fetchJsonP({
// url: 'http://shit-no-cors.json',
// complete: function(response) {
// console.log(response);
// }
// });
# 0. Make sure you have Ruby 1.9.3 installed, and optionally RVM and PostgreSQL
# 0.2 If you are on the Mac, make sure you have a c compiler by installing XCode Command Line Tools or gcc4.2 with homebrew
# 0.5 Make sure you have bundler version ~> 1.2 as Rails depends on it
gem install bundler
# 1. Get edge Rails source (master branch)
git clone
tobyhede / clj->js.cljs
Created Jul 29, 2012
clj->js - convert ClojureScript objects into JavaScript equivalents
View clj->js.cljs
(defn clj->js
"Recursively transforms ClojureScript maps into Javascript objects,
other ClojureScript colls into JavaScript arrays, and ClojureScript
keywords into JavaScript strings."
(string? x) x
(keyword? x) (name x)
(map? x) (.-strobj (reduce (fn [m [k v]]
tobyhede / gist:3179978
Created Jul 26, 2012
Ruby/Rails date format cheat sheet
View gist:3179978
%a - The abbreviated weekday name (``Sun'')
%A - The full weekday name (``Sunday'')
%b - The abbreviated month name (``Jan'')
%B - The full month name (``January'')
%c - The preferred local date and time representation
%d - Day of the month (01..31)
%e - Day of the month without leading 0 (1..31)
%g - Year in YY (00-99)
tobyhede / index.txt
Created Jun 19, 2012 — forked from aschoerk/index.txt
Ruby/Clojure analogs
View index.txt
For each Ruby module/class, we have Ruby methods on the left and the equivalent
Clojure functions and/or relevant notes are on the right.
For clojure functions, symbols indicate existing method definitions, in the
clojure namespace if none is explicitly given. clojure.contrib.*/* functions can
be obtained from,
ruby-to-clojure.*/* functions can be obtained from the source files in this
If no method symbol is given, we use the following notation:
jboner / latency.txt
Last active Oct 22, 2019
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
burke /
Created Jan 27, 2012 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.


You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

mipearson / to_be_pushed.rb
Created Aug 18, 2011
find git repositories that are behind their current remote tracking branch
View to_be_pushed.rb
#!/usr/bin/env ruby
pwd = ARGV[0] || '.'
debug = ARGV[1] == '-d'
Dir[File.join(pwd, '**', '.git')].each do |repo|
repo.gsub!(/\.git$/, '')
$stderr.puts "in #{repo}" if debug
if `cd #{repo}; git status`.include?("Your branch is ahead of")
puts repo
tobyhede / install_rails.markdown
Created Nov 20, 2010
From 0 to Rails in several whiles using homebrew and rvm
View install_rails.markdown
You can’t perform that action at this time.