Skip to content

Instantly share code, notes, and snippets.

data: {
data: dependencies: {
data: phoenix-build: '~1.0',
data: grunt-bg-shell: '*',
data: grunt-cli: '0.1.6',
data: jake: '*',
data: thorax-inspector: '0.2.4',
data: grunt: '~0.4',
data: express: '~3'
data: },
var async = require('async'),
_ = require('underscore');
var obj = {
key: 'value'
};
async.series(_.map(obj, function(value, key) {
return function(next) {
$(function() {
var Application = window.Application = new Thorax.ViewController({
template: "{{layout}}"
});
Backbone.history.start();
Application.render();
$('body').append(Application.el);
var Todos = Thorax.Collections.Todos = Thorax.Collection.extend({});
$(function() {
var Application = window.Application = new Thorax.ViewController({
template: "{{layout}}"
});
Backbone.history.start();
Application.render();
$('body').append(Application.el);
var Todos = Application.Collections.Todos = Thorax.Collection.extend({});
@eastridge
eastridge / gist:3353846
Created August 14, 2012 23:19
Thorax helpers latest
(function() {
var root = this,
Backbone = root.Backbone,
Handlebars = root.Handlebars,
Thorax = root.Thorax,
_ = root._,
$ = root.$,
paramMatcher = /:(\w+)/g,
callMethodAttributeName = 'data-call-method';
@eastridge
eastridge / thorax.sample-data.js
Created August 14, 2012 22:09
Thorax Sample Data
$(function() {
var Application = window.Application = new Thorax.Application();
Application.start();
$('body').append(Application.el);
var Todos = Application.collection('todos', {});
var Cats = Application.collection('cats', {});
Cats.instance = new Cats([
{
@eastridge
eastridge / gist:3353392
Created August 14, 2012 21:59
Thorax latest
(function() {
var root = this,
Backbone = root.Backbone,
Handlebars = root.Handlebars,
_ = root._,
$ = root.$,
Thorax;
//support zepto.forEach on jQuery
@eastridge
eastridge / gist:3353376
Created August 14, 2012 21:57
Thorax collection latest
(function() {
var root = this,
Backbone = root.Backbone,
Handlebars = root.Handlebars,
Thorax = root.Thorax,
_ = root._,
$ = root.$,
_fetch = Backbone.Collection.prototype.fetch,
_reset = Backbone.Collection.prototype.reset,
@eastridge
eastridge / gist:3352206
Created August 14, 2012 19:48
Thorax admin app frontend
# TODO:
# - fix module loading problem when creating new modules (can't visit route on freshly created module)
# - persist location between editor and application window
# - needs to work on reload
# - needs to work on editor close
prefix = '/admin'
savedEditor = localStorage?.getItem 'thorax-admin-editor'
window.Application = Application = new Thorax.Application editor: savedEditor or 'browser'
socket = io.connect window.location.protocol + '//' + window.location.host
@eastridge
eastridge / gist:3352149
Created August 14, 2012 19:43
Thorax admin backend
module.exports = function(server, secureServer, argv) {
if (argv.admin) {
var path = require('path'),
_ = require('underscore'),
fs = require('fs'),
exec = require('child_process').exec,
pathPrefix = '/admin',
io = require('socket.io'),
mkdirp = require('mkdirp');