Skip to content

Instantly share code, notes, and snippets.

View stevestreza's full-sized avatar

Steve Streza stevestreza

View GitHub Profile
@stevestreza
stevestreza / LoginViewController.swift
Created June 16, 2021 20:24
One pattern for getting rid of optionals in a xib-loaded UIViewController
import UIKit
class LoginViewController: UIViewController {
private class Controller {
let usernameField: UITextField
let passwordField: UITextField
init(usernameField: UITextField, passwordField: UITextField) {
self.usernameField = usernameField
self.passwordField = passwordField
import Combine
import Foundation
class ObservablePublisher<T, U: Error>: ObservableObject {
var result: Result<T, U>?
var value: T? {
if let result = self.result, case .success(let value) = result {
return value
}
@stevestreza
stevestreza / DispatchQueueScheduler.swift
Last active June 29, 2023 13:06
A basic implementation of a Scheduler for Combine. Probably not a great implementation. Useful only as a toy, do not ship this.
//
// DispatchQueueScheduler.swift
//
import Combine
import Foundation
// DO NOT USE THIS IN PRODUCTION
struct DispatchQueueScheduler: Scheduler {
let queue: DispatchQueue

Keybase proof

I hereby claim:

  • I am stevestreza on github.
  • I am stevestreza (https://keybase.io/stevestreza) on keybase.
  • I have a public key whose fingerprint is 5648 A161 7A0D 25D0 B713 CFC9 1C2B 41FD 1FA0 B7E6

To claim this, I am signing this object:

<?php
$solution_correct = array(
array(3,7,8,1,4,5,6,2,9),
array(1,4,9,8,6,2,7,5,3),
array(5,2,6,3,9,7,1,4,8),
array(8,3,5,9,2,1,4,7,6),
array(2,6,1,4,7,3,8,9,5),
array(7,9,4,6,5,8,3,1,2),
array(9,8,3,5,1,4,2,6,7),
array(6,1,7,2,8,9,5,3,4),
//
// Base32.swift
// Created by Steve Streza on 26.9.14.
//
import Foundation
func Base32Encode(data: NSData) -> String {
let alphabet = [ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "2", "3", "4", "5", "6", "7"]
return Base32Encode(data, alphabet)
@stevestreza
stevestreza / WeLoveFine_Contest_ToS.md
Last active August 29, 2015 14:03
Snapshot as of July 1, 2014. This is the contract you must agree to to submit to WeLoveFine's My Little Pony contest. Winners receive $250 and "consideration" to be included in their employment program. This amounts to spec work, and the ToS is preserved here should they change it. Edits were made to preserve formatting, but this was otherwise c…

Official Rules for the “The Pony Contest”

No Purchase Necessary. A Purchase will not Increase Your Chances of Winning.

Eligibility: The WeLoveFine “The Pony Contest” Promotion (the “Promotion”) is open to all professionals, student, or amateur artist/designers. Employees of WeLoveFine or other companies associated with the Promotion, as well as the immediate family (spouse, parents, siblings, and children) and household members of each such employee, are not eligible to enter. The Promotion is subject to federal, state, and local laws and regulations and is void in Puerto Rico and where prohibited.

Sponsor and Administrator: The Promotion is Sponsored by Mighty Fine, 2010 E. 15th Street, Los Angeles, California, 90021 (“WeLoveFine”). The Promotion is administered by Mighty Fine (“Administrator”).

Agreement to Official Rules: By entering the Promotion, you indicate your full and unconditional agreement to, and acceptance of, (a) these Official Rules and (b) WeLoveFine’s decisions, which are final and bi

-----BEGIN PGP MESSAGE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - https://gpgtools.org
owFUeQVUE/z3PoyNGF3SjE4FCQWR7pJuEaSVRqRHg3RLKCAtSJd0jAZFSro2QKVh
9Oj//P5ffd/fYTvs7Jxtn3ufe5/nufeTSIiFAcbMF1fXIzTNLsD8umuJoct8KRGl
paFECKYFY2BgEKooy+tgYGBLo5/yuNjod1qyh2vQ/7At1ZTkMW5//+W2F6eg38Fz
VTZ2x8DIz/n9xLyQd6n8/aanq4zdn89jbHa/3sHACMJQkZfR857fufbKYJvzTMfv
9Nu///Kr4eXmh3eM7r9EVdY3BltZ+ZlDgbJ38AReMWGRKWL7kwHCMDBbAECy1cWY
yyamxKCYoK8RPggwMVWwsOBAwqM13/m3anSkfoGBO4OlG1vlW18Gy0uFt/0/7JRX

Keybase proof

I hereby claim:

  • I am stevestreza on github.
  • I am stevestreza (https://keybase.io/stevestreza) on keybase.
  • I have a public key whose fingerprint is C5ED 06EB 9BBA AE5B DB34 77C2 C8E5 DDEF B159 2DCF

To claim this, I am signing this object:

---
BasedOnStyle: WebKit
AccessModifierOffset: -2
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: false
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false