Skip to content

Instantly share code, notes, and snippets.

View nbomberger's full-sized avatar

Nathaniel Bomberger nbomberger

View GitHub Profile
# inspired by https://gist.github.com/406460 and
# http://pivotallabs.com/users/rolson/blog/articles/1249-stubbing-out-paperclip-imagemagick-in-tests
# plus some additional monkeypatching to prevent "too many files open" err's
#
# place this file in <app root>/spec/support
#
RSpec.configure do |config|
$paperclip_stub_size = "800x800"
end
/*
File: KeychainItemWrapper.h
Abstract:
Objective-C wrapper for accessing a single keychain item.
Version: 1.2 - ARCified
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
@interface NSFileManager (DoNotBackup)
- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL;
@end
@nbomberger
nbomberger / Podfile-snippet
Last active August 29, 2015 14:07 — forked from funroll/Podfile-snippet
This is an improved version that combines the above two versions and works for Xcode 5.1.1. Based on the (updated) original by Cameron Spickert.
# Remove 64-bit build architecture from all pod targets and override 'Build Active Architecture Only' to NO.
post_install do |installer|
installer.project.targets.each do |target|
target.build_configurations.each do |configuration|
target.build_settings(configuration.name)['VALID_ARCHS'] = '$(ARCHS_STANDARD_32_BIT)'
target.build_settings(configuration.name)['ONLY_ACTIVE_ARCH'] = 'NO'
end
end
end
@nbomberger
nbomberger / file.swift
Last active August 29, 2015 14:09 — forked from frozzare/file.swift
import Foundation
class File {
class func exists (path: String) -> Bool {
return NSFileManager().fileExistsAtPath(path)
}
class func read (path: String, encoding: NSStringEncoding = NSUTF8StringEncoding) -> String? {
if File.exists(path) {
import bisect
class NFA(object):
EPSILON = object()
ANY = object()
def __init__(self, start_state):
self.transitions = {}
self.final_states = set()
self._start_state = start_state
#import <QuartzCore/QuartzCore.h>
@interface ArrowLayer : CALayer
@property (nonatomic) CGFloat thickness;
@property (nonatomic) CGFloat startRadians;
@property (nonatomic) CGFloat lengthRadians;
@property (nonatomic) CGFloat headLengthRadians;
@property (nonatomic, strong) UIColor *fillColor;
@nbomberger
nbomberger / Carthage Instructions.md
Last active August 29, 2015 14:27 — forked from pxlshpr/Carthage Instructions.md
These are the steps required to add and embed a framework into your project using Carthage.
  1. Add the URL of the framework's repo to your Cartfile using one of the following:
  github "ReactiveCocoa/ReactiveCocoa" # GitHub.com
  github "https://enterprise.local/ghe/desktop/git-error-translations" # GitHub Enterprise
  git "https://enterprise.local/desktop/git-error-translations2.git"
  git "/Users/user/foo/bar.git"

…optionally followed by one of the following version specifiers:

//some time, frc section may be need section offset
@objc public protocol MFetchedResultsControllerOffsetSectionDelegate{
func offsetSection() -> Int
}
class MFetchedResultsController: NSFetchedResultsController, NSFetchedResultsControllerDelegate {
weak var viewController: UIViewController? //UITableViewController UICollectionViewController
weak var scrollView: UIScrollView? //TableView CollectionView
weak var offsetSectionDelegate: MFetchedResultsControllerOffsetSectionDelegate?
@nbomberger
nbomberger / UITableView.swift
Created January 4, 2016 16:31 — forked from watert/UITableView.swift
UITableView example in iOS Playground with XCode 6 beta
// Playground - noun: a place where people can play
import UIKit
class ViewController: UIViewController ,UITableViewDelegate, UITableViewDataSource
{
var tableView: UITableView!
var items: NSMutableArray!
override func viewDidLoad() {
super.viewDidLoad()