Skip to content

Instantly share code, notes, and snippets.

View chbeer's full-sized avatar

Christian Beer chbeer

View GitHub Profile
@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 / 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];
#pragma mark -
#pragma mark Core Data stack
/**
Returns the managed object context for the application.
If the context doesn't already exist, it is created and bound to the persistent store coordinator for the application.
*/
- (NSManagedObjectContext *)managedObjectContext {
if (managedObjectContext != nil) {
@chbeer
chbeer / releaseNotes iVocabulary 3.0.3
Last active December 28, 2015 15:39
Release Notes for iVocabulary 3.0.3 (iOS)
- fixes crash when "buy"-cell is removed more than once
- fixes crash by preventing user from "opening" downloading documents
- fixed crash by disabling add button when in magic pages
- fixes crash in multiple choice training when delaying answers
- fixes crash in language edit controller
- fixes crash when adding training mode
- fixes crash when uploading files
- fixes crash in slideshow when going past first word
- fixes crash in training mode when repeating words
- fixes some other crashes
@chbeer
chbeer / simCap_startRecording.scpt
Created November 7, 2013 11:04
AppleScript that sends keystrokes to SimCap.app to start recording of the iOS Simulator screen
-- Uses System Events' keystrokes to start a recording in SimCap.app
tell application "SimCap"
activate
delay 0.5
tell application "System Events"
tell process "SimCap"
keystroke "r" using {command down}
end tell