Skip to content

Instantly share code, notes, and snippets.

View bermudalocket's full-sized avatar

bermudalocket bermudalocket

  • New York
  • 19:58 (UTC -04:00)
View GitHub Profile
@Galactic-Dev
Galactic-Dev / XXXRootListController.m
Created June 6, 2020 16:55
Show a custom version of Apple's native OBWelcomeController when opening a preference bundle.
/*The file that you modify is the XXXRootListController.m file in your
preference bundle directory (XXX being the three characters that you chose for your preference bundle */
//I'm interfacing all the classes you'll need here. But don't forget to change $(BUNDLE_NAME)_PRIVATE_FRAMEWORKS = Preferences to $(BUNDLE_NAME)_PRIVATE_FRAMEWORKS = Preferences OnBoardingKit
#include "XXXRootListController.h"
@interface OBButtonTray : UIView
- (void)addButton:(id)arg1;
- (void)setStackViewTopConstraint:(NSLayoutConstraint *)arg1;
- (NSLayoutConstraint *)stackViewTopConstraint;
@SpectralDragon
SpectralDragon / PreviewContextMenu.swift
Created April 8, 2020 19:22
Simple way to implement preview context menu for SwiftUI
//
// ContentView.swift
// PreviewSwiftUI
//
// Created by v.prusakov on 4/8/20.
// Copyright © 2020 v.prusakov. All rights reserved.
//
import SwiftUI
@nalexn
nalexn / CancelBag.swift
Last active November 1, 2023 06:43
Collecting AnyCancellable tokens in declarative SwiftUI fashion
// Copyright © 2019 Alexey Naumov. MIT License
import Combine
typealias CancelBag = Set<AnyCancellable>
extension CancelBag {
mutating func collect(@Builder _ cancellables: () -> [AnyCancellable]) {
formUnion(cancellables())
}
@brunogb
brunogb / SwiftUIDragDrop.swift
Last active July 1, 2020 17:44
Drag'n'Drop with SwiftUI
import SwiftUI
import PlaygroundSupport
struct MyView: View {
@State var viewOffset: CGSize = .zero {
didSet {
let newFrame = viewFrame.offsetBy(dx: self.viewOffset.width, dy: self.viewOffset.height)
self.canDrop = containerFrame.intersects(newFrame)
@sledsworth
sledsworth / NutrientModel.swift
Last active April 17, 2021 16:48
Generic Animated Progress Bar in SwiftUI
import Foundation
import UIKit
import SwiftUI
import Combine
class NutrientModel: Progressable {
var willChange = PassthroughSubject<BaseNutrient, Never>()
var id = UUID.init()
var name: String
@Vartkat
Vartkat / buildresticexcludes.sh
Last active December 23, 2023 05:29
Bash script to build a restic exclude list that mimics Apple TimeMachine exclude list
#!/bin/bash
# This script intend to mimic TimeMachine exclude list.
# As the exclude list can evolve between backups it has to be rebuilt before every backup
# Apple uses 5 types of excludes, four from the /System/Library/CoreServices/backupd.bundle/Contents/Resources/StdExclusions.plist file
# and files from applications where metadata says to not backup, these can be found usinf
# sudo mdfind "com_apple_backup_excludeItem = 'com.apple.backupd'"
SYSLOG=/usr/bin/syslog;
TEMPFILE=$1;
@Split82
Split82 / UnityShadersCheatSheet.shader
Created April 17, 2018 10:07
Unity Shaders Cheat Sheet
Shader "Name" {
Properties {
_Name ("display name", Range (min, max)) = number
_Name ("display name", Float) = number
_Name ("display name", Int) = number
_Name ("display name", Color) = (number,number,number,number)
_Name ("display name", Vector) = (number,number,number,number)
@SethCalkins
SethCalkins / LittleSnitch_Block_List.md
Last active January 5, 2023 05:17
Little Snitch Script to block Ad Servers

Here is a script to take the hosts from From http://pgl.yoyo.org/adservers/ and convert them to rules for Little Snitch.

It has options to grab the entire list or grab new entries past a certain date.

Just grab the output and copy/paste into Little Snitch.

The script is written to block access to any process, any port. You can also delete those lines and it will only block Mail. Or use the options to enter any process, port or protocol you want to block.