Earlier quoted context omitted.
Woa there! Why would JavaScript have `with` if you weren't intended to use it‽ How about: let applyTemplate = template => object => { with(object) { return eval("`"+template+"`"); } }
From the MDN docs: > Use of the with statement is not recommended, as it may be the source of confusing bugs and compatibility issues. See the "Ambiguity Contra" paragraph in the "Description" section below for details. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Mini projects built with VanillaJS. No frameworks or libraries
61–70 of 171 posts
Re: Mini projects built with VanillaJS. No frameworks or libraries
#62Here's one I did as an assignment for a job interview: https://github.com/ivancuric/hn-scroll You can see it in action here: https://hn-scroll.netlify.com/ The task was to build an offline capable site which displayed the latest Hacker News posts, and loaded more lazily when scrolling. I had to use the official HN API, and I couldn't have any middleware or caching. Everything had to be done client-side. The app ended…
This runs nice and fast. Out of interest, why did you use display: flex; on the li's and add the list number inside div's?
The browser's implementation of numbering ol's is to align them to the right and render them hanging. They don't impact the layout, much like position: absolute, and they grow to the left.
The default ol/ul behaviour leaves some space to the left where the bullets/numbers should fit. This means you need to take into account the maximum width of the number.
I had no idea how much is the limit of the API, could have been thousands of items, and I didn't want to leave space for four digits until you scroll down to item #1234
I could also have implemented this using CSS `counter-increment` and `content`, but this was a better approach for debugging if the articles were rendering in the right order, while the CSS approach only takes into consideration the amount of DOM nodes.
Re: Mini projects built with VanillaJS. No frameworks or libraries
#63Earlier quoted context omitted.
Your comment makes me imagine a more nuanced technical interview process - i.e you get to provide feedback to criticisms from the interviewer, you get to escalate/request review from someone else at the employer if you disagree with the interviewer. A platform ensures that the protocols are abided by by both employer and candidate. These sorts of interactions sound pretty far out now, but a few years ago who would ha…
It wasn't real time, but a home assingment. Sadly, I didn't get a chance to provide feedback to the criticisms. At least not in an impactful way — the decision has been made.
Re: Mini projects built with VanillaJS. No frameworks or libraries
#64Re: Mini projects built with VanillaJS. No frameworks or libraries
#65Soundslice ( https://www.soundslice.com/ ) — a website built around interactive/responsive sheet music, rendering the music entirely in client-side JS — doesn't use JavaScript frameworks or libraries. I'm the developer of Soundslice and continue to be happy with the vanilla JS decision, 8+ years into the company. It means better performance, clearer code, smaller JS filesizes. I gave a talk about it here: https://www…
Amazing site. I noticed one thing that could easily improve the feel of the site — the sheet music playhead which is outside of the canvas. You are using fractional units to position it, but you're also using left/top/height properties which can't be fractional. If you convert these to GPU translated layers via translate, you'll get a smoother playhead since these can be positioned fractionally, plus you'll cut down…
Re: Mini projects built with VanillaJS. No frameworks or libraries
#66Re: Mini projects built with VanillaJS. No frameworks or libraries
#67Earlier quoted context omitted.
It creates a function returning a function, where the argument to the first (which is a template) is used as a closure in the second (which takes a dict of values). The last function called in turn creates a function using the Function constructor, which, since it takes a string argument as the function body, allows the expansion of the values dict into variables and thus the population of the template string: applyT…
How come you haven't used tagged template literals? These would fit this use case: https://codeburst.io/javascript-es6-tagged-template-literals...
tpl = applyTemplate("Hello ${a}");
tpl({"a": "you"}); // --> Hello you
tpl({"a": "dude"}); // --> Hello dudeRe: Mini projects built with VanillaJS. No frameworks or libraries
#68Here's one I did as an assignment for a job interview: https://github.com/ivancuric/hn-scroll You can see it in action here: https://hn-scroll.netlify.com/ The task was to build an offline capable site which displayed the latest Hacker News posts, and loaded more lazily when scrolling. I had to use the official HN API, and I couldn't have any middleware or caching. Everything had to be done client-side. The app ended…
Re: Mini projects built with VanillaJS. No frameworks or libraries
#69I implemented an entire database in VanillaJS: It runs in-production with 10M+ monthly users! https://github.com/amark/gun ~13KB I get a lot of hate for not-using-2ton-framework-of-the-month. But I think prioritizing performance is worth the flack. Seeing repos/articles like this deeply warm my heart, maybe us VanillaJS devs are not alone after all! Does anybody have other favorite VanillaJS projects, that they could…
That's my aim too. My work is all Vanilla. I hate to use external frameworks and libraries in the browser, but love to use stuff on npm. I prefer to write something I like to use, rather than use something that exists that I don't like working with.
You can see portfolio here: https://github.com/cris691/Portfolio. Bepis and Dumbass are vanilla front-end alternatives to frameworks.
I'm really interested on what you think the hate for not-using-2ton-framework-of-the-month is about?