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 / 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 / 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 / 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 / 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 / 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"
class UIUINavigationController: UINavigationController {
override func preferredStatusBarStyle() -> UIStatusBarStyle {
return topViewController?.preferredStatusBarStyle() ?? super.preferredStatusBarStyle()
}
}
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()
}
}
@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
function lols {
random_num=$RANDOM
let "random_num %= 20"
if [ $random_num -eq 0 ]; then
alias hg="say hg && /usr/local/bin/hg"
else
alias hg="/usr/local/bin/hg"
fi
}
@b3ll
b3ll / wat.swift
Created April 16, 2015 01:18
Apparently convenience initializers blow away inherited ones, even though they're named differently "
//
// wat.swift
// Stratus
//
// Created by Adam Bell on 2015-04-15.
// Copyright (c) 2015 Adam Bell. All rights reserved.
//
import Foundation