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
// The Core Location example in Beginning iPhone 4 Development shows how to | |
// calculate a distance from a starting point, but it doesn't show how far you've | |
// actually traveled. These changes should let you see an accumulated distance. | |
// Add this to the interface declaration in WhereAmIViewController.h: | |
CLLocationDistance totalDistance; | |
// then replace the last chunk of locationManager:didUpdateToLocation:fromLocation: | |
// with this: |
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
/* | |
* This gives something resembling an average of the last 1/k values. A k-value of 0.5 will | |
* give the current values equal weight with the previous smooth values, while a k-value of | |
* 0.9 will let the current values only account for 10% of the new smooth value. | |
* | |
* This approach probably consumes a little less memory, and calculates a little faster, | |
* than actually keeping an array of old values. | |
*/ | |
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration { | |
CGFloat x = acceleration.x; |
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 | |
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE") | |
buildNumber=$((0x$buildNumber)) | |
buildNumber=$(($buildNumber + 1)) | |
buildNumber=$(printf "%X" $buildNumber) | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_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
class A { | |
func foo() -> String { | |
return "A foo" | |
} | |
} | |
class B: A { | |
override func foo() -> String { | |
return "B foo" | |
} |
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
All about that Spec | |
Yeah, it's pretty clear / I've made an app or two | |
And I can TDD it / Like I'm supposed to do | |
I do that red-green / Refactor most days | |
All the right tests / In all the right places | |
I see them old-timers / Working that FORTRAN shop | |
We know that shit ain't real / C'mon now make it stop | |
If you've got agile methods / Just raise em up |
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
[Ll]ibrary/ | |
[Tt]emp/ | |
[Oo]bj/ | |
ExportedObj/ | |
# Autogenerated VS/MD solution and project files | |
*.csproj | |
*.unityproj | |
*.sln |
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
White Space | |
(sung to the tune of Taylor Swift’s “Blank Space”) | |
[Verse 1:] | |
Nice to meet you | |
where you been? | |
I can show you incredible things | |
Cocoa, ruby, ember, vim | |
Saw you there and I thought, | |
oh my god look at that noob, |
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
# Mostly from http://reinh.com/blog/2009/03/02/a-git-workflow-for-agile-teams.html | |
# See also https://github.com/thoughtbot/guides/blob/master/protocol/git/README.md | |
# Make a branch called feature_name | |
git checkout -b feature_name | |
# Assuming we are working in a branch called "feature_name”. | |
# Rebase against master frequently (maybe daily, or whenever you're at | |
# a good stopping point), to avoid conflicts at the end: |
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 | |
# | |
# A post-build script for running in Xcode, to overlay app icons with some build info. | |
# Requires ImageMagick to be installed before use. | |
commit=`git rev-parse --short HEAD` | |
branch=`git rev-parse --abbrev-ref HEAD` | |
version=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}"` | |
function processIcon() { |
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 | |
# | |
# Run this as an Xcode build phase in order to always set the build number | |
# of a freshly-built app equal to the number of commits in the master branch. | |
# This gives you an always-increasing build number, automatically. | |
# | |
# This sets the build number only in the build product, not in the source | |
# directory itself, so it doesn't dirty the repository. You can leave the | |
# build number in the Xcode project to "1" forever. |
OlderNewer