Skip to content

Instantly share code, notes, and snippets.

View willdavidow's full-sized avatar

Will Davidow willdavidow

View GitHub Profile
@willdavidow
willdavidow / csv-to-json.js
Created April 23, 2019 00:51 — forked from jssuttles/csv-to-json.js
CSV to JSON Conversion in JavaScript
//var csv is the CSV contents with headers
function csvJSON(csv){
var lines=csv.split('\n');
var result = [];
var headers=lines[0].split(',');
lines.splice(0, 1);
lines.forEach(function(line) {
@willdavidow
willdavidow / in_viewport.js
Created September 28, 2017 14:16 — forked from jjmu15/in_viewport.js
check if element is in viewport - vanilla JS. Use by adding a “scroll” event listener to the window and then calling isInViewport().
// Determine if an element is in the visible viewport
function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
@willdavidow
willdavidow / smacss.txt
Created January 12, 2016 02:45 — forked from chipcullen/smacss.txt
SMACSS Property Order for SCSS Lint
# SMACSS Property Order
# http://smacss.com/book/formatting
# Box
display
position
top
right
bottom