Skip to content

Instantly share code, notes, and snippets.

# This is part of a rakefile I use for UI Automation that's part of an
# upcoming (secret) project that I hope to announce soon.
# You need to set the $app_bundle global variable to point to the application's
# bundle on disk. Then hand in 1 for iPhone or 2 for iPad to this function
# and it will manipulate the plist of the device.
def pick_simulator_device index
# For now, the only way to tell UI Automation to run the iPad or iPhone
# simulator is to change the app bundle plist to require only that device.
" Cover all the permutations. This is how I roll.
command! W :w
command! Q :q
command! Qa :qa
command! QA :qa
command! WQ :wq
command! Wq :wq
@jonathanpenn
jonathanpenn / stdout
Created April 25, 2012 18:27 — forked from listrophy/stdout
UIATargetHasGoneAWOLException
honor TravisCI(原*) rake test
running: /Users/brad/dev/bwoken/bin/unix_instruments.sh -D /Users/brad/dev/ios/TravisCI/integration/tmp/trace -t /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -v /Users/brad/dev/ios/TravisCI/build/TravisCI.app -e UIASCRIPT /Users/brad/dev/ios/TravisCI/integration/tmp/javascript/iphone/favorites.js -e UIARESULTSPATH /Users/brad/dev/ios/TravisCI/integration/tmp/results
Instruments : Plugin Search Paths (
"/Users/brad/Library/Application Support/Instruments/PlugIns",
"/Library/Application Support/Instruments/PlugIns",
"/Applications/Xcode.app/Contents/Developer/usr/PlugIns",
"/Applications/Xcode.app/Contents/Developer/usr/bin/PlugIns",
"/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns",
"/Applications/Xcode.app/Contents/Developer/Library/Instruments/PlugIns",
# Disable shadow in screenshots
# Run this command from the terminal
defaults write com.apple.screencapture disable-shadow -bool true
# Now you press Cmd-Shift-4 to go into "select a portion of the screen to shoot" mode,
# but press the spacebar and it then switches to "select a window to shoot" mode. Magic!
# From https://raw.github.com/mathiasbynens/dotfiles/master/.osx
#!/usr/bin/env ruby
require 'rack'
require 'raptor'
class Posts
end
class Users
end
@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 {
@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: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 / 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() {
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)