Skip to content

Instantly share code, notes, and snippets.

View ibrahimcesar's full-sized avatar
☁️
Learn and Be Curious

Ibrahim Cesar ibrahimcesar

☁️
Learn and Be Curious
View GitHub Profile
@ibrahimcesar
ibrahimcesar / pandoc-cheatsheet.md
Created April 20, 2022 08:40 — forked from cferdinandi/pandoc-cheatsheet.md
CLI cheats for creating a markdown ebook with Pandoc.

epub

pandoc assets/metadata.yml chapters/*.md -o book.epub -S

pdf

Using WKHTMLtoPDF (no page numbers)

@ibrahimcesar
ibrahimcesar / getRelativeTimeString.ts
Created June 2, 2022 13:13 — forked from LewisJEllis/getRelativeTimeString.ts
Simplified getRelativeTimeString
// from https://twitter.com/Steve8708/status/1504131981444980739
// simplified to a function body of 8 tidy lines
// no loop needed, no 2d array of 3-tuples needed
// just 2 arrays, a findIndex call, and some indexing :)
export function getRelativeTimeString(
date: Date | number,
lang = "en"
): string {
const timeMs = typeof date === "number" ? date : date.getTime();