Skip to content

Instantly share code, notes, and snippets.

View spion's full-sized avatar
:shipit:

Gorgi Kosev spion

:shipit:
View GitHub Profile
@spion
spion / proxy.js
Last active January 4, 2016 06:19 — forked from whoeverest/proxy.js
var http = require('http');
var proxy = require('http-proxy').createProxyServer({ target: 'https://192.168.88.167:5000/', secure: false });
http.createServer(proxy.web.bind(proxy))
.on('upgrade', proxy.ws.bind(proxy))
.listen(4433);
function nextRequire(prevWorkDone) {
if(requires.length) {
return stage(requires.shift(), true, options).then(function(workDone) {
anyWorkDone = anyWorkDone || workDone;
return nextRequire();
});
} else {
return work(rules, options, isChild, anyWorkDone);
}
}
@spion
spion / README.md
Last active January 2, 2016 05:08 — forked from ithinkihaveacat/README.md

Comparison of two different approaches to structuring code that uses Promises.

Version using .then(), from Complex task dependencies:

files.getLastTwoVersions(filename)
    .then(function(items) {
        return [versions.get(items.last), 
                versions.get(items.previous)];
    })
var less = require("less"),
Promise = require("promise");
module.exports = function(options) {
return function(inputs) {
return Promise.all(inputs.map(lessp)).then(function(css) { return css.join(''); });
};
};
function lessp(input) {
@spion
spion / gen-test.js
Last active December 17, 2015 13:59 — forked from creationix/output.log
var fs = require('fs');
function run(makeGenerator) {
return function () {
var generator = makeGenerator.apply(this, arguments);
var continuable, sync, value;
next();
function next() {
ffmpeg = require 'fluent-ffmpeg'
mongoose = require 'mongoose'
amqp = require 'amqp'
async = require 'async'
# Connect to RabbitMQ
amqpConnect = (done) ->
amqpConnection = amqp.createConnection {host: 'localhost'}
amqpConnection.on 'ready', done.bind(this, null, amqpConnection);
amqpConnection.on 'error', done.bind(this, "Failed connecting to rabbit");
#include <OneWire.h>
#include <LiquidCrystal.h>
#include <avr/delay.h>
#define CHANGERATE 5 // in which limits will the temperature change since the last reading, in degrees
#define INPUTPIN 5
// For every sensor found it outputs to serial:
// SensorID,CurrentTemp,Readout time,Current time
// Info at: http://wiki.spodeli.org/Хаклаб/Температура