Skip to content

Instantly share code, notes, and snippets.

View jackie1santana's full-sized avatar
✍️
writing code ..

Jackie Santana jackie1santana

✍️
writing code ..
View GitHub Profile
🔹 Test Case 1: Cover goToTemplatePage with complete date
ts
Copy
Edit
it('should validate and format date when complete date is present', async () => {
component.isCompleteDate = () => true;
component.userProvidedDate = '01/01/2024';
component.formatUserProvidedDate = jest.fn();
await component.goToTemplatePage();
✅ What This Example is Doing
1. It's mocking window.Bootstrapper._trackAnalytics:
ts
Copy
Edit
window.Bootstrapper = {
// @ts-ignore eslint
_trackAnalytics: jest.fn()
};
This fakes the real analytics function so Jest doesn’t explode.
// Add this to your ModelingEventInitiateComponent
import { trackAnalytics } from '@app/services/common/track-analytics/analytics';
export class ModelingEventInitiateComponent implements OnInit {
// ... your existing properties ...
public ngOnInit(): void {
// ... your existing ngOnInit code ...

Set the base image to Ubuntu must be first instruction - use docker search to find images

FROM ubuntu # <image>
FROM ubuntu:latest # - <image>:<tag>
FROM ubuntu:precise (LTS)

Set the maintainer info

@jackie1santana
jackie1santana / docker-help.md
Created February 2, 2021 03:30 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@jackie1santana
jackie1santana / node_nginx_ssl.md
Created January 30, 2021 03:32 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@jackie1santana
jackie1santana / postgres-cheatsheet.md
Created June 20, 2020 19:26 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@jackie1santana
jackie1santana / django_deploy.md
Created June 18, 2020 15:52 — forked from bradtraversy/django_deploy.md
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.

@jackie1santana
jackie1santana / python_heroku.MD
Created June 18, 2020 15:52 — forked from bradtraversy/python_heroku.MD
Python & Postgres Heroku Deployment

Python Heroku Deployment

Steps to create a postgres database and deply a Python app to Heroku

Install guinicorn locally

pipenv install gunicorn
or
pip install gunicorn
@jackie1santana
jackie1santana / python_mysql.py
Created June 18, 2020 15:50 — forked from bradtraversy/python_mysql.py
Python & MySQL crash course for beginners
import mysql.connector
from mysql.connector import errorcode
config = {
'user': 'root',
'password': '',
'host': 'localhost',
'database': 'acme'
}