Skip to content

Instantly share code, notes, and snippets.

View nicobytes's full-sized avatar
🏠
Working from home

Nicolas Molina Monroy nicobytes

🏠
Working from home
View GitHub Profile
@nicobytes
nicobytes / 62-forms-ui.md
Created February 2, 2020 19:11
62 Integrate Validations with Bulma Css

1. Install UI Framework

npm i bulma --save npm i --save @fortawesome/fontawesome-free

2. Inlcude en Angular.json

node_modules/bulma/css/bulma.min.css node_modules/@fortawesome/fontawesome-free/css/fontawesome.min.css

server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
}
@nicobytes
nicobytes / script.py
Last active January 14, 2020 23:24
milestone report gitlab
import requests
project_id = 'xxxxx'
labels = ['New funcionality', 'Support', 'Maintenance']
milestone = 'v1.6.0'
state = 'closed'
url = f'https://gitlab.com/api/v4/projects/{project_id}/issues'
headers = {'Authorization': 'Bearer xxxxxxxx'} # https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#limiting-scopes-of-a-personal-access-token
@nicobytes
nicobytes / 61-form-group-angular.md
Last active May 26, 2023 18:06
Forms en Angular

1. Create Form group

export class FormComponent implements OnInit {

  form: FormGroup;

  constructor() {
    this.buildForm();
  }
@nicobytes
nicobytes / 60-form-control-angular.md
Last active November 8, 2023 05:45
FormControl with Angular

1. Init

ng new angular-forms

2. Create component

ng g c components/product-form
@nicobytes
nicobytes / 58-markers-maps-ionic.md
Last active May 31, 2023 01:51
Multiples markers ionic google maps

1 Add SDK Google Maps

<script src="https://maps.googleapis.com/maps/api/js?key=KEY"></script>

2 Create div in html and declare

declare var google;
import { Injectable } from '@angular/core';
import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/common/http';
import { Observable } from 'rxjs';
@Injectable()
export class AuthInterceptor implements HttpInterceptor {
constructor() { }
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
export class ValidateEmailNotTaken {
static createValidator(signupService: SignupService) {
return (control: AbstractControl) => {
return signupService.checkEmailNotTaken(control.value).map(res => {
return res ? null : { emailTaken: true };
});
};
}
}
static passwordMatchValidator(control: AbstractControl) {
const password: string = control.get('password').value; // get password from our password form control
const confirmPassword: string = control.get('confirmPassword').value; // get password from our confirmPassword form control
// compare is the password math
if (password !== confirmPassword) {
// if they don't match, set an error in our confirmPassword form control
control.get('confirmPassword').setErrors({ NoPassswordMatch: true });
}
}