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
require 'spec_helper' | |
describe "HistoryItems" do | |
before(:each) {login_as :user} | |
describe "GET /history_items" do | |
it "works!" do | |
visit history_items_path | |
response.should be_success | |
end | |
end |
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
require 'benchmark' | |
require 'ohm' | |
require 'datamapper' | |
require 'dm-redis-adapter' | |
require "redis" | |
require 'json' | |
require 'mongo_mapper' | |
MongoMapper.connection = Mongo::Connection.new |
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
# HAProxy configuration - haproxy-db.cfg | |
## | |
## FRONTEND ## | |
## | |
# Load-balanced IPs for DB writes and reads | |
# | |
frontend db_write | |
bind 172.16.0.50:3306 |
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
# here's a quick recipe to run a performance test | |
# with this method, you can: | |
#-> easily choose the examples you want included from your existing specs | |
#-> define the target number of total iterations you'd like, no limit | |
#-> tune the transaction mix by specifying frequency metadata for each example | |
#-> be happy that the transaction mix is fairly homogeneous over the test interval | |
# (ideally you'd run this with acceptance (webrat/capybara) specs, but you | |
# could employ this technique for any rspec test) |
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
#include <stdio.h> | |
#include <sys/mman.h> | |
#include <assert.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <signal.h> | |
#include <unistd.h> | |
static volatile int done = 0; |
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
# This must be run from master | |
git checkout master | |
# Update our list of remotes | |
git fetch | |
git remote prune origin | |
# Remove local fully merged branches | |
git branch --merged master | grep -v 'master$' | xargs git branch -d | |
# Show remote fully merged branches | |
echo "The following remote branches are fully merged and will be removed:" | |
git branch -r --merged master | sed 's/ *origin\///' | grep -v 'master$' |
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
namespace :deploy do | |
desc "Hot-reload God configuration for the Resque worker" | |
task :reload_god_config do | |
sudo "god stop resque" | |
sudo "god load #{File.join(deploy_to, 'current', 'config', 'resque-' + rails_env + '.god')}" | |
sudo "god start resque" | |
end | |
end | |
# append to the bottom: |
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
# Inspired by https://gist.github.com/1172097 | |
alphabet = Hash[ | |
:a => "beep. beeeeep.", | |
:b => "beeeeep. beep. beep. beep.", | |
:c => "beeeeep. beep. beeeeep. beep.", | |
:d => "beeeeep. beep. beep.", | |
:e => "beep.", | |
:f => "beep. beep. beeeeep. beep.", | |
:g => "beeeeep. beeeeep. beep.", |
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
1. Use latest build | |
gem 'simple_form', :git => 'git://github.com/plataformatec/simple_form.git' | |
2. Create an initializer | |
# /config/initializers/simple_form.rb | |
# Use this setup block to configure all options available in SimpleForm. | |
SimpleForm.setup do |config| | |
# Wrappers are used by the form builder to generate a complete input. | |
# You can remove any component from the wrapper, change the order or even |
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
require 'fog' | |
require 'chef/config' | |
Chef::Config.from_file('./.chef/knife.rb') | |
EC2 = Fog::Compute.new provider: 'AWS', | |
region: Chef::Config[:knife][:region], | |
aws_access_key_id: Chef::Config[:knife][:aws_access_key_id], | |
aws_secret_access_key: Chef::Config[:knife][:aws_secret_access_key] | |
servers = EC2.servers.select { |s| s.tags["Name"] =~ /ec2\-test\-/ && s.state == "running" } |