Skip to content

Instantly share code, notes, and snippets.

@dcollien
dcollien / ImageTools.es6
Last active April 28, 2023 09:00
Resize Images in the Browser
let hasBlobConstructor = typeof(Blob) !== 'undefined' && (function () {
try {
return Boolean(new Blob());
} catch (e) {
return false;
}
}());
let hasArrayBufferViewSupport = hasBlobConstructor && typeof(Uint8Array) !== 'undefined' && (function () {
try {
@leighhalliday
leighhalliday / context.jsx
Created February 19, 2020 13:42
React Context Rendering Demo
import React from "react";
const MyContext = React.createContext();
const MyProvider = ({ children }) => {
const [theme, setTheme] = React.useState("light");
const nextTheme = theme === "light" ? "dark" : "light";
const value = {
theme,