Skip to content

Instantly share code, notes, and snippets.

ejb / .gitignore
Created May 15, 2018 — forked from starcalibre/.gitignore
Fast Interactive Canvas Scatterplot
View .gitignore
ejb / .block
Last active Jul 18, 2019
Structuring D3 code with ES6 classes
View .block
license: mit
ejb / celebrate.js
Last active May 3, 2017
Fill an element with celebratory (financial) emojis. As seen on
View celebrate.js
function celebrate(el) {
if (doesSupportEmoji() === false) {
// browser does not support emoji, provide a fallback if you like
var can = document.createElement('canvas');
var ctx = can.getContext('2d');
ejb / .block
Last active Aug 2, 2016
Structuring D3 v4 code with constructor functions
View .block
license: mit
ejb / perftest.js
Created Jun 30, 2016
Performance test: Loops versus array methods
View perftest.js
// This script should be run with Node.js
var short = generateDummy(100);
var med = generateDummy(10000);
var long = generateDummy(1000000);'Big loop:');
test(short, bigLoop);
test(med, bigLoop);
ejb / .block
Last active Nov 15, 2020
Structuring D3 code with constructor functions
View .block
license: mit
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
.chapter-illo {
width: 100%;
ejb / clickAnywhereElse.js
Created Dec 29, 2014
Tiny jQuery plugin for attaching a click event to everything except for the specified element (and its children). To use, just paste clickAnywhereElse.js into your JavaScript file.
View clickAnywhereElse.js
// Written by Elliot Bentley, inspired by
$.fn.clickAnywhereElse = function(callback) {
var className = '.'+this.attr('class').replace(/ /g,'.');
if ( !$( className ).length ) {
View m3.js
var json = '';
mapId: 'nmap',
json: json,
center_lat: 49,
center_lon: 36,
zoom: 5,
maxZoom: 7,
minZoom: 4,