Lurker News

Comments (104) 34 threads

Earlier comments
yissp1 reply#
Really cool project! Small suggestion, some indication of which type of tile is currently selected might be nice (like maybe highlight it or something).
anonytrary#
I agree, really cool, also have a small suggestion -- it'd be nice if you could click and drag to "draw" tiles into the main board. Currently you can only click tile-by-tile.
lwb4 replies#
Thought this was a clever trick:

const $ = _ => document.querySelector(_)
Pretty well sums up the state of jQuery in 2019 (almost 2020!)

drusepth1 reply#
What does this trick do?
grardb1 reply#
Written in older JS, it would look like this:

$ = function(_) { return document.querySelector(_) }
It basically turns `$` into an alias for `document.querySelector`. I'm not sure that it's any different from:
$ = document.querySelector

Continue this thread — 2 replies

andai#
Just checked on CanIUse, querySelector() actually has full support* since 2009!

Btw, querySelectorAll() to match multiple elements.
* IE partial until 2011

mkoryak4 replies#
This is written by someone who has never used jquery or forgot it. The beauty of jquery was not being able to use CSS selectors to find elements, but in being able to work with multiple selected elements as if it was a single one.

Ok, you will say, but you can always do
[... document.querySelectorAll('.foo .bar')].map(it => it.style.backgroundColor = 'corn');
instead of $('.foo .bar').css('backgroundColor', 'corn');
and it is clearly better because it does not use jQuery.
Don't get me wrong, jQuery has many issues that make it a very poor choice for big modern web applications, but please don't tell me that it can be replaced by querySelectorAll.

rkuykendall-com#
Na, the beauty of jQ was writing JS once and being confident most of it would work in most browsers. Everything else was sugar.
lwb#
> please don't tell me that [jQuery] can be replaced by querySelectorAll.

I didn't, and it can't -- my comment was merely to suggest that jQuery is now a shell of its old self, thanks largely to the improvement of browser DOM APIs.

danlugo92#
for (const node of document.querySelectorAll('.foo .bar')) { node.backgroundColor = 'corn' }
ZeikJT#
Not sure why someone would use map like that (which would unnecessarily generate and return a new array of 'corn's) instead of just forEach.

I'd also probably recommend using Array.from instead of a spread (for clarity) but less concerned about that part.

quickthrower2#
Hmm. Usually underscore as a function parameter should mean unused variable. Ok maybe I am too much of a fusspot.
hinkley#
This takes me back.

One of the last projects I did in college was a terrain generator.
After, I was learning a new programming language, so I picked it up again to experiment with some world building.
I started trying to generate more realistic (and traverseable) terrain. I had worked out coastlines and rivers, made some headway on biomes, and gotten stuck on simulated erosion before I remembered that I like games a little too much and didn’t want to make them for a living.
I was pretty bummed when No Man’s Sky was panned. Using generated terrain as a canvas and dropping a story into it still feels like the right long-term solution for exploration games.

atum47#
I can't upload the live version for now, cause I'm on a family event. I'll enable the GitHub version so everyone making pull requests can see the changes live

Load more comments