This file contains 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
# app/controllers/api_controller.rb | |
class ApiController < ApplicationController | |
skip_before_action :verify_authenticity_token | |
respond_to :json | |
rescue_from UserAuthenticationService::NotAuthorized, with: :not_authorized | |
rescue_from ActiveRecord::RecordNotFound, with: :not_found | |
before_filter :api_session_token_authenticate! | |
private |
This file has been truncated, but you can view the full file.
This file contains 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/jnh/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.5/lib/rspec/core/memoized_helpers.rb:199: [BUG] Segmentation fault at 0x007fff51ad3fd8 | |
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0] | |
-- Crash Report log information -------------------------------------------- | |
See Crash Report log file under the one of following: | |
* ~/Library/Logs/CrashReporter | |
* /Library/Logs/CrashReporter | |
* ~/Library/Logs/DiagnosticReports | |
* /Library/Logs/DiagnosticReports | |
for more details. |
This file contains 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
class MrDarcy | |
class Context | |
class << self | |
def role role_name, &block | |
role_name = role_name.to_sym | |
roles[role_name] = Module.new(&block) | |
role_name |
This file contains 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
lame -V 6 --tt 'Do Podcast: Show 4, Ruby 2.1' --tg 0xc --ta 'Do Podcast' --ty 2013 --tc 'http://dopodcast.org' --ti '~/Dev/dopodcast/dopocast.github.io/source/images/ruby-latte-rss.jpg' 'Do Podcast - Show 4.wav' show_4_ruby21.mp3 |
This file contains 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
[1] pry(main)> project = Fabricate(:project_with_attachments) | |
=> #<Project _id: Lo2ekuTh, created_at: 2013-12-18 04:28:41 UTC, updated_at: 2013-12-18 04:28:41 UTC, design: "design.brd", top_image: "i.png", bottom_image: "i.png", user_id: nil, upload_id: nil, license_id: nil, parent_project_id: nil, name: "Aliquam molestias id.", description: "Vel accusamus reiciendis officia voluptate.\nSed nihil sequi.", short_description: nil, notes: nil, version: nil, state: "CREATING", price: "3.9", email: "[email protected]", width_in_mils: 1024, height_in_mils: 768, pcb_layers: 2, shared_at: nil, share_setup_state: nil> | |
[2] pry(main)> project.layers.size | |
=> 8 | |
MOPED: 127.0.0.1:27017 COMMAND database=admin command={:ismaster=>1} (1.3313ms) | |
MOPED: 127.0.0.1:27017 INSERT database=playground_development collection=projects documents=[{"state"=>"CREATING", "price"=>"3.9", "width_in_mils"=>1024, "height_in_mils"=>768, "pcb_layers"=>2, "name"=>"Aliquam molestias id.", "description"=>"Vel accusamus reiciendis of |
This file contains 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
puts "Trying Ruby #{RUBY_DESCRIPTION}" | |
eval <<-'EOF' | |
proc do | |
puts "hello" | |
rescue Exception => e | |
puts "Exception #{e}" | |
ensure | |
puts "goodbye" | |
end |
This file contains 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
require 'spec_helper' | |
describe WidgetController do | |
subject { query; response } | |
describe '#index' do | |
let(:query) { get :index, format: :json } | |
context "when there are widgets available" do | |
before { Fabricate(:available_widget) } |
This file contains 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
Feature: New users can register and confirm accounts | |
Scenario: A new user registers for our service | |
Given I am on the home page | |
When I select "Register" from the nav | |
And I submit my details | |
Then I should see the thank you page | |
And I should receive a confirmation email | |
Scenario: The new user correctly pastes their confirmation code |
This file contains 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
isMultipleOf = (n)-> | |
(order)-> | |
order.get('quantity') % n == 0 | |
max = (accumulator, item)-> | |
accumulator = item if item > accumulator | |
accumulator | |
isGtZero = (quantity)-> | |
quantity > 0 |
This file contains 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 send_status_email | |
# Sometimes a whole bunch of emails will be queued in quick-succession. | |
# This is to stop them all being sent to the customer. It deletes any | |
# jobs queued to send this email, and then queues another to happen in | |
# 1 minute. | |
applicable_job = proc do |job| | |
job.klass == 'CartNotifierWorker' && job.args == ['cart_status_changed', self.id] | |
end | |
Sidekiq::ScheduledSet.new.select(&applicable_job).map(&:delete) | |
CartNotifierWorker.perform_in(60.seconds, :cart_status_changed, self.id) if user? |