konijn
  • Member for 9 years, 6 months
  • Last seen this week
  • Lyon, France
Increment the neighbors of a cell in a matrix
6 votes

Like Simon I would store the directions into a data structure, though I would probably hard code it //Array Index Constants var X = 0 , Y = 1; //All 8 neighbours ( vectors ) var vectors = [[-1,-1],[-...

View answer
Angular promise in service
Accepted answer
6 votes

This took a while to parse, it's probably me, I found few flaws with the code, except for a distinct lack of comments. I would have made url in preload an optional, 2nd parameter, I would probably ...

View answer
Merge sort could work 10 times faster
Accepted answer
6 votes

Some pointers: You keep adding 2 numbers here: startingIndex + i, that could probably be avoided if you went for(int i = startIndex; i < lastIndex; i++){ where lastIndex would be startIndex + ...

View answer
Ping-pong game with JavaScript and Canvas
6 votes

From a once-over, Short 1 letter variables are terrible ( except for x and y ), b, p and W are just terrible Also please spellcheck your variables: padles -> paddles You should only detect collision ...

View answer
Two Knockout computed dependent on each other
Accepted answer
6 votes

I will review and contrast the SO answer that I liked best: function viewModel() { var self = this; self.NetPrice = ko.observable(100); self.TaxRate = 0.2; self.TaxAmt = ko....

View answer
Allowing user space file-system to (kind-of) keep more than maximum number of files open
6 votes

From a once-over: Naming You seem to use all kinds of conventions, all lowercase, sometimes you use an underscore, sometimes you use lowerCamelCase. Perhaps you should stick to the underscore_style. ...

View answer
Simple to-do list as a single page application
Accepted answer
6 votes

From staring a while at your code; Grokking Your HTML stretches really wide sometimes, for maintainability I would indent more: <td class="col-lg-5"><span data-bind="text: title, visible: !...

View answer
Validating HTML Form
Accepted answer
6 votes

From a once over: Function names in JavaScript should only start with a capital if they are constructors, so Number is no good, since it returns a boolean, I would call it isNumber() I would put a "...

View answer
Monopoly: Positions
6 votes

Some minor remarks: Your Cities class should be called City If you are willing to use falsey boolean checks, you do not need to initialize forsale to false I would store the prices separately: var ...

View answer
Angularjs extends service
6 votes

At first sight, your code is short and there is nothing wrong with it. At second sight, there are a few things to improve: Your semicolons are all over the place; you have both missing and pointless ...

View answer
JavaScript Quiz App
6 votes

Quite nice! A general thought is that you could always store the correct answer first, and then show the possible answers in a random manner to make your code more DRY. Furthermore: Since you do ...

View answer
node.js passport wrapper
Accepted answer
6 votes

From a once over: Your indenting is a mix of 4 space and 8 space tabbing, please stick at all times to either 4 or 2 spaces. Looking at deserializeUser is aneurysm inducing. You have a ton of ...

View answer
Creating a simple login with AngularJS
6 votes

There is much wrong with your code.. You are iterating over every record to find a username, what happens if you have lots of users ? You are not verifying the password !? It seems like you are ...

View answer
Calculating Julian dates
6 votes

Welcome to Code Review, I do not know how to solve your problem, however, your code could use polishing. Magical constants; your code is littered with them, use constants instead Undocumented ...

View answer
HTTP site scraper
6 votes

I have to agree with the evaluation. 10thLetterRequest and Every10thLetterRequest are pretty much exactly the same, except that 10thLetterRequest only requires the first letter. Yet, you decided to ...

View answer
A script for a photo gallery/slideshow
6 votes

This code could use some changes Using window.onload is a bit old skool, consider using this. If you put id="mainImage" on the image instead of on the div, you can change your code to var mainImage = ...

View answer
Recursive find function in JavaScript / jQuery
6 votes

Overal I think the code looks too busy just to find a key/value match in an object tree-structure, it took a while to figure out which part(s) bothered me. Doing it twice You are doing the matching ...

View answer
Assigning stats in a game
6 votes

You would have to refactor this a few times to make it perfect, these are my suggestions for starters. Naming your variables a,b,c,d,e,s is bad form. You could have called them strength, agility, ...

View answer
Extracting a part of a URL path
5 votes

Super short review; The code should handle the presence or the absence ? in a transparent way The code should probably check for /supplier/ instead of ? That leaves me with function ...

View answer
Verifying if a string can be created with the letters of another string
5 votes

From a short review; Whenever I deal with search algorithms, I like to use haystack and needle as variable names, they are more evocative then str1 and str2 There are no comments, I think you need ...

View answer
Find the best matching combination of numbers
5 votes

From a short review; Your code is really hard to read/parse, I would not want to maintain this You have no useful comments, // <- the quantity is not useful You should terminate your lines with ;...

View answer
Reading code from array efficiently
5 votes

Sure, you are basically copy pasting to keep accessing arTab and promilleTab, you might instead just derive the indexes in arTab from bruddListe and arListe, like this: function skrivUt(Event:...

View answer
Validate parentheses "()" and "[]" are balanced
Accepted answer
5 votes

A short review; checkBalancedBrackets("([)]") returns true, not sure that was the intention b1 and b2 are not great names, what does the b stand for? Using arrays is not needed, all the code does is ...

View answer
Alternating chars N times
5 votes

A short code review; Your code does not work, it should return something instead it calls console.log Your for loop is icky, either update i and check i for(let i = 0; i < num; i++ )) or check ...

View answer
Blackjack game interview task
5 votes

I usually don't do Java code, and TopinFrassi covered most of what I wanted to write, but CARD does not follow the Java enum naming convention. This public String toString() { // the sequential ...

View answer
Eloquent JavaScript chessboard
Accepted answer
5 votes

Fun question; you should write a function that takes a parameter instead of just writing the code A chessboard has lots of repetition, take a minute to ponder how String.repeat could make this code ...

View answer
Rock-Paper-Scissors with the revealing module pattern
Accepted answer
5 votes

I like your question, I think if you are going to export one function, and then immediately execute it, then you are better served with a self executing query. You are writing a game, I would use a ...

View answer
Component-based system for JavaScript game
5 votes

Your code requires a ton of domain knowledge to properly review. I went to your Github repository to try and be more familiar with what you have. Entity support for components You asked specifically ...

View answer
Simple Poker Game
Accepted answer
5 votes

From a once over: In index.js you keep using game.getCurrentPlayer()., since all those activities can only be done by the current player I feel the caller should just be able to just call game....

View answer
Initializing a multidimensional with many default values
5 votes

From a once over: I tend to call colNumber -> colCount or columns It is considered better practice to group your variables in 1 comma-chained var You declared var x twice, this is not needed, and ...

View answer
1 2
3
4 5
27