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
InstanceMethods = | |
snapshot_attributes: -> | |
attrCopy = {} | |
for k, v of @attributes() | |
attrCopy[k] = v | |
@_attributes_snapshot = attrCopy | |
console.log 'snapshotted', this, attrCopy, @_attributes_snapshot, @was('type') |
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
// number to string, pluginized from http://stackoverflow.com/questions/5529934/javascript-numbers-to-words | |
window.num2str = function (num) { | |
return window.num2str.convert(num); | |
} | |
window.num2str.ones = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']; | |
window.num2str.tens = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']; | |
window.num2str.teens = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']; |
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
Spine.Model.include | |
# this is a monkey patch to allow dynamic loading of attributes. | |
load_without_updating_config: Spine.Model.prototype.load | |
load: (atts)-> | |
for key, value of atts | |
if @constructor.attributes.indexOf(key) == -1 | |
@constructor.attributes.push key | |
@load_without_updating_config(atts) |
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
Spine.Stack.include | |
active_controller: ()-> | |
@manager.active_controller | |
window.app = new App | |
app.manager.bind 'change', (controller)-> | |
console.log 'stack change', this, arguments | |
@active_controller = controller |
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
# the current setup, for conveience, removes all capital letters from class names, which is not the best. | |
# this could be fixed, but carefully. | |
# remove the default ensure element, we handle this in Base | |
Backbone.View.prototype._ensureElement = () -> | |
class ZenBucket.Views.Base extends Backbone.View | |
initialize: (render) -> | |
# set up sensible defaults |
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 Neo4j | |
module Rails | |
class Model | |
class << self | |
# This allows anything to be thrown at a relationship and understood. | |
# usage: | |
# | |
# has_one(:location).to(Location) | |
# accepts_hash_for :location |
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 Neo4j | |
module TypeConverters | |
class SerializeConverter | |
# serializes to sting | |
class << self | |
def convert?(type) | |
type == :serialize | |
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
# someday: move to json response module? | |
def json_response(options) | |
logger.warn "JSON response: #{options}" | |
render json: options | |
end | |
def json_callback(method, args = []) | |
json_response({status: :window_callback, method: method, args: args}) | |
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
/*! | |
* jQuery Mobile v1.0rc2 | |
* http://jquerymobile.com/ | |
* | |
* Copyright 2010, jQuery Project | |
* Dual licensed under the MIT or GPL Version 2 licenses. | |
* http://jquery.org/license | |
*/ | |
/*! | |
* jQuery Mobile Framework |
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
$.fn.sparkle = (arg_options) -> | |
options = { | |
width: 3 | |
gap: 3 | |
comets: 2 | |
} | |
$.extend(options, arg_options) if arg_options | |
span = options.width + options.gap |