Skip to content

Instantly share code, notes, and snippets.

View romainbriche's full-sized avatar

Romain Briche romainbriche

View GitHub Profile
@pokeb
pokeb / gist:150447
Created July 20, 2009 17:03
An example showing how to manage a queue with ASIHTTPRequest
//
// MyController.h
//
// Created by Ben Copsey on 20/07/2009.
// Copyright 2009 All-Seeing Interactive. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <GHUnit/GHUnit.h>
@class ASINetworkQueue;
@interface ExtendedManagedObject : NSManagedObject {
BOOL traversed;
}
@property (nonatomic, assign) BOOL traversed;
- (NSDictionary*) toDictionary;
- (void) populateFromDictionary:(NSDictionary*)dict;
+ (ExtendedManagedObject*) createManagedObjectFromDictionary:(NSDictionary*)dict
inContext:(NSManagedObjectContext*)context;
@henrik
henrik / example.m
Created June 27, 2010 11:48
Locating the keyboard (UIKeyboard) on iOS 4, to e.g. add a custom button.
- (void)someSetupMethod {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification object:nil];
}
- (void)someTeardownMethod {
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
}
@andrewsardone
andrewsardone / gist:504848
Created August 2, 2010 16:00
Automatically deleting our persistent store upon model changes in early development of @nutshellcrm
#define kIncompatibleModelErrorReason @"The model used to open the store is incompatible with the one used to create the store"
/**
Returns the persistent store coordinator for the application.
If the coordinator doesn't already exist, it is created and the application's store added to it.
*/
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
if (persistentStoreCoordinator_ != nil) {
return persistentStoreCoordinator_;
}
@jonah-williams
jonah-williams / build.sh
Created April 30, 2011 17:46
Command line iOS project builds and over-the-air distribution
#!/bin/bash
# https://gist.github.com/949831
# http://blog.carbonfive.com/2011/05/04/automated-ad-hoc-builds-using-xcode-4/
# command line OTA distribution references and examples
# http://nachbaur.com/blog/how-to-automate-your-iphone-app-builds-with-hudson
# http://nachbaur.com/blog/building-ios-apps-for-over-the-air-adhoc-distribution
# http://blog.octo.com/en/automating-over-the-air-deployment-for-iphone/
# http://www.neat.io/posts/2010/10/27/automated-ota-ios-app-distribution.html
@boctor
boctor / BaseViewController.m
Created May 5, 2011 02:08
A base view controller class that when running on the simulator in debug mode, will auto simulate a memory warning every time the view controller's viewDidAppear is called
//
// BaseViewController.m
//
// Created by Peter Boctor on 5/4/11.
//
// Copyright (c) 2011 Peter Boctor
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@aaronbrethorst
aaronbrethorst / t2p.rb
Created May 16, 2011 02:32
Twitter Timeline to Cocoa plist
require 'rubygems'
require 'json'
require 'plist'
require 'open-uri'
File.open("/Users/aaron/Desktop/tweets.plist", 'w') {|f| JSON.parse(open("http://api.twitter.com/1/statuses/user_timeline.json?screen_name=cocoacontrols").read).to_plist}
// this is implemented, but not declared. we add the category to fix the warning
// (since super cannot be casted any longer in clang)
@interface UINavigationController(AMInternal)
- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item;
@end
@implementation AMNavigationController
///////////////////////////////////////////////////////////////////////////////////////////////////
@mbinna
mbinna / UIViewController+MBSensitiveInformationInScreenshotPrevention.h
Created June 12, 2011 13:00
Prevent sensitive information from appearing in the screenshot that is automatically taken when the application transitions from the foreground to the background and vice-versa.
//
// UIViewController+MBSensitiveInformationInScreenshotPrevention.h
//
// Created by Manuel Binna on 05.05.11.
// Copyright 2011 Manuel Binna. All rights reserved.
//
@interface UIViewController (MBSensitiveInformationInScreenshotPrevention)
@irae
irae / _Stay_standalone.md
Last active January 29, 2024 12:38 — forked from kylebarrow/example.html
Stay Standalone: Prevent links in standalone web apps opening Mobile Safari

#Stay Standalone

A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.