Skip to content

Instantly share code, notes, and snippets.

@joakin
joakin / readme.md
Created April 11, 2018 16:43
Popups state chart as in the integration test
@joakin
joakin / loop.sh
Created March 12, 2018 10:38
Loop a gif and extend the last frame
gifsicle intro-gif.gif -d200 "#-1" -o intro-gif-last-frame.gif
gifsicle intro-gif.gif --loop --append intro-gif-last-frame.gif -o intro-gif-appended-looped.gif
@joakin
joakin / remote-advice.md
Last active February 26, 2018 17:56
What have you learned by working remote?
@joakin
joakin / profile.json
Last active January 30, 2018 22:05
Lazy loaded small images
This file has been truncated, but you can view the full file.
[{"pid":2339,"tid":775,"ts":101462461255,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":24,"tdur":19,"tts":4727567139},
{"pid":2339,"tid":775,"ts":101462461304,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":8,"tdur":7,"tts":4727567183},
{"pid":2339,"tid":775,"ts":101462461333,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":9,"tdur":7,"tts":4727567213},
{"pid":2339,"tid":775,"ts":101462461363,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":9,"tdur":9,"tts":4727567242},
{"pid":2339,"tid":775,"ts":101462461394,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"
This file has been truncated, but you can view the full file.
[{"pid":2339,"tid":775,"ts":94987529710,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":20,"tdur":20,"tts":4117667121},
{"pid":2339,"tid":775,"ts":94987529787,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":9,"tdur":9,"tts":4117667198},
{"pid":2339,"tid":775,"ts":94987529816,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":7,"tdur":8,"tts":4117667227},
{"pid":2339,"tid":775,"ts":94987529841,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEnabled"},"dur":7,"tdur":6,"tts":4117667252},
{"pid":2339,"tid":775,"ts":94987529864,"ph":"X","cat":"toplevel","name":"MessageLoop::RunTask","args":{"src_file":"../../base/trace_event/trace_log.cc","src_func":"SetEn
@joakin
joakin / profile-vim.md
Created January 17, 2018 10:19
Profile vim
@joakin
joakin / README.md
Created January 9, 2018 11:30
Async functions example
@joakin
joakin / browser-mitigations-meltdown-spectre.md
Created January 9, 2018 09:51
Browser mitigations for meltdown & spectre

There were recently two very serious security vulnerabilities disclosed ([Spectre][] & [Meltdown][]) that affect pretty much anything that can run code on your machine.

That includes browsers, so major vendors have started rolling out mitigations for such attacks so that the vulnerabilities can't be exploited from JavaScript. Here is some info in case you haven't followed:

Summary

  • performance.now is going to be rounded to avoid exposing the high precision timer
    • to 1ms in Safari, 20µs in Firefox, 20µs with 20µs jitter in Edge, unspecified in Chrome
  • SharedArrayBuffer is going to be disabled for now since it can be used to create high precision timers from JS
@joakin
joakin / debounce.js
Last active January 2, 2018 18:37
Small debounce and throttle fns.
function debounce (f, t) {
let tid = null
let r = _ => { tid = null; f() }
return _ => {
if (tid) clearTimeout(tid)
tid = setTimeout(r, t)
return () => { clearTimeout(tid); tid = null }
}
}
@joakin
joakin / static-marvin.sh
Created November 24, 2017 10:19
Static Marvin build
#!/bin/bash
git clone https://github.com/wikimedia/marvin.git
cd marvin/
npm i
npm run build
# Run node server to get the HTML
node dist/server/index.js &
# Save the HTML to dist/
curl http://localhost:3000/ > dist/index.html