visit('/projects')
visit(post_comments_path(post))
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
heroku addons:add pgbackups --remote staging | |
heroku addons:add pgbackups --remote production | |
heroku pgbackups:capture --remote production | |
heroku pgbackups:restore DATABASE `heroku pgbackups:url --remote production` --remote staging |
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 goes in config/initializers | |
APP_CONFIG = YAML.load(File.read(File.expand_path('../../app_constants.yml', __FILE__)))[Rails.env] |
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
$ gem list | |
*** LOCAL GEMS *** | |
actionmailer (2.3.12) | |
actionpack (2.3.12) | |
activerecord (2.3.12) | |
activeresource (2.3.12) | |
activesupport (2.3.12) | |
addressable (2.2.6) |
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
gem -v = 1.8.17 | |
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. |
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 | |
gem list | cut -d" " -f1 | xargs gem uninstall -aIx |
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 | |
ifconfig -a ppp0 | grep inet | awk '{print $2}' | xargs -0 -I ip sudo route add default gw ip ppp0 |
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
# Here’s a way to do http basic authentication and tie it in | |
# to the Restful Authentication mechanism to make current_person accessible: | |
def authenticate_person | |
authenticate_or_request_with_http_basic do |login, password| | |
person = Person.authenticate(login, password) | |
return false if !person or person.nil? | |
session[:person_id] = person.id | |
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 'active_support/core_ext' | |
class YamlCompare | |
def self.compare_keys first_file_info, second_file_info, results_location | |
first_file = Hash.new | |
second_file = Hash.new | |
deltas_file = Hash.new | |
File.open( first_file_info[:file_location] ) { |yf| first_file = YAML.load( yf ) } | |
File.open( second_file_info[:file_location] ) { |yf| second_file = YAML.load( yf ) } | |
first_file[first_file_info[:root]].each_pair do |k,v| |
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 'active_support/core_ext' | |
class YamlToXml | |
def self.yaml_to_xml file_to_read, file_to_write | |
doc = String.new | |
File.open( file_to_read ) { |yf| doc << YAML.parse( yf ).transform.to_xml } | |
File.open( file_to_write, 'w' ) { |f| f.write( doc ) } | |
end | |
def self.xml_to_yaml file_to_read, file_to_write |