Skip to content

Instantly share code, notes, and snippets.

View diamantidis's full-sized avatar

Ioannis Diamantidis diamantidis

View GitHub Profile
@diamantidis
diamantidis / filter.py
Created October 14, 2018 06:01
LLDB command to filter UIButtons by the label text
#!/usr/bin/python
'''
The MIT License (MIT)
Copyright (c) 2018 Ioannis Diamantidis @diamantidis
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
@diamantidis
diamantidis / javascript_download_profiles.scpt
Created November 25, 2018 08:42
OSA Javascript "script" to download provision profiles from Xcode
Application("Xcode").activate();
delay(1);
var system = Application("System Events"),
xcode = system.processes["Xcode"];
// open preferences
system.keystroke(",", { "using": "command down" });
@diamantidis
diamantidis / applescript_download_profiles.scpt
Created November 25, 2018 08:44
Applescript "script" to download provision profiles from Xcode
activate application "Xcode"
tell application "System Events"
tell process "Xcode"
keystroke "," using command down
click button "Accounts" of toolbar 0 of window 0
delay 1
repeat with account_row in rows of table 0 of scroll area 0 of window 0
select account_row
@diamantidis
diamantidis / TemplateInfo.plist
Last active June 28, 2022 12:47
A custom Xcode Template with coordinator
{
Kind = "Xcode.IDEFoundation.TextSubstitutionFileTemplateKind";
Platforms = (
"com.apple.platform.iphoneos",
);
Options = (
{
Description = "The name of the module to create";
Identifier = "productName";
Name = "New Module Name:";
@diamantidis
diamantidis / Step1_Storage.swift
Last active April 5, 2020 14:42
Code snippets for the post 'Help your user rate and review your iOS app!' (https://diamantidis.github.io/2020/04/05/app-reviews-for-iOS-apps)
import Foundation
enum StorageKey: String {
case lastVersionPromptedReview
case dayOfFirstAction
case actionCount
}
protocol Storage {
func integer(forKey key: StorageKey) -> Int
@diamantidis
diamantidis / 1_Models.swift
Created April 12, 2020 09:00
Notify users for app update on an iOS app
import Foundation
struct iTunesInfo: Decodable {
var results: [AppInfo]
}
struct AppInfo: Decodable {
var version: Version
var currentVersionReleaseDate: Date
}
@diamantidis
diamantidis / scala-ci.yml
Last active December 1, 2023 19:37
GitHub Actions for a Scala project (unit tests, code coverage, scalafmt)
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run tests
run: sbt coverage test
- name: Coverage Report
run: sbt coverageReport
- name: Upload coverage to Codecov
@diamantidis
diamantidis / ContentView.swift
Created June 21, 2020 12:59
A SwiftUI field with a UIPickerView as a keyboard
import SwiftUI
struct ContentView: View {
@State var selectedIndex: Int? = nil
let options: [String] = ["Option1", "Option2"]
var body: some View {
PickerField("Select an option", data: self.options, selectionIndex: self.$selectedIndex)
}
}
@diamantidis
diamantidis / 1_SFSymbols.scpt
Last active December 8, 2023 22:46
How to use AppleScript to generate an enum for the SF Symbols
activate application "SF Symbols"
tell application "System Events"
tell process "SF Symbols"
-- Click the “list” radio button.
click radio button 2 of radio group 1 of group 3 of toolbar 1 of window 0
tell outline 1 of scroll area 1 of splitter group 1 of window 0
select (row 1 where value of static text 1 of UI element 1 starts with "All")
on convertReservedKeywords(theText)
set keywords to {"repeat", "return", "case"}
set theNewText to theText
if keywords contains (theText as string) then
set theNewText to "`" & theText & "`"
end if
return theNewText
end convertReservedKeywords