Skip to content

Instantly share code, notes, and snippets.

@kernow
kernow / gist:750246
Created December 21, 2010 17:24
search module
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",
@kernow
kernow / gist:832554
Created February 17, 2011 20:06
npm config
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"
@kernow
kernow / gist:840796
Created February 23, 2011 17:44
mongoose find all
var sys = require('sys')
, mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test_mongoose');
// Models
var Schema = mongoose.Schema;
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
undefined method `tables' for class `ActiveRecord::ConnectionAdapters::PostgreSQLAdapter' (NameError)
/Users/JamieD/.rvm/gems/ree-1.8.7-2010.02@specializein-template/gems/activesupport-2.3.8/lib/active_support/core_ext/module/aliasing.rb:33:in `alias_method'
/Users/JamieD/.rvm/gems/ree-1.8.7-2010.02@specializein-template/gems/activesupport-2.3.8/lib/active_support/core_ext/module/aliasing.rb:33:in `alias_method_chain'
/Users/JamieD/.rvm/gems/ree-1.8.7-2010.02@specializein-template/gems/rails_sql_views-0.8.0/lib/rails_sql_views/connection_adapters/postgresql_adapter.rb:5:in `included'
/Users/JamieD/.rvm/gems/ree-1.8.7-2010.02@specializein-template/gems/rails_sql_views-0.8.0/lib/rails_sql_views/loader.rb:12:in `include'
/Users/JamieD/.rvm/gems/ree-1.8.7-2010.02@specializein-template/gems/rails_sql_views-0.8.0/lib/rails_sql_views/loader.rb:12:in `load_extensions'
/Users/JamieD/.rvm/gems/ree-1.8.7-2010.02@specializein-template/gems/rails_sql_views-0.8.0/lib/rails_sql_views/loader.rb:10:in `class_eval'
/Users/Jami
# create a worldpay response object that acts like a string but has the each_header method
# so that we can access the headers that worldpay returns
class WorldPayResponse < String
def initialize(resp)
@resp = resp
super(resp.body)
end
class CreateUserRememberTokens < ActiveRecord::Migration
def self.up
User.all.each do |u|
u.reset_remember_token!
puts u.reload.remember_token
end
end
end
@kernow
kernow / gist:3437765
Created August 23, 2012 15:30
chef-user databag creation
#
# Cookbook Name:: user
# Recipe:: data_bag
#
# Copyright 2011, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
<?xml version="1.0" encoding="UTF-8"?>
<theDavidBox>
<request>
<arg0>check_database</arg0>
<arg1>smb://[foo=bar]GIGANTO/Video</arg1>
<module>metadata_database</module>
</request>
<response>
<database_path>/share/nmj_database_1/media.db</database_path>
</response>
config.middleware.insert_after Warden::Manager, Dragonfly::Middleware, :reports
config.middleware.insert_after Rack::Cache, Dragonfly::Middleware, :images