Skip to content

Instantly share code, notes, and snippets.


Guilherme Rambo insidegui

View GitHub Profile
insidegui / ScrollViewOffsetModifier.swift
Created Jul 20, 2021
A SwiftUI ViewModifier that can be used to read a ScrollView's offset and store it into a @State property of the view
View ScrollViewOffsetModifier.swift
struct ScrollViewOffsetPreferenceKey: PreferenceKey {
static var defaultValue: CGPoint = .zero
static func reduce(value: inout CGPoint, nextValue: () -> CGPoint) {
value = nextValue()
print("value = \(value)")
typealias Value = CGPoint
insidegui /
Created Mar 16, 2021
Alias called "statusbarfix" which will update the status bar on any iOS Simulator that's currently running to look better for marketing images
alias statusbarfix='xcrun simctl status_bar booted override --time 9:41 --cellularMode active --cellularBars 4 --batteryState charging --operatorName ""'
View CoreDataAdapter.swift
import UIKit
import Combine
import CoreData
import OSLog
public typealias CoreDataModelTransformer<T: NSManagedObject, M: Hashable> = (T) -> M?
public final class CoreDataAdapter<T: NSManagedObject, M: Hashable>: NSObject, NSFetchedResultsControllerDelegate {
private let logger = Logger(subsystem: "codes.rambo.CombineCoreData", category: "CoreDataAdapter")
insidegui / Data+Compression.swift
Created Jul 21, 2020
A wrapper for compression/decompression of Swift Data using Apple's Compression framework.
View Data+Compression.swift
/// Created by Gui Rambo
/// This wraps Apple's Compression framework to compress/decompress Data objects.
/// It will use Compression's modern API for iOS 13+ and its old API for older versions.
/// For more information, check out Apple's documentation:
Copyright 2020 Guilherme Rambo
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:
View ChibiPicker.swift
import UIKit
import MobileCoreServices
/// Helps with the presentation and handling of the chibi picker from ChibiStudio.
final class ChibiPicker {
static let shared = ChibiPicker()
/// This is the URL ChibiStudio will open in your app after the user has picked a chibi,
/// make sure it is properly configured in your app's Info.plist and that you have added
View ShortcutsEntitlements.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
View UIKitCore.h
This file has been truncated, but you can view the full file.
// Generated by class-dump 3.5 (64 bit).
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
#pragma mark Blocks
typedef void (^CDUnknownBlockType)(void); // return type and parameters are unknown
insidegui / gist:a18124c0c573a4eb656f5c485ea7dae4
Last active Sep 19, 2021
Unofficial documentation for the iCloud Apple device image URL format
View gist:a18124c0c573a4eb656f5c485ea7dae4,4-2-3-0/online-infobox__3x.png
A: deviceImages version seems to determine the format of the image specifier (C, D, E, F)
B: device marketing name
C: device model identifier
D: color cover glass (front color)
1 - Black
2 - White
E: device enclosure color (back color)
insidegui / iBridge2_1_devtree.txt
Created Mar 10, 2018
iBridge 2,1 device tree
View iBridge2_1_devtree.txt
Device Tree with 19 properties and 10 children
| +--name 12 bytes: device-tree
| +--target-type 5 bytes: J137
| +--mlb-serial-number 29 bytes: syscfg/MLB#/0x20,zeroes/0x20
| +--compatible 27 bytes: J137AP
| +--secure-root-prefix 3 bytes: md
| +--AAPL,phandle 4 bytes: 1
insidegui / PwnageVerifier.swift
Last active Sep 30, 2018
Uses the pwnedpasswords API to verify password integrity
View PwnageVerifier.swift
By default, this class requires to work,
you can replace the default SHA1 implementation by setting the hash property to a function
that takes a String and returns an optional String (the SHA1 hex string of the input)
/// Uses the pwnedpasswords API to verify password integrity
public final class PwnageVerifier {
/// The base URL for the pwnedpasswords service (a default is provided by the initializer)