Skip to content

Instantly share code, notes, and snippets.

@jonswaff
jonswaff / gist:d1f9c36a6a8ab319d04d
Created July 31, 2014 15:14
Print all fonts available in XCode project. Handy for double-checking names of custom-added fonts
for family in UIFont.familyNames() {
println(family)
for fname in UIFont.fontNamesForFamilyName(family as String) {
println(" " + (fname as String))
}
}
@jonswaff
jonswaff / gist:8582072
Created January 23, 2014 16:44
Modal dialog for iOS.
- (void)presentModalView
{
CGFloat bounceDistance = 10.0;
CGFloat modalWidthPercentage = 0.9;
CGFloat modalHeightPercentage = 0.8;
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
CGRect frame = keyWindow.bounds;
// The screenView is a plain black view with opacity
@jonswaff
jonswaff / csvcompare.html
Created January 11, 2013 15:09
Basic CSV comparison. Aligns all identical values from CSV strings into a table. Comes in handy when you want to find which numbers exist in CSV list A but not list B or list C.
<!DOCTYPE html>
<html>
<head>
<title>CSV Compare</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
<!-- Basic CSV comparison. Aligns all identical values from CSV strings into a table. --->
function makeItSo() {
var numberOfCols = 3; // Number of sets/columns we are working with
@jonswaff
jonswaff / gotomeeting_transcode.bat
Created October 19, 2012 15:32
GoToMeeting Video Converter/Transcoder
@echo off
setlocal EnableDelayedExpansion
REM
REM Transcodes a GoToMeeting video (G2M4 codec, .WMV extension)
REM into a normal .WMV video. Essentially strips the proprietary
REM codec using the provided transcoder.
REM
REM There is a "Convert to Windows Media Player file" setting in
REM GTM that essentially does the same thing as this. However,
REM the transcoding begins IMMEDIATELY after the user terminates
@jonswaff
jonswaff / retrieveAllRecipients.php
Created August 16, 2012 13:41
Google Groups Provisioning API with PHP (Zend). Memory usage improvements.
/**
* Retrieve all recipients for a given email list using as little memory as
* possible (or at least less than the default Zend one which is known to hog a bit)
*
* !!! DO NOT USE Zend_Gdata_Gapps::retrieveAllRecipients !!!
*
* @param Zend_Gdata_Gapps $gapps Reference to Zend_Gdata_Gapps object
* @param array $members Reference to array of member email addresses
* @param string $emaiList The email list from which members should be retrieved
* @param string $startRecipient Get next page of recipients starting from this email
@jonswaff
jonswaff / timeIntervalToStringWithInterval
Created July 27, 2012 02:23
Convert a NSTimeInterval into a human-readable string. Used to convert EKAlerts to text
+ (NSString *)timeIntervalToStringWithInterval:(NSTimeInterval)interval
{
NSString *retVal = @"At time of event";
if (interval == 0) return retVal;
int second = 1;
int minute = second*60;
int hour = minute*60;
int day = hour*24;
// interval can be before (negative) or after (positive)