Skip to content

Instantly share code, notes, and snippets.

View jamiepinkham's full-sized avatar

Jamie Pinkham jamiepinkham

View GitHub Profile
//
// ScrumData.swift
// Scrumdinger
//
// Created by Jamie Pinkham on 12/15/20.
//
import SwiftUI
import Combine
//curries a 2 argument function
func curry<A, B, C>(_ f: @escaping (A, B) -> C) -> (A) -> (B) -> C {
return { x -> (B) -> C in { y -> C in
f(x, y)
}
}
}
func add(x: Int, y: Int) -> Int {
return x + y
enum MyError: Error {
case whoops
}
//Observable.create {}
let o = AnyPublisher<Int, MyError> { subscriber in
/*
onNext, but in combine you are returned a demand,
this is for controlling backpressure, which
doesn't exist in RxSwift.
protocol Action { }
protocol State {
static var initial: Self { get }
}
typealias Reducer<S: State, A: Action> = (_ state: S, _ action: A) -> S
enum AnAction: Action { }
enum AState: State {
case none
struct IntBox: CustomDebugStringConvertible {
let int: Int
init(int: Int) {
self.int = int
}
var debugDescription: String {
return "Intbox: \(self.int)"
}
}
var str = "Hello, playground"
enum Transformer<T> {
typealias Transform = NSData -> T?;
}
let data = str.dataUsingEncoding(NSUTF8StringEncoding)!
let transformer = Transformer<String>.Transform { data in return String(data: data, encoding: NSUTF8StringEncoding) }
//
// UBCoreDataStack.h
// LevelDBMigrator
//
// Created by Jamie Pinkham on 1/28/14.
// Copyright (c) 2014 Jamie Pinkham. All rights reserved.
//
#import <Foundation/Foundation.h>
#!/usr/bin/python
import sys
import os, shutil
import subprocess
import os.path
from datetime import datetime
import time
######################## Functions #########################
NSDictionary *viewsDict = NSDictionaryOfVariableBindings(_viewToAnimate);
NSLayoutConstraint *animationConstraint = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(3)-[_viewToAnimate]" options:0 metrics:nil views:viewsDict][0];
[self.containerView removeConstraint:self.leftEdgeConstraint];
[self.containerView addConstraint:animationConstraint];
[UIView animateWithDuration:0.3 animations:^{
[self.view layoutIfNeeded];
} completion:^(BOOL finished) {
;
}];
//
// JPSubscriptedCache.m
//
//
// Created by Jamie Pinkham on 5/14/13.
//
//
#import "JPSubscriptedCache.h"