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
| $(document).on 'ajax:success', '#contact_details a', (xhr, data) -> | |
| $('#contact_details').html(data.details) | |
| setupJobTagger = -> | |
| $('#job_tag_list').select2 | |
| tags: [] | |
| ajax: | |
| url: $('#job_tag_list').data('url') | |
| dataType: 'json', | |
| results: (data, page) -> |
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 | |
| @user = User.find(params[:user_id]) | |
| @stock = Stock.find_or_create_by_ticker(params[:ticker]) | |
| @user.stocks << @stock | |
| respond_with @stock | |
| end |
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
| ActiveRecord::Schema.define(version: 20131006225214) do | |
| create_table "matches", force: true do |t| | |
| t.integer "result" | |
| t.boolean "checked_out", default: false | |
| t.boolean "repeated", default: false | |
| t.boolean "planned", default: true | |
| t.integer "round" | |
| t.datetime "created_at" | |
| t.datetime "updated_at" |
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
| $ irb | |
| irb(main):001:0> require 'alchemist' | |
| => true | |
| irb(main):002:0> Alchemist.setup | |
| => [:absorbed_radiation_dose, :angles, :area, :capacitance, :distance, :dose_equivalent, :electric_charge, :electric_conductance, :electrical_impedance, :electromotive_force, :energy, :frequency, :force, :illuminance, :inductance, :information_storage, :luminous_flux, :luminous_intensity, :magnetic_flux, :magnetic_inductance, :mass, :power, :pressure, :radioactivity, :time, :volume, :density, :temperature] | |
| irb(main):003:0> 1.kb.to.b | |
| => 999.9999999999999 | |
| irb(main):004:0> 1.b.to.kb | |
| => 1.0 | |
| irb(main):005:0> 1.b.to.mb |
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
| class Product < ActiveRecord::Base | |
| def self.supplied_within_states(*states) | |
| # So you can pass either an array or a list of arguments to the method | |
| states = states.flatten(1) | |
| if states.include? 'all' | |
| scoped | |
| else | |
| # Here be dragons! - RS 2013-05-20 | |
| # Ideally this query would be much simpler - something like: |
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
| describe SeriesController do | |
| describe 'GET "create"' do | |
| subject { post :create, series: params } | |
| context 'valid parameters provided' do | |
| let(:params) { FactoryGirl.attributes_for :series } | |
| # Using expect(subject) here leads to an error: | |
| # NoMethodError: undefined method `call' for #<ActionController::TestResponse:0x007f03c4c3d470> | |
| specify { expect { subject }.to change(Series, :count).by(1) } |
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
| RSpec::Matchers.define :assign_to do |variable| | |
| chain :with do |value| | |
| @value = value | |
| end | |
| match do |response| | |
| if @value | |
| assigns[variable] == @value | |
| else | |
| assigns.has_key?(variable) |
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
| require 'spec_helper' | |
| describe GamesController do | |
| describe 'POST "create"' do | |
| subject(:response) { post :create, params } | |
| context 'valid parameters provided' do | |
| let(:params) { { game: FactoryGirl.attributes_for(:game) } } | |
| specify { expect { subject }.to change(Game, :count).by 1 } |
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
| Frenzal Rhomb - everything pre-Shut Your Mouth | |
| Jorn - everything pre-2006 (in particular, Out To Every Nation) | |
| Stratovarius - Infinite | |
| Tarot - Crows Fly Black | |
| The Living End - everything pre-White Noise | |
| Warmen - Japanese Hospitality |
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
| Capybara.register_driver :phantomjs do |app| | |
| Capybara::Selenium::Driver.new(app, browser: :phantomjs) | |
| end | |
| Capybara.javascript_driver = :phantomjs |