This file contains 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 | |
echo "This script will take an input folder full of images and assuming they're all retina sized, output the second folder to have retina and standard sized images." | |
if [ ! $# == 2 ]; then | |
echo "Usage: $0 in out" | |
exit | |
fi | |
if [ ! -d $1 ] |
This file contains 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
Variables set as: | |
name expression default value | |
--------------------------------- | |
class CLASS | |
class2 decapitalize(class) | |
--------------------------------- | |
@class $class$; |
This file contains 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
// From http://stackoverflow.com/questions/8041237/how-to-set-the-delegate-with-a-storyboard | |
#import <Foundation/Foundation.h> | |
@interface UIStoryboardSegue (topLevelDestinationViewController) | |
@property (readonly) id topLevelDestinationViewController; | |
@end |
This file contains 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 | |
# 2012 - Ben Clayton (benvium). Calvium Ltd | |
# Found at https://gist.github.com/2568707 | |
# | |
# This script installs a .mobileprovision file without using Xcode. Unlike Xcode, it'll | |
# work over SSH. | |
# | |
# Requires Mac OS X (I'm using 10.7 and Xcode 4.3.2) | |
# |
This file contains 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
// NOTE YOU MUST ADD THE FRAMEWORK 'MessageUI' to your project. | |
// MyViewController.h | |
//------------------- | |
#import <MessageUI/MessageUI.h> | |
@interface MyViewController : UIViewController <MFMailComposeViewControllerDelegate> | |
// MyViewController.m |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<style> | |
.slice { | |
background-image: url(http://upload.wikimedia.org/wikipedia/commons/8/89/Swiss_cheese_cubes.jpg); | |
position: absolute; | |
left: 0; |
This file contains 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
// A function that returns an object or nil if there's an error. | |
- (NSObject*) doSomethingComplexAndReturnObject:(NSString*) input error:(NSError**) error { | |
// do some work.. | |
BOOL itWorked = YES; | |
if (itWorked) { | |
return [[NSObject alloc] init]; // Do better memory management than this please. | |
} else { | |
*error = [NSError errorWithDomain:@"com.mycompany.myapp" code:14 userInfo:[NSDictionary dictionaryWithObject:@"My error message" forKey:NSLocalizedDescriptionKey]]; |
This file contains 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
<?php | |
/** | |
* Reads the requested portion of a file and sends its contents to the client with the appropriate headers. | |
* | |
* This HTTP_RANGE compatible read file function is necessary for allowing streaming media to be skipped around in. | |
* | |
* @param string $location | |
* @param string $filename | |
* @param string $mimeType | |
* @return void |
This file contains 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 url = "path/to/my/audio.mp3"; | |
var ap = new window.Audio(); | |
var isLoaded = false; | |
ap.addEventListener('canplay', function () { | |
isLoaded = true; | |
console.log(url.split("/").pop() + " loaded"); | |
this.play(); | |
}, false); |
This file contains 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
/* in iOS 5 | |
// Force app to be portrait-only | |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation | |
{ | |
return (interfaceOrientation == UIInterfaceOrientationPortrait); | |
} | |
*/ | |
// iOS 6 interface orientation support. Only rotate on iPad. | |
- (BOOL)shouldAutorotate { |
OlderNewer