Skip to content

Instantly share code, notes, and snippets.

View jimrutherford's full-sized avatar

Jim Rutherford jimrutherford

View GitHub Profile
@jimrutherford
jimrutherford / confettiView.swift
Created November 15, 2016 17:51
Confetti View
//
// Confetti.swift
// WorkRestRepeat
//
// Created by Jim Rutherford on 2015-03-28.
// Copyright (c) 2015 Taptonics. All rights reserved.
//
import UIKit
import QuartzCore
import UIKit
@IBDesignable
public class MyCustomView: UIView {
override public init(frame: CGRect) {
super.init(frame: frame)
applyStyle()
}
import UIKit
@IBDesignable
public class DarkHeadingLabel: UILabel {
override public init(frame: CGRect) {
super.init(frame: frame)
applyStyle()
}
@jimrutherford
jimrutherford / CrashlyticsDestination.swift
Created December 10, 2015 21:00
SwiftyBeaver Crashlyitcs Log Destination
//
// CrashlyticsDestination.swift
//
// Created by Jim Rutherford on 2015-12-10.
//
import UIKit
import Crashlytics
public class CrashlyticsDestination: BaseDestination {
@protocol TLSwipeForOptionsCellDelegate <NSObject>
/**
Tells the delegate that the specified cell’s menu is now shown or hidden.
@param cell The cell whose menu was shown or hidden.
@param isShowingMenu `YES` if the menu was shown; otherwise, `NO`.
*/
- (void)cell:(TLSwipeForOptionsCell *)cell didShowMenu:(BOOL)isShowingMenu;
@jimrutherford
jimrutherford / gist:6092371
Created July 26, 2013 21:27
Enumerate and list all fonts family names that are installed on a specific iOS device. Helpful to determine what font string name to use in [UIFont fontWithName:size:]
for (NSString *familyName in [UIFont familyNames]) {
for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) {
NSLog(@"%@", fontName);
}
}
@jimrutherford
jimrutherford / UIImage+ImageWithColor.h
Created December 3, 2012 23:49
A simple category on UIImage that will tint a named image with a UIColor
//
// UIImage+ImageWithColor.h
// WordClock
//
// Created by James Rutherford on 2012-12-03.
// Copyright (c) 2012 Braxio Interactive. All rights reserved.
//
@jimrutherford
jimrutherford / gist:3788472
Last active May 22, 2018 04:44
Device Detection Macros for iOS
/** String: Identifier **/
#define DEVICE_IDENTIFIER ( ( IS_IPAD ) ? DEVICE_IPAD : ( IS_IPHONE ) ? DEVICE_IPHONE , DEVICE_SIMULATOR )
/** String: iPhone **/
#define DEVICE_IPHONE @"iPhone"
/** String: iPad **/
#define DEVICE_IPAD @"iPad"
/** String: Device Model **/
@jimrutherford
jimrutherford / gist:3788453
Created September 26, 2012 14:44
Run script to flag TODO: and FIXME: as compiler warnings in XCode
// Add this snippet below as a Run Script in Build Phases for your project
KEYWORDS="TODO:|FIXME:|\?\?\?:|\!\!\!:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
@jimrutherford
jimrutherford / githubarchive.sh
Created July 3, 2012 22:39
Generate a bunch of JSON files from GithubArchive
#! /bin/sh
# requires that BigQuery CLI tools are installed
# http://code.google.com/p/google-bigquery-tools/
echo Running Query to grab most popular languages
bq --format=csv --quiet query 'SELECT TOP(repository_language, 10), count(*) FROM [githubarchive:github.timeline]' > tmpLanguages.csv
echo Removing top two lines