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
#!/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
<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'); |
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
/* Configure by modifying variables: | |
$round-width: size of round avatar | |
$avatar-image: image path of ravatar | |
*/ | |
div.round-avatar{ | |
$round-border-size: 5px; | |
$round-border-color: #fff; | |
$round-width: 100px; | |
$round-height: $round-width; | |
$avatar-image: url('//goo.gl/Nw9pE2'); |
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
/* | |
A scss mixin that convert background images from original URL path to DataURI with IE6-8 fallback. | |
- Based on `compass/css3/images` | |
- Support 1-10 background image(s) as arguments of `background-image` in compass. | |
- Use class `lt-ie9` in `<html>` tag as `html5-boilerplate` to determine if current browser is IE6-8 or not. | |
- Image created by `linear-gradient` will be skipped. | |
# Example |
1. Download git-prompt.sh and saved as hidden file .git-prompt.sh
curl -L https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh -o ~/.git-prompt.sh
2. apply git-prompt and insert branch variable $(__git_ps1)
in prompt in your shell configuration file (ex: ~/.bashrc
)
# colors
MAGENTA="\[\033[0;35m\]"
YELLOW="\[\033[0;33m\]"
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
# arg-1: filename pattern for "find" | |
# arg-2: content pattern for "grep" | |
# note: If filename pattern contains wildcard, it should be escaped. | |
# Or the matched files only in the current path will be the result. Other matched files | |
# will not be included in the result. | |
# ex: | |
# > findNgrep.sh \*.php test | |
# | |
find . -name "$1" -exec grep -wnH "$2" {} \; |
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
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html> | |
<head> | |
<style> | |
#table{ | |
display:table; /* must be 'table' */ | |
} | |
#table-cell{ | |
position:relative; /* must be 'relative' */ | |
width:500px; /* must be assigned an absolute value */ |
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
# simulate "wc -l" by sed | |
sed -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
# generate md5 hash of source string typed by user | |
echo -n 'source string:' | |
read str | |
echo -n $str | md5sum |