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
@DobrinGanev
DobrinGanev / connect.js
Created August 20, 2017 03:40 — forked from gaearon/connect.js
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
namespace Sagas
{
using System;
using System.Collections.Generic;
class Program
{
static ActivityHost[] processes;
@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
@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 / 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 / bindings-cheat-sheet.md
Created February 21, 2018 19:14 — forked from eendeego/bindings-cheat-sheet.md
Node/V8 bindings cheat sheet
@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>
#include <pthread.h>
#include <unistd.h>
#include <iostream>
#include <v8.h>
using namespace v8;
static void *run(void *ptr) {