博文

目前显示的是 一月, 2020的博文

process.env in Node.js

process | Node.js http://nodejs.cn/api/process.html process is a global  object http://nodejs.cn/api/process.html#process_process_env demo in script: if (process.env.NODE_ENV === 'production') { module.exports = require('./prod.js') } else { module.exports = require('./dev.js') } input "node" line commend node > process.env  // show value On Windows: set test=testValue on OS X or Linux: export test=testValue In js file process.env.test= 'dev'; package.json: "scripts": { "start": "set test=dev && node app.js" } ------------------------ Windows environment variant cmd > set test-env   // exit set test-env=production set path=%path%;C:\web;C:\Tools set test-env= my computer -> property -> advance -> environment variant... ---------------------- Linux echo $test-env     //check value of test-env // set value of test-env export test-env=production # attach va

Inside Ethereum Transactions -

图片
#3 · Inside Ethereum Transactions source :  https://www.dappuniversity.com/articles/web3-js-intro This is the third video in the 8-part tutorial series. This video will show you how to create transactions on The Ethereum Blockchain with Web3.js. This lesson will go from beginner to slightly advanced. I'll show you what happens when an Etherum transaction is created, and I'll show you how to broadcast a transaction manually to the network with Web3.js. In addition to learning Web3.js, the purpose of this lesson is to help you understand the fundamentals about how transactions work on The Ethereum Blockchain. Whenever you create a transaction, you're writing data to the blockchain and updating its state. There are several ways to do this, like sending Ether from one account to another, calling a smart contract function that writes data, and deploying a smart contract to the blockchain. We can get a greater understanding of these concepts by performing these actions w

copy text in vuejs and javascript

Reference: https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript https://www.w3schools.com/howto/howto_js_copy_clipboard.asp https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f copyAddress () {        if  (! navigator . clipboard ) {          var   copyText  =  document . getElementById ( 'Address' )          copyText . focus ();          copyText . select ()          copyText . setSelectionRange ( 0 ,  99999 )          // document.execCommand('copy')          try  {            var   successful  =  document . execCommand ( 'copy' )            var   msg  =  successful  ?  'successful'  :  'unsuccessful'            console . log ( 'Fallback: Copying text command was '  +  msg )         }  catch  ( err ) {            console . error ( 'Fallback: Oops, unable to copy' ,  err )         }       }  else  {          navigator . clipboard . wri

moment.js & UTC Time

WEB Site:   https://momentjs.com/docs/ 1. Local to UTC moment(LocalTime).utc() moment.utc(...)  is utc mode. Ambiguous input is assumed to be UTC. Unambiguous input is adjusted to UTC. 2. UTC to Local  moment.utc(value).local().format('YYYY-MM-DD HH:mm:ss:SSS') 3. Now   moment().format('YYYY-MM-DDTHH:mm:ss:SSS'); 1.Local to UTC: moment.parseZone(DateTimePaidLocal).utc().format() moment.parseZone()  keep the input zone passed in. If the input is ambiguous, it is the same as local mode. 2.UTC to Local: return moment.parseZone(DateTimePaidUtc).format() "moment" : {        "version" :  "2.24.0" ,        "resolved" :  "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz" , "integrity" :  "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/ 0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" } import   moment   from   'moment'