Skip to content

Instantly share code, notes, and snippets.

View zaosoula's full-sized avatar
🤖

Zao Soula zaosoula

🤖
View GitHub Profile
@zaosoula
zaosoula / relative-time.js
Last active May 4, 2022 10:10 — forked from danott/relative_time.php
Twitter style relative time.
const computeRelativeTime = (time) => {
if(typeof time === 'string') {
return computeRelativeTime(new Date(time));
}
const plural = (val) => val !== 1 ? 's' : '';
const format = (val, unit) => `${val} ${unit}${plural(val)} ago`;
let diff = (Date.now() - time.getTime()) / 1000;
@zaosoula
zaosoula / gitToZipArchive.sh
Last active December 20, 2021 19:48 — forked from betweenbrain/gist:4731411
Git archive changes made between two commits
git archive --format zip --output=./changes.zip HEAD $(git diff --name-only <SHA> <SHA>)