Skip to content

Instantly share code, notes, and snippets.

View pyramation's full-sized avatar
💭
🏄🏻‍♂️

Dan Lynch pyramation

💭
🏄🏻‍♂️
View GitHub Profile
@tbranyen
tbranyen / backbone.cacheit.js
Created October 25, 2012 02:31
Cache Backbone Model and Collection fetch calls with a deferred, simple and intuitive.
/*!
* backbone.cacheit.js v0.1.0
* Copyright 2012, Tim Branyen (@tbranyen)
* backbone.cacheit.js may be freely distributed under the MIT license.
*/
(function(window) {
"use strict";
// Localize global dependency references.
@tbranyen
tbranyen / bootstrap.html
Created September 18, 2012 02:14
boostrapping
<!-- Bootstrap data. -->
<script>
require(["main"], function() {
var news = require("app").news;
// Parse in the response and load into News.
news.reset({{{data}}});
});
</script>
@boazsender
boazsender / backbone.cache.js
Created August 30, 2012 16:46 — forked from tbranyen/backbone.collectioncache.js
Backbone.Collection caching by URL
/*!
* backbone.cache.js v0.0.2
* Copyright 2012, Boaz Sender (@boazsender)
* Based on backbone.collectioncache.js by Tim Branyen (@tbranyen) (https://gist.github.com/gists/3532848/edit)
* backbone.cacher.js may be freely distributed under the MIT license.
*/
(function(window) {
// Dependencies
var Backbone = window.Backbone;
@tbranyen
tbranyen / backbone.collectioncache.js
Created June 4, 2012 06:37
Backbone.Collection caching by URL
/*!
* backbone.collectioncache.js v0.0.2
* Copyright 2012, Tim Branyen (@tbranyen)
* backbone.collectioncache.js may be freely distributed under the MIT license.
*/
(function(window) {
"use strict";
// Dependencies
@k33g
k33g / kind.js
Created April 2, 2012 20:29
Re Use Object Model of BackBone
// Just do this : (and include backbone.js)
var Kind = function() {
this.initialize && this.initialize.apply(this, arguments);
};
Kind.extend = Backbone.Model.extend
//Simpler
var Thing = function() {};
Thing.extend = Backbone.Model.extend
@joefitzgerald
joefitzgerald / gist:1990736
Created March 7, 2012 03:32
Handlebars JST Grunt Task
/*
* Grunt Task File
* ---------------
*
* Task: JST-HB
* Description: Compile handlebars templates to JST file.
* Dependencies: underscore@1.2.4
*
*/
@anatoliychakkaev
anatoliychakkaev / stopSOPA-middleware-example.js
Created January 17, 2012 23:07
Blackout middleware for express, railwayjs
app.use(function blackoutMiddleware(req, res) {
// obtain static html here: http://www.zachstronaut.com/lab/text-shadow-box/stop-sopa.html
// or here: https://raw.github.com/zachstronaut/stop-sopa/master/index.html
fs.readFile('./public/stopSOPA.html', function (err, file) {
res.send(file.toString(), 503);
});
});
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh