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
var util = require('util'), | |
EventEmitter = require('events').EventEmitter; | |
var Server = function() { | |
var self = this; | |
this.on('custom_event', function() { | |
self.logSomething('custom_event'); | |
}); |
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
## Prepare ################################################################### | |
# Remove RVM | |
rvm implode | |
# Ensure your homebrew is working properly and up to date | |
brew doctor | |
brew update | |
## Install ################################################################### |
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
# You can name your captured matches and ruby will create local variables for you automatically. | |
# The regex is on Rubular at http://rubular.com/r/HJbhamKAib | |
$ irb | |
1.9.3p0 :001 > s = "Foo Bar Bas <foo@bar.com>" | |
"Foo Bar Bas <foo@bar.com>" | |
1.9.3p0 :002 > /(?<label>.*) <(?<email>[^>]*)/ =~ s | |
0 |
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
#!/bin/bash | |
COOKIE_JAR="ab-cookie-jar" | |
COOKIE_NAME="_myapp_session" | |
USERNAME="foo@bar.com" | |
PASSWORD="password" | |
LOGIN_PAGE_URI="http://localhost:3000/users/sign_in" | |
TEST_PAGE_URI="http://localhost:3000/dashboard" | |
echo "Logging in and storing session id." |
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
# Configure Rack middleware | |
config.middleware.insert_before 0, 'WwwRedirect' |
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
This is a sample contributor's license agreemenet |
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.middleware.insert_before(0, 'Rack::SeoRedirect') |
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.around do |example| | |
ActiveRecord::Base.transaction do | |
example.run | |
raise ActiveRecord::Rollback | |
end | |
end |
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 'rspec/core/formatters/progress_formatter' | |
# Custom RSpec formatter that speaks aloud using the say command, if available. | |
# Not to be taken too seriously, but fun for annoying your coworkers. | |
# Usage: bundle exec rspec -r ./say_formatter.rb -f SayFormatter spec | |
class SayFormatter < RSpec::Core::Formatters::ProgressFormatter | |
VOICES = %w[Agnes Albert Alex Bad\ News Bahh Bells Boing Bruce Bubbles Cellos | |
Deranged Fred Good\ News Hysterical Junior Kathy Pipe\ Organ | |
Princess Ralph Trinoids Vicki Victoria Whisper Zarvox] |
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
# Disallow site indexing in non-production environments | |
config.middleware.insert_before(::Rack::Lock, '::Rack::Robots') |
NewerOlder