Skip to content

Instantly share code, notes, and snippets.

View productdevbook's full-sized avatar
🖥️
Coding

Mehmet productdevbook

🖥️
Coding
View GitHub Profile
@KristofferEriksson
KristofferEriksson / useLocation.ts
Created February 11, 2024 16:44
A React Typescript hook that provides real-time geolocation data, complete with heading and speed metrics
import { useEffect, useState } from "react";
interface LocationOptions {
enableHighAccuracy?: boolean;
timeout?: number;
maximumAge?: number;
}
interface LocationState {
coords: {
npm init vue@3
if [ $? -eq 0 ]; then
LAST_FOLDER=$(ls -td ./* | head -1)
cd $LAST_FOLDER
yarn
code .
else
echo "Project creation unsuccessful 😔"
fi
@web-padawan
web-padawan / index.js
Created October 17, 2021 12:31
GitHub dependents
#!/usr/bin/env node
const cliProgress = require('cli-progress');
const gh = require('github-url-to-object');
const meow = require('meow');
const puppeteer = require('puppeteer');
const usage = `Usage
$ github-dependents <repository>
@kjmph
kjmph / A_UUID_v7_for_Postgres.sql
Last active April 23, 2024 15:26
Postgres PL/pgSQL function for UUID v7 and a bonus custom UUID v8 to support microsecond precision as well. Read more here: https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/
-- Based off IETF draft, https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/
create or replace function uuid_generate_v7()
returns uuid
as $$
begin
-- use random v4 uuid as starting point (which has the same variant we need)
-- then overlay timestamp
-- then set version 7 by flipping the 2 and 1 bit in the version 4 string
return encode(
@fabiolimace
fabiolimace / UUIDv6.sql
Last active April 30, 2024 06:04
Functions for generating UUIDv6 and UUIDv7 on PostgreSQL
/*
* MIT License
*
* Copyright (c) 2023-2024 Fabio Lima
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is