Skip to content

Instantly share code, notes, and snippets.

View chbeer's full-sized avatar

Christian Beer chbeer

View GitHub Profile
@chbeer
chbeer / CatalystNSViewCellFix.swift
Created August 15, 2022 13:15
Hack for fixing a crash in Catalyst when using UIDocumentBrowserViewController
// This uses https://github.com/steipete/InterposeKit.git
// I added this code to func application(_, didFinishLaunchingWithOptions:) -> Bool
if let clazz = NSClassFromString("NSTouchBarView") {
do {
let _ = try Interpose(clazz) {
try $0.hook("layout",
methodSignature: (@convention(c) (AnyObject, Selector) -> Void).self,
hookSignature: (@convention(block) (AnyObject) -> Void).self) {
store in { `self` in }
@chbeer
chbeer / templates.json
Last active June 21, 2021 18:32
Templates list
[
{
"title": "Template 1",
"fileName": "template1"
},
{
"title": "Template 2",
"fileName": "template2"
}
]
@chbeer
chbeer / KiCAD2JLCPCB.md
Created May 7, 2021 06:43
KiCAD to JLCPCB SMD

Schema

  • Add "LCSC" Field in Schematic containing SMD Part Number "C...."
  • Generate BOM: Tools -> Generate Bill of Materials (any plugin will work)

PCB

  • Generate POS: File -> Fabrication Outputs -> Footprint Position (.pos) File’.
    • CSV format, mm unit, ‘single file for board’
  • Plot Gerbers: File -> Plot
  • All copper layers, front mask, back mask, front silk, back silk, Edge.Cuts
@chbeer
chbeer / AppDelegate.swift
Created September 12, 2020 15:44
Prevent PDFView from stealing first responder when setting document
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
SwizzlePDFDocumentView()
...
}
@chbeer
chbeer / ExportOptions.plist
Created September 10, 2020 12:41
Shell script to deploy to AppStoreConnect
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>app-store</string>
<key>teamID</key>
<string>YOUR_TEAM_ID</string>
<key>destination</key>
<string>upload</string>
@chbeer
chbeer / MSLogger set Logging.m
Last active April 22, 2020 06:35
Set logging of MS AppCenter
@interface MSLogger ()
+ (void)setCurrentLogLevel:(MSLogLevel)currentLogLevel;
@end
[MSLogger setCurrentLogLevel:MSLogLevelVerbose];
@chbeer
chbeer / gist:3666e4b7b2e71eb47b15eaae63d4192f
Last active September 13, 2023 01:02 — forked from odrobnik/gist:e8ac59e13b62ea80b623
Calling AppleScript from Swift App, passing a parameter. Swift 3 version.
// updated for Swift 3
import Carbon
// Swift version of https://developer.apple.com/library/mac/technotes/tn2084/_index.html
@IBAction func testButtonPushed(sender: AnyObject) {
guard let url = NSBundle.main.url(forResource: "SendFinderMessage", withExtension: "scpt") else {
return
}
@chbeer
chbeer / Dev Links.md
Last active August 29, 2015 14:14
Developer Links
@chbeer
chbeer / gist:0d02b09b3b127bf4915c
Created January 23, 2015 21:14
Crash with "Show Detail" Segue
(lldb) bt
* thread #1: tid = 0x6b9a, 0x00000001974c00a8 libobjc.A.dylib`objc_exception_throw, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x00000001974c00a8 libobjc.A.dylib`objc_exception_throw
frame #1: 0x0000000186c53290 CoreFoundation`-[__NSArrayM insertObject:atIndex:] + 844
frame #2: 0x000000018b5b7ad0 UIKit`-[UINavigationBar pushNavigationItem:] + 268
frame #3: 0x000000018b5b78bc UIKit`-[UINavigationBar _pushNavigationItem:transition:] + 392
frame #4: 0x000000018b7fa334 UIKit`-[UINavigationBar _addItem:withEffectiveDelegate:transition:] + 152
frame #5: 0x000000018b839bfc UIKit`-[UIViewController _appendNavigationItemsToNavigationController:transition:] + 456
frame #6: 0x000000018b5b7340 UIKit`__71-[UINavigationController pushViewController:transition:forceImmediate:]_block_invoke + 292
frame #7: 0x000000018b5d114c UIKit`-[UINavigationController _startDeferredTransitionIfNeeded:] + 980
@chbeer
chbeer / gist:a59b655b25962dccfe02
Last active August 29, 2015 14:08
Examining Avea via gatttool

Find Avea

pi@raspberrypi ~ $ sudo hcitool lescan
LE Scan ...
…
B4:99:4C:49:4D:7B Avea_7B4D
…