- Set up
- install
npm install -g ethereumjs-testrpc http-server
- install
npm install solc [email protected]
- install
- Writing Smartcontract & deploying code
- Building UI with html and js
- Setting npm start script
"start": "node deployContract.js && http-server .",
- Run
testrpc
, then runnpm start
- CSS naming convention: http://getbem.com
Unit rem
tip: Adding font size 62.5%
to html
to specify 1rem = 10px
Snippet
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
console.time(__filename); | |
const { default: axios } = require('axios'); | |
const fs = require('fs'); | |
const { createInterface } = require('readline'); | |
const file = process.argv[2]; | |
const token = process.argv[3] || 'all'; | |
const dateStart = process.argv[4] | |
? new Date(`${process.argv[4]} 0:0:0`).getTime() / 1000 | |
: null; |
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
import * as winston from 'winston'; | |
const { combine, timestamp, prettyPrint, colorize, json } = winston.format; | |
export const logger = winston.createLogger({ | |
format: combine(colorize(), json(), timestamp(), prettyPrint()), | |
transports: [ | |
new winston.transports.Console({ | |
format: winston.format.simple(), | |
level: 'info', |
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
/** | |
* Motivation | |
* | |
* We have a very big array need to be processed in order | |
* with a async function and make sure that not blocking | |
* other process | |
* | |
* Solution | |
* | |
* Using Timers functions of Node.js |
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
package helper | |
func IndexOf(input []int, search int) int { | |
if len(input) == 0 { | |
return -1 | |
} | |
for i, v := range input { | |
if v == search { | |
return i |
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
package helper | |
import ( | |
"math/rand" | |
"time" | |
) | |
func Shuffle(arr []int) []int { | |
for i := len(arr) - 1; i > 0; i-- { | |
rand.Seed(time.Now().UTC().UnixNano()) |
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
version: "3.9" | |
services: | |
db: | |
image: mysql:5.7 | |
volumes: | |
- db_data:/var/lib/mysql | |
- ./docker/my.cnf:/etc/my.cnf | |
restart: always | |
environment: |
- More deeper understand about
libuv
, why it's run in 4 threads and how to config to improve NodeJS concurrency performance: https://www.sebastienvercammen.be/your-libuv-thread-pool-size-is-too-small/
nanoid
,uuid
: Unique string generator:node-schedule
: run jobsconcurrently
: Run multi commands concurrentlylive-server
: run server with live reload capability, useful fast testing html files
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
version: '3' | |
networks: | |
workspaces: | |
driver: bridge | |
services: | |
zookeeper: | |
image: confluentinc/cp-zookeeper:5.3.1 | |
restart: always |