Skip to content

Instantly share code, notes, and snippets.

View tuananhlai's full-sized avatar

Lại Tuấn Anh tuananhlai

  • Japan
  • 23:40 (UTC -12:00)
View GitHub Profile
@exzork
exzork / GM Handbook.txt
Last active February 1, 2025 05:22
GM Handbook for Grasscutter
// Grasscutter 2.7.0 GM Handbook
// Created 2022/05/31 17:46:25
// Commands
sendmessage : Sends a message to a player as the server
setfetterlevel : Sets your fetter level for your current active character
setworldlevel : Sets your world level (Relog to see proper effects)
setstats : Sets fight property for your current active character
give : Gives an item to you or the specified player
@meeech
meeech / cachemodule.ts
Created August 31, 2021 15:17
Register dynamic module with some error handling nestjs
@Module({
imports: [
CacheModule.registerAsync({
imports: [ConfigModule],
useFactory: async (
cConfig: ConfigType<typeof cacheConfig>,
rConfig: ConfigType<typeof redisConfig>,
) => {
Logger.log(`*** Cache is disabled: ${cConfig.disabled}`);
@pesterhazy
pesterhazy / indexeddb-problems.md
Last active August 11, 2025 18:48
The pain and anguish of using IndexedDB: problems, bugs and oddities

This gist lists challenges you run into when building offline-first applications based on IndexedDB, including open-source libraries like Firebase, pouchdb and AWS amplify (more).

Note that some of the following issues affect only Safari. Out of the major browsers, Chrome's IndexedDB implementation is the best.

Backing file on disk (WAL file) keeps growing (Safari)

When this bug occurs, every time you use the indexeddb, the WAL file grows. Garbage collection doesn't seem to be working, so after a while, you end up with gigabytes of data.

Random exceptions when working with a large number of indexeddb databases (Safari)

@tadast
tadast / ruby.yml
Created April 26, 2020 20:29
Example github actions config for Rails with postgres using DATABASE_URL
name: Ruby
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
@trihtm
trihtm / vietnam-banks
Created December 9, 2019 06:48
Vietnam Banks information format by json
{
"banksnapas": [
{
"en_name": "An Binh Commercial Joint stock Bank",
"vn_name": "Ngân hàng An Bình",
"bankId": "970425",
"atmBin": "970425",
"cardLength": 16,
"shortName": "ABBank",
"bankCode": "323",
@withoutwax
withoutwax / custom_fields_devise.markdown
Last active April 27, 2024 00:43
Adding Custom Fields to Devise

Adding Custom Fields to Devise

Before doing anything, please check the versions of the gem files:

gem 'rails', '~> 5.1.4'
gem 'devise', '~> 4.4.0'

Disclaimer - This solution may not work with older versions of rails and devise. Versions listed above were the latest versions of gems which I was using at the time of creation and tests. (10 Jan 2018)

@jonsuh
jonsuh / .bash_profile
Last active June 4, 2025 18:23
Bash echo in color
# ----------------------------------
# Colors
# ----------------------------------
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
@squarism
squarism / iterm2.md
Last active August 10, 2025 12:54
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@jboner
jboner / latency.txt
Last active August 11, 2025 08:33
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD