Skip to content

Instantly share code, notes, and snippets.

View edavis10's full-sized avatar

Eric Davis edavis10

View GitHub Profile
@edavis10
edavis10 / gist:58866
Created February 5, 2009 17:48 — forked from rails/gist:58761
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
time_ago_in_words: function(from) {
@edavis10
edavis10 / gist:59194
Created February 6, 2009 03:06 — forked from thewoolleyman/gist:47004
Example of CruiseControl.rb cruise_config.rb
#### Example of CruiseControl.rb cruise_config.rb which dynamically picks ####
#### the version of Rails to use based on CCRB project name ####
# cruise_config.rb:
require 'fileutils'
Project.configure do |project|
project.email_notifier.emails = ["chad+sandbox-ci-#{Socket.gethostname.chomp.downcase}@mycompany.com"]
require "#{File.dirname(__FILE__)}/vendor/plugins/shared_stuff/lib/cruise/mycompany_cruise_config.rb"
@edavis10
edavis10 / gist:59519
Created February 6, 2009 17:44 — forked from igal/gist:59510
### Mailer configuration from config/environments/production.rb
# Documnentation:
# * http://wiki.rubyonrails.com/rails/pages/HowToSendEmailsWithActionMailer
# * http://api.rubyonrails.org/classes/ActionMailer/Base.html
# Let MTA handle deliveries asynchronously, rather than using default synchronous SMTP
config.action_mailer.delivery_method = :sendmail
# Let MTA handle errors, do not raise exceptions
diff --git a/app/models/user.rb b/app/models/user.rb
index b35c1a8..4f8223d 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -80,6 +80,15 @@ class User < ActiveRecord::Base
super
end
+ def identity_url=(url)
+ begin
/*
* The MIT License
*
* Copyright (c) 2009 James F. Herdman
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
# Add some alias'es to FillingRequest map the attributes directly
def legal_business_name
self.company
end
def legal_business_name=(v)
self.company = v
end
def phone_number
#!/usr/bin/env ruby
#
# usage: script/server_restarter
#
# Rails autoloading, while nice in theory, frequently doesn't work. Since Rails 2.3+
# is so fast when completely reloading the server, I wrote this script to listen to the
# given directories, and kill/restart the server when any file is changed.
#
# It's quick, simple, and it reliably reloads your application when changes are made.
#
task :integrity => ['config/database.yml', 'test']
file 'config/database.yml' do
cp 'config/database.yml.sample', 'config/database.yml'
end
@edavis10
edavis10 / integrity_apache.conf
Created February 27, 2009 23:47
Apache2 / Passenger configuration for integrity
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.6
PassengerRuby /usr/local/bin/ruby
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /home/edavis/integrity/public
<Directory /home/edavis/integrity/public">
echo -e "This is a summary of disk usage on your server:\n\n `df -h`\n\nUptime: `uptime`" | mail -s "System report for `hostname` on `date`" my_email@gmail.\com