This file contains 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
# Taken from Batman.RailsStorage https://github.com/batmanjs/batman/blob/master/src/extras/batman.rails.coffee#L62 | |
# | |
# Usage: | |
# #= require ./json_storage | |
# class MyApp.Model extends Batman.Model | |
# @persist Batman.JSONStorage | |
# | |
class Batman.JSONStorage extends Batman.RestStorage | |
# override the default URL functions to add .json: | |
urlForRecord: -> @_addJsonExtension(super) |
This file contains 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
var gulp = require('gulp'); | |
var coffee = require('gulp-coffee'); | |
var concat = require('gulp-concat'); | |
var jade = require('gulp-jade'); | |
var batmanTemplates = require("gulp-batman-templates") | |
gulp.task('default', function(){ | |
gulp.watch('./**/*', ["build", "html", "finalize"]) | |
}); |
This file contains 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 App.Sale extends Batman.Model | |
@hasMany 'sale_items' | |
@accessor 'total_price', -> | |
memo = 0 | |
# adds 'sale_items' and each item as a source | |
@get('sale_items').forEach (item) -> | |
memo += item.get('subtotal') | |
memo | |
This file contains 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
var gulp = require('gulp'); | |
var coffee = require('gulp-coffee'); | |
var concat = require('gulp-concat'); | |
var jade = require('gulp-jade'); | |
var batmanTemplates = require("gulp-batman-templates") | |
gulp.task('default', function(){ | |
gulp.watch('./**/*', ["build", "html", "javascripts", "stylesheets", "finalize"]) | |
}); |
This file contains 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
#!/usr/bin/env ruby | |
if `git diff --cached spec` =~ /,\s?(:focus|focus:\s?true|:focus\s?=>\s?true)/ | |
puts "\e[31mRemove your :focus tags before committing!\e[0m" | |
exit 1 | |
end | |
if `git diff --cached spec` =~ /console\.log/ | |
puts "\e[31mRemove your console.log before committing!\e[0m" | |
exit 1 |
This file contains 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 MyApp.TasksController extends MyApp.ApplicationController | |
new: -> | |
task = new MyApp.Task | |
task.get('task_entries').build(item: new MyApp.Item) | |
@set('task', task) | |
# /tasks/new will be rendered implicitly. MyApp.TasksNewView will be used to render that template, if it is defined. | |
This file contains 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 Funzies.ComponentsNewView extends Batman.View | |
constructor: -> | |
super | |
@set 'pendingComponents', new Batman.Set | |
@set 'defaultKind', null | |
@set 'newFiles', null | |
@observe 'newFiles', (nv, ov) -> | |
if nv?.length | |
@_componentsFromFiles(nv) |
This file contains 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
var frame; | |
var frameSrc = "/sleep" // some local endpoint that just `sleep 2` or something | |
function addFrame() { | |
frame = document.createElement("iframe") | |
frame.style.display = "none" | |
document.head.appendChild(frame) | |
frame.src = frameSrc | |
} |
This file contains 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
// - Request saves on a key-by-key basis | |
// | |
// - After the operation, record whether keys are now persisted | |
// or whether they errored out | |
// | |
// - Store keys in a workflow: | |
// _requestedKeys -> requested, but not in flight or successfully saved | |
// _pendingKeys -> keys whose save is in flight now | |
// _successKeys -> keys whose save was successful | |
// _errorKeys -> keys whose save errored |
This file contains 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
_____ ___ __ __ ____ _____ _____ __ __ | |
||_// ||=|| (( (( ||=) (( )) (( )) ||<< | |
|| || || \_)) \_)) ||_)) \\_// \\_// || \\ | |
_____ _____ | |
|- == | .-,( ),-. |-----| | |
|Web | .-( )-. | iOS | | |
| App| ( Apple Server ) | | | |
| | '-( ).-' |-----| | |
'-----' '-.( ).-' `--°--' |