instruction
stringlengths
71
95.1k
I have just started a course on C and wanted to test what I have learned so far. I did so by making a small program that tells you how much you should charge for a shot of a spirit you put in. The code will ask if you want to do a calculation. It will follow up with a question about the name, price and size of a produ...
The main idea is, I have a struct and I will get a struct field as a string from another function, which I shall increment its value by 1. Below is the code I used and I think it is memory consuming. How can I improve it? Is there a better way than the reflection from the start? Thanks package main import ( "fmt" ...
I created a deck of cards that I used in a BlackJack game. I stripped out my black jack logic and left just the Deck, card and minimum dealer. The deck class is there because I want to create additional decks such as pinnacle or skip-bo. I that about using an Enum class for card objects or a switch statement for creati...
Here is a (reduced version of) a module for Bsplines, which I have used multiple times for my work on Atomic, Molecular, and Optical physics (AMO, in the trade lingo, a.k.a. "I love", in Italian). I wrote it more than a decade ago, with the occasional tweak, and it would benefit from a review. It is a bit long, but it ...
My program takes input from the user in two ways: By passing input as an argument whilst calling the command By taking any number of inputs after calling the command The program is a terminal calculator that recognizes parentheses, operators, and errors as soon as you pass an expression. If you happen to come across ...
I am trying to implement the data type LExpr as an instance of show. data LExpr = Var String | App LExpr LExpr | Lam String LExpr This is my code: instance Show LExpr where showsPrec d (Var str) = showString' str showsPrec d (App e1 e2) = showParen (d>=6) $ sh...
This is not the typical debate in FizzBuzz code about how to handle repeated if statements. I believe that it is a matter of personal preference. I am here to ask about the choice of repeated mathematical operation. Usually the solution to a FizzBuzz code is to use the modulus operator on every iteration. However, I'm ...
Problem: Given an array A of N integers, you will be asked Q queries. Each query consists of two integers L and R. For each query, find whether bitwise OR of all the array elements between indices L and R is even or odd. My approach: Accept the array of N integers. For any query (Qi) scan the array of integers between ...
To practice with SFINAE, template meta programming, functional programming and monads in C++, I decided to try writing a skinny version of the two functions (monadic binding and return) that make std::optional a monad. Here's the result: #include <optional> #include <utility> #include <vector> template<typename T, typ...
I am automating the building and unit testing of a personal project using shell scripts , CMake and make on the latest version of Fedora Linux. I have also tested building on the latest version of Ubuntu. I had to decrease the minimum CMake version on Ubuntu to make it work. Parts of the unit testing have previously be...
I got this question during an interview. The question itself was very open-ended - it asked me to implement a ticket queue system, where by default it would have 3 different queues to hold tickets that are of severity 1, severity 2, and severity 3 respectively. It should have functionalities like: add a ticket to the ...
This is a follow-up question for A Sub-string Extractor Implementation with Specific Keywords in Java. As AJNeufeld's answer mentioned, the test case getTargetString("Where the start is before here.", "start", "here"); will return "". I am going to fix this with the vocabulary word comparison technique in this version....
I just started to learn pointers, so I'm interested if I used them correctly in this task where I check if the absolute value of the greatest element in an array is two times greater than the absolute value of the smallest one. My code works properly; I'm just interested if I used the pointer correctly (it should only ...
I have the following code for determining TP, TN, FP and FN values for binary classification given two sparse vectors as input (using the sparse library): def confused(sys1, ann1): # True Positive (TP): we predict a label of 1 (positive), and the true label is 1. TP = np.sum(np.logical_and(ann1 == 1, sys1 == 1)...
Given a 2-column CSV dictionary file that contains translation of certain words, this c# code needs to replace the first occurrence of a word in the dictionary. Once a segment of string has been replaced, it cannot be matched or overwritten by a new dictionary word. This sounded like a fairly simple task but the code...
I was trying to designing a simplified parking lot management system. It has three types of slots (s,m,l). The goal here is that we want to make the placement/release of cars as efficient as possible, ideally O(1). The way I implemented is to use 3 separate stacks to hold empty spots for small, medium and large vehicle...
An elevator starts on the ground floor 0 and moves up or down by one floor at a time as described by an input string travel. Here's an example travel string udddudduuuuddu where u is a move up 1 floor and d is a move down 1 floor. count-basement-trips takes a travel string and counts how many times the elevator returns...
I'm taking the CS50 course, and we're asked to create a program which takes an input (the total height of the pyramid) and outputs a pyramid of that height. i.e Here’s how the program might work if the user inputs 8 when prompted: $ ./mario Height: 8 # # ## ## ### ### #### #### ##### #####...
I'm learning priority scheduling algorithm and trying to implement it using std::vector. But the current performance of my code that's partially implemented is not that good since I'm performing sort operation every time I add a new process to std::vector list. Can somebody suggest ways I can improve my current partial...
Hi I have wrote a code here for predicting temperature across months. This is the dataset that I was using: https://www.kaggle.com/sumanthvrao/daily-climate-time-series-data I have used a SARIMA model and looking at the predicted results, it does seem to be pretty decent. Given that I just started learning about a mont...
Sorry, I'm new and not confident. This is right, yes? It seems to work but, again, other people's answers seem more complicated: grid = [ ['.', '.', '.', '.', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['O', 'O', 'O', 'O', 'O', '.'], ['.', 'O', 'O', 'O', 'O', 'O'], ...
Previous: Advent of Code 2020 - Day 2: validating passwords Problem statement I decided to take a shot at Advent of Code 2020 to exercise my Rust knowledge. Here's the task for Day 3: Day 3: Password Philosophy [...] Due to the local geology, trees in this area only grow on exact integer coordinates in a grid. You ma...
I'm taking CS50, an Introduction to CS, and we're asked to do the following task: Suppose that a cashier owes a customer some change and in that cashier’s drawer are quarters (25¢), dimes (10¢), nickels (5¢), and pennies (1¢). The problem to be solved is to decide which coins and how many of each to hand to the custom...
Goal I am aiming to create a page with two columns, left side to be a summary section and the right side just an image. I'd like to hear some reviews to where I can improve my current html and css code :) It is not yet media responsive, just wanting to improve each step at a time. * { margin: 0; padding: 0; }...
The method gets called extensively throughout my programm, is there any way I can speed it up or improve other aspects? The code calculates the n-ary Cartesian Product of a List containing n Lists, so that for example: Product([[1],[2,3],[4,5]]) yields [1,2,4],[1,2,5],[1,3,4],[1,3,5] public static IEnumerable<T[]> Pro...
I have written some code in python to determine the outcome(including the remaining troops of both sides) of a Risk battle fought until one side is defeated. When using the Numba's njit decorator the code can simulate one battle's outcome in ~ 0.2ms. This is not fast enough for the application I have in mind. Ideally i...
As an exercise, I put together a postfix calculator using modern Fortran. Language apart, I am interested in knowing your take on the algorithm. As far as I remember from my freshman year (chemistry - long ago), the problem has a standard solution in C, which I imagine is optimal in some sense. However, I did not look ...
I have been developing a software driver for the internal a/d converter on this platform. The a/d converter peripheral is described in following document. The driver is written in C++ and is build upon existing driver which has been developed by the platform manufacturer in C language. The reason why I have decided to ...
An attempt at a clean implementation of this important data structure in C. It's hard to make such structures generic in C without losing performance, so this specialises on char* keys and int values, but uses some type aliases, such that only a few places need changing to change the key or value types. The hash table ...
The module has three functions: get_property_from_dict, retrieves a dictionary property's from a given path. token_collect_from_dict, builds a list of tokens and their location from a given dictionary. token_replace_in_dict, replaces a tokens in a dictionary with supplied values. I want to use these functions in a la...
Namespace list to directory structure Motivation I have a list of namespaces I extracted from types, and I which to create a directory structure, that represents these namespaces. So that I can place a file at the namespace path of each type. The simplest method would be to replace the . separator with a \\, and call i...
My name is Ruben and I am seeking tips on how to improve/optimize these functions. I picked up Python last year and I am at a point at which I can code scripts to do what is needed, but as you will see I am for sure a beginner especially when it comes to parsing files. This section of the Python script has the purpose ...
The goal of this module is to take in a string (user input, someone copy and pasting a large list of proxies) and parse it into an array of objects. I appreciate any and all feedback, but I'm specifically interested in improving the stringToProxy function. Namely I'm unsure about mutating the string parameter, seems li...
I wrote this function to generate random permutation of input vector, while making sure every element has switched place (for a Secret Santa like purpose). std::map<std::string, std::string> getPermutation(const std::vector<std::string>& participants) { auto permuted = participants; std::random_device rd; std::mt...
I wrote a function that returns a directed graph as an adjacency matrix. The function requires two arguments: the amount of nodes and the amount of edges. At first, nodes are placed and instantly connected to the graph. When all nodes are added, random edges are created until all edges are placed. Code: public int[,] G...
This evening I have seen the text of the Rainfall Challenge posted seven years ago by Hunter McMillen. I did not look at his solution (besides, I have no clue about perl), but I was intrigued by the problem, so I set out to solve it. In this case, it seems to me that OOP is a bit of an overkill, so I did it in a proced...
Last week I challenged myself to create the smallest possible code for a Tic Tac Toe game with an AI as opponent. Smallest possible in regards to say least number of characters used. The requirements on the game are as follows: A "nice" playing experience (ability to get user input and print the board after every move...
I'm taking CS50 Intro to CS. In this assignment, we're asked to make a program that can identify what type of credit card (AMEX, Visa, MasterCard) is given in the input (and whether it is valid.) Validity is checked using Luhn's Algorithm. Here's how the algorithm works: Multiply every other digit by 2, starting with ...
I made a method that takes an array and converts it to a matrix, given that it is a valid conversion. However, there is some redundant code in the beginning and I thought maybe you could help me? I am new to programming so avoid complicated imports and such. private int[][] toMatrix(int[] arr) { if(validConve...
I am relatively new to C++ coming from languages such as Java and would like tips to make my code more C++ like and doing things in the C++ way. The header file: #pragma once #include <string> #include <memory> class Expression { public: std::string symbol; std::shared_ptr<Expression> left; std::shared_pt...
Initially I have a code in JavaScript which looks like - const createUsersInfo = obj => { const studentDetails = []; const teacherDetails = []; obj.forEach(x => { if (x.type) { if ( x.type === 'teacher' && x.group !== 'admin' ) { teacherDetails.push(x); } else if ( x.type =...
My program applies stacking penalty rule in Daily Fantasy Football by choosing which players to be penalized by which amount of points. The rule is about penalizing teams with two or more defensive players when the team conceded no goals. Here is the description of the rule: For the 2019/20 football season, there is a...
Assume we are given \$ n \$ natural numbers, \$a_{1}, a_{2}, \dots, a_{n} \$ and we are supposed to calculate the following summation: \$ \sum_{i = 1}^{n}\sum_{j = 1}^{n} \left\lfloor \dfrac{a_{i}}{a_{j}} \right\rfloor\$. This is a question from a challenge and in only one test, I get time-limit exceeded error. Can my ...
I'm trying to do a simulation on the role of luck in human achievement. Here is what I intend to do with my code: Create 20000 instances of people with randomly generated scores for skill, experience and hard-work(0 to 99), and a luck value(0 to 100). Create a total score for each person, with 95% of the average of th...
absolute newbie here. I need help with simplifying my code. I want to create many more similar functions as shown below. Is there a simpler way where I can code without having to manually type in the same function every time I want to add a new function? function toggleItem1() { var myItem1 = document.getElementBy...
I just recently learned how to write Methods in C#. Here is one experiment I made. It calculates addition, subtraction, division, multiplication, and the square root of a number. fill free to give me suggestions on how I can improve the code. I also do know I need to set up a system that prevents the user from typing w...
The following code will add to each code block on https://codereview.stackexchange.com/ or https://stackoverflow.com/ a 'Select Code' button that will select the code belonging to that block. This was originally written in 2013, I adjusted it to the new CSS and exchanged var with let, otherwise I think it looks fine. H...
I've just started learning myself Rust. I am practicing with the exercises from the book available on the official website. Here is my attempt at the temperature converter exercise at the end of chapter 3. Could you tell me if my approach is correct? Is there something I could have done more efficiently? Is there somet...
I wrote a function in C that reads an entire line from a stream into a dynamically allocated buffer. What would you suggest I should do to improve its performance? Also, are there any errors that could occur and are not handled? This is the code: #define ERRALLOC(ptr) \ if (ptr ==...
I'm trying to apply Uncle Bob's Clean Code practices onto this exercise I'm helping someone with. (The exercise assignment is in a "docstring" comment above the Main.) I'm unsure what the best naming convention would be for ReturnAllCombinationsOfInputtedList, although I suspect it doesn't involve the return word in it...
I implemented Tic-Tac-Toe in Rust to learn the language. I split the implementation into two files: game.rs contains the actual game logic, and main.rs contains the main function and the command-line UI. I'm interested in any feedback. One particular question I have: I'm interested in trying to implement a GUI interfac...
Despite the many decent answers to this question, one was unable to find an iterative solution. Here's what I came up with: Code: type CircularReferenceHandler = (parentKey: IndexKey, parentValue: Dictionary<IndexKey, any>, childKey: IndexKey, childValue: Dictionary<IndexKey, any>) => void; type Dictionary<TKey extends...
I wanted to render some Vega plots in a rust+wasm web application I've been building with Yew. I'm a bit new to Rust, so I'm looking for feedback on runtime safety and stylistic issues. I was specially skeptical of the spawn_local I copied from someone's GitHub and the amount of unwraps thrown around. use std::collecti...
I have 2 dictionaries that I have to compare, if an element of one dictionary exists in the other dictionary, then add the element to an array but only one time... here the working code const getFavouriteShows = (graphql, favouriteShows) => { const arraya = []; //iterate trough favouriteShows for (let item...
Currently I have this code: private async Task<(List<SomeModel> data1, List<string> data2)> ProcessFileAsync(IEnumerable<FileInfo> filesInDirectory) { var data1 = new List<SomeModel>(); var data2 = new List<string>(); var inDirectory = filesInDirectory as FileInfo[] ?? filesInDirec...
I made the code underneath to sort my array and group people with the same score to show who all got 1st, 2nd and 3rd. the "points" variable looks like this points: { '204255221017214977': 3, '208993609255485441': 5, '382197942762602496': 4, '664606841409634324': 5, '779857709155090432': 4, '381084508276916...
I've defined a data structure which represents a doe_model, providing two maps with a configuration_id as key and a configuration_model as value. The configuration_model is an unordered_map which has a knob_name as key and a knob_value as value. There are things I don't like very much about this but I can't get a grasp...
Due to some bug somewhere, my speaker balance kept moving off-center and it was getting annoying. So I cobbled together the code below (based on this question) which—to my surprise—does compile and run on macOS 11.1 / Swift 5.3.2. I am a beginner and am trying to learn, trying to avoid errors and adhere to the DRY prin...
While trying to grasp the potentials of the collection features in F#, I encountered this one: let needSpecialDocument country = (not country.IsEea) && (not country.IsInSchengen) // could also be: not (country.IsEea || country.IsInSchengen) let wantToMoveTo country = country.Name = "CC" let potentialDestinations = ...
I'm 13 years old and turning 14 years soon! I Coded this simple text game in around 30 minutes, can someone rate it? and give some feedback import random import time current_coin = 500 def play(): computer2 = random.choice(['r','p','s']) computer1 = random.choice(['r','p','s']) if computer2 == computer1: ...
I am testing a Spring boot service using JUnit 5 and Mockito. I haven't spent much time on unit testing in the past so I'm not sure if I'm accidentally implementing an anti-pattern or not following best practices. I read multiple times that it's good practice to have one assertion per test, I have one assertion but I ...
Context As many of you may know I have a library that allows C++ objects to be converted into JSON/YAML/BSON automatically with a single declaration (see previous code reviews). I am now (trying) using this to connect and send data to Mongo without the developer having to write any specific code to convert their C++ ob...
I have a system of n oscillators which oscillate with time. To each of these oscillators I am adding a fluctuating coloured noise term with a different seed for each oscillator. Here is my code for the generation of this noise: #include <math.h> #include <stdio.h> #include <stddef.h> #include <stdlib.h> #include <iostr...
I'm an amateur at programming and have created the following method with which I pass a lowercase string with the idea it is then returned either in it's original lowercase format, Capitalised or UPPERCASE. I'm not sure this is the best way or is truly "random" but does work up to a point but would like pointers on any...
The Merriam-Webster Dictionary API at some point discontinued the use of XML in favor of exclusively returning JSON. This had the unfortunate effect of making finding a definition listed by sense number (i.e. definition 1 a (2)) much more complicated because they're trying to force a semi-arbitrary document based model...
here's some code I wrote in java SE to get use to if statements and scanning. just looking for suggestions that will improve this program or/and teach me techniques that I should get use to using. import java.util.Scanner; public class Calculator { public static void main(String[] args) { System.out.print("En...
This is a follow-up question for Generic Two Dimensional Data Plane with Manipulation Methods For C# and A SubPlane Method for Generic Two Dimensional Data Plane in C#. Based on iSR5's suggestion, in SubPlane method, Array.Copy is used instead of regular for loop in order to improve performance. The experimental implem...
I have this find function. Is it concise, efficient and readable with good logic flow? // findFirstStringInBracket finds the first string enclosed in brackets. func findFirstStringInBracket(str string) string { if len(str) > 0 { indexFirstBracketFound := strings.Index(str, "(") if indexFirstBracketF...
I have this function and need to refactor it Please refactor the code below to make it more concise, efficient and readable with good logic flow function findFirstStringInBracket($str){ if(strlen($str) > 0){ $firstbracket = strstr($str, '('); if($firstbracket){ $firstbracket = ltrim($fir...
I've created binary classification model from scratch, just to understand intuition behind that. However when I compare my implementation to model from tensorflow/pytorch with the same parameters and configuration I noticed that my model achieved similar results in about 3 000 epochs but tensorflow/pytorch model achiev...
I wrote a fairly simple program that grades theory-based quizzes. It is fairly straightforward. I would love to get insights and ideas on how it might be improved. consine_similarity.py """This module uses consine distance to check the similarity between two sentences""" from nltk.corpus import stopwords from nltk.clu...
I created a dates_in_range() function which checks if all of the dates passed to it ($dates array) are within $start_date and $end_date. If they aren't, it'll return false. The code works fine, but I'm wondering if there's a way to refactor it better using something like array_filter? Or does this look fine? function d...
Compared to the recursive version e.g. on Rosetta, this is 5-10% faster and uses 50% less instructions (for N=12). Only problem is the goto. Can it be avoided without using a function? The two outer for-loops don't do much in terms of loop control. But this is how I could make it work. Is there a more convincing non-re...
I feel like I'm likely violating a design principal or two here so I'd appreciate any mistakes or antipatterns being named and pointed out. I'm attempting to map a system in code which represents a decision tree, so based on the users input would provide them the next choice they can make, then from their input to that...
I need help to optimize my code for huge lists with approx. 10000000 elements. Is there a way to improve my algorithm or should I try to build a new one using a completely different approach? Task: given a list of integers and a single sum value, return the first two values (parse from the left please) in order of appe...
So this is a blackjack game, any feedback or tips on what I should remove from the code that is not needed is very appreciated. Note: some of the names of classes or variables are in Swedish but it should not interfere with understanding the code I think. Blackjack.java import java.util.Scanner; class Card { priva...
I Have the below code that gets urls of PDF files, send them to a convert function and returns them as images, is there a way to make this code more readable? Is there a way to avoid functions chaining? import PDFtoImages from '../PDFtoImages' export async function convertPDF(file, category) { const images= await ...
Code gets timed out and needs to be simplified. To ensure that n = sum of squares , To determine if n^2 = sum of squares , I need to input 4 integers : 5881, 2048, 2670, 3482 #To define the sum of squares def sumSquare(n) : i = 1 while i * i <= n : j = 1 while(j * j <= n) ...
I'm currently going through The Odin Project, in an attempt to learn some Javascript. I'm a junior in a CS program, and I realize that I am not very good at programming, but I want to change that. I made a very simple rock-paper-scissors implementation with JS and HTML. I plan on adding CSS later and making it not look...
I'm working on getting myself comfortable with C after only working in high level languages for the past 10 years. I've done rust as well and really like the concept of notating immutability in functions. That being said I'm confused on if I should use const wherever the compiler lets me, or just use it where it seman...
To practice my C, I've written a small function in C to display an integer as an 8-bit binary number. Please let me know how to improve this function, and other C-style coding conventions. Thanks! /** * Converts an integer to binary. * * @param num Integer to convert. * * @return c-string. **/ const char* to_bin...
I Have this class want to practice how to write a factory method pattern and I can change the logPlace by set the app.config, and I try to improve the performance so I use static List<string>,I want to decrease IO loading Here is my question This class can call factory method pattern or not? Is my code as clear as it ...
Problem Statement: Given an array arr[] of N non-negative integers representing the height of blocks. If width of each block is 1, compute how much water can be trapped between the blocks during the rainy season. Input: N = 6 arr[] = {3,0,0,2,0,4} Output: 10 For complete description, please go to this link. My Co...
I have a Java program that does find and replace (like when you do it in a text editor for example notepad++) in files of a folder and all sub-folders. I created 4 functions: the first function has folder path in the parameters so it listed all the sub files if it's a folder then list all the sub files again: then in R...
I have a service that converts an Excel spreadsheet file into HTML. It is working just fine, but it is quite a big method that doesn't follow any SOLID principles. Therefore I would like to improve it to follow at least the Single Responsibility Principle. But I really don't know how to apply it and find the level of a...
The problem statement was pretty easy and I was able to run half of the test cases, but some of the test cases in the end gave me the error of memory limit reached. What can I do here to improve the memory efficiency of my code? Question: Find the min number of "usable" integers required to reach the N. The "usable int...
I have created a task that I need to query database for List of String and store it in neededDataList. I will use neededDataList in a scheduled task every 10 minutes to do a simple task. And I need to retrieve a fresh data of neededDataList every 1 hour. Will the scheduledExecutorService2 pick up the fresh neededDataLi...
I'm making a project that needs a simple cross-platform command-line parser. I made this. Hope you enjoy! #include <stdio.h> #include <string.h> #include <stdlib.h> #include <stdarg.h> #define __NUM_OF_ELEMENTS(ARR) (sizeof(ARR)/sizeof(ARR[0])) #define __HAS_ARG(FLAGS, ARG) (FLAGS & (1 << ARG)) void panic(const char...
I wrote a matrix class in C++ with an addition and multiplication method. It works fine, but I don't think a C++ programmer would enjoy reading this. I would love some help with that. #include <iostream> #include <string> class Matrix { public: int rows; int columns; int* contents; // Constructor ...
I haven't separated the stack code into its own header and source yet, this is just a proof of concept for now. Haven't chosen better function names yet because I ultimately want to integrate this code into a larger project where I need a way to store data into some kind of dynamic list. Settled for an stack API for no...
I am analyzing videos from the popular social media platform, TikTok, and extracting the songs into a Spotify playlist. Here is a gif of one of these videos: https://i.imgur.com/I0dVoac.mp4. Full video: https://vm.tiktok.com/ZMJwqpTPq Basically, after the video is downloaded, I get unique frames in 2 steps: Get frame...
I'm an amateur programmer making a career change into web development. I've found Advent of Code challenges are great way to sharpen my skills. I've cleaned up this solution for Day 10, 2020 as much as I know how. Here's a link to the description of the problem and my solution on GitHub. I've also summarized the proble...
I have the object with values. I trying to filter based on values. var data = { "map": { "0": ["abcd"], "1": ["efgh"], "2": ["xyz"], } } In above object I am trying to filter xyz which are have in array values. Expecting output: { '0': [ 'xyz' ] } I done the code but I am not sure it's efficient way....
Like most teams, we take turns to speak in our daily stand-ups. When we gather around the sprint board, it's easy to know who speaks when - we start at one end and pass the role along the line. At present, we're all working remotely, so there's no physical ordering that we would agree on. And we would get tired of u...
I made a skyscraper solver based on the kata on Codewars. To try to understand the problem you can try to solve a 4x4 Skyscraper here. There are also instructions available. Now on Codewars there are also more difficult katas were you have to solve 6x6 or even 7x7 Skyscraper puzzles. Why are they more difficult? You ru...
I'm preparing for junior developer interviews and am trying to come up with a more interesting/versatile solution to FizzBuzz than I've done in the past. Do you have any ideas of how I might DRY this up? Is it too difficult to read? const isMultiple = (num, mod) => { return num % mod == 0 } const fizzBuzz = (range...
I'm making a slide sidebar with vuejs and tailwind. It works but feels kind of sluggish. Is there a way to make it smoother ? working example: https://codepen.io/tuturu1014/pen/oNzRXeW <button @click="isOpen = !isOpen" class="bg-blue-200 p-5"> <span v-if="isOpen">Open</span> <span v-else>Close</span> </button> <div...
This is my take on the guess the number game. The user has three attempts to guess the number chosen at random. The number is between 0 and 9, including. It tells the user to guess higher or lower and reveals the number if the game is lost. Input that is not a number between 0 and 9, including, is not accepted and the ...
Hello everyone this is my first post here so please do critique my post if there's anything. I have made a program intended to pass a programming challenge on open.kattis.com, here. It should do as title says, but with the conditions that each traversal follows the rules of a "Knight" from chess, that being plus/minus ...
I have created my first npm package: https://github.com/sunnysideup/stretched-bg-image. The purpose of the package is to add a class to a div (or any other block element in the HTML) depending on the width / height ratio of the div (panorama / landscape / portrait / skyscraper) Below is the code. It works fine, but doe...