Skip to content

Instantly share code, notes, and snippets.

View pokedotdev's full-sized avatar
🤙

Poke pokedotdev

🤙
View GitHub Profile
@pokedotdev
pokedotdev / snowflake_id.pgsql
Last active October 2, 2023 01:48
instagram snowflake id
CREATE SCHEMA snowflake;
CREATE DOMAIN snowflake.id AS bigint;
CREATE SEQUENCE snowflake.table_id_seq;
CREATE OR REPLACE FUNCTION snowflake.next_id(shard_id smallint default 1)
RETURNS snowflake.id
AS $$
DECLARE
@pokedotdev
pokedotdev / tweet-date.ts
Last active January 23, 2023 16:49
Get time since a Tweet was created
const MS = {
SECOND: 1000,
MINUTE: 1000 * 60,
HOUR: 1000 * 60 * 60,
DAY: 1000 * 60 * 60 * 24,
} as const
function getTimeSinceTweet(tweetDate: Date): string {
const currentDate = new Date()
const diff = currentDate.getTime() - tweetDate.getTime()
@pokedotdev
pokedotdev / clsx.js
Last active July 22, 2022 03:12
Join class names
function toVal(mix) {
var k, y, str='';
if (typeof mix === 'string' || typeof mix === 'number') {
str += mix;
} else if (typeof mix === 'object') {
if (Array.isArray(mix)) {
for (k=0; k < mix.length; k++) {
if (mix[k]) {
if (y = toVal(mix[k])) {
str && (str += ' ');
/* Firefox Only */
@supports (-moz-appearance: none) {}
/* Chromium Only */
@supports (contain: paint) and (not (-moz-appearance: none)) {}
/* Chromium + Firefox */
@supports (contain: paint) {}
/* Chromium + Safari */
@pokedotdev
pokedotdev / .vimrc
Last active May 2, 2021 10:45
My neovim settings
syntax enable
set number
set mouse=a
set title
set numberwidth=4
set clipboard=unnamed
set showcmd
set ruler
set encoding=utf-8
set showmatch