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
$LOAD_PATH.unshift(File.dirname(__FILE__)) | |
ENV['RAILS_ENV'] ||= 'test' | |
require File.expand_path("../dummy/config/environment.rb", __FILE__) | |
require 'rspec/rails' | |
require 'rspec/autorun' | |
require 'shoulda-matchers' | |
require 'capybara/rails' | |
require 'capybara/rspec' | |
require 'database_cleaner' |
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
irb(main):001:0> my_text = '' | |
=> "" | |
irb(main):002:0> my_text += "this is a test" | |
=> "this is a test" | |
irb(main):003:0> my_text | |
=> "this is a test" | |
irb(main):004:0> my_text << " another test" | |
=> "this is a test another test" | |
irb(main):005:0> my_text | |
=> "this is a test another test" |
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 ActionView | |
module Helpers | |
module ActiveModelHelper | |
def error_messages_for(*params) | |
options = params.extract_options!.symbolize_keys | |
if object = options.delete(:object) | |
objects = Array.wrap(object) | |
else | |
objects = params.collect {|object_name| instance_variable_get("@#{object_name}") }.compact |
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
# Deploy To Heroku | |
# | |
class HerokuDeployer | |
attr_accessor :campfire_config | |
def initialize(project = nil) | |
@campfire_config = {} | |
end | |
def build_finished(build) |
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
git symbolic-ref HEAD refs/heads/my-branch-name | |
rm .git/index | |
git clean -fdx | |
touch README | |
git add . | |
git commit -m "Initial Commit" |
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
(rdb:1) text = page.find('.my-class').base.native.content | |
"5000 ms" | |
(rdb:1) text.force_encoding("UTF-8") | |
"5000 ms" | |
(rdb:1) s = "5000 ms" | |
"5000 ms" | |
(rdb:1) s.force_encoding("UTF-8") | |
"5000 ms" | |
(rdb:1) text == s | |
false |
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
# Other deploy stuff | |
begin | |
require 'tinder' | |
after "deploy", "campfire" | |
after "deploy:migrations", "campfire" | |
after "deploy:rollback", "campfire" | |
desc '[internal] Announces deployments a Campfire room.' |
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
# Project-specific configuration for CruiseControl.rb | |
Project.configure do |project| | |
# ... | |
project.campfire.config = { | |
:domain => 'SUBDOMAIN', | |
:room => 'ROOM_NAME', | |
:token => 'API_KEY', | |
:ssl => true |
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 | |
IFUP=/etc/network/if-up.d/iptables.sh | |
IFDOWN=/etc/network/if-down.d/iptables.sh | |
IPTABLES() { | |
echo iptables $@ >&1 2>&1 | |
iptables $@ | |
} | |
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 Enumerable | |
def reject_blanks | |
reject do |i| | |
i.blank? || (i.respond_to?(:values) && i.values.all?(&:blank?)) | |
end | |
end | |
end |