Skip to content

Instantly share code, notes, and snippets.

View guanting112's full-sized avatar
🐈‍⬛

Guanting Chen guanting112

🐈‍⬛
  • Taiwan
  • 19:19 (UTC +08:00)
View GitHub Profile
@weihanglo
weihanglo / rust-vs-go.md
Last active April 21, 2024 01:24
【譯】Rust vs. Go

【譯】Rust vs. Go

本文譯自 Julio Merino 2018 年七月撰寫的 Rust vs. Go 一文。Julio Merino 是 G 社僱員,在 G 社工作超過 8 年,無論工作內外,都接觸開發不少 Go 語言,並撰寫 [Rust 點評][rust-review]系列文,來聽聽他對 Rust 與 Go 的想法吧。

Thanks Julio Merino for this awesome article!


@guanting112
guanting112 / install_source_command_line_tools.sh
Last active May 9, 2023 13:52
[macOS] SourceTree command line tools install script ( support 10.11, 10.12 )
#!/usr/bin/env bash
function link_stree {
ln -s /Applications/SourceTree.app/Contents/Resources/stree /usr/local/bin/
}
function install {
link_stree
}
@kaddopur
kaddopur / isTaiwanId.es6
Created September 7, 2016 16:23
身分證字號檢查
function isTaiwanId(id) {
const mapping = [10, 11, 12, 13, 14, 15, 16, 17, 34, 18, 19, 20, 21, 22, 35, 23, 24, 25, 26, 27, 28, 29, 32, 30, 31, 33];
const ID_REGEX = /^[A-Z][12]\d{8}$/i;
if (!ID_REGEX.test(id)) {
return false;
}
return `${mapping[id.toUpperCase().charCodeAt(0)-65]}${id.slice(1)}`
.split('')
@victornpb
victornpb / occurrences.js
Last active June 7, 2023 14:37
Function count the occurrences of substring in a string
/** Function that count occurrences of a substring in a string;
* @param {String} string The string
* @param {String} subString The sub string to search for
* @param {Boolean} [allowOverlapping] Optional. (Default:false)
*
* @author Vitim.us https://gist.github.com/victornpb/7736865/edit
* @see Unit Test https://jsfiddle.net/Victornpb/5axuh96u/
* @see http://stackoverflow.com/questions/4009756/how-to-count-string-occurrence-in-string/7924240#7924240
*/
function occurrences(string, subString, allowOverlapping) {