This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Newbie programmer | |
def factorial(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * factorial(x - 1) | |
print factorial(6) | |
#First year programmer, studied Pascal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// © 2008 Eugene Solodovnykov | |
// http://idevblog.info/mobileprovision-files-structure-and-reading/ | |
// | |
#import <Foundation/Foundation.h> | |
int main (int argc, const char * argv[]) { | |
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// From http://stackoverflow.com/questions/4442126/how-to-draw-a-speech-bubble-on-an-iphone | |
// | |
void DrawPopupShapeInRect(CGRect rect, CGColorRef borderColor, CGColorRef backgroundColor, CGFloat borderRadius, CGFloat strokeWidth, CGFloat pointerWidth, CGFloat pointerHeight) | |
{ | |
CGRect currentFrame = self.bounds; | |
CGContextSetLineJoin(context, kCGLineJoinRound); | |
CGContextSetLineWidth(context, strokeWidth); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# run this in ~/Library/Logs/CrashReporter/MobileDevice | |
pth=${0%*/*} | |
cd "$pth" | |
#echo "$@" | |
if [ -z "$1" ]; then | |
find . -name "*.crash" | while read file; | |
do | |
echo "converting $file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc 'Remove unused images' | |
task :clean_assets do | |
require 'set' | |
all = Set.new | |
used = Set.new | |
unused = Set.new | |
# White list | |
used.merge %w{Icon Icon-29 Icon-50 Icon-58 Icon-72 Icon-114} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: new-github topfunky tidy_table | |
function new-github() { | |
git remote add origin [email protected]:$1/$2.git | |
git push origin master | |
git config branch.master.remote origin | |
git config branch.master.merge refs/heads/master | |
git config push.default current | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// BaseViewController.m | |
// | |
// Created by Peter Boctor on 5/4/11. | |
// | |
// Copyright (c) 2011 Peter Boctor | |
// | |
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SSH Connection pooling for faster additional connections to a machine | |
ControlMaster auto | |
ControlPath /tmp/ssh_mux_%h_%p_%r | |
# This makes subsequent connections go faster | |
ControlPersist 2h | |
# Make it so ssh-ing from one server to another passes keys around automagically | |
Host * | |
ForwardAgent yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
dir = "$1" | |
keyword = "$2" | |
find "$dir" -name '$keyword' -exec rm -i {} \; |
OlderNewer