Live data from Hacker News

John Resig annotates original jQuery source code

genius.com

51–60 of 102 posts

Re: John Resig annotates original jQuery source code

#51
post #13

Earlier quoted context omitted.

This formatting style for annotated sources always seems to work so well: http://robflaherty.github.io/jquery-annotated-source/docs/01...

I think this wouldn't work for anecdotal comments that John is doing here which runs into paragraphs which would result in lot of whitespace on the right. I think an easier fix would be to highlight the current annotation in a different color while docking the comments to the right while keeping it free for user to move around. I agree that clicking to go to next is annoying. Perhaps mouse over or scrolling should au…

[deleted]

Re: John Resig annotates original jQuery source code

#52
post #2

Very neat content, but does it have to be formatted like this? I respect that it preserves the original file, but it makes it very difficult to read. Comments added to the source code would serve much better for the purposes of understanding the code. This tool makes it impossible to read the annotation and the source code at the same time. Clicking on 'set' for example, about 20-30 lines in, lets you read the annota…

It would be nice if you could simply drag the modal once it's rendered. I think that would be the most simple solution.

Exactly what I was thinking. I'm sure there's some kind of cross-browser, front-end javascript library that you could use to achieve this :)

Re: John Resig annotates original jQuery source code

#55
What surprises me is the lack of comments in the original file. This leads to e.g.:

    this._get(i).$$tmpFunc = f;
    this._get(i).$$tmpFunc(i);
    this._get(i).$$tmpFunc = null;
with the comment (from now):

So this may look crazy — it certainly does to me! Why not just do: f.call(this._get(i))? If I remember correctly, and I just did some double-checking and I think this is the case, but IE 5 didn’t support .call()! The original version of jQuery event worked back to IE 5… I can hardly believe.

I personally hate coming across snippets of code like this (usually from myself ): ). What do I do here? Can I just replace this with .call? Why did he not do .call? Performance? Or just MSIE5 (if I ever figure that out in the first place).

All my respect to mr. Resig, of course! What an almost legendary piece of software. Just interesting to see that this commentless programming is something of all pedigrees.

And a note to people saying "learn from this," please also learn that without the original author and rapgenius, we would never have understood that part. Or at least I wouldn't.

Re: John Resig annotates original jQuery source code

#56
post #37
post #2

Very neat content, but does it have to be formatted like this? I respect that it preserves the original file, but it makes it very difficult to read. Comments added to the source code would serve much better for the purposes of understanding the code. This tool makes it impossible to read the annotation and the source code at the same time. Clicking on 'set' for example, about 20-30 lines in, lets you read the annota…

The main difference between Genius-style annotation and code comments, which I think is important to note (and valuable) is that code comments annotate a point or position in the source, while genius annotations are referring to a span or range in the source.

Well, I think the idea is sound. I'm even into Hip-Hop/Rap, so I should like them.

Unfortunately the user interface is a world of pain. It's unusable. It's worse than quora. Good idea, but the execution needs work.

Re: John Resig annotates original jQuery source code

#57
post #7
post #2

Very neat content, but does it have to be formatted like this? I respect that it preserves the original file, but it makes it very difficult to read. Comments added to the source code would serve much better for the purposes of understanding the code. This tool makes it impossible to read the annotation and the source code at the same time. Clicking on 'set' for example, about 20-30 lines in, lets you read the annota…

I like it. It almost makes me wish I could comment my code like this somehow. I often find that long comments can break my flow when reading code -- but of course, commenting is necessary, so perhaps it could be useful to pull them aside in an IDE. Does something like that exist?

Isn't this sort of the original intent and purpose of Literate programming. I just spent a bunch of my time creating my emacs configuartion in org-mode using babel [0] and man, it was a cool experience. You can comment out the wazoo, linking to the web, other files or other parts of the same file all organized in a custom hierarchy or whatever you choose.

Then just C-c C-v t and all the source code is in a clean seperate file. You can even set it up to include the comments, link to the comments, or whatever other way you want the output to be. If I ever pursue programming more seriously, I can't image not seriously trying to do it in this manner.

0. http://orgmode.org/worg/org-contrib/babel/

Re: John Resig annotates original jQuery source code

#58
post #37
post #2

Very neat content, but does it have to be formatted like this? I respect that it preserves the original file, but it makes it very difficult to read. Comments added to the source code would serve much better for the purposes of understanding the code. This tool makes it impossible to read the annotation and the source code at the same time. Clicking on 'set' for example, about 20-30 lines in, lets you read the annota…

The main difference between Genius-style annotation and code comments, which I think is important to note (and valuable) is that code comments annotate a point or position in the source, while genius annotations are referring to a span or range in the source.

> The main difference between Genius-style annotation and code comments, which I think is important to note (and valuable) is that code comments annotate a point or position in the source, while genius annotations are referring to a span or range in the source.

I don't think that's necessarily true; code comments very often refer to a range in the source. Because code is generally designed to be accessed as linear text without hyperlinking facilities, the identification of the range is usually something that the reader has to interpret by applying (sometimes language specific) conventions relating to code formatting, indentation, and the precise placement of comments, and there are a limited set of kinds of spans that conventions cover (e.g., a span that starts in one block but extends to include the following part of the containing block doesn't have a good layout convention to indicate that a comment goes with it.)

Genius-style annotations, because they aren't limited to conventions that work in a strict linear text medium, can easily refer to arbitrary spans of content.

Re: John Resig annotates original jQuery source code

#60

Anyone else already find the XSS in genius.it? Edit: wow, the whole thing is seriously broken. Emailing them now. Edit 2: It's not as broken as I thought, and these guys are quick to reply and try to figure things out. To be clear, I haven't gotten it to run arbitrary JS, just include arbitrary HTML, which isn't as dangerous.

How is including arbitrary html not as dangerous, when arbitrary html also means tags?
Post reply on HN