func mapViewDidFinishLoadingMap(_ mapView: MGLMapView) {
let source = MGLSource(sourceIdentifier: "source")!
let symbolLayer = MGLSymbolStyleLayer(layerIdentifier: "place-city-sm", source: source)
let url = URL(string: "https://www.mapbox.com/mapbox-gl-js/assets/earthquakes.geojson")!
let options = [MGLGeoJSONClusterOption: NSNumber(booleanLiteral: true),
MGLGeoJSONClusterRadiusOption: NSNumber(integerLiteral: 20),
MGLGeoJSONClusterMaximumZoomLevelOption: NSNumber(integerLiteral: 15)]
let geoJSONSource = MGLGeoJSONSource(sourceIdentifier: "earthquakes", url: url, options: options)
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
/** | |
* | |
* Aaron K. Saunders | |
* twitter: @aaronksaunders | |
* last updated may 23, 2014 | |
* | |
* See more Appcelerator Information on Clearly Innovative Blog | |
* | |
* www.clearlyinnovative.com | |
* blog.clearlyinnovative.com |
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 Parse | |
import Bolts | |
class AuthDelegate:NSObject, PFUserAuthenticationDelegate { | |
func restoreAuthenticationWithAuthData(authData: [String : String]?) -> Bool { | |
return true | |
} | |
} | |
let configuration = ParseClientConfiguration { (configuration) -> Void in |
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 baseUrl = 'https://api.parse.com/1', | |
appId = 'XXXXXXXXXXXXXXX', | |
apiKey = 'XXXXXXXXXXXXXX'; // make sure to use the REST API Key | |
var _register = function(params, lambda, lambdaerror) { | |
var method = 'POST', | |
url = baseUrl + '/installations', | |
payload = (params) ? JSON.stringify(params) : ''; | |
_helper(url, method, payload, function(data, status) { |
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
from enum import Enum, EnumMeta | |
class ChoiceEnumMeta(EnumMeta): | |
def __iter__(self): | |
return ((tag, tag.value) for tag in super().__iter__()) | |
class ChoiceEnum(Enum, metaclass=ChoiceEnumMeta): | |
""" |
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
extension PHPhotoLibrary { | |
typealias PhotoAsset = PHAsset | |
typealias PhotoAlbum = PHAssetCollection | |
static func saveImage(image: UIImage, albumName: String, completion: (PHAsset?)->()) { | |
if let album = self.findAlbum(albumName) { | |
saveImage(image, album: album, completion: completion) | |
return | |
} |
This guide has been updated for Titanium SDK 3.3.0 which uses AppCompat to bring the ActionBar to Android 2.3.x
Android has a build-in theming system. Using this feature you can easily change the base color Android uses for its controls across your app, allowing you to provide better branding and personalization, while maintaining Android's UI and UX.
Android built-in themes are:
- Holo (Mostly Black and Cyan)
- Holo Light (Mostly White and Gray)
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 os | |
import lxml.html as LH | |
import shutil | |
import requests | |
temp_dir = "/tmp/avatar_tmp" | |
if not os.path.isdir("html/avatars"): | |
os.mkdir("html/avatars") | |
if os.path.isdir(temp_dir): |
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
####################################################################### | |
# Setup: | |
# $ python3 -m venv venv | |
# $ source venv/bin/activate | |
# $ pip install requests | |
# Usage: | |
# $ python pgatour.py | |
####################################################################### | |
import os |
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
1. Open Terminal | |
2. cd to your Xcode project | |
3. Execute the following when inside your target project: | |
find . -name "*.swift" -print0 | xargs -0 wc -l |
OlderNewer