Skip to content

Instantly share code, notes, and snippets.

View jbrennan's full-sized avatar
😅
bestie please let me merge

Jason Brennan jbrennan

😅
bestie please let me merge
View GitHub Profile
@jbrennan
jbrennan / wwdc2014
Created July 16, 2019 15:00 — forked from phnessu4/wwdc2014
wwdc 2014 sessions and pdf
pdf
http://devstreaming.apple.com/videos/wwdc/2014/102xxw2o82y78a4/102/102_platforms_state_of_the_union.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/201xx2xfazhzce8/201/201_advanced_topics_in_internationalization.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/202xx3ane09vxdz/202/202_whats_new_in_cocoa_touch.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/203xxh9oqtm0piw/203/203_introducing_healthkit.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/204xxhe1lli87dm/204/204_whats_new_in_cocoa.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/205xxqzduadzo14/205/205_creating_extensions_for_ios_and_os_x,_part_1.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/206xxdiurnffagr/206/206_introducing_the_modern_webkit_api.pdf?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/207xx270npvffao/207/207_accessibility_on_os_x.pdf?dl=1
@jbrennan
jbrennan / ViewController.swift
Created August 31, 2018 20:11
Simple file for converting Localizable.strings key=values back into a codebase
class ViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
let translations = translationsFor(stringsFilePath: "/Users/jasonbrennan/peloton/Argon/Argon/Supporting Files/Localizable.strings")
for translation in translations {
replace(translation: translation, inProjectDirectory: "/Users/jasonbrennan/peloton/Argon/Argon")
}
@jbrennan
jbrennan / LineScaling.swift
Created August 3, 2016 23:13
The math behind a “drag to scale this line” operation.
extension Line {
/** Returns a scaled line according to the projection of `scalingPoint` onto the receiver.
- parameter scalingPoint: A point interpreted as a vector used for scaling this line. This point should be something like the location of a touch or cursor during a "drag to scale" operation, but the point doesn't have to lie along the line itself. The point **must** be in the same coordinate space as the line.
*/
func lineByScalingToTouchPoint(scalingPoint: Point) -> Line {
// This algorithm works by
// - treating the incoming point as a vector,

Hello Everyone,

The Swift 3 release is nearing completion, so it is time to look back on the release, learn from what happened, and use it to shape what we (the Swift community) do in the year ahead. Overall, Swift 3 is going to be an absolutely amazing release, and it is impressive how much got done. Thank you to everyone who contributed to making it happen. Instead of diving into a flurry of new proposals immediately, it is important to take stock of where we are, and look at the bigger picture.

Metapoint: this email is ridiculously long and covers multiple topics. Instead of replying to it directly, it is best to start new threads on individual topics that you’d like to discuss. Just tag them with “[Swift 4]” in the subject line.

Swift 3 Retrospective

Every year of Swift’s development has been completely different from the previous one, and I expect Swift 4 to continue this trend. With a goal of learning and improving year over year, here are some observations & retrospective about Swi

@jbrennan
jbrennan / nearthespeedoflight-2016.css
Created April 3, 2016 03:20
Style for Nearthespeedoflight.com April 2 2016
/* ============================== */
/* ! */
/* ! Speed of Light style ver 3 */
/* ! Copyright 2016 Jason Brennan */
/* ! */
/* ! April 2 2016 */
/* ! */
/* ============================== */
@jbrennan
jbrennan / nearthespeedoflight.css
Created April 3, 2016 01:42
Style for Nearthespeedoflight.com from Feb 2013 to April 2016
/* ============================== */
/* ! */
/* ! Speed of Light style ver 2.6 */
/* ! Copyright 2011 Jason Brennan */
/* ! */
/* ! February 20 2013 */
/* ! */
/* ============================== */
@jbrennan
jbrennan / PrototopeViewController.swift
Created March 15, 2016 02:01
Example of using setting up Prototope in a UIViewController
//
// ViewController.swift
// DrawingProto
//
// Created by Jason Brennan on 2015-12-19.
// Copyright © 2015 Jason Brennan. All rights reserved.
//
import UIKit
import Prototope
@jbrennan
jbrennan / ImmediatePanGestureRecognizer.m
Created December 29, 2015 22:42
A UIPanGestureRecognizer subclass to recognize immediately. Is this a good idea?
@implementation ImmediatePanGestureRecognizer
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[super touchesBegan:touches withEvent:event];
if (self.numberOfTouches >= self.minimumNumberOfTouches) {
self.state = UIGestureRecognizerStateBegan;
}
}
@jbrennan
jbrennan / signals.md
Created November 16, 2015 21:02
Some notes on getting help with Reactive Cocoa Signals with help from a coworker

Notes about Signals

Nacho offered me a little bit of help today with a relatively simple problem. Here are some notes on it for future reference.

The problem

I have a container view which has in it a TabBarView and a ScrollView. When one of the tabs in the tab bar view is tapped, I want it to update its internal state (which button is selected) and then I need the container view to be able to respond as well (to scroll its scrollview).

@jbrennan
jbrennan / Bug.swift
Created July 16, 2015 14:03
Bug related to having an optional enum in a struct in Swift
import Foundation
public struct FeaturedItem {
public enum ImageSource {
case Bundled(name: String) // simplified enum with one case to illustrate the bug.
}
public let localizedTitleImageSource: ImageSource? // This optional causes Swift to barf. If it's non-optional, it compiles fine
// Workaround in this case is to just use an optional String instead of the enum.
}