Skip to content

Instantly share code, notes, and snippets.

View jeffijoe's full-sized avatar
:shipit:
Navigating a sea of slop

Jeff Hansen jeffijoe

:shipit:
Navigating a sea of slop
View GitHub Profile
@jeffijoe
jeffijoe / docker-nuke.sh
Created October 9, 2017 10:15
Clearing space for Docker on macOS - the Nuclear Option
# This script will completely remove the Docker virtual disk (I guess?). Relaunch Docker for Mac to rebuild it.
# Why do you need this? If you're building Node apps in Docker, eventually you might get the ´no space left on device`
# error. You can use ` docker rm $(docker ps -q -f 'status=exited'); docker rmi $(docker images -q -f "dangling=true")`
# but that only works a few times. The command below is a complete reset, and will nuke your containers and images.
rm -rf ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2
@jeffijoe
jeffijoe / ScrollManager.jsx
Last active November 1, 2023 18:51
Save and restore scroll position in React
/*
The MIT License
Copyright (c) Jeff Hansen 2018 to present.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION W
@jeffijoe
jeffijoe / GenericTypeResolver.cs
Last active October 2, 2018 20:31
JsonConverter based on type
// SkyClip
// - GenericTypeResolver.cs
// --------------------------------------------------------------------
// Author: Jeff Hansen <jeff@jeffijoe.com>
// Copyright (C) Jeff Hansen 2015. All rights reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;