Skip to content

Instantly share code, notes, and snippets.


Caleb Davenport calebd

View GitHub Profile
calebd /
Created Jun 7, 2012
Simple UITableView implementation using only HTML and CSS
calebd /
Created Jul 19, 2012
A better build date script for Xcode

A Better Build Date

Showing a build date in an app is pretty easy using __DATE__ and __TIME__ but the format is fixed. This script allows you to control the date and time format and pull the build date from the Info.plist using the CMDBundleBuildTime key.

calebd / NSObject+CMDDescription.m
Last active Dec 10, 2015
A better NSObject description.
View NSObject+CMDDescription.m
#import <objc/runtime.h>
- (NSString *)description {
unsigned int count;
objc_property_t *properties = class_copyPropertyList([self class], &count);
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithCapacity:count];
for (unsigned int i = 0; i < count; i++) {
NSString *name = [NSString stringWithUTF8String:property_getName(properties[i])];
id value = [self valueForKey:name];
if (value == self) {
calebd / Readme.markdown
Last active Dec 20, 2015
Rdio table view scrolling
View Readme.markdown

Step 1: Configure the table view.

  • Set a view as the table footer
  • Set the background color to clear.

Step 2: Set the default table view values when your view loads. The values and variables seen here are explained below.

- (void)viewDidLoad {
    [super viewDidLoad];
calebd /
Created Jan 9, 2014
HuBot script for checking the latest average iOS and Mac App Store review times.
# Description:
# Fetch iOS and Mac App Store average review times.
# Commands:
# bot review times
# bot review time
module.exports = (robot) ->
robot.respond /review times?/i, (msg) ->
View Brewfile
install 'rbenv'
install 'ruby-build'
install 'redis'
install 'postgres'
install 'heroku'
install 'zsh-completions'
install 'pianobar'

Keybase proof

I hereby claim:

  • I am calebd on github.
  • I am calebd ( on keybase.
  • I have a public key whose fingerprint is 90E2 D6FA 4617 A20E F17B A0FD C9D4 36D2 93D8 1A54

To claim this, I am signing this object:

View weird.markdown

The URL contains a plist, and inside that is coded another plist. Together, they make references to Apple IP addresses, ports, web services, Netflix, and Apple TV. What is this?

Edit: It looks like AVPlayer encounters an eror in the simulator that points to this URL as seen here: Thanks to @mwhuss for sharing this with me.

Outer property list:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
View UIColor Bug.markdown

I found an annoying behavior in UIColor today. If either saturation or brightness is 0 when creating an HSB color, other color values are ignored. This results in a valid color, and if drawn, it will be the correct color. But the values coming out of it are incorrect.

Assuming these defined values:

UIColor *color;
CGFloat inputHue, inputSaturation, inputBrightness, inputAlpha;
CGFloat outputHue, outputSaturation, outputBrightness, outputAlpha;
View Readme.markdown

Why does this work? In theory, creating a mutable version of an NSData object by referencing its original bytes using -[NSMutableData dataWithBytesNoCopy:length:freeWhenDone:], and then modifying those bytes would result in the original immutable object being modified as well.

It is worth noting that calling -[NSData dataWithBytesNoCopy:length:freeWhenDone:] results in both data objects having the same byte pointer address, and that memsetting the data returned by bytes on an immutable data object will in fact update the data that it represents.


DataTest[58994:303] original data pointer location: 0x10010a630
DataTest[58994:303] original data: <4c6f7265 6d206970 73756d20 646f6c6f 72207369 7420616d 65742c20 636f6e73 65637465 74757220 61646970 69736369 6e672065 6c69742e>
DataTest[58994:303] mutable data pointer location: 0x100201a00