Skip to content

Instantly share code, notes, and snippets.

@Unitecho
Unitecho / google_reader.js
Last active December 11, 2015 20:48 — forked from dongyuwei/node-reader.js
Node : Google Reader API client.js
/*
This library was developed by Will Honey.
It is licensed under the GPLv3 Open Source License
This library requires the underscore library found at http://documentcloud.github.com/underscore/
This library requires the underscore string library found at http://edtsech.github.com/underscore.string/
This library requires the support of localStorage. Updates could be easily made to change that.
*/
/* jslint adsafe: false, devel: true, regexp: true, browser: true, vars: true, nomen: true, maxerr: 50, indent: 4 */
@Unitecho
Unitecho / Storage.js
Created January 30, 2013 03:41
Node : Debug message format
var debug = require('debug')('carcass:Factory:Storage');
@Unitecho
Unitecho / index.js
Created January 30, 2013 04:42
Node : Importing submodules from a folder
root.js
/**
* You just have to require the folder where the index.js file is in
*/
var index = require('./models');
console.log(index);
---------
models/index.js
@Unitecho
Unitecho / exported.js
Created January 30, 2013 05:18
Node : Module creation without arguments
var EventEmitter = require('events').EventEmitter;
module.exports = new EventEmitter();
setTimeout(function() {
module.exports.emit('ready');
}, 1000);
@Unitecho
Unitecho / bench.js
Created January 30, 2013 07:35
Node : Benchmarking code
console.time('100-elements');
for (var i = 0; i < 100; i++) {
;
}
console.timeEnd('100-elements');
var net = require('net')
var sock = net.connect(1337)
process.stdin.pipe(sock)
sock.pipe(process.stdout)
sock.on('connect', function () {
process.stdin.resume();
process.stdin.setRawMode(true)
@Unitecho
Unitecho / console.js
Created February 1, 2013 10:13
Node : Console log direct CB binding
db.on('error', console.error.bind(console, 'connection error:'))
@Unitecho
Unitecho / gist:4713994
Created February 5, 2013 11:52
jQuery : Detect CSS3 end transition
$("#someSelector").bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(){ ... });
@Unitecho
Unitecho / index.js
Created February 6, 2013 07:46
JS : Add methods to Object with .call(
(function() {
this.updateKey = function(msg, block, callback) {
var self = this;
[.....]
});
};
}).call(User.prototype);
@Unitecho
Unitecho / gist:4721032
Created February 6, 2013 07:51
HTTP : detecting rate limits in headers
["x-ratelimit-limit", "x-ratelimit-remaining", "x-oauth-scopes", "link"]