Skip to content

Instantly share code, notes, and snippets.

View andrewsardone's full-sized avatar

Andrew Sardone andrewsardone

View GitHub Profile
@andrewsardone
andrewsardone / gist:2438929
Created April 21, 2012 18:18
Simplenote syncing duplicate files
> cd Simplenote
> ls | wc -l
306
> find . -exec basename {} \; \
| cut -d . -f 1 \
| sort \
| uniq -c \
| grep -v "^[ \t]*1 " \
@andrewsardone
andrewsardone / gist:1935008
Created February 28, 2012 20:46
I'm finally making two-stage object creation work for me ;-)
#import <SenTestingKit/SenTestingKit.h>
#import "OCMock.h"
#import "NLPageControlScrollViewHelper.h"
#pragma mark - Tests
@interface NLPageControlScrollViewHelperTests : SenTestCase
@end
@andrewsardone
andrewsardone / gist:1827605
Created February 14, 2012 15:36
Creating a custom UITableViewCell

[Apple's Documentation][appledoc1]

Option 1: Programmatic Setup and Subview Manipulation

No UITableViewCell subclass

Add subviews to a cell's contentView, or tweak properties of a certain cell style's subviews.

Example:

@andrewsardone
andrewsardone / ExampleTests.m
Created February 1, 2012 16:00
Fake a neighboring class method for the object in test. Stolen from https://gist.github.com/1038034 with a clearer (to me) interface and example.
#import <SenTestingKit/SenTestingKit.h>
#import "SenTestCase+MethodSwizzling.h"
#pragma mark Fakes for Tests
@interface FakeMyObject : NSObject
/**
* A fake, or "stub," implementation of MyObject's +doSomething method.
*/
#include <stdio.h>
int main(void)
{
int foo = 1;
switch (foo)
{
case 0:
int bar = 2;
@andrewsardone
andrewsardone / Foo.h
Created December 30, 2011 20:39
Testing Objective-C blocks question
#import <Foundation/Foundation.h>
@interface Foo : NSObject
@property (nonatomic, strong) NSString *someState;
/**
* Does something asynchronously.
*
* @param resultBlock
@andrewsardone
andrewsardone / gist:1376802
Created November 18, 2011 15:44
Android screen resolutions cheat sheet – http://git.io/androidscreenratios

What are the different Android screen resolution ratios?

                 |-----------+---------+---------+---------|
                 |      ldpi |    mdpi |    hdpi |   xhdpi |
|----------------+-----------+---------+---------+---------|
| Ratios:        |         3 |       4 |       6 |       8 |
| Example:       |     75x75 | 100x100 | 150x150 | 200x200 |
| Emulator Type: | WQVGA 400 |    HVGA | WVGA800 |         |
|----------------+-----------+---------+---------+---------|
@andrewsardone
andrewsardone / gist:1367501
Created November 15, 2011 16:27
Objective-C @Property declaration cheat sheet – http://git.io/objcproperty

@property(<atomicity>, <writability>, <setter semantics>)

<atomicity>

nonatomic – Specifies that accessors are nonatomic. By default, accessors are atomic.

<writability>

readwrite – Indicates that the property should be treated as read/write. This attribute is the default.

@andrewsardone
andrewsardone / gist:1334566
Created November 2, 2011 19:06
A quick cheat sheet for using Bundler

Bundler project setup

Create a Gemfile at root of your project

source :rubygems
gem "jekyll"

Install gems via bundler to a local vendor directory: