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 | |
PROJ=`find . -name '*.xib' -o -name '*.[mh]'` | |
for png in `find . -name '*.png'` | |
do | |
filename=`basename $png` | |
name=${filename%.*} | |
if ! grep -q $name $PROJ; then | |
echo "$png is not referenced" | |
fi |
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
- (NSArray *)generate:(int)n randomUniqueNumbersBetween:(int)lowerLimit upperLimit:(int)upperLimit | |
{ | |
NSMutableArray *randomNumberArray = [NSMutableArray arrayWithCapacity:upperLimit-lowerLimit]; | |
// add all numbers to array | |
for (int i = lowerLimit; i < upperLimit; i++) | |
{ | |
[randomNumberArray addObject:@(i)]; | |
} | |
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
- (CCParticleSystem *)createParticleEffectInCode { | |
CCParticleSystem *emitter = [[CCParticleSystem alloc] initWithTotalParticles:50]; | |
emitter.texture = [[CCTextureCache sharedTextureCache] addImage: @"stars-grayscale.png"]; | |
// duration | |
emitter.duration = CCParticleSystemDurationInfinity; | |
// Gravity Mode: gravity | |
emitter.gravity = CGPointZero; |
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
OALSimpleAudio *audio = [OALSimpleAudio sharedInstance]; | |
[audio playEffect:@"your_file_name"] |
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
-(void) applicationWillResignActive:(UIApplication *)application | |
{ | |
[[CCDirector sharedDirector] pause]; | |
} | |
-(void) applicationDidEnterBackground:(UIApplication*)application | |
{ | |
[[CCDirector sharedDirector] stopAnimation]; | |
} |
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
/* | |
Generates a random number with upper bound of provided value. | |
Truncates upper bound to 32-Bit values. | |
*/ | |
func randomInteger(var maximum: Int) -> Int { | |
if maximum > Int(Int32.max) { | |
maximum = Int(Int32.max) | |
} | |
return Int(arc4random_uniform( |
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
protocol Initializable { | |
init() | |
} | |
class A : Initializable { | |
var content:String | |
required init() { | |
content = "TestContent" | |
} |
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
// Workaround for Parse 1.6.4 and Xcode 6.3, see: http://stackoverflow.com/questions/28953306/pfobject-does-not-have-a-member-named-subscript/29015269#29015269 | |
extension PFObject { | |
subscript(index: String) -> AnyObject? { | |
get { | |
return self.valueForKey(index) | |
} | |
set(newValue) { | |
if let newValue: AnyObject = newValue { | |
self.setValue(newValue, forKey: index) | |
} |
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
//: Playground - noun: a place where people can play | |
import Foundation | |
let arr = [1,5,7,8] | |
let pointer = UnsafeMutablePointer<[Int]>.alloc(4) | |
pointer.initialize(arr) | |
let x = pointer.memory[3] |
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
import Foundation | |
class A { var x = "a" } | |
var a:A = A() | |
isUniquelyReferencedNonObjC(&a) | |
var b = a |
OlderNewer