Skip to content

Instantly share code, notes, and snippets.

Avatar
😍
In love with JavaScript!!

Kevin Uriel Fonseca kirasiris

😍
In love with JavaScript!!
View GitHub Profile
@kirasiris
kirasiris / Login.js
Last active Jan 4, 2021
TFAuthenticationWithNodeJSandMongoDB
View Login.js
///
///
/// AS THE FILE TITLE SUGGEST, THIS IS WHERE YOU SEND YOUR USERNAME AND/OR PASSWORD DATA
///
///
import React, { useEffect, useState } from 'react';
import { Link, withRouter } from 'react-router-dom';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import Helmet from 'react-helmet';
View npm exposed environment variables
// per https://docs.npmjs.com/misc/scripts, npm exposes a bunch of variables to
// the environment prefixed with npm_config_*, npm_package_* and npm_lifecycle_*.
// Here's a list of all variables exposed in my setup.
npm_config_access=
npm_config_allow_same_version=
npm_config_also=
npm_config_always_auth=
npm_config_argv='{"remain":[],"cooked":["run","foo"],"original":["run","foo"]}'
npm_config_auth_type=legacy
View action.js
export const addPost = (formData, files, setUploadPercentage) => async dispatch => {
try {
// ATTACH FILES
let fileKeys = [];
for(let file of files) {
const uploadConfig = await axios.get(`${API}/api/v1/uploads/getS3url?type=${file.type}`);
await axios.put(uploadConfig.data.url, file, {
View handleTwoInputs.js
const [avatar, setAvatar] = useState('');
const [avatarname, setAvatarName] = useState('Choose File');
const [cover, setCover] = useState('');
const [covername, setCoverName] = useState('Choose File');
const [uploadPercentage, setUploaderPercentage] = useState(0);
const handleChange = name => e => {
setProducerData({...producerData, [name]: e.target.value});
setAvatar(e.target.files[0]);
setAvatarName(e.target.files[0].name);
@kirasiris
kirasiris / example.json
Created Apr 3, 2020
A example displaying JSON data from an Application I'm working on.
View example.json
"data": [
{
"skills": [],
"languages": [],
"featured": "no",
"status": "published",
"_id": "5e22cb366eb08933b0de664e",
"title": "My second resume",
"email": "kebin1421@hotmail.com",
"address": "10153 Red Bluff Ln Fort Worth, TX",
@kirasiris
kirasiris / component.js
Last active Feb 19, 2020
Load CSS and JavaScript files dynamically on React!
View component.js
import useCSS from 'PATH_TO_useCSS_FILE';
import useScript from 'PATH_TO_useScript_FILE';
/*
* useCSS usage
*/
useCSS("https://www.w3schools.com/w3css/4/w3.css", "head");
useCSS("https://www.w3schools.com/w3css/4/w3.css", "body");
/*
@kirasiris
kirasiris / MathMethods.cs
Last active Feb 19, 2020
TO COMPLETE!! Needs string validation!
View MathMethods.cs
using System;
namespace Unit2_Calculator_AzuaraFonseca {
class MathMethods {
public void showMenu() {
Console.WriteLine("|----------------------------------------------|");
Console.WriteLine("| A: Addition |");
Console.WriteLine("| B: Substraction |");
Console.WriteLine("| C: Multiplication |");
@kirasiris
kirasiris / Car.cs
Last active Jan 29, 2020
Example of creating a class in C#. The right way.
View Car.cs
/*
* Each class should have a getter and a setter.
*/
using static System.Console;
namespace FourthConsoleApplicationUnitMethods {
class Car {
public string brand = "";
@kirasiris
kirasiris / MethodOverloading.cs
Created Jan 29, 2020
An example on creating Overloading in C#
View MethodOverloading.cs
using static System.Console;
namespace FourthConsoleApplicationUnitMethods
{
class UnitMethods {
// Method Overloading
static int Add(int a, int b) {
int result = a + b;
return result;
@kirasiris
kirasiris / Page.js
Created Sep 20, 2019
Here it is whole CRUD system lol.
View Page.js
import axios from 'axios';
import { setAlert } from '../alert';
import {
GET_PAGES,
CLEAR_PAGE,
PAGE_ERROR,
// UPDATE_LIKES,
DELETE_PAGE,
ADD_PAGE,
GET_PAGE,