Skip to content

Instantly share code, notes, and snippets.

View diestrin's full-sized avatar

Diego Barahona diestrin

View GitHub Profile

Keybase proof

I hereby claim:

  • I am diestrin on github.
  • I am diestrin (https://keybase.io/diestrin) on keybase.
  • I have a public key ASApnkk77TweGbc8l5K2VW1dxVRF8CNvzgK1RNevvh6dnwo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am diestrin on github.
  • I am diestrin (https://keybase.io/diestrin) on keybase.
  • I have a public key whose fingerprint is 186A FADD AEF2 2A0C 5EC6 09F3 ABB5 4720 A12F 9968

To claim this, I am signing this object:

export const detailLog = msg => util.inspect(msg, { showHidden: false, depth: null });
export const concurrentCalls = <T1,T2=any>(config: {
maxConcurrentCalls: number,
promiseFn: (arg: T1) => Promise<T2>,
dataSource: T1[],
beforeCall?: (index?: number, item?: T1) => void,
afterCall?: (index?: number, error?: any, result?: T2) => void
}): Promise<{response: T2, error: any}[]> => {
return new Promise(resolve => {
const responses = [];
let currentIndex = config.maxConcurrentCalls - 1;
{
"channels": ["public", "private"],
"topology": {
"hyperledger": {
"channels": ["public"],
"users": ["john", "mike"]
},
"covalent": {
"channels": ["public", "private"],
"users": ["diego"]
// Create the mock controller adapter
const adapter = new MockControllerAdapter();
// Create the participant client
const participantCtrl = ClientFactory(ParticipantController, adapter);
// Initialize the adapter with all the controllers
await adapter.init([...]);
// Register an user
adapter.addUser('MyUser1');
class Neuron {
constructor() {
this.theta0 = 0;
this.theta1 = 0;
}
/**
* @param {number} value
*/
predict(value) {
const cube =
`+---+
/ /|
+---+ |
| | +
| |/
+---+`.split('\n');
/**
* @typedef {{x: number, y: number, z: number}} Coords
// lib imports
import { ReplaySubject } from 'rxjs/ReplaySubject';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import 'rxjs/add/operator/scan';
// external imports
import { mergeDeep, isFunction } from '@wu/utils';
export interface IAction<Actions> {
type: Actions;
payload?: any;
import { NgModule, Injectable } from '@angular/core';
import {
Request,
Response,
XHRBackend,
JSONPBackend,
RequestMethod
} from '@angular/http';
import {
NodeBackend,