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 CreateGenresShows < ActiveRecord::Migration | |
def self.up | |
create_table :genres_shows, :id => false do |t| | |
t.integer :show_id | |
t.integer :genre_id | |
end | |
end | |
def self.down | |
drop_table :shows_genres |
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
if(options.type == 'spy'){ | |
// May have issues with scope/context that will need investigating if they crop up | |
expectation.original_method.apply(mock, arguments); | |
} |
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
var BOSH_SERVICE = 'https://jamie-template.local/http-bind/'; | |
var connection = null; | |
function rawInput(data) | |
{ | |
console.log('RECV: ' + data); | |
} | |
function rawOutput(data) | |
{ |
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
Strophe.addConnectionPlugin('connectionmanager', { | |
pingTime: 10000, // the time in ms between each ping | |
timeoutTime: 8000, // the time in ms to wait for a ping to return | |
pingInterval: null, | |
connection: null, | |
init: function(connection) { | |
this.connection = connection; | |
}, |
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
# I would expect all of the following to return the same results | |
# Works as expected | |
Article.find(:first, :conditions => { :slug => 'blah', :published => true }) | |
# On latest beta gem errors with ArgumentError: wrong number of arguments (2 for 0..1) | |
# Works on latest github master commi | |
Article.where(:published => true).find(:first, :conditions => { :slug => 'blah' }) | |
# On latest beta gem erros with ArgumentError: wrong number of arguments (2 for 0..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
class Car | |
include Mongoid::Document | |
field :name | |
field :colour | |
key :name | |
end | |
c1 = Car.new :name => 'bob', :colour => 'red' |
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
# features/ask_a_question.feature | |
Feature: Asking a question | |
@javascript @wip | |
Scenario Outline: Using the question preview | |
Given that I am a user | |
When I go to the homepage | |
And I fill in "question_title" with "<Question Title>" | |
And I fill in "question_body" with "<Input Body>" |
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
# cucumber feature | |
Scenario: Add member to mailing list | |
Given I am on the registration page | |
When I fill in my details | |
And I check "add me to the mailing list" | |
And I press "Sign up" | |
When the account is confirmed the member should be added to the mailing list | |
Scenario: Don't add member to mailing list |
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
>> r = Company.search "teach" | |
=> [#<Company model: nil, avatar_mime_type: nil, avatar_size: nil, charity: false, address: "", permalink: "Finance/Teaching/conn-ortiz", name: "Conn-Ortiz", _keywords: ["love", "teach", "teaching", "conn", "ortiz"], avatar_uid: nil, created_at: Thu, 16 Dec 2010 11:19:33 UTC +00:00, category: "Teaching", member_id: nil, updated_at: Fri, 17 Dec 2010 16:33:30 UTC +00:00, url: "", _id: BSON::ObjectId('4d09f5c56c78035f08000027'), contact_title: "", tel: "", contact_surname: "", avatar_ext: nil, contact_forename: "", linkedin: nil, description: "We love teaching", avatar_name: nil, email: "[email protected]", sector: "Finance">] | |
>> r = Company.search "teaching" | |
=> [#<Company model: {"_id"=>BSON::ObjectId('4d09f5c56c78035f08000027'), "_keywords"=>["love", "teach", "teaching", "conn", "ortiz"], "name"=>"Conn-Ortiz", "permalink"=>"Finance/Teaching/conn-ortiz", "address"=>"", "charity"=>false, "avatar_size"=>nil, "avatar_mime_type"=>nil, "model"=>nil, "category"=>"Teaching", "created_a |
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
criteria.merge!( :_keywords => { :$in => words } ) | |
search_result = collection.map_reduce(search_map(words), search_reduce, {:query => criteria, :finalize => search_finalize}) | |
def search_reduce | |
"function( key , values ){return { model: values[0]};}" | |
end | |
def search_finalize | |
"function( key , values ){return values.model;}" |
OlderNewer