Skip to content

Instantly share code, notes, and snippets.

View Aschen's full-sized avatar
💭
:trollface:

Adrien Maret Aschen

💭
:trollface:
View GitHub Profile
@Aschen
Aschen / loop-create-array.js
Last active November 29, 2019 08:53
Benchmarking creating array from array
const Benchmark = require('benchmark')
const suite = new Benchmark.Suite
const array = [];
for (let i = 0; i < 1000; i++) {
array.push({ value: i });
}
@Aschen
Aschen / create-collection.js
Created November 28, 2019 03:50
Create Kuzzle collection with mappings
const {
Kuzzle,
WebSocket
} = require('kuzzle-sdk')
const kuzzle = new Kuzzle(new WebSocket("localhost"))
kuzzle.on('networkError', error => console.error(error));
(async () => {
@Aschen
Aschen / docker-compose-v2.yml
Created November 22, 2019 09:58
Docker compose Kuzzle v2
version: '3'
services:
kuzzle:
image: kuzzleio/kuzzle:2
ports:
- "7512:7512"
cap_add:
- SYS_PTRACE
depends_on:
@Aschen
Aschen / array-benchmark.js
Last active November 18, 2019 09:52
Benchmarking array iteration with Node.js
const Benchmark = require('benchmark')
const suite = new Benchmark.Suite
const array = [];
for (let i = 0; i < 1000; i++) {
array.push(i);
}
@Aschen
Aschen / README.md
Last active September 10, 2025 10:04
Get random card from a Trello board

Shuffle Trello : Pick a random card in a column

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.

Usage

@Aschen
Aschen / kuzzle-sdk.java
Last active October 16, 2019 07:19
Kuzzle Java SDK Login
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