Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I used to work remotely back when it wasn't mainstream

Marcelo Luiz Onhate onhate

💭
I used to work remotely back when it wasn't mainstream
View GitHub Profile
@onhate
onhate / executor.js
Last active Apr 19, 2021
Queue Executor in Vanilla Javascript / Typescript
View executor.js
export const waitForMillis = async (millis: number) => {
return new Promise(resolve => setTimeout(resolve, millis));
};
export const executor = (concurrency = 100) => {
let workers = 0;
let index = 0;
let queue = [];
const waitFor = async () => {
@onhate
onhate / dynamodb-graphql-dataloader.ts
Created Oct 16, 2020
Zero Dependencies DynamoDB Graphql DataLoader
View dynamodb-graphql-dataloader.ts
import { DocumentClient } from 'aws-sdk/clients/dynamodb';
import DataLoader from 'dataloader';
export type DynamodbDataloader = DataLoader<GetRequest, DocumentClient.AttributeMap | null>
interface GetRequest {
TableName: string;
Key: DocumentClient.Key;
}
@onhate
onhate / remark-auto-link.ts
Last active Jul 23, 2020
remark auto link workaround to generate correct link output format
View remark-auto-link.ts
@onhate
onhate / express-dynamic-routes-file-system.js
Last active Jan 17, 2021
Load Express Routes dynamically like Nuxt.js
View express-dynamic-routes-file-system.js
const express = require('express');
const glob = require("glob");
const app = express();
glob.sync('./api/**/*.http.js', { cwd: __dirname })
.forEach(file => {
const endpoint = file.split('.http.js').join('')
.split('_').join(':')
.substr(1);
View jsWithBinary-GumTreeInfiniteLoop-left.js
// --- TreeGrid Header ---
Component = {
// --- File information ---
Name: "Editable JavaScript TreeGrid",
Address: "http://www.treegrid.com",
Type: "TreeGrid with Gantt chart with Extended API",
Version: "9.2.12",
Release: "3. June 2013 10:52",