This file contains 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
RAILS_ROOT/app/flex/src/ | |
org/pillowfactory/models/Person.as => Add custom model behavior/properties here. | |
org/pillowfactory/models/base/PersonBase.as* => Contains properties and model helper methods. | |
org/pillowfactory/models/base/Base.as => Superclass to all generated models. | |
org/pillowfactory/models/helpers/Errors.as => Implementation of the ActiveRecord Errors class. | |
org/pillowfactory/models/helpers/Hash.as => Dynamic class with Ruby Hash-like methods. |
This file contains 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
# http://drnicutilities.rubyforge.org/map_by_method/ | |
require 'map_by_method' | |
# Dr Nic's gem inspired by | |
# http://redhanded.hobix.com/inspect/stickItInYourIrbrcMethodfinder.html | |
require 'what_methods' | |
# Pretty Print method | |
require 'pp' |
This file contains 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
# stolen from http://github.com/cschneid/irclogger/blob/master/lib/partials.rb | |
# and made a lot more robust by me | |
# this implementation uses erb by default. if you want to use any other template mechanism | |
# then replace `erb` on line 13 and line 17 with `haml` or whatever | |
module Sinatra::Partials | |
def partial(template, *args) | |
template_array = template.to_s.split('/') | |
template = template_array[0..-2].join('/') + "/_#{template_array[-1]}" | |
options = args.last.is_a?(Hash) ? args.pop : {} | |
options.merge!(:layout => false) |
This file contains 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
## Error I get when using a validates_presence_of :description in my Special model | |
durran-validatable-2.0.1/lib/validations/validation_base.rb:61:in `raise_error_if_key_is_dup': key Special/Validatable::ValidatesPresenceOf/description must be unique, provide the :key option to specify a unique key (ArgumentError) |
This file contains 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 'user_app' | |
map '/user' do | |
run UserApp | |
end |
This file contains 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
autocmd BufWritePre * :%s/\s\+$//e |
This file contains 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
# Given | |
class Business | |
attr_accessor :name, :net_worth | |
attr_accessor :line_1, :line_2, :city, :state, :zip | |
end | |
# Import with CSV Mapper | |
CsvMapper.import('path_to_file.csv') do | |
map_to Business | |
start_at_row 1 # Skip the first row (probably a header row) |
This file contains 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
function rvm_require_ruby { | |
if [ "`rvm list | grep $1`" = "" ] | |
then | |
echo "ERROR: Requires Ruby Version: $1" | |
exit | |
fi | |
} | |
function rvm_use { | |
rvm_require_ruby $1 | |
rvm use $1 |
This file contains 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
function rvm_require_ruby | |
{ | |
if ! rvm list strings | grep -q "^$1" ; then | |
echo "ERROR: Requires Ruby Version: '$1'" | |
return 1 | |
fi | |
return 0 | |
} |
This file contains 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
def possessify(word) | |
result = word.to_s.dup | |
if word.empty? | |
result | |
else | |
result.ends_with?('s') ? result << "'" : result << "'s" | |
end | |
end |
OlderNewer