Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
5 votes
3 answers
286 views

Largest Triple Products without using sort?

I implemented the Largest Triple Products algorithm, but I use sort which makes my time complexity \$O(n *log(n))\$. Is there a way to implement it without a temporary sorted array? The problem: You'...
1 vote
1 answer
233 views

UserScript to Highlight tab for queue item

It may seem a bit obsessive and/or pedantic, but the following script allows me to see when posts are ready for reviewing. I developed this UserScript for use with TamperMonkey to allow me to have a ...
6 votes
1 answer
152 views

Timezone-based VPN-detection

I use the following snippet at my browser homepage to detect whether or not I have VPN turned on. If the IP timezone is different from the browser timezone, then it is most probably VPN is turned on. ...
-5 votes
0 answers
30 views

Avoid duplicate if checks when overriding a method in JavaScript? [closed]

I have the following parent class method in JavaScript: ...
4 votes
2 answers
2k views

Given a pivot x, and a list lst, partition the list into three parts

The task: Given a pivot x, and a list lst, partition the list into three parts. The first part contains all elements in lst that are less than x. The second part contains all elements in lst that are ...
5 votes
1 answer
164 views

SET game in javascript

"SET", not to be confused with the data-structure is a card game in which player try to find a combination of 3 cards. Each cards have 4 attributes: color, number, shape, and filling-...
3 votes
0 answers
108 views

Splash screen library in jQuery

I have created a splash screen library in jQuery. The splash screen will display until the website has completed loading all the images. I just wanted to know if there are any possible improvements. ...
5 votes
0 answers
53 views

React and D3 Alignment Histogram

I'm reasonably new to D3, and I've put together a class based React component which outputs a genomic alignment visually. The ...
1 vote
2 answers
79 views

Figure/number to text converter javascript implementation (turn around)

A turned around, starting from units digit, reimplementation of Figure/number to text converter javascript implementation (second thought) started by Figure/number to text converter javascript ...
1 vote
1 answer
53 views

Figure/number to text converter Javascript implementation: my take in Dutch: v2

I did a second version for my original question: The original question The reason I ask this question is I was trying to answer a question from a different user: Figure/number to text converter ...
3 votes
2 answers
333 views

Intersection of 2D vector equation straight lines

