This is a gist used in the following blog posts:
var html = require('./index') | |
var world = 'xyz' | |
var planet = [ | |
document.createElement('strong') | |
] | |
planet[0].textContent = 'planet' | |
var res = html.render(Main(world, planet)) | |
function Main (world, who) { |
I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.
I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.
Chrome 51 has some pretty wild behaviour related to console.log
in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
body { | |
font: 100%/1.25 sans-serif; | |
color: #636363; | |
padding: 1em; | |
} | |
table { | |
width: 100%; | |
margin: 0; | |
border-top: 1px solid #e4e2e8; |
Create an .htaccess file in the webroot:
AuthUserFile /app/www/.htpasswd
AuthType Basic
AuthName "Restricted Access"
Require valid-user
Create a .htpasswd file:
htpasswd -c /app/www/.htpasswd [username]
Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications
like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.
open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl
You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html
# Rename multiple files | |
# http://www.24hourapps.com/2009/03/linux-tips-10-rename-multiple-files.html | |
# Renaming multiple files in Linux is surprisingly difficult given the simplistic power | |
# provided by many other system commands. Unlike DOS, which provided a rename command that | |
# allowed wild cards, Linux's rename/mv command is less versatile. Therefore to rename files one needs to write a loop. Luckily bash helps a lot here. | |
# Lets say we have in our directory a number of .txt files that we need to rename to .nfo. | |
# To do this we would need to use the command: |