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 | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the branch/status of the current git repository | |
# * the branch of the current subversion repository | |
# * the return value of the previous command | |
# | |
# USAGE: |
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
=========================================================================== | |
Without Magic: | |
Server Software: Apache/2.2.10 | |
Server Hostname: trailspace.local | |
Server Port: 80 | |
Document Path: /member/album_test | |
Document Length: 287 bytes | |
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
# | |
# Autotest.send(:alias_method, :real_make_test_cmd, :make_test_cmd) | |
# Autotest.send(:define_method, :make_test_cmd) do |*args| | |
# real_make_test_cmd(*args).sub('test/unit', %[rubygems -e "require 'redgreen'"]) | |
# end | |
# | |
# | |
# module Autotest::Growl | |
# def self.growl title, msg, img, pri=0, stick="" | |
# system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{stick}" |
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
Feature: Session management | |
In order to access the back end of the site, | |
the Admins and Editors | |
want to be able to log in and log out. | |
Scenario: Successful admin log in | |
Given there is a user named "admin" with password "admin" | |
And I am on the log in page | |
When I fill in "Login" with "admin" | |
And I fill in "Password" with "admin" |
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 | |
# Example script to demonstrate how to detect a version number from a | |
# capistrano deployment using git. Presumes that we can use the git command | |
# on the current working directory. | |
# | |
# A better strategy is probably to just write the tag or commit to a file | |
# during the capistrano deployment. | |
# Capistrano leaves a REVISION file in the Rails root with the checksum of |
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
[Fri Mar 20 08:39:05 2009] [notice] Apache/2.2.3 (CentOS) configured -- resuming normal operations | |
Error during failsafe response: closed stream | |
*** Exception NoMethodError in application (undefined method `[]=' for nil:NilClass) (process 4980): | |
from /var/www/passenger/lib/phusion_passenger/rack/request_handler.rb:68:in `process_request' | |
from /var/www/passenger/lib/phusion_passenger/abstract_request_handler.rb:197:in `main_loop' | |
from /var/www/passenger/lib/phusion_passenger/railz/application_spawner.rb:340:in `start_request_handler' | |
from /var/www/passenger/lib/phusion_passenger/railz/application_spawner.rb:298:in `handle_spawn_application' | |
from /var/www/passenger/lib/phusion_passenger/utils.rb:176:in `safe_fork' | |
from /var/www/passenger/lib/phusion_passenger/railz/application_spawner.rb:296:in `handle_spawn_application' | |
from /var/www/passenger/lib/phusion_passenger/abstract_server.rb:332:in `__send__' |
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 | |
# | |
# A complete URL-shortening web application, written in Ruby/Sinatra. Run it | |
# from the command line, and then visit http://localhost:4567/ | |
# | |
# Or to run it under apache/passenger, you'll need a config.ru file with the | |
# following contents: | |
# | |
# require 'tinyurl' | |
# run Sinatra::Application |
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
# Return the chronological age of the subject at the time of the test's | |
# administration as a 2-element array of years and months. | |
# | |
# If the day component of the subject's age is more than 15 days, then the | |
# month is rounded upwards. | |
def chronological_age | |
return nil if subject.nil? || subject.date_of_birth.nil? || date_of_administration.nil? | |
age_years, age_months, age_days = age(subject.date_of_birth, date_of_administration) | |
# Round up if they're more than halfway through the month. |
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
# Return as a three-element array the number of years, months, and days | |
# between the two given dates. | |
# | |
# Time is counted from the "from" date, in the order of years, | |
# months, and days. This order is significant since leap years will | |
# pass unnoticed if they are "absorbed" by a year or month | |
# calculation. For example, 2007 to 2008 is a year and February 15th | |
# to March 15th is a month, whether they include a leap day or not. | |
# However, the leap year is observed properly if it occurs within the | |
# days portion of the calculation. For example February 20th to March |
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
class Thing | |
# The number of instances of this class that are currently in existence. | |
@@count = 0 | |
# Print out how many thing there are. | |
def self.print_count | |
puts "There are now #{@@count} things." | |
end | |
OlderNewer