This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Data Class | |
class Address { | |
public street: string; | |
public city: string; | |
public state: string; | |
public zip: string; | |
public coordinates: Array<number>; | |
constructor(street: string, city: string, state: string, zip: string, coordinates: Array<number>) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********************************************************************/ | |
abstract class Animal { | |
public abstract caminar(): any; | |
public abstract maullar(): any; | |
public abstract ladrar(): any; | |
} | |
class Gato extends Animal { | |
public caminar() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IPublisher { | |
subscribe(observer: Observer): void | |
unsubscribe(observer: Observer): void | |
notify(news: String): void | |
} | |
interface IObserver { | |
update(news: string): void | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Crear una clase builder para un request http | |
// (Puede incluir URL, headers, body, timeout, etc…) | |
'use strict'; | |
class httpBuilder { | |
url = function(url) { | |
this.url = url; | |
return this; | |
} | |
headers = function(headers) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IPrice { | |
calculate(input: number): number; | |
} | |
class BasePrice implements IPrice { | |
calculate(input: number): number { | |
return input; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConnectionPrototype { | |
constructor(proto){ | |
this.proto = proto; | |
return this.clone(); | |
} | |
clone(){ | |
let connection = new Connection( | |
this.proto.driver, | |
this.proto.server, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const paymentsStates = { | |
id: 'payments', | |
initial: 'inicial', | |
states: { | |
inicial: { | |
on: { | |
// Aquí se añaden 2 opciones en la transición, en la primera el | |
// camino exitoso y la occondición, en la segunda el camino al error | |
TRANSITION: | |
[ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pokemons = [ | |
{ | |
"id": 3, | |
"name": "Venusaur", | |
"type": ["Grass", "Poison"], | |
"base": { | |
"HP": 80, | |
"Attack": 82, | |
"Defense": 83, | |
} |