I know the vectors that describe two perpendicular lines, $$\mathbf{a} + \lambda\mathbf{d}$$ and $$\mathbf{b} + \mu\mathbf{d'}$$ I've written a JavaScript function to get the coordinates of the point ...
5 votes
1 answer
117 views

Cryptographically secure random int in range

I tried to make a cryptographically secure random int in range generator for javascript, practically the javascript equivalent of php's random_int(min,max): ...
0 votes
1 answer
65 views

JQuery selector optimization for multiple clicks

I have multiple inputs that each one has an increment and decrement button The buttons will be pressed multiple times so I am looking to optimize my selector: So should I keep the first one (which ...
2 votes
1 answer
339 views

HTML Editor: Online HTML Editor with Real-Time Preview

Overview HTML Editor is a web-based HTML editor designed for web developers, designers, and learners. It offers a lightweight, minimalist environment for writing and previewing HTML, CSS, and ...
2 votes
1 answer
114 views

Figure/number to text converter Javascript implementation: my take in Dutch: v1

I read this question Figure/number to text converter javascript implementation. Like the answer said, that version has two main issues. I tried to solve them. The main issues with the original: The ...
5 votes
1 answer
169 views

Code to generate an array of 364 random special characters with 20 random words broken up throughout

I am trying to recreate a Fallout 4 style terminal hacking game, so I wanted to create code to generate the terminal output (namely, 32 rows with 12 characters each and 20 random words spread out). ...
0 votes
0 answers
68 views

JavaScript: Retry wrapper for the fetch-API

I know there are many good libraries for this, but to understand the issue better, here is my own basic attempt. The fetch will be retried if it fails with a promise rejection or the response ...
1 vote
3 answers
1k views

Math calculation JavaScript. Am I using Objects correctly? Can I use methods / functions to shorten my code further? Also error logging?

Context- CRM system, front-end form. Requirement- Within a form users have to give a rating to a section based on user inputs, each rating has different weighting. The rating is stored in an option ...
5 votes
1 answer
114 views

Support Captain Picker in Vanilla JavaScript

I have been tinkering about a program that would pick the support "captain" of the day on workdays with the following rules: Program should only pick a captain on weekdays (Mon. to Fri.). ...
2 votes
0 answers
131 views

Complete HTML 5 platform game as a snippet

I made a complete little platformer game as a code snippet. The goal is to try to keep jumping on the enemies without touching the ground to increase score. I used Tad's Basic Game Objects, an open ...
1 vote
1 answer
113 views

Filtering array in JavaScript and outputting to DOM - repetition

Sample code below - it works, but feels clunky. clients is provided from a DB as a json_encoded array of objects (in the real ...
5 votes
1 answer
89 views

Code for smart CSS rounding using JavaScript

I wrote a project that allows you to make CSS corner rounding more consistent and, in my opinion, nicer. Here's full GIT repo with an example and a README.md: https:...
0 votes
0 answers
20 views

Trying to convert svg to React and react native components while supporting a number of customisations

...
2 votes
1 answer
82 views

Merge discrete integer intervals

What it does The code starts with a set of integer intervals, and can add new intervals (possibly by updating existing intervals). Essentially, it is a bit array whose index starts at ...
4 votes
2 answers
133 views

Filter an object array based on certain conditions

How can I rewrite this in a cleaner way? I have this function that takes a list of contacts of different types (are being called ...
2 votes
1 answer
73 views

Figure/number to text converter javascript implementation

Developed around chain of responsibilities design pattern, it consists of a series of converters returning arrays of string that could be used either to look up text mapped to the keys, for ...
2 votes
1 answer
714 views

Google Chrome Service Worker Persistent Storage Caching System

Moving from Google Chrome Extensions’ Manifest V2 to Manifest V3, service workers replace background pages. Background pages can be configured to be persistent, but service workers can’t be persistent....
5 votes
1 answer
75 views

Browser and Node.js compatible code require

The Reason The reason I designed this code was that in many cases, when I wanted to test code in the browser that would be running on a Node instance, the code that I was copying (Don't worry, copying ...
3 votes
1 answer
43 views

My surrealdb (1.x) migration script

I'm working on a migration script for surrealdb (currently working with 1.x). Please review and let me know what I should improve. ...
8 votes
3 answers
28k views

Counting characters inside of a textarea using Angular

I have a textarea and need to calculate how many characters have been typed into it. Both of the following solutions work correctly—which would be preferable,...
3 votes
2 answers
155 views

Basic Linked List Implementation in JavaScript

Clarification of Intent Recursion here is used on purpose for practice - note that iteration is preferred in this case (I'll be more clear about where my intentions are!) Factory function was also ...
2 votes
2 answers
133 views

Faster regex to match all worded numbers from 1 to 99

I would like to know if there is a better regex to match all worded numbers from 1 to 99. With "better" I mean shorter with same performance, OR faster. I came up with this. I can't do ...
5 votes
1 answer
513 views

Better way to share JavaScript code [closed]

I am working on a website using .NET Razor Pages. I have multiple pages that share JavaScript code. I'm using vanilla JavaScript. I have to perform actions related to mapping using leaflet. Most of ...
5 votes
1 answer
121 views

Generate a Penrose tiling

I would like to know if it's possible to optimize the code the generate this type of Penrose Tiling. I finished programming this type in javascript / p5.js and the algorithm works very fine and takes ...
-2 votes
1 answer
97 views

Clicker game feedback [closed]

Can someone please look at my clicker game and tell me if it is good and what to add? ...
2 votes
2 answers
79 views

Optimize Working Live Search & Highlight Function

I've written a custom Live Search & Highlight function in vanilla JS. It is working and does what I expect it to. The issue is that the more items I add to the page content to search, the slower ...
4 votes
5 answers
285 views

Gomoku game 5 in a row. Javascript simple game Canvas

Gomoku ★★★ (Tic Tac Toe) There are many Gomoku (5 in a row) game projects on the Internet. The scripts of these projects are freely available. Having analyzed them, I created my own game code based on ...
4 votes
3 answers
111 views

How to optimize the algorithm of generating images in javascript canvas?

I added this question on Stackoverflow, but it was suggested that I post it here. Currently, I create 2000x2000 pixels canvas and tile the image on it, and then tiling the texture on top and applying <...
7 votes
2 answers
300 views

Library project - javascript

I am going through the Odin Project and have just finished the 'Library' project on their FullStack JavaScript course. As this is the first time I'll have my code reviewed, I want to know what I'm ...
4 votes
1 answer
377 views

Tic Tac Toe with only the 3 last moves

I wrote a Tic-Tac-Toe game that unlike the normal TTT only saves the last 3 moves. That means, that the first move will be removed on the 4th move and so on. To not necessarily extend the description ...
5 votes
1 answer
2k views

JavaScript implementation of Pascal's Triangle

I'm currently trying to teach myself JavaScript. If someone could critique my implementation of Pascal's Triangle I would be very grateful. ...
4 votes
2 answers
5k views

Laravel 8 registration and login with user profiles

I am working on a Laravel application (Github repo) that requires user registration and login. After registration, the users can change their registration details (except password, for which there is ...
0 votes
0 answers
3k views

TypingTest Autotyper Userscript

For fun, I decided to inspect the obfuscated source code on TypingTest and figure out how to write an auto typer for it. I came up with the following UserScript. A couple of notes: The site's code ...
10 votes
1 answer
261 views

Chart showing the Percentage of Answered CR questions

Every day Duga reports the number of unanswered questions and percentage of answered questions (after she calls the API endpoint /info) in The 2nd Monitor. I ...
2 votes
3 answers
193 views

Efficiently tagging first and last of each object matching condition

How can I make the code more readable and more efficient? (provided code is O(n²) time, but intuition says it can be pre-processed and done in O(n) time) Description it tags the first and last of ...
1 vote
1 answer
120 views

Javascript Signals implementation

I've created my own implementation of signals in typescript, inspired by the proposed tc39 specification (https://github.com/tc39/proposal-signals) in the BOM. I think it would be great if I could use ...
3 votes
1 answer
96 views

Plain JavaScript Rock, Paper, Scissors

As part of "The Odin Project" web-dev curriculum, I created a simple "Rock, Paper, Scissors" game. I am hoping to receive feedback on how readable the code is and if the ...
0 votes
2 answers
75 views

Showing the even numbers between two numbers which the user has entered

I've done it to be honest, but I feel like I'm writing extra code. I want a shortcut. The code is: ...
5 votes
1 answer
104 views

Secure password generator form

With the demise of passwordsgenerator.net I wrote my own generator; Please review with an eye on correctness and maintainability; ...
4 votes
1 answer
455 views

HTML Editor, Online HTML Editor with Real-Time Preview

Note Please review the new question and ignore the following. Overview HTML Editor is a web-based HTML editor designed for web developers, designers, and learners. It offers a light-weight, ...

1
2 3 4 5
188