priority | selector | example |
---|---|---|
1 | inline style in html tag | <div style="color:red" > |
2 | tag#id | div#myID { color:red; } |
3 | #id | .myID { color:red; } |
4 | tag.class | div.myClass { color:red; } |
5 | .class | .myClass { color:red; } |
6 | tag | div { color:red; } |
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
git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD |
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 [ -L $0 ] ; then | |
BASEDIR=$(cd "$(dirname "$(readlink $0)")"; pwd -P) # for symbolic link | |
else | |
BASEDIR=$(cd "$(dirname "$0")"; pwd -P) # for normal file | |
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
// 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'); |
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
#!/bin/bash | |
### Backup git working status | |
# Backup modified and untracked files without ignored ones in any git working directory. The destination is required and will be created automatically if not exists. | |
# | |
# Usage: | |
# ./git-backup [destination path] | |
# Ex: | |
# ./git-backup ~/backup20130101 | |
# | |
# Note: Mac users have to install GNU Coreutils to support `--parents` of cp command |
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
<?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 && |
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
#!/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 |
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
# 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 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
# this script is only for Mac OS X | |
# ex: eject.sh /Volumes/MyDisk | |
diskutil unmount $1 |
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
<html> | |
<body> | |
Load external CORS image into the canvas below:<br> | |
<canvas id="c"></canvas><br> | |
Convert canvas to DataUri then set as source of the image below:<br> | |
<img id="img" /> <br> | |
<div id="results"></div> | |
<script> | |
var c = document.getElementById('c'); | |
var ctx = c.getContext('2d'); |
NewerOlder