Skip to content

Instantly share code, notes, and snippets.

View amerine's full-sized avatar
🌅
Out West

Mark Turner amerine

🌅
Out West
View GitHub Profile
#View
<label for="searchtext">Search for a specific fighter:</label>
<%= text_field_with_auto_complete :fighter, :contains, { :size => 15 }, :skip_style => true -%>
<p>Search Results:</p>
<div id="fighter_name_results"></div>
#Controller
class ResourceController < ActionController::Base
def logger
@@logger ||= Logger.new("#{RAILS_ROOT}/log/my.log")
end
end
select au.auditstoryid, au.storyModifydate, a.authorFirstName, a.authorLastName, au.savemethod
from auditstory au
inner join authors a on au.modBy = a.authorId
where storyId = 1054 and storyModifyDate > SUBDATE(curdate(), 1)
class User
def self.highschooler
age_between(14, 18).in_school
end
end
map.resources :entries, :except => :new do |entry|
entry.resources :comments
entry.resources :votes
end
validate do |model_name|
model_name.errors.add_to_base("Type must not be blank") if model_name.template.blank?
end
if ENV['RAILS_ENV'] && !Object.const_defined?('RAILS_DEFAULT_LOGGER')
require 'logger'
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
end
Bluepill.application("app_name") do |app|
app.process("app_name") do |process|
process.start_command = "cd /u/apps/app_name/current && /usr/local/bin/unicorn_rails -c /u/apps/app_name/current/config/unicorn.conf.rb -E production -D"
process.stop_command = "kill -QUIT `cat /u/apps/app_name/current/tmp/pids/unicorn.pid`"
process.restart = "kill -USR2 `cat /u/apps/app_name/current/tmp/pids/unicorn.pid`"
process.stdout = process.stderr = "/u/apps/app_name/current/log/unicorn.log"
process.pid_file = "/u/apps/app_name/current/tmp/pids/unicorn.pid"
process.checks :mem_usage, :every => 10.seconds, :below => 250.megabytes, :times => [3, 5]
process.uid = "app"
process.gid = "app"
class Project < ActiveRecord::Base
def name
read_attribute(:name) or 'none'
end
end
class Project < ActiveRecord::Base
alias :old_read_attribute :read_attribute
def read_attribute(attr)
old_read_attribute(attr) or 'none'
end
end