Skip to content

Instantly share code, notes, and snippets.

View zorn's full-sized avatar
💸
Elixir Contractor For Hire

Mike Zornek zorn

💸
Elixir Contractor For Hire
View GitHub Profile
- (NSString *)filenameForScoreboardTextFontConfig
{
if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM()) {
return @"arcade-hd.fnt";
} else {
if ([[CCDirector sharedDirector] enableRetinaDisplay:YES]) {
return @"arcade-hd.fnt";
} else {
return @"arcade.fnt";
}
@zorn
zorn / gist:1049072
Created June 27, 2011 15:18
Sometimes I enjoy hate email more than happy email. lol.
You know what? I drop out on ya app! There are many better ones
out there. So yep I give up I'm going to delete this app as it
doesn't even help at all. All u can see is just pokemon,
ladiladilaaa!!! Ooohh!! I can see pokemon wooowww its pokemon!
See how boring just looking at their faces not even helpful so I
quit on this app I'm deleting it n givin it 1 star hmph! >:(
OFF LIMITS!!
THIS IS SPARTA!!
Sent from my iPad
@zorn
zorn / gist:1054401
Created June 29, 2011 17:43
New code to make sure intro screencast plays in QuickTime if available or default (usually Safari) if not.
- (IBAction)play:(id)sender
{
// Open up the intro movie, using in pref order, QuickTime, QuickTime X
// or the system defaul (usually Safari).
if (![self openIntroMovieUsingAppBundleIdentifier:@"com.apple.quicktimeplayer"]) {
if (![self openIntroMovieUsingAppBundleIdentifier:@"com.apple.QuickTimePlayerX"]) {
if (![self openIntroMovieUsingAppBundleIdentifier:nil]) {
NSLog(@"Could not open intro movie.");
}
}
@zorn
zorn / gist:1077907
Created July 12, 2011 12:45
Simple NSGradient usage.
- (void)drawRect:(NSRect)rect
{
NSRect bounds = [self bounds];
NSBezierPath *clipShape = [NSBezierPath bezierPath];
[clipShape appendBezierPathWithRoundedRect:bounds xRadius:40 yRadius:30];
NSGradient *aGradient = [[[NSGradient alloc]
initWithColorsAndLocations:[NSColor redColor], (CGFloat)0.0,
[NSColor orangeColor], (CGFloat)0.166,
[NSColor yellowColor], (CGFloat)0.33,
[NSColor greenColor], (CGFloat)0.5,
@zorn
zorn / gist:1078285
Created July 12, 2011 16:04
Resize a canvas using JavaScript
<canvas id="c" height="100" width="100" style="border:1px solid red"></canvas>
<script>
var c = document.getElementById('c');
alert(c.height + ' ' + c.width);
c.height = 200;
c.width = 200;
alert(c.height + ' ' + c.width);
</script>
@zorn
zorn / gist:1114701
Created July 29, 2011 20:43
Random Dex Email (Sonic Fanfic?)
The dark king said faith the dark evil girl! The friend said what you done with faith the dark king said she is mine right? Faith the dark evil girl said
Right! Sonic said what happened to You
Shadow said faith?
The dark king said back off shes mine!
Faith the dark evil girl said I'm with the dark king!
Yoshi said you must belong with us!
Blade faith said yeah!
The dark king said no she is belong with me!
Faith the dark evil girl said go away shadow
Shadow said but you are my friend! Scourge said hey sonic!!
Model: iMac (iMac)
CPU Speed: 8x 2.15 GHz
Process: ProfitTrain [1579]
Path: /Users/USER/Downloads/ProfitTrain.app/Contents/MacOS/ProfitTrain
Identifier: com.clickablebliss.ProfitTrain
Version: 2.0.9 (2.0.9)
Code Type: X86 (Native)
Parent Process: launchd [184]
Date/Time: 2011-07-30 19:52:46.996 -0400
I started by installing Rails 3.1 and playing around. When I got to our App I noticed it was build in Rails 3 and bundler told me I have to install all it's specific versions. When it was done I tried to launch the server but
Last login: Tue Aug 2 17:57:55 on ttys000
Zelda:~ zorn$ echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
Zelda:~ zorn$ which ruby
/usr/local/bin/ruby
Zelda:~ zorn$ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
Zelda:~ zorn$ cd Projects/Summit-AdminPanel/
@zorn
zorn / gist:1135033
Created August 9, 2011 19:59
Clickable Bliss Coding Style Guide

Objective-C

http://www.webkit.org/coding/coding-style.html

Category Methods

Always prefix category methods to avoid collision. In the case of category methods that are very specific to the app, use app prefixes like PT_viewBackgroundColor for ProfitTrain, for more generalized code use CB_containsString:. If the code is part of a branded framework then use it's own prefix. We use the underscore as a way to define separation from the namespace and the method name which most people expect to start with a lowercase.

- (BOOL)containsObjectOfClass:(Class)class
{
__block BOOL answer = NO;
[self enumerateObjectsUsingBlock:^(id obj, BOOL *stop) {
if ([obj isKindOfClass:class]) {
answer = YES;
*stop = YES;
}
}];
return answer;