background preloader


Facebook Twitter

The real reason to avoid jQuery. Or How to avoid common SPA pitfalls when using 3rd party plugins In the past few years, I've read countless blog posts, twitter rants and medium exposés detailing how jQuery isn't necessary, and why you should just write with "native" JavaScript.

The real reason to avoid jQuery

I disagree with these posts, because there are still a number things which jQuery handles which are not easy to replicate quickly unless you know the edge cases you need to handle. There is, however, a very major reason to avoid jQuery, and it has very little to do with features or file-size. jQuery is smothering your SPA's performance. I don't mean a little.

I primarily work with Ember applications that are built to work well across every platform. Standard caveat, before I dive into the details: avoiding jQuery and jQuery plugins isn't going to make your code suddenly perform better, only well written code is going to do that. Philip Roberts: What the heck is the event loop anyway? Anjana Vakil: Learning Functional Programming with JavaScript - JSUnconf 2016. JS: The Right Way.


Finding Improper JavaScript Globals. When I interview web developers, my first JavaScript question is usually the following: What is the difference, in JavaScript, between x = 1 and var x = 1.

Finding Improper JavaScript Globals

Feel free to answer in as much or as little detail as you feel comfortable. Most people would give an answer about how the var keyword makes something a local variable, omitting it makes it a global variable. While I'd love to hear about scope chains, the window object, and hear the term "implied global" in an answer, that basic answer is good enough. It might not show a thorough knowledge of JavaScript, but at least it shows some level of understanding of the most common dangerous feature.

There are three basic ways to make a global variable in JavaScript. Var x = 1; // declared global y = 2; // implied global window.z = 3; // window global Implied globals are bad because they're hard to keep track of, and their declarations aren't hoisted. Introducing badglobals.js Include badglobals.js in your page, before any other scripts. Verekia/js-stack-from-scratch: Step-by-step tutorial to build a modern JavaScript stack from scratch. Meetselva. Free JavaScript / CSS / CSS3 - CSS Script. Learning JavaScript Design Patterns. JavaScript Module Pattern: In-Depth.

The module pattern is a common JavaScript coding pattern.

JavaScript Module Pattern: In-Depth

It’s generally well understood, but there are a number of advanced uses that have not gotten a lot of attention. In this article, I’ll review the basics and cover some truly remarkable advanced topics, including one which I think is original. The Basics We’ll start out with a simple overview of the module pattern, which has been well-known since Eric Miraglia (of YUI) first blogged about it three years ago. If you’re already familiar with the module pattern, feel free to skip ahead to “Advanced Patterns”. Anonymous Closures This is the fundamental construct that makes it all possible, and really is the single best feature of JavaScript. (function () { // ... all vars and functions are in this scope only // still maintains access to all globals }()); Notice the () around the anonymous function.

Global Import JavaScript has a feature known as implied globals. Luckily, our anonymous function provides an easy alternative. Detect rotation of Android phone in the browser with javascript. Stop Writing Slow Javascript - I Like Kill Nerds. As Alfred Pennyworth once profoundly said in The Dark Knight Rises: Some front-end developers just want to watch the world burn.Alfred Pennyworth, The Dark Knight Rises As developers we are constantly learning, always growing and sometimes whether we realise it at the time or not, we are always making mistakes.

Stop Writing Slow Javascript - I Like Kill Nerds

Sometimes we make mistakes however small that pile on-top of one another which can result in some interesting consequences for our applications performance. Here are a few tips, most of which you might already have read elsewhere on how to write performant Javascript and just even thinking about some of the things you might be doing in your applications. Getting off the jQuery pony. Spring-cleaning Unused CSS With Grunt, Gulp, Broccoli or Brunch. [caption id="attachment_6609" align="aligncenter" width="640"] The tough economic times on Tatooine hit everyone hard, including the Jawas.

Spring-cleaning Unused CSS With Grunt, Gulp, Broccoli or Brunch

[/caption] Delivering a fast experience on the web usually involves reducing server response time, minification of CSS/JS/HTML and an optimisation of images and above-the-fold content. We can further minimize the latency caused by stylesheet loading by removing unused CSS rules delivered to the client. In this write-up, we'll take a look at build tasks you can use to remove unused CSS in your pages. Unused CSS is a particular problem when working with a heavy modern UI framework such as Twitter Bootstrap, Zurb Foundation or Adobe TopCoat. This is a problem that’s been previously highlighted by the PageSpeed team, who include removing unused CSS as part of their speed recommendations for the web: "Before a browser can begin to render a web page, it must download and parse any stylesheets that are required to lay out the page.

JavaScript Best Practices Part 1 · Thinkful Programming Guides. Javascript Best Practices, Part 1 Make it Understandable Choose easy to understand and short names for variables and functions.

JavaScript Best Practices Part 1 · Thinkful Programming Guides

Stop Writing Slow Javascript - I Like Kill Nerds. As Alfred Pennyworth once profoundly said in The Dark Knight Rises: Some front-end developers just want to watch the world burn.Alfred Pennyworth, The Dark Knight Rises.

Stop Writing Slow Javascript - I Like Kill Nerds

Php function call using javascript. The State Of JavaScript Developer Survey.