Skip to content

Instantly share code, notes, and snippets.

View productdevbook's full-sized avatar
🖥️
Learning

Wind productdevbook

🖥️
Learning
View GitHub Profile
@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>
@productdevbook
productdevbook / fullnested.ts
Created June 4, 2022 16:34
nested property full
type TerminalType =
| string
| number
| bigint
| boolean
| null
| undefined
| any[]
| Map<any, any>
| Set<any>
type TerminalType =
| string
| number
| bigint
| boolean
| ((...args: any) => any)
/**
* Deep nested keys of an interface with dot syntax
*
@productdevbook
productdevbook / genarate-jwt.md
Last active May 18, 2022 03:14
JWT Generate

Generate the RSA keys

openssl genrsa -out private.pem 2048 openssl rsa -in private.pem -pubout > public.pem

Yukaridaki kisim openssl kullarak rs256 sifreleme sistemini kullanarak bir gizli key yaratiyor. Sonra bu gizli keyden public key yaratiyoruz.

Bu iki key sistemde kullaniyoruz. Jwt sifrelenirken public key ile sifrenip karsiya gonderiyor. Karsi taraf bize istek attiginda tokeni public key ile cozuyoruz.

print the keys in an escaped format

awk -v ORS='\n' '1' private.pem

Increasing the amount of inotify watchers

If you are not interested in the technical details and only want to get Listen to work:

  • If you are running Debian, RedHat, or another similar Linux distribution, run the following in a terminal:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
@productdevbook
productdevbook / filterArray.js
Created July 7, 2021 03:54 — forked from jherax/arrayFilterFactory.1.ts
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {