This file contains hidden or 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 'dart:ui'; | |
extension StringLocalizedCase on String { | |
String toLocalizedUpperCase(Locale locale) { | |
if (locale.languageCode == 'tr' || locale.languageCode == 'az') { | |
return replaceAll('i', 'İ').replaceAll('ı', 'I').toUpperCase(); | |
} | |
return toUpperCase(); | |
} |
This file contains hidden or 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 'package:google_maps_flutter/google_maps_flutter.dart'; | |
List<LatLng> polylineDecode(String polyline) { | |
final codeUnits = polyline.codeUnits; | |
final len = codeUnits.length; | |
// For speed we preallocate to an upper bound on the final length, then | |
// truncate the array before returning. | |
final path = <LatLng>[]; | |
var index = 0; |
This file contains hidden or 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 'dart:async'; | |
import 'dart:math'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter_svg/svg.dart'; | |
import 'package:google_maps_flutter/google_maps_flutter.dart'; | |
/// A button resembling the built-in 'compass' indicator from Google Maps SDK. | |
/// This supports both light and dark themes. Requires material, | |
/// google_maps_flutter and flutter_svg. |
This file contains hidden or 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 android.content.Context | |
import com.google.android.gms.maps.GoogleMap | |
import com.google.android.gms.maps.SupportMapFragment | |
import io.reactivex.Observable | |
import io.reactivex.Single | |
import io.reactivex.disposables.Disposables | |
@androidx.annotation.CheckResult | |
fun SupportMapFragment.map(): Single<GoogleMap> = | |
Single.create { emitter -> |
This file contains hidden or 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 io.reactivex.Observable | |
import io.reactivex.Single | |
import io.reactivex.disposables.Disposables | |
import io.socket.client.IO | |
import io.socket.client.Socket | |
import io.socket.emitter.Emitter | |
class RxIO(uri: String) { | |
private val socket = IO.socket(uri) |
This file contains hidden or 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 android.content.DialogInterface | |
import androidx.appcompat.app.AlertDialog | |
import com.jakewharton.rxbinding2.view.clicks | |
import io.reactivex.Maybe | |
import io.reactivex.Single | |
/** | |
* Sets the dialog non-cancelable. Emits either {@link DialogInterface#BUTTON_POSITIVE}, | |
* {@link DialogInterface#BUTTON_NEGATIVE} or {@link DialogInterface#BUTTON_NEUTRAL} and dismisses | |
* the dialog. |
This file contains hidden or 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 android.content.res.Resources | |
import android.util.TypedValue | |
object OneDp { | |
fun init(resources: Resources) { | |
oneDp = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1f, resources.displayMetrics) | |
} | |
} | |
private var oneDp = 0f |
This file contains hidden or 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 'dart:math'; | |
import 'package:flutter/material.dart'; | |
class RatingBar extends StatelessWidget { | |
RatingBar({this.numStars = 5, this.rating = 0.0, this.onChanged}); | |
final int numStars; | |
final double rating; | |
final ValueChanged<double> onChanged; |
This file contains hidden or 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 fs = require("fs"); | |
var xml2js = require("xml2js"); | |
var gpx = process.argv[2]; | |
// https://gist.github.com/wteuber/6241786 | |
Math.fmod = function(a, b) { | |
return Number((a - (Math.floor(a / b) * b)).toPrecision(8)); | |
}; |
NewerOlder