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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'thor' | |
require 'chef' | |
require 'chef/node' | |
require 'chef/rest' | |
# Please see the readme for overview documentation. | |
# |
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
$ ack \(Given\|When\|Then\) features/step_definitions | |
features/step_definitions/admin_steps.rb | |
3:Given /^I signed up as an admin with "(.*)\/(.*)"$/ do |email, password| | |
10:Given /^I signed up as an admin who cannot publish deals with "(.*)\/(.*)"$/ do |email, password| | |
20:Then /^I should see the admin index page$/ do | |
24:Then /^I should see a user named "(.*)"$/ do |name| | |
features/step_definitions/clearance_steps.rb | |
3:Then /^I should see error messages$/ do |
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
-module(packer). | |
-export([pack/1, test/0]). | |
pack(Data) -> | |
pack(Data, []). | |
test() -> | |
[[a, a, a], [b, b, b]] = packer:pack([a,a,a,b,b,b]), | |
[[a,a,a,a], [b], [c, c], [a, a], [d], [e, e, e, e]] = packer:pack([a,a,a,a,b,c,c,a,a,d,e,e,e,e]), |
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 'mongo' | |
require 'mongo_record' | |
require 'memcached' | |
MongoRecord::Base.connection = | |
Mongo::Connection.new("75.101.206.153").db('trader_network_trois') | |
$cache = Memcached.new("localhost:11211") | |
class ItemOfInterest < MongoRecord::Base |
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 'rubygems' | |
require 'json' | |
require 'typhoeus' | |
require 'net/http' | |
class CouchDB | |
include Typhoeus | |
remote_defaults :on_success => lambda {|response| JSON.parse(response.body)}, | |
:on_failure => lambda {|response| puts "error code: #{response.code}"}, | |
:base_uri => "http://127.0.0.1:5984/couch-test-db" |
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 'rubygems' | |
require 'rufus/tokyo' | |
t = Rufus::Tokyo::Table.new('table.tct') | |
t['pk0'] = { 'name' => 'alfred', 'age' => '22' } | |
t['pk1'] = { 'name' => 'bob', 'age' => '18' } | |
t['pk2'] = { 'name' => 'charly', 'age' => '45', 'foos' => {'bat' => 2} } | |
t['pk3'] = { 'name' => 'doug', 'age' => '77' } | |
t['pk4'] = { 'name' => 'ephrem', 'age' => '32', 'foos' => {'bar' => 1, 'bat' => 2, 'bam' => 3 } } |
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
# First, you don't have to fret about the word at the beginning-- you can use | |
# any of them at any time. Given, When or Then, it doesn't really matter. | |
# | |
# Second, webrat doesn't do JavaScript. If we reference AJAX interfaces | |
# directly, we can do that, but the binding will be performed manually by Jim. | |
# If we find ourselves constantly doing that, we should look into expanding | |
# testing support to JavaScript as well. | |
# | |
# Third, you should feel free, rather than constrained, when you are writing | |
# Cucumber. It's the development job to polish and flesh out when we don't |
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
namespace(:cookbooks) do | |
# | |
# This rake script enables merging in public "cookbooks" from | |
# opscode into your local "chef-repo" | |
# | |
# generating per-cookbook branches takes a while. run this task on | |
# your opscode cookbooks git clone and you'll end up with a zillion | |
# branches with one cookbook per branch | |
# | |
# if you like just skip to "option #2" below to play around with this. |
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 'rubygems' | |
require 'eventmachine' | |
require 'socket' | |
module RPCServer | |
include EM::P::ObjectProtocol | |
def post_init | |
@obj = Hash.new | |
end | |
def receive_object method |