Skip to content

Instantly share code, notes, and snippets.

View Pocket-titan's full-sized avatar
Need coffee

Jelmar Gerritsen Pocket-titan

Need coffee
View GitHub Profile
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHMAAAB3BAMAAADC/GLDAAAAMFBMVEUAAACqqqoAAACqqqo/Pz8AAAAuLi4TExN/f3+Li4tiYmLX19ewsLDi4uJYWFixsbGPmeHFAAAAEHRSTlMAAwIGCAULDQYLDQ0NCRcXy6bg3wAACQBJREFUeF5l0M3rLm9BwOHrvuf9mec55z75Wra41cwKF2MZYaspc1FEjERv1GLAHwVRMEoSRIvRhYS4mDBIyMWQKAQZIxhUKIySRK0eC0HCxYFq0+rbf9Dy4XCuP+Cz+MggRyvg00jY1AT0o7qBNqUew+CquiBcQIvRjgS4HxJJBzsAGW2DqjpXgMSPWaFiIpKhruT/lm94A/WUROA5ReOBihVMkWhDNiLgfsIAUx3B6eamWSQcOka0AEwoJxZOMEggMgGaNeEGLJQwQElApeiB6hMAGUDzbRcAgnMtPPk4yPg/eD6wz1wu5AmY6bl9cMZdvNAkoIcSULDovMvtAPQAkeEOEy5YIADKT3BCVQGIuNPCPxIADUFPBKcALyJMPm8gGT2IwE9QCCVcxqEZ3wGYIHjok/IAjLUlcdNgmmlE9swz2h5uuLNVvNTC/szAuJL2HeNOoiMkgA0w9ZTIGIG3aySVBUQxNEp1aEDM84ASQGaoUh9ULDZnBtuAMwo0jABafbMbMRUcmBG/CxH/TKdQjA6Q4e9WIzagwe2zCoAarht8aGn+CtDnX/E6GVQcn7N/HZ/2sJjxXjAUNwYTAQugpsEdRnfawGDNQAaYKICBC84KyP0BPWCCni05OgB2J3QobhYCtkHJFQ4hXWEQMelAW1MxtTeVC4hmMBFBCIWH5HUFCguwyKQSUCJhI9XXCewiA5Ce/JuxxxUZvoX1osX7EAAS1QTdndkCe1reCqDH/9DhpQ5oZqAQeREAdkmQ/Qh3gE7tqy7+WokfOmAD0EBnAPzyxeoGaLxu8JIrOGnBecRhMGHHsGHwsLACGQFd8KqMO5
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
*
* Add your own CSS or Less to fully customize Atom.
* If you are unfamiliar with Less, you can read more about it here:
* http://lesscss.org
*/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Pocket-titan
Pocket-titan / useImmerState.ts
Created March 17, 2021 19:53
immer + useState = useImmerState
import { useCallback, useState } from "react";
import produce, { Draft } from "immer";
function useImmerState<S = undefined>(initialState: S | (() => S)) {
const [state, _setState] = useState(initialState);
const setState = useCallback((mutateFn: (draft: Draft<S>) => S | void) => {
_setState(produce(mutateFn) as (oldState: S) => S);
}, []);
@Pocket-titan
Pocket-titan / angle.py
Created April 14, 2024 16:59
Improved 2d angle annotation for matplotlib
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Arc
from matplotlib.transforms import Bbox, IdentityTransform, TransformedBbox
class AngleAnnotation(Arc):
"""
Draws an arc between two vectors which appears circular in display space.