This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"globals": { | |
"afterAll": false, | |
"afterEach": false, | |
"beforeAll": false, | |
"beforeEach": false, | |
"describe": false, | |
"expect": false, | |
"fit": false, | |
"it": false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://vega.github.io/schema/vega/v4.json", | |
"width": 500, | |
"height": 200, | |
"padding": 5, | |
"signals": [ | |
{ | |
"name": "interpolate", | |
"value": "linear", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 | |
height: 960 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage: | |
// let ctx = canvas.getContext("2d"); | |
// let data = desaturate(0.5, ctx, canvas.width, canvas.height); | |
// ctx.putImageData(data); | |
function desaturate (amount, ctx, w, h) { | |
let imgData = ctx.getImageData(0, 0, w, h), | |
x, y, i, | |
grey; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
NewerOlder