Skip to content

Instantly share code, notes, and snippets.

View AlvisonHunterArnuero's full-sized avatar
😀
Coding ? keepCoding : backToCoding

Alvison Hunter AlvisonHunterArnuero

😀
Coding ? keepCoding : backToCoding
View GitHub Profile
// my array declaration with each object and cars details
const arrCars = [
{ type: "Wagon", make: "Infiniti", color: "Gray", year:"2018" },
{ type: "Sedan", make: "Honda", color: "Black" , year:"2020"},
{ type: "Convertible", make: "Porsche", color: "Silver" , year:"2014"},
{ type: "Hatchback", make: "Volkswagen", color: "White", year:"2012" }
];
// function to pull this information via map method
function pluck(array, arg01,arg02,arg03,arg04) {
// let us declare the container of the generated array
@AlvisonHunterArnuero
AlvisonHunterArnuero / JavaScriptClassesExcercises.js
Last active April 29, 2020 04:36
Probando un poco el crear Clases padres e hijos con ES6, olvidandonos del Prototype de una vez por todas.
// let us start writing the main class, from Here I will build the other ones by extending it
class Monster {
constructor(options) {
this.name = options.name;
this.type = options.type;
this.ingest = options.ingest;
this.health = 100;
}
Introduce(msg) {
return `Hey humans: My name is ${this.name}. ${msg}.`;
@AlvisonHunterArnuero
AlvisonHunterArnuero / ArrayHelpers.js
Last active April 29, 2020 04:36
Unos ejercicios basados en el uso de los helpers que me gustaria subir a gist para tenerlos ahi como referencia para mi y para otros
// Using Array Helpers Excercise - This uses Filter()
const numbers = [10, 20, 30];
function reject(){
let lessThanFifteen = numbers.filter(function(number){
return number < 15;
});
return ` Number that is less than 15 is: ${lessThanFifteen}`;
}
reject();
@AlvisonHunterArnuero
AlvisonHunterArnuero / DestructureArraytoObjects.js
Last active April 29, 2020 04:36
Un poco de destructurado con arreglos y objetos o viceversa, usando un arreglo de objetos como ejemplo para este codigo sencillito.
// WE WILL CONVERT AN ARRAY OF OBJECTS INTO AN ARRAY USING THE MAP HELPER AND DESTRUCTURING
// WE WILL BE USING SOME OF THE COURSES OF UNIVERSIDAD DE INGIENERIA [UNI] MANAGUA AS SAMPLES
const classes = [
["Cloud Computing", "9:00 AM", "Danilo Rodríguez", "Estudios de Posgrado"],
[
"Hacking y Ciber Seguridad",
"8:00 AM",
"Jorge Gutiérrez",
"Recinto Ricardo Morales Avilés"
],
// Ready for Gist
"use strict";
const start_codon = "AUG";
const stop_codon = "STOP";
const codon_to_amino_acid = {
AUG: "Met",
CAA: "Gln",
CAG: "Gln",
GGU: "Gly",
GCG: "Ala",
@AlvisonHunterArnuero
AlvisonHunterArnuero / covidNI2020ImpactSample.js
Last active April 29, 2020 04:35
Un ejemplo de lo que puede pasar si al menos dos personas contagiadas tienen contacto con otras y estas con otras mas en un corto periodo de tiempo.
// Global function to generate a rnd number
const rndNumber = (maxNumber = 30, minNumber = 1) => {
return Math.floor(Math.random() * maxNumber) + minNumber;
};
// main function goes here, we destructure the variables to be used
const coVid19NI = ({
intReportedCases,
objDate = new Date(),
currentDate = objDate.toDateString(),
contactedOnes = rndNumber(30),
@AlvisonHunterArnuero
AlvisonHunterArnuero / UserNameBasedOnName.html
Last active April 29, 2020 04:34
Quick question in regards generating an username based on the typed name and save it in a var
<!DOCTYPE html>
<html>
<body>
<h4>Sign Up Form Marca ACME</h4>
<p>Please type your name to generate its user name:</p>
<b>Name </b><input type="text" id="name" onkeyup="handleChange()"><br/><br/>
<b> User </b><input type="text" id="username">
<p id="displaymsg"></p>
@AlvisonHunterArnuero
AlvisonHunterArnuero / BasicAgeCalculation.py
Last active August 10, 2020 05:20
I decided to give it a try to python with my first ever Hello World type code, this one to calculate the age of the use of this app. Thanks Elotgamu for the inspiration in Python.
#Made with ❤️ in Python 3 by Alvison Hunter - Last Edited on July 9th, 2020
# calculate the age in years, days and hours for an individual as well as preferred programming language.
from enum import Enum
import datetime
def main():
# Using enum class to create the age range enumerations
class age_cat(Enum):
BABY = "you are still a baby"
CHILD = "you are still a child"
YOUNG = "you are certainly young"
@AlvisonHunterArnuero
AlvisonHunterArnuero / GenerateRandomPasswordString.js
Last active April 29, 2020 04:34
This function will generate a random string based on the parameter number, useful for temp passwords
// This function will generate a random string based on the parameter number, useful for temp passwords
const fnRandomString = (argLength) => {
let generatedString = ''; // receptor of the generated string, this will contain the x amount of character based on args
let baseString = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*+&^%$#!';
let charactersLength = baseString.length;
// refactor this to a ES6 friendly version, by using one of the looping helpers that we count with in ES6
[...baseString].every(function(element,index) {
// start building the string getting a random character each time based on the baseString
generatedString += baseString.charAt(Math.floor(Math.random() * charactersLength)) ;
// using the index of this helper, if it is equal to args-1 we stop the loop, otherwise
@AlvisonHunterArnuero
AlvisonHunterArnuero / generateRandPwd.py
Last active December 29, 2020 06:06
This code will generate a random set of strings that can be used for temporary passwords or login tokens.
# This function will generate a random string with a lenght based
# on user input number. This can be useful for temporary passwords
# or even for some temporary login tokens.
# Made with ❤️ in Python 3 by Alvison Hunter - December 28th, 2020
from random import sample
import time
from datetime import datetime
# We will incorporate some colors to the terminal
class bcolors:
PRIMARY ='\033[34m'