Skip to content

Instantly share code, notes, and snippets.

View productdevbook's full-sized avatar
🖥️
Coding

Mehmet productdevbook

🖥️
Coding
View GitHub Profile
@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',
@productdevbook
productdevbook / pnpm-git.yml
Created November 17, 2022 04:42
pnpm with cache
name: Main
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@productdevbook
productdevbook / get-ip-address.ts
Created June 20, 2022 07:29
Get IP Adress Func
import os from 'node:os'
function getIPAdress() {
let localIPAddress = ''
const interfaces = os.networkInterfaces()
for (const devName in interfaces) {
const iface = interfaces[devName] as os.NetworkInterfaceInfo[]
for (let i = 0; i < iface.length; i++) {
const alias = iface[i]
if (
@productdevbook
productdevbook / confetti-js.vue
Last active June 14, 2022 17:21
confetti-js vue 3
<script setup lang="ts">
import ConfettiGenerator from 'confetti-js'
const confettiElement = ref<HTMLCanvasElement | null>(null)
const canvasBoundingRect = computed(() => {
if (confettiElement.value) {
return confettiElement.value.getBoundingClientRect()
}
return {
top: 0,
left: 0,
@productdevbook
productdevbook / strings.xml
Created June 13, 2022 10:24 — forked from prakashpun/strings.xml
Add test AdMob app ID and ad unit IDs which has to be replaced later with live production ads for Admob account
<resources>
...
<string name="admob_app_id">ca-app-pub-3940256099942544~3347511713</string>
<string name="ad_unit_id">ca-app-pub-3940256099942544/5224354917</string>
...
</resources>