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
| data = [] | |
| ((90.days.ago.to_date)..Date.today).each do |date| | |
| date = date.to_formatted_s(:db) | |
| value = db_data.has_key?(date) ? db_data[date] : 0 | |
| data << [date, value] | |
| 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
| filename = Rails.root.join("2-XML Schema", "[OSA-EAI-CCOM-ML-XSD-V03-2]CCOM-ML_V3-2-3 (2010-11-30).xsd") | |
| doc = Nokogiri::XML(File.read(filename)) | |
| def complex_types_of(doc,base) | |
| hash = {} | |
| doc.xpath("//xs:extension[@base='#{base}']").each do |extension| | |
| complex_type = extension.parent.parent | |
| name = complex_type[:name] | |
| hash[name] = complex_types_of(doc,name) | |
| 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
| module ExtendThroughInclude | |
| def included(klass) | |
| klass.extend(ClassMethods) | |
| klass.send(:include, InstanceMethods) | |
| end | |
| class InstanceMethods | |
| 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
| ######################################################################## | |
| # | |
| # harvest-sample.rb | |
| # | |
| # Basic API demo. Use this sample as a starting point on how to | |
| # connect, authenticate, and send requests to the Harvest API and | |
| # handle the API throttle limit. This is not a libary, if you want one | |
| # for Ruby, we recommend investigating ActiveResource::Base. | |
| # | |
| # To execute this sample, save this file to your computer and |
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
| <!-- http://www.quirksmode.org/css/forms.html --> | |
| <html> | |
| <head> | |
| <style> | |
| label,input { | |
| display: block; | |
| width: 150px; | |
| float: left; | |
| margin-bottom: 10px; | |
| } |
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
| GOOGLE_MAPS_API_KEY = "something" | |
| # This is a plain old ruby class that assumes someone has give it the | |
| # parts of an address. The end goal is to use Google to geolocate it | |
| # and assign a lat/long | |
| class Locateable | |
| attr_accessor :street1, :street2, :city, :state, :country | |
| attr_accessor :latitude, :longitude, :accuracy | |
| # returns false if google was unable to geolocate the |
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
| Factory.define(:kit) do |f| | |
| f.association :primary_palette, :factory => :palette # association doesn't match class name | |
| f.association :secondary_palette, :factory => :palette | |
| f.association :user, :factory => :user | |
| f.sequence(:name) { |i| "Kit#{i}" } | |
| f.bg_images { |images| [images.association(:attachment)] } # has_many assoc | |
| f.default false | |
| f.display_fonts { [Factory(:font), Factory(:font)] } | |
| f.body_font { Factory(:font) } | |
| 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 Person | |
| include ActiveModel::MassAssignmentSecurity | |
| attr_accessor :name, :birthday, :handsomeness | |
| attr_protected :handsomeness | |
| def initialize(params = {}) | |
| self.attributes = params | |
| 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
| $ bundle | |
| /Users/dalcorn/.rvm/gems/jruby-1.5.6@mimosa2/bin/bundle: line 9: require: command not found | |
| /Users/dalcorn/.rvm/gems/jruby-1.5.6@mimosa2/bin/bundle: line 11: version: command not found | |
| /Users/dalcorn/.rvm/gems/jruby-1.5.6@mimosa2/bin/bundle: line 13: syntax error near unexpected token `(' | |
| /Users/dalcorn/.rvm/gems/jruby-1.5.6@mimosa2/bin/bundle: line 13: `if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then' | |
| $ which bundle | |
| /Users/dalcorn/.rvm/gems/jruby-1.5.6@mimosa2/bin/bundle | |
| $ ls -l `which bundle` | |
| -rwxr-xr-x 1 dalcorn staff 410 Feb 24 15:09 /Users/dalcorn/.rvm/gems/jruby-1.5.6@mimosa2/bin/bundle* | |
| $ head `which bundle` |
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
| From 7b7505ad8836f6fa9e613a29534bb9536defea44 Mon Sep 17 00:00:00 2001 | |
| From: Doug Alcorn <[email protected]> | |
| Date: Wed, 11 May 2011 16:59:45 -0400 | |
| Subject: [PATCH] updating the few attribute types from value_class number to | |
| measure [#13103329] | |
| --- | |
| 3-XML-Ref-Data/CCOM Reference Data.xml | 12 ++++++------ | |
| 1 files changed, 6 insertions(+), 6 deletions(-) |