Code Review Weekly Newsletter
Code Review Weekly Newsletter

Top new questions this week:

Benchmarking things in C#

I needed a better way to benchmark code, because, well, rewriting the same benchmarking code every time I need it is just...well...unpleasant. So, here's a class which does just that, it runs an ...

c# performance .net statistics benchmarking  
asked by EBrown 26 votes
answered by Heslacher 28 votes

Finding two consecutive triangular numbers with a given target sum

I need to speed up this code so it can handle inputs in the thousands. It adds triangular numbers to a list based on input n, then it loops through to find if any two consecutive numbers squared in ...

python performance algorithm loop  
asked by JonnyDoeInWisco 10 votes
answered by alexwlchan 15 votes

Top 10 editors partitioned by year

I wanted to get some stats on who has done the most edits on Code Review, so I wrote the following query on SE Data Explorer. All improvement suggestions are welcome. Note that I used a cursor to ...

sql stackexchange t-sql  
asked by Phrancis 8 votes
answered by dnoeth 4 votes

Accessing the Stack Exchange API

Part of a project I'm getting started on requires access to the Stack Exchange API for certain data, as a result I built a .NET implementation to interact with it. The implementation is pretty ...

c# oop .net stackexchange polymorphism  
asked by EBrown 7 votes
answered by Heslacher 2 votes

Bucket sort in Haskell

As a first step in learning Haskell I am solving this problem, which involves finding the Rith-ranked numbers, given some input list and many Ri. In an imperative language I would make a zeroed array ...

performance haskell sorting  
asked by stewbasic 7 votes
answered by max taldykin 1 vote

Pong-like game in C++ and Allegro5

I've been working on this pong game for the last 10 days, and I'd like to know of your opinions about it, what could I change to make my code better? #include <stdio.h> #include ...

c++ game  
asked by Luna 7 votes
answered by Edward 11 votes

Printing future leap years

My code prints the next 20 leap years: def loop_year(year): x = 0 while x < 20: if year % 4 != 0 and year % 400 != 0: year +=1 ##print("%s is a common ...

python performance datetime  
asked by Andy K 6 votes
answered by Dex' ter 9 votes

Greatest hits from previous weeks:

Convert object array to hash map using lodash

The use case is to convert an array of objects into a hash map where one property is the key and the other property is the value. Common case of using this is converting a "link" object in a ...

javascript beginner lodash.js  
asked by Pete 15 votes
answered by Jon Anderson 34 votes

Snake game in C++

This is my version of the Snake game, written in C++. How could it be improved, and what general advice would be useful for future projects? #include <iostream> #include <conio.h> void ...

c++ beginner game snake-game  
asked by TheKittyKat 22 votes
answered by Yann 21 votes

Can you answer these?

JavaScript function for to toggle multiple CSS-classes at once

The method toggle of Element.classList expects a parameter which names a CSS-class. You can't assign multiple classes at once by using for example an array. So you have to write something like ...

javascript css html5  
asked by st88 3 votes

Recursive bubble sort in OCaml

I'm new in OCaml and just want to be sure that I write code in "ocaml way". My other first programs in OCaml was imperative and looks like python-code. So I decided to write simple code and share it ...

sorting ocaml  
asked by grigoriytretyakov 2 votes

png2jpeg, a utility for converting PNG to JPEG

I've been working on a simple command-line png2jpeg utility. Its purpose is to convert images from PNG format to JPEG. The source code requires the libpng and libjpeg development libraries to be ...

c console  
asked by user102756 3 votes
Subscribe to more Stack Exchange newsletters


Unsubscribe from this newsletter or change your email preferences by visiting your subscriptions page on stackexchange.com.

Questions? Comments? Let us know on our feedback site. If you no longer want to receive mail from Stack Exchange, unsubscribe from all stackexchange.com emails.

Stack Exchange, Inc. 110 William St, 28th Floor, NY NY 10038 <3