Skip to content

Instantly share code, notes, and snippets.

// Based on Brian Grinstead's console.save()
// http://bgrins.github.io/devtools-snippets/#console-save
(function(console){
console.saveCsv = function(data, filename){
if(!data) {
console.error('Console.saveCsv: No data')
return;
@ericsoco
ericsoco / eslint-config.json
Created September 5, 2019 19:11
Generated via `eslint --print-config file-causing-lint-crash.js`
{
"globals": {
"afterAll": false,
"afterEach": false,
"beforeAll": false,
"beforeEach": false,
"describe": false,
"expect": false,
"fit": false,
"it": false,
@ericsoco
ericsoco / .block
Last active November 22, 2018 19:53
cluster force
license: mit
@ericsoco
ericsoco / README.md
Last active November 22, 2018 19:52
d3-force-cluster I

Example illustrating the use d3-force-cluster.

@ericsoco
ericsoco / multi-series.json
Created October 10, 2018 19:46
Vega: Multi-series line chart w/ tooltips
// The spec below creates a dataset, `tooltip_0_0`,
// that contains pivoted values for each groupby.
// These key:value pairs can be fed into a tooltip implementation
// to display the value of each line at each timestep.
{
"$schema": "https://vega.github.io/schema/vega/v4.0.json",
"description": "",
"width": 800,
"height": 600,
@ericsoco
ericsoco / gist:72538faae3587fe117c5f094248bb79c
Created August 24, 2018 05:38
Immutable splice (Javascript / ES6)
const merge = (arr, val, i) => [
...arr.slice(0, i),
val,
...arr.slice(i + 1)
];
const arr1 = ['a', 'b'];
console.log(merge(arr1, 'foo', 1));
console.log(merge(arr1, 'foo', 0));
console.log(merge(arr1, 'foo', 2));
@ericsoco
ericsoco / gist:91d1833600bbec99725809a3762ffb0a
Created August 2, 2018 22:48
exploring multiple y-axis series in Vega
{
"$schema": "https://vega.github.io/schema/vega/v4.json",
"width": 500,
"height": 200,
"padding": 5,
"signals": [
{
"name": "interpolate",
"value": "linear",
@ericsoco
ericsoco / .block
Last active September 6, 2017 22:34
contour blob
license: mit
@ericsoco
ericsoco / .block
Last active August 30, 2017 04:01
contour blob
license: mit
@ericsoco
ericsoco / README.md
Created November 6, 2015 21:14
Wrapping Long Labels 2.0