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 / lighthouse-ci.yml
Created October 29, 2020 22:46
Lighthouse CI
.github/workflows/lighthouse-ci.yml
```yml
name: Lighthouse CI
on: [push]
jobs:
lhci:
name: Lighthouse CI
runs-on: ubuntu-latest
steps:
@nicobytes
nicobytes / map.js
Created October 17, 2020 12:34
MapJS
const numbers = [1,2,3,4];
// Mutable
for (let index = 0; index < numbers.length; index++) {
numbers[index] = numbers[index] + 2;
}
console.log(numbers);
// Inmutable v1
const newNumbers = [];
for (let index = 0; index < numbers.length; index++) {
@nicobytes
nicobytes / steps.md
Last active November 9, 2020 00:41
Performance monitoring with Lighthouse CI

1. Install the Lighthouse CI CLI.

npm install -g @lhci/cli

2.

import { Component, OnInit, forwardRef } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
@Component({
selector: 'app-stepper',
templateUrl: './stepper.component.html',
styleUrls: ['./stepper.component.scss'],
providers: [
{
provide: NG_VALUE_ACCESSOR,

1. Define marker

interface Marker {
  lat: number;
  lng: number;
  title: string;
  image: string;
  text: string;
  markerObj?: any;
@nicobytes
nicobytes / nest-pg.md
Last active February 18, 2022 02:59
NestJS, TypeORM and PostgreSQL
npm install --save @nestjs/typeorm typeorm pg
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { configService } from './config/config.service';
@nicobytes
nicobytes / arrays.md
Last active April 21, 2020 23:14
Arrays

Arrays

Why?

const averageTempJan = 31.9;
const averageTempJan = 35.3;
const averageTempMar = 42.4;
const averageTempApr = 52;
@nicobytes
nicobytes / steps.md
Last active October 4, 2022 17:14
Scale app with Docker Sawrm
  1. Create machines / nodes
node-01
node-02
node-03
  1. Update machine

service

@Injectable({
  providedIn: 'root'
})
export class UserService {

  constructor(
    private http: HttpClient
@nicobytes
nicobytes / 65-custom-validations.md
Last active June 14, 2021 21:18
Custom validations in Angular
import { AbstractControl } from '@angular/forms';

export class MyValidations {

  static age(control: AbstractControl) {
    const value = control.value;
    if (value < 18) {
      return {isYoung: true};
 }