Skip to content

Instantly share code, notes, and snippets.

Alexandru Vlăduţu alessioalex

Block or report user

Report or block alessioalex

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:c438c57b182aaf13dbac
1) Scaling out to multiple processes (by default a LDB database can only be accessed by a single Node process):
- https://github.com/juliangruber/multilevel
- https://github.com/substack/level-party - no need to take care of multilevel sever and multilevel client, this module does that for us
2) Namespaces / namespacing
- https://www.npmjs.org/package/level-sublevel
- https://github.com/juliangruber/level-prefix
View mp3player.js
var fs = require('fs');
var lame = require('lame');
var Speaker = require('speaker');
fs.createReadStream(process.argv[2])
.pipe(new lame.Decoder())
.on('format', function (format) {
this.pipe(new Speaker(format));
});
@alessioalex
alessioalex / deps_autorun.js
Created Jun 20, 2014
Mimmicking Deps.autorun from Meteor in pure Node
View deps_autorun.js
"use strict";
var EventEmitter = require('events').EventEmitter;
var Session = new EventEmitter();
Session.data = {};
Session.get = function(key) {
return this.data[key] || null;
View rwd.css
/* http://twitter.github.com/bootstrap/scaffolding.html#responsive */
/* Landscape phones and down */
@media (max-width: 480px) { ... }
/* Landscape phone to portrait tablet */
@media (max-width: 768px) { ... }
/* Portrait tablet to landscape and desktop */
@media (min-width: 768px) and (max-width: 940px) { ... }
View LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2014
Copyright (C) 2014 Addy Osmani @addyosmani
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
View convert.js
var fs = require('fs');
var infile = process.argv[2];
if (!infile) return console.log("need infile");
var data = fs.readFileSync(infile, 'utf8').split('\n');
var outlines = [];
data.forEach(function(item) {
View settimeout-iif.js
function tellMeLater() {
for (var i = 0; i < 10; i++) {
(function(i) {
setTimeout(function() {
console.log(i);
}, 100);
}(i));
}
}
@alessioalex
alessioalex / streaming-crawler.js
Created Nov 22, 2014
streaming-crawler.js that reads articles from first X pages
View streaming-crawler.js
var request = require('request');
var cheerio = require('cheerio');
var select = require('html-select');
var tokenize = require('html-tokenize');
var counter = 0;
function crawl(page, stopAt, cb) {
counter++;
You can’t perform that action at this time.