http
rest
graphql
javascript
promise
async/await
react-router
| /// rpc.js | |
| import { createAction } from 'redux-actions'; | |
| import { put, call, takeEvery } from 'redux-saga/effects'; | |
| export function buildRpcMethod(methodName, { customSelectors, customSagas }) { | |
| const doRequest = (params) => { | |
| const { data: { result, error } } = await axios.post('/rpc', { | |
| jsonrpc: '2.0', | |
| method: methodName, | |
| params, |
| Math.getRandomInt = (min, max) => { | |
| /* getRandomInt(11, 17) => output includes 11 and 17 */ | |
| return Math.floor(Math.random() * (max - min + 1)) + min; | |
| }; | |
| // Vue.js Nurislam Node.js Artur Islam React_Na Artur | |
| // books[0].authors[0].books[1].authors[1] === persons[2].books[0].authors[1]; | |
| function fetchBooks() { | |
| return new Promise((resolve, reject) => { |
| /* jshint esversion: 6*/ | |
| /* jshint ignore:start */ | |
| let TIMES = 1000 * 1000 * 100; | |
| console.time("(() => { }) instanceof Function"); | |
| for (let i = 0; i < TIMES; i++) | |
| (() => {}) instanceof Function; | |
| console.timeEnd("(() => { }) instanceof Function"); |
| #!/usr/bin/env node | |
| /* jshint esversion: 6*/ | |
| function redirectStdout(logFilePath) { | |
| const fs = require('fs'); | |
| let access = fs.createWriteStream(logFilePath, { | |
| 'flags': 'a', | |
| 'encoding': null, |