Skip to content

Instantly share code, notes, and snippets.

@Jonarod
Jonarod / reset.css
Last active February 9, 2019 20:16
CSS minimal reset
*, *::before, *::after {margin:0;padding:0;border:0;border-collapse:collapse;border-spacing:0;box-sizing:border-box;outline:none;font-size:100%;font:inherit;vertical-align:baseline;list-style:none;quotes:none;}
html {font-family: "Quicksand", "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-weight: 300;font-size: 16px;line-height:1.5;overflow-x:hidden;}
body {font-size : 1em; -webkit-font-smoothing: antialiased; overflow-x: hidden;}
img {max-width: 100%;}
fieldset, img {border:0;}
legend {color:#000;}
li {list-style:none;}
sup {vertical-align:text-top;}
sub {vertical-align:text-bottom;font-size:80%;}
table {border-collapse:collapse;border-spacing:0;}
@Jonarod
Jonarod / CSVtoJSON.js
Last active April 3, 2020 09:39
Parse CSV and convert it to JSON with ES6
function CSVToMatrix(csv,delimiter){
let matrix = [];
csv.split('\n').map( l => { l.trim() == "" ? 0 : matrix.push(l.trim().split(delimiter).map(v=>v.trim())) })
return matrix
}
function MatrixToJSON(matrix,from,to){
let jsonResult = []; from = from||0;
matrix.map((a,i) => {
let obj = Object.assign({}, ...matrix[0].map((h, index) => ({[h]: matrix[i][index]})))