Skip to content

Instantly share code, notes, and snippets.

View eesur's full-sized avatar

Sundar Singh eesur

View GitHub Profile
@eesur
eesur / README.md
Created November 20, 2015 15:50
eon-chart for realtime updates with PubNub

Using eon-chart for testing gauge chart for realtime updates with PubNub and C3

This uses the included PubNub library to pubnub.publish() packets to the pubnub.subscribe() call waiting inside the C3 framework.

You probably want to publish data from the back-end instead. Check out our docs for more info: http://www.pubnub.com/documentation/

@eesur
eesur / README.md
Last active November 9, 2015 18:22
d3 | lodash groupBy float numbers

Grouping an array using lodash _.groupBy.

Creates an object composed of keys generated from the results of running each element of collection through iteratee. The corresponding value of each key is an array of the elements responsible for generating the key. The iteratee is bound to thisArg and invoked with three arguments: (value, index|key, collection).

@eesur
eesur / README.md
Created November 6, 2015 15:22
d3 | keypress/keyboard events

Testing keypress events using Mousetrap, a simple library for handling keyboard shortcuts in Javascript.

Numbers 0 to 9 will render Japanese equivalent using unicode characters. To hear audio of Japanese numbers

@eesur
eesur / README.md
Last active October 22, 2015 13:49
d3 | times tables practice

Time tables practice for my youngest. I've been using playing cards (normal deck), which are fantastic and this is based of the same idea; where I still work with him and see if he beats the machine—no scoring, just fun practice.

You can filter the sets at the top, by deselecting any to be excluded. And change speed via buttons in footer.

@eesur
eesur / README.md
Created July 23, 2015 20:57
d3 | p5 canvas circles
@eesur
eesur / README.md
Created July 15, 2015 16:40
d3 | how old will we be

My youngest is always asking me, 'how old will you be when I'm x years? and by brother/sister is x years

So this sketch is for him! but it was weird doing it, actually made me pause.

Used moment.js to calculate the dates; no real need though, as they were just subtractions—but handy if I do anything more detailed with the sketch.

The nav/options are an array (caled dates in the code) that can just be added to and changed, and the rest get's worked out and displayed.

@eesur
eesur / README.md
Last active November 3, 2017 17:16
d3 | voronoi for hotspots
@eesur
eesur / README.md
Last active August 29, 2015 14:24
d3 | SGGS authors per ang

Chart on SGGS authors

This is my first draft/sketch for a chart to show authors, as they appear on each ang/page of the Sri Guru Granth Sahib. Each bar represents a page, there is a legend to filter the authors.

Issues

  • Mostly to do with the data, scraped what I could, but had to go through manually to fill in the gaps. Grouped Bhagats together(15), Bhatts(17), and Sikhs(4) otherwise would have be too many colours
  • Didn't know which shabad Guru Gobind Singh wrote

To do:

@eesur
eesur / README.md
Created June 19, 2015 13:28
d3 | legend scroll

Testing legend with scroll for an overtly long legend. Test has simple fade out of lines on click of legend item, and moves the legend on roll over of bar lines. Use the slider to increase/decrease the lines and keys in legend.

@eesur
eesur / README.md
Last active August 29, 2015 14:22
setInterval in second half of the minute

setInterval to update at random time, within the second half of the minute. e.g. to help spread server load

  • If between 30-60 seconds of current minute PASS
  • If between 0-30 seconds of current minute FAIL

If FAIL, set time-out to ensure PASS If PASS, set interval to reload every 60 seconds

*View browser console for feedback