Skip to content

Instantly share code, notes, and snippets.

View jordanekay's full-sized avatar
🟢
Currently available for new projects

Jordan Kay jordanekay

🟢
Currently available for new projects
View GitHub Profile
enum COVID {}
extension COVID {
struct Conditions {
let caseCount: Int
let hospitalizationCount: Int
let caseIncrease: Float
}
public struct Response {

This is not any kind of formal academic gloss on one of the most contested and considered terms in contemporary political history, neoliberal. I’m not qualified to write one of those. This is an attempt to convey what a lot of people mean when they use the term “neoliberal” in the context of 21st century progressive politics and what it meant in the recent past. This is a scribbling about my perception of how a contested term rose and fell and changed over time. I will leave the meaning of neoliberalism to others. But “neoliberalism” meant something in left-of-center political debates ten or fifteen years ago, and it was used like a comma, and now it means something different or less and I think about it a lot.

Traditionally neoliberalism had much more to do with conservatism than liberalism. It was Ronald Reagan and Margaret Thatcher who brought us a neoliberal revolution in the 1970s and 80s, after all. But you can read history books about that. In 2021 “neoliberal” as a pejorative tends to mean those who

@jordanekay
jordanekay / RoundRect.swift
Last active October 7, 2015 17:01
Replacement implementation of round-rect UIBezierPaths
import Darwin
private typealias Point = (x: CGFloat, y: CGFloat)
private typealias Points = (Point, Point?)
extension UIBezierPath {
public convenience init(rect: CGRect, cornerRadius radius: CGFloat, roundedCorners: UIRectCorner = .AllCorners) {
self.init()
let path = Path(rect: rect, radius: radius, roundedCorners: roundedCorners)
drawPath(path)
@jordanekay
jordanekay / MonolithViewController.swift
Last active September 12, 2015 04:02 — forked from asmallteapot/MonolithViewController.swift
Handling storyboard segues with enumerations in Swift
class MonolithViewController: UIViewController {
enum InnerSegueType {
case WebView
case Inspector
init?(segue: UIStoryboardSegue) {
if segue.identifier == "WebView" {
self = .WebView
} else if segue.identifier == "Inspector" {
self = .Inspector
@jordanekay
jordanekay / Dictionary.swift
Last active February 11, 2021 16:01
Mapping dictionaries in Swift
extension Dictionary {
public func map<T: Hashable, U>(@noescape transform: (Key, Value) -> (T, U)) -> [T: U] {
var result: [T: U] = [:]
for (key, value) in self {
let (transformedKey, transformedValue) = transform(key, value)
result[transformedKey] = transformedValue
}
return result
}
@jordanekay
jordanekay / Bigrams.swift
Last active August 29, 2015 14:14
Finding bigrams in text
func bigrams(text: String) -> [(String, String)] {
let words = split(text) { $0 == " " }
return Array(Zip2(words, words[1..<words.count]))
}
1> println(bigrams("one two three four five"))
[(one, two), (two, three), (three, four), (four, five)]
struct User {
let id: Int
let name: String
let email: String?
}
extension User: JSONDecodable {
static func create(id: Int, name: String, email: String?) -> User {
return User(id: id, name: name, email: email)
}
@jordanekay
jordanekay / gist:8855193
Created February 7, 2014 00:15
Debug -[UIScrollView setContentOffset:animated:] by changing duration
NSTimeInterval duration = 3.0;
SEL selector = @selector(_setContentOffsetAnimationDuration:);
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[scrollView methodSignatureForSelector:selector]];
[invocation setSelector:selector];
[invocation setTarget:scrollView];
[invocation setArgument:&duration atIndex:2];
[invocation invoke];
[scrollView setContentOffset:contentOffset animated:YES]
@implementation NSString (JSRemoveIrrelevantTags)
- (NSString *)js_stringByRemovingIrrelevantTags
{
NSMutableString *filteredString = [NSMutableString string];
NSSet *filteredLinguisticTags = [NSSet setWithArray:@[NSLinguisticTagDeterminer, NSLinguisticTagPreposition]];
[self enumerateLinguisticTagsInRange:NSMakeRange(0, self.length)
scheme:NSLinguisticTagSchemeLexicalClass
@jordanekay
jordanekay / gist:5703459
Last active December 18, 2015 01:19
Naturally sorting a list of titles in Cocoa
#import <Foundation/Foundation.h>
@implementation NSString (JEKNormalization)
- (NSString *)jek_normalizedString
{
__block NSString *normalizedString = self;
[self enumerateLinguisticTagsInRange:NSMakeRange(0, self.length) scheme:NSLinguisticTagSchemeLexicalClass options:~NSLinguisticTaggerOmitWords orthography:nil usingBlock:^(NSString *tag, NSRange tokenRange, NSRange sentenceRange, BOOL *stop) {
if (tag == NSLinguisticTagDeterminer && tokenRange.location == 0) {
normalizedString = [self substringFromIndex:tokenRange.length + 1];