Skip to content

Instantly share code, notes, and snippets.

View ponkys's full-sized avatar
🦦

Diego M Mosquera ponkys

🦦
View GitHub Profile
@ponkys
ponkys / server_timeout.js
Last active November 10, 2021 21:49
Emulate a timeout
const fastify = require('fastify')({ logger: true })
var timer = {};
function delay(callback, length){
if(!timer.startTime){
timer.startTime = new Date().getTime();
timer.callback = callback;
timer.length = length;
}
@ponkys
ponkys / changelog-generator.js
Created June 17, 2019 14:50
changelog-generator to compare two branches
// use like this node tools/changelog-generator.js upstream/master upstream/develop
#! /usr/bin/env node
'use strict';
const REVISION = setupArguments(process.argv);
const JIRA_BASE_URL = 'https://motainteam.atlassian.net/browse/:issueid';
const GIT_LOG_CMD = `git log --merges --pretty="%b" ${REVISION}`;
require('child_process').exec(GIT_LOG_CMD, (error, stdout) => {
if (error) {
console.error(`git log error: ${error}`);
@ponkys
ponkys / counter-composition.js
Created January 15, 2019 10:47 — forked from adrianmcli/counter-composition.js
An example of using plain functions and composing them to make state containers.
// state container definition
const useState = initVal => {
let val = initVal;
const get = () => val;
const set = x => (val = x);
return Object.freeze({ get, set });
};