Skip to content

Instantly share code, notes, and snippets.

View cbess's full-sized avatar
💭
Coding for Jesus' glory. Soli Deo gloria

C. Bess cbess

💭
Coding for Jesus' glory. Soli Deo gloria
View GitHub Profile
@cbess
cbess / url-mutating.md
Created October 17, 2013 15:59
URL manipulation
@cbess
cbess / time-nsstring.m
Last active December 25, 2015 14:39
Time formatted string from seconds.
/**
* Returns the human-readable string that represents the specified seconds.
* @discussion Ex: seconds = 4017 -> "01:06:57"
*/
- (NSString *)timeStringFromSeconds:(NSInteger)seconds
{
int hours = seconds / 3600;
int rem = seconds % 3600;
int minutes = rem / 60;
int remSecs = rem % 60;
@cbess
cbess / xcode5-ios6-sdk.sh
Last active December 25, 2015 00:19
Links iOS 6 SDK into Xcode SDKs. Allowing you to build/link against iOS 6.x within Xcode 5.
# links the Xcode4.6.x 6.1 SDK to Xcode5 sdks
# by C. Bess (2013)
# For simulators run (ex: iOS 6 sdk/app in iOS 7 simulator):
# - Works if you haven't installed iOS 6 sdk yet
# ln -s Xcode-4.6.3.app/.../iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk Xcode.app/.../iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk
echo Linking iOS 6 SDK to Xcode 5
# name of the Xcode bundles (in Applications)
@cbess
cbess / convert-to-cggeometry.py
Last active December 24, 2015 22:39
TextMate command to convert `frame` dot notation to equivalent CGGeometry function calls
#!/usr/bin/python
# Created by C. Bess (2013)
# Converts the frame dot notation to CGGeometry function calls
#
# ref: http://manual.macromates.com/en/environment_variables.html
#
# Usage:
# After selecting the text that contains the target text, use
# 'Select Bundle Item' menu item, then find this command and press enter
@cbess
cbess / sunset-sunrise.md
Last active December 23, 2015 11:00
Sunset/sunrise calculations and libs
@cbess
cbess / temp-inboxes.md
Last active May 24, 2025 14:57
Temporary inboxes: 10 minute, disposable, temp, etc. email addresses. Live spam free.
@cbess
cbess / gist:6303604
Last active April 1, 2016 16:59
Fix iOS [sizeWithFont:constrainedToSize:lineBreakMode:] deprecation warning. Adjusts the label height (top align text).
// adjust the label height (top align text)
// old
CGSize labelSize = [model.name sizeWithFont:self.nameLabel.font
constrainedToSize:_maxNameLabelSize
lineBreakMode:self.nameLabel.lineBreakMode];
// new
CGSize labelSize = [model.name boundingRectWithSize:_maxNameLabelSize
options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeName: self.nameLabel.font}
context:nil].size;
@cbess
cbess / countly.debian.install.sh
Last active September 25, 2019 03:03
# debian count.ly install script
#!/bin/bash
# debian count.ly install script
# by: C. Bess (github.com/cbess), 2013
# Tested on wheezy (v7.1)
set -e
if [[ $EUID -ne 0 ]]; then
echo "Please execute Countly installation script with a superuser..." 1>&2
exit 1
@cbess
cbess / xcode-pods.sh
Created June 28, 2013 14:55
Xcode "Run Script" cocoapods phase
echo Process pods
if [ ! -e /usr/bin/pod ] ; then
echo Installing cocoapods...
gem install cocoapods
fi
pod update