Skip to content

Instantly share code, notes, and snippets.

View darlanthiago's full-sized avatar
💻
I'm programming and drinking coffee

Darlan Thiago darlanthiago

💻
I'm programming and drinking coffee
View GitHub Profile
@LewisJEllis
LewisJEllis / getRelativeTimeString.ts
Last active November 8, 2024 00:35
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();
const minute = 60;
const hour = minute * 60;
const day = hour * 24;
const week = day * 7;
const month = day * 30;
const year = day * 365;
/**
* Convert a date to a relative time string, such as
* "a minute ago", "in 2 hours", "yesterday", "3 months ago", etc.

How to install Laravel globally in Ubuntu

===================================================================

Open your terminal using Ctrl+Alt+T and type the following commands

Step 1: Install Laravel

composer global require "laravel/installer"
@leocomelli
leocomelli / git.md
Last active May 9, 2026 22:50
Lista de comandos úteis do GIT

GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda