Skip to content

Instantly share code, notes, and snippets.

@mabhub
mabhub / anagrams.js
Last active February 1, 2021 14:48
Anagrams
/**
* Return a copy of `array` without element at `index`
*/
const punch = (array = [], index) => {
const copy = array.slice();
copy.splice(index, 1);
return copy;
};
const getAnagrams = (word = '', dedup = true) => {
@mabhub
mabhub / Incapsula.js
Last active April 6, 2020 14:18
generateur
(function(_0x137a30, _0x278297) {
var _0xb5dc08 = function(_0x1c3e3b) {
while (--_0x1c3e3b) {
_0x137a30['push'](_0x137a30['shift']());
}
};
var _0x53d63f = function() {
var _0x573c96 = {
'data': {
'key': 'cookie',
@mabhub
mabhub / gatsby-ssr.js
Created November 21, 2019 16:57
Do not inline CSS in Gatsby rendered HTML files
exports.onPreRenderHTML = ({ getHeadComponents, replaceHeadComponents }) => {
if (process.env.NODE_ENV !== 'production') {
return;
}
const headComponents = getHeadComponents();
replaceHeadComponents(headComponents.map(headComponent => {
if (headComponent.type !== 'style') {
return headComponent;
@mabhub
mabhub / nvm-list
Created February 19, 2019 14:13
NVM list global packages
#!/usr/bin/env node
const { promises: fs } = require('fs');
const path = require('path');
(async () => {
const nvmPath = process.env.NVM_DIR;
if (!nvmPath) {
console.error('Unable to detect nvm path. Exiting.');
process.exit(1);
@mabhub
mabhub / death_letter.tex
Created August 9, 2018 10:41 — forked from aeris/death_letter.tex
Lettre de la mort GDPR
\documentclass[10pt]{lettre}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{eurosym}
\usepackage{enumitem}
\usepackage[frenchb]{babel}
\begin{document}
\begin{letter}{
@mabhub
mabhub / README.md
Last active March 15, 2018 10:25
Hackaviz 2018 data

Données pour le Hackaviz 2018

Structure

Pour alléger le fichier original, quelques modifications ont été apportées :

Simplification des coordonnées

Les coordonnées de geométries sont tronquées à 4 décimales. Cela provoque une perte de précision relativement limitée, un dix-millieme de degré représentant appxoimativement 11m.

@mabhub
mabhub / stitcher.py
Last active July 24, 2017 10:12 — forked from will-hart/README.md
Stitch together tilemaps into a single image
# -*- coding: utf-8 -*-
"""
A simple script which converts all the images in the folder it is run from
into a single image. Images should be in "tile map set" folder format with
0-based numbered folders and images running from 0 - n, named as e.g. "0.png"
Used for http://forums.bistudio.com/showthread.php?178671-Tiled-maps-Google-maps-compatible-(WIP)
License: public domain
"""
@mabhub
mabhub / main.js
Created February 15, 2017 15:24
Bootstrap media queries as classes
[[480, 'xs'], [768, 'sm'], [992, 'md'], [1200, 'lg']].forEach(([size, name]) => {
document.body.classList.toggle(`screen-${name}-min`, window.matchMedia(`(min-width: ${size}px)`).matches);
document.body.classList.toggle(`screen-${name}-max`, window.matchMedia(`(max-width: ${size}px)`).matches);
});