Tag Info

53

It would be better to do this with a user style, e.g. using the Stylus extension, like this: .rep, .reputation, .reputation-score { visibility: hidden; } One advantage of user styles over scripts is that they're applied as soon as the page starts to load, so you won't see the rep counts flicker briefly while the page is loading. Also, user styles will ...

47

On a personal note, your code is really clean, the idea is brilliant, and I really hope to see it implemented soon. Your code is well implemented and structured, but there's syntax points that could be improved. I see a lot of basic if-else statements, if you're into ternaries, using them really slims down these statements, but it's at the cost of ...

40

Portability / Compatibility: Does it work correctly on all modern browsers (excluding old versions of Internet Explorer)? In Safari, there is a cute tingly-shiny (don't know how to call it) effect as the fully spread pieces fade out. In Chrome, either there is no such effect, or it's so faint it's not visible. (I'm on a Mac.) (Sorry, I don't know enough ...

39

Performance It works fine for me in Opera and Chrome, but it is buggy in Firefox. Profiling reveals that redraw is responsible (big surprise :) ), and there is not much to optimize without changing the whole concept. Two minor optimizations might be: save 2 * Math.PI in a constant. assign context.fillStyle = particle.color; outside the particles loop (...

31

I have one in the "any other comments" category :) Localization? I know, that's not a concern. Or is it? Localization always seems to get left behind! Ironically, it's exactly for that reason that localizing an application is more often than not, a pain in the neck. But then, how much harder is it, really, to write this: if (items.size() >= ...

29

You could use querySelectorAll instead of getElementsByClassName. That way, you have a bit more flexibility in targeting elements. It also allows multiple selectors. That way, you don't have to loop twice. Instead of [].slice which uses an unnecessary array as host, try using Array.prototype.slice.call instead. Longer, but without that extra array. Also, ...

28

That's a beautiful excuse for writing code, and the final product is quite nice as well. ★ First of all, congrats to your Java-ridden mind for not forcing classes into Python where they aren't needed. ★ You import but do not use OrderedDict and operator. Remove unused imports. ★ It is customary to write your code in a way that allows it to be used as ...

28

I guess this is about as beautiful as PHP gets :p (I had not fun discovering this monstrosity.) One minor suggestion I have is to eliminate the duplication here: if (isset($question[$field_name])) { $sql_params[':' .$field_name] = $question[$field_name]; } else { $sql_params[':' .$field_name] = 0; } I'm surprised our good ...

22

Block syntax This: loop { ... } Causes a syntax error in MRI 2.1. This would fix the syntax error: loop { ... } However, the use of {...} is normally reserved for single-line blocks. Prefer: loop do .. end Methods Use many more methods. It should be possible to figure out what the script does, in broad strokes, by looking only at its main ...

22

For starters, indent your code consistently — the standard in Ruby is two spaces. That includes indenting the contents of your begin-rescue-end blocks. Normally, I don't like to make such a huge fuss about indentation, but in this case I think it's highly important, because: Your program has a highly unusual outline (infinite loops and a function ...

22

You should always have an Alt attribute in your img tags <img src="http://i.stack.imgur.com/bGZ1m.png" width="80" height="43"> <img src="http://i.stack.imgur.com/bGZ1m.png" width="80" height="43" alt="Toy Airplane - Based on public domain image http://pixabay.com/en/aeroplane-aircraft-airplane-flight-161999/" > new lines added ...

22

Technically, the full outer join is insufficient. If during a certain week there was not a single user who posted their first question or answer, the plot for that week needs to be 0. It would be misleading to plot a direct line from the previous week to the following week, skipping the quiet week. So, strictly speaking, you need to generate a series of ...

21

Like Mat's Mug already pointed out, you have some magic numbers in your code. private final WebhookParameters params = WebhookParameters.toRoom("8595"); private final WebhookParameters debug = WebhookParameters.toRoom("20298"); get rid of them. You shouldn't hardcode the stackexchange api url. Instead put it inside a configuration file. If the api ...

20

If this is actually your first SQL you're quite good in learning new languages. Some remarks: The Group By is not weird, it's the SUM, you apply a conditional aggregation but the result is the same as a simple COUNT(*) (you can always get the same result using different ways in SQL). The ORDER BY 'Downvotes' DESC will not work as expected, because single ...

19

Disclamer: My review will be short is longer than I expected but I will only focus on the function useData(). I've read it carefully and did my best to improve it and make it more readable for you. Lets get it started! The first thing that pops in my head is that giant pile of un-indented SVG: \$svg = <<<END <svg xmlns="http://www.w3.org/...

18

// @resource theme https://raw.githubusercontent.com Github isn't a CDN so availability might be a problem if you want to share this to people. Github can go down any time due to maintenance or attack response. Suggesting you have a high-availability, low-latency server somewhere. On every update of a code, it kicks off a CI serve build. After a ...

17

I would encourage you to produce more explicit output, particularly with the filenames. If I wanted to reverse the process and scrape the code into files on my machine, using a Python script such as the following… import json from lxml import html import re import requests FILENAME_HINT_XPATH = "../preceding-sibling::p[1]/strong/text()" def code_for_post(...

17

General Now that you have such neat postings, the answers are going to need to be neater too. GUI Bugs When I run the GUI, it does not let me select directories from the File Browser. It also starts in the 'Documents' directory, and it would be better to do one of two things: start in the current directory start in the last directory used (use java.util....

16

There are a few things that are off in this query. Going through them in some sense of order: I am still a fan of 'old style' joins, but, the CTE concept is a real winner in SQL Server, so, instead of creating the table variable, just use the CTE. I can tell that your code went through some iterations, and as a result, you have some 'cruft' that can be ...

16

Here is how I would rewrite your code. I will add my comments after: plotActivity <- function( activity = 'codereview.stackexchange.com', api_key = getOption('rescuetime_api_key'), from_date = NULL, to_date = NULL) { ## This function plots time spent on a given URL ## using the rescue time API ## ## Arguments: ## - activity: the url ...

16

Documentation I think that what the query is doing is looking at your reputation rank, then rounding up to the nearest 50. It would be nice to hit "edit description" and document that for the benefit of anyone else using Stack Exchange Data Explorer. Generality Data Explorer allows parameterization. Use it. Style You shouldn't have to declare ...

16

A few things, some nitpicks, some UX, some probably-bugs. What Lyle's Mug has already stated is also part of my answer, but first things first: UX This query is quite unwieldy to use, because all the things you might want to play with are hardcoded. SEDE allows using parameters, with a rather simple syntax: ##name:type[?if optional, default value]## ...

16

Update url UserScripts have the magical ability to update themselves if you provide a link to a raw version of your script as a UserScript header: Note: You actually have to increase the version, or it won't update. // ==UserScript== // @name Reputation Hider // @namespace http://gihub.com/Vogel612/ReputationHider // @version 0.1 // @...

15

Conceptually, when you want to perform an action at a fixed rate, you want to use an ScheduledExecutorService. This class is designed to handle the use-case of running code at a fixed rate, possibly with an initial delay. The advantage is that you can schedule more than one task, and it also lets you handle all the tasks, eventually cancelling some of them. ...

14

It's much more important to convey the code faithfully than to save a few bytes of output by replacing spaces with tabs: line = line.replaceAll(" ", "\t"); // replace four spaces with tabs, since that takes less space In fact, since you used your program to produce this question itself, I suspect that your tool is responsible for introducing the bug in ...

14

I find this pretty nicely done and really hard to pick on. But here's a little something. Instead of writing this condition this way: WHERE Posts.CreationDate <= @today AND Posts.CreationDate > @target_week This is shorter and simpler: WHERE Posts.CreationDate BETWEEN @target_week AND @today Keep in mind though that's not exactly the same, ...

14

Magic Numbers You did a very nice job of eliminating all magic numbers/values in the top of your code. However, there is still this one line: var DELAY = 60 * 1000; Where did 60 come from? And 1000? These are still magic numbers, but they are not worthy of new constants; I would just add a simple comment explaining what DELAY is being set to. Thanks to ...

14

'2011-Jan-01' --There was very little activity prior to this date. Including it skews the graph. And then '2011-Jan-01' --There was very little activity prior to this date. Including it skews the graph. If that wasn't Copy+Paste'd, you've given your fingers a lot of work here. And if it was... well then, you've given yourself more work than you should ...

14

One by one, then: Is it good that I stored the posts in tables, or is it unnecessary? It is unnecessary, in this case. What your table variables are doing for you here really is simulating a self-referencing join. You could instead use aliases on the actual table(s), for instance: FROM Posts AS "Answers" JOIN Posts AS "Questions" ON "Answers"....

14

The use of the Tags field on the Post is a poor choice for the query. It relies on a table scan, which is slow, because it has to check each question. Note, you can use the < and > characters to identify tag start and end values in the Tags column, but, as I say, don't use that column. Instead, you should do a join with the PostTags and Tags tables. ...

Only top voted, non community-wiki answers of a minimum length are eligible