Skip to content

Instantly share code, notes, and snippets.

@tatomyr
tatomyr / createImageBitmap.js
Last active July 6, 2019 11:39 — forked from MonsieurV/createImageBitmap.js
createImageBitmap polyfill with Blob and ImageData source support
/*
* Safari and Edge polyfill for createImageBitmap
* https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/createImageBitmap
*
* Support source image types Blob and ImageData.
*
* From: https://dev.to/nektro/createimagebitmap-polyfill-for-safari-and-edge-228
* Updated by Yoan Tournade <[email protected]>
* Updated by Andrew Tatomyr
*/
@tatomyr
tatomyr / transpose.js
Created May 4, 2017 09:19
One-line JavaScript array transpose
[[0, 1], [2, 3], [4, 5]].reduce((prev, item) => item.map((_, i) => [...(prev[i] || []), item[i]]), []); // [[0, 2, 4], [1, 3, 5]]