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 |
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 '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
-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
$ 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
#!/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
# Bash snippet to open new shells in most recently visited dir. | |
# Useful if you want to open a new terminal tab at the present | |
# tab's location. | |
# | |
# Put this in your .bashrc or whatever. | |
pathed_cd () { | |
if [ "$1" == "" ]; then | |
cd | |
else |
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
Host ec2*compute-1.amazonaws.com | |
User some_user | |
StrictHostKeyChecking no | |
Host my_chef_instance | |
User some_user | |
Hostname ec2-xx-xx-xx-xx.compute-1.amazonaws.com | |
StrictHostKeyChecking no | |
LocalForward 8443 localhost:443 |
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
<%= branch = `git symbolic-ref HEAD`.gsub('refs/heads/', '').chomp.gsub('/', '_') %> | |
login: &login | |
adapter: mysql | |
username: root | |
password: xxxxxxxxxxxxxx | |
host: localhost | |
socket: /opt/local/var/run/mysql5/mysqld.sock | |
development: |
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
config.action_controller.asset_host = Proc.new do |source, request| | |
non_ssl_host = "http://asset#{source.hash % 4}.backpackit.com" | |
ssl_host = "https://asset1.backpackit.com" | |
if request.ssl? | |
case | |
when source =~ /\.js$/ | |
ssl_host | |
when request.headers["USER_AGENT"] =~ /(Safari)/ | |
non_ssl_host |