Skip to content

Instantly share code, notes, and snippets.

View joshdholtz's full-sized avatar
👨‍👩‍👦
Family first then OSS

Josh Holtz joshdholtz

👨‍👩‍👦
Family first then OSS
View GitHub Profile
System.gc(); // Getting angry
Runtime.getRuntime().gc(); // Getting angrier
@joshdholtz
joshdholtz / TTTAttributedLabel+QuickFonting.m
Created March 5, 2014 04:28
Super quick fonting with TTTAttributedLabel
//
// TTTAttributedLabel+QuickFonting.m
//
// Created by Josh Holtz on 3/4/14.
// Copyright (c) 2014 RokkinCat. All rights reserved.
//
#import "TTTAttributedLabel+QuickFonting.h"
@implementation TTTAttributedLabel (QuickFonting)
1 banana
2 scoops whey protein (banana flavored)
12 oz milk
3 large spoonsfulls plain greek yogurt
Handful of strawberries
Handful of blueberries
@joshdholtz
joshdholtz / ClientSessionManager.m
Created April 11, 2014 16:03
AFNetworking 2.0 - cancelAllHTTPOperationsWithMethod for AFHTTPRequestOperationManager
- (void)cancelAllHTTPOperationsWithMethod:(NSString*)method path:(NSString*)path parameters:(NSDictionary*)parameters ignoreParams:(BOOL)ignoreParams {
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:(method ?: @"GET") URLString:[[NSURL URLWithString:path relativeToURL:self.baseURL] absoluteString] parameters:parameters];
NSString *URLStringToMatched = [[request URL] absoluteString];
for (NSOperation *operation in [self.operationQueue operations]) {
if (![operation isKindOfClass:[AFHTTPRequestOperation class]]) {
continue;
}
@joshdholtz
joshdholtz / PassProtocolClass.swift
Last active August 29, 2015 14:05
Can i pass in a class (not instance of a class), and sure it conforms to a protocol?
// Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
protocol Cool {
init(name: String)
func talk() -> String
}
@joshdholtz
joshdholtz / StaticStruct.swift
Created August 29, 2014 17:40
Static variables in struct
struct This {
static var powerRangers: String?
}
@joshdholtz
joshdholtz / GenericsThings.swift
Created October 15, 2014 19:03
Why is C not C?
//
// ViewController.swift
// SwiftTest
//
// Created by Josh Holtz on 8/3/14.
// Copyright (c) 2014 Josh Holtz. All rights reserved.
//
import UIKit
@joshdholtz
joshdholtz / ManStuff.swift
Created October 15, 2014 19:21
Another issues but with extending???
//
// ViewController.swift
// SwiftTest
//
// Created by Josh Holtz on 8/3/14.
// Copyright (c) 2014 Josh Holtz. All rights reserved.
//
import UIKit
@joshdholtz
joshdholtz / Working.swift
Last active August 29, 2015 14:07
Working Version
//
// ViewController.swift
// SwiftTest
//
// Created by Josh Holtz on 8/3/14.
// Copyright (c) 2014 Josh Holtz. All rights reserved.
//
import UIKit
@joshdholtz
joshdholtz / something.m
Last active August 29, 2015 14:09
Autoconstraint issue
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x17009cb60 UIImageView:0x1701f9900.centerX == AVAudioOnlyIndicatorView:0x170199980.centerX>",
"<NSLayoutConstraint:0x17009cbb0 H:|-(>=10)-[UIImageView:0x1701f9900] (Names: '|':AVAudioOnlyIndicatorView:0x170199980 )>",
"<NSLayoutConstraint:0x17009d970 H:|-(0)-[AVAudioOnlyIndicatorView:0x170199980] (Names: '|':UIView:0x17419a4e0 )>",
"<NSLayoutConstraint:0x17009d9c0 H:[AVAudioOnlyIndicatorView:0x170199980]-(0)-| (Names: '|':UIView:0x17419a4e0 )>",
"<NSLayoutConstraint:0x17009d6f0 H:|-(0)-[UIV