Skip to content

Instantly share code, notes, and snippets.

@pashields
pashields / MapperConfig+PListReader.m
Created February 6, 2012 02:33
A simple MapperConfig extension to load from a plist
#import "MapperConfig.h"
@interface MapperConfig (PListReader)
- (void)importFromPList:(NSString*)pListName;
@end
@implementation MapperConfig (PListReader)
- (void)importFromPList:(NSString*)pListName {
NSString *path = [[NSBundle mainBundle] pathForResource:pListName ofType:@"plist"];
NSDictionary *mappings = [[NSDictionary alloc] initWithContentsOfFile:path];
- (void)keyboardWillShow:(NSNotification *)notif {
if (self.scrollView.frame.size.height == 460-HEADER_BAR_HEIGHT-216) {
return;
}
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.2];
self.scrollView.frame = CGRectMake(0, HEADER_BAR_HEIGHT, 320, 460-HEADER_BAR_HEIGHT-216);
[UIView commitAnimations];
NSLog(@"contentOffset: %f", self.scrollView.contentOffset.y);
if ([self.lastNameField isFirstResponder]) {
@pashields
pashields / Resty.m
Created August 22, 2011 15:38
Deserialize json obj-c
//
// RIP.m
// RIP
//
// Created by Patrick Shields on 8/21/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#import "Resty.h"
#import "RestyConfig.h"
@pashields
pashields / punsubscribe-test.c
Created April 19, 2011 13:07
This attempts to show the failure of redis' punsubscribe cmd
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "hiredis.h"
int main(void) {
int ppid = fork();
if (ppid == 0) {
redisContext *c;
[
{
"dateCreated": null,
"dateModified": null,
"itemId": "2",
"itemToViewer": "NONE",
"itemType": "USER",
"location": null,
"name": "Dude Man",
"thumbnailUri": null,
package com.floop.rest.api;
import java.io.File;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
Downloaded: http://repo1.maven.org/maven2/redis/clients/jedis/1.5.1/jedis-1.5.1.jar (98 KB at 44.4 KB/sec)
Downloaded: http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.12/mysql-connector-java-5.1.12.jar (716 KB at 180.2 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:59.332s
[INFO] Finished at: Sun Jan 23 16:59:17 EST 2011
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project com.floop.data: Could not resolve dependencies for project com.floop:com.floop.data:jar:1.0.0-SNAPSHOT: Could not find artifact com.surftools:BeanstalkClient:jar:1.4.4-SNAPSHOT in JBoss (https://repository.jboss.org/nexus/content/groups/public/) -> [Help 1]
@pashields
pashields / gist:791657
Created January 23, 2011 00:20
mvn install failing
Patrick-Shieldss-MacBook-Air:tmp pashields$ brew info maven
maven 3.0.2
http://maven.apache.org/
/usr/local/Cellar/maven/3.0.2 (40 files, 3.3M)
http://github.com/mxcl/homebrew/commits/master/Library/Formula/maven.rb
Patrick-Shieldss-MacBook-Air:tmp pashields$ git clone [email protected]:floop-inc/floop-server.git
Cloning into floop-server...
remote: Counting objects: 7308, done.
remote: Compressing objects: 100% (2242/2242), done.
remote: Total 7308 (delta 3731), reused 6921 (delta 3533)
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Application Specific Information:
iPhone Simulator 225, iPhone OS 4.1 (iPhone/8B117)
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[RKTStatus request]: unrecognized selector sent to class 0x2dbc8'
*** Call stack at first throw:
(
Build RestKitObjectMapping of project RestKit with configuration Debug
CompileC build/RestKit.build/Debug-iphonesimulator/RestKitObjectMapping.build/Objects-normal/i386/RKObjectManager.o Code/ObjectMapping/RKObjectManager.m normal i386 objective-c com.apple.compilers.gcc.4_2
cd /Users/pashields/sandboxes/RestKit
setenv LANG en_US.US-ASCII
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -x objective-c -arch i386 -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk -fexceptions -mmacosx-version-min=10.6 -gdwarf-2 -fobjc-abi-version=2 -fobjc-legacy-dispatch -D__IPHONE_OS_VERSION_MIN_REQUIRED=40100 -iquote /Users/pashields/sandboxes/RestKit/build/RestKit.build/Debug-iphonesimulator/RestKitObjectMapping.build/R