Live data from Hacker News

NYTimes Opensources Their Deep Linking JS

open.blogs.nytimes.com

31–40 of 56 posts

Re: NYTimes Opensources Their Deep Linking JS

#31

Earlier quoted context omitted.

I'm suspicious of anyone who spends their time critiquing others' work so harshly instead of innovating on their own.

I'm suspicious of anyone who obviously doesn't think innovation is innovation without making sure your innovation actually works (with tests).

Since you and goldenthunder completely missed this, allow me to clarify that OP could have been critiquing the project's choice of variable names and I would have said the exact same thing.

My statement wasn't about tests in the slightest.

Re: NYTimes Opensources Their Deep Linking JS

#32
Grats donohoe, well done. What is of particular interest to me here is the use of the Levenshtein distance algorithm. The reason this works well here is because you are comparing your supplied key against a constrained set. Applying the Levenshtein distance algorithm (or its variants) against a constrained set of small size in this fashion has virtually no performance impact as the time to complete is entirely based on the size of the set you are matching against. On the other hand, matching against a set of millions of records does get costly.

Re: NYTimes Opensources Their Deep Linking JS

#33
post #26

Earlier quoted context omitted.

I'm suspicious of anyone who spends their time critiquing others' work so harshly instead of innovating on their own.

[deleted]

Hardly. The attitude you're demonstrating is the real anathema. You're just confusing people recoiling from your abrasive disposition with disagreement over the importance of tests (as others have done in this thread).

> Enterprise JS is 400 lines of code... 0 lines of tests. Kudos, NYT.

See how your comment carries across a real difficulty working with other people? This would have said the same thing, albeit without the slam to the author:

> This project has no tests. Maybe I'll fork it and add some, in order to make it more robust.

Another example from your history:

> adding position:relative without knowing what it does... great advice

Someone made a good point here which is actually grounded in reality, and you responded with a smartass remark which might have discouraged him from contributing in the future. One of the guidelines for Hacker News is that you shouldn't write a comment that you wouldn't say to someone's face. If you go around quipping like that to peoples' faces, I pity your acquaintances.

You could have worded it this way:

> That isn't what position: relative is meant for. There is another way to accomplish that:

Just be positive to your fellow human being. It's not fucking difficult. That's why you're getting downvoted.

Re: NYTimes Opensources Their Deep Linking JS

#34
post #18

Earlier quoted context omitted.

RTFM? :) The difference is no 'href' tags. The 'tag' is automatically created based on the words in the paragraph, via Javascript, and decoded appropriately. It is also slightly neat in that you can highlight a specific sentence (multiple sentences actually, see the little tutorial at the bottom). I actually kind of like it, it would be a neat way to really highlight what you think is interesting in an article when s…

I thought about a plugin but then you are maintaining several and handling issues from readers who hits walls installed or uninstalling it... My hope tis that this approach is equally unhelpful to everyone :) Seriously, my hope is that if an approach like this is going to happen that we can keep the usage (syntax) consistent. Further down the road I'd like the view to also show you what people in your network have hi…

That reminds me of http://www.tynt.com/

Re: NYTimes Opensources Their Deep Linking JS

#36
post #16

Earlier quoted context omitted.

Why isn't it sufficient to use the Google-hosted jQuery? It's likely to be cached.

1. a boatload of page view info you are sending off to google 2. it's another dependency that you don't control

To your first point, is this a critique of the speed (pushing info up to Google) or to Google sucking in yet more information? If it's the latter I'm already in trouble because almost everything I do uses Google Analytics, but I can see the point if you're doing something else.

WRT your second point, there's a middle ground of pointing to Google's hosted version for speed and falling back to a local copy if it is not found.

You can see the technique in use within the Boilerplate HTML5 template - http://html5boilerplate.com/ - Scroll down to the index.html file, line 58.

Re: NYTimes Opensources Their Deep Linking JS

#37
post #4

On Github, they say they'll eventually remove the dependency on PrototypeJS. The library is only ~10k now, hopefully that change won't increase the size too much.

It looks like they are only using a small portion of it -- selectors in init and a few event handlers. They could use one of the many pre-existing selector engines and write a simple cross-browser addEvent function

That is the plan. The CSS selectors are only required (for now) as NYT has some specific criteria to cover the markup in various Article and Blg Post pages.

For most cases I imagine 'querySelectorAll' or 'getElementsByTagName' would suffice

Re: NYTimes Opensources Their Deep Linking JS

#38
post #26

Earlier quoted context omitted.

[deleted]

Hardly. The attitude you're demonstrating is the real anathema. You're just confusing people recoiling from your abrasive disposition with disagreement over the importance of tests (as others have done in this thread). > Enterprise JS is 400 lines of code... 0 lines of tests. Kudos, NYT. See how your comment carries across a real difficulty working with other people? This would have said the same thing, albeit withou…

[deleted]

Re: NYTimes Opensources Their Deep Linking JS

#39
post #5

On Github, they say they'll eventually remove the dependency on PrototypeJS. The library is only ~10k now, hopefully that change won't increase the size too much.

You know what I would love to have the HTML5 guys add to the spec? Some way of keeping libraries like PrototypeJS and jQuery in the browser cache at all times, so that pages could just use them without worrying about the size. Perhaps some kind of alternate src attribute on script tags, so you could list a local copy (for reliability) as well as Google and Microsoft CDN URLs, and the browser would go with the first o…

In HTML5 you can do this by keeping a script in LocalStorage, then executing it on-demand. It could also have a fallback mechanism for network loading (and lazy initialization).

The implementation of this is left as an exercise for the reader.

Re: NYTimes Opensources Their Deep Linking JS

#40
post #5

On Github, they say they'll eventually remove the dependency on PrototypeJS. The library is only ~10k now, hopefully that change won't increase the size too much.

You know what I would love to have the HTML5 guys add to the spec? Some way of keeping libraries like PrototypeJS and jQuery in the browser cache at all times, so that pages could just use them without worrying about the size. Perhaps some kind of alternate src attribute on script tags, so you could list a local copy (for reliability) as well as Google and Microsoft CDN URLs, and the browser would go with the first o…

Wouldn't you be able to do this with the cache manifest? http://diveintohtml5.org/offline.html
Post reply on HN