Skip to content

Instantly share code, notes, and snippets.

View ajsharp's full-sized avatar

Alex Sharp ajsharp

View GitHub Profile
[GEM_ROOT]/gems/mongo-1.3.1/lib/mongo/util/pool.rb:80:in `rescue in checkout_new_socket'
[GEM_ROOT]/gems/mongo-1.3.1/lib/mongo/util/pool.rb:76:in `checkout_new_socket'
[GEM_ROOT]/gems/mongo-1.3.1/lib/mongo/util/pool.rb:156:in `block (2 levels) in checkout'
:
[GEM_ROOT]/gems/mongo-1.3.1/lib/mongo/util/pool.rb:152:in `block in checkout'
[GEM_ROOT]/gems/mongo-1.3.1/lib/mongo/util/pool.rb:145:in `loop'
[GEM_ROOT]/gems/mongo-1.3.1/lib/mongo/util/pool.rb:145:in `checkout'
[GEM_ROOT]/gems/mongo-1.3.1/lib/mongo/repl_set_connection.rb:324:in `checkout_writer'
[GEM_ROOT]/gems/mongo-1.3.1/lib/mongo/connection.rb:477:in `receive_message'
[GEM_ROOT]/gems/mongo-1.3.1/lib/mongo/cursor.rb:407:in `block in send_initial_query'
@ajsharp
ajsharp / airbrakeapp.com.js
Created August 17, 2011 23:48
DotJS script to create github issues from AirbrakeApp error pages
// NOTE: You need dotjs installed to use this: https://github.com/defunkt/dotjs
//
// You must name this file with your airbrakeapp subdomain prepended to the filename.
// Example: So myairbrakesubdomain.airbrakeapp.com.js
var login = "<GITHUB USERNAME>";
var token = "<GITHUB TOKEN>";
var title = $("#notice_heading h2").text();
var link = document.location.href;
myFunc = function() {
  {"name": {"first": "blah"}}
}
def compile_template_method(locals)
source, offset = precompiled(locals)
offset += 5
method_name = "__tilt_#{Thread.current.object_id.abs}"
Object.class_eval <<-RUBY, eval_file, line - offset
#{extract_magic_comment source}
TOPOBJECT.class_eval do
def #{method_name}(locals)
Thread.current[:tilt_vars] = [self, locals]
class << self
require 'rubygems'
require 'json/pure'
require 'awesome_print'
class Person
attr_accessor :name, :age
def initialize(name, age)
@name, @age = name, age
end
attributes :_id, :as => :id
attributes :name, :blah, :foo, :bar
offers do
attributes :foo, :bar
messages do
# ...
end
end
{
"aps": {"alert": "some message"},
"aliases": ["1234"],
"key1": "val1",
"key2": "val2"
}
# shelling out to the system here is what triggers signal trap bug.
# If we remove this line, all works as intended.
#
# This issue affects ruby 1.9.2-p180 and ubuntu 11.04, kernel version 2.6.38-8-virtual
# References: https://bugzilla.kernel.org/show_bug.cgi?id=32922
`echo blah`
loop do
trap("INT") { puts("exiting..."); exit(0) }
def mobile
respond_to do |fmt|
fmt.iphone { ... }
fmt.andriod { ... }
end
end
module Sinatra
module AmbiguousRoutes
def self.registered(app)
app.class_eval do
class << self
private
def route_with_ambiguity(verb, path, options = {}, &block)