Skip to content

Instantly share code, notes, and snippets.

View mdarse's full-sized avatar

Mathieu Darse mdarse

  • Paris
View GitHub Profile
@mdarse
mdarse / a.js
Last active May 20, 2020 18:24
Broken module binding with top level await & dynamic import
import B from "./b.js";
console.log(B); // "undefined" or "X" depending on export in b.js
@mdarse
mdarse / airtable_snipets.sql
Last active January 10, 2020 19:30
Various Airtable formula snippets
-- Get Nth word (replace WORD_N to use)
TRIM(
MID(
SUBSTITUTE(
{Name},
" ",
REPT(" ", LEN({Name}))
),
(WORD_N - 1) * LEN({Name}) + 1,
LEN({Name})
@mdarse
mdarse / firefox_logins_to_1password_csv.py
Created December 27, 2018 17:54
Converts Firefox passwords export to 1Password compatible CSV
#!/usr/bin/env python3
import csv
import sys
from urllib.parse import urlparse
# This expects a CSV export from https://github.com/kspearrin/ff-password-exporter
# This outputs 1Password compatible CSV
# see https://support.1password.com/create-csv-files/
output = csv.writer(sys.stdout)
@mdarse
mdarse / Scaler.js
Last active May 2, 2017 09:34
Scaler component to display some inner tree like a full page preview would do (including media queries).
import { Component, PropTypes } from 'react';
import stylePropType from 'react-style-proptype';
// TODO For SSR support, use this: https://github.com/bvaughn/react-virtualized/blob/78910b626b3c0d31d2a791a7a3f1c0dcaa56a25e/source/vendor/detectElementResize.js
// TODO Debounce window resize handler
function resetMeasurements() {
return {
windowWidth: document.documentElement.offsetWidth,
scalerWidth: null,

Keybase proof

I hereby claim:

  • I am mdarse on github.
  • I am mathieudarse (https://keybase.io/mathieudarse) on keybase.
  • I have a public key whose fingerprint is F7E3 8EDC A155 70BF AF96 CCB2 5ECC AD2E 4C9C 4B68

To claim this, I am signing this object:

#/bin/bash
set -o errexit
# Find whether the Vagrant machine was already created or not.
# It parses that kind of output:
#
# 1438619288,default,provider-name,vmware_fusion
# 1438619288,default,state,not_created
# 1438619288,default,state-human-short,not created
@mdarse
mdarse / .bashrc
Last active August 29, 2015 14:18
PHPUnit global notifier
#!/bin/bash
alias phpunit="phpunit --bootstrap bootstrap_listener.php"
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@mdarse
mdarse / query.pp
Last active August 29, 2015 14:08
IN syntax grammar
%skip space \s
%token in IN
%token word \S+
#query:
in_expression() | text() | unrestricted_text()
#in_expression:
text() ::in:: field()
@mdarse
mdarse / clone.js
Created August 2, 2013 10:13 — forked from Raynos/clone.js
function clone(o) {
return Object.create(
Object.getPrototypeOf(o),
Object.getOwnPropertyDescriptors(o)
);
}