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
| require 'httparty' | |
| require 'json' | |
| class Campfire | |
| include HTTParty | |
| base_uri 'https://YOUR_DOMAIN.campfirenow.com' | |
| basic_auth 'YOUR_API_KEY', 'X' # yes, that is a literal X string. it's needed to satisfy basic_auth(), but campfire ignores it. | |
| headers 'Content-Type' => 'application/json' | |
| def self.speak(message) |
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
| require 'webrick' | |
| require 'webrick/httpproxy' | |
| require 'fileutils' | |
| require 'md5' | |
| ### | |
| # FakeWebRecorder is an HTTP Proxy that records sessions as calls to FakeWeb. | |
| # The code that FakeWebRecorder generates should be suitable for testing | |
| # interaction with a particular website. | |
| # |
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
| gemcutter => redis downloads spec | |
| ================================= | |
| keys | |
| ---- | |
| downloads => global counter for all gem downloads | |
| downloads:today => sorted set for downloads from today | |
| downloads:rubygem:rails => counter for all rails downloads | |
| downloads:version:rails-2.3.5 => counter for all rails 2.3.5 downloads |
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
| require 'lib/string_util.rb' | |
| require 'singleton' | |
| require 'rubygems' | |
| require 'active_support/core_ext/class/attribute_accessors' | |
| class Tokenizer | |
| include Singleton |
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
| sys = require('sys') | |
| for(var n in ["foo", "bar"]) { | |
| sys.puts(n) | |
| } |
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
| var Timezone = { | |
| set : function() { | |
| var date = new Date(); | |
| date.setTime(date.getTime() + (1000*24*60*60*1000)); | |
| var expires = "; expires=" + date.toGMTString(); | |
| document.cookie = "timezone=" + (-date.getTimezoneOffset() * 60) + expires + "; path=/"; | |
| } | |
| } |
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
| def mask(x)y=x.dup;y[6,6]='*'*6;y;end |
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
| heroku config --long | ruby -pe "\$_ = \$_.gsub(/(\w+)\s+=> (.+)/, 'export \1=\2')" > /tmp/$$ && source /tmp/$$; rm /tmp/$$ |
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 WrappedError < StandardError | |
| attr_reader :original_error, :message_with_original_error | |
| def initialize(original_error = nil) | |
| @original_error = original_error | |
| end | |
| def message |
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 Company < ActiveRecord::Base | |
| has_many :employees | |
| end | |
| class Employee < ActiveRecord::Base | |
| has_one :position | |
| belongs_to :company | |
| end | |
| class Position < ActiveRecord::Base |