#参考资料
###下载单个文件,默认将输出打印到标准输出中(STDOUT)中
curl http://www.centos.org
| // You need to apply this once all the animations are already finished. Otherwise labels will be placed wrongly. | |
| d3.selectAll('.nv-multibar .nv-group').each(function(group){ | |
| var g = d3.select(this); | |
| // Remove previous labels if there is any | |
| g.selectAll('text').remove(); | |
| g.selectAll('.nv-bar').each(function(bar){ | |
| var b = d3.select(this); | |
| var barWidth = b.attr('width'); |
| # Detect operating system in Makefile. | |
| # Author: He Tao | |
| # Date: 2015-05-30 | |
| OSFLAG := | |
| ifeq ($(OS),Windows_NT) | |
| OSFLAG += -D WIN32 | |
| ifeq ($(PROCESSOR_ARCHITECTURE),AMD64) | |
| OSFLAG += -D AMD64 | |
| endif |
| #!/bin/sh | |
| for i in ./*.swf ; do | |
| for j in `swfextract $i | grep -E PNGs.* -o | grep -E [0-9]+ -o` ; do | |
| echo "$i -> extract png $j"; | |
| swfextract -p "$j" "$i" -o "$i"_"$j".png | |
| done | |
| for j in `swfextract $i | grep -E JPEGs.* -o | grep -E [0-9]+ -o` ; do | |
| echo "$i -> extract jpeg $j"; | |
| swfextract -j "$j" "$i" -o "$i"_"$j".jpg | |
| done |
| // ES7, async/await | |
| function sleep(ms = 0) { | |
| return new Promise(r => setTimeout(r, ms)); | |
| } | |
| (async () => { | |
| console.log('a'); | |
| await sleep(1000); | |
| console.log('b'); | |
| })() |
| ############################################################################### | |
| # Helpful Docker commands and code snippets | |
| ############################################################################### | |
| ### CONTAINERS ### | |
| docker stop $(docker ps -a -q) #stop ALL containers | |
| docker rm -f $(docker ps -a -q) # remove ALL containers | |
| docker rm -f $(sudo docker ps --before="container_id_here" -q) # can also filter | |
| # exec into container |
| // REQUIRES: | |
| // moment.js - http://momentjs.com/ | |
| // USAGE: | |
| // {{ someDate | moment: [any moment function] : [param1] : [param2] : [param n] | |
| // EXAMPLES: | |
| // {{ someDate | moment: 'format': 'MMM DD, YYYY' }} | |
| // {{ someDate | moment: 'fromNow' }} |
#参考资料
###下载单个文件,默认将输出打印到标准输出中(STDOUT)中
curl http://www.centos.org
| // XPath CheatSheet | |
| // To test XPath in your Chrome Debugger: $x('/html/body') | |
| // http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/ | |
| // 0. XPath Examples. | |
| // More: http://xpath.alephzarro.com/content/cheatsheet.html | |
| '//hr[@class="edge" and position()=1]' // every first hr of 'edge' class |
| # source this code in a Bash shell ($ . django-csrftoken-login-demo.bash), | |
| # and run with a DB name as parameter (e.g. $ django-csrftoken-login-demo demo) | |
| django-csrftoken-login-demo() { | |
| # -- CHANGE THESE VALUES TO MATCH YOUR ACCOUNT -- | |
| local HOSTING_USERID=9988 | |
| local HOSTING_PANEL_USER='[email protected]' | |
| local HOSTING_PANEL_PASS='my secret login password' | |
| local HOSTING_DB_PREFIX='username_' | |
| local DB_NAME=$HOSTING_DB_PREFIX$1 |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.