Skip to content

Instantly share code, notes, and snippets.

View dcortesnet's full-sized avatar
🏀
quick to answer

Diego C dcortesnet

🏀
quick to answer
View GitHub Profile
@dcortesnet
dcortesnet / nextjs_banner.tsx
Last active February 14, 2023 13:00
Nextjs simple banner
import Image from "next/image";
export const Banner: React.FC<{ img: string }> = ({ img }) => {
return (
<section
style={{
width: "100%",
height: "100%",
}}
>
@dcortesnet
dcortesnet / react_native_google_button.tsx
Created February 10, 2023 14:59
React native Google button
import React from "react";
import { Image, StyleSheet, Text, TouchableOpacity } from "react-native";
interface Props {
text: string;
onPress: any;
width: string;
}
const GoogleButton: React.FC<Props> = ({ text, onPress, width }) => {
@dcortesnet
dcortesnet / nestjs_jwt_provider.ts
Last active February 14, 2023 12:21
Nestjs example jwt provider
import { Injectable } from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import jwt from "jsonwebtoken";
@Injectable()
export class JwtProvider {
constructor(private configService: ConfigService) {}
sign(payload: string) {
return jwt.sign(payload, this.configService.get<string>("JWT_SECRET"));
@dcortesnet
dcortesnet / github_pages_deploy_gatsby.yml
Created January 26, 2023 14:58
Github action Gatsby deploy
name: Deploy to Github pages
on:
push:
branches:
- master
jobs:
build-deploy:
runs-on: ubuntu-latest
@dcortesnet
dcortesnet / javascript_convert_number_to_currency.js
Last active February 14, 2023 13:04
Javascript formato de moneda dinero
new Intl.NumberFormat('es-CL', {
style: 'currency',
currency: 'CLP',
}).format(1500);
// https://medium.com/geekculture/automatic-number-format-with-javascript-all-countries-8b457ac0b491
@dcortesnet
dcortesnet / django_config_example.py
Created November 27, 2022 12:33
Django example config started
"""
Django settings for school_service project.
Generated by 'django-admin startproject' using Django 3.1.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
@dcortesnet
dcortesnet / nestjs_s3_provider.ts
Created October 19, 2022 12:02
Nestjs S3 example provider
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import AWS from 'aws-sdk';
@Injectable()
export class S3Provider {
private s3: AWS.S3;
private bucket: string;
private folder: string;
@dcortesnet
dcortesnet / nodejs_sendgrid_send_email.js
Last active February 14, 2023 12:27
Nodejs send email with sendgrid
const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
to: "test@example.com",
from: 'test@example.com',
subject: 'Sending with SendGrid is Fun',
text: 'and easy to do anywhere, even with Node.js',
html: '<strong>and easy to do anywhere, even with Node.js</strong>',
};
sgMail.send(msg);
@dcortesnet
dcortesnet / mongodb_lookup_n_to_m.js
Created October 9, 2022 19:16
MongoDB lookup N:M
// Orders collection
{
"_id" : ObjectId("634312b873d381100e27b8ea"),
"company" : "Microsoft",
"products" : [
ObjectId("634312f073d381100e27b8ec"),
ObjectId("634312f073d381100e27b8ed")
]
},
{
@dcortesnet
dcortesnet / mongodb_lookup_1_to_n.js
Created October 9, 2022 19:15
MongoDB lookup 1:N
// Authors Collection
{
"_id" : ObjectId("63430b9e73d381100e27b8e9"),
"name" : "J. K. Rowling",
"books" : [
ObjectId("63430b8a73d381100e27b8e7"),
ObjectId("63430b8a73d381100e27b8e8")
]
}
// Books Collection