All Questions
473 questions
44
votes
2
answers
40k
views
Balanced parentheses
Given an expression string exp, write a program to examine whether the
pairs and the orders of
"{","}","(",")","[","]"
are correct in exp.
For example,...
12
votes
1
answer
1k
views
Responsive/adaptive website code
I have all these functions that work together to create functionality on a page. Is the structure of these functions OK? Can I do anything to speed this up or make my code better? I'm not exactly ...
12
votes
4
answers
66k
views
Different way of writing multiple click functions
I have the following .click() functions:
...
9
votes
2
answers
10k
views
How can I quickly find unique list items?
I use the loop-every-single-list-item approach to filter out unique elements in a given list, which tends to be very inefficient way as a list grow in size, or as function call frequency increases. ...
9
votes
2
answers
2k
views
Enforcing set environment variables
Context
I have a node.js application that uses many other modules and libraries. Some of these modules pull details from process environment variables, such as URL's for databases, credentials, and so ...
7
votes
1
answer
350
views
MVC - Control Module - Version 2
All models are in the model namespace and follow a naming convention. This makes it easy to consolidate control into cType() as shown below.
All control passes ...
7
votes
2
answers
203
views
Adding links to tags on StackExchange sites
This Greasemonkey script adds links to tags on StackExchange sites which allow for activating, deactivating and ignoring favorite and related tags by using UI components.
Since JavaScript is not my ...
30
votes
2
answers
819
views
Desktop Notifications for flags and queue items
After our recent election, I got elected as a moderator here on Code Review (Thank you, community members!). One of the first things I missed among the moderator tools was desktop notifications for ...
25
votes
3
answers
719
views
Code-Q2A - copy code blocks from questions to answers
I came up with an idea for a userscript to simplify writing answers on Stack Exchange while writing a previous answer.
This userscript adds "Review"-links on the top of each code segment. When ...
24
votes
3
answers
3k
views
Simple object-oriented calculator
After studying several ways of doing OOP in JavaScript I think I finally came up with one that seems OK to me. Is it okay? Do you see some problems I can face by using OOP in JavaScript like this?
...
11
votes
1
answer
574
views
node.js passport wrapper
I have started some experiments with node.js.
Any comment on style (especially the callbacks) and best practice is appreciated:
PassportControl.js
...
8
votes
2
answers
21k
views
Getting the divisors count of an integer
I am using mod and my code works. I am wondering if there is a more efficient way to write a method that returns the total number of divisors for an integer.
...
7
votes
5
answers
8k
views
Validate that brackets are balanced
I've done a test for a job (which I failed) and I'd like to know in which ways my code could've been better.
Here are the questions and my answers, it's not very long.
1) Make a program that ...
6
votes
2
answers
429
views
Simple object-oriented calculator - follow-up
This question is an improvement I did based on recommendations from this other question: Simple object-oriented calculator
JSFiddle
...
5
votes
2
answers
911
views
Matrix of articles and authors from large JSON dataset
Given the following JSON data containing 4 articles by 4 different authors:
...
3
votes
1
answer
207
views
Simple HTML website with JavaScript navbar
The following code is a website with a nav-bar on it. It uses some simple JavaScript to make it work:
index.html:
...
43
votes
5
answers
31k
views
Determining if two words are anagrams
I was given a this problem at a technical interview and failed miserably in the time given. Afterwards, I sat down and worked out what I think is a good solution. The task was actually to build an ...
24
votes
7
answers
10k
views
FizzBuzz in Javascript
I'm sure everyone here knows what FizzBuzz is. I would like constructive criticism for my solution.
I'm a beginner to programming as a whole and this isn't my first solution, but it's what I think is ...
23
votes
1
answer
2k
views
Brainfuck interpreter in JavaScript
Just what it says on the tin: a brainfuck interpreter in JavaScript.
...
15
votes
2
answers
2k
views
Markdown to HTML
...
13
votes
2
answers
191
views
Bookmarklet for selecting code snippets on Code Review
The following code will add to each code block a 'Select Code' button that will select the code belonging to that block. Please review for maintainability.
In order to use this, visit http://...
13
votes
2
answers
31k
views
Changing Number to Words in JavaScript
One day I saw a question on Stack Overflow asking about changing numbers to words, I thought about it, and next day I started coding. When I had the code working, I thought it could, most likely, be ...
12
votes
2
answers
849
views
In-browser syntax highlighter
I've made a simple in-browser syntax highlighter using JQuery. It's pretty simple, it just wraps keywords, integers, and such in <span> elements with color ...
11
votes
1
answer
305
views
Snake on a Plane
My code uses a canvas element to create a live snake game on a plane!
...
11
votes
1
answer
407
views
Brainfuck interpreter in JavaScript, take 2
The previous version is here. This version takes suggestions from that review into account:
brainfuck is now an object instead of a function, and ...
10
votes
2
answers
230
views
Associating degrees with notes of scales
I have a JS file that creates an object with notes from a music scale when given a key (aka tonic/ note). The code works and does what I want it to do. I need a critique on the way it's written, what ...
9
votes
4
answers
1k
views
Simple Number to Words using a Single Loop String Triplets in JavaScript
I have extensively reviewed 2 old articles on the subject: https://stackoverflow.com/questions/14766951/convert-digits-into-words-with-javascript and https://stackoverflow.com/questions/5529934/...
8
votes
2
answers
296
views
Desktop notifications for queue items
I wasn't satisfied with Simon's alert on the orange alert. I wanted to know if even 1 review item was available, so I made some modifications to the userscript so that it runs on the Review page, and ...
8
votes
2
answers
335
views
Local user registration
More javascript (nodejs) to go with the passport wrapper I just posted:
UserBook.js
...
6
votes
3
answers
440
views
Brainfuck Interpreter in JavaScript 3
I have this Brainfuck interpreter:
...
6
votes
2
answers
444
views
Sending Email Through App Script
Background
This is a function that is part of a library written in GAS. A function inside a library I've written is supposed to send out an email to another user or users with accompanying details (...
6
votes
1
answer
100
views
Desktop Notifications for Queue Items - Updated Code
A while ago I took one of @Simon's scripts and updated it to make it more geared towards normal users (no offense mods) and this Question was created. But the link to the Github is no longer correct ...
6
votes
1
answer
406
views
JavaScript module to render and handle a form to add users
I recently switched to modular JavaScript and really like the idea of having the state of your application in JavaScript and not in the DOM. I want to know if what I am doing is considered best ...
5
votes
4
answers
481
views
Calculate Final Grade: follow-up
I'm creating an online calculator to get the average grade of different tests my students take and also the final grade. I wonder if you see any problems in this update or any way to improve it:
<...
5
votes
1
answer
234
views
3D 1st Person Snake Game #2
This is an iterative review of this question: 3D 1st Person Snake Game #1
The next iteration can be found here: 3D 1st Person Snake Game #3
Here is a snippet of the code:
...
5
votes
2
answers
162
views
Event emitter npm module
I was asked to complete the task described below:
Event Emitters are objects that serve as the core building block in event-driven architectures. They simplify the process of handling asynchronous
...
4
votes
1
answer
456
views
Determine whether any permutation of a string is a palindrome
The task:
Given a string, determine whether any permutation of it is a
palindrome.
For example, "carrace" should return true, since it can be rearranged ...
4
votes
2
answers
7k
views
Codewars: Sum of Pairs
I've been working on this task (see screenshot).
Here's my answer to it so far:
...
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 ...
4
votes
2
answers
1k
views
Wrath Cookie Switch for Auto Golden Cookie Clicker
Sometimes you feel like a wrath cookie and sometimes you don't.
Here is a function that I created that will run on an interval, so all I have to do is set a boolean when I want to switch between ...
4
votes
1
answer
595
views
HTML Editor : online HTML editor with real-time preview
Note
Please review the new question and ignore the following.
Overview
HTML Editor is an online HTML editor with a minimalist approach. Edit your HTML, CSS, and JavaScript code and monitor the ...
4
votes
1
answer
1k
views
HTML5 Snake Game
This is the first version of my first HTML5 game. Beyond the standard features, I've added a high scores board which uses local storage to keep track of the scores.
You can move the snake with the ...
3
votes
1
answer
220
views
Login Server with Node.js
I'm currently learning Node.js. To practice, I've decided to create a login server. The program goes as follows:
User connects to local website (10.0.0.79, props to this users answer for helping me ...
3
votes
2
answers
1k
views
Find the elements that appear only once
The task:
Given an array of integers in which two elements appear exactly once
and all other elements appear exactly twice, find the two elements
that appear only once.
For example, given ...
3
votes
1
answer
81
views
HTML5 Tile Cycle Puzzle
It's been a while since I did anything with JavaScript. I made a tile puzzle game to help me brush up. You can find it here: https://compucademy.net/tile-puzzle/
I would like some feedback on my use ...
3
votes
1
answer
301
views
Simple object-oriented calculator - part 3
This question is an improvement I did based on recommendations from these other questions:
Simple object-oriented calculator
Simple object-oriented calculator - follow-up
To those looking this ...
3
votes
2
answers
4k
views
Javascript based War card game
I'm working on a game of War for a potential employer and I was hoping someone could review my code and provide feedback on my code.
HTML/CSS
...
3
votes
1
answer
352
views
Contact form with spam-prevention
Idea
After a handfull of small javascript-projects, I also wanted to work a bit with php now. I decided to create a simple contact-form. Of course, I wanted it to be as spam-save as possible, so I ...
2
votes
2
answers
79
views
Dim Hero & Add Background to Nav on scroll
I have followed a tutorial that initially was for adding a 'sticky' nav. I adapted this slightly so it adds a background to the Nav when the page scroll reaches the top-third point of the hero area.
...
2
votes
2
answers
168
views
A package for sort algorithms - v2
Looking for general feedback and praise. This is for learning an not implementation as I would expect the built is sort algos to be much faster.
Addressed issues here:
A package for sort algorithms
...