This small script pick a random card in a column on a Trello board.
We use this script at Kuzzle to pick a random card for our product workshop.
| const Benchmark = require('benchmark') | |
| const suite = new Benchmark.Suite | |
| const array = []; | |
| for (let i = 0; i < 1000; i++) { | |
| array.push({ value: i }); | |
| } |
| const { | |
| Kuzzle, | |
| WebSocket | |
| } = require('kuzzle-sdk') | |
| const kuzzle = new Kuzzle(new WebSocket("localhost")) | |
| kuzzle.on('networkError', error => console.error(error)); | |
| (async () => { |
| version: '3' | |
| services: | |
| kuzzle: | |
| image: kuzzleio/kuzzle:2 | |
| ports: | |
| - "7512:7512" | |
| cap_add: | |
| - SYS_PTRACE | |
| depends_on: |
| const Benchmark = require('benchmark') | |
| const suite = new Benchmark.Suite | |
| const array = []; | |
| for (let i = 0; i < 1000; i++) { | |
| array.push(i); | |
| } |
This small script pick a random card in a column on a Trello board.
We use this script at Kuzzle to pick a random card for our product workshop.
| import io.kuzzle.sdk.core.Kuzzle; | |
| import io.kuzzle.sdk.core.Options; | |
| Options options = new Options(); | |
| options | |
| .setAutoReconnect(true), | |
| .setPort(7512); | |
| Kuzzle kuzzle = new Kuzzle("106.75.172.117", options, new ResponseListener<Void>() { |
| const filters = { | |
| geoPolygon: { | |
| location: { | |
| points: [ | |
| [2.35107421875, 51.0275763378024], | |
| [-4.89990234375, 48.472921272487824], | |
| [-1.6259765625, 43.48481212891603], | |
| [3.01025390625, 42.48830197960227], | |
| [7.62451171875, 43.77109381775651], | |
| [8.173828125, 48.980216985374994], |
| const filters = { | |
| equals: { containerId: 'liia-1209' } | |
| }; | |
| await kuzzle.realtime.subscribe('containers', 'positions', filters, notification => { | |
| // Only notifications about the 'liia-1209' container | |
| }); |
| echo "./doxbee-sequential/promises-native-async-await.js ./doxbee-sequential/promises-ecmascript6-native.js ./doxbee-sequential/promises-bluebird.js" | sed -e 's|\.js||' | xargs node ./performance.js --p 1 --t 1 --n 10000 | |
| file time(ms) memory(MB) | |
| promises-bluebird.js 279 49.20 | |
| promises-native-async-await 280 53.22 | |
| promises-ecmascript6-native.js 318 65.82 | |
| Platform info: | |
| Linux 4.10.0-38-generic x64 | |
| Node.JS 12.8.1 |
| echo "./doxbee-sequential/promises-native-async-await.js ./doxbee-sequential/promises-ecmascript6-native.js ./doxbee-sequential/promises-bluebird.js" | sed -e 's|\.js||' | xargs node ./performance.js --p 1 --t 1 --n 10000 | |
| file time(ms) memory(MB) | |
| promises-bluebird.js 260 44.71 | |
| promises-native-async-await 322 68.64 | |
| promises-ecmascript6-native.js 332 73.80 | |
| Platform info: | |
| Linux 4.10.0-38-generic x64 | |
| Node.JS 10.16.2 |