A very simple local-time only date formatting tool that lives in one file and does the minimum for mvp.
const {format} = require('./dateUtil.js')
let date=Date.now()
let formatStr='www, DD mmmm, YYYY H:I:s.SS'
import fs from 'fs' | |
import path from 'path' | |
import YAML from 'js-yaml' | |
/** | |
* Process an object with references | |
* @param {object} obj - the object to process | |
* @param {string} rootFolder - the folder where the yaml file is located | |
* @returns {object} | |
*/ |
const fs = require('fs') | |
const events = require('events') | |
const readline = require('readline') | |
const readLinesFromFile = async function(file, start, count) { | |
let end = start + count | |
let lines = [] | |
try{ | |
let rl = readline.createInterface({ | |
input: fs.createReadStream(file), |
This function will remove all cookies that are:
/
)const {start, measure, create} = require('./timer.js') | |
const MAX=1000 | |
var seed = Math.random()*1000; | |
function random() { | |
var x = Math.sin(seed++) * 10000; | |
return x - Math.floor(x); | |
} |
const debug=require('./qdebug.js') | |
const log1 = debug('log1') | |
const log2 = debug('log2') | |
const sublog = log1.ext('sublog') | |
log1.info('hello world', {test:Math.random()}) | |
log2.info('hello world', {test:Math.random()}) | |
sublog.info('hello world', {test:Math.random()}) |
# VsCode Local Settings :: The team is too cool to standardise IDE | |
.vscode/ | |
# Temp-Folder ::I am so dumb I need a persistent scratch-pad | |
tmp/ | |
# Dev Scripts :: The team is too advanced for this shit | |
dev/ | |
# Unofficial Docs :: The team is too clever for this shit |
#!/bin/bash | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
const timespanToMs=(timeSpan)=>{ | |
let lut={'':1, ms:1, s:1000, m:60000, h:3600000, d: 86400000, w:604800000, y:31556952000 } | |
let ms=(`${timeSpan}`.match(/\d+[ywdhms]{0,2}\s?/g)).reduce((a,s)=>{ | |
let [,v,m] =s.match(/(\d+)([ywdhms]{0,2})/) | |
return a + (v * lut[m]) | |
},0) | |
return ms | |
} | |
let passTests=[ |
const Catch = async (promise, errorHandler) => { | |
if (promise instanceof Promise) { | |
try { | |
let returnValue = await promise | |
return returnValue | |
} catch (e) { | |
if (typeof errorHandler === 'function') return errorHandler(e) | |
return errorHandler | |
} | |
} |