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
const elem = document.querySelecor('#scollableElement'); | |
// scroll to specific position | |
elem.scrollTop = 100px; | |
elem.scrollLeft = 200px; | |
// scroll to bottom/right | |
elem.scrollTop = elem.scrollHeight; | |
elem.scrollLeft = elem.scrollWidth; |
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
docker run -it -p 9090:9090 -e "mnemonic=wrong bit chicken kitchen rat" -e "accounts=20" --rm --name tron trontools/quickstart |
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 validateJsonStr(jsonStr) { | |
let content = jsonStr.replace(/\\["\\\/bfnrtu]/g, '@'); | |
content = content.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'); | |
content = content.replace(/(?:^|:|,)(?:\s*\[)+/g, ''); | |
return /^[\],:{}\s]*$/.test(jsonStr); | |
} |
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
netstat -ano | findstr <port_number> |
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
# find process /? - show help | |
tasklist | findstr <pid/name> | |
# kill process /? - show help | |
taskkill /F /T /IM <name> | |
taskkill /F /T /PID <name> |
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
# one line | |
## explaination | |
### 1. echo something and pipe to cut for processing | |
### 2. -d<char> means cut string by char | |
### 3. -f<num> means get the second set of cutted result | |
echo 'someletters_12345_moreleters.ext' | cut -d'_' -f 2 | |
# multi line | |
INPUT='someletters_12345_moreleters.ext' | |
SUBSTRING=$(echo $INPUT| cut -d'_' -f 2) |
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
const fs = require('fs') | |
const os = require('os') | |
const path = require('path') | |
const electron = require('electron') | |
const desktopCapturer = electron.desktopCapturer | |
const electronScreen = electron.screen | |
const shell = electron.shell | |
const screenshot = document.getElementById('screen-shot') | |
const screenshotMsg = document.getElementById('screenshot-path') |
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
# This error is cause by node_module node version not matched | |
# generally, it happend when you switch node version(with nvm & conda) but did not re-install dependencies | |
# in some case, it was cause by the electron node version is not compatiable with local node | |
## 1. install electron-rebuild | |
yarn add electron-rebuild --dev | |
## 2. remove node_modules | |
sudo rm -rf node_modules | |
## 3. re-install | |
yarn |
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
var user = { | |
first: 'John', | |
last: 'Doe', | |
age: 42 | |
}; | |
// plain console log | |
console.log(JSON.stringify(user, undefined, 2)); | |
// or with interpolation: | |
console.log(`User: ${JSON.stringify(user, undefined, 2)}`); |
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
const config = { | |
chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906', | |
keyProvider: ['MY PRIVATE KEY'], | |
httpEndpoint: 'https://api.eosnewyork.io:443', | |
verbose: false, // API activity | |
broadcast: true, | |
sign: true, | |
expireInSeconds: 60 | |
} |