Skip to content

Instantly share code, notes, and snippets.

View coding-chris-kao's full-sized avatar
🏠
Working from home

Chris Kao coding-chris-kao

🏠
Working from home
View GitHub Profile
@coding-chris-kao
coding-chris-kao / id_validator.js
Last active August 13, 2019 07:26
Taiwan ID Validator
const strategies = {
isId(value) {
const correspondingNumberTable = {
'A': '10',
'B': '11',
'C': '12',
'D': '13',
'E': '14',
'F': '15',
'G': '16',
@coding-chris-kao
coding-chris-kao / flexible_switch.js
Created August 8, 2019 04:11
Use switch like if-else in a flexible way
function checkAge(age){
switch(true){ // Set boolean first
case (age > 18):
console.log('case 1')
break
case (age == 18):
console.log('case 2')
break
case (age < 18):
console.log('case 3')
@coding-chris-kao
coding-chris-kao / AsyncChain.js
Created August 8, 2019 04:07
Chain async functions and execute once or repeat
class AsyncChain {
constructor() {
this.queue = []
}
funcA() {
this.queue.push(1000)
return this
}
@coding-chris-kao
coding-chris-kao / embedded_google_maps.html
Last active August 8, 2019 03:56
Embedded Google Maps
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3615.0135729194126!2d121.56329771407152!3d25.033613444896503!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x3442abb6e9d93249%3A0xd508f7b3aa02d931!2z5Y-w5YyXMTAx6KeA5pmv5Y-w!5e0!3m2!1szh-TW!2stw!4v1565235575454!5m2!1szh-TW!2stw" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>