Skip to content

Instantly share code, notes, and snippets.

@f0i
f0i / mithril.patch.js
Created October 27, 2015 16:00
Pass event to m.withAttr callback function
 // Pass event to m.withAttr callback function
m.withAttr = function(prop, withAttrCallback) {
return function(e) {
e = e || event;
var currentTarget = e.currentTarget || this;
withAttrCallback(prop in currentTarget ? currentTarget[prop] : currentTarget.getAttribute(prop), e);
}
};
@f0i
f0i / keybase.md
Created April 5, 2014 09:09
ID proof for keybase.io

Keybase proof

I hereby claim:

  • I am f0i on github.
  • I am f0i (https://keybase.io/f0i) on keybase.
  • I have a public key whose fingerprint is 5E0A 1751 29DD 6DC3 FE5C 0C59 85F8 8874 C638 46AE

To claim this, I am signing this object:

@f0i
f0i / makefile
Created November 25, 2013 10:29
Terminal IDE sync script
all: clean copy commit push
clean:
cp makefile /tmp/tidemakefile
-rm * -r
cp /tmp/tidemakefile makefile
copy:
echo "new location of code (e.g. /tmp/TermIDE) without tailing slash:"
read location && cp -r $${location}/* .
@f0i
f0i / .vimrc
Created January 31, 2013 06:57
Highlight loops based on indention in vim
highlight loop1 ctermbg=233
highlight loop2 ctermbg=235
highlight loop3 ctermbg=237
let g:showtree=0
function! TreeView()
if (g:showtree == 0)
let g:showtree=1
match loop1 "^ .*$\|\(^ \)\@<= .*$"
2match loop2 "\(^ \)\@<= [^\ ].*$\|\(^ \)\@<= \|\(^ \)\@<= .*$"
@f0i
f0i / makefile
Last active May 21, 2019 03:33
Make task to watch file system changes and rebuild
all:
# do something
# watch requires inotify-tools
watch:
while true; \
do \
inotifywait ./ || exit && make all; \
sleep 0.5; \
done