Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang=\"en\">
<head>
<meta charset=\"utf-8\" />
<title>Action Controller: Exception caught</title>
<style>
body { background-color: #fff; color: #333; }
body, p, ol, ul, td {
font-family: helvetica, verdana, arial, sans-serif;
@jeremyvdw
jeremyvdw / Gemfile
Created August 27, 2011 13:16 — forked from igrigorik/Gemfile
HTML5 SSE / EventSource demo with Goliath
source :gemcutter
gem 'goliath', :git => 'git://github.com/postrank-labs/goliath.git'
gem 'em-synchrony', :git => 'git://github.com/igrigorik/em-synchrony.git'
@jeremyvdw
jeremyvdw / async_upload.rb
Created January 18, 2012 00:17 — forked from elucid/async_upload.rb
Running multiple Goliath apps
require 'goliath'
require 'yajl'
# adapted from goliath/examples/async_upload.rb
class AsyncUpload < Goliath::API
use Goliath::Rack::Params # parse & merge query and body parameters
use Goliath::Rack::DefaultMimeType # cleanup accepted media types
use Goliath::Rack::Render, 'json' # auto-negotiate response format
def on_headers(env, headers)
@jeremyvdw
jeremyvdw / apubnub.rb
Created March 5, 2012 18:27
apublish & asubscribe PubNub methods (wrapped in Fibers)
require 'eventmachine'
require 'em-http-request'
require 'yajl'
module PubSub
class Pubnub
#**
#* Pubnub
#*
#* Init the Pubnub Client API
diff --git a/app/models/trophy.rb b/app/models/trophy.rb
index 059ccca..b9bf3ee 100644
--- a/app/models/trophy.rb
+++ b/app/models/trophy.rb
@@ -201,12 +201,12 @@ class Trophy
trophies = trophies_list
- user_values = Statistics::UserActivity::Query.new.for_user(user_id) do
- trophies.map { |trophy| metric_promise(trophy.dimension, trophy.metric) }
@jeremyvdw
jeremyvdw / celluloid_registry_issue.rb
Created August 17, 2012 13:49
Celluloid registry issue/weirdness
require 'celluloid'
require 'awesome_print'
Celluloid.logger = Logger.new STDOUT
class Monitor
include Celluloid
attr_reader :name
@jeremyvdw
jeremyvdw / Redis::TimeoutError
Created September 10, 2012 17:56
Redis::TimeoutError
Redis::TimeoutError: Connection timed out
Collapse
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:198 • rescue in io
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:196 • io
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:204 • read
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:142 • block in call_pipelined
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:177 • block (2 levels) in process
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:281 • ensure_connected
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:167 • block in process
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:242 • logging
@jeremyvdw
jeremyvdw / gist:3692550
Created September 10, 2012 17:58
Redis::TimeoutError
Redis::TimeoutError: Connection timed out
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:198 • rescue in io
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:196 • io
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:204 • read
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:142 • block in call_pipelined
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:177 • block (2 levels) in process
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:281 • ensure_connected
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:167 • block in process
vendor/bundle/ruby/1.9.1/bundler/gems/redis-rb-4f7eadc119ba/lib/redis/client.rb:242 • logging
@jeremyvdw
jeremyvdw / gist:3699810
Created September 11, 2012 16:56
rbxcrashreport
jeremy:preplaysports-api/ (rbx-2.0.testing) (master✗) $ foreman start worker=10 [18:47:20]
18:47:37 worker.1 | started with pid 34890
18:47:37 worker.2 | started with pid 34891
18:47:37 worker.3 | started with pid 34892
18:47:37 worker.4 | started with pid 34893
18:47:37 worker.5 | started with pid 34894
18:47:37 worker.6 | started with pid 34895
18:47:37 worker.7 | started with pid 34896
18:47:37 worker.8 | started with pid 34897
18:47:37 worker.9 | started with pid 34898
> db.players.find( { team_id: { $in: ["phi"] } }).sort({last_name: 1}).explain()
{
"cursor" : "BtreeCursor team_id_1",
"isMultiKey" : false,
"n" : 37,
"nscannedObjects" : 37,
"nscanned" : 37,
"nscannedObjectsAllPlans" : 74,
"nscannedAllPlans" : 74,
"scanAndOrder" : true,