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
File.open("test/fixtures/ketama_results", "r").each_line { |x| a = x.split(" "); puts " { \"#{a[0].gsub('\\', '\\\\\\')}\", #{a[1]}UL, #{a[2]}UL, \"#{a[3].split(':')[0]}\" }," } |
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 print pretty 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
function rbpatch { | |
local branch | |
branch=$(git name-rev --name-only head 2>/dev/null) | |
git diff ${1:-master}..head > "~/Desktop/${branch}-patch.txt" | |
} |
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 with_temp_folder(&block) | |
count = 0 | |
begin | |
name = "/tmp/test#{rand(2 ** 32)}" | |
Dir.mkdir(name) | |
rescue SystemCallError | |
retry if count < 10 | |
raise | |
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
require 'test/unit/ui/console/testrunner' | |
def running_under_textmate? | |
ENV.keys.any? { |key| key =~ /^TM_/ } | |
end | |
begin | |
require 'redgreen' unless running_under_textmate? | |
rescue LoadError | |
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
// allows you to do this (manifest is of type Manifest[T]): | |
// val obj: T = manifest.create() | |
implicit def manifest2creator[T](m: Manifest[T]): Creator[T] = new Creator(m) | |
class Creator[T](m: Manifest[T]) { | |
def create(): T = m.erasure.newInstance().asInstanceOf[T] | |
} |
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
import sbt._ | |
import java.io.File | |
protected class StandardProject(info: ProjectInfo) extends DefaultProject(info) { | |
override def dependencyPath = "lib" | |
override def disableCrossPaths = true | |
val homeFolder = Path.fromFile(new File(System.getProperty("user.home"))) | |
override def ivyCacheDirectory = Some(homeFolder / ".ivy2-sbt" ##) |
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/ruby | |
require "rubygems" | |
require "thrift_client" | |
$:.push('./target/gen-rb') | |
require "funny_name_generator" | |
client = ThriftClient.new(FunnyNameGenerator::Client, "localhost:9999", :transport_wrapper => nil) | |
p client.get_name() |
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
class CamSet | |
server: 'http://example.com/cam/' | |
constructor: (@name, @max, @viewDiv, @messageDiv) -> | |
@urls = [] | |
@urlMap = {} | |
now = new Date() | |
@dates = (new Date(now.getTime() - 60000 * i) for i in [max - 1 .. 0]) | |
@urls = (this.urlForDate(d) for d in @dates) | |
@current = @urls.length - 1 |
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
// ==UserScript== | |
// @name Fix github | |
// @namespace http://www.lag.net/fix-github/ | |
// @version 1.0 | |
// @description Fix the CSS for inline code segments of a markdown page on github. | |
// | |
// @include http://github.com/* | |
// @include https://github.com/* | |
// @include http://wiki.github.com/* | |
// @include http://help.github.com/* |
OlderNewer