Skip to content

Instantly share code, notes, and snippets.

View 1ec5's full-sized avatar
🙈
Not actively reading bugmail

Minh Nguyễn 1ec5

🙈
Not actively reading bugmail
View GitHub Profile
@1ec5
1ec5 / nspredicate-filter.md
Last active July 11, 2016 07:07
Correspondence between NSPredicate types and Mapbox Style Specification filter forms
Filter form NSPredicateOperatorType/NSCompoundPredicateType
has NSContainsPredicateOperatorType
!has NSNotPredicateType(NSContainsPredicateOperatorType)
== NSEqualToPredicateOperatorType
!= NSNotEqualToPredicateOperatorType
> NSGreaterThanPredicateOperatorType
>= NSGreaterThanOrEqualToPredicateOperatorType
< NSLessThanPredicateOperatorType
<= NSLessThanOrEqualToPredicateOperatorType
Sampling process 57615 for 1 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Mapbox GL (pid 57615) every 1 millisecond
Process: Mapbox GL [57615]
Path: /Users/mxn/hub/mapbox-gl-native-2/build/macos/Build/Products/Debug/Mapbox GL.app/Contents/MacOS/Mapbox GL
Load Address: 0x100000000
Identifier: com.mapbox.MapboxGL
Version: 0.1.0 (1)
Code Type: X86-64
Parent Process: debugserver [57616]
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 6158a9a..0af52af 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -30,6 +30,18 @@ static NSString * const MBXViewControllerAnnotationViewReuseIdentifer = @"MBXVie
@implementation MBXCustomCalloutAnnotation
@end
+@interface MBXArrowFillPolyline : MGLPolyline
+@end
@1ec5
1ec5 / boldedit.md
Created August 31, 2016 23:04
Be bold and edit the map

OpenStreetMap is a freely licensed, freely editable map of the world. The Wikimedia and OpenStreetMap projects have a lot of superficial similarities: wiki-style editing, a free license, multilingualism, vandalism, countervandalism, bots, and – of course – interminable naming debates. There are also some important structural differences: in the case of OpenStreetMap, a decentralized administrative team and software ecosystem, an emphasis on original research over secondary sources, and no notability guidelines whatsoever. Yet these two movements complement each other in numerous ways.

This talk aims to provide a proper introduction to the OpenStreetMap community from the eyes of a Wikipedian. Due to time constraints, it assumes passing familiarity with OpenStreetMap and how to edit it (hint: click the Edit tab). We’ll go over key processes and cultural norms and why they exist, drawing parallels to the Wikimedia community’s own experi

@1ec5
1ec5 / token_repl.swift
Created November 7, 2016 19:46
Replacing tokens in Swift
import Foundation
// http://stackoverflow.com/a/30404532/4585461
extension String {
func nsRange(from range: Range<String.Index>) -> NSRange {
let from = range.lowerBound.samePosition(in: utf16)
let to = range.upperBound.samePosition(in: utf16)
return NSRange(location: utf16.distance(from: utf16.startIndex, to: from),
length: utf16.distance(from: from, to: to))
}
@1ec5
1ec5 / token_scanner.swift
Last active November 7, 2016 20:04
Replacing tokens in Swift using Scanner
var instructions = "⚠️ Veer {direction} at the 🐃 crossing"
let scanner = Scanner(string: instructions)
scanner.charactersToBeSkipped = nil
var result = ""
while !scanner.isAtEnd {
var buffer: NSString?
if scanner.scanUpTo("{", into: &buffer) {
result += buffer as! String
}
@1ec5
1ec5 / NSExpression+MGLAdditions.mm
Last active February 17, 2017 00:30
UIColor attribute conversion
diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm
index c54102b8c..a7759cda9 100644
--- a/platform/darwin/src/NSExpression+MGLAdditions.mm
+++ b/platform/darwin/src/NSExpression+MGLAdditions.mm
@@ -1,5 +1,12 @@
#import "NSExpression+MGLAdditions.h"
+#import "MGLTypes.h"
+#if TARGET_OS_IPHONE
+ #import "UIColor+MGLAdditions.h"
@1ec5
1ec5 / macos.md
Created March 3, 2017 01:58
Applications using the Mapbox macOS SDK
@1ec5
1ec5 / tvos.log
Created March 13, 2017 11:19
Warnings on 1ec5-tvos branch of mapbox-gl-native
Deprecations Group
/Users/mxn/hub/mapbox-gl-native-2/platform/ios/src/MGLMapView.mm:1058:22: 'frameInterval' is deprecated: first deprecated in tvOS 10.0 - use preferredFramesPerSecond
/Users/mxn/hub/mapbox-gl-native-2/platform/ios/src/MGLMapView.mm:1949:52: 'openURL:' is deprecated: first deprecated in tvOS 10.0 - Please use openURL:options:completionHandler: instead
Semantic Issue Group
/Users/mxn/hub/mapbox-gl-native-2/platform/ios/src/MGLMapView.mm:4285:13: Enumeration values 'MGLUserTrackingModeFollowWithHeading' and 'MGLUserTrackingModeFollowWithCourse' not handled in switch
Apple Mach-O Linker Warning Group
ld: warning: URGENT: building for tvOS simulator, but linking in object file (/Users/mxn/hub/mapbox-gl-native-2/mason_packages/ios-8.0/icu/58.1-min-size/lib/libicuuc.a(utypes.ao)) built for iOS. Note: This will be an error in the future.
ld: warning: URGENT: building for tvOS simulator, but linking in object file (/Users/mxn/hub/mapbox-gl-native-2/mason_packages/ios-8.0/icu/58.1-min-size/lib/libicu