Skip to content

Instantly share code, notes, and snippets.

View paolorossi's full-sized avatar

I don't run when I code paolorossi

View GitHub Profile
@paolorossi
paolorossi / html5-video-streamer.js
Created March 7, 2012 13:21
Node.js HTML5 video streamer
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
@paolorossi
paolorossi / async-task-queue.js
Last active December 17, 2021 04:36
Javascript Queue for sequencing AJAX requests and other asynchronous tasks. Demo http://jsfiddle.net/rusci/26Dud/6/
// Queue class for serializing AJAX calls.
//
// Inspired by Raynos http://stackoverflow.com/a/4797596/1194060
//
// Queue has a public append method that expects some kind of task.
// A task is a generic function passed as callback.
// Constructor expects a handler which is a method that takes a ajax task
// and a callback. Queue expects the handler to deal with the ajax and run
// the callback when it's finished
@paolorossi
paolorossi / designer.html
Last active August 29, 2015 14:09
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">
@paolorossi
paolorossi / infinite-ssh.js
Last active August 29, 2015 14:21
Node.js: retry SSH connection after error (with timeout)
// npm install ssh2
var Client = require('ssh2').Client;
var cmd = 'tail -f /tmp/foo.log';
var TIMEOUT = 5000;
var host = {
host: 'host.example.com',
port: 22,
username: 'username',
password: 'password'
@paolorossi
paolorossi / angular-js-google-maps-markers-clustering-spiderfying.markdown
Created May 25, 2017 05:44
Angular.js - Google Maps - Markers clustering & spiderfying