requirements
- Rails 3.2.1
- column stored as date
- date entered as text
- blank/null date allowed
- validated on input
- formatted for display
- using decorator/presenter (i.e. draper)
class ActiveRecord::LogSubscriber | |
def sql_with_filtering(event) | |
return if 'CACHE' == event.payload[:name] | |
sql_without_filtering(event) | |
end | |
alias_method_chain :sql, :filtering | |
end |
export ORIGINAL_GIT=`which git` | |
export ORIGINAL_HG=`which hg` | |
git() { | |
if [ -d .hg ]; then | |
echo "perhaps you meant hg?" | |
"$ORIGINAL_HG" $@ | |
else | |
"$ORIGINAL_GIT" $@ | |
fi |
class FormsController < ApplicationController | |
def index | |
respond_to do |format| | |
format.html {render template: "shared/backbone", locals: {preloaded: {forms: all_forms}}} | |
format.json {render json: all_forms} | |
end | |
end | |
private |
class Chef | |
class Resource | |
class Deploy < Chef::Resource | |
def on_start(arg=nil, &block) | |
arg ||= block | |
set_or_return(:on_start, arg, :kind_of => [Proc, String]) | |
end | |
def on_complete(arg=nil, &block) | |
arg ||= block |
Mar 21, 2012 9:05:20 PM org.apache.commons.httpclient.HttpConnection releaseConnection | |
FINE: Releasing connection back to connection manager. | |
Mar 21, 2012 9:05:20 PM org.apache.commons.httpclient.HttpConnection releaseConnection | |
FINEST: enter HttpConnection.releaseConnection() | |
Mar 21, 2012 9:05:20 PM org.apache.commons.httpclient.HttpConnection isResponseAvailable | |
FINEST: enter HttpConnection.isResponseAvailable() | |
Mar 21, 2012 9:05:20 PM org.apache.commons.httpclient.HttpMethodBase shouldCloseConnection | |
FINE: Should NOT close connection in response to directive: keep-alive | |
Mar 21, 2012 9:05:20 PM org.apache.commons.httpclient.HttpMethodBase canResponseHaveBody | |
FINEST: enter HttpMethodBase.canResponseHaveBody(int) |
#!/usr/bin/env ruby -w | |
require 'digest/md5' | |
def if_changed(filename) | |
last_digest_filename = ".#{filename.gsub('/', '_')}" | |
last_digest = File.read(last_digest_filename) rescue "" | |
current_digest = Digest::MD5.hexdigest(File.read(filename)) | |
unless last_digest.eql? current_digest | |
yield |
requirements
module M1 | |
def fumullins | |
p "M1#fumullins" | |
end | |
end | |
module M2 | |
def fumullins | |
p "M2#fumullins" | |
super |
module SomeHelper | |
def text_field(object_name, method, options = {}) | |
options[:readonly] = @readonly | |
super(object_name, method, options) | |
end | |
end |
group :test, :development do | |
gem 'sqlite3' | |
gem 'rspec-rails' | |
gem 'turnip', :git => "https://github.com/jnicklas/turnip.git" | |
gem 'capybara' | |
gem 'database_cleaner' | |
gem 'guard-rspec' | |
gem 'guard-spork' | |
gem 'spork', '0.9.0.rc9' | |
gem 'guard-jasmine' |