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:6983791
Created October 14, 2013 23:08
Don't look up inexistent fonts with CTFontCreateWithName
NSDate *date = [NSDate date];
CTFontRef font = CTFontCreateWithName((__bridge CFStringRef)@"DOGE_NOT_APPROVE", 12, NULL);
NSDictionary *attributes = @{(__bridge id)kCTFontAttributeName: (__bridge_transfer id)font};
NSAttributedString *string = [[NSAttributedString alloc] initWithString:@"broked" attributes:attributes];
NSLog(@"%f %@", [date timeIntervalSinceNow], string);
@b3ll
b3ll / UIBlurView.m
Created March 24, 2014 22:12
How to iOS 7
// Basically what every single developer has done to update their app for iOS 7 :P
@interface UIBlurView : UIToolbar
@end
@implementation UIBlurView
@end
s = [SBIconController sharedInstance];
l = s.currentRootIconList;
icons = [NSMutableArray array];
for (var i = 0; i < l.icons.length; i++) {
[icons addObject:[l viewForIcon:l.icons[i]]];
}
// icons = choose(SBIconView); works, but doesn't, because superview
animator = [[UIDynamicAnimator alloc] initWithReferenceView:icons[0].superview];
@b3ll
b3ll / spoofmac.fish
Created May 30, 2014 19:07
MAC address changer for OS X
function spoofmac
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -z
sudo ifconfig en0 ether $argv
end
//
// SheepParty.swift
// Sheep Party
//
// Adam Bell, 2014
import Foundation
class 🎉 : NSObject
{
@b3ll
b3ll / MaybeRevolutionary.swift
Created July 3, 2014 23:14
Revolutionizing YES / NO
import Cocoa
var MAYBE: Bool {
get {
return Bool(Int(arc4random_uniform(2)))
}
}
var thisIsTotallyAGoodIdea = MAYBE
// Fibonnaci Pandas
let terms = 10
func fib(n:Int) -> Int {
if n == 0 || n == 1 {
return n
} else {
return fib(n-1) + fib(n-2)
}
// June 11, 2012
// https://twitter.com/b3ll/status/212169466665111552
-(BOOL)isBlocked
{
return false;
}
-(int)epicWWDCLineHacks
{
@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
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
}