Skip to content

Instantly share code, notes, and snippets.

@jonathanpenn
jonathanpenn / cache.rb
Created March 29, 2010 13:14
Drop in replacement for Nesta's lib/cache.rb helper. Used on http://navel-labs.com
# http://navel-labs.com is built in Nesta (a cms on top of Sinatra) and
# hosted by the awesome Heroku. Since Heroku apps don't have filesystem
# write access, they can't use the default page caching strategy. But
# Heroku offers awesome http proxy caching if you just set the right headers.
#
# Replace lib/cache.rb with this code and call the cache method like usual
# in Nesta, and boom! You have page caching on Heroku!
#
# Nesta: http://effectif.com/nesta
# Heroku: http://heroku.com
// I don't usually touch the AppDelegate anywhere else in the program
// so I'm not sure if this solves what you're trying to do or not.
// But, this should show the difference of how to declare public vs.
// private properties.
@interface SomeClass : NSObject {
// If you use LLVM then you don't have to declare the private var!!
}
@property (nonatomic, retain) NSString *somePublicStringProperty;
@jonathanpenn
jonathanpenn / gist:807211
Created February 2, 2011 03:52
Toggle Xcode between Device and Simulator SDKs
tell application "Xcode"
set targetProject to project of active project document
tell targetProject
if active SDK contains "iphoneos" then
set active SDK to "iphonesimulator"
else
set active SDK to "iphoneos"
end if
end tell
YELLOW='\[\033[1;33m\]'
BLUE='\[\033[1;34m\]'
GREEN='\[\033[1;32m\]'
RED='\[\033[0;31m\]'
NORMAL='\[\033[00m\]'
# Prompt Setup
function minutes_since_last_commit {
@jonathanpenn
jonathanpenn / build.sh
Created June 13, 2011 16:36 — forked from jonah-williams/build.sh
Command line iOS project builds and over-the-air distribution
#!/bin/bash
# https://gist.github.com/949831
# http://blog.carbonfive.com/2011/05/04/automated-ad-hoc-builds-using-xcode-4/
# command line OTA distribution references and examples
# http://nachbaur.com/blog/how-to-automate-your-iphone-app-builds-with-hudson
# http://nachbaur.com/blog/building-ios-apps-for-over-the-air-adhoc-distribution
# http://blog.octo.com/en/automating-over-the-air-deployment-for-iphone/
# http://www.neat.io/posts/2010/10/27/automated-ota-ios-app-distribution.html
class AbsPathTag < Liquid::Tag
def initialize(tag_name, src, tokens)
super
@src = src
@src.strip!
end
def render(context)
@base_url = context.registers[:site].config['url']
absoluteize(@src)
@jonathanpenn
jonathanpenn / diffdir
Created October 13, 2011 13:25
A directory diff'ing script written using Unix magic piping files through `md5` to compare their contents.
#!/bin/bash
# In honor of Dennis Ritchie, I present my directory diff'ing
# script built on the piping magic of Unix.
#
# Usage: diffdir dir1 dir2
set -e # Bomb out of the script on any errors
diff_directories() {
@jonathanpenn
jonathanpenn / gist:1377594
Created November 18, 2011 20:05
An expectation framework with matchers
# This is just a fun experiment to write an expectation
# framework with matchers. NOT PRODUCTION READY! :)
def main
include Expectation
my_matchers = matchers do
define_matcher :to_be do |expected, actual|
@jonathanpenn
jonathanpenn / unix_instruments.sh
Last active January 26, 2016 19:09
Make Instruments play nice with unix by returning > 0 status code if build fails
#!/usr/bin/env bash
#
# Copyright (c) 2013 Jonathan Penn (http://cocoamanifest.net)
#
# 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 Software is
# furnished to do so, subject to the following conditions:
@jonathanpenn
jonathanpenn / gist:1428002
Created December 3, 2011 20:06
Blip prompt
# Prompt Setup
YELLOW='\[\033[1;33m\]'
BLUE='\[\033[1;34m\]'
GREEN='\[\033[1;32m\]'
RED='\[\033[0;31m\]'
NORMAL='\[\033[00m\]'
WHITE='\[\033[0;37m\]'
function minutes_since_last_commit {