Skip to content

Instantly share code, notes, and snippets.

View blakedietz's full-sized avatar
🚲
Life's too short, go ride a bike

Blake Dietz blakedietz

🚲
Life's too short, go ride a bike
View GitHub Profile
@blakedietz
blakedietz / data.js
Created July 28, 2013 01:25
An exercise in using d3.js to replicate barcharts found in http://www.cbpp.org/cms/?fa=view&id=3927#_ftn10 with d3.js
var data = [
{
"state":"Alaska",
"percentage": -3.2
},
{
"state":"Alabama",
"percentage": -39.8
},
{
@blakedietz
blakedietz / BarChart.js
Last active December 20, 2015 21:39
Reusable Bar Charts
function BarChart()
{
// Default selector is the body
var selector = "body";
var data;
var xScale,
yScale;
var yAxis,
@blakedietz
blakedietz / data.js
Created August 10, 2013 21:33
Reusable and Configurable Pyramid Charts
var data = [
{
"state":"Alaska",
"percentage": -3.2
},
{
"state":"Alabama",
"percentage": -39.8
},
{
@blakedietz
blakedietz / index.html
Created September 17, 2013 03:46
A zoomable and pannable visualization of the cantor set.
<!DOCTYPE html>
<meta charset="utf-8">
<title>Zoom + Pan: Cantor Set</title>
<script src="http://d3js.org/d3.v2.min.js"></script>
<body>
<script src="render.js"></script>
</body>
</html>
@blakedietz
blakedietz / index.html
Created September 22, 2013 17:18
A zoomable, 5th level iteration of Sierpinski's Carpet implemented in d3.js
<!DOCTYPE html>
<meta charset="utf-8">
<title>Sierpinski Carpet</title>
<script src="http://d3js.org/d3.v2.min.js"></script>
<body>
<script src="render.js"></script>
</body>
</html>
@blakedietz
blakedietz / index.html
Last active August 29, 2015 13:57
Types of D3 Step Line Generation
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<title></title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
</head>
<body>
<script type="text/javascript">
@blakedietz
blakedietz / example.js
Last active August 29, 2015 14:15
A small example of a multi-select component.
angular.module( 'exampleApplication', [] )
.controller( 'selectionController', function( $scope )
{
$scope.selectedItems = _.range( 0, 24 )
.map( function( number )
{
return {
"name": number
}
} );
@blakedietz
blakedietz / keybase.md
Created July 3, 2015 19:56
Keybase proof

Keybase proof

I hereby claim:

  • I am blakedietz on github.
  • I am blakedietz (https://keybase.io/blakedietz) on keybase.
  • I have a public key whose fingerprint is 38A6 C552 CB19 996B DF39 E028 AC16 C83E B8F8 7DED

To claim this, I am signing this object:

@blakedietz
blakedietz / index.js
Last active August 7, 2016 22:30
A small example where an error is thrown due to importing a component that has selectors into another component.
import selectVariables from './selectors';
import React from 'react';
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
import { Tabs, Tab } from 'material-ui/Tabs';
import Foo from '../Foo';
import Bar from '../Bar';
class BazTabs extends React.Component {
constructor(props)
@blakedietz
blakedietz / impl-a.js
Created January 21, 2019 18:29
Discussing which implementations are better and why
const selectedOrderlines = Object.entries(productQuantities)
.filter(([, value]) => value !== '')
.map(([productId, qty]) => {
const quantity = Number(qty)
return {
branchQuantities: branchId !== undefined ? [{ branchId, quantity }] : undefined,
productId: Number(productId),
qty: quantity,
}
})