This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ruby-debug' | |
require 'socket' | |
require 'forwardable' | |
class SporkDebugger | |
DEFAULT_PORT = 10_123 | |
HOST = '127.0.0.1' | |
extend Forwardable | |
def_delegators :state, *[:prepare_debugger, :initialize] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -g prefix C-a | |
unbind C-b | |
bind C-a send-prefix | |
set bell-action none | |
set-option -g status-left "" | |
set-option -g status-right "#S" | |
set -g status-bg black | |
set -g status-fg white | |
set utf8-default on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Finds the longest common starting substring in an array of strings | |
function common_substring(data) { | |
var i, ch, memo, idx = 0 | |
do { | |
memo = null | |
for (i=0; i < data.length; i++) { | |
ch = data[i].charAt(idx) | |
if (!ch) break | |
if (!memo) memo = ch | |
else if (ch != memo) break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mustache' | |
Mustache::Parser::ALLOWED_CONTENT = /(\w|[?!\/.-])*/ | |
class ImplicitIterator < Mustache | |
define_method "." do | |
self[:to_s] | |
end | |
def names |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
if [[ -s "${TM_PROJECT_DIRECTORY}/.rvmrc" ]] | |
then | |
source "${TM_PROJECT_DIRECTORY}/.rvmrc" | |
fi | |
`which ruby` $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'system_timer' | |
def try_for_a_bit | |
result = nil | |
e_last = nil | |
begin | |
SystemTimer.timeout_after(2) do | |
until result | |
begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
OlderNewer