Live data from Hacker News

Animating URLs with JavaScript and Emojis

matthewrayfield.com

161–170 of 173 posts

Re: Animating URLs with JavaScript and Emojis

#161

Earlier quoted context omitted.

You can already use Greek letter variable names in Python: https://stackoverflow.com/questions/17043894/what-unicode-sy... I've used θ in code dealing with angles before.

That's a bad idea. How are other developers supposed to type this character (unless they are from Greece)?

I'm not from Greece and I can type any character I need to. It's just a matter of thinking very hard about it, and then the character "pops".

Re: Animating URLs with JavaScript and Emojis

#163
post #67

Earlier quoted context omitted.

In the article it does state that the history API could be used and why it wasn't. The first point about updating the whole URL is easy to render moot: when you push new state using the history API, replicate the effect of location.hash by making sure you only change the hash part. The second part is the sticky one for the "ain't this cool" factor: the throttle in some browsers effectively limits constant animation t…

All I know is he tried pushState. Perhaps replaceState is not throttled, because it doesn't create new history entries, just replaces the last one. Try this in chrome console. And yes, it doesn't throttle at all. i=0; setInterval(() => history.replaceState('', '', '/' + (i++)), 50); It's interesting how people will just believe everything, even if the test is 30 seconds away.

I just tested, Safari still throttles history.replaceState().

Re: Animating URLs with JavaScript and Emojis

#164

Earlier quoted context omitted.

It shouldn't. It uses history.replaceState(). https://developer.mozilla.org/en-US/docs/Web/API/History_API...

It actually just updates window.location.hash instead, which does cause a flood of history entries (looks like just one per distinct animation state, though, at least in Chrome). See the "One Last Thing" section near the bottom of the article for the rationale. See the inline code snippets in the article, or view source for wavyurl.com to see the actual code used.

At least in Safari, history.replaceState() still pollutes the browser history, all it does is avoid breaking the back button.

Re: Animating URLs with JavaScript and Emojis

#165

Earlier quoted context omitted.

That's a bad idea. How are other developers supposed to type this character (unless they are from Greece)?

keep it in the copy paste buffer, obviously /s. For an even more extreme version, look at Perl6's atomic operators: https://docs.perl6.org/language/unicode_ascii#Atomic_operato... (or any other operators on this page for that matter). IMO, it's not a "bad idea". Code is meant to be read, not written. If it renders the code more readable, then that's a win. But obviously, whether those symbols actually make the code m…

> whether those symbols actually make the code more readable is debatable.

In general, it would be rather silly to use greek letters for variable names. Yet sometimes, they tend to make numerical code much more readable when you are copying a mathematical formula verbatim.

Compare using "πθ" versus "M_PI*theta" several times on the same formula, for example.

Re: Animating URLs with JavaScript and Emojis

#166

This page will wreck your browser history. The post explains the rationale at the end, but frankly speaking there should have been the warning for each checkbox.

If you're using Firefox you can Control+H then right click on the site and select the option labeled "Forget About This Site". Done.

I think that only works before Sync replicates all those crufts to every other device.

Re: Animating URLs with JavaScript and Emojis

#167

Earlier quoted context omitted.

That's a bad idea. How are other developers supposed to type this character (unless they are from Greece)?

I'm not from Greece and I can type any character I need to. It's just a matter of thinking very hard about it, and then the character "pops".

What do you mean? Remembering the compose key sequence?

Re: Animating URLs with JavaScript and Emojis

#168

Earlier quoted context omitted.

You can already use Greek letter variable names in Python: https://stackoverflow.com/questions/17043894/what-unicode-sy... I've used θ in code dealing with angles before.

yes, I want to use them in C. It is possible with clang but, unfortunately, not with gcc. I also want to be able to type them into TeX, both in math mode and in text mode, without much fuss.

\theta doesn't seem that bad. Typing something like \kissyface or \poop seems better than clicking around or typing a numeric code, albeit with the usual name guessing problem.

On OS X, and I assume others, you can add items to be automatically replaced, so something like "!t" could become a unicode theta if you want.

Re: Animating URLs with JavaScript and Emojis

#169

This page will wreck your browser history. The post explains the rationale at the end, but frankly speaking there should have been the warning for each checkbox.

If you're using Firefox you can Control+H then right click on the site and select the option labeled "Forget About This Site". Done.

Wow, that took multiple minutes to run here.

Well done to the author of this hack on finding a way to dump massive amounts of data to firefox's sqlite store.

Post reply on HN