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 neo4j = require('neo4j-driver'); | |
const uri = 'bolt://localhost:7687' | |
async function init(tx) { | |
await tx.run('MATCH ()-[k]->() DELETE k') | |
await tx.run('MATCH (n) DELETE n') | |
await tx.run('CREATE (p:A)') | |
await tx.run('CREATE (p:B)') | |
} |
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
/** | |
* usage node connect.js mqtt://localhost:1883 | |
*/ | |
const mqtt = require('mqtt') | |
const URI = process.argv[2] | |
const EVENTS = ['connect', 'reconnect', 'close', 'offline', 'end', 'error', 'packetsend', 'packetreceive', 'message'] |
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 assert = require('assert'); | |
const Jimp = require('jimp'); | |
exports.command = function (selector, fileName) { | |
this.perform((client, done) => { | |
let width, height, x, y; | |
client |
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 express = require('express'); | |
const cors = require('cors'); | |
const bodyParser = require('body-parser'); | |
const app = express(); | |
const PORT = process.env.PORT || 3000; | |
app.use(cors()); | |
app.use(bodyParser.urlencoded({extended: false})); | |
app.use(bodyParser.json()); |
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
let gpio = require('rpi-gpio'); | |
let Promise = require('bluebird'); | |
//mock | |
// gpio = { | |
// setup: function (pin, direction, cb) { | |
// console.log('setup', pin, direction); | |
// cb(); | |
// }, | |
// write: function (channel, value, cb) { |
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
koa.use((ctx, next) => new Promise((resolve, reject) => { | |
ctx.body = "hello" | |
next().then(_ => { | |
resolve(); | |
}); | |
})); |