Skip to content

Instantly share code, notes, and snippets.

@ezequieltejada
ezequieltejada / firebase config.ts
Last active September 14, 2023 19:42
firebase.json
export const environment = {
appName: 'app-name',
useEmulators: true,
firebase: {
projectId: 'demo-project',
appId: 'valid-app-id',
storageBucket: 'app-name.appspot.com',
apiKey: 'valid-api-key',
authDomain: 'app-name.firebaseapp.com',
messagingSenderId: '1111111',
NOTA: Ejecutar comandos sobre POWERSHELL con permisos de Administrador.
OpenSSH está incluido con Windows 10, Actualización 1803.
#Verificando las caracteristicas
$> Get-WindowsCapability -Online | Where-Object -Property Name -Like "OpenSSH*"
Name : OpenSSH.Client~~~~0.0.1.0
State : Installed
Name : OpenSSH.Server~~~~0.0.1.0
State : NotPresent
@ezequieltejada
ezequieltejada / angular-material-theme-cheatsheet.md
Last active December 12, 2022 08:03
Angular Material Theme Course Cheat Sheet

Angular Material Theming Cheatsheet

Create a theme for a component.

  1. Create a new file for theming the component at the same level as the component itself. Call it "{{componentName}}.scss-theme.scss" (From now on called the theme file)
  2. Inside the theme file import material theming utils with @use '~@angular/material/theming' as material;
  3. Then create a mixing with the name of the component and make it receive a parameter of $theme in order to provide for the theme. @mixin app-banner-theme($theme) {...}.
  4. Inside that mixing, add all the neccesary styling for the component. You can access the theme colors like this:
    $theme-colors: material.mat-get-color-config($theme);

$success-color: map-get($theme-colors, success);

@ezequieltejada
ezequieltejada / rx-online-offline.js
Created October 11, 2022 14:18 — forked from ccnokes/rx-online-offline.js
Online/offline event observable with RxJS (see comments below for a better, more up-to-date way of doing this)
const { Observable } = require('rxjs/Observable');
require('rxjs/add/observable/fromEvent');
require('rxjs/add/operator/map');
require('rxjs/add/observable/merge');
function createOnline$() {
//merge several events into one
return Observable.merge(
//use .map() to transform the returned Event type into a true/false value
Observable.fromEvent(window, 'offline').map(() => false),
@ezequieltejada
ezequieltejada / appEngineHandleShutdownGracefully.md
Last active October 7, 2022 10:41
App Engine gracefully handle shutdown

How to handle shutdown gracefully in an App Engine.

app.get('/_ah/stop', (req, res) => {
  console.info('Shutting down.');
  server.close();
  res.send();
});

app.get('/_ah/start', (req, res) => {
@ezequieltejada
ezequieltejada / firebase.json
Created September 27, 2022 10:44
problem with deploy
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build",
"npm --prefix \"$RESOURCE_DIR\" run predeploy"
@ezequieltejada
ezequieltejada / sampleREADME.md
Created September 12, 2022 16:36 — forked from FrancesCoronel/sampleREADME.md
A sample README for all your GitHub projects.

Repository Title Goes Here

Frances Coronel

INSERT GRAPHIC HERE (include hyperlink in image)

Subtitle or Short Description Goes Here

ideally one sentence >

@ezequieltejada
ezequieltejada / subscribeExample.ts
Created June 29, 2022 08:14
Handling subscriptions in Angular components
import { Component, OnInit } from '@angular/core';
import { Service } from '../services/service';
@Component({
selector: 'selector-name',
templateUrl: 'name.component.html'
})
export class NameComponent implements OnInit, OnDestroy {
subscriptions$: SubscriptionLike[] = [];
@ezequieltejada
ezequieltejada / testing-steps.md
Last active July 21, 2022 08:13
Testing Steps
  1. Install Jest (yarn add -D jest babel-jest @babel/core @babel/preset-env | npm install -D jest babel-jest @babel/core @babel/preset-env)
  2. Create babel.config.js file in the root of the project with this content
    module.exports = {
        presets: [
            ['@babel/preset-env', { targets: { node: 'current' } }],
            '@babel/preset-typescript'
        ]
    };
    
@ezequieltejada
ezequieltejada / nodemon-typescript.md
Last active October 1, 2022 21:25
Nodemon & Typescript

Debug with Nodemon and Typescript - Source

When we have our node project in typescript and want to debug we can use VSCode debugger. However we are not willing to sacrifice restarting the server on save or working directly in typescript. How can we achieve that?

Install dependencies

The first step is to install our dev-dependencies. We are going to need:

  • typescript
  • ts-node
  • nodemon
  • @types/node