a list of slides from nodeconf
you may want to take a look at the jsconf-gist too!
// credit for this goes to @latentflip | |
var State = require('ampersand-state'); | |
var Collection = require('ampersand-collection'); | |
var OptionList = Collection.extend({ | |
//Circular reference so we have to function wrap this | |
model: function (data, options) { | |
return new Option(data, options); | |
} |
body | |
nav.navbar.navbar-default | |
div.container-fluid | |
div.navbar-header | |
a.navbar-brand(href='/') Our App | |
ul.nav.navbar-nav | |
li | |
a(href='/list') list | |
.container | |
main(role="page-container") |
var Model = require('ampersand-model'); | |
module.exports = Model.extend({ | |
props: { | |
address: 'state' | |
} | |
}); |
// we'll just use an ampersand-view here as an | |
// example parent view | |
var View = require('ampersand-view'); | |
var FormView = require('ampersand-form-view'); | |
var InputView = require('ampersand-input-view'); | |
var MyView = View.extend({ | |
template: '<div><h1>App form</h1 ><form role="app-edit-form"></form></div>', | |
render: function () { |
// grab your file object from a file input | |
$('#fileInput').change(function () { | |
sendFile(this.files[0]); | |
}); | |
// can also be from a drag-from-desktop drop | |
$('dropZone')[0].ondrop = function (e) { | |
e.preventDefault(); | |
sendFile(e.dataTransfer.files[0]); | |
}; |
/* | |
Building a module this way allows you to do this on the client: | |
<script src="underscore.js"></script> | |
<script src="myutils.js"></script> | |
Then use it in your code as children of '_' without polluting your global namespace. | |
_.myFunction(); |
a list of slides from nodeconf
you may want to take a look at the jsconf-gist too!
var fermata = require('fermata'), | |
uuid = require('node-uuid'); | |
var apiKey = 'YOUR_API_KEY'; // should probably be imported from an external keys file | |
var site = fermata.api({url: 'https://api.postageapp.com/v.1.0'}); | |
exports.send = function (details, cb) { | |
site['send_message.json'].post(details, cb); | |
}; |
=text_shadow($color, $x, $y, $blur) | |
:text-shadow = $color $x $y #{$blur}px | |
=box_shadow($color, $x, $y, $blur) | |
:-webkit-box-shadow = $color $x $y #{$blur}px | |
:-moz-box-shadow = $color $x $y #{$blur}px | |
:box-shadow = $color $x $y #{$blur}px | |
=inner_shadow($color, $x, $y, $blur) | |
:box-shadow = inset $color $x $y #{$blur}px |
if (typeof require == 'undefined') { | |
var exports = window, | |
server = false; | |
} else { | |
var Backbone = require('./backbone'), | |
_ = require('underscore')._, | |
server = true; | |
} | |
exports.TeamModel = Backbone.Model.extend() |