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
BLURGH = "outer blurgh" | |
module Foo | |
BLURGH = "foo blurgh" | |
class Bar | |
def blurgh | |
BLURGH | |
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
var Route = React.createClass({ /* magic */ }); // not necessary, handled my Routed's magic | |
var Link = React.createClass({ /* magic */ }); | |
var Routed = { /* magic */ }; | |
var App = React.createClass({ | |
mixins: [Routed], | |
render: function() { | |
return ( | |
<Root 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
#!/bin/sh | |
# | |
# Compile health-tracking javascript if necessary. | |
if git rev-parse --verify HEAD >/dev/null 2>&1 | |
then | |
against=HEAD | |
else | |
# Initial commit: diff against an empty tree object | |
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 |
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 'erb' | |
def interpolate(template, values = {}) | |
template.gsub(/\{\{(.+?)\}\}/) { |token| values.fetch($1) { ERB.new("<%= #{token} %>").result(binding) } } | |
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 'minitest/autorun' | |
class EmptyArray | |
def self.new | |
@instance ||= super | |
end | |
private :initialize | |
def method_missing(*args, &block) |
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 'spec_helper' | |
describe FeaturePool do | |
it "creates a new instance given valid attributes" do | |
Fabricate :feature_pool | |
end | |
it "is not valid without a name" do | |
Fabricate.build(:feature_pool, :name => "").should_not be_valid | |
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
# from http://railstips.org/blog/archives/2011/04/19/ssh-tunneling-in-ruby/ | |
require 'net/ssh/gateway' | |
gateway = Net::SSH::Gateway.new('<myremotehostorip.com>', '<remote_user>') | |
# Open port 27018 to forward to 127.0.0.1:27017 | |
# on the remote host provided above | |
gateway.open('127.0.0.1', 27017, 27018) |
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
pool = FeaturePool.find_by_name('discussions/primary') | |
position = 1 | |
previous = pool.feature_appearances.all(:conditions => 'featured_at IS NOT NULL', :order => 'featured_at') | |
previous.each do |appearance| | |
appearance.update_attribute(:position, position) | |
position += 1 | |
end | |
pool.update_attribute(:head, previous_and_current.last(pool.rotate_count).to_a.last.position + 1) |
NewerOlder