background preloader

Html

Facebook Twitter

Hacker News. A while ago I wrote an article with some CSS tips, now it’s time to give some polish to our HTML!

Hacker News

In this article I’ll share some tips and advice about HTML code. Some of this guidance will be best suited for beginners – how to properly build paragraphs, use headings, or improve forms, but we will also discuss SVG sprites for icons, a somewhat more advanced topic. Text Paragraphs Most of our writing is structured in paragraphs, and there is an HTML element for that: <p>.

Writing Less Damn Code. I’m not the most talented coder in the world.

Writing Less Damn Code

No, it’s true. So I try to write as little code as possible. The less I write, the less there is to break, justify, or maintain. I’m also lazy, so it’s all gravy. (ed: maybe run with a food analogy?) But it turns out the only surefire way to make performant Web Stuff is also to just write less. And that’s not all. My favorite thing about aiming to have less stuff is this: you finish up with only the stuff you really need — only the stuff your user actually wants. It’s not just about what you pull in to destroy your UX or not, though. First off, WAI-ARIA ! LOL, no: AngularJS Project Structure. I’ve been programming professionally for about 6-7 years now and I’ve used my fair share of languages/frameworks/stacks.

AngularJS Project Structure

My most recent job (as well as some of my current freelance work) has led me down the AngularJS/NodeJS path. Do not get me wrong - I love using both of these in my web development work. NodeJS with Express is quite nice for writing basic APIs and AngularJS for the front end allows someone who sucks at front end work to be able to produce some pretty useful interfaces. Now, obviously there a million-and-one things that developers debate about. For nostalgia’s sake, let’s list a few: Tabs vs. spaces Vim vs. This list goes on and on. I try not to get sucked into these sorts of discussions, as I believe many seasoned developers in general are pretty stubborn… although I’ll admit that I have been engaged in pointless debates on more than one occasion.

One thing that I hardly ever hear about, though, is directory structure and file naming conventions for projects. -Dave. Drewww/socket.io-benchmarking @ GitHub. I've had lots of fun making prototypes in nodejs with socket.io.

drewww/socket.io-benchmarking @ GitHub

But I've felt lost in thinking about the performance of the server if I ever needed to scale something up. What operations, exactly, are costly? What is the bottleneck in performance? A few potential limiting factors came to mind: holding lots of connections open simultaneously receiving lots of messages sending lots of messages There's been some nice work at figuring out how many connections a server might be able to support, but that only knocks out one of our potential bottlenecks. In my work, I'm interested in building real-time applications for synchronous interaction, so this analysis is going to focus primarily on the cost to sending messages from the server to the client, not the cost of receiving messages from clients. Accelerated Mobile Pages – A new approach to web performance. This is a really hard problem to solve, so we decided to reduce scope.

Accelerated Mobile Pages – A new approach to web performance

The web today is many things: an application platform, an e-commerce platform, a content platform, a gaming platform, and so much more. We decided to focus entirely on static content as it lends itself to more radical optimization approaches that are easier to apply across the board. We began to experiment with an idea: could we develop a restricted subset of the things we’d use from HTML, that's both fast and expressive, so that documents would always load and render with reliable performance?

That experiment has culminated in a promising proof of concept we call Accelerated Mobile Pages (AMP). AMP HTML is built on existing web technologies, and the documents written in it render in all modern web browsers and web views. The page you are currently reading is an AMP HTML document. We think AMP HTML is promising, but we know it's not complete. AMP HTML loves CSS! So, AMP HTML comes with strong limitations on JS. Bubbling and capturing. DOM elements can be nested inside each other.

Bubbling and capturing

And somehow, the handler of the parent works even if you click on it’s child. The reason is event bubbling. For example, the following DIV handler runs even if you click a nested tag like EM or CODE: Accessing an iframe's JavaScript function via GWT - Thoughts and Dreams. Browser Zoom - Why Does It Break Your Page And How To Avoid It. 4 creative ways to clone objects.