Skip to content

Instantly share code, notes, and snippets.

View casconed's full-sized avatar
🎅
F E S T I V E

Jason Moore casconed

🎅
F E S T I V E
View GitHub Profile
@kyleshevlin
kyleshevlin / memoizedHandlers.js
Created January 22, 2021 00:26
Using React.useMemo to create a `handlers` object
// One of my new favorite React Hook patternms is to create handler
// functions for a custom hook using `React.useMemo` instead of
// `React.useCallback`, like so:
function useBool(initialState = false) {
const [state, setState] = React.useState(initialState)
// Instead of individual React.useCallbacks gathered into an object
// Let's memoize the whole object. Then, we can destructure the
// methods we need in our consuming component.
@tad-iizuka
tad-iizuka / ViewController.swift
Last active November 7, 2022 16:43
Photo Capture Sample Swift 4 + iOS 11
//
// ViewController.swift
// PhotoCaptureSample
//
// Created by Tadashi on 2017/09/23.
// Copyright © 2017 UBUNIFU Incorporated. All rights reserved.
//
import UIKit
import AVFoundation
import Photos