This guide enables port forwarding for foo.com
to localhost:3000
. Tested on macOS High Sierra.
$ sudo nvim /etc/hosts
Add the following:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security --allow-running-insecure-content |
#!/usr/bin/env bash | |
# Use this one-liner to produce a JSON literal from the Git log: | |
git log \ | |
--pretty=format:'{%n "commit": "%H",%n "author": "%an <%ae>",%n "date": "%ad",%n "message": "%f"%n},' \ | |
$@ | \ | |
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \ | |
perl -pe 's/},]/}]/' |
document.attachEvent("onreadystatechange", function(){ | |
if (document.readyState === "complete"){ | |
document.detachEvent( "onreadystatechange", arguments.callee ); | |
// code ... | |
} | |
}); |
For instance, to copy a file called rental_agreement.doc from our remote machine to a new file called agreement.doc on our local machine, we’d execute: | |
scp [email protected]:/Users/tandorra/Desktop/rental_agreement.doc agreement.doc | |
Obviously, the burden in this situation is knowing the exact location and name of the file before transferring it. Copying a file from your local machine to a remote one is a little easier. In that situation, we’d execute this command instead: | |
scp file-to-copy user@remote-address:path-to-new-saved-file |
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime |
If you've written your share of JavaScript, you've likely encountered scenarios where independent asynchronous requests need to complete before execution can continue. In many cases, you're forced to impose an order to the requests and nest some callbacks to be notified of their completion. Another common, albeit dirty approach, is to pollute the parent scope of the events with flags of some sort and poll them on a particular time interval until completion.
In either case, maintainability becomes a nightmare and will likely cause future readers of your code to do an enormous amount of desk flipping.
Fortunately enough, we can dig into our bag of constructs and make use of what's commonly referred to as a promise, an abstract concept thats made its way into jQuery and has recently gained native support in modern browsers.
##Promises - A Brief Introduction ##
openssl genrsa -des3 -out fooboo.key 2048 | |
openssl req -new -key fooboo.key -out fooboo.csr | |
openssl x509 -req -days 365 -in fooboo.csr -signkey fooboo.key -out fooboo.crt |
SELECT table_schema "DB Name", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" FROM information_schema.tables GROUP BY table_schema; |