Skip to content

Instantly share code, notes, and snippets.

View benasher44's full-sized avatar

Ben Asher benasher44

View GitHub Profile
@benasher44
benasher44 / pip_install_karta_without_numpy.out
Created September 7, 2015 23:36
Output after running ```pip install cython``` followed by ```pip install --no-cache-dir -e git+https://github.com/njwilson23/karta@numpyless-install#egg=karta-dev```
Obtaining karta from git+https://github.com/njwilson23/karta@numpyless-install#egg=karta-dev
Cloning https://github.com/njwilson23/karta (to numpyless-install) to /Users/benasher/Code/Python/venvs/karta_test/src/karta
Collecting numpy>=1.6 (from karta)
Downloading numpy-1.9.2-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.7MB)
100% |████████████████████████████████| 3.7MB 12.1MB/s
Collecting pyproj>=1.9 (from karta)
Downloading pyproj-1.9.4.tar.gz (7.8MB)
100% |████████████████████████████████| 7.8MB 9.7MB/s
Collecting pyshp>=1.2 (from karta)
Downloading pyshp-1.2.3.tar.gz
cython>=0.2
karta>=0.4.4
@benasher44
benasher44 / kif_xcode7.3_fix.diff
Created March 23, 2016 20:19
Proposed fix for XCTest-KIF class loading issues
diff --git a/Classes/KIFAccessibilityEnabler.m b/Classes/KIFAccessibilityEnabler.m
index afac189..a501c5b 100644
--- a/Classes/KIFAccessibilityEnabler.m
+++ b/Classes/KIFAccessibilityEnabler.m
@@ -41,12 +41,7 @@
+ (void)load
{
@autoreleasepool {
- if ([XCTestObservationCenter respondsToSelector:@selector(sharedTestObservationCenter)]) {
- XCTestObservationCenter *observationCenter = [XCTestObservationCenter sharedTestObservationCenter];
@benasher44
benasher44 / gist:e49e5e5d15442d4abb676e5bc79683bf
Created May 6, 2016 15:16
==, != for SequenceType and Dictionary with SequenceType values
func ==<S: SequenceType where S.Generator.Element: Equatable>(lhs: S, rhs: S) -> Bool {
var lgen = lhs.generate()
var rgen = rhs.generate()
while true {
let lelem = lgen.next()
let relem = rgen.next()
if let lelem = lelem, relem = relem {
if lelem != relem {
// elements aren't equal
return false
@benasher44
benasher44 / keybase.md
Created January 15, 2017 23:13
benasher44 Keybase Verification

Keybase proof

I hereby claim:

  • I am benasher44 on github.
  • I am benasher44 (https://keybase.io/benasher44) on keybase.
  • I have a public key ASAfZYP_CcVdIjs7IbUG4_rD4NRrujFTIeQ1RbPxVLjdbQo

To claim this, I am signing this object:

@benasher44
benasher44 / todo.py
Created March 18, 2017 04:21
todo.py - produce warnings from TODOs created by the current user
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import os
import re
from contextlib import closing
from itertools import chain
@benasher44
benasher44 / gist:52c3a234c8a98948cdb24c8adbca522d
Created March 27, 2017 21:29
ReactiveCocoa 5.1.0 Swift 3.1 Crash Trace
l-value expression does not have l-value access kind set
(member_ref_expr type='@lvalue UISearchBarDelegate?' location=/<redacted>/Pods/ReactiveCocoa/ReactiveCocoa/UIKit/iOS/UISearchBar.swift:18:48 range=[/<redacted>/Pods/ReactiveCocoa/ReactiveCocoa/UIKit/iOS/UISearchBar.swift:18:43 - line:18:48] decl=UIKit.(file).UISearchBar.delegate
(archetype_to_super_expr implicit type='UISearchBar' location=/<redacted>/Pods/ReactiveCocoa/ReactiveCocoa/UIKit/iOS/UISearchBar.swift:18:43 range=[/<redacted>/Pods/ReactiveCocoa/ReactiveCocoa/UIKit/iOS/UISearchBar.swift:18:43 - line:18:43]
(member_ref_expr type='Base' location=/<redacted>/Pods/ReactiveCocoa/ReactiveCocoa/UIKit/iOS/UISearchBar.swift:18:43 range=[/<redacted>/Pods/ReactiveCocoa/ReactiveCocoa/UIKit/iOS/UISearchBar.swift:18:43 - line:18:43] decl=ReactiveSwift.(file).Reactive.base [with Base] direct_to_storage
(declref_expr implicit type='Reactive<Base>' location=/<redacted>/Pods/ReactiveCocoa/ReactiveCocoa/UIKit/iOS/UISearchBar.swift:18:43 range=[/<redac
@benasher44
benasher44 / PlanLibUUID.swift
Last active May 2, 2018 19:00
Fast Swift implementation of UUID(uuidString:)
import Foundation
extension UUID {
/// Ranges within a UUID string that contain non-hyphen characters
private static let charRanges = [
(0..<8),
(9..<13),
(14..<18),
(19..<23),
@benasher44
benasher44 / JSONObjectDecoder.swift
Last active October 22, 2020 13:48
JSONObjectDecoder
//
// Created by Ben Asher on 12/18/17.
// Copyright © 2017-present PlanGrid. All rights reserved.
//
import Foundation
/// A JSON decoder for decoding a Foundation-typed JSON object generated by `JSONSerialization`
/// into concrete swift `Decodable` types
public final class JSONObjectDecoder {
@benasher44
benasher44 / Swift42Compatibility.swift
Last active March 3, 2019 23:03
Swift 4.2 Compatibility Shims
//
// Created by Ben Asher on 6/13/18.
// Copyright © 2018-present PlanGrid. All rights reserved.
//
import Foundation
import MapKit
import UserNotifications
#if swift(>=4.2)