Hello World from GitHub
This file contains 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
hey there! |
Usually when new version of Node.js comes out and you update it by just installing new and removing old one, all of your global NPM packages are gone. Here is how to update to new version of Node and reinstall packages:
$ nvm install NEW_VERSION --reinstall-packages-from=OLD_VERSION
This file contains 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 _ = require('lodash') | |
const components = { | |
blaster: { | |
tasks: [ | |
{ name: 'ystanovka_lazera_blastera_v_korpus', worker: 'shturmoviki' }, | |
{ name: 'polirovka_rukoyati_blastera', worker: 'sborshiki' }, | |
{ name: 'zaryad_batarey_blastera', worker: 'akkumulyatori' }, | |
{ name: 'pristrelka', worker: 'shturmoviki' } | |
], |
curl -H "Content-Type: application/json" -X POST -d '{"username":"xyz","password":"xyz"}' http://localhost:3000/api/login
curl -XGET 'http://127.0.0.1:8000/api/some' -H 'Authorization: JWT <some_token>'
This file contains 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 moment from 'moment' | |
import es from 'elasticsearch' | |
import uuid from 'node-uuid' | |
import _ from 'lodash' | |
import config from '/config' | |
const client = new es.Client({ | |
host: config.host | |
}) |
This file contains 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
getAPIKeys () { | |
const esClient = new ElasticSearch.Client({ host: 'http://nightly.apinf.io:14002' }); | |
const params = { | |
size: 10, | |
body: { | |
sort: [ | |
{ | |
request_at: { | |
order: 'desc', | |
}, |
This file contains 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') | |
var walk = function (dir, done) { | |
fs.readdir(dir, (error, list) => { | |
if (error) { | |
return done(error) | |
} | |
let i = 0; |
This file contains 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
migrate () { | |
this.notify.info('success') | |
axios.get(`http://127.0.0.1:1337/servers?limit=1000`) | |
.then(res => { | |
const servers = res.data | |
this.notify.info('Success', `Found ${servers.length} servers.`) | |
_.forEach(servers, server => { | |
this.apiServers.add(server) | |
.then(res => console.log(res)) | |
.catch(err => console.error(err)) |
NewerOlder