Skip to content

Instantly share code, notes, and snippets.

View samgreen's full-sized avatar

Sam Green samgreen

  • San Francisco, CA
View GitHub Profile
NSArray *subviews = [self.view subviews];
for (NSInteger i = 0; i < subviews.count; i++) {
UIView *subview = [subviews objectAtIndex:i];
if ([subview isKindOfClass:[UIImageView class]]) {
NSArray *imageSubviews = [subview subviews];
for (NSInteger j = 0; j < imageSubviews.count; j++) {
UIView *imageSubview = [imageSubviews objectAtIndex:i];
//
// Server.h
// NEPEquipmentScanner
//
// Created by Sam Green on 3/3/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Icon.png</string>
<string>Icon@2x.png</string>
<string>Icon-72.png</string>
</array>
- (void)tappedRadioButton:(UIButton *)sender {
Radio *radio = [RadioSingleton sharedRadio];
if (radio.isPlaying) {
[radio stopPlaying];
} else {
[radio startPlaying];
}
}
//
// UserTests.m
// TomManatosJobList
//
// Created by Sam Green on 4/25/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "UserTests.h"
NSMutableArray *allCategories = [NSMutableArray array];
for (NSString *key in [template allKeys]) {
NSArray *categoryItems = [template objectForKey:key];
[allCategories addObject:categoryItems];
}
var testDecimal = numerator / denominator;
if(testDecimal < .1){
numerator = 0;
denominator = 1;
}
else if(testDecimal > .29 && testDecimal < .35){
numerator = 1;
denominator = 3;
}
else if(testDecimal > .59 && testDecimal < .70){
if(wineRatingAverage==0)
_rateViewStatic.rating = 0;
else if(wineRatingAverage==0.5)
_rateViewStatic.rating = 0.5;
else if(wineRatingAverage==1)
_rateViewStatic.rating = 1;
else if(wineRatingAverage==1.5)
_rateViewStatic.rating = 1.5;
else if(wineRatingAverage==2)
_rateViewStatic.rating = 2;
{
"title":"Braised Lamb Shanks",
"advertiserId":1,
"recipeId":"9431",
"url":"/recipe/braised-lamb-shanks",
"notes":"",
"modified":"2012-07-10 18:28:16",
"introduction":"<p>Braising is a wise choice of preparation for lamb shanks, as this cut is typically tough. The “low and slow” cooking process results in tender, juicy meat that just falls off the bone.</p>",
"imageURL":"/wp-content/uploads/secure/USWM-App-Advertisement.jpg",
"photoURL":"/wp-content/uploads/2011/12/64_1-150x150.jpg",
- (void)createPDFFromContents {
NSString *pdfPath = [NSURL pathToDocuments:@"CostCalculator.pdf"];
BOOL success = UIGraphicsBeginPDFContextToFile(pdfPath, self.bounds, nil);
if (!success) return;
CGContextRef pdfContext = UIGraphicsGetCurrentContext();
UIGraphicsBeginPDFPage();
[self.layer renderInContext:pdfContext];