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 Double { | |
var degreesToRadians: CGFloat { | |
return CGFloat(self) * CGFloat(M_PI) / 180.0 | |
} | |
} | |
extension CLLocationCoordinate2D { | |
func distanceFromCoordinateInMeters(coordinate: CLLocationCoordinate2D) -> Double { | |
// Haversine forumla. https://en.wikipedia.org/wiki/Haversine_formula |
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 Foundation | |
import Mapbox | |
import RxCocoa | |
import RxSwift | |
import UIKit | |
class RxMGLMapViewDelegateProxy: DelegateProxy, MGLMapViewDelegate, DelegateProxyType { | |
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 RxSwift | |
extension ObservableType { | |
func rateLimit(rate: NSTimeInterval) -> Observable<E> { | |
let scheduler = MainScheduler.sharedInstance | |
var lastEmit = NSDate() | |
return filter { _ in | |
return scheduler.now.timeIntervalSinceDate(lastEmit) > rate | |
} |
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
// Say we have an Alamofire request we want to consume as an Observable.. | |
func fooAsObservable(URL: String, headers: [String: AnyObject?]) -> Observable<Foo> { | |
return create { observer in | |
let request = Alamofire(.GET, URL, headers: headers | |
.responseJSON(completionHandler: { (_, _, result) in | |
switch result { |
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
// Say you have two observables (Bar and Baz) you want to combine into a single output (Foo) | |
public Observable<Foo> combineObservables(Observable<Bar> barObservable, Observable<Baz> bazObservable) { | |
return Observable.zip( | |
barObservable, | |
bazObservable, | |
new Func2<Bar, Baz, Foo>() { | |
@Override |
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
# Terminal color and style | |
export PS1="\[\033[36m\]\u:\[\033[33;1m\]\w\[\033[m\]\$ " | |
export CLICOLOR=1 | |
export LSCOLORS=ExFxBxDxCxegedabagacad | |
# Aliases | |
alias ll='ls -alGFh' | |
alias gemlist='gem list | egrep -v "^( |$)"' | |
alias hist="history | grep -E -v '^ *[0-9]+ *h ' | grep " |
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
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css"> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.4/leaflet.css"> | |
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.4/leaflet.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.5.2/umd/react.production.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.5.2/umd/react-dom.production.min.js"></script> |
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 React, { Component } from 'react' | |
import { Map, TileLayer } from 'react-leaflet' | |
import ExampleComponent from 'react-leaflet-editable-circle' | |
export default class App extends Component { | |
render () { | |
return ( | |
<div className="map"> | |
<Map |
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 React, { Component } from 'react' | |
import { Map, TileLayer } from 'react-leaflet' | |
import ExampleComponent from 'react-leaflet-editable-circle' | |
export default class App extends Component { | |
render () { | |
return ( | |
<div className="map"> | |
<Map |
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
.leaflet-container { | |
height: 100vh; | |
width: 100%; | |
} |
OlderNewer