Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Nicolas Molina Monroy nicobytes

🏠
Working from home
View GitHub Profile
@nicobytes
nicobytes / type-orm_nestjs.md
Last active Jan 25, 2021
Steps: TypeOrm + NestJs
View type-orm_nestjs.md

1. Create project

npm i -g @nestjs/cli
nest new tasks-api
npm run start:dev

2. Overview and delete files

3. Create module

nest g mo tasks
View reduce.js
const data = [1,3,4,5];
const rta = data.reduce((counter, item) => counter + item, 0);
console.log(rta);
const orders = [
{
customerName: 'Nicolas',
total: 60,
delivered: true,
},
View filter.js
const orders = [
{
customerName: 'Nicolas',
total: 60,
delivered: true,
},
{
customerName: 'Zulema',
total: 120,
delivered: false,
View lighthouse-ci.yml
.github/workflows/lighthouse-ci.yml
```yml
name: Lighthouse CI
on: [push]
jobs:
lhci:
name: Lighthouse CI
runs-on: ubuntu-latest
steps:
View map.js
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 Nov 9, 2020
Performance monitoring with Lighthouse CI
View steps.md

1. Install the Lighthouse CI CLI.

npm install -g @lhci/cli

2.

View 78-stepper.ts
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,
View 78-interactive-maps.md

1. Define marker

interface Marker {
  lat: number;
  lng: number;
  title: string;
  image: string;
  text: string;
  markerObj?: any;
@nicobytes
nicobytes / nest-pg.md
Last active Jul 15, 2020
NestJS, TypeORM and PostgreSQL
View nest-pg.md
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';
View arrays.md

Arrays

Why?

const averageTempJan = 31.9;
const averageTempJan = 35.3;
const averageTempMar = 42.4;
const averageTempApr = 52;