Skip to content

Instantly share code, notes, and snippets.

View Caballerog's full-sized avatar
:octocat:
live$.pipe(map(person => person.teach(me)),tap(me => me.betterEachDay())))

Carlos Caballero Caballerog

:octocat:
live$.pipe(map(person => person.teach(me)),tap(me => me.betterEachDay())))
View GitHub Profile
@Caballerog
Caballerog / INSTALL.rst
Created February 11, 2017 22:31 — forked from sakti/INSTALL.rst
sentry setup with docker-compose

In order to run this image do: docker-compose up -d to get all up. On first run DB initialization and initial user setup is done like so:

First start a bash in the container: docker-compose exec sentry /bin/bash. Then, inside bash, do sentry upgrade wait until it asks you for an inital user. When finished exit the bash.

When in doubt check with docker-compose ps if all went fine.

@Caballerog
Caballerog / introrx.md
Created March 2, 2017 20:18 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
function factorial(num) {
return num === 0 ? 1: (num * factorial(num - 1));
}
function factorial(num){
let total = 1;
for (i=1; i <= num; ++i) {
total = total * i;
}
return total;
}
const add = (x, y) => x + y;
const calculateBill = (sumOfCart, tax) => sumOfCart * tax;
const memoize = fn => {
const cache = {}; // 1
return (...args) => { // 2
const stringfiedArgs = JSON.stringify(args); // 3
const result = (cache[stringifiedArgs] =
typeof cache[stringifiedargs] === 'undefined'
? fn(...args)
: cache[stringifedArgs]); // 4
return result; // 5
};
const add = (x, y) => x + y;
const addMemoized = memoize(add); // Decorator Pattern
const isUniqueExponential = arr => {
let result = true;
for (let i = 0; i < arr.length; i++){
for (let j = 0; j < arr.length; j++){
if (i !== j && arr[i] === arr[j]) {
result = false;
}
}
}
return result;
const randomArray = length =>
Array.from({ length }, () => Math.floor(Math.random() * length));
const params = [
randomArray(19000),
randomArray(19000),
randomArray(19000),
randomArray(19000),
];
const measureTime = (cb, ...args) => {
const t0 = performance.now();
cb(...args);
const t1 = performance.now();
console.log('Call to doSomething took ' + (t1 - t0) + ' milliseconds.');
};