Skip to content

Instantly share code, notes, and snippets.

🇮🇹

Kilian Ciuffolo kilianc

🇮🇹
  • San Francisco, CA
View GitHub Profile
@kilianc
kilianc / count.js
Last active Dec 8, 2018
Example script for Shorts App
View count.js
let count = 0
let id = setInterval(() => {
if (count > 10) {
return clearInterval(id)
}
console.log(count++)
}, 1000)
console.log(Promise)
View consume-filestream.js
var bufferjoiner = require('bufferjoiner')
/**
* Consumes and buffers a file stream
* @param {ReadStream} fileStream The readable file stream
* @param {Function} callback The done callback
*/
module.exports = function consumeFileStream(fileStream, callback) {
if (undefined === callback) return consumeFileStream.bind(null, fileStream)
@kilianc
kilianc / continuable.test.js
Last active Dec 28, 2015
Testing if I forgot to make each method continuable. I am afraid I may be going insane.
View continuable.test.js
describe('#*', function () {
it('should return a continuable if a callback is not passed', function () {
Object.keys(Db.prototype).forEach(function (functionName) {
var params = introspect(db[functionName])
if (params.pop() === 'callback') {
var fnStr = db[functionName].toString()
var line = f('if (undefined === callback) return this.%s.bind(this, %s)', functionName, params.join(', '))
assert.isFunction(db[functionName](), functionName)
View firmata.cpp
/*
Firmata.cpp - Firmata library
Copyright (C) 2006-2008 Hans-Christoph Steiner. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
See file LICENSE.txt for further informations on licensing terms.
View jquery.tweenlite.js
/*!
* TweenLite jQuery plugin v0.0.1
*
* Copyright (c) 2011 Kilian Ciuffolo, me@nailik.org
*
* Licensed under the MIT license.
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
@kilianc
kilianc / patch.js
Last active Oct 3, 2015
Make you request object able to buffer flying packet after pause() call
View patch.js
require('http').IncomingMessage.prototype.makeBuffered = function () {
var self = this
var unluckyChunks = []
var isPaused = false
var isEnded = false
var originalResume = self.resume
var originalPause = self.pause
var originalEmit = self.emit
var currentEmit = originalEmit
You can’t perform that action at this time.