Skip to content

Instantly share code, notes, and snippets.

View j-j-m's full-sized avatar
🔮
Pondering my orb

Jacob Martin j-j-m

🔮
Pondering my orb
View GitHub Profile
@Miiha
Miiha / Interface.swift
Last active July 14, 2021 06:25
UNUserNotificationCenter modelled with simple data types using pointfree.co's approach of designing dependencies.
import Foundation
import UserNotifications
import Combine
import CoreLocation
public struct UserNotificationClient {
public var add: (UNNotificationRequest) -> AnyPublisher<Void, Error>
public var getAuthStatus: () -> AnyPublisher<UNAuthorizationStatus, Never>
public var getDeliveredNotifications: () -> AnyPublisher<[Notification], Never>
public var getNotificationCategories: () -> AnyPublisher<Set<UNNotificationCategory>, Never>
/// Translation of [Peter Norvig's spell checker](http://norvig.com/spell-correct.html) into Swift 3.
/// Sample input corpus [here](http://norvig.com/big.txt)
/// Swift 2 version: https://gist.github.com/airspeedswift/6d8c9d95f0d812f58be3
import Foundation // purely for IO, most things done with Swift.String
/// Given a word, produce a set of possible alternatives with
/// letters transposed, deleted, replaced or rogue characters inserted
func edits(word: String) -> Set<String> {
if word.isEmpty { return [] }
@eoghain
eoghain / CustomInteractiveAnimationNavigationController.swift
Last active September 21, 2023 07:33
UINavigationController that implements swipe to push/pop in an interactive animation. Just implement the InteractiveNavigation protocol on your ViewControllers you add to the nav stack to get custom transitions. Or implement a single animation and return it instead of the nil's in the UIViewControllerTransitioningDelegate and all transitions wil…
import UIKit
protocol InteractiveNavigation {
var presentAnimation: UIViewControllerAnimatedTransitioning? { get }
var dismissAnimation: UIViewControllerAnimatedTransitioning? { get }
func showNext()
}
enum SwipeDirection: CGFloat, CustomStringConvertible {
@paul-delange
paul-delange / GIFDownloader.h
Created November 18, 2012 09:10
Convert remote GIF into something MPMoviePlayerController can use
//
// GIFDownloader.h
// TheJoysOfCode
//
// Created by Bob on 29/10/12.
// Copyright (c) 2012 Tall Developments. All rights reserved.
//
#import <Foundation/Foundation.h>