Skip to content

Instantly share code, notes, and snippets.

View NyaGarcia's full-sized avatar
🐈

Nya NyaGarcia

🐈
View GitHub Profile
@NyaGarcia
NyaGarcia / recursive-euclides.ts
Created January 13, 2024 16:46
Recursive Euclidean algorithm to calculate Greatest Common Divisor
function calculateGreatestCommonDivisor(a: bigint, b: bigint) {
if(b === 0n) {
return a;
}
return calculateGreatestCommonDivisor(b, a % b);
}
@NyaGarcia
NyaGarcia / app-routing.module.ts
Created July 10, 2023 12:02
Configuring the router to automatically bind router state information to component inputs
import { RouterModule, Routes, provideRouter, withComponentInputBinding } from '@angular/router';
import { NgModule } from '@angular/core';
import { PokemonListComponent } from './pokemon-list/pokemon-list.component';
const routes: Routes = [
{ path: '', pathMatch: 'full', redirectTo: 'pokemon' },
{ path: 'pokemon', component: PokemonListComponent },
];
@NyaGarcia
NyaGarcia / pokemon-card.component.css
Created February 17, 2023 18:30
NgBytes Standalone Pokemon Card
mat-card {
transition: all 0.5s;
}
mat-card img {
height: 300px;
object-fit: contain;
width: 100%;
}
@NyaGarcia
NyaGarcia / pokemon-list.component.css
Created February 17, 2023 18:29
NgBytes Standalone Pokemon List
.card-container {
display: flex;
}
ngbytes-pokemon-card {
margin: 20px;
max-width: 300px;
}
@NyaGarcia
NyaGarcia / pokemon-detail.component.css
Last active April 25, 2023 12:18
NgBytes Standalone Pokemon Detail
h2 {
margin-bottom: 10px;
}
h4 {
color: rgba(0,0,0,.54);
font-weight: normal;
margin-top: 0;
}
@NyaGarcia
NyaGarcia / pokemon-detail.component.ts
Last active July 10, 2023 11:23
NgBytes Standalone Pokemon Detail
import { RouterModule } from '@angular/router';
import { Component, OnInit } from '@angular/core';
import { Pokemon, PokemonService } from '../pokemon.service';
import { CommonModule } from '@angular/common';
import { MatButtonModule } from '@angular/material/button';
@Component({
selector: 'app-pokemon-detail',
standalone: true,
@NyaGarcia
NyaGarcia / pokemon-detail.component.html
Last active July 3, 2023 12:41
NgBytes Standalone Pokemon Detail
<div class="detail">
<h2>{{ pokemon.name }}</h2>
<h4>{{ pokemon.type }} type</h4>
<div class="content">
<img [src]="pokemon.imageUrl" alt="Photo of a Pokemon" />
<div>
<p>Attack: {{ pokemon.attack }}</p>
<p>Defense: {{ pokemon.defense }}</p>
<p>
{{ pokemon.description }}
@NyaGarcia
NyaGarcia / app-routing.module.ts
Last active July 10, 2023 11:25
NgBytes Standalone App Routing Module
import { RouterModule, Routes, provideRouter, withComponentInputBinding } from '@angular/router';
import { NgModule } from '@angular/core';
import { PokemonListComponent } from './pokemon-list/pokemon-list.component';
const routes: Routes = [
{ path: '', pathMatch: 'full', redirectTo: 'pokemon' },
{
path: 'pokemon',
component: PokemonListComponent,
@NyaGarcia
NyaGarcia / app-routing.module.ts
Created February 17, 2023 12:53
NgBytes Standalone App Routing Module
import { RouterModule, Routes } from '@angular/router';
import { NgModule } from '@angular/core';
import { PokemonListComponent } from './pokemon-list/pokemon-list.component';
const routes: Routes = [
{ path: '', pathMatch: 'full', redirectTo: 'pokemon' },
{ path: 'pokemon', component: PokemonListComponent },
];
@NyaGarcia
NyaGarcia / app.component.html
Created February 17, 2023 12:10
NgBytes Standalone App Component
<h1>Standalone Pokedex</h1>
<router-outlet></router-outlet>