Skip to content

Instantly share code, notes, and snippets.

View 1N50MN14's full-sized avatar

Ayman Mackouly 1N50MN14

  • Stockholm, Sweden
View GitHub Profile
am@dfv:~/dev/dfv/playground/lmdb$ yarn add lmdb-store
yarn add v1.22.4
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error /home/am/dev/dfv/playground/lmdb/node_modules/lmdb-store: Command failed.
Exit code: 1
Command: prebuild-install || node-gyp rebuild
Date: Wed, 27 Apr 2016 22:12:11 +0500
Subject: [PATCH] Taking screen shot Api
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Usage:
cordova.plugins.iosrtc.takeScreenShot(okResult);
** param ‘okResult’ is a call back method which received base64 PNG
@1N50MN14
1N50MN14 / transform-stream
Last active August 29, 2015 14:02
Simple transform stream
function Through(opts, onData, onEnd) {
if (!(this instanceof Through)) return new Through(opts, onData, onEnd)
Transform.call(this, opts)
this._transform = onData
if (typeof onEnd === 'function') this._flush = onEnd
}
inherits(Through, Transform)
function through(opts, onData, onEnd) {
if (typeof opts === 'function') {
@1N50MN14
1N50MN14 / gist:0001e454688e0d985bac
Created May 16, 2014 08:31
multipelx id as meta
var concat = require('concat-stream')
var plex1 = require('multiplex')
var meta = {id:'mystream', collect:true}
var s = plex1.createStream(JSON.stringify(meta))
var plex2 = multiplex(function onStream(stream, meta) {
var m = JSON.parse(stream.meta)
if (m.collect) return stream.pipe(collect(m))
// do something else
@1N50MN14
1N50MN14 / gist:6059074
Created July 23, 2013 01:04
webinstance/app notification example
******** client code ********
var Unreal = require('unrealjs')
var routes = require('./routes')
var app = new Unreal({role:'web', version:'0.0.1'})
app.registerRoutes(routes)
app.on('ready', function (remote) {
// do this when a user logs in
@1N50MN14
1N50MN14 / gist:6058736
Created July 22, 2013 23:57
Complete livereload example
var unreal = require('unrealjs'),
host = unreal.isProduction ? '55.55.55.55' : '127.0.0.1',
port = unreal.isProduction ? 8888 : 9999
var services = unreal.serviceRegistry.connect(host, port)
var config = {
views: { //must always contain a layout file (either .html or .jade)
paths: ['views/'],
options: {},
@1N50MN14
1N50MN14 / gist:5136884
Created March 11, 2013 19:20
couchdb run error
{"init terminating in do_boot",{{badmatch,{error,{bad_return,{{couch_app,start,[normal,["/etc/couchdb/default.ini","/etc/couchdb/local.ini"]]},{'EXIT',{{badmatch,{error,{error,eacces}}},[{couch_server_sup,start_server,1,[{file,"couch_server_sup.erl"},{line,56}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,274}]}]}}}}}},[{couch,start,0,[{file,"couch.erl"},{line,18}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
@1N50MN14
1N50MN14 / gist:5021563
Created February 23, 2013 22:05
document shim for hyperscript
function Document() {}
Document.prototype.createTextNode = function(v) {
var n = new Text();
n.value = v;
return n;
}
Document.prototype.createElement = function(nodeName) {
var el = new Element();
var net = require('net'),
os = require('os'),
es = require('event-stream'),
Doc = require('crdt').Doc,
uuid = require('node-uuid'),
inherits = require('inherits'),
EventEmitter = require('events').EventEmitter;
module.exports = P2P;