Skip to content

Instantly share code, notes, and snippets.

View cesalberca's full-sized avatar

César Alberca cesalberca

View GitHub Profile
| Color Favorito | Nombre Clase OOP 1 | Mes de Nacimiento | Nombre Clase OOP 2 | Comida Favorita | Nombre Clase OOP 3 |
|----------------|--------------------|-------------------|--------------------|-----------------|--------------------|
| Azul | Singleton | Enero | Factory | Pizza | Service |
| Rojo | Facade | Febrero | Adapter | Sushi | Manager |
| Verde | Decorator | Marzo | Observer | Hamburguesas | AbstractFactory |
| Amarillo | Command | Abril | Proxy | Tacos | Iterator |
| Morado | Template | Mayo | Bridge | Pasta | Builder |
| Naranja | Visitor | Junio | Composite | Helado | Prototype |
| Rosa | Strategy | Julio | Chai
@cesalberca
cesalberca / data.json
Created May 3, 2022 16:10
Frameworks
[
"lodash",
"chalk",
"eslint",
"react",
"dotenv",
"moment",
"async",
"debug",
"semver",
type VerticalAlignment = "top" | "middle" | "bottom";
type HorizontalAlignment = "left" | "center" | "right";
declare function setAlignment(value: `${VerticalAlignment}-${HorizontalAlignment}`): void;
setAlignment("top-left"); // works!
setAlignment("top-middel"); // error!
setAlignment("top-pot"); // error!
@cesalberca
cesalberca / range.ts
Created June 30, 2020 15:33
Range function that returns an array from a given number to another
export function range(start: number, end?: number): number[] {
return [...Array(end !== undefined ? end - start : start).keys()].map(i => i + (end !== undefined ? start : 0))
}
if (isProtected) {
/**
* We have to execute this code outside of the JavaScript's main context
* in order to let Angular finish with the closing animation
*/
setTimeout(() => {
this.router.navigate([paths.root])
}, 0)
}
export type Paths = {
[key: string]: string | Paths
root: string
}
export decorator @logged {
@wrap(f => {
const name = f.name;
function wrapped(...args) {
console.log(`starting ${name} with arguments ${args.join(", ")}`);
f.call(this, ...args);
console.log(`ending ${name}`);
}
Object.defineProperty(wrapped, "name", {
value: name,
function f() {
console.log("f(): evaluated");
return function (target, propertyKey: string, descriptor: PropertyDescriptor) {
console.log("f(): called");
}
}
{
"name": "blog",
"description": "César Alberca's blog",
"version": "0.1.0",
"license": "MIT",
"private": true,
"homepage": "https://www.cesalberca.es",
"scripts": {
"prestart": "run-s -l clean",
"start": "run-p -l server copy:watch compile:watch",
name: CI
on:
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps: