Skip to content

Instantly share code, notes, and snippets.

View fraserxu's full-sized avatar
🐢
No idea

Fraser Xu fraserxu

🐢
No idea
View GitHub Profile
@fraserxu
fraserxu / install_git.sh
Last active August 31, 2023 17:11
setup nodenv on ubuntu
#!/bin/bash
set -ex
sudo apt-get update
sudo apt-get install -y git
@fraserxu
fraserxu / loadMore.js
Last active August 9, 2023 05:37
Simple load more function for ng-repeat with limitTo filter
// set the default amount of items being displayed
$scope.limit= 5;
// loadMore function
$scope.loadMore = function() {
$scope.limit = $scope.items.length
}
const array = [1, 2, 3, 4, 5]
const fetchData = i => {
console.log(`fetching ${i}...`)
return new Promise(resolve =>
setTimeout(() => {
console.log(`finished ${i}`)
resolve()
}, 1000)
)
➜ market-shopfront-api git:(master) ✗ while true; do time ./node_modules/.bin/tsc; sleep 2; done
./node_modules/.bin/tsc 3.56s user 0.19s system 177% cpu 2.105 total
./node_modules/.bin/tsc 2.81s user 0.14s system 189% cpu 1.556 total
./node_modules/.bin/tsc 2.64s user 0.14s system 191% cpu 1.453 total
./node_modules/.bin/tsc 2.53s user 0.14s system 182% cpu 1.458 total
./node_modules/.bin/tsc 2.69s user 0.14s system 188% cpu 1.497 total
./node_modules/.bin/tsc 2.77s user 0.16s system 179% cpu 1.632 total
./node_modules/.bin/tsc 2.62s user 0.14s system 186% cpu 1.476 total
./node_modules/.bin/tsc 2.59s user 0.14s system 187% cpu 1.456 total
./node_modules/.bin/tsc 2.90s user 0.16s system 188% cpu 1.623 total
@fraserxu
fraserxu / README.md
Created August 27, 2018 23:03 — forked from mchelen/README.md
JSON Resume Browser Example
@fraserxu
fraserxu / auth.js
Last active February 6, 2018 09:51
Handling CORS in Meteor app
/*
* packages/reststop2/auth.js
* Add a method to handle OPTIONS request
*/
// return nothing
RESTstop.add('login', {'method': 'OPTIONS'}, function() {})
@fraserxu
fraserxu / dev_setup.txt
Last active January 20, 2018 01:14 — forked from brndnblck/dev_setup.txt
Local Setup for .test Domains (dnsmasq + nginx)
sudo -v
brew install dnsmasq nginx
echo "address=/test/127.0.0.1" > /usr/local/etc/dnsmasq.conf
vim /usr/local/etc/nginx/nginx.conf
vim /usr/local/etc/nginx/servers/market-shopfront.conf
tee /usr/local/etc/nginx/nginx.conf > /dev/null << EOF
#user nobody;
@fraserxu
fraserxu / china_provinces.json
Created December 18, 2014 06:35
china population choropleth
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fraserxu
fraserxu / upgrade.md
Last active March 7, 2017 04:39
The great node yarn upgrade guide

Install node

We recommend use nvm instead of nodenv, you can install nvm with brew install nvm. And then you can use it to install the version we are using.

nvm install 6.10.0

Use the version