This file contains hidden or 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
{"lastUpload":"2018-01-19T19:27:44.276Z","extensionVersion":"v2.8.7"} |
This file contains hidden or 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
// these two functions are conceptually equivalent | |
async function findFoo1() { | |
console.log('finding foo 1'); | |
const rval = await findFooById(1); | |
console.log('I have foo 1'); | |
return rval; | |
} | |
function findFoo1() { | |
console.log('finding foo 1'); | |
return findFooById(1).then((foo1) => { |
This file contains hidden or 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
function findFooById(id) { | |
// pretend this is a DB query or something asynchronous | |
return Promise.resolve({ | |
id, | |
name: 'Foo' | |
}); | |
} | |
function findFoo1() { | |
console.log('finding foo 1'); | |
return findFooById(1); |
This file contains hidden or 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
function findFooById(id) { | |
// pretend this is a DB query or something asynchronous | |
return Promise.resolve({ | |
id, | |
name: 'Foo' | |
}); | |
} | |
async function findFoo1() { | |
console.log('finding foo 1'); | |
const rval = await findFooById(1); |
This file contains hidden or 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
// Promise | |
doSomethingAsync | |
.then((value) => console.log(value)); | |
.catch((error) => console.log(error)); | |
// or instead use await | |
try { | |
const value = await doSomethingAsync(); | |
console.log(value); | |
} catch (error) { |
This file contains hidden or 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
# install epel repo | |
# yum -y install httpry | |
httpry -i eth0 | |
# Format options: | |
# httpry -i eth0 -f 'host,request-uri' | |
# see https://github.com/jbittel/httpry/blob/master/doc/format-string |
This file contains hidden or 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
echo 'Running tests in Xvfb virtual display for Firefox' | |
xvfb-run testem ci --reporter=xunit --launch=firefox | |
# ensure that non-zero is returned for any failures | |
# because xvfb-run may return 0 even in case of a test failure | |
if [ -r test-reports/testem.xml ]; then | |
# check results for failures | |
failures=$(grep --count '<failure' ./test-reports/testem.xml) | |
if [ $failures -eq 0 ]; then |
This file contains hidden or 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
# PhantomJS on ubuntu | |
# phantomjs: libfontconfig | |
sudo apt-get -y install libfontconfig | |
sudo npm install -g phantomjs | |
export PHANTOMJS_BIN=/usr/bin/phantomjs | |
This file contains hidden or 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
# setup passwordless ssh | |
# on the client machine | |
# 1. create ssh key pair | |
ssh-keygen -t rsa -b 4096 -C "[email protected]" | |
# 2. create authorized_keys file using the PUBLIC key (careful this will destroy an existing authorized_keys file) | |
scp id_rsa.pub [email protected]:/home/stacy/.ssh/authorized_keys | |
# Change permissions on .ssh directories and files if needed (on client and server) | |
cd ~/.ssh |
This file contains hidden or 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
df -h |
NewerOlder