Skip to content

Instantly share code, notes, and snippets.

View aescarcha's full-sized avatar

Álvaro Escarcha aescarcha

View GitHub Profile
@aescarcha
aescarcha / nodeAsyncTest.js
Created September 25, 2018 07:03
Javascript async / await resolving promises at the same time test
// Simple gist to test parallel promise resolution when using async / await
function promiseWait(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(true);
}, time);
});
}
@aescarcha
aescarcha / example.ts
Last active October 9, 2018 11:49
Browser image downscaling on Typescript with Angular example
// Example of picking a file and using this
// Angular + material, you can go to handleInput
<button type="button" mat-raised-button color="primary" (click)="fileInput.click()">
<span>Sube tu foto</span>
<input #fileInput type="file" (change)="handleFileInput($event)" style="display:none;" />
</button>
@aescarcha
aescarcha / gist:341db9d36ccff444b8ad1368e2c834c2
Last active November 26, 2021 16:36
Inversify double controller inheritance failing test
import {Container, injectable} from 'inversify';
import * as supertest from 'supertest';
import {json, urlencoded} from 'express';
import {InversifyExpressServer} from '../../src/server';
import {
controller, httpGet, requestParam,
httpDelete, httpPost, httpPut, requestBody,
} from '../../src/decorators';
import {cleanUpMetadata} from '../../src/utils';
import {getRouteInfo} from '../../src';