Skip to content

Instantly share code, notes, and snippets.

View chochinlu's full-sized avatar
🎯
Focusing

Park Lu chochinlu

🎯
Focusing
  • Taiwan
View GitHub Profile
@chochinlu
chochinlu / web-speech-api-cold-start-fix.md
Created December 21, 2025 12:30
Fix Web Speech API cold start issue - first utterance clipping

Web Speech API Cold Start Fix

Fix the issue where the beginning of speech gets clipped when using speechSynthesis

Problem

When using the Web Speech API (window.speechSynthesis), the first few syllables of speech often get cut off or clipped. This is a common issue, especially in Chrome-based browsers.

Root Causes

@chochinlu
chochinlu / validate.js
Last active January 22, 2021 08:56
validate TRON address (簡易版)
const ADDRESS_SIZE = 34;
const ADDRESS_PREFIX_BYTE = 0x41;
const ALPHABET_MAP = {};
const BASE = 58
const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
function decode58(string) {
if (string.length === 0)
return [];
@chochinlu
chochinlu / .dockerignore
Last active December 23, 2020 02:31
Create React App + Docker
.git
.gitignore
.idea
node_modules
build
@chochinlu
chochinlu / i18nJson.js
Created December 2, 2020 08:44
merge i18n files to one csv file
const fs = require('fs')
const path = require('path')
const I18N_DIR = path.join('src', 'i18n', 'resources')
const TW_DIR = path.join(I18N_DIR, 'zh-TW')
const EN_DIR = path.join(I18N_DIR, 'en')
const DELIMITER = '^' // 分隔符
const TARGET = 'target.csv'
@chochinlu
chochinlu / app.module.ts
Created July 29, 2020 01:50
NestJS + TypeORM + env CongfigService
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { TasksModule } from './tasks/tasks.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import { typeOrmConfig } from './config/typeorm.config';
import { ConfigModule, ConfigService } from '@nestjs/config';
@Module({
imports: [
@chochinlu
chochinlu / reset.css
Created March 21, 2019 07:50
reset.css
*,
*::after,
*::before {
margin: 0;
padding: 0;
box-sizing: inherit;
}
html {
/* font-size: 10px; */
@chochinlu
chochinlu / tour.exercise.go
Last active December 12, 2018 02:36
A tour of Go: Exercises
/** --- Exercise: Loops and Functions --- **/
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := 2.0
@chochinlu
chochinlu / GetLogGroups.re
Last active August 21, 2018 03:20
aws-sdk ReasonML binding testing.
type credentialObj = {. "profile": string};
[@bs.deriving abstract]
type awsConfig = {mutable credentials: credentialObj};
type aws = {. config: awsConfig};
[@bs.obj]
external makeCredentialObj : (~profile: string) => credentialObj = "";
[@bs.module "aws-sdk"] [@bs.new]
@chochinlu
chochinlu / pid.js
Last active May 16, 2018 03:46
驗證與產生可用的身分證字號
// wiki 身分證驗證規則 https://zh.wikipedia.org/wiki/%E4%B8%AD%E8%8F%AF%E6%B0%91%E5%9C%8B%E5%9C%8B%E6%B0%91%E8%BA%AB%E5%88%86%E8%AD%89#%E7%B7%A8%E8%99%9F%E8%A6%8F%E5%89%87
// 中華民國身分證字號英文字首的編號規則數字
const firstLetterMapping = new Map([
['A', '10'],
['B', '11'],
['C', '12'],
['D', '13'],
['E', '14'],
['F', '15'],
@chochinlu
chochinlu / testcoins_rinkeby.txt
Created September 26, 2017 06:42
Testcoins for Rinkeby
0x7eF413776C089E5910409b93363575167BA24372