Skip to content

Instantly share code, notes, and snippets.

View mikermcneil's full-sized avatar
🦢

Mike McNeil mikermcneil

🦢
View GitHub Profile
@mikermcneil
mikermcneil / mpu-s3-from-another-url.js
Created March 12, 2013 06:33
multi-part s3 streaming upload from another url
var fs = require('fs');
var knox = require('knox');
var mpu = require('knox-mpu');
var request = require('request');
var uri = "https://lh4.ggpht.com/N5f6FA5zPjrTH-UggaFLstYSO1za-01CbsO17ZwkghtF0k9TSzWcnCn4bybCDeIOP4cu=w124";
// Open download stream from google
var downStream = request(uri);
@mikermcneil
mikermcneil / cascading-policies.js
Last active December 14, 2015 19:59
Cascading policies (child policies are appended to parent queue)
/**
* Policy defines middleware that is run before each controller/action.
* Any policy dropped into the /policies directory is made globally available through sails.policies
* Below, use the string name of the policy (for instance authenticated.js would be "authenticated")
*/
module.exports.policies = {
// Default policy (apply to everything)
// equivalent to ['authenticated']
'*': 'authenticated'
@mikermcneil
mikermcneil / explicit-poilcies.js
Created March 12, 2013 08:10
Explicit policies (each actions'/controllers' policies override all parents)
/**
* Policy defines middleware that is run before each controller/action.
* Any policy dropped into the /policies directory is made globally available through sails.policies
* Below, use the string name of the policy (for instance authenticated.js would be "authenticated")
*/
module.exports.policies = {
// Default policy (apply to everything)
// equivalent to ['authenticated']
'*': 'authenticated'
@mikermcneil
mikermcneil / explicit-poilcies.js
Created March 12, 2013 08:10
Explicit policies (each actions'/controllers' policies override all parents)
/**
* Policy defines middleware that is run before each controller/action.
* Any policy dropped into the /policies directory is made globally available through sails.policies
* Below, use the string name of the policy (for instance authenticated.js would be "authenticated")
*/
module.exports.policies = {
// Default policy (apply to everything)
// equivalent to ['authenticated']
'*': 'authenticated'
@mikermcneil
mikermcneil / ecumene.js
Created March 12, 2013 14:19
Proposed specification for defining simple, RESTful, all-js schemas Use cases: + generating JSON API documentation + generating unit tests for JSON APIs + validating requests and marshaling responses
/**
* Proposed specification for defining simple, RESTful, all-js schemas
* (see anchor: https://github.com/balderdashy/anchor)
*
* Use cases:
* + generating JSON API documentation
* + generating unit tests for JSON APIs
* + validating requests and marshaling responses
*
*/
@mikermcneil
mikermcneil / app.html
Last active December 15, 2015 07:49
just another declarative pipedream vision of tomorrow
<!DOCTYPE html>
<html>
<head>
<title>Lift.js Example</title>
<script type="text/javascript" src="http://balderdash.co/lift.js"></script>
<!-- For app.js, see: https://gist.github.com/mikermcneil/5226696 -->
<script type="text/javascript" src="./js/app.js"></script>
</head>
<body>
@mikermcneil
mikermcneil / app.js
Last active December 15, 2015 07:49
just another declarative pipedream vision of tomorrow
//
// # app.js
//
// ### A hypothetical example of the lift.js js library
//
// ## What is this?
// Well, lift.js is a project I've been dreaming about for a long time.
// It converts declarative, stylesheet-like javascript markup into functional logic & state components.
// These take the form of Backbone models, views, and collections, as described by Mast (https://github.com/balderdashy/mast)
//
@mikermcneil
mikermcneil / installing-jslint-for-sublime.md
Created April 5, 2013 00:41
Installing the jslint plugin for sublime
sudo npm install -g cordova

Components

Events

  • UI event binding (e.g. click, scroll)
  • Navigation binding (e.g. hashtag routes)
  • Server binding (e.g. /device/activate)

View

  • Layout management (e.g. constructs UI with proper templates)
  • UI updates/animation (e.g. DOM manipulation)