instruction
stringlengths
71
95.1k
I am currently working in a project based on a microservices architecture pattern. Services are wired up by HTTP calls. They eventually call each others for fetching or putting some data. I am working on the web page which envelops the whole microservices. I mean, the web page actually needs to send and retrieve data f...
I have made a clone of the mobile game Ballz, and it works quite well. However, there are a few problems: Performance. When I have more than 50 balls in the game, the FPS dips from 60. I am unsure how to (A) improve the performance of the game and (B) adapt to a low frame rate such that the game physics continues to w...
I have to find the position (array index) of a number in an array, the number can lie in between any other two numbers in the array. I have written code for this but I want some alternative way to do this. example: let the array be given as float arr[]={1.5, 3.65, 4.9, 8.4, 10.6, 17.5, 19.45, 21.86, 25.67, 30.65}; No...
I am 12 days old into Python and web scraping and managed to write my first ever automation script. Please review my code and point out blunders If any. What do I want to achieve? I want to scrape all chapters of each Novel in each category and post it on a WordPress blog to test. Please point out anything that I miss...
The basic idea of the code is that agents come into the world, they age and then die. I want to keep track of who is dead and who is alive. Eventually, they will do more things but I think there should be a lot of things I am not doing best practice on. I assume I'm doing something wrong with "Global" as well. # Classe...
I haven't found a good code example for a reactive retry operator with a retry strategy that was good enough for my needs. So I tried to make my own. It seems to work in my tests but I would really appreciate some feedback. (C# 8.0) using System; using System.Linq; using System.Reactive; using System.Reactive.Concurren...
So this is a pretty simple code, I think it was? It asks for the user's birth day and month, and gives it back with the day a discount reminder email will be sent (the day before their birthday) Now I tried to optimize as much as I could, possible wrong inputs and if the user's birthday is the first of a month Even tho...
In order to improve my C++ skills I started doing some toy projects, one of them being my own std::string_view implementation. This was my first time implementing a std library. I'm pasting the code inline, but you can check it out at https://github.com/david89/cpp-library/tree/master/types if you want (there are some ...
I just stated learning Rust (again...), here is a short bit of code I wrote: #![allow(non_snake_case)] /** * takes a 2D Vec and returns a 90° rotated version */ pub fn createRotated90(arr: &Vec<Vec<bool>>) -> Vec<Vec<bool>> { let newWidth = arr[0].len(); let newHeight = arr.len(); let mut newRetArr = cr...
My gut tells me this is poor practice, so, I thought I would ask for some feedback. The goal here is to fake a fluent API design for any class without using reflection while keeping it as pretty as possible. If I were to use reflection, I would just use jOOR. No need to comment on null-checks. I have omitted them in th...
The idea At my work, I'm tasked with retrieving logs for a list of online orders from a total of 12 servers. To do this, I SSH into them (with a jump host in between) one by one, run the script for every order, then parse the output. Overall, a very tedious process that I'm sure can be automated. W -> J -> S W = My Win...
I'm implementing the matrix multiply function using Java's multithreading. Below is my code: So I first tried the normal single threaded approach, then tried the ExecutorService approach, I don't know why the first approach is actually faster than the multithreading approach, based on the start time and the end time, i...
This would be for a MUD client, which has elements of a sort of telnet bot. Here, there's string parsing for a logged file for each line -- starting with the most recent. Once a "trigger" is invoked the parser and actions should, for the sake of simplicity, stop. I'm considering a records class for the triggers, but f...
The assumption is that k is quite large as compared to no. of elements in the array and division by 2 returns ceiling of the result. Request for your review and suggestions for further improvements or simplifications. Example : Array: { 10, 15, 7, 23, 5} k = 6 Solution: {5, 4, 4, 6, 5} = 24 How Code Works? Basically we...
I tried solve this easy leetcode challenge in java. Challenge link Here is my solution class Solution { public int romanToInt(String s) { Map<String, Integer> data = new HashMap<String, Integer>() { { put("I", 1); put("V", 5); put("X", 10); put("L",...
I wrote rock paper scissors game using what I have learnt yet.It is while,for statements,list,tuple,dictionary and such simple things only.So I am interested how can I simplify this code using only what I have learnt(simple things) Here is code k = input("Hello guys what are you names: ") j = input("and yours? ...
I am new to programming and I have tried to recreate below lines into OOP's code. Please review and provide comments. House has Rooms.Rooms are drawing room, bed room, bathroom etc.Each room has walls, ceiling,floor. Each room have different objects in it like drawing room has sofa, table , TV etc. , bedroom has TV etc...
So this is the code I wrote for hangman in python. I want to know of can shorten this code more further and make it look more professional # importing random function import random, hanged from word_meaning import meanings # Dictionary of random words word_dict = '''whistle, park, picayune, attach, grubby, gusty, neck...
I've started learning JavaScript last week. Today I ran into a JS exercise available at this link codewars exercise and decided to give it a try. I've used very basic JS because I know only a small number of JS methods. Could you please review and rate my code? challenge text : Your task is to write a function named ...
I wrote a script that connects to World Bank API, gathers some data (indicators) for a number of countries, creates pd.DataFrame, and saves the result as xlsx file. What I had in mind when I was writing the code: I wanted to avoid constructing pd.DataFrame within the function or using the append method to store data ...
This is one of my mini project of dice rolling and I want to improve it further with more advanced Python. Maybe you have any ideas to improve the code itself? This code will ask the minimum and maximum number for the dice from the user and the number of times it will roll them, giving random numbers. import random #Si...
I've implemented an algorithm that generates all variations of a matrix of size \$M*N\$. My approach is that I see a matrix as a list where the position of elements can be calculated from the position in the matrix. By doing that I can reduce the problem into generating all variations of a list of length \$M*N\$. The a...
Below is my entire program. You can read what it does thanks to the comments and specifications in particular. My question is: can it be improved? Would it be possible, for example, to avoid writing a fwrite() inside each if? Is there a good pattern that can be implemented somewhere in this code? The entire program is...
I wrote this script and got what I wanted from it. However I'm looking for input on ways I can improve the function. My goal was to scrape a bunch of image links from a website I'd like to rebuild. I wanted to use webscraper but the image links were coded into the CSS instead of the HTML mark up. Hence I had difficulty...
I've a simple code base with few 'weapon' concrete classes which implements different contracts in order to be used by its clients. My contracts: public interface IWeaponPrimaryAttack { void DoAttack(); } public interface IWeaponSecondaryAttack { void DoSecondaryAttack(); } public interface IReloadable { vo...
Decided to give ReactJS + Redux + Typescript a try this weekend. Going to include the code first and then summerize a few questions that came into my mind during development. Also posting here to get general feedback on what I can improve on. The whole project on codesandbox.io index.tsx import * as React from "react";...
This is my current View hierarchy: ParentView:View { ChildView1: UIViewRepresentable ChildView2: View } In ChildView2 I have a button who's action I want to pass to ChildView1. That action is a @Binding on ChildView2, a @State in ParentView where it also is declared, and also a @Binding on ChildView1, where ...
I'm trying to make an ID generator that generates 64 bit longs. The IDs should be globally unique even between two offline machines. This is the same idea as UUID (GUID), but UUID is 128 bit long and contains redundant (constant) bits (eg. it uses the millisecs passed since the year 1980 and has 5-8 versioning bits). I...
Could you look at my code for the completed training project of the Python Hangman game and tell me where you can improve the code style? Code on GitHub import random from string import ascii_lowercase class Hangman: @staticmethod def print_welcome(): print('H A N G M A N') def __init__(self): ...
In a personal project I was working on, I had a vector of std::vector< std::pair<unsigned,char>>'s that represented a character and its position in the alphabet. I found that using/manipulating that vector to be clumsy so I wrote this implementation. Essentially, it just wraps the usual vector operations. I'm hoping fo...
I have a very simple file where I have a Qcombobox Filter. When you select the filter, I run through a case on the index and output results. So, on selection I trigger: self.comboBox.activated.connect(self.handleActivated) Then, my handled function is def handleActivated(self, index): db = QSqlDatabase.add...
This BST implementation seems to work, I would appreciate an advice on how to improve the code. I am also interested in the following: rule-of-5 methods, are all of them necessary (e.g. is destructor necessary when using smart pointers)? Are they implemented correctly? Does Node class need rule-of-5 methods? is clear...
I tried it using the code given below. big=0 ; c=0 def largest(n): global c c+=1 global big if n//10!=0: if big<n%10: big=n%10 return largest(n//10) if n//10==0: if c==1: return n else: return big But, when I input more than one nu...
I must allow user to add city, state and country if it is not already present in the drop-down. Then I must create the respective model instances and then update the city in the userprofile. The below is the working code. I have not checked it for all cases but I have checked it for most cases. Please tell me if there ...
I have cleared all my scripting from the use of JQuery, but sometimes I miss a few handy extensions. Now I'm playing with the idea to "extend" document.querySelectorAll with some handy stuff, using the proxy Object. Here's a snippet to demostrate that idea. The advantage seems that there's no juggling around with this...
This is my first Haskell project so I don't really have a good feel for what makes Haskell code clean, so they'll be lots of things that can be improved. Things I have a gut feeling are bad design: pieceAt on line 194 throws an error when it's called on an empty square. My reasoning was that it's undefined behaviour an...
Here's a function I use to generate a 2.5 gig SQL dump file for testing. It works but it takes a long time. How can I make it more efficient? const crypto = require("crypto"); const fs = require('fs'); const os = require('os'); const path = require('path'); (async function main(){ var dumpfile = await generate_lar...
I'm reading "Introduction to Algorithms" by CLRS and I can't find an implementation of the pseudo code from the book in golang. By the original implementation I mean that we deal with extra parameters in the function to define slice of an original array. All implementations on the web deal with whole array. And that's ...
Background I am a total beginner in Haskell, so after reading the Starting out-chapter of "Learn you a Haskell", I wanted to create my first program that actually does something. I decided to do the famous Caesar-Cipher. Code import Data.Char encryptChar :: Char -> Int -> Int encryptChar char shift = if ord char > 64 ...
I am currently working with the Stack Exchange Data Dump - to be more precise - with the dumped Posts.xml data set from Stack Overflow. What am I trying to achieve? I want to read the whole data set and import each row (a post on Stack Overflow) as a document into an MongoDB database. What am I doing right now? I am us...
I did some manual tests by instantiating the class and it seems to be working okay. I wanted some feedback on the following: Is the code well structured? I notice I have a lot of redundancy. The search and delete methods are almost the same. I use a string to flag deleted keys until they are replaced, is there a bette...
I have concurrency tasks in my module: user code is able to instantiate my object and specify Executor service, then user can submit requests to this object which should be run on specified executor. I'm calling this object requests queue. Also, this object holds internal state, but it's not relevant for this question....
I have a simple scrapy spider that crawls a page and returns H1 on the pages. Since, each page is unique, one cannot know how many h1's will be on the page. Since the scrapy spider returns a list, I need to convert the list of lists into variables that I can then insert. The output of H1 could look like ['some text h1'...
I have written a simple logger, AsyncFile, which asynchronously writes data to a file. Since data is going to be written very often (E.g. 10 writes per 30 milliseconds from different threads, my system has a 30ms sync time), I would like to know if: 1. The design makes sense att all? Am I missing something obvious? 2. ...
Good morning, I have the following code: Option Explicit Private Sub CommandButton1_Click() Dim LastRowA As Long, LastRowB As Long, LastRowC As Long, lastrowD As Long, LastrowE As Long, LastrowF As Long, LastrowG As Long, LastrowH As Long, LastrowI As Long, LastrowK As Long, LastrowL As Long Dim ws As Worksheet...
I want to have a test fail, because the email already exists, so I create duplicate@dave.com and dave@dave.com, but is there a way to do it without this? it('prepare', (done) => { chai.request(rest_api_url).post('/subscribers') .send({email: 'dave@dave.com', name: 'klaas'}) .end((err, res) => { ...
The goal is to have well defined state transitions, and the ability to provide the next event to execute. I'd like to know if this is a proper implementation of State Machine, considering how states and transitionTable are defined, and how I handle event as input and output via nextEvent. In many examples I cannot clea...
I'm developing a man-in-the-middle proxy that will let the user see and modify HTTP and HTTPS requests before they leave the client and responses before they arrive at the client. The code I'm working on is working, but I don't know if it's the right or beast way to achieve this behaviour. I'm waiting for all request a...
My program , developed with C using win_flex , implements lexical, syntatic and semantic analysis , given defined grammar rules. I would like to know if you any suggestion for improving or refactoring this. Here is my code: main.c #define _CRT_SECURE_NO_DEPRECATE #include <stdio.h> #include <stdlib.h> #include <string....
Here is some code that sends an email using Mimekit for .net C# to send email via Office365. DI is done using TinyIOC. It downloads an image from blob storage and then sends it with an attachment. Each email will ALWAYS have at least one attachment. Code feels a bit messy, especially the body/subject selector. ///...
Task: Complete the following function that determines if the number of even and odd values in an list of Integers is the same. | In | Out | Why | |------------------|-------|------------------------| | [5, 1, 0, 2] | true | two evens and two odds | | [5, 1, 0, 2, 11] | false | ...
I have two fuctions: f2 - first allocate memory , then move data. f - deallocate + move = emplace_back. I am trying to understand what is faster and better to use in terms of performance and code quality? void f2(const std::vector<std::string>& users) { std::vector<std::pair<std::string, int>> userOccurancies(user...
I was rewriting some code from my colleague and I was questioning if I was improving the code at all. My take at the code: if (account == null || (!account.Authorizations.Any(x => (x.Role.Name == RoleNames.ADMIN || x.Role.Name == RoleNames.SENDER || x.Role.Name == RoleNames.SENDERSADMIN) && x.TopicFilte...
I have written the code for implementation of the cp program that prints the number of bytes copied when the user presses Ctrl-C. Could someone please review this code and provide feedback. Thanks a lot. #include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<fcntl.h> #include<error.h> #include<signal.h> #def...
Write a Program that determines where to add periods to a decimal string so that the resulting string is a valid IP address. There may be more than one valid IP address corresponding to a string, in which case you should print all possibilities. For example, if the mangled string is "19216811" then some of the cor...
The following is the conclusion in a long chain of attempts to solve Project Euler problem #14 (Longest Collatz sequence) on HackerRank in the Haskell programming language. The problem is defined as follows: The following iterative sequence is defined for the set of positive integers: n → n/2 (n is even) n → 3n + 1 (...
RNA can be broken into three nucleotide sequences called codons, and then translated to a polypeptide like so: RNA: "AUGUUUUCU" => translates to Codons: "AUG", "UUU", "UCU" => which become a polypeptide with the following sequence => Protein: "Methionine", "Phenylalanine", "Serine" There are 64 codons which in turn ...
I wrote this code in order to return a http status of not found to my users in case the resource is not present in the DB. @RestController public class ExampleController { public final ExampleService exampleService; @Autowired public ExampleController(ExampleService exampleService) { this.exampleS...
I have this script which works perfectly but I experienced some delays because of these 2 for loops [i][j]. Is there any way to do the same function but with a better and more effective process like foreach or other? User.find({}).lean(true).exec((err, users) => { let getTEvent = []; //nested loops() //...
I'm making a MacOS app that will do some analysis on the user's calendar data. For now it only supports Apple's native calendar (EventKit), but I will later add support to Google, outlook, etc. Models/Events/Base.swift: import Foundation struct EventData { var title: String; var startDate: Date; var endDat...
I attempted making a hashmap in python, and it was harder, due to some limitations but this is my version of dictionaries in python. Are there any way to simplify or do the same thing in less code along with tips and tricks? class HashMap: def __init__(self, memory): # refers to the length of the bucket ...
Suppose I have an InputStream that contains text data, and I want to detect all words and their numLine. I reach for every word in file and their num line and put the result in a map. This is my code: public class IndexerClassicRead { private static Map<String, Map<String, Set<Integer>>> mapAllWordsPositionInFilesI...
Task: . Complete the following function that determines if two lists contain the same elements, but not necessarily in the same order. The function would return true if the first list contains 5, 1, 0, 2 and the second list contains 0, 5, 2, 1. The function would return false if one list contains elements the other doe...
Review Wanted Application Summary The application is a simple screen scraper which is to notify the user when new items are posted. The code is run as a CRON job every ten minutes. It will scrape the target page and return an array of ALL items matching the search criteria ( hard-coded ) by the user. The results are co...
This is modified from the general recursive solution here: https://stackoverflow.com/a/54544211/42346 to, more specifically, copy/move files with a given extension from one directory to another whilst preserving subdirectories. I'm reluctant to use .rename() for this purpose as it seems slightly less intuitive than cop...
Task: "Implement a method 'gruppiere', in a way that it can be invoked on all enumerable objects (Enumerable). The method receives a block and returns a hash. The items of the enumerable a grouped within the hash according to the return-value of the block." What they like to have is an own implementation of Ruby's "#gr...
Hi I am working on a complex application and currently adding two additional properties to objects that match the condition and returning it back. I was able to achieve the expected output, but just wanted to know if there is any other way which is more efficient than what I have tried. Step 1 : Filtering the array to ...
i'm exercising Java multithreading on an example of simple banking funcions. The programm is able to perform multiple transactions at once on different threads.All accounts transfer money to the following account, the last transferes money to the first. I want some feedback so I can improve my coding standards and pra...
I needed to draw border element according to scroll amount. I made it work but I am not sure about optimization and performance. There may have a better way? I am open to suggestion you can see it in action here: enter link description here here my js: Thanks var el = document.querySelectorAll(".animateBorder"); docu...
I'm trying to give one Controller one operation. However, some Controllers exists of 2 or more operations. I'm not sure whats the best way to structure this part of the app. For example, I have 2 Controller Functions, each doing their independent thing 1. attemptGetUserById (checks input, calls database provider, retu...
I am trying to create stacked inputs using flexbox, with the additional ability to also set rows. Here is the code: .stacked-inputs, .stacked-inputs .row { display: -ms-flexbox; display: flex; -ms-flex-flow: row wrap; flex-flow: row wrap; -ms-flex-align: center; align-items: center; } .stacked...
using System; using System.Collections.Generic; namespace Function_JosephusSurvivor { class Program { static void Main(string[] args) { //Debug purposes Console.WriteLine(JosSurvivor(7, 3)); Console.ReadKey(); } //Actual function: pu...
I'm trying to create functions in Python that would update calculations for a matrix only for new entries. These functions are created within a Design class, where users would submit a design into an existing database of designs. The distance between each design should be calculated, but ideally not by brute force ever...
hi guys this script recursively searches for files with a certain extension and possibly in a directory passed by the terminal ....(In case no directory has been passed, search from the current one) I believe it works correctly but I wanted to ask you if you noticed any flaws and report them to me or just tell me that ...
I am making a Tic-tac-toe game and I have the basic board but I am repeating the code and it is very badly written. I am wondering how I can use better practices to write the DOM elements that I need. I am referring to the function boardController.buildBoard() which can be found here: https://github.com/robbiesoho/TTTJ...
I just finished up this script that crawls hundreds of local git repos for csv files and then stores them into a database. I've tried to follow a "functional" paradigm for this script but am kind of confused with all the side-effects (printing, writing to db, shell subprocess). Definitely looking for a classic code-rev...
I am working to solve a problem where I need to determine if a Point lies on a line connecting two other Points. For example, if I have Point a, b, c, I want to determine if c is on the line segment connecting a and b. In my code, I have a point, me (a in the example) and two lists of points, hits (b in the example) ...
Given a range of integers, count the number of ways each single integer can be used in unique sets of three operands that all add up to a given sum. For a technical interview I was asked to solve a puzzle (Without coding). The puzzle was given a 3X3 grid with unique integers 1-9 each filling a location on the grid, arr...
I had posted this on StackOverflow — someone pointed me here. My code is working, but it's incredibly verbose and I know that it can be made more compact. I just don't know how :-) I'm building an audio portfolio. When a button is clicked, a sequence of events happens. When another button is clicked, all other active b...
I'm looking for someone to tell me how I could refactor/change/improve my JS, I'm still learning and really want my code to be the best it can be for when it comes time for me getting a job in the industry. Would really appreciate a professional's help. It's just a fairly simple todo list... Here is the JS let ul = doc...
I want to extract the headers data and column data (not row data) from an HTML table using JavaScript. Is this a good approach of doing it? And how can I simplify this using jQuery? let table = document.getElementById('tab') debugger let headers = Array.from(table.rows[0].cells).map(x => x.innerText) let columnData =...
I have tried Implementing Stacks Using Linked Lists, and would like some tips and tricks regarding optimizations or ways to simplify/compact processes. It has 3 functions, Push, Pop, and Peek (For checking the top item in stacks) class Node: def __init__(self, data, next=None): self.data = data self...
How can I improve the visual appeal Of My text-based Pokemon battling simulator? I created a Pokemon battling simulator in C++. I showed it to my mom, dad, and brother, and they didn't say anything about this, but I have a tugging feeling that they didn't think it looked to great. I myself don't think it looks to great...
I have been trying to develop a program which implements a parser, i.e., syntactic analysis. Here is what I have done so far: parser.c #include <stdio.h> #include "parser.h" void error_handle(char *expected, YYSTYPE *token) { if (token) { fprintf(yyout, "Error: Expected token is { %s }, but actual token is...
Note As there are a lot of related modules in the project, I recently posted several similar posts(because all content cannot fit due to character limit) and someone indicated that this might be against the website policy, so I edited and included only the features of what my code does, I got some votes for closing the...
Hello I am a beginner in PHP and I need some opinions. How secure is my registration code ? If I launched this on the web would you feel safe signing up with personal info ? <?php // shows all errors ini_set('display_errors', 1); error_reporting(E_ALL); //check if form is submitted if ( $_SE...
I have some paths in a list. Here is an example: a=["/desktop/folderA/fileA","/desktop/folderA/folderX/file1","/diskKH/folderA/fileA","/desktop/folderB/folderC/fileX"] However I need the output to be in the following form. [{ 'name': 'desktop', 'children': [{ 'name': 'folderA', 'children': [{ ...
From my repository. This is my first time implementing a Fibonacci Heap, and since it's pretty complicated (at least to me), I would like to check if it is all correct. import java.util.HashMap; import java.util.HashSet; import java.util.Objects; public class FibonacciHeap { private final HashMap<Integer, Node> ref...
I am looking for improvements in the code below which is taking a long time to finish. Initially when I export around 26k+ records, it will take around 20-30 mins to finish. Usually then either the server running out of time, or a DB timeout occurrs. I do realize it is bulky code. The data is populated after if (stockI...
I write an hobbyist application that collects soccer-data from different sources around the www and aggregates it for a graphical representation and sends it out as a tweet. Now I want to fully automate this process in a more or less robust way (more or less because 1. this is a hobby and 2. depends on scraped 3rd part...
Description: The web server retrieves data from file database (pdf, doc, 3d file, zip and rar) and financial program such as inventory, price, indexes, order status and so on. I'm doing REST API PHP for the first time, I've never used this API with PHP, I am an absolute beginner to REST. Code returns data to coopera...
A section of my page lists 'Workshops' and just uses objects from a queryset. The page/site uses bootstrap. <div class="row my-4"> <div class="container"> {% if workshops|length %} <div class="row"> <h3 class="text-uppercase font-weight-bolder font-title ml-4">Learn through workshops</...
This defaults to user input if the arguments are not passed at compile time.. How effective is this technique and where can it be applied? #define _CRT_SECURE_NO_WARNINGS #include <iostream> void foo(unsigned number = []() {unsigned num = 0; std::cin >> num; return num; } ()) { std::cout << number << "\n"; } int...
Now implemented changes suggested in my previous post and now am back again for the internet to tear me and my shitty code down. PatchNotes Extracted templateRetriever class from the email service thus making it a little smaller. Put the email bodyTEXT in embedded HTML file so the program is more future proof. Chang...
Here's a little bash script I wrote, which basically checks something on an Amazon EC2 instance and reports data to CloudWatch every 60 seconds. I'll run this inside a container. Everything works just fine, but I think it's clunky, doesn't write anything to stdout/stderr so no logs, and doesn't handle any errors. I am ...
I've been working on an LR(1) parser, and I've just finished making the LR(1) item. I'm very rusty with C++, so any pointers (especially optimization and code structure) would be appreciated. Here are my files: main.cpp: #include <iostream> #include <array> #include <vector> #include <unordered_map> #include "lritem.cp...
I am a beginner in coding. I was doing this question today. A new movie has been released. Many people are buying tickets which costs 25 dollars. There are many people wanting a ticket but each person has either one of 25 dollar bill, 50 dollar bill or 100 dollar bill. People will only come in the order of queue. ...
This is a small web scraping project I made in 2 hours that targets the website remote.co . I am looking forward for improvements in my code. I know about the inconsistency with the WebDriverWait and time.sleep() waits, but when I used the WebDriverWait to wait until the load_more button was clickable and ran the progr...
I've decided to work on my Perl skills. I've written a small subroutine that splits a string based on an optional delimiter. I'd like any feedback on this program so I can kick bad habits to the curb. Written in Perl 5. sub split_string { my $string = @_[0]; my $delimiter = @_[1] ? @_[1] : " "; my @result =...
I've implemented tic-tac-toe in TypeScript before; now I'm porting it to Elixir. As before, this is pure game logic, no UI involved. I'm very new to Elixir, so any suggestions are appreciated. The actual game logic: defmodule MassivelyMultiplayerTtt.Game do defstruct current_player: :player_x, winning_pla...