Skip to content

Instantly share code, notes, and snippets.

View alemures's full-sized avatar

Alejandro Santiago alemures

View GitHub Profile
@alemures
alemures / services.md
Last active January 19, 2017 12:54
High performance Web Services
@alemures
alemures / yield-promise.js
Created June 23, 2016 14:02
Yield Promises
function run(generator) {
var it = generator();
var obj = it.next();
(function _run() {
if (!obj.done) {
obj.value.then(result => {
obj = it.next(result);
_run();
}).catch(err => it.throw(err));
@alemures
alemures / AsyncFuture.java
Last active May 21, 2023 09:22
Async Future with callback in Java
package com.test;
import java.util.Random;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class AsyncFuture {
public static void main(String[] args) {
ExecutorService service = Executors.newFixedThreadPool(5);
@alemures
alemures / async-comparison.js
Last active April 20, 2016 15:35
Comparison between different ways to implement async methods in Node.js
'use strict';
const async = require('async');
const Promise = require('bluebird');
const db = {
app: [
{ id: 10, name: 'twitter' },
{ id: 11, name: 'facebook' },
{ id: 12, name: 'google' }