Skip to content

Instantly share code, notes, and snippets.

Follow your passion.

Hank Wang hanksudo

Follow your passion.
  • Taipei, Taiwan & Tokyo, Japan
View GitHub Profile
hanksudo / promise.race.js
Last active Dec 6, 2021
nodejs promise race
View promise.race.js
let promiseA = new Promise((resolve) => {
const timeout = 100 + Math.floor(Math.random() * 1900)
setTimeout(() => resolve('A'), timeout);
console.log('A timeout', timeout)
let promiseB = new Promise((resolve) => {
const timeout = 100 + Math.floor(Math.random() * 1900)
setTimeout(() => resolve('B'), timeout);
console.log('B timeout', timeout)
hanksudo / combineAndKeepOrder.go
Created Aug 18, 2021
(go) combine two array and keep order
View combineAndKeepOrder.go
package main
import "log"
func main() {
result := combineAndKeepOrder([]string{"a", "b", "c"}, []string{"c", "a", "d"})
log.Println(result, testEq(result, []string{"c", "b", "a", "d"}))
result = combineAndKeepOrder([]string{}, []string{"c", "a", "d"})
log.Println(result, testEq(result, []string{"c", "a", "d"}))
hanksudo /
Last active Dec 8, 2020
Initial iOS project without Storyboard (remove storyboard)
  1. Remove Main.storyboard file
  2. Remove Main interface in Deployment Info

Screen Shot 2020-12-08 at 12 11 07

  1. Remove UISceneStoryboardFile key in Info.plist
  • Composable, Reusable
  • Declarative
  • Immutable


Fundamental part of RxSwift, Read-only

Create and subscribe Observable

hanksudo /
Created Nov 4, 2020
Add/remove loopback alias IPs on macOS
# add 
sudo ifconfig lo0 alias

# revert
sudo ifconfig lo0 -alias

Terraform note

provider "aws" {
  profile    = "default"
  region     = "us-east-1"
hanksudo / purgeAndroid.txt
Created Mar 20, 2018 — forked from tahmidsadik/purgeAndroid.txt
How to completely remove Android Studio from Mac OS X
View purgeAndroid.txt
How to Completely Remove Android Studio
Execute these commands from the terminal
rm -Rf /Applications/Android\
rm -Rf ~/Library/Preferences/AndroidStudio*
rm ~/Library/Preferences/
rm -Rf ~/Library/Application\ Support/AndroidStudio*
rm -Rf ~/Library/Logs/AndroidStudio*
hanksudo /
Created Oct 8, 2017
Python - class private publc
class Person:
def __init__(self):
def _single(self):
print "single"
def __double(self):
print "double"