This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def create | |
| if @confirmation.save | |
| OrderMailer.delay.order_notification(@order) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /Users/idhorat/.rvm/gems/ruby-1.9.3-p362@chow/gems/better_errors-0.3.2/lib/better_errors/core_ext/exception.rb:9: [BUG] Segmentation fault | |
| ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-darwin11.4.2] | |
| -- Control frame information ----------------------------------------------- | |
| c:0061 p:---- s:0194 b:0194 l:000193 d:000193 CFUNC :callers | |
| c:0060 p:0072 s:0191 b:0191 l:000fc0 d:000950 LAMBDA /Users/idhorat/.rvm/gems/ruby-1.9.3-p362@chow/gems/better_errors-0.3.2/lib/better_errors/core_ext/exception.rb:9 | |
| c:0059 p:---- s:0188 b:0188 l:000187 d:000187 FINISH | |
| c:0058 p:---- s:0186 b:0186 l:000185 d:000185 CFUNC :new | |
| c:0057 p:---- s:0184 b:0184 l:000183 d:000183 CFUNC :require | |
| c:0056 p:0012 s:0180 b:0180 l:000c08 d:000158 BLOCK /Users/idhorat/.rvm/gems/ruby-1.9.3-p362@chow/gems/activesupport-3.2.9/lib/active_support/dependencies.rb:251 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Running: rake assets:precompile | |
| rake aborted! | |
| undefined method `match' for nil:NilClass | |
| /tmp/build_pz2syblot4iq/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.23/lib/mongoid/sessions/mongo_uri.rb:49:in `initialize' | |
| /tmp/build_pz2syblot4iq/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.23/lib/mongoid/sessions/factory.rb:103:in `new' | |
| /tmp/build_pz2syblot4iq/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.23/lib/mongoid/sessions/factory.rb:103:in `parse' | |
| /tmp/build_pz2syblot4iq/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.23/lib/mongoid/sessions/factory.rb:62:in `create_session' | |
| /tmp/build_pz2syblot4iq/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.23/lib/mongoid/sessions/factory.rb:43:in `default' | |
| /tmp/build_pz2syblot4iq/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.23/lib/mongoid/sessions.rb:109:in `default' | |
| /tmp/build_pz2syblot4iq/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.23/lib/mongoid.rb:124:in `default_session' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # run rails c test | |
| require 'capybara/dsl' | |
| Capybara.app = app.instance_variable_get("@app") | |
| cap = Object.new.instance_eval { extend Capybara::DSL; self } | |
| cap.visit '/' | |
| cap.page.find 'tr' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random, pylab | |
| #set line width | |
| pylab.rcParams['lines.linewidth'] = 6 | |
| #set font size for titles | |
| pylab.rcParams['axes.titlesize'] = 20 | |
| #set font size for labels on axes | |
| pylab.rcParams['axes.labelsize'] = 20 | |
| #set size of numbers on x-axis | |
| pylab.rcParams['xtick.major.size'] = 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime | |
| from flask import url_for | |
| from dashboard import db | |
| class Page(db.Document): | |
| title = db.StringField(max_length=100, required=True) | |
| slug = db.StringField(max_length=100, required=True) | |
| parent = db.StringField(max_length=100, required=False, default='') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Place holder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| def noReplacementSimulation(numTrials): | |
| ''' | |
| Runs numTrials trials of a Monte Carlo simulation | |
| of drawing 3 balls out of a bucket containing | |
| 3 red and 3 green balls. Balls are not replaced once | |
| drawn. Returns the a decimal - the fraction of times 3 | |
| balls of the same color were drawn. | |
| ''' | |
| count_matches = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def collision_prob(numIndices, numInsertions): | |
| ''' | |
| Given the number of buckets and the number of items to insert, | |
| calculates the probability of a collision. | |
| ''' | |
| prob = 1.0 | |
| for i in range(1, numInsertions): | |
| prob = prob * ((numIndices - i) / float(numIndices)) | |
| return 1 - prob |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask | |
| app = Flask(__name__) |