Skip to content

Instantly share code, notes, and snippets.

View gmp26's full-sized avatar

Mike Pearson gmp26

View GitHub Profile
@gmp26
gmp26 / AAA_tree.js
Created April 11, 2012 12:11
AAA vis test
var w = 600,
h = 300;
// colours selected from colorbrewer palette
var color = d3.scale.ordinal()
.domain(["q0-5", "q1-5", "q2-5", "q3-5", "q4-5"])
// .range(colorbrewer.RdYlBu[5].reverse());
.range(colorbrewer.YlOrRd[5]);
// .range(colorbrewer.PiYG[5].reverse());
@gmp26
gmp26 / barDiv.js
Created April 13, 2012 14:28
Stacked or grouped bars with zoom
(function() {
var n = 9, // number of layers
m = 1, // number of samples per layer
sourceData = stream_layers(n, m, 0.1);
/*
sourceData = [
[{x:0,y:9800}],
[{x:0,y:128}],
[{x:0,y:60}],
@gmp26
gmp26 / gist:6c105ad18fef37cb516f
Last active August 29, 2015 14:07
Drag2Rects.elm
import Graphics.Input as Input
import Mouse
clicked = Input.input 0
rectangle : Color -> Element
rectangle c = [rect 50 40 |> filled c] |> collage 50 50
rect1 = Input.hoverable clicked.handle (\b -> if b then 1 else 0) (rectangle red)
rect2 = Input.hoverable clicked.handle (\b -> if b then 2 else 0) (rectangle green)
import String
import Graphics.Input (Input, input)
import Graphics.Input.Field as Field
content : Input Field.Content
content = input Field.noContent
main : Signal Element
main =
lift scene content.signal
@gmp26
gmp26 / arithmagons2.elm
Created October 14, 2014 11:34
arithmagons editable
import Graphics.Input (Input, input)
import Graphics.Input.Field as Field
import Text
content : Input Field.Content
content = input Field.noContent
tf = toFloat
@gmp26
gmp26 / arithmagons1.elm
Created October 14, 2014 11:36
arithmagons masked
import Graphics.Input (Input, input)
import Graphics.Input.Field as Field
import Text
content : Input Field.Content
content = input Field.noContent
tf = toFloat
@gmp26
gmp26 / arithmagons3.elm
Last active August 29, 2015 14:07
arithmagons unmasked 3
import Graphics.Input (Input, input)
import Graphics.Input.Field as Field
import Text
content : Input Field.Content
content = input Field.noContent
tf = toFloat
@gmp26
gmp26 / StackPair.elm
Created October 26, 2014 08:00
Left and right numbered entries in a stack.
module StackPair where
import Either as E
import Either (Either (..), lefts, rights)
type Numbered a = {a | n: Int}
type Entry a = Either (Numbered a) (Numbered a)
type Entries a = [Entry a]
@gmp26
gmp26 / designer.html
Last active August 29, 2015 14:08
designer
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icon/core-icon.html">
<polymer-element name="my-element">
<template>
<style>
@gmp26
gmp26 / designer.html
Last active August 29, 2015 14:12
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">