a list of slides from nodeconf
you may want to take a look at the jsconf-gist too!
| // Simple function queue runner. Just pass me an array of functions and I'll | |
| // execute them one by one at the given interval. | |
| run_queue = function (funcs, step, speed) { | |
| step = step || 0; | |
| speed = speed || 500; | |
| funcs = funcs || []; | |
| if (step < funcs.length) { | |
| // execute function | |
| funcs[step](); |
| Your mama's so fat that all her shell commands run in verbose mode. - @HenrikJoreteg | |
| Your momma's so fat she returns an http 413 error: Request entity too large! - @boringgeek |
| // If you don't use underscore.js, use it (http://documentcloud.github.com/underscore/) | |
| // Then, use underscore's mixin method to extend it with all your other utility methods | |
| // like so: | |
| _.mixin({ | |
| escapeHtml: function () { | |
| return this.replace(/&/g,'&') | |
| .replace(/>/g,'>') | |
| .replace(/</g,'<') | |
| .replace(/"/g,'"') | |
| .replace(/'/g,'''); |
| var View = Backbone.View.extend({ | |
| initialize: function () { | |
| this.handleBindings(); | |
| }, | |
| contentBindings: { | |
| title: '.title' | |
| }, | |
| classBindings: { |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Some single page app</title> | |
| <style> | |
| /* | |
| Here's the magic, we take the unselectable attribute and make it more powerful | |
| in browsers that support it see here for more: | |
| http://help.dottoro.com/lcrlukea.php#-webkit-user-select | |
| */ |
| """ | |
| Straight Include template tag by @HenrikJoreteg | |
| Django templates don't give us any way to escape template tags. | |
| So if you ever need to include client side templates for ICanHaz.js (or anything else that | |
| may confuse django's templating engine) You can is this little snippet. | |
| Just use it as you would a normal {% include %} tag. It just won't process the included text. |
| if (typeof require == 'undefined') { | |
| var exports = window, | |
| server = false; | |
| } else { | |
| var Backbone = require('./backbone'), | |
| _ = require('underscore')._, | |
| server = true; | |
| } | |
| exports.TeamModel = Backbone.Model.extend() |
| =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 |
| 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); | |
| }; |
a list of slides from nodeconf
you may want to take a look at the jsconf-gist too!