Skip to content

Instantly share code, notes, and snippets.

View nicolasbrugneaux's full-sized avatar
🤓
Nerdin'

Nicolas Brugneaux nicolasbrugneaux

🤓
Nerdin'
View GitHub Profile
@nicolasbrugneaux
nicolasbrugneaux / settings.json
Created September 4, 2020 21:07
vscode settings
// Place your settings in this file to overwrite the default settings
{
"editor.glyphMargin": false,
"editor.wordWrap": "off",
"workbench.colorCustomizations": {
"editorIndentGuide.activeBackground": "#888",
},
"editor.codeActionsOnSave": {
"source.organizeImports": false,
"source.fixAll.eslint": true

Keybase proof

I hereby claim:

To claim this, I am signing this object:

const fetch = require('node-fetch');
const API_URL = 'https://slack.com/api/';
const TOKEN = '?token=' + 'redacted';
const DEFAULT_COUNT = 100; // as per slack's doc
const PAST_THRESHHOLD = new Date();
PAST_THRESHHOLD.setHours(-120 * 24, 0, 0, 0);
@nicolasbrugneaux
nicolasbrugneaux / plv8.rb
Last active March 21, 2017 11:47 — forked from aliatsis/plv8.rb
brew plv8 formula (static linking to v8)
require 'formula'
# based on https://github.com/Homebrew/homebrew/pull/19833
class Plv8 < Formula
homepage 'http://code.google.com/p/plv8js/wiki/PLV8'
version '2.0.0'
url 'https://github.com/plv8/plv8/archive/master.zip'
depends_on :postgresql
@nicolasbrugneaux
nicolasbrugneaux / migrate.js
Created March 30, 2016 09:53
true parallelism in node
import { cpus } from 'os';
import cluster from 'cluster';
if (cluster.isMaster) {
getAllRows()
.then(rows => {
const CPUS = cpus().length;
const chunked =chunks(rows, CPUS); // n rows into an array of length CPUS containing n/CPUS-ish rows (tries to balance)
const statuses = chunked
@nicolasbrugneaux
nicolasbrugneaux / drag.js
Created September 25, 2015 14:44
Make a div draggable – movable.
const getNumberFromCss = ( rules, cssName ) => parseInt( rules[cssName], 10 );
export const makeDraggable = ( element ) =>
{
const initial =
{
x : null,
y : null,
top : null,
right : null
@nicolasbrugneaux
nicolasbrugneaux / fuzzy.js
Last active September 21, 2015 14:41
fuzzy-string-matching-using-cosine-similarity
// http://blog.nishtahir.com/2015/09/19/fuzzy-string-matching-using-cosine-similarity/
'use strict';
Set.intersection = function*( set1, set2 )
{
for ( let value of set1.values() )
{
if ( set2.has( value ) )
{
@nicolasbrugneaux
nicolasbrugneaux / migration.js
Created August 21, 2015 10:03
spotify: migrate to rdio.
// go to the proper iframe in the console, should be something like:
// 'collection-app-spotify'...
// run that
[].map.call(document.querySelectorAll( 'div.list-group>.list-group-item-media.playable'), function(list){
return list.getAttribute('data-uri')
} );
// copy all these links in http://resp.in/
-- zcat 2015/07/0723*trace* |
-- grep -o "__id.*duration_..__" |
-- sed 's/__*\|id\|duration/ /g' |
-- sed 's/^ *\| *$//g' |
-- sed 's/ */ /' |
-- nawk '{
-- max[$1] = !($1 in max) ? $2 : ($2 > max[$1]) ? $2 : max[$1]
-- } END {
-- for (i in max)
-- print i, max[i]