Skip to content

Instantly share code, notes, and snippets.

View lsiden's full-sized avatar

Lawrence Siden lsiden

View GitHub Profile
// Instead of this:
EccapCalc.mainPage = SC.Page.design({
mainPane: SC.MainPane.design({
childViews: 'description value'.w(),
description: SC.ScrollView.design({
contentView: SC.ListView.design({
layout: { centerX: 0, centerY: 0, width: 250, height: 300 },
# I xxx'd out the domain part of the URL's to protect the innocent. -ls
Feature: Submit Webform
As a visitor to xxx.com
I want to submit a form with some personal information
and be redirected to a thank-you page.
Scenario Outline: Form Submission
Given I visit "http://xxx/webform.html"
And I type "<loan_purpose>" into field "loan_purpose",
And I type "<loan_amount>" into field "loan_amount",
// ==========================================================================
// Project: EccapCalc.LedgerView
// Copyright: ©2009 Westside Consulting LLC
// ==========================================================================
/*globals EccapCalc */
/** @class
This is a reusable view that is meant to be instantiated from the function
EccapCalc.createLedgerView(x, y, w, h, title, arrayController).
sc_require('models/ledger_entry');
EccapCalc.LedgerEntry.FIXTURES = [{
guid: '1,',
description: '401K',
amount: '150000',
ledger: 'assets',
}, {
guid: '2,',
description: 'Home',
EccapCalc.ledgerController = function(view, ledger_id) {
/** @class
@extends SC.ArrayController
*/
return SC.ArrayController.create(
SC.CollectionViewDelegate,
/** @scope EccapCalc.ledgerController.prototype */ {
verticalOffset: 0,
EccapCalc.mainPage = SC.Page.design({
// The main pane is made visible on screen as soon as your app is loaded.
// Add childViews to this pane for views to display immediately on page
// load.
mainPane: SC.MainPane.design({
childViews: 'scrollView'.w(),
scrollView: SC.ScrollView.design({
contentView: SC.View.design({
childViews: 'labelView assetsView incomeView expensesView'.w(),
add_item: function() {
// create new LedgerEntry and add it to the list
var that = this;
var ledger_entry = EccapCalc.store.createRecord(EccapCalc.LedgerEntry, {
ledger: that.ledger,
});
// select new LedgerEntry in UI
this.selectObject(ledger_entry);
require 'rubygems'
require 'dm-core'
db_url = "sqlite3://#{File.dirname(__FILE__)}/example.db"
DataMapper.setup(:default, db_url)
class LedgerEntry
include DataMapper::Resource
property :id, Serial
@lsiden
lsiden / gist:388475
Created May 3, 2010 19:17
Submitted to Rack on 3/13/2010
diff -ur rack-rack-39ea53f/lib/rack/content_length.rb rack-1.1.0/lib/rack/content_length.rb
--- rack-rack-39ea53f/lib/rack/content_length.rb 2010-01-03 14:21:42.000000000 -0500
+++ rack-1.1.0/lib/rack/content_length.rb 2010-03-13 20:25:44.000000000 -0500
@@ -13,7 +13,7 @@
status, headers, body = @app.call(env)
headers = HeaderHash.new(headers)
- if !STATUS_WITH_NO_ENTITY_BODY.include?(status) &&
+ if !STATUS_WITH_NO_ENTITY_BODY.include?(status.to_i) &&
!headers['Content-Length'] &&
diff --git a/lib/rack/chunked.rb b/lib/rack/chunked.rb
index dddf969..0ee8fb9 100644
--- a/lib/rack/chunked.rb
+++ b/lib/rack/chunked.rb
@@ -35,7 +35,7 @@ module Rack
def each
term = "\r\n"
@body.each do |chunk|
- size = bytesize(chunk)
+ size = chunk.nil? ? 0 : bytesize(chunk)