This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Character { | |
var asciiValue: UInt32? { | |
return String(self).unicodeScalars.filter{$0.isASCII}.first?.value | |
} | |
} | |
func sort(str: String, isReversed: Bool) -> String { | |
if (isReversed) { | |
return String(str.characters.sorted(by: compareCharactersReversed)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-keygen -t rsa | |
# Enter file in which to save the key (/home/ivan/.ssh/id_rsa): | |
# key 儲存位置, 如果沒有特別要改地方, 按Enter即可 | |
# Enter passphrase (empty for no passphrase): | |
# 是否要設定key的密碼, 不用的話按Enter即可 | |
# Enter same passphrase again: | |
# 再次設定密碼, 上一部沒有設定的話按Enter即可 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MODE=development | |
DBHOST=localhost | |
DBPORT=5432 | |
DBCONN_STR=${DBHOST}:${DBPORT} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MODE=development | |
DBHOST=localhost | |
DBPORT=5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export DBHOST=localhost | |
export DBPORT=5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -f ~/.bashrc ]; then | |
source ~/.bashrc | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
os.getenv('DBCONN_STR') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 對齊開頭分隔符號 | |
foo = long_function_name(var_one, var_two, | |
var_three, var_four) | |
# 要多縮排一次來區分 | |
def long_function_name( | |
var_one, var_two, var_three, | |
var_four): | |
print(var_one) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 沒有垂直對齊時,第一行不應該有參數 | |
foo = long_function_name(var_one, var_two, | |
var_three, var_four) | |
# 其他行要多縮一次縮排,不然沒辦法跟再下一層的內容分開 | |
def long_function_name( | |
var_one, var_two, var_three, | |
var_four): | |
print(var_one) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 不額外做縮排 | |
if (this_is_one_thing and | |
that_is_another_thing): | |
do_something() | |
# 加入註解,可以在支援語法凸顯的編輯器中將兩者區分開來 | |
if (this_is_one_thing and | |
that_is_another_thing): | |
# Since both conditions are true, we can frobnicate. | |
do_something() |
OlderNewer