Skip to content

Instantly share code, notes, and snippets.

View bencmorrison's full-sized avatar

Beno Morrison bencmorrison

View GitHub Profile
@bencmorrison
bencmorrison / remove-snapd.sh
Last active July 17, 2023 01:38
Remove Snapd from Ubuntu
# Removing Snapd from Ubuntu (tested on 23.04)
# This guide assumes you want to install Flatpak and remove Snapd
################################
# Ensuring Flatpak is setup!
################################
# Ensure you have Gnome Software and Flatpak plugin installed
sudo apt install gnome-software gnome-software-plugin-flatpak
@bencmorrison
bencmorrison / Color+InterfaceStyle.swift
Last active June 9, 2023 07:17
UIKit and SwiftUI Programatic Dynamic Color
// Created by Benjamin Morrison on 1/6/2023.
import UIKit
import SwiftUI
@available(iOS 14.0, *)
extension UIColor {
/// A wrapper around the `init(dynamicProvider:)` function to make
/// setting light and dark mode colors easier.
/// - Note: Unknown modes are defaulted to `lightMode`
/// - Parameters:
@bencmorrison
bencmorrison / CustomButtonStyleWithDisabledState.swift
Last active June 10, 2023 04:09
SwiftUI ButtonStyle with Disabled State
// Created by Ben Morrison on 31/5/2023.
import SwiftUI
/// Create a custom button style that as you normally do
struct CustomButtonStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
// This is differnet as you will not apply your changes here
// We will return a view that takes the configuration instead
CustomButtonStyleView(configuration: configuration)