- GitHub Staff
- http://zerowidth.com
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
var sys = require('sys'); | |
var foo = { | |
name: 'foo', | |
bar: function() { | |
sys.puts('in bar, this is ' + this.name); | |
setTimeout(this.bar, 1000); | |
}, | |
baz: function() { | |
var me = this; |
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
# this is why AR3 and arel is awesome. | |
# bus route data, loaded from google transit data | |
# the usage | |
class StopsController < ApplicationController | |
def nearest | |
@stops = Stop.nearest_to(lon, lat).serving_route("SKIP").limit(5).all | |
end | |
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 ruby | |
require "fileutils" | |
require "pathname" | |
require "zlib" | |
world = Pathname.new File.expand_path("./world") | |
0.upto(3) do |x| | |
0.upto(3) do |z| |
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
module App | |
class Model | |
def as_json(opts={}) | |
hash = super | |
if opts && inclusions = opts[:include] | |
case inclusions | |
when Array | |
inclusions.each do |key| | |
hash[key.to_s] = send(key.to_sym).as_json | |
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
module Golem | |
class ServerMapConverter | |
def self.convert(src_path, dest_path) | |
new(src_path, dest_path).convert | |
end | |
attr_reader :src, :dest | |
def initialize(src_path, dest_path) | |
@src = Pathname.new(src_path).expand_path |
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 sshr() { | |
if [ -n "$1" ]; then | |
if [ -n "$2" ]; then | |
ssh -t $1 sudo $2 | |
else | |
ssh -t $1 sudo su - | |
fi | |
else | |
echo "... specify a host, n00b" | |
fi |
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 "trollop" | |
Trollop::Parser.module_eval do | |
def self.mode_parse(args=ARGV, &block) | |
parser = Parser.new(args, &block) | |
with_standard_exception_handling(parser) { parser.mode_parse args } | |
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
source :rubygems | |
gem "bson_ext" | |
gem "mongo" | |
gem "logging" |
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
Dreamer [Fischer], level [1], priority [19], policy [OTHER] | |
Dreamer [Cobb], level [1], priority [19], policy [OTHER] | |
Dreamer [Ariadne], level [1], priority [19], policy [OTHER] | |
Dreamer [Arthur], level [1], priority [19], policy [OTHER] | |
Dreamer [Eames], level [1], priority [19], policy [OTHER] | |
Dreamer [Yusuf], level [1], priority [19], policy [OTHER] | |
Dreamer [Saito], level [1], priority [19], policy [OTHER] | |
[Fischer] HIJACKED ! Open up my defense projections in my dream to the hijackers! | |
[Cobb] sees Fischers defense projections at work in the dream at level [1] | |
[Cobb] taking Fischer to level 2 |
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 ruby | |
log = "big.log" | |
words = %w(foo bar baz blech mumble what no ack aiee) | |
File.open(log, 'w') do |file| | |
1000.times do |n| | |
content = (0..(rand(100) + 10)).map { words[rand(words.size)] } | |
file.puts "#{n} #{content.join ' '}" | |
end |