This file contains hidden or 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
| /* | |
| * 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 |
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| ### 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 |
This file contains hidden or 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
| #### 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" |
This file contains hidden or 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
| 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) { |
This file contains hidden or 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_dependency 'users_helper' | |
| module RateUsersHelperPatch | |
| def self.included(base) # :nodoc: | |
| base.send(:include, InstanceMethods) | |
| base.class_eval do | |
| alias_method_chain :user_settings_tabs, :rate_tab | |
| end | |
| end |
This file contains hidden or 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
| # My jQuery thinking is starting to bleed into Ruby | |
| def amount_for_user(user=nil) | |
| return 0 if self.time_entries.size <= 0 | |
| return self.time_entries.select do |time_entry| | |
| user.nil? || time_entry.user == user | |
| end.collect(&:cost).compact.sum | |
| end |
This file contains hidden or 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
| ### Modified | |
| ActionController::Routing::Routes.draw do |map| | |
| # Add your own custom routes here. | |
| # The priority is based upon order of creation: first created -> highest priority. | |
| # Here's a sample route: | |
| # map.connect 'products/:id', :controller => 'catalog', :action => 'view' | |
| # Keep in mind you can assign values other than :controller and :action | |
This file contains hidden or 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 | |
| # Written by Coda Hale <[email protected]>. MIT License. Go for it. | |
| def include_pattern(filename) | |
| core = filename.gsub(/_spec/, "").gsub(/\Aspec\//, "") | |
| return Regexp.quote(core) | |
| end | |
| if ARGV.empty? || ARGV == ["--help"] || ARGV == ["-h"] | |
| STDERR.puts("Usage:") |
This file contains hidden or 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
| # 1) Point *.example.com in your DNS setup to your server. | |
| # | |
| # 2) Setup an Apache vhost to catch the star pointer: | |
| # | |
| # <VirtualHost *:80> | |
| # ServerName *.example.com | |
| # </VirtualHost> | |
| # | |
| # 3) Set the current account from the subdomain | |
| class ApplicationController < ActionController::Base |