This file contains hidden or 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
strToCodes = (str) -> | |
result = new Array(str.length) | |
pos = 0 | |
while pos < str.length | |
c = str.charCodeAt(pos).toString(16) | |
result[pos] = if c.length % 2 == 1 then "x0"+c else "x"+c | |
result[pos] += "\n" if c == "a" # i.e. "\n" | |
pos++ | |
result.join(' ') |
This file contains hidden or 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
Prompt = { | |
cmdCount: 1, | |
host: function() { | |
if(db.serverStatus().ok == false) { | |
if(db.serverStatus().errmsg == "need to login") { | |
return "unauthorized"; | |
} else { | |
return "error" | |
} |
This file contains hidden or 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 bash | |
## | |
# Run with: | |
# | |
# curl -sSL https://gist.github.com/tekwiz/8289262/raw/rmate-setup.sh | bash -s | |
# | |
mkdir -p ~/bin | |
curl -Lo ~/bin/rmate https://raw.github.com/textmate/rmate/master/bin/rmate |
This file contains hidden or 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 ruby | |
require "tmpdir" | |
require "fileutils" | |
PWD_ORIG = Dir.pwd | |
TMP_DIR = Dir.mktmpdir("git-backup") | |
def remote_basename | |
if ARGV[0] =~ /\.git$/ |
This file contains hidden or 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
module Circuit | |
FORMAT_EXT_REGEXP = /\.([^\.]+)$/ | |
module Validators | |
silence_warnings do | |
SLUG_REGEXP = /\A(?:[-_!~*'()a-zA-Z\d:@&=+$,]|%[a-fA-F\d]{2})*(?:;(?:[-_!~*'()a-zA-Z\d:@&=+$,]|%[a-fA-F\d]{2})*)*\Z/ | |
end | |
class SlugValidator < ActiveModel::EachValidator | |
def validate_each(record, attribute, value) |
This file contains hidden or 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
class Semaphore | |
def initialize(limit) | |
@main, @internal = Mutex.new, Mutex.new | |
@mutexes = limit.times.collect { Mutex.new } | |
end | |
def synchronize | |
# create the mutex variable for scope | |
# grab the current thread for sleeping if necessary later | |
mutex, thread = nil, Thread.current |
This file contains hidden or 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
module Bundler | |
module Source | |
class Git < Path | |
def path | |
@install_path ||= begin | |
if Bundler.requires_sudo? | |
Bundler.user_bundle_path.join(Bundler.ruby_scope).join(git_scope) | |
else | |
Bundler.install_path.join(git_scope) | |
end |
Problem: Gemfile.lock was generated on Windows machine (mingw), but on the OS X machine, the mingw gems are removed from the lockfile (and the platform "unknown" is added).
Bundler Version: All developers on are on bundler 1.0.13
Ruby Version: 1.8.7-p174 (OS X) and 1.8.7-p330 (Windows)
RVM Version: 1.2.4 (OS X), no RVM on Windows
Bundle Config: no settings