Model: Cell {x, y, alive} View: CellView {model: Cell} Collection: Cells
CellView renders a div CellView listens to Cell.change to change b.g. color
On app init:
# based on http://code.activestate.com/recipes/528911-barcodes-convert-upc-e-to-upc-a/ | |
class Upc | |
def self.convert_upc_e_to_upc_a(upce=nil) | |
return upce if upce.nil? or upce.length < 6 or upce.length > 8 # not a UPC-E | |
upce = case upce.length | |
when 6 | |
upce | |
when 7 | |
upce[0,6] |
# manifest-entry-field => [ search-method, product-data-source, link-weight ] | |
# search-method: is the name of a function [fuzzy_search | manufacturer_search | exact] | |
# OR a lambda which receives ( the value of manifest-entry-field, the value of product-data-source ) | |
# and returns the matching product or nil | |
LINKING_COLUMNS = { | |
:title => [:fuzzy_search, | |
:title, | |
5], | |
#:description => [:fuzzy_search, :description, 10], |
$('#bidding .editable').editable('/loads/<%=@load.id%>/manifest_entries/edit_in_place.ajax', { | |
'id': 'elementid', | |
'name': 'elementname', | |
'callback': function(result,settings){ | |
var field = $(this).attr('class').split(/ /).pop(); | |
if(field.match(/_cents$/)){ | |
$(this).html(result.manifest_entry.manifest_entry[field]/100).formatCurrency(); | |
} else { | |
$(this).html(result.manifest_entry.manifest_entry[field]); | |
} |
require 'spec_helper' | |
describe "Bar" do | |
it "should not bar" do | |
lambda { | |
"foo".bar | |
}.should raise_exception | |
end | |
end |
Model: Cell {x, y, alive} View: CellView {model: Cell} Collection: Cells
CellView renders a div CellView listens to Cell.change to change b.g. color
On app init:
This is a rough spec for a gem I would like to use to connect to X.commerce. As X.commerce is new and my experience with it is limited, I'd like to discuss with the community first how best to structure the interaction before actual code is written.
I've spec'd out the following basic object structure:
def points(x) | |
{ | |
1 => 1, | |
2 => 2, | |
3 => 5, | |
4 => 7, | |
6 => 15, | |
8 => 21 | |
}[x.to_i] | |
end |
require 'pivotal-tracker' | |
module PivotalTracker | |
class Project | |
def create_stories(options={}) | |
req = options[:requester] | |
own = options[:owner] | |
stories = options[:stories] | |
stories.split(/\n/).each do |story| | |
md = story.strip.match(/^([fcb])(\d) (.*?) \[(.*)\]$/) |
require 'pivotal-tracker' | |
module PivotalTracker | |
class Project | |
def create_stories(options={}) | |
req = options[:requester] | |
own = options[:owner] | |
stories = options[:stories] | |
stories.split(/\n/).each do |story| | |
md = story.strip.match(/^([fcb])(\d) (.*?) \[(.*)\]$/) |
describe World do | |
it "should return no cell on a new board" do | |
w = World.new | |
w.cell_at(2,2).should be_nil | |
end | |
it "should allow cell creation" do | |
w = World.new | |
w.make_cell(2,2) | |
w.cell_at(2,2).should be_kind_of(Cell) | |
end |