Add this function screen
in ~/.bashrc
to avoid error as below:
Cannot open your terminal '/dev/pts/0' - please check.
function screen() {
/usr/bin/script -q -c "/usr/bin/screen ${*}" /dev/null
}
// assign html string value with easy-to-ready format | |
const html = (function() {/* This line will be removed!!!! | |
<div> | |
hello world!!! | |
</div> | |
This line will be removed!!!! */}).toString().split('\n').slice(1,-1).join('\n'); |
<?php | |
function isBig5Char ($char) { | |
if (strlen($char) < 2) | |
return false; | |
$byte1hex = dechex(ord($char[0])); | |
$byte2hex = dechex(ord($char[1])); | |
$number = hexdec($byte1hex . $byte2hex); | |
return ( | |
0x8140 <= $number && |
#!/bin/bash | |
# | |
# copy local ip address to clipboard | |
# this script is only for OS X | |
echo -n `ifconfig en0 | awk '$1 == "inet" {print $2}'` | pbcopy |
git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD |
# put this snippet in your shell config(ex: ~/.bashrc, ~/.zshrc, ...) | |
# make sure `.nvmrc` exsits in your project folder | |
function init-node { | |
# switch node version by nvm after changing folder without AVN | |
if [[ -f ".nvmrc" ]]; then | |
# initialize nvm if necessary | |
if [[ -z $(nvm 2>/dev/null) ]]; then | |
# nvm is not initailized | |
echo 'initialize nvm ...' | |
source ~/.nvm/nvm.sh |
# this script is only for Mac OS X | |
# ex: eject.sh /Volumes/MyDisk | |
diskutil unmount $1 |
if [ -L $0 ] ; then | |
BASEDIR=$(cd "$(dirname "$(readlink $0)")"; pwd -P) # for symbolic link | |
else | |
BASEDIR=$(cd "$(dirname "$0")"; pwd -P) # for normal file | |
fi |
Add this function screen
in ~/.bashrc
to avoid error as below:
Cannot open your terminal '/dev/pts/0' - please check.
function screen() {
/usr/bin/script -q -c "/usr/bin/screen ${*}" /dev/null
}
#!/bin/bash | |
# git push to gerrit for current branch | |
branch_name=$(git symbolic-ref -q HEAD) | |
branch_name=${branch_name##refs/heads/} | |
branch_name=${branch_name:-HEAD} | |
git push origin HEAD:refs/for/$branch_name |
alias qlook="qlmanage -p 2>/dev/null" |