Skip to content

Instantly share code, notes, and snippets.

View joelongstreet's full-sized avatar

Joe Longstreet joelongstreet

View GitHub Profile
@staltz
staltz / introrx.md
Last active April 21, 2025 04:15
The introduction to Reactive Programming you've been missing
@ruzz311
ruzz311 / turnip-farmer.txt
Last active April 4, 2025 20:49
The story of the turnip farmer. Weird things are written in the middle of a hackathon. (originally ~ June 2013)
"In all my days as a turnip farmer I have not yet experienced the love of a white radish," thought the farmer as he sighed and walked up the dusty, worn trail towards the barn. The paint, which once was vibrant red had dulled to a rusty hue where the paint had not yet freed itself from the siding, leaving chunks of exposed rough wood that he ran his hands along. The man braced his back against the worn but sturdy structure and slowly sank until his knees could take no more and he crumpled against the barn. The sun beat warm against the old man's skin which had thinned as the years raced by him. And in that moment he drifted off to sleep.
...
How long had he been out? One hour? Two? It was not yet dusk but the cicadas had begun to roar.
His eyes fluttered half-open, though only one seemed willing to do the work. There was a sourness in the back of his throat, metallic and dry, and for a moment he thought perhaps he had bitten his tongue in his sleep. He pressed a hand to his chest and let it rest there. Jus
@ckniffen
ckniffen / backbone.inherits.js
Created October 8, 2013 20:55
Tweak of Backbone.extend to allow deeper inheritance for properties such as `defaults` and `options` and another property you also want extended.
/* global _, Backbone */
(function(_, Backbone){
// Helper function to correctly set up the prototype chain, for subclasses.
// Similar to `goog.inherits`, but uses a hash of prototype properties and
// class properties to be extended.
Backbone.deepInheritableProperties = ['options', 'defaults'];
var inherits = function(protoProps, staticProps) {
var parent = this;
var child;
@mikermcneil
mikermcneil / custom-express-middleware.md
Created August 17, 2013 04:44
Using custom express middleware in Sails.js circa v0.9.3

Custom middleware is a legacy option, since most times you just want to use policies.

HOWEVER! There are times you want to use sails for quick/dirty things you would normally use express for (but you already have sails around, w/e). More pertinently, if you want middleware to run before the static files from your assets folder are served, policies won't let you do that.

Here's an example of using the BasicAuth middleware for everything:
// Put this in `config/express.js`