Skip to content

Instantly share code, notes, and snippets.

View bpierre's full-sized avatar
✌️

Pierre Bertet bpierre

✌️
View GitHub Profile
@bpierre
bpierre / README.md
Last active February 15, 2024 18:40
Switch To Vim For Good

Switch To Vim For Good

NOTE: This guide has moved to https://github.com/bpierre/switch-to-vim-for-good

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: https://gist.github.com/bpierre/0a0025d348b6001394e0

@bpierre
bpierre / emotion-plugin-css-unit.js
Last active April 9, 2021 14:24
Custom CSS units implemented with @emotion/cache as a stylis plugin
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
bpierre / anchor-select.js
Created May 8, 2012 14:48
CSS Selectors anchors: /mypage.html#anchor-select(#content > h1)
(function(window) {
function getSelector(hash) {
var matches;
hash = hash.slice(1);
matches = hash.match(/^anchor-select\((.+)\)$/);
if (matches) {
return decodeURIComponent(matches[1]);
}
return false;
@bpierre
bpierre / Makefile
Created November 5, 2011 17:34
A Makefile to concatenate / minify my JS Scripts and convert/compress my Stylus (CSS preprocessor) files
# JS files
JS_FINAL = js/project-name-all.js
JS_TARGETS = js/file1.js \
js/file2.js \
js/file3.js
# CSS files
CSS_FINAL = css/project-name-all.css
STYLUS_TARGETS = css/file1.styl \
@bpierre
bpierre / gist:4991393
Created February 19, 2013 23:52
Results of the markdown-testsuite with markdown-js
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
bpierre / sfrbox-host.sh
Created December 3, 2012 13:40
Add a custom domain on a Neuf/SFR Box, from CLI
#!/bin/sh
die () {
echo >&2 "$@"
exit 1
}
[ "$#" -eq 2 ] || die "2 arguments required (IP and Domain), $# provided"
LOGIN="admin"
@bpierre
bpierre / kib.js
Created November 14, 2012 00:03
Another boring keyboard library
/*jshint browser:true */
(function(name, definition) {
if (typeof define == 'function') {
define(definition);
} else if (typeof module != 'undefined') {
module.exports = definition();
} else {
this[name] = definition();
}
})('kib', function(){
@bpierre
bpierre / index.html
Created October 15, 2012 11:37
SUPER #7
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>SUPER #7</title>
<style>
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; }
@bpierre
bpierre / index.html
Created September 26, 2012 23:49
Mini clock
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Clock demo</title>
<style>
svg {
display: block;
position: absolute;
left: 50%;
@bpierre
bpierre / eternal-ff.txt
Created September 21, 2012 11:03
My Twitter followings
@BKcore
@codylindley
@KerbalSpaceP
@GilbertWehrle
@dlctbl
@FREE_FACTS
@tabatkins
@marijnjh
@rocket2guns
@stripe