- Run:
command+r
- Stop:
command+.
- Run without building:
command+control+r
- Test:
command+u
- Analyse:
command+shift+b
- Clean:
command+shift+k
- Super-clean:
command+alt+shift+k
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
@interface MyViewController() | |
@property (nonatomic, assign) dispatch_source_t timer; | |
- (void)handleTimer; | |
@end | |
@implementation | |
@synthesize timer=timer_; | |
- (id)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
toRemove='someDirectory/* bigFile.txt' | |
# Remove every file that matches $toRemove | |
git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch $toRemove" --prune-empty -- --all | |
# Rebuild the history cache (does not seem to remove big file from the git caches... maybe not required) | |
rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune | |
# Make a clean clone |
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
# First install LWP | |
sudo cpan install LWP | |
# Then add some aliasses, add them to your shell's startup script | |
lwpOptions="-uUsSe" | |
alias GET="lwp-request -m GET $lwpOptions" | |
alias POST="lwp-request -m POST $lwpOptions" | |
alias HEAD="lwp-request -m HEAD $lwpOptions" | |
# Now use them: |
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
// Based upon: http://stackoverflow.com/a/13839284/439096 | |
#import <Foundation/Foundation.h> | |
@interface NSString (split) | |
@property (nonatomic, readonly) NSArray *split; | |
@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
// A factor of 0.5 means that every newValue will have a 50% impact on the average | |
// Usage: self.average = updateRunningAverage(self.average, newValue, 0.3); | |
#define updateRunningAverage(average, newValue, factor) (((newValue) * (factor)) + ((average) * (1.0 - (factor)))) |
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
// | |
// UIResponder+sendAction.h | |
// Berik Visschers | |
// | |
// Created by Berik Visschers on 2013-03-22. | |
// Copyright (c) 2013 Xaton. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
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
def wrap(angle): | |
while angle > 2 * pi: | |
angle -= 2 * pi | |
while angle < 0: | |
angle += 2 * pi | |
return angle | |
def magnetometer_readings_to_tilt_compensated_heading(bx, by, bz, phi, theta, declinationRadians=0): | |
""" Takes in raw magnetometer values, pitch and roll and turns it into a tilt-compensated heading value ranging from -pi to pi (everything in this function should be in radians). | |
The correct value for declinationRadians can be found online: http://magnetic-declination.com/countries.php note that this value is in radians, not in degrees. |
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
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) { | |
// Load resources for iOS 6.1 or earlier | |
} else { | |
// Load resources for iOS 7 or later | |
} | |
// But only in XCode 5 |
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
var applicationActivityIndicators = 0 | |
extension UIApplication { | |
func startActivityIndicator() { | |
applicationActivityIndicators++ | |
UIApplication.sharedApplication().networkActivityIndicatorVisible = true | |
} | |
func stopActivityIndicator() { | |
applicationActivityIndicators-- | |
if applicationActivityIndicators <= 0 { |
OlderNewer