Skip to content

Instantly share code, notes, and snippets.

@abierbaum
abierbaum / app.js
Created July 10, 2012 15:43
Test for line chart in d3.js
var data = [3,7,9,1,4,6,8,2,5],
w = 700,
h = 300,
max_val = d3.max(data);
// Scales
x = d3.scale.linear()
.domain([0, data.length - 1])
.range([0, w]);
y = d3.scale.linear()
@abierbaum
abierbaum / app.js
Created July 10, 2012 18:08 — forked from abierbaum/app.js
Test for data based line chart.
//
// Chart example
//
// - Shows multiple lines in one chart
// - User can see scale showing the values and the timeframe
// - Each line has separate color
// - Show legend of groups with colors
// - Support transitions to:
// - Change data shown
// - Change the items shown (keep colors for old ones)
@abierbaum
abierbaum / index.html
Created July 10, 2012 19:12 — forked from mbostock/.block
Axis Component (AB)
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.0.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.csv.js?2.0.0"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.time.js?2.0.0"></script>
<style type="text/css">
body {
font: 10px sans-serif;
@abierbaum
abierbaum / bad_browser.html
Created November 6, 2012 15:01 — forked from my8bird/gist:3959405
Chrome Frame example
<!DOCTYPE html>
<html>
<head>
<script >
// Check that we have a supported browser
(function() {
var ua = window.navigator.userAgent,
in_chrome = /chrome/i.test(ua),
in_chrome_frame = /chromeframe/i.test(ua), // Notice inChrome is true if inChromeFrame is
in_ie = /msie/i.test(ua),
@abierbaum
abierbaum / Gruntfile.js
Last active December 14, 2015 09:29
Demonstrate a potential bug in file array format dest referencing.
module.exports = function(grunt) {
// -- LOAD GRUNT PLUGINS -- //
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerMultiTask('debug_files', 'debugs files passed in',
function() {
grunt.log.writeln('Inside task: ' + this.nameArgs);
try {
@abierbaum
abierbaum / 0_reuse_code.js
Last active August 29, 2015 14:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
execve("/usr/bin/docker", ["/usr/bin/docker", "daemon", "-D", "-H", "fd://"], [/* 5 vars */]) = 0
brk(0) = 0x1826000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff1293e6000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=18948, ...}) = 0
mmap(NULL, 18948, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7ff1293e1000
close(4) = 0
open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 4
read(4, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240l\0\0\0\0\0\0"..., 832) = 832
@abierbaum
abierbaum / tslint.json
Created May 14, 2016 18:49
tslint.json file for bug report
{
"rulesDirectory": [
"node_modules/tslint-eslint-rules/dist/rules",
"node_modules/tslint-microsoft-contrib",
"node_modules/vrsource-tslint-rules/rules"
],
"rules": {
"align": [
true,
"parameters",
@abierbaum
abierbaum / machine.js
Last active August 11, 2019 20:30
Generated by XState Viz: https://xstate.js.org/viz
// Missing a reconnect
const ws_machine = Machine({
id: 'ws_machine',
initial: 'disconnected',
strict: true,
context: {
retries: 0
},
@abierbaum
abierbaum / machine.js
Created August 11, 2019 20:35
Generated by XState Viz: https://xstate.js.org/viz
// Missing a reconnect
const countdown = Machine({
id: 'count_down',
initial: 'idle',
states: {
idle: {
on: {
START: 'running'