Skip to content

Instantly share code, notes, and snippets.

View DobrinGanev's full-sized avatar
🏠
Working from home

Dobrin Ganev DobrinGanev

🏠
Working from home
View GitHub Profile
#include <pthread.h>
#include <unistd.h>
#include <iostream>
#include <v8.h>
using namespace v8;
static void *run(void *ptr) {
@DobrinGanev
DobrinGanev / hello-world.cc
Created February 21, 2018 19:23 — forked from tejom/hello-world.cc
console.log v8
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fstream>
#include <iostream>
@DobrinGanev
DobrinGanev / bindings-cheat-sheet.md
Created February 21, 2018 19:14 — forked from eendeego/bindings-cheat-sheet.md
Node/V8 bindings cheat sheet
@DobrinGanev
DobrinGanev / difference.js
Created January 25, 2018 05:43 — forked from Yimiprod/difference.js
Deep diff between two object, using lodash
/**
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {
return _.transform(object, function(result, value, key) {
if (!_.isEqual(value, base[key])) {
@DobrinGanev
DobrinGanev / echo_server.js
Created December 14, 2017 17:05 — forked from liamgriffiths/echo_server.js
simple node.js net tcp/unix socket echo server
/**
* echo server
*
*/
var net = require('net'),
port = 5000,
unixsocket = '/tmp/echo.sock';
var log = function(who, what) {
@DobrinGanev
DobrinGanev / lxc.sh
Created December 13, 2017 23:20 — forked from reqshark/lxc.sh
set up linux containers with node.js
# update the host
apt-get update && apt-get upgrade -y # && apt-get dist-upgrade -y && apt-get autoremove --purge -y && apt-get autoclean -y
# https://www.stgraber.org/
# install linux containers
sudo apt-get install lxc
# list all containers and view their current status
sudo lxc-ls -f
namespace Sagas
{
using System;
using System.Collections.Generic;
class Program
{
static ActivityHost[] processes;
@DobrinGanev
DobrinGanev / merkleTree.md
Last active September 29, 2017 16:16
merkleTree
import hashlib
# Hash pairs of items recursively until a single value is obtained
def merkle(hashList):
@DobrinGanev
DobrinGanev / observable.js
Created September 14, 2017 20:00
redux createStore returns [$$observable]: observable
/**
this is from the Redux createStore()
/**
* Interoperability point for observable/reactive libraries.
* @returns {observable} A minimal observable of state changes.
* For more information, see the observable proposal:
* https://github.com/tc39/proposal-observable
*/
function observable() {
const outerSubscribe = subscribe
@DobrinGanev
DobrinGanev / lastAction.js
Created September 1, 2017 04:33
redux last Action
const reducer = ((state = 0, action) => {
switch (action.type) {
case 'INCREMENT': return state + 1
case 'DECREMENT': return state - 1
default: return state
}
})
const initialState = {
count: 0