Skip to content

Instantly share code, notes, and snippets.


Pierre Bertet bpierre

View GitHub Profile
bpierre / emotion-plugin-css-unit.js
Last active Apr 9, 2021
Custom CSS units implemented with @emotion/cache as a stylis plugin
View emotion-plugin-css-unit.js
import { CacheProvider } from "@emotion/react"
import createCache from "@emotion/cache"
function cssUnitPlugin(unitInPx = 8, unit = "gu") {
const re = new RegExp("([0-9]+)" + unit, "g")
const convert = (value) => value.replace(re, replacer)
const replacer = (_, value) => `${value * unitInPx}px`
return (element) => {
if (element.type === "decl" && element.value.includes(unit)) {
bpierre /
Last active Oct 11, 2021
Switch To Vim For Good

Switch To Vim For Good

NOTE: This guide has moved to

This guide is coming from an email I used to send to newcomers to Vim. It is not intended to be a complete guide, it is about how I switched myself.

My decision to switch to Vim has been made a long time ago. Coming from TextMate 1, I wanted to learn an editor that is Open Source (so I don’t lose my time learning a tool that can be killed), cross platform (so I can use it everywhere), and powerful enough (so I won’t regret TextMate). For these reasons, Vim has always been the editor I wanted to learn, but it took me several years before I did it in a way that works for me. I tried to switch progressively, using the Janus Vim distribution for a few months, then got back to using TextMate 2 for a time, waiting for the next attempt… here is what finally worked for me.

Original gist with comments:

## Colours and font styles
# Escape sequence and resets
# Foreground colours

Keybase proof

I hereby claim:

  • I am bpierre on github.
  • I am bpierre ( on keybase.
  • I have a public key whose fingerprint is D737 C824 4126 75D9 89E9 4835 5277 8183 234D C59F

To claim this, I am signing this object:

View gist:10526379
### Keybase proof
I hereby claim:
* I am bpierre on github.
* I am bpierre ( on keybase.
* I have a public key whose fingerprint is 219A B92C E852 719D 99C3 5A1B 17B2 82B4 3284 3D18
To claim this, I am signing this object:
bpierre / hash.js
Created Feb 23, 2014
Mini location.hash system + mini routing system (useful with PhoneGap)
View hash.js
* Mini location.hash update system
* Usage:
* var createHash = require('./hash');
* var hash = createHash('!/', function(value) {
* // Value updated
* });
bpierre / gist:4991393
Created Feb 19, 2013
Results of the markdown-testsuite with markdown-js
View gist:4991393
not ok test/markdown-testsuite.t.js .................. 51/102
Command: "node" "markdown-testsuite.t.js"
TAP version 13
ok 1 2-paragraphs-hard-return-spaces
ok 2 2-paragraphs-hard-return
ok 3 2-paragraphs-line-returns
ok 4 2-paragraphs-line-spaces
ok 5 2-paragraphs-line-tab
ok 6 ampersand-text-flow
ok 7 ampersand-uri
bpierre /
Created Dec 3, 2012
Add a custom domain on a Neuf/SFR Box, from CLI
die () {
echo >&2 "$@"
exit 1
[ "$#" -eq 2 ] || die "2 arguments required (IP and Domain), $# provided"
bpierre / kib.js
Created Nov 14, 2012
Another boring keyboard library
View kib.js
/*jshint browser:true */
(function(name, definition) {
if (typeof define == 'function') {
} else if (typeof module != 'undefined') {
module.exports = definition();
} else {
this[name] = definition();
})('kib', function(){
View index.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>SUPER #7</title>
html { display: table; width: 100%; height: 100%; background: #000; }
body { display: table-cell; vertical-align:middle; text-align:center; margin: 0; }
canvas { margin: 0; }
h1 { color: #fff; margin: 0 0 10px; font:24px sans-serif; }