Skip to content

Instantly share code, notes, and snippets.

View devld's full-sized avatar
😎

devld devld

😎
  • Xi'an
View GitHub Profile
@devld
devld / .bashrc
Last active April 28, 2020 07:44
Git-Bash configuration
export LANG=zh_CN.UTF-8
alias ls="ls --color=tty"
alias e="explorer .; true"
# alias for git
alias glg="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias ga="git add ."
alias gco="git checkout"
@devld
devld / Util.java
Last active February 23, 2020 10:23
Java, JavaScript 数字转中文
private static String numToCN(int n, boolean appendZero, boolean appendOne) {
if (n == 0) return "";
if (n < 10) {
return (appendZero ? "零" : "") + NUMBER_MAPPING[n];
} else if (n < 100) {
return (appendZero ? "零" : "") + (!appendOne && n < 20 ? "" : NUMBER_MAPPING[n / 10])
+ "十" + (n % 10 == 0 ? "" : NUMBER_MAPPING[n % 10]);
} else if (n < 1000) {
return NUMBER_MAPPING[n / 100] + "百" +
numToCN(n % 100, n % 100 < 10, true);
@devld
devld / profile.ps1
Created April 12, 2018 11:13
colorful Prompt and `ls` in Powershell
function Prompt
{
if ($?) {
$color = "Green"
} else {
$color = "Red"
}
Write-Host -NoNewline -ForegroundColor $color '>> '
$pwd = $(Get-Location)
if ($pwd.Path -eq $env:USERPROFILE) {