Live data from Hacker News

Show HN: A TO-DO app that fits inside a single tweet

ruky.me

11–20 of 56 posts

Re: Show HN: A TO-DO app that fits inside a single tweet

#12
post #3

Earlier quoted context omitted.

Op here: you can’t do it with plain js Plus it’s ok to use frameworks according to the tweet

Care to elaborate? There are some nifty tricks when it comes to golfing JS.

Well sorry I was in a hurry when I typed the above comment

Well the body can’t have any dom elements according to the challenger

That means I had to create the dom elements as well and I was unable to figure out a way within the given character limit

Re: Show HN: A TO-DO app that fits inside a single tweet

#14
post #3

Earlier quoted context omitted.

Op here: you can’t do it with plain js Plus it’s ok to use frameworks according to the tweet

Care to elaborate? There are some nifty tricks when it comes to golfing JS.

JS is ok, it’s the DOM APIs that are verbose. I mean this is just to handle the enter key:

    f.addEventListener('keypress',e=>{if(e.keyCode==000) etc()})

Re: Show HN: A TO-DO app that fits inside a single tweet

#15
post #3
post #2

I am not very familiar with JS but doesn't loading a framework externally kind of defeat the purpose?

Op here: you can’t do it with plain js Plus it’s ok to use frameworks according to the tweet

Then that means it doesn't fit.

Re: Show HN: A TO-DO app that fits inside a single tweet

#16

Earlier quoted context omitted.

Care to elaborate? There are some nifty tricks when it comes to golfing JS.

JS is ok, it’s the DOM APIs that are verbose. I mean this is just to handle the enter key: f.addEventListener('keypress',e=>{if(e.keyCode==000) etc()})

Exactly these were the challenges I faced when using plain js

Re: Show HN: A TO-DO app that fits inside a single tweet

#17
Code golf is generally the most interesting when the rules are specific enough that every entry has the same constraints.

In this case, "to-do app" and "general purpose library" are so general that it becomes a game of semantics. The winner will have the broadest definition of "general purpose" and narrowest definition of "app".

I don't think we should criticize the person who posted this. It was a silly prompt that was guaranteed to get controversial submissions that people would pick apart.

Re: Show HN: A TO-DO app that fits inside a single tweet

#18

My version is even shorter and has a closing -tag and even -tags for the swag: new TodoApp({}); It's obviously just a concept and doesn't work yet (example.com, durr!) but it's in the same spirit. It only relies on a general purpose todo app library. Default options of course! (Which fortunately make it mount on body)

I golfed it down and fixed a few bugs for you:

    

Re: Show HN: A TO-DO app that fits inside a single tweet

#19

Earlier quoted context omitted.

Care to elaborate? There are some nifty tricks when it comes to golfing JS.

JS is ok, it’s the DOM APIs that are verbose. I mean this is just to handle the enter key: f.addEventListener('keypress',e=>{if(e.keyCode==000) etc()})

Just a fun note: You can replace this

    f.addEventListener('keypress',e=>{...})
With the older but essentially equivalent

    f.onkeypress=e=>{...}
and save 18 characters. You can even use `onkeyup` and save 3 more characters.

Re: Show HN: A TO-DO app that fits inside a single tweet

#20
post #10

My version is even shorter and has a closing -tag and even -tags for the swag: new TodoApp({}); It's obviously just a concept and doesn't work yet (example.com, durr!) but it's in the same spirit. It only relies on a general purpose todo app library. Default options of course! (Which fortunately make it mount on body)

Ha ha I almost gave up and wanted to do the same But then I realized I’ll be able to figure it out It’s done for the challenge :)

I think you did it pretty well. Your codes pretty readable despite the constraints. Maybe just let the people know what you would've added or changed if you had a bit more space :)
Post reply on HN