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
@joshdholtz
joshdholtz / AndroidManifest.xml
Created July 24, 2013 16:08
Using Sentry-Android, setting up in sublcassed Application, with a CaptureListener to show if using wifi - Screenshot of success http://i.imgur.com/n0LcGfM.png
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.joshdholtz.sentry"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
@joshdholtz
joshdholtz / unretina_it
Last active January 1, 2016 11:49
Quick script to scale retina images down 50% into a new file in current directory I also added a bash script in my /usr/local/bin so that I can run this from anywhere
#!/bin/bash
ruby ~/scripts/unretina_it.rb
System.gc(); // Getting angry
Runtime.getRuntime().gc(); // Getting angrier
@joshdholtz
joshdholtz / FindMe.java
Created February 24, 2014 04:55
Quick and dirty way to find users location - just make sure to ask politely
/**
*
* MANIFEST PERMISSIONS
* <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
* <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
*
*
*
* /
@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