Skip to content

Instantly share code, notes, and snippets.

View tatthien's full-sized avatar
🦄
.gitignore

Thien Nguyen tatthien

🦄
.gitignore
View GitHub Profile
@KristofferEriksson
KristofferEriksson / useDebounce.ts
Created February 13, 2024 14:14
A React Typescript hook that allows you to debounce any fast changing value
import { useEffect, useState } from "react";
/**
* useDebounce hook
* This hook allows you to debounce any fast changing value. The debounced value will only
* reflect the latest value when the useDebounce hook has not been called for the specified delay period.
*
* @param value - The value to be debounced.
* @param delay - The delay in milliseconds for the debounce.
* @returns The debounced value.
@rsms
rsms / example.txt
Last active March 11, 2023 23:00
source line-length histogram script
./linelen_hist.sh src '*.c'
COLS COUNT
2 1317 ████████████████████████████████████████████████████████████▌
4 583 ██████████████████████████▏
6 500 ██████████████████████▎
8 253 ███████████▊
10 264 ████████████▊
12 448 ████████████████████▋
14 417 ███████████████████▌
16 476 █████████████████████▍
@spawnrider
spawnrider / index.js
Created March 15, 2022 07:47
Custom endpoints for Directus snapshot import/export
import { defineEndpoint } from '@directus/extensions-sdk';
import * as fs from 'fs';
import * as path from 'path';
import { spawn } from 'child_process';
import busboy from 'busboy';
export default defineEndpoint((router) => {
@fnky
fnky / ANSI.md
Last active April 26, 2024 16:45
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27

VimWiki Cheatsheet

[number] refers to the wiki number, set by the order in your vimrc. The default is 1.

Wiki Management

  • [number] <leader> ww - open wiki index file
  • [number] <leader> wt - open wiki index file in new tab
  • <leader> ws - list and select available wikis
  • wd - delete wiki page
@sosedoff
sosedoff / 1_simple.go
Created July 16, 2016 18:45
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"