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
>> d1 = Date.new( 2006, 12, 1 ) | |
=> #<Date: 4908141/2,0,2299161> | |
>> d2 = Date.new( 2007, 1, 15 ) | |
=> #<Date: 4908231/2,0,2299161> | |
>> (d1..d2) | |
=> #<Date: 4908141/2,0,2299161>..#<Date: 4908231/2,0,2299161> | |
>> weekends = [0, 6] | |
=> [0, 6] | |
>> (d1..d2).each { |i| puts i } | |
<snip> |
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/sh | |
# A short script to bring the production database up to date. You need to | |
# run this from the application root, e.g.: | |
# | |
# ./script/update_production_database | |
# Display commands as we execute them. | |
set -x |
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
$ cd a_rails_project/ | |
$ ruby vendor/gems/skylinecms/test/unit/page_test.rb | |
vendor/gems/skylinecms/test/unit/page_test.rb:1:in `require': no such file to load -- test_helper (LoadError) | |
from vendor/gems/skylinecms/test/unit/page_test.rb:1 | |
$ ruby -r vendor/gems/skylinecms/test/test_helper vendor/gems/skylinecms/test/unit/page_test.rb | |
config.gem: Unpacked gem skylinecms in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this. | |
config.gem: Unpacked gem skylinecms in vendor/gems not in a versioned directory. Giving up. | |
/opt/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement | |
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:440:in `load_missing_constant': uninitialized constant Skyline::Sections::Interface (NameError) | |
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependenc |
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
$ rake -T | |
(in /Users/woods/src/git/vendor/skyline) | |
rake doc:generate # Generate YARD Documentation | |
rake gem:build # Build gem | |
rake gem:check_dependencies # Check that runtime and development dependencies are installed | |
rake gem:check_dependencies:development # Check that development dependencies are installed | |
rake gem:check_dependencies:runtime # Check that runtime dependencies are installed | |
rake gem:gemspec # Generate and validates gemspec | |
rake gem:gemspec:debug # Display the gemspec for debugging purposes | |
rake gem:gemspec:generate # Generates the gemspec, using version from VERSION |
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 Chapter < ActiveRecord::Base | |
validates :subdomain, | |
:presence => true, | |
:uniqueness => true, | |
:length => { :maximum => 63 } | |
validates_format_of :subdomain, :with => /^[a-z0-9-]+$/i, :message => 'can only contain letters, numbers, and dashes' | |
validates_format_of :subdomain, :without => /^-/, :message => 'can not start with a dash' | |
validates_format_of :subdomain, :without => /-$/, :message => 'can not end with a dash' | |
validates_format_of :subdomain, :without => /--/, :message => 'can not contain two consecutive dashes' | |
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
# For best results, run this file with the command: | |
# spec -c -f n karma_proxy.rb | |
require 'rubygems' | |
require 'active_support' | |
# This module provides all the client-side functionality that the web app | |
# will need to integrate with a Karma server. | |
module Karma |
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
# Create or update a particular user. | |
# | |
# PUT /users/:permalink.html | |
# PUT /users/:permalink.json | |
# PUT /users/:permalink.xml | |
# | |
# If the user does not already exist, it will be created at the given URI. | |
# If the user already exists, it will be updated. If the permalink is | |
# updated, the URI of the resource will have changed, and a Location: header | |
# will be returned with the location of the new resource. |
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
# Set up a global git ignore file in ~/.gitignore . Copy and paste these commands into a terminal. | |
echo '.DS_Store' >> ~/.gitignore | |
git config --global core.excludesfile ~/.gitignore |
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
# Rack configuration file. Used to run this app under apache/passenger. | |
require 'app' | |
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
#!/usr/bin/env ruby | |
# Query twitter for all recent tweets by West Arete Computing and write them | |
# to a JSON file. | |
require 'rubygems' | |
require 'twitter' | |
require 'active_support' | |
# The users from whom we should fetch tweets tagged with #westarete |