Skip to content

Instantly share code, notes, and snippets.

View productdevbook's full-sized avatar
🖥️
Learning

Wind productdevbook

🖥️
Learning
View GitHub Profile
## Git Update Alias
You can create a Git alias to easily update your fork by synchronizing it with the original repository (upstream). The alias performs a series of commands to fetch the latest changes from upstream, merge them into your fork, and push the changes to your remote repository.
### 1. **Set up the Alias**
Run the following command in your terminal to define the `git update` alias:
```bash
git config --global alias.update '!f() { git fetch upstream && git merge upstream/main && git push origin main; }; f'
@productdevbook
productdevbook / docker.yml
Last active March 6, 2025 20:03
docker.yml
docker pull redis:7.4.2-alpine3.21
docker pull postgres:17.4-alpine3.21
# run
docker run --name dev-redis -d -p 6379:6379 redis:7.4.2-alpine3.21
docker run --name dev-postgres -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres postgres:17.4-alpine3.21
docker run --name dev-mail -d -p 1080:1080 -p 1025:1025 marlonb/mailcrab:latest
# connect
DATABASE_POSTGRES_URL=postgres://postgres:postgres@localhost:5432/postgres
REDIS_URL=redis://localhost:6379
@productdevbook
productdevbook / format.sh
Created March 6, 2025 13:03 — forked from garethrees/format.sh
Format USB drive from the command line macOS
diskutil list
diskutil unmountDisk /dev/disk2
diskutil eraseDisk FAT32 SANDISK /dev/disk2
// #1
function logWrapper(fn: Function) {
return function (...args: any[]) {
console.log(`Calling function with args: ${args}`);
return fn(...args);
};
}
@productdevbook
productdevbook / motion.ts
Created November 13, 2024 12:52
Motion Test
import { animate } from 'motion'
import type { AnimationPlaybackControls, ValueAnimationOptions } from 'motion/react'
import {
type VNode,
computed,
defineComponent,
h,
mergeProps,
reactive,
useAttrs,
@productdevbook
productdevbook / A_UUID_v7_for_Postgres.sql
Created November 6, 2023 05:13 — forked from kjmph/A_UUID_v7_for_Postgres.sql
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(
@productdevbook
productdevbook / urql.ts
Created March 4, 2023 18:34
Nuxt 3 urql graphql
import { Client, createClient, dedupExchange, errorExchange, fetchExchange, ssrExchange } from '@urql/core'
import { ref } from 'vue'
import { devtoolsExchange } from '@urql/devtools'
import * as Session from 'supertokens-web-js/recipe/session'
import { authExchange } from '@urql/exchange-auth'
import { defineNuxtPlugin } from '#app'
const ssrKey = '__URQL_DATA__'
export default defineNuxtPlugin((nuxtApp) => {
@productdevbook
productdevbook / geo.json
Created December 8, 2022 09:21
geoexample.json
{
type: 'FeatureCollection',
features: [
{
type: 'Feature',
properties: {
asdas: 'asdas',
},
geometry: {
type: 'Polygon',