This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)keyboardWillShow:(NSNotification *)notification { | |
if(nil != self.view.window){ | |
CGRect appFrame = [[UIScreen mainScreen] applicationFrame]; | |
CGRect keyboardBounds = [[[notification userInfo] valueForKey:UIKeyboardBoundsUserInfoKey] CGRectValue]; | |
CGRect searchBounds = [self.searchBar bounds]; | |
CGFloat height = CGRectGetHeight(appFrame) - CGRectGetHeight(keyboardBounds) - CGRectGetHeight(searchBounds); | |
CGRect visibleBounds = CGRectMake(CGRectGetMinX(appFrame), | |
CGRectGetMinY(appFrame) + CGRectGetHeight(searchBounds), | |
CGRectGetWidth(appFrame), | |
height); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat .gitignore | egrep -v "^#|^$" | while read line; do | |
if [ -n "$line" ]; then | |
OLD_IFS=$IFS; IFS="" | |
for ignored_file in $( git ls-files "$line" ); do | |
git rm --cached "$ignored_file" | |
done | |
IFS=$OLD_IFS | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
################################################################################ | |
# | |
# renameXcodeProject.sh | |
# | |
# author: Monte Ohrt <[email protected]> | |
# date: Jan 27, 2009 | |
# version: 1.0 | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
int main(void) { | |
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | |
NSURL* url = [NSURL URLWithString:@"https://twitter.com/"]; | |
NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url]; | |
[request setHTTPMethod:@"HEAD"]; | |
NSHTTPURLResponse* response; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSURL *appURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.itunes.com/app/%@", | |
[[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"] | |
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.*; | |
import java.awt.event.*; | |
public class FullScreen extends java.applet.Applet { | |
private Label label; | |
private Window window; | |
private boolean running; | |
private int clicks; | |
private String[] messages = new String[] { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FB_RequireFeatures(["Connect", "XFBML"], function() { | |
FB.init(FacebookConfig.api_key, "facebook_crossdomain_comm_channel.html"); | |
}); | |
function facebookRequestPermissionIfNecessary(permission, callback) { | |
FB.ensureInit(function() { | |
FB.Facebook.apiClient.users_hasAppPermission(permission, function(result) { | |
if (result == 0) { | |
FB.Connect.showPermissionDialog(permission, callback); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CALayer* layer = someView.layer; | |
CAKeyframeAnimation* animation; | |
animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"]; | |
animation.duration = 1.0; | |
animation.cumulative = YES; | |
animation.repeatCount = 1; | |
animation.removedOnCompletion = NO; | |
animation.fillMode = kCAFillModeForwards; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ify = function() { | |
return { | |
"link": function(t) { | |
return t.replace(/(^|\s+)(https*\:\/\/\S+)/g, function(m, m1, link) { | |
return m1.concat('<a href="', link, '">', link.substr(0, 24), 25 < link.length ? '...' : '', '</a>'); | |
}); | |
}, | |
"at": function(t) { | |
return t.replace(/(^|\s+)\@([a-zA-Z0-9_]{1,15})/g, ‘$1@<a href=”http://twitter.com/$2″>$2</a>’); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation NSArray(Filtering) | |
- (NSArray*)arrayByMappingArrayUsingSelector:(SEL)selector, ... { | |
NSInvocation* invocation; | |
va_list arguments; | |
if (selector && [self lastObject]) { | |
va_start(arguments, selector); | |
invocation = [NSInvocation invocationUsingSelector:selector onTarget:[self lastObject] argumentList:arguments]; | |
va_end(arguments); | |
} |