Skip to content

Instantly share code, notes, and snippets.

%matplotlib inline
import matplotlib.pyplot as plt
import httplib2
import json
import urllib
query = [
("source_type", "skp"),
("config", "8888"),
{
"metadata": {
"name": "Load SkiaPerf Data"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@jcgregorio
jcgregorio / How_to_use.html
Last active July 17, 2023 14:44
HTML Templating using the HTML <template> element and exactly 100 lines of JS. A cleaned up version of this code is now available at https://github.com/jcgregorio/stamp/.
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
<script src="templating.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<template id=t>
<!DOCTYPE html>
<html>
<head>
<title>Tracking mouse position on canvas</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=egde,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<canvas id=traces width=500 height=500>
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 / 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 / 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 / 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",