Skip to content

Instantly share code, notes, and snippets.

View pochito427's full-sized avatar
💡
Working

Alfonso Neil Jimenez Casallas pochito427

💡
Working
View GitHub Profile
@pochito427
pochito427 / crud_dictionary.py
Created July 16, 2023 18:04
CRUD Python Dictionaries
"""
En este desafío, se te proporcionará un diccionario llamado person que contiene información sobre una persona. Tu reto es realizar las siguientes operaciones en orden:
1. Agregar un nuevo elemento al diccionario con la llave "twitter" y el valor "@nicobytes".
2. Actualizar el valor del elemento con la llave "name" con el valor "Felipe".
3. Eliminar el elemento del diccionario con la llave "age".
4. Imprimir una lista con las llaves del diccionario.
5. Imprimir una lista con los valores del diccionario.
"""
@pochito427
pochito427 / crud_list.py
Created July 16, 2023 16:11
CRUD Python Lists
"""
En este desafío, se te proporcionará una lista de letras llamada letters. Tu reto es realizar las siguientes operaciones en orden:
1. Agregar la letra G al final de la lista.
2. Reemplazar la letra en la posición 0 con la letra Z.
3. Eliminar la letra C de la lista.
4. Imprimir la lista resultante al revés.
"""
@pochito427
pochito427 / Hanoi.js
Created April 23, 2023 17:45
Hanoi Towers with Stacks
class Disk {
constructor(value) {
this.value = value;
this.next = null;
}
}
class Peg {
constructor() {
this.top = null;
@pochito427
pochito427 / CarBuilder.js
Last active June 4, 2023 19:09
Builder pattern
export class CarBuilder {
// Tu código aquí 👇
constructor() {
this.year = 0;
this.model = '';
this.brand = '';
this.color = '';
this.price = 0;
this.isAvailable = false;
}
@pochito427
pochito427 / Chat.js
Created April 12, 2023 02:01
Singleton Chat
import { User } from "./user";
export class Chat {
constructor() {
if (!Chat.instance) {
this.users = [];
Chat.instance = Object.freeze(this);
}
return Chat.instance;
}
@pochito427
pochito427 / rock_paper_scissors_switch.js
Created February 26, 2023 19:41
Rock, paper, scissors game with switch declaration
function validateGame(user, cpu){
switch(true){
case (user === cpu):
alert("Tie!");
break;
case (user === 2 && cpu === 3):
alert("CPU wins, sorry!");
break;
case (user === 1 && cpu === 2):
alert("CPU wins, sorry!");
@pochito427
pochito427 / rock_paper_scissors.js
Last active February 26, 2023 19:19
Rock, paper, scissors game
function validateGame(user, cpu){
if(user !== cpu){
if(user === 1 && cpu === 3){
alert("You win!");
}else if(user === 2 && cpu === 3){
alert("CPU wins, sorry!");
}else if(user === 2 && cpu === 1){
alert("You win!");
}else if(user === 1 && cpu === 2){
alert("CPU wins, sorry!");
@pochito427
pochito427 / web_scraping_counting_tags.py
Created February 20, 2020 03:12
Python script for scraping HTML contents and counting tags from an URL source with Beautiful Soup 4 library
# To run this, you can install BeautifulSoup
# https://pypi.python.org/pypi/beautifulsoup4
# Or download the file
# http://www.py4e.com/code3/bs4.zip
# and unzip it in the same directory as this file
import urllib.request, urllib.parse, urllib.error
from bs4 import BeautifulSoup
import ssl
@pochito427
pochito427 / Program.cs
Created March 20, 2019 05:56
This is a C# script which validates if a date is greater than other given by the user.
/*
*
* User: Alfonso Neil Jimenez Casallas
* Date: 26/08/2016
* Time: 2:42 p. m.
*
*
*/
using System;
using System.Globalization;
@pochito427
pochito427 / challengeIrix.js
Created December 31, 2018 06:51
This is a script to get first non duplicated number on a sequence array
(function () {
var SOLVE_CHALLENGE = "Implement the logic of the addNumber and getFirstNonDuplicated functions, do not limit yourself, if you need to create variables just do it. Good Luck";
var ANALYZE_1 = "What are the time (Big O notation) and space complexity of your solution?";
var SOLVE_ANALYZE_1 = "The time complexity for this solution is O(N) where N is the size of 'sequence' array and space complexity is O(M) where M is the size of 'seq_map' set with non duplicated keys from 'sequence' array";
var ANALYZE_2 = "What are the limitations of your solution?";
var SOLVE_ANALYZE_2 = "Map structure data does not have a standard built-in function in JavaScript to sort keys by ascending order and according to values and to get desired results faster and efficiently.";
var ANALYZE_3 = "Why have you decided to implement it on that way?";
var SOLVE_ANALYZE_3 = "Because this implementation is one of the simplest and most legible possible solutions for me as a developer, besides it is not the wo