Skip to content

Instantly share code, notes, and snippets.

View YuriBrunetto's full-sized avatar
🎩

Yuri Brunetto YuriBrunetto

🎩
View GitHub Profile
@YuriBrunetto
YuriBrunetto / chunks-array.js
Created February 2, 2018 10:51
Array into chunks
const myArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
const chunkSize = 4
const chunks = myArray.reduce((ar, it, i) => {
const ix = Math.floor(i / chunkSize)
if (!ar[ix]) ar[ix] = []
ar[ix].push(it)
return ar
@YuriBrunetto
YuriBrunetto / es.js
Created September 20, 2016 17:31
ES6 shortcut - Get elements like jQuery
const $ = document.querySelector.bind(document)
// id
let divs = [
$("#div"),
$("#input")
]
// class
let other = [