Skip to content

Instantly share code, notes, and snippets.

View idx3d's full-sized avatar

Denys Lieukhyn idx3d

  • Ukraine
View GitHub Profile
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing
@intech
intech / gist:5879743
Last active December 19, 2015 01:59
// we need the fs module for moving the uploaded files
var fs = require('fs'),
EventEmitter = require('events').EventEmitter;
var uploadQueue = new EventEmitter();
uploadQueue.on('upload', function(tmp_path, target_path) {
// move the file from the temporary location to the intended location
fs.rename(tmp_path, target_path, function(err) {
if (err) throw err;
// delete the temporary file, so that the explicitly set temporary upload dir does not get filled with unwanted files
@schamane
schamane / curl.js
Created February 23, 2013 09:47
Curl vs http module for nodejs
var exec = require('child_process').exec,
url = "http://google.com/",
timeout = "3",
data="?q=test";
var time = process.hrtime();
exec('curl --max-time ' + timeout + ' -d \'' + data + '\' ' + url, function (error, stdout, stderr) {
var diff = process.hrtime(time);
//console.log('stdout: ' + stdout);
//console.log('stderr: ' + stderr);
@shripadk
shripadk / gist:652819
Created October 29, 2010 03:10
Express authentication using Redis for session store and Couchdb for database (in coffeescript!)
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'