Skip to content

Instantly share code, notes, and snippets.

View agibralter's full-sized avatar
:shipit:

Aaron Gibralter agibralter

:shipit:
View GitHub Profile
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
@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.

// 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
}
require 'rubygems'
require 'system_timer'
def try_for_a_bit
result = nil
e_last = nil
begin
SystemTimer.timeout_after(2) do
until result
begin
// ----------------------------------------------------------
// 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) {}
#!/usr/bin/env zsh
if [[ -s "${TM_PROJECT_DIRECTORY}/.rvmrc" ]]
then
source "${TM_PROJECT_DIRECTORY}/.rvmrc"
fi
`which ruby` $*
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)
@agibralter
agibralter / gist:468653
Created July 8, 2010 21:19
Given an array of path strings, find the longest common prefix path.
# Given an array of path strings, find the longest common prefix path.
def find_base_path(paths)
return paths.first if paths.length <= 1
arr = paths.sort
f = arr.first.split('/')
l = arr.last.split('/')
i = 0
i += 1 while f[i] == l[i] && i <= f.length
f.slice(0, i).join('/')
end
@defunkt
defunkt / ii.rb
Created May 24, 2010 23:33
{{.}} in mustache.rb
require 'mustache'
Mustache::Parser::ALLOWED_CONTENT = /(\w|[?!\/.-])*/
class ImplicitIterator < Mustache
define_method "." do
self[:to_s]
end
def names