instruction stringlengths 71 95.1k |
|---|
I am wondering if I can get some feedback for my implementation of "Sieve of Eratosthenes" and twin prime. I followed this pseudocode.
Few notes:
I added MAX(primes.size << 1, (x << 1) + 1) to make I resize the table large enough to find the next twin prime.
Use a struct to keep track of the size of the dynamic array
... |
This is programmed in Visual Studio 2019 with the C++17 feature set.
The intent with this code is to be able to create memory blocks of the specified alignment and size, so as to have contiguous cache-friendly memory and to only do one malloc and free for the whole block. Is there something wrong or missing from this i... |
I have a jsonArray.js file
const jsonArray = [
{"click": "clearValue", "alt": "clearValueIcon",
"src" : "https://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/128/Actions-edit-clear-icon.png",
"style": "grid-column:1/2;grid-row: 2/3;"},
{"click": "negativePositive", "alt": "negativePositiveIcon",
"src... |
Background and Code
I am using the following JavaScript code to inject CSS classes into a webpage after the page has loaded. These classes act as selectors that I can use to pinpoint a table cell to perform other actions (the actions that I wish to perform are out of the scope of this question).
These selectors are use... |
As an exercise, I've decided to write a lightweight, dictionary type database. Below are some of the features I've implemented:
Overwrite Inserting: I allow the user to determine if they want to overwrite existing data, should they insert a pair that already has a value associated with the key of that pair.
Encryption... |
For several days I have been learning about MVC, and I do some code but I don't know if that is correct. I will be grateful for some tips to get this code better.
Here is my github respository
https://github.com/DanielPeleton/mvc-php
class/db.php
<?php
class db{
public static $host = '';
public static $user = '... |
What can I improve about this code in order to be production-ready? I'm not worried about security but about errors that could occur.
What exceptions should I catch? I feel overwhelmed about exceptions because I feel that there are a lot of exceptions that one can consider.
What else should I do? Should I do unit testi... |
Here is my vampire based text adventure game.
I recently started learning Python and Googled for some good projects to practice with. I wrote all this code myself after checking out some examples on the internet.
import time #added to enable pause
#A text based dracula survival game
#possible answers
answer_A = ['A',... |
(There is now a 2nd version of this code)
Have you ever written proxy objects, instead of using a setter and a getter method? In that case, I'm interested in your opinion on the following design for a templated proxy:
#include <type_traits>
#include <utility>
template <typename Handle, typename Getter, typename Setter... |
I need to speed up a circular buffer that has space and time requirements.
Each cell in the circular buffer represents a list of N elements to be sent. The shipment takes place if the list reaches N elements, or if the elapsed time exceeds X ms.
At the moment I have found this solution, but I am quite sure it is not th... |
This has been my approach for "simplifying" MongoDB aggregation queries in a pythonic syntax - was my intent, at the very least:
from datetime import datetime, timedelta
class MatchStage(list):
def _get_day_range(self):
current_time = datetime.now()
return (current_time - timedelta(days=1)), curren... |
I have written this Sieve of Eratosthenes. This is a bit of software that will find all of the prime numbers between 2 and n, where n is a user-defined value.
The code does seem quite bloated and any help at making it more elegant would be great. I know that I am not very good at list comprehensions and if it is possib... |
With a reference implementation for PEP 622 now available in a Jupyter playground, I decided to copy over my favourite feature of Rust in full to Python.
Note: this won't be released until Python 3.10 but there is a reference implementation available.
Given that I do a lot of interacting with JSON through the web, havi... |
I am a newbie in stack exchange code review. I just wrote a C function where the function checks if the given string is numeric or not. What do you think about my way of doing this? And could this be done in other ways?
#include <stdio.h>
#include <stdbool.h>
bool is_numeric(const char* str)
{
while (isspace(*str)... |
At our office there is this piece of code (the original author isn't employed anymore, so I can't ask him).
Does anybody have an idea, what he did there? Is there any advantage of using this struct OrderDirection instead directly the enum Direction?
(for me, this is interesting and I just wanted to know why.)
public st... |
I have a function :
function __throwError(func) {
if (func.length === 1) {
function passNumber() {
func(0);
}
function passString() {
func("item");
}
function passEmptyArray() {
func([]);
}
function passUndefinedOrNull() {
func(undefined || null);
}
expect(p... |
I am making a game event messenger based on the observer pattern and I'd really appreciate some feedback on this please. The intent behind it is that I am sending in a function pointer so that it can work for the broadcasting. Also using the subscribers memory address as a way of detecting it for unsubscribe.
Thank you... |
for my dissertation (in psychology) I created an emotion recognition test that displays an image of a face displaying a certain emotion for a set time, then allows participants to press a button indicating which emotion they feel was being displayed. This was my first major Python project - and I'm hoping to upload it ... |
I'm working with numpy arrays and dictionaries, the keys of the dictionary are coordinates in the numpy array and the values of the dictionary are a list of values I need to add in those coordinates, I also have a 3D list of coordinates that I use for reference, I was able to do it, but I'm creating unnecessary copies ... |
I am new to flutter and i managed to build a working Grid which does what i want it to do but the code is a duplicated hell and i didn't manage to create it dynamically while still keeping track of the input-fields and its input.
I really could use some help!
import 'package:flutter/material.dart';
import 'package:intl... |
My solution to string interpretation is pretty fast. However, I worry about repeated if (Len == 1). That might make the function bigger in the executable. How can I improve my function, to not be as redundant while checking if Len is equal to 1?
#include <ctype.h>
signed char BoolFromStr(const char *const StrIn, regist... |
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time!
Problem
Let's say a positive integer is a superpalindrome if it is a
palindrome, and it is also the square of a palindrome.
Now, given two positive integers L and R (represented as strings),
return the number of... |
I'll be teaching Computer Architecture at the undergraduate level this fall and want to make sure that my example Verilog code follows best practices. I welcome any suggestions, however minor, for improving this code, which runs at EDA Playground.
Our textbook is Computer Organization and Design by Hennessy and Patters... |
I asked this question before and mickmackusa and Your Common Sense gave me some good answers. I went over them and made as much changes as I could because some of the code didn't work properly for me. So again i want to know if this is a good way to have my registration code for people to sign up.
//check if form is su... |
This week I published a project that aims to enable sharing Jekyll built pages on various social media platforms, without unnecessarily degrading client privacy; ie. it does not call-out to those third-party sites unless a client actively clicks a share link.
Currently supported sites are:
Facebook
Linked-In
Reddit
... |
(following up from here)
I am working on a little project where I need to scan all the config files present in a folder on the disk and load it in memory. Below are the steps:
On the disk there is already a default Records folder which has all the default config files present. This is to fallback if loadDefaultFlag is... |
Edit: I added another configuration vector to CardView, a size attribute, which may be .small or .medium. As such, I had to refactor the design to create several descendent protocols of CardView for each attribute, and several concrete structs corresponding to each possible combinations of size and style. Here is the u... |
I have a simple binary tree that has no parent pointers.
class Node:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Tree:
def __init__(self, root=None):
self.root = root
I need to traverse the tree from bottom up and c... |
I developed a college fee report generator application using Java with internet as referance,but now I need you guys help in making it more obvious and a sturdy application as I am a rookie to Java Swing.
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
i... |
I recently posted some code for review, and am now looking to gather some feedback on my latest implementation with that code. Yes, I have fallen into the OOP rabbit hole (thanks Mathieu Guindon) and am curious if my OOP approach is on the right track.
Some background: I am creating a Chart Workbook from scratch via da... |
Is there a better way to design this code? I have read that too many function parameters is a sign of poorly design code, and would love some feedback on this code.
The functions Google Maps markers and update the state.
Also any other feedback unrelated is welcome.
Functions:
// Initialising map and markers
export con... |
Project
I wanted to create a syntax highlighter for Java using JavaScript, HTML and CSS. It uses regular expressions to find the parts that should be highlighted (at the moment: keywords, strings, comments, imports) and then uses HTML-tags to highlight the found parts.
Result
The website looks like this before entering... |
I'm doing an exercise where I pick an existing webpage and I code its front end (in HTML and CSS) from scratch, just by looking at it. I started off with an easy one. It would be great if somebody could review my code.
What are the best units to use? I know px is discouraged. Should I replace them with em and rem? How... |
For practice purposes I implemented a function that checks for palindromes:
def palindrom(name):
name_reversed = ""
for buchstabe in name[::-1]:
name_reversed += buchstabe
return name.lower() == name_reversed.lower()
print(palindrom("Tom"))
print(palindrom("Bob"))
How may I improve this code, e... |
Tried to do my own implementation of reflection(introspection) for using in my next projects.
Is it optimized at compile time? If no, how can I improve it?
This macro is good interface for adapting structures for reflection?
What features can(should) be added to make reflection(introspection) more useful?
Godbolt
Macro... |
I am pretty new to C++ and I think I have some problems of keeping code clean and optimized, especially I have problems with writing comments. I just don't know when should I be explaining what I write. Any tips and advices will be hugely appreciated!
Here's the code:
#include <iostream>
#include <initializer_list>
#in... |
I was inspired by this video by Matt Parker to use the Farey Sequence to convert a float into a string representation of a fraction, how did I do? How well did I follow F# workflow and patterns (I'm new to the language)? Can it be done better, or rather, how would a "professional" F# developer write this function? Than... |
I am working on a C# application and I want to support multiple themes, so I wrote a ThemeManager class that can check, load and apply a specific theme. A theme is considered valid, when all of it's member variables are set (not null). If a theme is invalid I want to throw an IncompleteThemeException. However the follo... |
I wrote a function that is supposed to take a format string similar to what date accepts and replace all format specifiers with strings provided by a callback function.
Format specifiers are sequences of a % plus another character; %% for a literal %
Replace the format specifier with the string provided by the callbac... |
I've been working on building a Rust version of GNU tar following the spec here.
As of right now, I've got the binary accepting a single argument, the path to the file/directory to tar, which is passed to a separate library which does the heavy lifting.
The library handles building the Tar record (1 per file), which co... |
I just made a small Luhn Checksum validator
Description of Luhn Checksum
Every number in the Integer gets added individually together, but every second digit gets instead doubled and added. If the doubled number is over ten each individual digit gets added.
It works, but is there a way to make it more elegant and maybe... |
I have written this logic for logging, but is getting replication for all fields (last name, DOB,city, state, ZIP, etc). Here only validation logic is going to differ, whereas logging functionality will remain the same.
public boolean validFirstName(UserInputDetails record) {
if (CommonUtil.isNullOrEmpty(record... |
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time!
Problem
You have a very large square wall and a circular dartboard placed on the wall. You have been challenged to throw darts into the board blindfolded. Darts thrown at the wall are represented as an array of p... |
The idea of a defer statement or a ScopeGuard has, for a while, been something I have wanted in C++, but up until recently I had always assumed that C++ did not have it. However, that's when I found std::experimental::scope_exit but it had a problem, which was that it had not been implemented in any of the compilers I ... |
I am new to coding/programming. About four months ago I decided to develop my skills using Python. After several books and a lot of assistance from this awesome community I developed the first part of my "Pizza Order System" program.
Explanation of my program:
When the program in ran, the user is prompted to pick a piz... |
My target is to have an environment variable being set to a leading substring of $PWD and to be unset when $PWD does not start with that substring.
So I decided to override cd like this (here I'm assuming the substring is just my home directory /home/enrico, but in general is fine for me that it be an hardcoded regex):... |
I'm writing a simple REST API to my MongoDB using PyMongo (Python 3.7).
Each collection I have in the DB has a route (e.g http://the.api.url/collection_name ),
and every document under that collection has a sub-route (e.g http://the.api.url/collection_name/document_id ).
The micro-services in my program need to access... |
I have made a program for my calculator's micropython, that can solve various a level statistics questions for me. However due to the limitations of the micropython's standard library, i had to reinvent the wheel on some functions and could not rely on external modules to do the tasks as they don't exist in micropython... |
I've written PHP code to upload multiple images to a server.
This function processes a maximum of 10 images at one time and if any image's width or height is larger than 2000px it will resize it. But the code is a little bit slow.
I would like to hear your opinion of this code.
Is there a way to make it faster and more... |
I am currently reviewing CTCI(Cracking the Coding Interview)
The question is asking me to implement an algorithm which checks whether the characters in a string are all unique however they do not want me to use any auxillary data structures
My Algorithm is relatively straight forward, Two nested loops one starting at 0... |
My exploration of Rust continues. I'm quite pleased with the 2-step table lookup for decoding variable bit-length codes here, for some reason I found this tricky to work out, but now it's done I like it. InputBitStream has a required "lifetime parameter", it seems these are not given meaningful names, which seems odd, ... |
My implementation of a Sudoku solver. It isn't done using the most naive way but still it does an exhaustive search with some assistance from a heap. The only constraints I have used is the basic rules of Sudoku (a number can occur only once in a row, column and it's box). There probably are more techniques or reasonin... |
I have written a program that will determine the height of a Tetris board after a sequence of moves are made. These inputs are in the form of a comma-delimited list, and look like <piece><position>. List of pieces:
I - this is a 1x4 piece lying on its side
Q - this is a 2x2 square piece
T - this is a T-shaped piece
Z ... |
I am trying to recreate a neat effect that I saw posted on Stack Overflow as a GIF .
I am trying to recreate this with CSS and JavaScript and I have created a similar effect with a button press.
I know there is a better way to position the divs since I am working with 3d moving and rotating. I need to have a formula th... |
Improved version of the original question
I've created a simple npm module and CLI program to get the latest GitHub and Bitbucket release from their APIs using Node.js. Please tell me if there's anything to improve!
GitHub
npm
RunKit
Improved module code
#!/usr/bin/env node
const fetch = require("node-fetch");
/**
... |
I have a rails app with a Project model. Each project has usages which is numeric data.
I need to get all the usage for each month and year. I also need to get usage for specific months and years across multiple projects.
Instead of writing one large service file with raw SQL queries to handle this, I have decided to e... |
I'm moving some files from a Linux machine to a Windows machine over a low-speed, possibly buggy experimental communications channel that I want to test. One of the tests is to transfer large numbers of large and small files and verify their cryptographic hashes at the receiving end. On the Linux side, we're using md... |
I am writing a python GUI application that plots weather data on a map for a specific region. It plots temperature, dewpoint, wind data, and icons that represent the sky conditions. It extracts the data for longitude/latitude from text files. I timed out how long it takes for the program to plot each type of weather da... |
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time!
Problem
Given a non-empty binary tree, find the maximum path sum.
For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. T... |
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time!
Problem
Given a non-empty binary tree, find the maximum path sum.
For this problem, a path is defined as any sequence of nodes from some starting node to any node in the tree along the parent-child connections. T... |
In another Code Review, it was recommended that I alphabetize my CSS. So I made a tool to do this quickly in JavaScript.
Because CSS has two levels (selector on the outside, parameters on the inside), and they both need to be alphabetized, alphabetizing it is not as easy as just doing array.sort(). A custom tool is nee... |
I made the UI for the hacking minigame from the Fallout series. Could I get some feedback on the main Game.js component? It's my first React app.
I'm especially curious as to whether my code is easily testable, and also if it has a lot of clarity, ie. if it's easy to understand. I am also curious of improvements that c... |
Good evening, I'm new to Rust and would like some help refactoring this small app I made so that it's more efficient, even if it may be unnecessary.
Basically I'm trying to figure out better ways to do stuff, and if I could analyze how someone would do the same thing, but better, I think it could help me learn a bit m... |
I've got this quick and dirty little console app in C# to serve an HTTP/HTML page.
static void Main()
{
// create a socket
var socket = new Socket(SocketType.Stream, ProtocolType.Tcp);
// bind to localhost:8080
socket.Bind(new IPEndPoint(IPAddress.Loopback, 8080));
socket.Listen(16); // listen
/... |
I am not happy with two functions calling get_user() since while testing I mock get_user and to test with get_user_returns_null case, it returns Null for both function calls naturally which hints that the structure is not correct. I am using flask-sqlalchemy with postgres models ORM.
def insert_user(user_details):
... |
Problem:
Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".
Problem from here.
This is my code:
/*
* Code by Clint
*/
public class F... |
This is my first C program. I want to optimize this simulation.
Algorithm
The simulation algorithm is:
The system can go from \$i\$ to \$i+1\$ with probability \$e^{-L\theta(\rho_i)}\$, where \$\rho_i=i/L\$, and \$\theta(\rho)=\rho(2b-\rho)\$.
When system reaches \$n=0\$, it is revieved (resurected) to position based ... |
I have the following method that is responsible for retrieving an Item from the database. There will be multiple threads instantiating this class, so I want to make sure that the operation will be thread-safe. As a result, I have added a lock around it, however since class only contains instance variables (and no stati... |
I have a file with over 2 million lines. I want to get the 8th column of the file and find the pattern that contains "DP=" and "QD=" and then save all the values in an array, get the mean, median and create a figure. I wrote the following script. This script goes through each line in a loop, find the pattern and saves ... |
I'm in the process of reviewing some old code released by an old colleague.
We have a cronjob that executes once in an hour to download some thumbnails: the paths to the thumbnails are stored in a plain array.
// $totalThumbs is usually less than 2000 (each about 3kb)
while ($i < $totalThumbs) {
$imgName = basename(... |
I have the following code, which displays the content for my custom page template "landingpage.php" and for single posts. The site uses Bootstrap 4.
<?php if(is_page_template( 'landingpage.php' )): ?>
<div id="content" class="site-content">
<div class="container-fluid">
<div class="row">
... |
The below algorithm is supposed to take a list of input IPs/networks and a list of IPs/networks to exclude, and return a list of networks that don't include any of the IPs/networks to exclude...
Please review it and provide me with some feedback!
import ipaddress
from ipaddress import IPv4Network
def recurse_exclude(s... |
I'm attempting exercise A.2.1 from the book http://alloytools.org/book.html. Having got this far, I find that when stepping through instances I only ever get 2 connects links, no matter how many requests links, when using the MiniSat solver. When using MiniSat plus Unsat core, I sometimes get more connects, but not man... |
Am using Java 1.8 and JUnit 5 to test a program which I wrote which grabs external zip files from a public url and then converts them into MD5 based hashes.
This post / question serves as not only a code review (but also contains a design & implementation question) for the class that is under test and the test case, it... |
I'm writing a web server from scratch on pure Java in learning purpose. As a part of request handling, I worked on a class to parse HTTP request, I expect from it to be able to do next things:
extract http method, headers and body from request
return BAD REQUEST in case of malformed request
response with error on clie... |
I am importing an Excel sheet where the first column will contain product numbers. I match those numbers to my SQL database and display the product number and description of the matching products to a datagridview.
The code works, but if there are a lot of products it can take a long time. What I'd really like to do i... |
While quarantine I decided to look into the assembly language, as it's quite interesting to see how code works on the lower levels. To challenge myself I made a binary search algorithm. The OS is Windows.
I just code casually (in Python and C++, so I know about the concept of pointers), therefore I don't have that much... |
This is my scraper for AWS ECS (Elastic Container Service). My primary use for this is to grep through the resulting file to see which cluster a given service is in.
I've been coding in python for a few years now, but I don't feel like my code is as pythonic as it should be. I've run this though pylint and it passes ... |
The goal here is to notate and produce essential PDF reports.
The For loop takes an id number and puts it into specified calculator worksheet. The workbook is set to automatic calculation so all of the necessary values update. Then it copies the result then saves as PDF a set of worksheets labeled Report
The code works... |
Users input their pin-code which is checked against the database and returned with the locality, district and state associated with that pin-code. Multiple localities may be returned so the options are passed to a select element so the user can choose theirs.
Old values are also passed as props to the Vue component and... |
This is my first big project. I missed ArrayList a lot in C and thought that it would a very good learning exercise if I implemented my own in C. I tried to take all the features from Java's ArrayList and Python's list. I'd be really glad if you guys could give me some reviews on it.
The only code that needs to be revi... |
This is my first ever created game. I been slowly but continuously learning PHP for the past 2 months and just last night I thought that I might be able to create a simple and very basic game.
Due to my lack of coding experience I am aware that my code could be pretty bad to the point of making anyone to cringe.
But be... |
My form comprises of a mandatory file input.
The form is validated according to the jQuery validate plugin.
The file input has attribute required so that the validator recognises it as a mandatory field.
Problem statement:
Each time the user selects a file, the value of the file input is immediately reset to "". ... |
I have designed and Online Book Reader System as considering the previous reviews on this platform. You can find the classes below. I would be appreciated for the valuable reviews.
Assumptions: "Online Book Reader System" is a system that includes online books and serves its customers to read books online. Users should... |
I wrote this variant of Bresenham's for fun. I am looking to see what I can optimize as it is still slower than Bresenham's.
The idea here was that if I could isolate out the IFs in Bresenham's loop it'd be more efficient. Well go figure, the added multiplication (A) or array lookups (B) in the pre-calc destroy said ef... |
I'm learning C++ using a book and currently, I'm reading the section about formating output data using manipulators. There is a program written to output data once without showing the base and again with its base. It is a simple program as follows:
#include <iostream>
using namespace std;
int main()
{
... |
Hi guys Im very very new To Angular/Typescript Im teaching my self section by section by just messing around and figuring things out.
Currently im just doing loop's and outputs so I decided to write a Randomizer for a Moba
Its. 5 Arrays then I select a Random item from each Check that they dont match and output
But I j... |
class ChristmasTree
{
private static void byHand()
{
System.out.println( "Chritsmas tree, yey." );
System.out.println( " *" );
System.out.println( " ***" );
System.out.println( " *****" );
System.out.println( " *******" );
System.out.println( " ********"... |
I have a macro created by my predecessor that I run on a monthly basis. However, it does take a while to get through, and I would like to clean it up for efficiency please.
It copies data from multiple Workbooks:
Wholesale\Reporting\Market6 Scorecard\Templates\52 Wk Data.csv
Wholesale\Reporting\Market6 Scorecard\Templa... |
Aware that this is a very common exercise; but I'm getting a bit obsessed about creating a simple, clean-ui todo app, at least for myself.
It's not quite finished yet, but I guess it will be much easier to review now than at the end, in case you look at the javascript code (react)
I'm looking any simple advice, best pr... |
I've implemented a Game of Life in Kotlin.
There are some major requirements on this solution:
Purely object-functional production code.
As close to an infinite universe as possible.
File src/test/kotlin/…/PointTest.kt
package com.nelkinda.training.gameoflife
import org.junit.jupiter.api.Test
import kotlin.test.asse... |
I've included the files that I felt were relevant (i.e I haven't included the individual pieces in the inheritance hierarchy). I'm particularly curious as to whether the system as a whole is constructed well. I've used MVC along with the Observer pattern to decouple the model and view.
Controller.java
package chess;
i... |
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time!
Problem
For an integer n, we call k>=2 a good base of n, if all digits of n
base k are 1.
Now given a string representing n, you should return the smallest good
base of n in string format.
Example 1:
Input: "13... |
I created a music player using swiftUI.I need to ask a question when I break up my player into usable components. How should I take this approach with the music player? because the music player is one view can't break up?
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
... |
I'm new programmer and I'm working on Xamarin MVVM app and I have a pin view like
So, basically I have numbers from 0-9 if you pick one number its visible then if you pick a second one first one changed to * and I store all numbers into string called PinCode
ViewModel Code:
public string PinCode { get; set; } = str... |
I have completed this question and I am wondering what is the fastest way to solve it.
The question is "There is an array with some numbers. All numbers are equal except for one. Try to find it!"
Example:
find_uniq([ 1, 1, 1, 2, 1, 1 ]) == 2
find_uniq([ 0, 0, 0.55, 0, 0 ]) == 0.55
I came up with the solution:
from col... |
I recently created a program that could get information from a client, a name and some text, and then put that into a text file. From there the user can get open the text file straight from the program. I made it in two days. Please give me some tips in ways I can improve it, thank you!
The Server:
import java.io.*;
im... |
So this is my first time writing a Lexer, and I want to make sure I'm doing it right. The lexer is not complete for a programming language right now, because I think I can easily add more stuff later. Here is the code:
main.cpp
#include <iostream>
#include <fstream>
#include <memory>
#include <unordered_map>
#include "... |
I'm new to programming and this is the first thing I'm doing on my own. I would appreciate it if you could point me ways to optimize this RPG dice roller code in Python!
import random
def dice_reader():
##this should read messages like '2 d 6 + 3, 5 d 20 + 2 or just 3 d 8'##
message = input('>')
reader = mess... |
I'm currently building an application using Passport and bcrypt for user authentication. I've created the registration part. Is there anything I could improve on? I'm still getting the hang of writing in JavaScript and I'm not sure if I'm using arrow functions correctly.
require('dotenv').config();
const express = requ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.