Skip to content

Instantly share code, notes, and snippets.

View tobyhede's full-sized avatar
👨‍🚀
...

Toby Hede tobyhede

👨‍🚀
...
View GitHub Profile
@tobyhede
tobyhede / install_rails.markdown
Created November 20, 2010 23:37
From 0 to Rails in several whiles using homebrew and rvm
@mipearson
mipearson / to_be_pushed.rb
Created August 18, 2011 00:31
find git repositories that are behind their current remote tracking branch
#!/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
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — 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.

Requirements

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.

@jboner
jboner / latency.txt
Last active April 18, 2024 17:18
Latency Numbers Every Programmer Should Know
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
@tobyhede
tobyhede / index.txt
Created June 19, 2012 10:22 — forked from aschoerk/index.txt
Ruby/Clojure analogs
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 http://github.com/kevinoneill/clojure-contrib/tree/master,
ruby-to-clojure.*/* functions can be obtained from the source files in this
gist.
If no method symbol is given, we use the following notation:
@tobyhede
tobyhede / gist:3179978
Created July 26, 2012 02:53
Ruby/Rails date format cheat sheet
From http://linux.die.net/man/3/strftime
%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
tobyhede / clj->js.cljs
Created July 29, 2012 01:52
clj->js - convert ClojureScript objects into JavaScript equivalents
(defn clj->js
"Recursively transforms ClojureScript maps into Javascript objects,
other ClojureScript colls into JavaScript arrays, and ClojureScript
keywords into JavaScript strings."
[x]
(cond
(string? x) x
(keyword? x) (name x)
(map? x) (.-strobj (reduce (fn [m [k v]]
# 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
# https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers
# 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 https://github.com/rails/rails.git
@tobyhede
tobyhede / vsjsonp.js
Last active August 29, 2015 14:13 — forked from juliocesar/vsjsonp.js
// VSJONP ― Very Simple JSONP
// ==========================
//
// Usage:
// fetchJsonP({
// url: 'http://shit-no-cors.json',
// complete: function(response) {
// console.log(response);
// }
// });