This file contains 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
var sleep = function(para) { | |
return new Promise(function(resolve, reject) { | |
setTimeout(function() { | |
resolve(para * para) | |
}, 1000) | |
}) | |
} |
This file contains 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
var sleep = function(para) { | |
return new Promise(function(resolve, reject) { | |
setTimeout(function() { | |
resolve(para * para) | |
}, 1000) | |
}) | |
} | |
async function asyncSleep (para){ | |
return await sleep(para) |
This file contains 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 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
This file contains 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
# 2017/4/23 | |
# To sync file from local to AWS EC2 by pem key | |
# Exclude '/node_modules' | |
# Check user name *******************/ | |
if [ -z ${SYNC_USER} ]; then | |
echo "Input your EC2 name (default user: ec2-user):." | |
read _userName | |
if [ -z ${_userName} ]; then |
This file contains 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
var casper = require('casper').create(); | |
casper.start('http://casperjs.org/'); | |
casper.then(function() { | |
this.echo('First Page: ' + this.getTitle()); | |
}); | |
casper.thenOpen('http://phantomjs.org', function() { | |
this.echo('Second Page: ' + this.getTitle()); |
This file contains 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
##################################### | |
####### Config Your host here ##### | |
##################################### | |
FROM_DB_HOST="abc.com:1024" | |
TO_DB_HOST="def.mlab.com:1111" | |
FROM_DB_NAME="peter" | |
TO_DB_NAME="peter-dev" | |
##################################### |
This file contains 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
sudo yum upgrade | |
sudo yum install git | |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | bash | |
source ~/.bash_profile | |
nvm install v6.9.5 |
This file contains 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
curl -L https://github.com/docker/machine/releases/download/v0.12.2/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine && | |
chmod +x /tmp/docker-machine | |
sudo cp /tmp/docker-machine /usr/local/bin/docker-machine |
This file contains 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
import React from 'react' | |
import { connect } from 'react-redux' | |
import { mount, shallow } from 'enzyme' | |
import ToastList from '../../../src/components/common/ToastList' | |
jest.mock('../../../src/components/common/ToastList/ToastItem/index.js', () => | |
(props) => <mock-toast-item id={props.id}> | |
{props.msg} | |
</mock-toast-item> | |
) |
This file contains 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
window.addEventListener('scroll', function(){ | |
console.log(window.pageYOffset) | |
}) |
OlderNewer