Skip to content

Instantly share code, notes, and snippets.

NSRange range = [myString rangeOfString:@"foop"];
if (range.location == NSNotFound) {
...
//---- in TNConstants.m:
// TNConstantsApp block:
+(BOOL)hasJQueryDrawnTemplates {
return YES;
}
@nataliepo
nataliepo / journey.html
Created March 15, 2013 14:43
latest journey
<style> .body.poem p { text-indent: 0em !important; padding-left: 0em !important;} </style>
<p style="margin:20px 0px 0px 80px !important;"><em>While I am a pilgrim here</em><br><em>let Thy love my spirit cheer</em></p>
<br />
<p>In the evening, camped at the mouth of a small creek, a good supper of trout as we discuss whether to name this place Whirlpool Canyon or Craggy Canyon. We cannot decide.</p>
<p>A headlong ride, rearing and plunging with the waves. We decide to call it Whirlpool Canyon.</p>
@nataliepo
nataliepo / ampmBug.M
Created February 15, 2013 15:30
NSDateFormatter bug
// dateString expected format: "2012-08-08 17:31:01 Etc/GMT"
// This value comes from our receipt-verification service,
// so it's independent of any of the user's settings
+(NSDate*)translateExpirePurchaseStringToDate: (NSString*)dateString {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
// strip the ending
NSString *purchaseDateString = [dateString stringByReplacingOccurrencesOfString:@" Etc/GMT" withString:@""];
// at the bottom of TNConstants.m's @implementation TNConstantsLinechef : NSObject
+(NSString*)latest_issue_url {
return [NSString stringWithFormat:@"%@/latest_issue.json", [TNConstantsLinechef base_asset_url]];
}
// ..in the @interface TNConstantsLinechef : NSObject block:
+(NSString*)latest_issue_url;
@nataliepo
nataliepo / gist:4549622
Created January 16, 2013 18:41
Dropdown of homepage layout choices for papermag
Title Only,
Pullquote,
Video,
Photo Only,
Tall (240x390),
Wide (390x240),
X-Large Feature (900x650),
XLarge with Text Below,
Tall Feature,
Medium Feature with Text Below,
// Not sure what the base url should be, but appending the
// callback=? parameter will help use it jsonp-style
var api_url = this._settings.baseAPIURL +
'/search/venue/' + venue_id +
'?callback=?';
// I append things on the end like category=Hamburger&location=Greenpoint
var ending_url = $.fn.getQueryParameterString();
// call it!
@nataliepo
nataliepo / uic.M
Created November 6, 2012 00:12
uicollectionview flow
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
return CGSizeMake(200.0, 200.0);
}
@nataliepo
nataliepo / padding.M
Created October 1, 2012 18:26
Paddings in a UITextView
# courtesy of http://stackoverflow.com/questions/746670/how-to-lose-margin-padding-in-uitextview
nameField.contentInset = UIEdgeInsetsMake(-4, -8, 0, 0);