Skip to content

Instantly share code, notes, and snippets.

@boundsj
boundsj / example_swift_geojson_clustering_filters.md
Created September 26, 2016 22:46
Swift GeoJSON + Clustering + Filters Example
    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)
@aaronksaunders
aaronksaunders / TiParse.js
Last active December 3, 2017 11:46
UPDATED PROJECT: http://bit.ly/1p61VRC Tested w/ latest version of parse "parse-1.2.18.js" I took a look at the latest Parse update to the APIs and they have made it even more complex to integrate Appcelerator and Facebook since they have integrated the FB Javascript API into the Parse Module directly.this hack just overrides the FB functions th…
/**
*
* Aaron K. Saunders
* twitter: @aaronksaunders
* last updated may 23, 2014
*
* See more Appcelerator Information on Clearly Innovative Blog
*
* www.clearlyinnovative.com
* blog.clearlyinnovative.com
@flovilmart
flovilmart / Example.swift
Created February 17, 2016 12:46
Authenticate with custom OAuth example
import Parse
import Bolts
class AuthDelegate:NSObject, PFUserAuthenticationDelegate {
func restoreAuthenticationWithAuthData(authData: [String : String]?) -> Bool {
return true
}
}
let configuration = ParseClientConfiguration { (configuration) -> Void in
@mattberg
mattberg / Parse.js
Created September 21, 2012 14:24
Simple Parse REST API module for Titanium
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) {
@treyhunner
treyhunner / choice_enum.py
Created April 9, 2018 23:49
Enum for use with Django ChoiceField
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):
"""
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
}
@ricardoalcocer
ricardoalcocer / themes.md
Last active October 15, 2021 08:10
Changing Android ActionBar Theme and Android Style

Customizing the overall App Style

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)
@droberin
droberin / fix_avatars.py
Created February 9, 2018 15:54
Slack exported conversation avatar replacement with locally downloaded avatars from original URL
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):
@thayton
thayton / pgatour.py
Last active January 24, 2023 03:31
pga tour
#######################################################################
# Setup:
# $ python3 -m venv venv
# $ source venv/bin/activate
# $ pip install requests
# Usage:
# $ python pgatour.py
#######################################################################
import os
@Tokuriku
Tokuriku / Count lines of code in Xcode project
Last active March 9, 2023 23:16 — forked from ccabanero/Count lines of code in Xcode project
Count lines of code in SWIFT Xcode project
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