Skip to content

Instantly share code, notes, and snippets.

@ryanbriones
ryanbriones / gist:269803
Created January 5, 2010 22:27 — forked from madmimi/gist:269783
post to Campfire via new API
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)
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.
#
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
require 'lib/string_util.rb'
require 'singleton'
require 'rubygems'
require 'active_support/core_ext/class/attribute_accessors'
class Tokenizer
include Singleton
sys = require('sys')
for(var n in ["foo", "bar"]) {
sys.puts(n)
}
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=/";
}
}
def mask(x)y=x.dup;y[6,6]='*'*6;y;end
heroku config --long | ruby -pe "\$_ = \$_.gsub(/(\w+)\s+=> (.+)/, 'export \1=\2')" > /tmp/$$ && source /tmp/$$; rm /tmp/$$
class WrappedError < StandardError
attr_reader :original_error, :message_with_original_error
def initialize(original_error = nil)
@original_error = original_error
end
def message
class Company < ActiveRecord::Base
has_many :employees
end
class Employee < ActiveRecord::Base
has_one :position
belongs_to :company
end
class Position < ActiveRecord::Base