Skip to content

Instantly share code, notes, and snippets.

View ajchambeaud's full-sized avatar

Ainu Jorge Chambeaud Helguera ajchambeaud

View GitHub Profile
@ajchambeaud
ajchambeaud / index.js
Created December 10, 2015 18:28
Promise Error Handler
function a(){
var promise = new Promise(function (resolve, reject) {
resolve(1);
});
return promise;
}
function b(){
return a().then(function () {
return Promise.resolve("11");
interface Person {
firstName: string;
lastName: string;
}
function greeter(person: Person) {
return "Hello, " + person.firstName + " " + person.lastName;
}
var user = { firstName: "Jane", lastName: "User" };
@ajchambeaud
ajchambeaud / PromisifyExample.js
Created April 24, 2017 23:30
Promisify node CPS functions
/*
* Simple async function: Dividir dos numeros. Falla si el deniminador es cero
*/
function ioDivisionOpeation(x, y, callback) {
setTimeout(
() => {
if (y === 0) {
return callback(new Error('Division by cero'));
}
@ajchambeaud
ajchambeaud / PromiseAll.js
Created April 24, 2017 23:50
Promise.All Example
// Function simple que retorna una promise
function add(a, b) {
/**
* Alias para:
*
* return new Promise((resolve, reject) => resolve(a + b));
*/
return Promise.resolve(a + b);
}
// Implementacion simple de un EventEmitter en node.js
class Emitter {
constructor() {
this.subscriptors = {};
}
emit(event, data) {
this.subscriptors[event] && this.subscriptors[event].forEach(subscritor => subscritor(data));
}
@ajchambeaud
ajchambeaud / README.md
Created August 15, 2017 02:05
Elm Workshop - Guia de instalacion

Instalacion del Entorno

Node.js

Instalar la version LTS de Node.js

Asegurate de tener node.js instalado, ya que varias tools dependen de node. Recomendamos instalar la version 6.11 (LTS) que podes descargar de la pagina de node.

@ajchambeaud
ajchambeaud / FizzBuzz.js
Created December 2, 2017 18:05
JS FizzBuzz
/*
* Write a program that prints the numbers from 1 to 100.
* But for multiples of three print “Fizz” instead of the number
* and for the multiples of five print “Buzz”.
* For numbers which are multiples of both three and five print “FizzBuzz”
*/
const range = (init, end) => {
const nums = [];
@ajchambeaud
ajchambeaud / learningjs.md
Last active March 7, 2019 14:29
The ajchambeaud's recommended books and courses to master React and JS

Frontend Masters: AWS for Frontend Engineers

You should have the following completed on your computer before the workshop:

  • Install the AWS CLI.
  • Have Node.js installed on your system. (Recommended: Use nvm.)
    • Install yarn with brew install yarn.
  • Create an AWS account. (This will require a valid credit card.)
  • Create a Travis CI account. (This should be as simple as logging in via GitHub).