Skip to content

Instantly share code, notes, and snippets.

View scottburton11's full-sized avatar

Scott Burton scottburton11

View GitHub Profile
cloud start
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require': /Library/Ruby/Gems/1.8/gems/poolparty-1.4.0/bin/../lib/poolparty/cloud.rb:141: syntax error, unexpected ',', expecting '|' (SyntaxError)
define_method meth.to_sym do |*args, &block|
^
/Library/Ruby/Gems/1.8/gems/poolparty-1.4.0/bin/../lib/poolparty/cloud.rb:290: syntax error, unexpected kEND, expecting $end
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Ruby/Gems/1.8/gems/poolparty-1.4.0/bin/../lib/poolparty.rb:50
from /Library/Ruby/Gems/1.8/gems/poolparty-1.4.0/bin/../lib/poolparty.rb:47:in `each'
from /Library/Ruby/Gems/1.8/gems/poolparty-1.4.0/bin/../lib/poolparty.rb:47
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
require 'mongoid'
require 'sunspot'
Mongoid.configure do |config|
config.master = Mongo::Connection.new.db("geo_near_with_boost")
end
class Hoobatz
include Mongoid::Document
field :name
@scottburton11
scottburton11 / gist:811583
Created February 4, 2011 19:17
Mongoid related scopes in inherited models - fails in RC1
class Business
include Mongoid::Document
references_many :cleanliness_ratings
...
end
class Rating
include Mongoid::Document
referenced_in :business
scope :good, :where => {:score.gte => 7}
@scottburton11
scottburton11 / gist:849632
Created March 1, 2011 18:46
MongoDB indexed range query slower?
> db.ip_blocks.find({start_address: {$lte: 1665637698}, end_address: {$gte: 1665637698}}).explain()
{
"cursor" : "BasicCursor",
"nscanned" : 3662284,
"nscannedObjects" : 3662284,
"n" : 1,
"millis" : 2645,
"indexBounds" : {
}
Paypal is generally a very poorly-designed product. It has evolved badly over the years, and today stands out as anachronistic and backward-looking compared to its competitors.
I have used PayPal as a customer, as a seller and as a developer, and I can confidently say that the experience is among the worst I've had in each category. As a professional web application developer, I would turn down any work that required me to integrated PayPal as a payment solution, and I actively warn my customers against relying on PayPal as a provider. I usually only need to explain that PayPal is expensive and difficult to integrated compared to the alternatives, but if pressed I will offer anecdotes about PayPal's awful consumer experience and customer service.
This latest interaction, which prompted this chain of customer support disasters, centers around two things: PayPal's inept user experience design, which prompts users to "Complete your purchase" on a screen that will only ever reject your purchase, and PayPal's
@scottburton11
scottburton11 / gist:1479734
Created December 15, 2011 03:43
Ember.js tree
<html>
<head>
<script src="javascripts/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/ember.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
App = Ember.Application.extend();
App.Node = Ember.Object.extend({
name: null,
<html>
<head>
<script src="javascripts/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="javascripts/ember.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
App = Ember.Application.extend();
App.Node = Ember.Object.extend({
name: null,
class GeocodesProfile
def self.for_profile(profile, geocoder = PostalGeocoder)
new(profile, geocoder).perform
end
attr_reader :profile
def initialize(profile, geocoder = PostalGeocoder)
@profile = :profile
end
@scottburton11
scottburton11 / gist:2013555
Created March 10, 2012 22:12
mongo slave replication failure
Sat Mar 10 22:11:06 [replslave] local.me Assertion failure fileNo != -1 db/rec.h 126
0x534a81 0x54163f 0x720b18 0x7290c1 0x72f52f 0x61f447 0x622b6c 0x6f8177 0x651c99 0x6530a6 0x65e1a0 0x65e6a8 0x65ee11 0x65f59a 0x83a4b0 0x7f9977e74971 0x7f997743192d
/opt/mongodb-1.6.5/bin/mongod(_ZN5mongo12sayDbContextEPKc+0xb1) [0x534a81]
/opt/mongodb-1.6.5/bin/mongod(_ZN5mongo8assertedEPKcS1_j+0x10f) [0x54163f]
/opt/mongodb-1.6.5/bin/mongod() [0x720b18]
/opt/mongodb-1.6.5/bin/mongod(_ZN5mongo11DataFileMgr6insertEPKcPKvibRKNS_11BSONElementEb+0x1051) [0x7290c1]
/opt/mongodb-1.6.5/bin/mongod(_ZN5mongo11DataFileMgr16insertWithObjModEPKcRNS_7BSONObjEb+0x5f) [0x72f52f]
/opt/mongodb-1.6.5/bin/mongod(_ZN5mongo14_updateObjectsEbPKcRKNS_7BSONObjES2_bbbRNS_7OpDebugEPNS_11RemoveSaverE+0xb77) [0x61f447]
/opt/mongodb-1.6.5/bin/mongod(_ZN5mongo13updateObjectsEPKcRKNS_7BSONObjES2_bbbRNS_7OpDebugE+0x11c) [0x622b6c]
/opt/mongodb-1.6.5/bin/mongod(_ZN5mongo7Helpers12putSingletonEPKcNS_7BSONObjE+0x107) [0x6f8177]
@scottburton11
scottburton11 / gist:3239347
Created August 2, 2012 18:21
Warden FailureApp for Devise token_authentication
class MyApp::FailureApp < Devise::FailureApp
def respond
if api_token_failure?
invalid_token
elsif api_login_failure?
invalid_credentials
else
super
end