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
Hasans-MacBook-Pro-2:mapbox-gl-native hasan$ ls -l | |
total 80 | |
-rw-r--r-- 1 hasan staff 1311 Jun 9 14:33 LICENSE.md | |
-rw-r--r-- 1 hasan staff 3480 Jun 9 14:33 Makefile | |
-rw-r--r-- 1 hasan staff 3960 Jun 9 14:33 README.md | |
drwxr-xr-x 8 hasan staff 272 Jun 9 14:33 bin | |
drwxr-xr-x 11 hasan staff 374 Jun 9 14:33 common | |
-rw-r--r-- 1 hasan staff 1362 Jun 9 14:33 common.gypi | |
drwxr-xr-x 3 hasan staff 102 Jun 9 14:33 config | |
-rwxr-xr-x 1 hasan staff 3749 Jun 9 14:33 configure |
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
// | |
// ASTransitionAnimator.m | |
// Maps | |
// | |
// Created by Hasan on 6/16/14. | |
// Copyright (c) 2014 AssembleLabs. All rights reserved. | |
// | |
#import "ASSlideUpTransitionAnimator.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
/** | |
Show prefs on top of the map | |
*/ | |
-(IBAction) tapShowMenu:(id)sender | |
{ | |
ASMapPrefsViewController* prefsController = [[ASMapPrefsViewController alloc] initWithMap:self.map]; | |
[prefsController setTransitioningDelegate:self]; | |
[prefsController setModalPresentationStyle:UIModalPresentationCustom]; | |
[self presentViewController:prefsController animated:YES completion:NULL]; |
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
//MARK: AVCaptureMetadataOutputObjectsDelegate | |
func captureOutput(captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [AnyObject]!, fromConnection connection: AVCaptureConnection!) { | |
for metadata in metadataObjects { | |
for barcodeType in self.allowedBarcodes { | |
if metadata.type == barcodeType { | |
let barcode = (metadata as AVMetadataMachineReadableCodeObject).stringValue as String? | |
self.session.stopRunning() | |
if self.delegate != nil { | |
self.delegate!.didScanBarcode(barcode!) |
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
let allowedBarcodes = [AVMetadataObjectTypeUPCECode, | |
AVMetadataObjectTypeCode39Code, | |
AVMetadataObjectTypeCode39Mod43Code, | |
AVMetadataObjectTypeEAN13Code, | |
AVMetadataObjectTypeEAN8Code, | |
AVMetadataObjectTypeCode93Code, | |
AVMetadataObjectTypeCode128Code, | |
AVMetadataObjectTypePDF417Code, | |
AVMetadataObjectTypeQRCode, | |
AVMetadataObjectTypeAztecCode |
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
let camera = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo) | |
var error : NSError? = nil | |
let cameraInput : AVCaptureDeviceInput? = AVCaptureDeviceInput.deviceInputWithDevice(camera, error: &error) as? AVCaptureDeviceInput | |
self.session.addInput(cameraInput) | |
if error != nil || cameraInput == nil { | |
//Awesome error handling :D | |
println(error!.localizedDescription) | |
} | |
else { |
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 💩💩💩💩 { | |
func 💩💩💩(😎: Int, 🐯: Int) -> Int { | |
return 😎 + 🐯; | |
} | |
} | |
let 🐔 = 3; | |
let 😥 = 🐔 + 2; | |
let 💩 = 💩💩💩💩(); | |
print(💩.💩💩💩(🐔, 🐯:😥)); |
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
-(void) pixelsFromImage:(NSImage*)image | |
withCompletion:(void(^)(UInt32 *pixels, NSUInteger pixelCount))completion { | |
//Extract pixels from the image in a 1D array | |
CFDataRef inputData = (__bridge CFDataRef)[image TIFFRepresentation]; | |
CGImageSourceRef inputSource = CGImageSourceCreateWithData(inputData, NULL); | |
CGImageRef inputCGImage = CGImageSourceCreateImageAtIndex(inputSource, 0, NULL); | |
NSUInteger width = CGImageGetWidth(inputCGImage); | |
NSUInteger height = CGImageGetHeight(inputCGImage); | |
NSUInteger numberOfPixels = height * width; |
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
-(void) fetchDominantColorFromImage:(NSImage*)image withCompletion:(void(^)(NSColor *color, NSTimeInterval processingTime))completion { | |
... | |
__weak typeof(self) weakMe = self; | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ | |
[weakMe pixelsFromImage:image withCompletion:^(UInt32 *pixels, NSUInteger pixelCount) { | |
.... |
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
//Divide up the work among workers | |
NSUInteger numberOfWorkers = 4; | |
NSUInteger pixelsPerWorker = pixelCount/numberOfWorkers; | |
for (NSUInteger worker = 0; worker < numberOfWorkers; worker++) { | |
//Submit work blocks to be executed concurrently | |
dispatch_async(weakMe.concurrentQueue, ^{ | |
//Add the colors result to a trie data strucuture whose leaf is the counter, O(1) baby |
OlderNewer