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
| # Bus 0.1(alpha) | |
| # (c) 2010 John Wright, QuickLeft Inc. | |
| # Bus may be freely distributed under the MIT license. | |
| # For all details and documentation: | |
| # http://github.com/mrjjwright/Bus | |
| # | |
| # | |
| # | |
| # Bus would not be possible without Jeremy Ashkenas who wrote CoffeeScript, the language |
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
| # sloth 0.1(alpha) | |
| # Version for Node.js. | |
| # (c) 2010 John Wright, QuickLeft Inc. | |
| # sloth may be freely distributed under the MIT license. | |
| # For all details and documentation: | |
| # http://github.com/mrjjwright/sloth | |
| # | |
| # | |
| # Sloth is a content based JSON store. It tracks changes in the content of JSON objects, not ids, uuids or timestamps. |
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
| # Usage: _.toCSS(object) | |
| # Returns properly formatted CSS. | |
| # Object cannot be deeply nested as this is a simple object/CSS mapping and it reads better. | |
| # If you want to do something dynamic to generate the CSS, do it in a JS function that returns the object. | |
| # | |
| _css = | |
| toCSS: (obj) -> | |
| propToCSS = (key, value) -> | |
| css = '' | |
| for selector of obj |
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
| template = CoffeeKup.compile -> | |
| div class: 'section first sources', -> | |
| div id: 'sources-overview', class: 'category', -> | |
| a href: '/sources/overview', -> 'Overview' | |
| div class: 'section', -> | |
| for source in @sources | |
| div id: "sources-#{source.uuid}", class: 'category source', -> | |
| span class: 'searching' | |
| a href: "/sources/#{source.uuid}", -> source.name |
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
| fs = require 'fs' | |
| assets = require './frontend/js/assets' | |
| exec = require('child_process').exec | |
| task 'dev:js_lib', 'Rebuild the js libs', (options) -> | |
| js = '' | |
| js_local = assets.js_local | |
| for key of assets.js | |
| if assets.js[key] is "npm" | |
| try |
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
| fs = require 'fs' | |
| CoffeeScript = require 'coffee-script' | |
| task "build:package", "Builds the package.json from it's coffee source", (options) -> | |
| js = CoffeeScript.compile "return #{fs.readFileSync('package.coffee', 'utf8')}" | |
| json = JSON.stringify eval(js), null, 2 | |
| fs.writeFileSync 'package.json', json | |
| console.log('Successfully wrote out package.json') |
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
| # Security code for a user | |
| uuid = require "node-uuid" | |
| crypto = require "crypto" | |
| util = require("util") | |
| systemSalt = "49caa18ae0d91e9ad610eba6bf6328172ae026a497ef6e79dcb0b7b1eb1ca534a047405eb8f0f05b2e513d548a3d97a0d4a2634593ac98d5e1db64212837b254" | |
| # Default fingerprint function | |
| fingerprint = (user) -> | |
| return user.email |
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 Address < ActiveRecord::Base | |
| attr_accessible :address1, :address2, :phone, :city, :state, :zip, :country, :website_url, :name | |
| def validate | |
| required_set = [:address1, :city, :state, :zip, :country] | |
| matches = required_set.map {|my_method| self.send(my_method).present? }.reduce(0) {|a,b| a + (b == true ? 1 : 0) } | |
| self.errors.add(:address1, "Must have a full address!") if matches.between?(1, 4) | |
| end | |
| 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
| # Load the remote RB db object, our connection to the backend SQLite or MongoDB | |
| DNode.connect (rbdb) -> | |
| RB.db = rbdb | |
| # Fetch the logged in Backbone user if any | |
| RB.user.fetch success: -> Backbone.history.loadUrl() | |
| # Overwrite the Backbone sync method to use Dnode and rbdb | |
| # The Recordbook database has a MongoDB compatible API, even if it sits on SQLite | |
| Backbone.sync = (method, model, success, error) -> | |
| collectionName = model.collectionName() |
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
| $('.product-order a').bind("ajax:success", function(e, lineItemQuantity){ | |
| var $this = $(this), | |
| $confirmObj = $this.parent('.product-order').siblings('.product-image').children('.order-over'); | |
| if( !$confirmObj.is('visible') && !($confirmObj.is('animated')) ){ | |
| $confirmObj.fadeIn(); | |
| $confirmObj.children('p').children('.order-count').text(lineItemQuantity); | |
| setTimeout( function(){$confirmObj.fadeOut();}, 3000); | |
| } | |
| }); |