Skip to content

Instantly share code, notes, and snippets.

@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
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 / 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
// 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 / 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
require 'open-uri'
# url dsl -- the ultimate url dsl!
#
# You just can't beat this:
#
# $ irb -r url_dsl
# >> include URLDSL
# => Object
# >> http://github.com/defunkt.json

Introduction

Forward (from PEP 8)

One of Guido’s key insights is that code is read much more often than it
is written. The guidelines provided here are intended to improve the
readability of code and make it consistent across the wide spectrum of
Python code. As PEP 20 6 says, “Readability counts”.

A style guide is about consistency. Consistency with this style guide is

Some ideas for unobtrusive ajax pagination.
HTML Markup...
<div class="pagination_container">
<div class="pagination>
<a href="...">1</a>...
</div>
<div class="pagination_target">
#!/usr/bin/env ruby
#
# usage: script/server_restarter
#
# Rails autoloading, while nice in theory, frequently doesn't work. Since Rails 2.3+
# is so fast when completely reloading the server, I wrote this script to listen to the
# given directories, and kill/restart the server when any file is changed.
#
# It's quick, simple, and it reliably reloads your application when changes are made.
#
@jonathanpenn
jonathanpenn / rdingus_examples_spec.rb
Created December 23, 2008 02:40
Some examples on how RDingus might be used.
require File.dirname(__FILE__)+"/spec_helper.rb"
class Person
def initialize(name)
@name = name
end
def name
@name