Skip to content

Instantly share code, notes, and snippets.

View b3ll's full-sized avatar
💭
no u

Adam Bell b3ll

💭
no u
View GitHub Profile
@b3ll
b3ll / GottaGoFastJS.swift
Created May 14, 2016 08:59
Blazingly-Fast JSON Parser written in Swift
import Foundation
public typealias JSON = AnyObject
public func JSONWithData(data: NSData) -> JSON? {
do {
let j = try NSJSONSerialization.JSONObjectWithData(data, options: [])
return j
} catch _ {
return nil
class Person: NSObject {
@objc var name: String? {
get {
return NSUserDefaults.standardUserDefaults().objectForKey(NSStringFromSelector(#selector(Person.name))) as? String
}
set(name) {
NSUserDefaults.standardUserDefaults().setObject(name, forKey: NSStringFromSelector(#selector(Person.name)))
NSUserDefaults.standardUserDefaults().synchronize()
}
}
class UIUINavigationController: UINavigationController {
override func preferredStatusBarStyle() -> UIStatusBarStyle {
return topViewController?.preferredStatusBarStyle() ?? super.preferredStatusBarStyle()
}
}
@b3ll
b3ll / AppDelegate.m
Created July 10, 2016 05:53
Getting access to _statusBarWindow
//
// AppDelegate.m
// StatusBarWindow
//
// Created by Adam Bell on 7/9/16.
// Copyright © 2016 Adam Bell. All rights reserved.
//
#import "AppDelegate.h"
@b3ll
b3ll / ItemGenerics.swift
Last active July 22, 2016 18:15
Sadface
//: Playground - noun: a place where people can play
import UIKit
protocol Item {
var title: String? { get set }
var value: String? { get set }
}
@b3ll
b3ll / AVSpeechSynthesizerTest.swift
Created December 30, 2016 18:19
For some reason the character range in the delegate is totally messed up… unless I'm using it incorrectly?
//
// AppDelegate.swift
// AVSpeechSynthesizerTest
//
// Created by Adam Bell on 12/30/16.
// Copyright © 2016 Adam Bell. All rights reserved.
//
import AVFoundation
import UIKit
@b3ll
b3ll / UIActivityViewControllerPreheat.swift
Created February 21, 2017 09:19
UIActivityViewController is crazy slow :(
// Preheat the UIActivityViewController because it's crazy slow.
let activityViewController = UIActivityViewController(activityItems: [ UIImage(named: "Halo.jpg")! ], applicationActivities: nil)
activityViewController.view.alpha = 0.0
let fakeViewController = UIViewController()
fakeViewController.present(activityViewController, animated: false) {
activityViewController.dismiss(animated: false, completion: nil)
}
@b3ll
b3ll / gist:9cba83d5bcd40a9f0e4405a28cafef2e
Last active March 1, 2017 23:56
Dump for a bundler issue
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.8
- RUBY VERSION: 2.4.0 (2016-12-24 patchlevel 0) [x86_64-darwin16]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.4.0
- USER INSTALLATION DIRECTORY: /Users/b3ll/.gem/ruby/2.4.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/b3ll/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.4.0/etc
- RUBYGEMS PLATFORMS:
@b3ll
b3ll / CircleLine.swift
Created June 7, 2019 22:20
"unstable" Swift UI Animation in Xcode 11 b1
//
// ContentView.swift
// CircleLine
//
// Created by Adam Bell on 6/5/19.
// Copyright © 2019 Adam Bell. All rights reserved.
//
import SwiftUI
@b3ll
b3ll / UIUndoGestureRecognizerFixes.m
Last active September 8, 2020 15:44
Disables the 3-Finger Gestures in iOS 13
//
// UIUndoGestureRecognizerFixes.m
// no u
//
// Created by Adam Bell on 8/22/19.
// Copyright © 2019 Adam Bell. All rights reserved.
//
#import "UIUndoGestureRecognizerFixes.h"