Skip to content

Instantly share code, notes, and snippets.

View jjvillavicencio's full-sized avatar

John Villavicencio jjvillavicencio

View GitHub Profile
@jjvillavicencio
jjvillavicencio / main.dart
Created October 22, 2019 20:09 — forked from RajaShanmugamJM/main.dart
Polyline support in Google Maps Flutter
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
void main() => runApp(Main());
class Main extends StatefulWidget {
@override
_MainState createState() => _MainState();
@jjvillavicencio
jjvillavicencio / dots_indicator.dart
Created July 26, 2019 17:14 — forked from dnys1/dots_indicator.dart
Carousel widget in Flutter
import 'dart:math';
import 'package:flutter/material.dart';
class DotsIndicator extends AnimatedWidget {
const DotsIndicator({
@required this.controller,
@required this.itemCount,
@required this.onPageSelected,
this.color = Colors.white,
import { AbstractControl, ValidatorFn } from '@angular/forms';
import libphonenumber from 'google-libphonenumber';
export class PhoneValidator {
// Inspired on: https://github.com/yuyang041060120/ng2-validation/blob/master/src/equal-to/validator.ts
static validCountryPhone = (countryControl: AbstractControl): ValidatorFn => {
let subscribe: boolean = false;
return (phoneControl: AbstractControl): {[key: string]: boolean} => {
@jjvillavicencio
jjvillavicencio / phone.validator.ts
Created April 23, 2019 19:05 — forked from djabif/phone.validator.ts
Angular Phone + Country Validator
//Complete example for Ionic Framework in: https://ionicthemes.com/tutorials/about/forms-and-validation-in-ionic
//Complete example for Angular 5 in: https://angular-templates.io/tutorials/about/angular-forms-and-validations
import { AbstractControl, ValidatorFn } from '@angular/forms';
import * as libphonenumber from 'google-libphonenumber';
export class PhoneValidator {
// Inspired on: https://github.com/yuyang041060120/ng2-validation/blob/master/src/equal-to/validator.ts
static validCountryPhone = (countryControl: AbstractControl): ValidatorFn => {
@jjvillavicencio
jjvillavicencio / password.validator.ts
Created April 23, 2019 19:04 — forked from djabif/password.validator.ts
Password Validator for ionic apps
import { FormControl, FormGroup } from '@angular/forms';
export class PasswordValidator {
static areEqual(formGroup: FormGroup) {
let val;
let valid = true;
for (let key in formGroup.controls) {
if (formGroup.controls.hasOwnProperty(key)) {
let control: FormControl = <FormControl>formGroup.controls[key];
@jjvillavicencio
jjvillavicencio / form.ts
Created April 23, 2019 19:04 — forked from djabif/form.ts
Ionic Password validator
import { PasswordValidator } from '../../validators/password.validator';
this.matching_passwords_group = new FormGroup({
password: new FormControl('', Validators.compose([
Validators.minLength(5),
Validators.required,
Validators.pattern('^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]+$') //this is for the letters (both uppercase and lowercase) and numbers validation
])),
confirm_password: new FormControl('', Validators.required)
}, (formGroup: FormGroup) => {
return PasswordValidator.areEqual(formGroup);
@jjvillavicencio
jjvillavicencio / README-Template.md
Created April 18, 2019 03:47 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@jjvillavicencio
jjvillavicencio / mysql_backup_cron.sh
Created December 10, 2018 16:05 — forked from jabranr/mysql_backup_cron.sh
Automatic MySQL dump and backup to Git repo cron job
#!/bin/sh
#
# @author: Jabran Rafique <hello@jabran.me>
# @link: http://jabran.me/articles/automatic-database-backup-using-git-hosting/
# Set variables
FULLDATE = $(date +"%Y-%d-%m %H:%M")
NOW = $(date +"%Y-%m-%d-%H-%M")
MYSQL_DUMP = `which mysqldump`
GIT = `which git`