Skip to content

Instantly share code, notes, and snippets.

{
"metadata": {
"name": "Load SkiaPerf Data"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
%matplotlib inline
import matplotlib.pyplot as plt
import httplib2
import json
import urllib
query = [
("source_type", "skp"),
("config", "8888"),
A quick and hacky HTTP server in Julia to execute Julia, which gets around the
startup and JIT delays when running Julia scripts from the command line.
@jcgregorio
jcgregorio / LICENSE
Last active August 5, 2017 15:48
D3 and L-Systems with Redux and StateReflector
// Copyright (c) 2017 The Chromium Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
@jcgregorio
jcgregorio / L-System.js
Last active August 7, 2017 07:47
L-Systems with Redux and StateReflector
(function () {
var dup = (o) => JSON.parse(JSON.stringify(o));
var $ = (id) => document.getElementById(id);
var canvas = document.querySelector("canvas"),
ctx = canvas.getContext("2d"),
width = canvas.width,
height = canvas.height;
var rules = {
@jcgregorio
jcgregorio / colorlogs
Last active August 7, 2017 17:48
Colorizes glogs as they pass through.
#!/bin/sh
# Since glog emits to stderr you'll need to run this through:
# 2>&1 | colorlogs
awk '
/^I/ {print "\033[32m" $0 "\033[39m"}
/^W/ {print "\033[33m" $0 "\033[39m"}
/^E/ {print "\033[31m" $0 "\033[39m"}
'
@jcgregorio
jcgregorio / page.html
Created August 15, 2017 04:05
HTML for Organizing around State
<label for=length>Length:</label>
<input type=range name=length id=length min=1 max=10 />
<span style="padding: 0 10px;" id=lengthDisplay></span>
<br>
<label for=angle>Angle:</label>
<input type=range name=angle id=angle min=0.01 max=1 step=0.01 />
<span style="padding: 0 10px;" id=angleDisplay></span>
<br>
<canvas width=600 height=600></canvas>
@jcgregorio
jcgregorio / main.js
Created August 15, 2017 04:17
JS for the main page.
let dup = (o) => JSON.parse(JSON.stringify(o));
let canvas = document.querySelector("canvas"),
ctx = canvas.getContext("2d"),
width = canvas.width,
height = canvas.height;
let rules = {
"X": "F-[[X]+X]+F[+FX]-X",
"F": "FF",
@jcgregorio
jcgregorio / binder.js
Last active August 15, 2017 04:37
Binds a Redux state store to and from HTML elements.
// Binder makes it easy to setup bindings between data stored in a Redux
// store and HTML elements.
class Binder {
// store - A Redux store.
// dispatch - A function called to update the state in store.
// ele - The root element where all element searches begin from, i.e.
// querySelectorAll is run on this element. Defaults to document.
constructor(store, dispatch, ele = document) {
this.to = [];
@jcgregorio
jcgregorio / spinner-bw.css
Created November 8, 2017 22:06
An activity spinner using Custom Elements.
spinner-bw {
display: none;
border-radius: 50%;
width: 2em;
height: 2em;
border: 0.4em solid #A6CEE3;
border-left: 0.4em solid #1F78B4;
animation: spinner-bw-spin 1.5s infinite linear;
}