Skip to content

Instantly share code, notes, and snippets.

View pol's full-sized avatar

pol llovet pol

View GitHub Profile
def test_formats_on_nested_element
@nested = { :id => 2, :name => 'Nested', :data => {:foo => ''}}
for format in [ :json, :xml ]
using_format(Person, format) do
ActiveResource::HttpMock.respond_to.get "/people/1.#{format}", {'Accept' => ActiveResource::Formats[format].mime_type}, ActiveResource::Formats[format].encode(@nested)
assert_equal @nested[:name], Person.find(1).name
end
end
end
::: in your database.yml
# stuff common to several databases
login: &login
adapter: mysql
username: fad
password: fad
host: localhost
fad_2007:
<<: *login
# returns true if the user authenticates to the LDAP server with the
# provided password
#
def ldap_authenticated?(password)
SimpleLdapAuthenticator.valid?(self.login, password)
end
def login=(value)
write_attribute :login, (value ? value.downcase : nil)
end
MAC PRO
MB: dual socket nehalem xeon
CPU: 2.66 Ghz Nehalem Xeon
MEM: 3GB 1066MHZ DDR3 ECC
HDD: 640MB 7200RPM SATA 3G/s
VID: Geforce GT 120
CDR: 18x SuperDrive
Input: Apple Mouse + Keyboard
OS: Mac OSX 10.5
CASE: Mac Pro Aluminum Case
#!/usr/bin/env ruby
# Symlink this to ~/.autotest
require 'autotest/redgreen'
# AUTOTEST_IMAGE_PATH = File.dirname(File.symlink?(__FILE__) ? File.readlink(__FILE__) : File.expand_path(__FILE__))
module Autotest::Growl
def self.growl title, msg, img, pri=0, stick=""
system "growlnotify -w -n autotest --image #{img.inspect} -p #{pri} -m #{msg.inspect} #{title.inspect} #{stick}"
end
#
# #############################################################
# # Rake
# #############################################################
#
namespace :rake do
namespace :db do
task :reset do
run("cd #{deploy_to}/current; /usr/bin/rake db:reset RAILS_ENV=production")
# The Azure Hourly Error
from Cron Daemon <root@azure.resortclosings.com>
to root@azure.resortclosings.com
date Mon, Jun 29, 2009 at 4:00 AM
subject Cron <root@azure> /root/scripts/rsnapshot-with-remount hourly
/bin/cp: will not create hard link `/backup/hourly.1/localhost/data/Completed Escrow Documents/10000-19999/10401' to directory `/backup/hourly.1/localhost/data/Completed Escrow Documents/10000-19999/10401'
----------------------------------------------------------------------------
rsnapshot encountered an error! The program was invoked with these options:
/usr/bin/rsnapshot hourly
----------------------------------------------------------------------------
# Azure Hourly Error
from Cron Daemon <root@azure.resortclosings.com>
to root@azure.resortclosings.com
date Tue, Jul 21, 2009 at 4:00 PM
subject Cron <root@azure> /root/scripts/rsnapshot-with-remount hourly
/bin/cp: will not create hard link `/backup/hourly.1/localhost/data/Completed Escrow Documents/10000-19999/10401' to directory `/backup/hourly.1/localhost/data/Completed Escrow Documents/10000-19999/10401'
----------------------------------------------------------------------------
rsnapshot encountered an error! The program was invoked with these options:
/usr/bin/rsnapshot hourly
----------------------------------------------------------------------------
# Dev/Apps Capistrano Deployment Script
# Copyright (c) 2009 Montana State University
#
# Version: 0.2
#
# FILE: deploy.mysql.rb
# This deployment file will allow a user to deploy their application code to dev.msu.montana.edu
#
# PREREQUISITES
# - capistrano gem installed (sudo gem install capistrano)
@pol
pol / gist:169250
Created August 17, 2009 17:11 — forked from irjudson/gist:163598
# Dev/Apps Capistrano Deployment Script
# Copyright (c) 2009 Montana State University
#
# Version: 0.3
#
# FILE: deploy.mysql.rb
# This deployment file will allow a user to deploy their application
# code to dev.msu.montana.edu
#
# PREREQUISITES