The Guy Who Keeps Coding While True Yavuz Ege Özcan's blog

Popularity Of Programming Languages On Hacker News 2 years ago

Well, here is an interesting poll. In my opinion, the userbase of HN tends to be more open and experimental than the average programmer crowd and that makes these results even more interesting to me:

RankNameUpvotes - Downvotes
0Python2093
1C1629
2Go765
3SQL704
4Haskell691
5JavaScript683
6C#665
7Lisp635
8Clojure571
9Scheme523
10Ruby489
11Lua486
12Assembly371
13Erlang371
14Rust318
15Scala217
16OCaml203
17F#173
18Smalltalk144
19Shell131
20Forth128
21D88
22Other65
23R50
24Ada14
25Pascal11
26Rexx-53
27Delphi-94
28Tcl-98
29Fortran-132
30Groovy-155
31CoffeeScript-159
32Objective-C-215
33Perl-256
34C++-345
35Cobol-443
36ColdFusion-560
37Actionscript-661
38Java-931
39Visual Basic-957
40PHP-1360

ps. I used the following quick-and-dirty script to parse the results. You can get the current results by running this:

var scores = {}, name, sign;
[].slice.call($0.querySelectorAll("tr:not([style])"), 0)
.forEach(function(row, i) {
if(i%2 === 0) {
var nameAndSign = row.innerText.trim().split(" - ");
name = nameAndSign[0];
sign = nameAndSign[1] === "Like" ? 1 : -1;
return;
}
scores[name] = scores[name] || 0;
scores[name] += sign * parseInt(row.innerText.trim().split(" ")[0]);
});
var scoresArray = [];
Object.keys(scores).forEach(function(key) {
var entry = {};
entry[key] = scores[key];
scoresArray.push(entry);
});
scoresArray.sort(function(b,a) {
return a[Object.keys(a)[0]] - b[Object.keys(b)[0]];
});
scoresArray.forEach(function(a) {
var name = Object.keys(a)[0];
console.log(name, a[name])
});

Parsing Time Manually 3 years ago

How do you get the minute difference between two 12-hour dates encoded in a string like

"12:05am-02:55pm"

?

Short Answer

You shouldn’t. Get your data properly!

But Still…

I hate myself.

Seventh Problem On Project Euler 3 years ago

The Problem

I hate clichés but there we go:

What is the 10 001st prime number?

The Solution

Let’s try a one-liner this time:

var a=[],b;for(b=2;10001>a.length;b++)a.some(function(c){return 0==b%c})||a.push(b);console.log(a.pop());

yay.

Sixth Problem On Project Euler 3 years ago

The Problem

Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.

The Solution

Supposed to be harder, or?

Fifth Problem On Project Euler 3 years ago

The Problem

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

The Solution

I know this can be calculated very easily with pen and paper but overcomplicating stuff is just fun, I guess =)