Skip to content

Instantly share code, notes, and snippets.

View qawemlilo's full-sized avatar

Qawelesizwe Mlilo qawemlilo

View GitHub Profile

What are we trying to observe? Raw object data.

// Objects
var obj = { id: 2 };
obj.id = 3; // obj == { id: 3 }
 
// Arrays
var arr = ['foo', 'bar'];
arr.splice(1, 1, 'baz'); // arr == ['foo', 'baz'];
@qawemlilo
qawemlilo / observe
Last active August 29, 2015 13:57
Object.observe and data binding research
http://weblog.bocoup.com/javascript-object-observe/
http://wiki.ecmascript.org/doku.php?id=harmony:observe
http://addyosmani.com/blog/the-future-of-data-binding-is-object-observe/
https://gist.github.com/addyosmani/6951740
https://github.com/samdutton/simpl/tree/master/observe
http://www.lucaongaro.eu/blog/2012/12/02/easy-two-way-data-binding-in-javascript/
@qawemlilo
qawemlilo / gist:9617077
Last active August 29, 2015 13:57
Node, Task Automation / Build tools
NPM Run
NPM built-in task runner
Links:
http://substack.net/task_automation_with_npm_run/
GRUNT
Created by Ben Alman
Links:
@qawemlilo
qawemlilo / CORS
Created July 9, 2014 11:41 — forked from Unitech/CORS
app.all('*', function (req, res, next) {
res.header("Access-Control-Allow-Origin", req.headers.origin);
res.header("Access-Control-Allow-Credentials", true);
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
res.header("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, Authorization, Content-Length");
if (req.method == 'OPTIONS') {
return res.send(200);
}
@qawemlilo
qawemlilo / count.js
Last active August 29, 2015 14:15 — forked from jordaaash/count.js
var Promise = require('bluebird'),
User = require('./user'),
knex, query;
knex = User.prototype._builder(User.prototype.tableName);
query = function (q) {
q.distinct()
.innerJoin('orders', function () {
this.on('users.id', '=', 'orders.user_id')
@qawemlilo
qawemlilo / seed.js
Last active August 29, 2015 14:16
Seeding
var sequence = require('when/sequence');
// requires you to save your model in a seperate file
var PostModel = require('./models/post');
var posts = [
{title: 'Title 1', html: '<p>Lorem ipsum dolor sit amet, graeco efficiendi ne nec, no cibo possit vix</p>'},
{title: 'Title 2', html: '<p>Lorem ipsum dolor sit amet, graeco efficiendi ne nec, no cibo possit vix</p>'},
{title: 'Title 3', html: '<p>Lorem ipsum dolor sit amet, graeco efficiendi ne nec, no cibo possit vix</p>'},
@qawemlilo
qawemlilo / Makefile
Last active August 29, 2015 14:18 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
#!/usr/bin/env node
var util = require('util'),
fs = require('fs'),
path = require('path'),
http = require('http'),
_ = require('lodash'),
url = require('url');
var DEBUG = false,
// Node.js CheatSheet.
// Download the Node.js source code or a pre-built installer for your platform, and start developing today.
// Download: http://nodejs.org/download/
// More: http://nodejs.org/api/all.html
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
Verifying I am +qawemlilo on my passcard. https://onename.com/qawemlilo