Skip to content

Instantly share code, notes, and snippets.

View coolbrg's full-sized avatar

Budh Ram Gurung (BRG) coolbrg

View GitHub Profile
@coolbrg
coolbrg / gist:5813945
Created June 19, 2013 12:34
Error log in "staging"
2013-06-19T12:32:08.442569+00:00 app[web.2]: E, [2013-06-19T12:32:08.441564 #15] ERROR -- : app error: closed stream (IOError)
2013-06-19T12:32:08.442569+00:00 app[web.2]: E, [2013-06-19T12:32:08.441635 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_response.rb:53:in `write'
2013-06-19T12:32:08.442569+00:00 app[web.2]: E, [2013-06-19T12:32:08.441675 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_response.rb:53:in `http_response_write'
2013-06-19T12:32:08.442569+00:00 app[web.2]: E, [2013-06-19T12:32:08.441706 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:562:in `process_client'
2013-06-19T12:32:08.442569+00:00 app[web.2]: E, [2013-06-19T12:32:08.441732 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:632:in `worker_loop'
2013-06-19T12:32:08.442569+00:00 app[web.2]: E, [2013-06-19T12:32:08.441771 #15] ERROR -- : /app/vendor/bundle/ruby/1.9.1/gems/unicorn
@coolbrg
coolbrg / gist:5933873
Created July 5, 2013 11:18
Heroku logs on 'Saving problems'.
2013-07-05T11:16:09.177945+00:00 app[web.2]: Started PUT "/problems/51d6882c78c3f738fc000046" for 203.123.164.34 at 2013-07-05 11:16:09 +0000
2013-07-05T11:16:10.446408+00:00 app[web.2]:
2013-07-05T11:16:10.446408+00:00 app[web.2]: Mongoid::Errors::InvalidFind (
2013-07-05T11:16:10.446408+00:00 app[web.2]: Problem:
2013-07-05T11:16:10.446408+00:00 app[web.2]: Calling Document.find with nil is invalid.
2013-07-05T11:16:10.446408+00:00 app[web.2]: Summary:
2013-07-05T11:16:10.446408+00:00 app[web.2]: Document.find expects the parameters to be 1 or more ids, and will return a single document if 1 id is provided, otherwise an array of documents if multiple ids are provided.
2013-07-05T11:16:10.446408+00:00 app[web.2]: Resolution:
2013-07-05T11:16:10.446408+00:00 app[web.2]: Most likely this is caused by passing parameters directly through to the find, and the parameter either is not present or the key from which it is accessed is incorrect.):
2013-07-05T11:16:10.446408+00:00 app[web.2]: app/controllers/p
@coolbrg
coolbrg / gist:5956145
Created July 9, 2013 09:56
sinatra_street_view.rb for 1st iteration.
# sinatra_street_view.rb
require 'sinatra'
require 'sinatra/reloader' if development?
def formatted_url(address)
base_url = 'http://maps.googleapis.com/maps/api/geocode/xml?sensor=false&'
encoded_address = URI.encode address
"#{base_url}#{encoded_address}"
end
[{"name"=>"animal", "spec"=>{"generator"=>["In List", ["dog", "horse", "cow", "goat", "ox"]], "transformers"=>{}}}, {"name"=>"time", "spec"=>{"generator"=>["Normal Distribution", "6", "2"], "transformers"=>{"In Between"=>["1", "4"]}}}, {"name"=>"velocity", "spec"=>{"generator"=>["Normal Distribution", "6", "5"], "transformers"=>{"Greater Than"=>["1"]}}}, {"name"=>"name", "spec"=>{"generator"=>["In List", ["aa", "bb", "cc", "dd", "ee", "ff", "gg"]], "transformers"=>{}}}]
@coolbrg
coolbrg / gist:42056a1fbcbe279bb222
Created June 25, 2014 02:44
Class Method Demo Phase 1
class ClassMethodDemo
def self.greet
puts "Hello, Ruby"
end
end
ClassMethodDemo.greet
@coolbrg
coolbrg / gist:541b1f8d854a2eddd3a9
Created June 25, 2014 02:46
Class Method Demo Phase 2
class ClassMethodDemo
def self.greet
puts "Hello, Ruby"
end
ClassMethodDemo.greet
end
@coolbrg
coolbrg / gist:72e5cae24a3f4fe1b8ba
Created June 25, 2014 02:48
Class Method Phase 3
class ClassMethodDemo
def self.greet
puts "Hello, Ruby"
end
greet
end
@coolbrg
coolbrg / gist:44efd3d4e6072d8b32dc
Created June 25, 2014 02:48
Class Method Demo Phase 4
class ClassMethodDemo
def self.greet
puts "Hello, Ruby"
end
end
class UseDemo < ClassMethodDemo
greet
end
@coolbrg
coolbrg / gist:66e797cffed73275c290
Created June 25, 2014 03:04
Multiple Inheritance Demo
module Aa
def a_foo
puts "A's foo"
end
end
module Bb
def b_foo
puts "B's foo"
end
@coolbrg
coolbrg / gist:c0fd8b3400842915bec7
Created June 25, 2014 03:06
Single Inheritance Demo
class Mammal
def breathe
puts "inhale and exhale"
end
end
class Cat < Mammal
def speak
puts "Meow"
end