Skip to content

Instantly share code, notes, and snippets.

[11] pry(#<ProbablyWorthWatching::FindsVideosFilter>)> Http.with_follow(true).get("http://t.co/CN60RkMG").response
=> #<HTTP/1.1 200 OK @headers={"Server"=>"nginx", "Date"=>"Fri, 01 Feb 2013 22:59:53 GMT", "Content-Type"=>"text/html; charset=UTF-8", "Transfer-Encoding"=>"chunked", "Connection"=>"keep-alive", "Expires"=>"Fri, 01 Feb 2013 23:39:05 GMT", "X-Ua-Compatible"=>"IE=EmulateIE9,chrome=1", "Vary"=>"User-Agent,Accept-Encoding", "X-Frame-Options"=>"SAMEORIGIN", "X-Dns-Prefetch-Control"=>"on", "X-Varnish"=>"68307248 67584637", "Age"=>"1248", "Via"=>"1.1 varnish", "X-Varnish-Cache"=>"1", "X-Vserver"=>"10.90.128.188", "Cache-Control"=>"no-store, no-cache, must-revalidate, post-check=0, pre-check=0"}>
@knewter
knewter / npm-debug.log
Created November 4, 2012 21:19
yeoman install fails?
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'yeoman',
1 verbose cli '-g' ]
2 info using [email protected]
3 info using [email protected]
4 verbose read json /usr/local/lib/package.json
5 verbose read json /usr/local/lib/package.json

Server Setup

Derived from this link

The main difference is that this configuration supports rails 3.2.

To set up a server, do the following as root:

echo '--- Install system packages ---'

$ wget http://mayhemstaging.lemirror.com/system/imported.sh.gz ; gzip -d imported.sh.gz ; sh ./imported.sh
--2012-09-25 15:03:02-- http://mayhemstaging.lemirror.com/system/imported.sh.gz
Resolving mayhemstaging.lemirror.com (mayhemstaging.lemirror.com)... 50.116.16.82
Connecting to mayhemstaging.lemirror.com (mayhemstaging.lemirror.com)|50.116.16.82|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16193241 (15M) [application/octet-stream]
Saving to: `imported.sh.gz'
100%[========================================================================================================================================================================================================================================>] 16,193,241 679K/s in 34s
@knewter
knewter / gist:3764780
Created September 22, 2012 01:18
THIS IS WHY ISOLATION
$ time rake test
/home/jadams/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -I"lib:test" -I"/home/jadams/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib" "/home/jadams/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/integration/canvas_stack_stitcher_printing_test.rb" "test/integration/canvas_stitching_test.rb" "test/unit/canvas_stack_stitcher_test.rb" "test/unit/canvas_layer_test.rb" "test/unit/canvas_printer_test.rb" "test/unit/canvas_test.rb" "test/unit/canvas_creator_test.rb" "test/unit/canvas_stitcher_test.rb" "test/unit/canvas_stack_test.rb"
Run options: --seed 42824
# Running tests:
..........................
Finished tests in 0.010393s, 2501.7495 tests/s, 4811.0568 assertions/s.
(3.2ms) SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "interactions" WHERE "interactions"."ip_address" ILIKE '%127.0.0.1%' LIMIT 30 OFFSET 0) subquery_for_count
PG::Error: ERROR: operator does not exist: inet ~~* unknown
LINE 1: ..."interactions" WHERE "interactions"."ip_address" ILIKE '%12...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
: SELECT COUNT(count_column) FROM (SELECT 1 AS count_column FROM "interactions" WHERE "interactions"."ip_address" ILIKE '%127.0.0.1%' LIMIT 30 OFFSET 0) subquery_for_count
Rendered /home/jadams/.rvm/gems/ruby-1.9.3-p194@learning_earnings/gems/activeadmin-0.5.0/app/views/active_admin/resource/index.html.arb (338.4ms)
Completed 500 Internal Server Error in 366ms
ActionView::Template::Error (PG::Error: ERROR: operator does not exist: inet ~~* unknown
class DeliverRewardsCommandsController < LoggedInController
# FIXME: Needs to reject non teacher/schooladmins
def create
reward_deliveries = RewardDelivery.find(params[:reward_deliveries])
command = DeliverRewardsCommand.new reward_deliveries: reward_deliveries
command.on_success = method(:on_success)
command.execute!
end
def on_success
@knewter
knewter / macro_reflection_relation_facade.rb
Created September 8, 2012 01:10
MacroReflection-esque ActiveRecord::Relation does what now?
class MacroReflectionRelationFacade < SimpleDelegator
def initialize(proxied)
super(proxied)
end
def target
self
end
end
@knewter
knewter / gist:3565125
Created September 1, 2012 06:02
quickie explanation of #method
class Foo
def initialize baz
@baz = baz
end
def bar
puts @baz
end
@knewter
knewter / food_fight_play_comands_controller.rb
Created August 31, 2012 23:52
command controller with a callback style
class FoodFightPlayCommandsController < LoggedInController
def create
command = FoodFightPlayCommand.new(params[:food_fight_play_command])
command.person_id = current_person.id
# Set up success / failure callbacks
command.on_success = method(:on_success)
command.on_failure = method(:on_failure)
command.execute!
end