Skip to content

Instantly share code, notes, and snippets.

View rolandleth's full-sized avatar
🚀
Taking off

Roland Leth rolandleth

🚀
Taking off
View GitHub Profile
@rolandleth
rolandleth / LaunchBar-Theme-Arguments.txt
Created October 27, 2020 07:40 — forked from atika/LaunchBar-Theme-Arguments.txt
A non exhaustive list of LaunchBar theme arguments, extracted with grep from bundled themes, to make your custom themes.
defaultBoldFontName
defaultDimmedTextColor
defaultEmphasizedFontName
defaultFontName
defaultSelectedTextShadowColor@1x
defaultSelectedTextShadowColor@2x
defaultShadowOffset
defaultTextColor
defaultTextShadowColor
defaultTextShadowColor@2x
@rolandleth
rolandleth / UIStackViews.swift
Last active September 15, 2022 18:43
SwiftUI influences in UIKit
import UIKit
class VStack: UIStackView {
init(alignment: UIStackView.Alignment = .fill, spacing: CGFloat = 10, _ arrangedViews: UIView...) {
super.init(frame: .zero)
axis = .vertical
self.alignment = alignment
self.spacing = spacing
@rolandleth
rolandleth / updateSafeAreaForKeyboardFromNotification.swift
Created March 29, 2020 18:35 — forked from douglashill/updateSafeAreaForKeyboardFromNotification.swift
Avoid the keyboard by leveraging additionalSafeAreaInsets.
// Avoids the keyboard in a UIKit app by leveraging additionalSafeAreaInsets.
// You can put this in the root view controller so the whole app will avoid the keyboard.
// Only tested on iOS 13.3.
// Made for https://douglashill.co/reading-app/
@objc func updateSafeAreaForKeyboardFromNotification(_ notification: Notification) {
guard let endFrameInScreenCoords = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect else {
return
}
// Please consider whether the force unwrap here is safe for your own use case.
import UIKit
import PlaygroundSupport
let touchAnimationDuration: TimeInterval = 0.3
var shouldPulse = true
class Handler {
@objc
func didTouchUpInside(_ button: UIButton) {
@rolandleth
rolandleth / TwitterArchiveParser.swift
Created June 20, 2018 07:49
Extracting and converting your Twitter archive into simpler objects
// Blog post: https://rolandleth.com/extracting-and-parsing-tweets-from-your-twitter-archive
import Foundation
struct Tweet: Codable {
let text: String
let timestamp: String
}
@rolandleth
rolandleth / FullInteractiveLabel.swift
Last active September 17, 2018 09:29
Interactive label
import UIKit
import PlaygroundSupport
final class FullInteractiveLabel: UILabel {
private let dataDetector: NSDataDetector?
private var detectedResults: [NSTextCheckingResult] {
guard let text = attributedText?.string ?? self.text else { return [] }
return dataDetector?.matches(in: text, range: NSRange(location: 0, length: text.count)) ?? []

Keybase proof

I hereby claim:

  • I am rolandleth on github.
  • I am rolandleth (https://keybase.io/rolandleth) on keybase.
  • I have a public key whose fingerprint is BD89 9BE0 51C3 7C47 1B21 4C2C B2A2 A248 0058 1718

To claim this, I am signing this object: