Skip to content

Instantly share code, notes, and snippets.

Avatar

AJ Farkas ajfarkas

View GitHub Profile
@ajfarkas
ajfarkas / keybase.md
Created December 5, 2014 19:22
Identity Verification
View keybase.md

Keybase proof

I hereby claim:

  • I am ajfarkas on github.
  • I am ajfarkas (https://keybase.io/ajfarkas) on keybase.
  • I have a public key whose fingerprint is 64F2 8417 973A F3FB B17A E94E 3826 66A0 FAA3 8A08

To claim this, I am signing this object:

@ajfarkas
ajfarkas / smoothScroll.js
Created January 4, 2015 00:21
Smooth Scroll for web in Vanilla JS
View smoothScroll.js
function scrollSmooth(node, time){
var distance = node.getBoundingClientRect().top,
step = 10 * distance / time,
frames = distance / step,
i = 0,
run;
function goTo(){
window.scrollBy(0, step);
i++;
@ajfarkas
ajfarkas / defineVar.js
Created January 6, 2015 05:44
Generate variables from strings using object notation
View defineVar.js
var array = ["One", "Two", "Three"], local = {};
//for local scope
array.forEach( function(value, index){
local["number" + value] = index + 1;
});
console.log(local.numberOne) //1
console.log(local.numberTwo) //2
console.log(local.numberThree) //3
@ajfarkas
ajfarkas / hexToRGBa.js
Last active August 29, 2015 14:13
hex to RGBa conversion
View hexToRGBa.js
function hexToRGBa(hex, alpha){
var r = parseInt( hex.slice(1,3), 16 ),
g = parseInt( hex.slice(3,5), 16 ),
b = parseInt( hex.slice(5,7), 16 ),
a = alpha || 1;
return "rgba(" + r + ", " + g + ", " + b + ", " + a + ")";
}
@ajfarkas
ajfarkas / README.md
Last active August 29, 2015 14:19
Luminance Histograms for Red, Green, and Blue Hues
View README.md

Histograms of the range of luminance values for all unmixed hues of red, green, and blue.

Middle gray for our eyes is 18% gray for computer monitors (rgb(47,47,47) is L*a*b*(50.015), where L*.domain([0, 100])). The background color is the RGB value closest to L* == 50.

@ajfarkas
ajfarkas / README.md
Last active August 29, 2015 14:19
z-stacked multi-series bar chart w animation
View README.md

A 3-series histogram of red, green, and blue hue luminance distribution. The bars are z-axis sorted by height, and the graph is sortable by color, with animation.

@ajfarkas
ajfarkas / README.md
Last active August 29, 2015 14:19
Rotated x-axis labels for D3
View README.md

Geometry is fun! Rotated x-axis labels calculated by input.

@ajfarkas
ajfarkas / README.md
Last active August 29, 2015 14:19
Rotating D3 Axis Labels with Slider
View README.md

Move the slider to choose the angle of the x-axis labels.

@ajfarkas
ajfarkas / README.md
Last active August 29, 2015 14:20
Multi-Series Histogram with Blended Color
View README.md

Luminance Histogram for R, G, B Hues

This d3 histogram shows the range of luminance values (0 - 100) for all saturation levels of red, green, and blue hues, respectively. I've used opacity on a dark background to mimic proper color-mixing. D3 transitions provide smooth animation when showing and hiding individual histograms. The particularly interesting result here is that there is a much larger variety of light colors than of dark colors; if you were to choose an rgb() (or hex) color at random, bet on it being > 50 L*.

@ajfarkas
ajfarkas / 20150420-20150520_tempRange.json
Last active August 29, 2015 14:21
Small Multiples: Temperature
View 20150420-20150520_tempRange.json
[{"date":"2015-04-20","min":"26.8","max":"48.0"},{"date":"2015-04-21","min":"36.1","max":"57.2"},{"date":"2015-04-22","min":"29.3","max":"61.5"},{"date":"2015-04-23","min":"46.4","max":"48.6"},{"date":"2015-04-24","min":"28.2","max":"48.9"},{"date":"2015-04-25","min":"33.8","max":"52.5"},{"date":"2015-04-26","min":"29.3","max":"55.6"},{"date":"2015-04-27","min":"40.6","max":"57.0"},{"date":"2015-04-28","min":"41.5","max":"58.8"},{"date":"2015-04-29","min":"47.8","max":"59.4"},{"date":"2015-04-30","min":"44.8","max":"57.7"},{"date":"2015-05-01","min":"40.1","max":"63.7"},{"date":"2015-05-02","min":"30.9","max":"70.5"},{"date":"2015-05-03","min":"32.7","max":"73.6"},{"date":"2015-05-04","min":"34.5","max":"84.4"},{"date":"2015-05-05","min":"51.3","max":"74.3"},{"date":"2015-05-06","min":"34.2","max":"77.4"},{"date":"2015-05-07","min":"39.7","max":"84.2"},{"date":"2015-05-08","min":"44.8","max":"64.2"},{"date":"2015-05-09","min":"44.6","max":"70.0"},{"date":"2015-05-10","min":"46.2","max":"84.9"},{"date":"2015-0