Skip to content

Instantly share code, notes, and snippets.

Ricardo Tomasi ricardobeat

Block or report user

Report or block ricardobeat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ricardobeat
ricardobeat / index.html
Created Sep 10, 2018
Inline event attributes benchmark
View index.html
<!doctype html>
<body></body>
<script>
const events = [
'click',
'input',
'change',
'mouseenter',
'mouseleave',
@ricardobeat
ricardobeat / task.js
Last active Mar 20, 2018
Taks sample
View task.js
const { task, read, write } = require('taks')
const _postcss = require('postcss')
const _rollup = require('rollup')
const _uglify = require('uglify-es')
const postcss = task.plugin(async function (input, output, options) {
let opts = Object.assign({ from: undefined, plugins: [] }, options)
let src = await read(input)
let { css } = await _postcss(opts.plugins).process(src, opts)
return write(output, css)
@ricardobeat
ricardobeat / task.js
Last active Mar 20, 2018
minimal task runner
View task.js
#!/usr/bin/env node
const _tasks = {}
function task (name, fn) {
_tasks[name] = fn
}
task.run = async function (name, wait) {
if (!name) return console.warn(`Usage: node task [name]`)
if (!_tasks[name]) return console.warn(`No task named ${name}`)
@ricardobeat
ricardobeat / search.sh
Created Apr 10, 2017
Git: digging for lost code - unlabeled stashes etc
View search.sh
git fsck --no-reflogs | awk '/dangling commit/ {print $3}'| while read hash; do
echo "$hash"
git show $hash | grep -H -C4 svg
done
View README.md

Simple comparison between Atomic CSS vs 'standard' CSS. Might not be representative of larger files.

results

file raw gzip
with-atomic.css 576b 325b
with-atomic.html 1183b 254b
without-atomic.css 1676b 324b
without-atomic.html 714b 199b
View abortable-promise.js
function AbortablePromise (fn) {
var abortHandler;
function onAbort (abortFn) {
abortHandler = abortFn;
}
var promise = new Promise(function (resolve, reject) {
fn.call(null, resolve, reject, onAbort);
View gist:4bb8ffe1a12120a2923c
Verifying I am +ricardobeat on my passcard. https://onename.com/ricardobeat
@ricardobeat
ricardobeat / stupid-ie7-console-log.js
Last active Aug 29, 2015
IE7 panel for console.*
View stupid-ie7-console-log.js
;(function () {
var doc = document.documentElement
var IE7 = navigator.userAgent.indexOf('MSIE 7') > 0
logpane = document.createElement('div')
var height = 180
var width = 480
document.body.appendChild(logpane)
logpane.style.background = '#fff'
logpane.style.padding = '10px'
logpane.style.position = IE7 ? 'absolute' : 'fixed'
@ricardobeat
ricardobeat / chess.js
Last active Aug 29, 2015
compiling chess results with node streams
View chess.js
#!/usr/bin/env node
var fs = require('fs')
var path = require('path')
var dir = process.argv[2]
if (!dir) throw new Error('Usage: ./chess.js path-to-pgn-files/ ')
var white = 0
var black = 0
You can’t perform that action at this time.