Read each line of code line by line. Never assume, always check. Learn the laws from grey beards. They have made all the mistakes before.
- When in doubt create comment to verify.
| %!TEX TS-program = xelatex | |
| \documentclass[12pt]{scrartcl} | |
| % This ^^^ is a standard LaTeX document class declaration | |
| % (the previous line is a pseudo-comment, declaring that we will | |
| % use the special XeTeX machinery for its more extensive font list | |
| % and its use of unicode.) | |
| % If you made this line more akin to the one in the default | |
| % latex.template file, say: | |
| % \documentclass$if(fontsize)$[$fontsize$]$endif${scrartcl} |
| //www.lsauer.com 2012 | |
| //Answer to: | |
| //http://stackoverflow.com/questions/881085/count-the-number-of-occurances-of-a-character-in-a-string-in-javascript/10671743#10671743 | |
| //There are at least four ways. The best option, which should also be the fastest -owing to the native RegEx engine -, is placed at the top. //jsperf.com is currently down, otherwise I would provide you with performance statistics. | |
| #1. | |
| ("this is foo bar".match(/o/g)||[]).length | |
| //>2 | |
| #2. | |
| "this is foo bar".split("o").length-1 |
| ## credit: http://fabian-affolter.ch/blog/the-lineinfile-module-of-ansible/ | |
| --- | |
| - hosts: alpine_install | |
| user: root | |
| tasks: | |
| # - name: create a complete empty file | |
| # command: /usr/bin/touch /test/test.conf | |
| - name: create a new file with lineinfile |
| #!/bin/bash | |
| set -o errexit | |
| echo "Removing exited docker containers..." | |
| docker ps -a -f status=exited -q | xargs -r docker rm -v | |
| echo "Removing dangling images..." | |
| docker images --no-trunc -q -f dangling=true | xargs -r docker rmi |
Read each line of code line by line. Never assume, always check. Learn the laws from grey beards. They have made all the mistakes before.