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
SELECT | |
`archive_messages`.`id` AS `id`, | |
`archive_messages`.`body` AS `body`, | |
`archive_messages`.`utc` AS `created_at`, | |
`users`.id AS `user_id`, | |
`questions`.id AS `question_id` | |
FROM | |
archive_collections | |
INNER JOIN archive_messages | |
ON archive_collections.id = archive_messages.coll_id |
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 sys = require('sys') | |
, mongoose = require('mongoose'); | |
mongoose.connect('mongodb://localhost/test_mongoose'); | |
// Models | |
var Schema = mongoose.Schema; |
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
npm config ls | |
;_exit = ---sekretz--- | |
auto-activate = "always" | |
auto-deactivate = true | |
binroot = "/Users/JamieD/.node/bin" | |
browser = "open" | |
color = true | |
description = true | |
dev = false | |
dotnpm = ".npm" |
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
module Noodall | |
module Search | |
STOPWORDS = ["about", "above", "above", "across", "after", "afterwards", "again", "against", "all", "almost", "alone", "along", "already", "also", "although", "always", "among", "amongst", "amoungst", "amount", "and", "another", "any", "anyhow", "anyone", "anything", "anyway", "anywhere", "are", "around", "back", "became", "because", "become", "becomes", "becoming", "been", "before", "beforehand", "behind", "being", "below", "beside", "besides", "between", "beyond", "bill", "both", "bottom", "but", "call", "can", "cannot", "cant", "con", "could", "couldnt", "cry", "describe", "detail", "done", "down", "due", "during", "each", "eight", "either", "eleven", "else", "elsewhere", "empty", "enough", "etc", "even", "ever", "every", "everyone", "everything", "everywhere", "except", "few", "fifteen", "fify", "fill", "find", "fire", "first", "five", "for", "former", "formerly", "forty", "found", "four", "from", "front", "full", "further", "get", "give", "had", "has", "hasnt", "have", |
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;}" |
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
# 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
# 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
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
# 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) |