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
import sys, math, random | |
class Point: | |
def __init__(self, coords, reference=None): | |
self.coords = coords | |
self.n = len(coords) | |
self.reference = reference | |
def __repr__(self): | |
return str(self.coords) |
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
// Error reported in http://stackoverflow.com/questions/23819466/error-return-address-clgeocoder | |
NSString *anAddressString = @"568 Broadway, New York, NY" | |
CLGeocoder *geocoder = [[CLGeocoder alloc] init]; | |
void (^geocodeBlock)(NSArray *placemarks, NSError *error) = ^(NSArray *placemarks, NSError *error) { | |
if (error) { | |
/* | |
* Printing error gets -> Error Domain=kCLErrorDomain Code=2 "The operation couldn’t be |
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
// Set startFrame and endFrame for _contentView | |
CGRect endFrame = _contentView.frame; | |
CGRect startFrame = endFrame; | |
startFrame.origin.y = -startFrame.size.height; | |
_contentView.frame = startFrame; | |
void (^animationBlock)(void) = ^(void){ | |
_contentView.frame = endFrame; | |
}; |
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
# Add Git Repository as a subRepository | |
git submodule add git@mygithost:billboard lib/billboard |
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
// found in http://www.cocos2d-iphone.org/forum/topic/9138 | |
CGFloat GBDot(const CGPoint v1, const CGPoint v2) { | |
return v1.x*v2.x + v1.y*v2.y; | |
} | |
CGPoint GBSub(const CGPoint v1, const CGPoint v2) { | |
return CGPointMake(v1.x - v2.x, v1.y - v2.y); | |
} |
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 | |
# Found at http://gr3p.com/2012/06/encontrar-recursos-no-usados-en-un-proyecto-de-xcode | |
for i in `find . -name "*.png" -o -name "*.jpg"`; do | |
file=`basename -s .jpg "$i" | xargs basename -s .png | xargs basename -s @2x` | |
result=`ack -i "$file"` | |
if [ -z "$result" ]; then | |
echo "$i" | |
fi |
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
__attribute__ ((deprecated)) |
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
git init | |
git remote add origin https://github.com/username/Hello-World.git | |
#make some commits here | |
git push origin master |
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
-(NSString *) currentSong { | |
NSString *retVal = nil; | |
MPMusicPlayerController* iPodMusicPlayer = [MPMusicPlayerController iPodMusicPlayer]; | |
MPMediaItem *mediaItem = [iPodMusicPlayer nowPlayingItem]; | |
if (mediaItem) { | |
NSString *artist = [mediaItem valueForProperty: MPMediaItemPropertyArtist]; | |
NSString *song = [mediaItem valueForProperty: MPMediaItemPropertyTitle]; | |
retVal = [NSString stringWithFormat:@"NLT: %@ - %@", song, artist]; |
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
#GET | |
curl -HAccept:text/plain http://example.com/base | |
#PUT | |
curl -XPUT -HContent-type:text/plain --data "stuff:morestuff" http://example.com/base?param=val | |
#DELETE | |
curl -XDELETE http://example.com/base/user/123 | |
#POST |
OlderNewer