Skip to content

Instantly share code, notes, and snippets.

View agibralter's full-sized avatar
:shipit:

Aaron Gibralter agibralter

:shipit:
View GitHub Profile
def substr(str1, str2)
len = str1.length
last = (0...len).detect{|i| str1[i] != str2[i]}
last ||= len
str1[0...last]
end
def gcp(strings)
sorted = strings.sort
substr(sorted.first, sorted.last)
#!/usr/bin/env zsh
if [[ -s "${TM_PROJECT_DIRECTORY}/.rvmrc" ]]
then
source "${TM_PROJECT_DIRECTORY}/.rvmrc"
fi
`which ruby` $*
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
require 'rubygems'
require 'system_timer'
def try_for_a_bit
result = nil
e_last = nil
begin
SystemTimer.timeout_after(2) do
until result
begin
// HOWTO: load LABjs itself dynamically!
// inline this code in your page to load LABjs itself dynamically, if you're so inclined.
(function (global, oDOC, handler) {
var head = oDOC.head || oDOC.getElementsByTagName("head");
function LABjsLoaded() {
// do cool stuff with $LAB here
}
@rentalcustard
rentalcustard / 01_readme.markdown
Created October 25, 2010 11:20
Fix tmux bootstrap

The author of this patch is 'toby' from the MacPorts project, and the original commit containing this diff can be found at https://trac.macports.org/changeset/58563. The trac ticket prompting the commit (and with additional context) is at https://trac.macports.org/ticket/18357.

Toby, if you're reading this, apologies for not attributing the gist originally; I put this up quickly while experimenting with tmux under Leopard and abandoned it when it didn't solve the problem at hand. It's only fair now that other people are looking at the gist to give you credit.

export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=1000000000
export RUBY_HEAP_FREE_MIN=500000
export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=1000000000
export RUBY_HEAP_FREE_MIN=500000
@atmos
atmos / lojack-proxy.god.rb
Created November 13, 2010 03:05
god configs for camo.
God.watch do |w|
w.uid = "git"
w.gid = "git"
w.name = "camo"
w.pid_file = "/data/camo/tmp/camo.pid"
w.interval = 30.seconds
w.env = {
"PORT" => '8080',
"CAMO_KEY" => '0x24FEEDFACEDEADBEEFCAFE'
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />
<!--[if lt IE 9]>
<link href="/stylesheets/pie.css" media="screen, projection" rel="stylesheet" type="text/css" />
<![endif]-->