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
This plugin for Merb and Rails provides a simple and extremely flexible way to upload files. | |
ORM Support: ActiveRecord, DataMapper, Sequel, MongoMapper | |
Storage Support: S3, MongoDB's GridFS, filesystem... | |
Oh yeah and works with RMagick, ImageScience, MiniMagic | |
http://github.com/jnicklas/carrierwave/ |
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
<%= f.select(:role_id, options_from_collection_for_select(@roles, "id", "to_s"), {:include_blank => true, :selected => nil}) %> |
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 38 columns, instead of 29 in line 1.
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
"Funding USD",,,,"Uncommitted Pledges USD",,,,, Donor,,,,,,,Channel,,,Description,,,,,,,,,,,,,,,,,, | |
Abbott Laboratories,,,,,,,Bilateral (to affected government),,,In-kind: Donations of medicines and nutritional products,,,,,,,,"1,000,000",,,,,0,,,,, | |
,,,,,,,,,ADRA-Haiti,,,,,,,ADRA-Haiti,,,Emergency assistance,,,,,,,,"809,281",,,,,0,,,,, | |
,,,,,,Advent Software,,,,,,,PIH,,,Humanitarian assistance,,,,,,,,0,,,,,"25,000",,,,, | |
Air Products,,,,,,,American RC,,,Humanitarian assistance,,,,,,,,0,,,,,"25,000",, | |
Albanian Red Cross,,,,,,,IFRC,,,for victims of earthquake in Haiti; for the emergency appeal of the International Federation of Red Cross and Red Crescent Societies,,,,,,,,"15,000",,,,,0,, | |
Alcoa Foundation,,,,,,,American RC,,,Assist the victims of Haitis devastating earthquake,,,,,,,,0,,,,,"100,000",, | |
Alcon Laboratories,,,,,,,NGOs,,,"in-kind: $1 million worth of eye drops and eye-related antibiotics and ointments: in partnership with Project Hope, AmeriCares, Direct Relief International and Heart to Heart",,,,,,,,0 |
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 'ruby-debug'; Debugger.start; Debugger.settings[:autoeval] = 1; Debugger.settings[:autolist] = 1; debugger |
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
# these are the athlete ids | |
>> r.unit.stats.last.data.keys | |
# => ["4070026", "4070245", "4070246", "4070190", "4070104", "4070191", "4070105", "4070050", "4070027", "4070192", "4070106", "4070051", "4070028", "4070270", "4070107", "4070052", "4070029", "4070271", "4070131", "4070108", "4070053", "4070272", "4070210", "4070132", "4070109", "4070054", "4070273", "4070096", "4070211", "4070133", "4070055", "4070097", "4070212", "4070134", "4070056", "4070098", "4070213", "4070135", "4070057", "4070177", "4070099", "4070136", "4070058", "4070080", "4070178", "4070059", "4070081", "4070179", "4070214", "4070082", "4070215", "4070137", "4070160", "4070020", "4070216", "4070138", "4070161", "4070258", "4070083", "4070021", "4070240", "4070217", "4070139", "4070162", "4070084", "4070259", "4070163", "4070218", "4070022", "4070100", "4070085", "4070242", "4070023", "4070101", "4070164", "4070219", "4070243", "4070024", "4070102", "4070165", "4070244", "4070025", "4070103", "4070166"] | |
# here's the full data for a give |
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 'rubygems' | |
require 'pp' | |
unless self.class.const_defined? "IRB_RC_HAS_LOADED" | |
begin # db connection helpers | |
def some_db | |
ActiveRecord::Base.establish_connection(:adapter => 'mysql', :username => 'root', :database => 'some_database') | |
end | |
def prod_db | |
ActiveRecord::Base.establish_connection(:adapter => 'mysql', :username => 'root', :database => 'app_production') |
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
>> m = {:fn=>"Mark Wunsch", :title=>["Front End Engineer at Scripps Networks"], :n=>{:family_name=>["Wunsch"], :given_name=>["Mark"]}, :adr=>[{:locality=>["Greater New York City Area"]}]} | |
# => {:fn=>"Mark Wunsch", :adr=>[{:locality=>["Greater New York City Area"]}], :n=>{:family_name=>["Wunsch"], :given_name=>["Mark"]}, :title=>["Front End Engineer at Scripps Networks"]} | |
>> m.class | |
# => Hash | |
>> m.to_yaml | |
# => "--- \n:fn: Mark Wunsch\n:adr: \n- :locality: \n - Greater New York City Area\n:n: \n :family_name: \n - Wunsch\n :given_name: \n - Mark\n:title: \n- Front End Engineer at Scripps Networks\n" | |
$ ruby -v |
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
class Form | |
include MongoMapper::Document | |
key :fields, Hash | |
# ... | |
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
class Field | |
include MongoMapper::EmbeddedDocument | |
key :name, String | |
key :label, String, :required => true | |
key :helper_text, String | |
key :required, Boolean, :default => false | |
key :widget, String, :required => true | |
key :options, Array # => [[value, label], [value, label], [value, label]] | |
key :selected, String |