Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Brian Michel brianmichel

🎯
Focusing
View GitHub Profile
@brianmichel
brianmichel / sparkle-marconio-test.patch
Created Feb 4, 2022
A patch for a new test to exercise the Appcast parsing behavior in Sparkle for my failing updater.
View sparkle-marconio-test.patch
diff --git a/Tests/SUAppcastTest.swift b/Tests/SUAppcastTest.swift
index a1e921db..336e959b 100644
--- a/Tests/SUAppcastTest.swift
+++ b/Tests/SUAppcastTest.swift
@@ -11,6 +11,27 @@ import Sparkle
class SUAppcastTest: XCTestCase {
+ func testBrokenAppcast() {
+ let testURL = Bundle(for: SUAppcastTest.self).url(forResource: "marconio-broken-appcast", withExtension: "xml")!
@brianmichel
brianmichel / NSExtensionContext+Loading.swift
Created Jun 5, 2021
Publisher-ify NSExtensionContext item loading
View NSExtensionContext+Loading.swift
import Combine
import Foundation
extension NSExtensionContext {
enum Errors: Error {
/// An error passed when there is no error, and no item is returned.
case unableToLoadItem
}
/**
@brianmichel
brianmichel / Birbhouse-Code-of-Conduct.md
Last active May 19, 2020
Code of Conduct for Birbhouse Slack
View Birbhouse-Code-of-Conduct.md

This code pulls greatly from the XOXO Code of Conduct https://2018.xoxofest.com/conduct

COMMUNITY CODE OF CONDUCT

This policy is a "living" document, and subject to refinement and expansion in the future. Last updated May 19th, 2020.

Everyone participating in the Birbhouse community—including, but not limited to the Slack group—is required to agree to the following Code of Conduct. This includes all members, no exceptions.

Birbhouse is dedicated to providing a harassment-free experience for everyone, regardless of gender, gender identity and expression, sexual orientation, disability, mental illness, neurotype, physical appearance, body, age, race, ethnicity, nationality, language, or religion. We do not tolerate harassment of participants in any form.

Anyone who violates this Code of Conduct may be sanctioned or expelled from the Birbhouse Slack group at the discretion of the Birbhouse admins.

View ReadApplHeader.swift
extension String {
subscript (bounds: CountableClosedRange<Int>) -> String {
let start = index(startIndex, offsetBy: bounds.lowerBound)
let end = index(startIndex, offsetBy: bounds.upperBound)
return String(self[start...end])
}
subscript (bounds: CountableRange<Int>) -> String {
let start = index(startIndex, offsetBy: bounds.lowerBound)
let end = index(startIndex, offsetBy: bounds.upperBound)
View keybase.md

Keybase proof

I hereby claim:

  • I am brianmichel on github.
  • I am brianmichel (https://keybase.io/brianmichel) on keybase.
  • I have a public key whose fingerprint is 8398 AA13 7CA6 C265 E9FA 7072 B0E0 1B54 3A70 96C5

To claim this, I am signing this object:

View swift-lint-buildphase.sh
git diff HEAD --name-only -- "Ando/*.swift" | while read filename; do
${PODS_ROOT}/SwiftLint/swiftlint lint --path "$filename";
done
@brianmichel
brianmichel / pennant.rb
Last active Sep 6, 2017
Scrape Clubhouse.io tickets from git logs.
View pennant.rb
#!/usr/bin/env ruby
require 'optparse'
options = {
repo: File.expand_path(`pwd`),
verbose: false
}
parser = OptionParser.new do |opts|
opts.banner = 'Usage: pennant.rb -p TAG_PATTERN'
@brianmichel
brianmichel / FailingCast.swift
Created Dec 15, 2016
Returned value is a string, but cannot be cast to as String
View FailingCast.swift
import Foundation
protocol KeyValueStorage {
func set(_ value: Any?, forKey key: String)
func value(forKey key: String) -> Any?
}
final class DictionaryKeyValueWrapper: KeyValueStorage {
var dictionary = [String: Any?]()
View swift-analysis.rb
#!/usr/bin/env ruby
require 'pathname'
exit 1 unless ARGV[0]
full_file_path = File.expand_path("#{ARGV[0]}")
puts "got file path: #{full_file_path}"
exit 1 unless File.extname(full_file_path) == '.xcactivitylog'
View reset.applescript
on onConfirmUninstall()
set applicationName to "Slack"
try
display dialog "Are you sure you want to reset " & applicationName & "?"
set uninstallScript to quoted form of POSIX path of (path to resource "uninstall.bash")
do shell script "bash " & uninstallScript with administrator privileges
display dialog "Successfully Reset " & applicationName buttons {"OK"} default button "OK"
on error err
if err contains "User canceled" then