Skip to content

Instantly share code, notes, and snippets.

@mediabounds
mediabounds / gist:3164737
Created July 23, 2012 17:05
Converts an ISO8601 duration (http://en.wikipedia.org/wiki/ISO_8601#Durations) to seconds (NSTimeInterval)
- (NSTimeInterval) timeIntervalWithISO8601duration:(NSString *)duration
{
// duration is in the format "P3Y6M4DT12H30M5S" OR "P2W"
// The P simply indicates that this is a duration, this should be the first character.
// The T is the separator between the date portion (day, month, year) and the time portion (hour, minute, second).
if ([duration characterAtIndex:0]!='P') return 0;
NSScanner *iso8601duration = [NSScanner scannerWithString:duration];
iso8601duration.charactersToBeSkipped = [NSCharacterSet characterSetWithCharactersInString:@"P"];
@mediabounds
mediabounds / floatsign.sh
Last active March 31, 2024 18:43
A small bash script to re-sign iOS applications.
# !/bin/bash
# Copyright (c) 2011 Float Mobile Learning
# http://www.floatlearning.com/
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the