Skip to content

Instantly share code, notes, and snippets.

View darwin-morocho's full-sized avatar

Darwin Morocho darwin-morocho

View GitHub Profile
@darwin-morocho
darwin-morocho / GPSModule.java
Created June 26, 2018 03:41
Modulo Nativo React Native para usar el GPS en Android
package ec.dina.nearbyfind.gpsmodule;
import android.app.Activity;
import android.app.Service;
import android.content.Intent;
import android.content.IntentSender;
import android.location.Location;
import android.os.Bundle;
import 'dart:math' as math;
class Coord {
final double lat, lng;
Coord(this.lat, this.lng);
}
class GeolocationUtils {
///decode the google encoded string using Encoded Polyline Algorithm Format
/// for more info about the algorithm check https://developers.google.com/maps/documentation/utilities/polylinealgorithm
  npm i -D ts-node nodemon typescript  
npm i jsonwebtoken cors express
tsc --init 
class WebRTCConfig {
static const Map<String, dynamic> mediaConstraints = {
'audio': true,
'video': {
'mandatory': {
'minWidth': '480', // Provide your own width, height and frame rate here
'minHeight': '640',
'minFrameRate': '30',
},
'facingMode': 'user',
@darwin-morocho
darwin-morocho / multi_image_picker_filepath_solucion.md
Last active April 4, 2020 23:27
Solución multi_image_picker cuando se trata de acceder al método get filePath de una instancia de la clase Asset

Cuando recorremos la lista de assets dentro del bucle for(Asset asset in assets) tenemos la siguiente linea la cual ahora es invalida

final path = await asset.filePath;

asset.filePath se utilizaba para obtener el path (la ruta) de la imagen la cual tambien nos proveía de el nombre de la imagen y la extension (jpg, png, gif)

debido a problemas de compatibilidad con ios 13 fue removido.

Elimine el siguiente codigo

[
{
"zone": "Quito",
"polygon": [
{
"lat": -0.047370063279951635,
"lng": -78.3330900592032
},
{
"lat": -0.07002935299841169,
[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+
r'^
(?=.*[A-Z]) // should contain at least one upper case
(?=.*[a-z]) // should contain at least one lower case
(?=.*?[0-9]) // should contain at least one digit
(?=.*?[!@#\$&*~]) // should contain at least one Special character
.{8,} // Must be at least 8 characters in length

MongoDB

Es una base de datos documental (NoSQL) de escalado facil y gran performance. Los datos se guardan como un JSON.

Document

cada dato guardado en una base mongo se le conoce como documento.

Collection

Crear usuario

adduser username

Agregar permission de administrador

usermod -aG sudo username

@darwin-morocho
darwin-morocho / geolocator_wrapper.dart
Last active September 2, 2022 12:25
Flutter - A class to wrap the static methods of the geolocator plugin, with this you can mock the wrapper for unit testing or widget testing
import 'dart:async';
import 'package:geolocator/geolocator.dart';
class GeolocatorWrapper {
StreamController<Position>? _positionController;
StreamController<bool>? _serviceEnabledController;
StreamSubscription? _positionSubscription, _serviceEnabledSubscription;
/// check if the Location Service is Enabled
Future<bool> get isLocationServiceEnabled => Geolocator.isLocationServiceEnabled();