This file contains hidden or 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
| # Tell system when Xcode utilities live: | |
| sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer | |
| # Set "opendiff" as the default mergetool globally: | |
| git config --global merge.tool opendiff |
This file contains hidden or 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
| // For details, see http://mindsea.com/2012/12/18/downscaling-huge-alassets-without-fear-of-sigkill | |
| #import <AssetsLibrary/AssetsLibrary.h> | |
| #import <ImageIO/ImageIO.h> | |
| // Helper methods for thumbnailForAsset:maxPixelSize: | |
| static size_t getAssetBytesCallback(void *info, void *buffer, off_t position, size_t count) { | |
| ALAssetRepresentation *rep = (__bridge id)info; | |
| NSError *error = nil; |
This file contains hidden or 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 DownloadOperation : NSOperation | |
| { | |
| NSURLRequest *request; | |
| NSURLConnection *connection; | |
| NSMutableData *receivedData; | |
| } | |
| @property(readonly) BOOL isExecuting; | |
| @property(readonly) BOOL isFinished; |
This file contains hidden or 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://www.tuaw.com/2011/03/14/use-applescript-to-open-current-safari-url-in-google-chrome/ | |
| -- install FastScripts http://www.red-sweater.com/fastscripts/ and place this AppleScript in the Scripts applications folder for Google Chrome. | |
| -- For me that was ~/Library/Scripts/Applications/Safari | |
| -- You can then assign it a keyboard shortcut. I went with Cmd-Shift-C | |
| property theURL : "" | |
| tell application "Safari" | |
| set theURL to URL of current tab of window 1 | |
| end tell | |
| tell application "Google Chrome" |
This file contains hidden or 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 <UIKit/UIKit.h> | |
| #import <ImageIO/ImageIO.h> | |
| #import <MobileCoreServices/MobileCoreServices.h> | |
| - (void)exportAnimatedGif | |
| { | |
| UIImage *shacho = [UIImage imageNamed:@"shacho.png"]; | |
| UIImage *bucho = [UIImage imageNamed:@"bucho.jpeg"]; | |
| NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"animated.gif"]; |
This file contains hidden or 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 format_time(secs): | |
| return "%d:%02d" % (secs / 60, secs % 60) | |
| def invert(arr): | |
| """ | |
| Make a dictionary that with the array elements as keys and | |
| their positions positions as values. | |
| >>> invert([3, 1, 3, 6]) |
This file contains hidden or 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
| #!/usr/bin/env python | |
| """Compare two aligned images of the same size. | |
| Usage: python compare.py first-image second-image | |
| """ | |
| import sys | |
| from scipy.misc import imread | |
| from scipy.linalg import norm |
This file contains hidden or 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 DownloadOperation : NSOperation | |
| { | |
| NSURLRequest *request; | |
| NSURLConnection *connection; | |
| NSMutableData *receivedData; | |
| } | |
| @property(readonly) BOOL isExecuting; | |
| @property(readonly) BOOL isFinished; |
NewerOlder