Skip to content

Instantly share code, notes, and snippets.

View marknorgren's full-sized avatar

Mark Norgren marknorgren

View GitHub Profile
@marknorgren
marknorgren / xcode-git-version.sh
Created January 23, 2012 23:12 — forked from jpwatts/xcode-git-version.sh
This Xcode 4 build phase script automatically sets the version and short version string of an application bundle based on information from the containing Git repository.
#!/bin/bash
# This script automatically sets the version and short version string of
# an Xcode project from the Git repository containing the project.
#
# To use this script in Xcode 4, add the contents to a "Run Script" build
# phase for your application target.
set -o errexit
set -o nounset
@marknorgren
marknorgren / cleanup.sh
Created April 18, 2012 19:39
Panacea for slow Xcode
#!/bin/sh
for f in $(ls -p ~/Library/Application\ Support/iPhone\ Simulator/| grep '/') ; do
if [ "$f" != 'User/' ]; then
echo "$f"
rm -r ~/Library/Application\ Support/iPhone\ Simulator/$f
mkdir ~/Library/Application\ Support/iPhone\ Simulator/$f
fi
done
rm -r ~/Library/Developer/Xcode/DerivedData
@marknorgren
marknorgren / objc.cfg
Created October 16, 2012 13:40 — forked from tszming/objc.cfg
My uncrustify config file for objective-c
#
# uncrustify config file for objective-c and objective-c++
#
indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs
output_tab_size = 4 # new tab size
indent_columns = output_tab_size
indent_label = 2 # pos: absolute col, neg: relative column
indent_align_assign = FALSE
+ (NSString *)timeIntervalToStringWithInterval:(NSTimeInterval)interval
{
NSString *retVal = @"At time of event";
if (interval == 0) return retVal;
int second = 1;
int minute = second*60;
int hour = minute*60;
int day = hour*24;
// interval can be before (negative) or after (positive)
#!/bin/bash
#
# (Above line comes out when placing in Xcode scheme)
#
# Inspired by original script by incanus:
# https://gist.github.com/1186990
#
# Rewritten by martijnthe:
# https://gist.github.com/1379127
#
@marknorgren
marknorgren / fix-xcode
Last active December 23, 2015 09:59 — forked from rnapier/fix-xcode
#!/usr/bin/python
# fix-xcode
# Rob Napier <robnapier@gmail.com>
# Updates - Mark Norgren <mark@marknorgren.com>
# Script to link in all your old SDKs every time you upgrade Xcode
# Create a directory called /SDKs (or modify source_path).
# Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
@marknorgren
marknorgren / index.html
Created September 20, 2013 18:41 — forked from enjalot/brush.js
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<style>
svg {
width: 960px;
height: 500px;
border: 1px solid gray;
}
#!/bin/sh
PORT=4200
sudo launchctl unload /Library/LaunchDaemons/com.crashplan.engine.plist
sudo sed -i '' "s/\(<servicePort>\)[^<]*/\1$PORT/" /Library/Application\ Support/CrashPlan/conf/my.service.xml
sed -i '' "s/#*\(servicePort=\).*/\1$PORT/" /Applications/CrashPlan.app/Contents/Resources/Java/conf/ui.properties
defaults write /Applications/CrashPlan.app/Contents/Resources/CrashPlan\ menu\ bar.app/Contents/Info CPPort $PORT
sudo launchctl load /Library/LaunchDaemons/com.crashplan.engine.plist
#
# Uncrustify Configuration File
# File Created With UncrustifyX 0.2 (140)
#
# Alignment
# ---------
## Alignment
# Detailed explanation at http://hitesh.in/2011/running-a-bottle-py-app-on-dreamhost/
#1. Add current directory to path, if isn't already
import os, sys
cmd_folder = os.path.dirname(os.path.abspath(__file__))
if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)
import bottle
from bottle import route, run