Skip to content

Instantly share code, notes, and snippets.

@tbrisbout
tbrisbout / leanpub-word-count.js
Last active November 30, 2020 20:57
Leanpub word count
const wc = () => Array.from(document.querySelectorAll('.view-lines div span span')).map(e => e.innerText.split(/\s/)).flat().filter(x => /\w+/.test(x)).length
setInterval(() => { document.querySelector('.save-text.in-page').innerText = wc() + ' words' }, 5000)
@tbrisbout
tbrisbout / run.sh
Last active November 2, 2020 21:47
build diagrams
#!/bin/bash
# To run like this:
# ./run.sh foo.py
#
# If you have `entr` installed, you can build and preview on change:
# ls *.py | entr -p ./run.sh /_
#
set -e
@tbrisbout
tbrisbout / naive-go-fmt.vim
Created April 13, 2020 14:21
Gofmt on save in vim without plugins
function! CustomGoFmt()
let file = expand('%')
silent execute "!gofmt -w " . file
edit!
set filetype = go
endfunction
command! CustomGoFmt call CustomGoFmt()
augroup go_autocmd
autocmd BufWritePost *.go CustomGoFmt

Instruction for elm workshop

Elm Installation

  • elm
npm install -g elm
  • elm-test
@tbrisbout
tbrisbout / talk.vimrc
Last active December 13, 2015 17:26
talk vimrc
" augroup reload_talk_vimrc
" autocmd!
" autocmd BufWritePost *.vimrc source ~/dev/talk.vimrc
" augroup END
" ================ General Config ================
set nocompatible
syntax enable
set encoding=utf-8