Skip to content

Instantly share code, notes, and snippets.

View corysullivan's full-sized avatar

Cory Sullivan corysullivan

View GitHub Profile
@wilkinvr
wilkinvr / ms-outlook_actions.xml
Last active September 2, 2025 17:16
ms-outlook:// URI scheme documentation (Outlook for Android 4.2212.2)
<?xml version="1.0" encoding="utf-8"?>
<actions xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:aapt="http://schemas.android.com/aapt">
<action intentName="actions.intent.CREATE_MESSAGE">
<fulfillment urlTemplate="ms-outlook://emails/new{?to,name,body,type}">
<parameter-mapping intentParameter="message.text" required="true" urlParameter="body"/>
<parameter-mapping intentParameter="message.@type" urlParameter="type"/>
<parameter-mapping intentParameter="message.recipient.name" urlParameter="name"/>
<parameter-mapping intentParameter="message.recipient.email" urlParameter="to"/>
</fulfillment>
<fulfillment urlTemplate="ms-outlook://emails/new"/>
@vinczebalazs
vinczebalazs / SheetModalPresentationController.swift
Last active October 20, 2025 09:05
A presentation controller to use for presenting a view controller modally, which can be dismissed by a pull down gesture. The presented view controller's height is also adjustable.
import UIKit
extension UIView {
var allSubviews: [UIView] {
subviews + subviews.flatMap { $0.allSubviews }
}
func firstSubview<T: UIView>(of type: T.Type) -> T? {
allSubviews.first { $0 is T } as? T
@nevillepark
nevillepark / README.md
Last active November 19, 2025 05:24
CBC radio stream URLs

CBC Radio Stream URLs

Using these URLs, you can listen to CBC radio streams with applications like VLC or Transistor. The files are M3U playlists, so you can use them as-is, edit them to suit your tastes, or use individual URLs.

This playlist contains the .m3u8 URLs from the CBC Listen website, which uses the HLS (HTTP Live Streaming) protocol. The audio stream is broken up into multiple tiny files, which are then fed into the .m3u8 playlist file that delivers them to your computer in the right order. This should work with modern media players.

This legacy playlist uses good old-fashioned MP3 streams found on PublicRadioFan.com. It will work with older programs like Winamp that don't support HLS. I don't know how lo

@ole
ole / Atomic.swift
Created June 6, 2019 13:27
Atomic as a property wrapper
import Dispatch
import PlaygroundSupport
@propertyDelegate
struct Atomic<A> {
private var _value: A
private let queue = DispatchQueue(label: "property wrapper")
init(initialValue: A) {
_value = initialValue
@irace
irace / ConsoleLogDestination.swift
Last active September 20, 2023 08:04
Simple Swift logger
import Foundation
final class ConsoleLogDestination: LogDestination {
func log(statement: String) {
#if DEBUG
print(statement)
#endif
}
func error(error: Error) {
@groue
groue / JSONSynchronization.swift
Created September 13, 2017 14:33
GRDB JSONSynchronization
// To run this playground, select and build the GRDBOSX scheme.
//
// This sample code shows how to use GRDB to synchronize a database table
// with a JSON payload. We use as few SQL queries as possible:
//
// - Only one SELECT query.
// - One query per insert, delete, and update.
// - Useless UPDATE statements are avoided.
import Foundation
// Returns `URL?`
public enum SocketEndPoint: String {
case eventSocket = "http://nowhere.com/events"
case liveSocket = "http://nowhere.com/live"
public var url: URL? {
return URL(string: self.rawValue)
}
}
@steipete
steipete / ios-xcode-device-support.sh
Last active May 11, 2025 13:30
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/15.0 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
import Foundation
// MARK: - Protocol
public protocol Notifier {
associatedtype Notification: RawRepresentable
}
public extension Notifier where Notification.RawValue == String {
/// Given two sorted sequences (left and right), this function emits "merge steps"
/// which tell whether elements are only found on the left, on the right, or on
/// both sides.
///
/// Both sequences do not have to share the same element type. Yet elements must
/// share a common comparable *key*.
///
/// Both sequences must be sorted by this key.
///
/// Keys must be unique in both sequences.