Skip to content

Instantly share code, notes, and snippets.

View jdg's full-sized avatar

Jonathan George jdg

View GitHub Profile
ProjectsAppDelegate *appDelegate = (ProjectsAppDelegate *)[[UIApplication sharedApplication] delegate];
UIViewAnimationTransition trans = UIViewAnimationTransitionFlipFromLeft;
[UIView beginAnimations: nil context: nil];
[UIView setAnimationTransition: trans forView: [appDelegate window] cache: YES];
[UIView setAnimationDuration:1.0];
[self.navigationController pushViewController:self.projectViewController animated:NO];
[UIView commitAnimations];
/*
* Memory.c
* Outpost
*
* Created by Jim Dovey on 23/04/09.
* Copyright 2009 Morfunk, LLC. All rights reserved.
*
* Copyright (c) 2009, Jim Dovey
* All rights reserved.
*
# define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
# ifdef DEBUG
# define DLog(fmt, ...) ALog(fmt, ##__VA_ARGS__);
# else
# define DLog(...)
# endif
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {
NSLog(@"webView requested: %@ - %@", request, [[request URL] host]);
NSURL *requestUrl = [request URL];
if ([[requestUrl host] isEqualToString:OAUTH_REDIRECT_TRIGGER]) {
[self completeAccessTokenRequest];
}
return YES;
}
// by Wil Shipley
// from: http://www.wilshipley.com/blog/2005/10/pimp-my-code-interlude-free-code.html
static inline BOOL IsEmpty(id thing) {
return thing == nil
|| ([thing respondsToSelector:@selector(length)]
&& [(NSData *)thing length] == 0)
|| ([thing respondsToSelector:@selector(count)]
&& [(NSArray *)thing count] == 0);
}
//
// SynthesizeSingleton.h
// CocoaWithLove
//
// Created by Matt Gallagher on 20/10/08.
// Copyright 2009 Matt Gallagher. All rights reserved.
//
// Permission is given to use this source code file without charge in any
// project, commercial or otherwise, entirely at your risk, with the condition
// that any redistribution (in part or whole) of source code must retain
class Hash
def recursively_symbolize_keys
tmp = {}
for k, v in self
tmp[k] = if v.respond_to? :recursively_symbolize_keys
v.recursively_symbolize_keys
else
v
end
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# - a browser with WebSocket support
#
# Usage:
# ruby redis_pubsub_demo.rb
#
#!/usr/bin/ruby
require 'osx/cocoa'
require 'date'
OSX.require_framework "AddressBook"
filePath = "%%%{PBXFilePath}%%%"
fileName = File.basename(filePath)
projName = File.basename(File.dirname(filePath))
//
// A category on UIViewController that lets you do this:
//
// [myViewController showInPopoverFromRect:someRect inView:someView];
//
// A global instance of the popover controller will be managed by the view controller..
//
#import <UIKit/UIKit.h>