Skip to content

Instantly share code, notes, and snippets.

View toniov's full-sized avatar

Antonio V toniov

View GitHub Profile
@toniov
toniov / parse-rb-to-mixcloud.js
Last active March 23, 2020 01:25
Parse Rekordbox playlist to Mixcloud compatible format
// $ node index.js playlist.csv Album "Track Title" Artist
const fs = require('fs');
const papa = require('papaparse');
const filePath = process.argv[2];
const parts = {};
for (let i = 3; i < process.argv.length; i++) {
parts[process.argv[i]] = -1;
}
@toniov
toniov / for-await-of_example.js
Created January 8, 2019 13:32
for-await-of with a synchronous iterable over non-promise values
const sleep = (ms) => new Promise(r => setTimeout(r, ms));
for await (const x of [300, 100, 200]) {
console.log(x);
await sleep(x);
}
// It prints 300 100 200, which means it was not executed concurrently
@toniov
toniov / profileUnion.js
Last active June 7, 2018 02:43
Profiling execution time of array union keeping order
const union = require('lodash.union');
const list = [2890, 10004, 145];
const largeArray = [];
for (let i = 0; i < 25000; i++) {
largeArray.push(Math.floor(Math.random() * 25000));
}
const mediumArray = [];
for (let i = 0; i < 10000; i++) {
mediumArray.push(Math.floor(Math.random() * 10000));
@toniov
toniov / file0.txt
Last active August 1, 2017 05:36
JavaScriptでElasticsearchのクエリを作る ref: http://qiita.com/antonvs/items/ae64ca9d4733a8e8341a
{
"bool": {
"must": [{
"term": {
"name": "承太郎"
}
}, {
"match": {
"description": {
"query": "やれやれだぜ"