Skip to content

Instantly share code, notes, and snippets.

View jeffremer's full-sized avatar

Jeff Remer jeffremer

View GitHub Profile

Odyssey Swift API Design and Style Guidelines

🍎 Apple’s API Style Guidelines

Apple’s official Swift naming and API design guidelines hosted on swift.org are considered part of this style guide and are followed as if they were repeated here in their entirety.

This document serves to amend those guidelines with non-contradictory clarifications relevant to the Odyssey codebase, reiterating the relevant Swift API design guideline principles.

It is a living document, subject to correction and amendment through a feedback and ratification process via RFC.

@jeffremer
jeffremer / git-squash
Created June 19, 2013 20:10
git-squash
#!/bin/sh
source "$(git --exec-path)/git-sh-setup"
USAGE="COMMITS"
function _squash() {
if [[ $# == 1 ]]; then
if [[ -n $(git rev-parse --verify --quiet HEAD~$1) ]]; then
git rebase -i HEAD~$1
else
@jeffremer
jeffremer / bypass_rescue.rb
Created April 29, 2013 20:37
Useful Rspec output with bypass_rescue
describe "index" do
it "raises AccessDenied" do
bypass_rescue
expect { get :index }.to raise_error(AccessDenied)
end
end
@jeffremer
jeffremer / cleanup_tags.sh
Last active December 14, 2015 14:29 — forked from nuc/gist:1834765
Bulk delete a set of tags filtered by FILTER.
export FILTER="hudson"
git ls-remote --tags origin | awk '/^(.*)(\s+)(.*[a-z0-9])$/ {print ":" $2 }' | grep $FILTER | xargs git push origin
git tag -l | grep $FILTER | xargs git tag -d
@jeffremer
jeffremer / ViewController.m
Created January 3, 2013 19:28
How to detect shake gestures in a UIViewController.
@implementation ViewController
#pragma mark - UIResponder
- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
{
if (motion == UIEventSubtypeMotionShake) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Shaken"
message:@"Not stirred."
delegate:self
@jeffremer
jeffremer / README.md
Created November 14, 2012 18:08
Did you run the tests?

This gives you an annoying little prompt that makes you enter "yes" before pushing.

  1. Install the dependencies: gem install highline colored
  2. Add didyou.rb to your PATH and make it executable chmod a+x didyou.rb.
  3. Add the git wrapper function in your shell startup file and reload your shell.
@jeffremer
jeffremer / platforms.md
Created June 1, 2012 19:48
iPhone Models
  • iPhone1,1 - Original (EDGE)
  • iPhone1,2 - 3G
  • iPhone2,1 - 3GS
  • iPhone3,1 - 4 (GSM)
  • iPhone3,3 - 4 (CDMA)
  • iPhone4,1 - 4S
@jeffremer
jeffremer / cedar-issue.md
Created January 27, 2012 23:32
Cedar macro object literal issue

I'm having trouble getting Cedar matchers to accept object literals like @"strings" or [NSNumber numberWithInt:2]. If I assign them to a variable then pass in the pointer it works fine, but if I pass in a literal to the macro it fails while building with errors like this:

	Semantic Issue
	error: no matching function for call to 'equal' [3]

For example, I've set up a blank Example project and added Cedar, then created a simple spec showing what seems to work and what doesn't:

@jeffremer
jeffremer / cedar-issue.md
Created January 27, 2012 23:30
Cedar macros won't take object literals

I'm having trouble getting Cedar matchers to accept object literals like @"strings" or [NSNumber numberWithInt:2]. If I assign them to a variable then pass in the pointer it works fine, but if I pass in a literal to the macro it fails while building with errors like this:

	Semantic Issue
	error: no matching function for call to 'equal' [3]

For example, I've set up a blank Example project and added Cedar, then created a simple spec showing what seems to work and what doesn't:

- (UIImage *)captureView:(UIView *)view
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext(screenRect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[[UIColor blackColor] set];
CGContextFillRect(ctx, screenRect);