Author: Tom Alexander
Never silence generic exceptions in code…ever
This will be short and sweet. I recently came across some code that caught a generic exception but immediately discarded it. The exception actually held valuable intel into a problem in a production environment. Never do this:
1 2 3 4 |
try: doSomethingThatRaises() except: pass |
Always log the exception even if you don’t want to “deal” with it in your code path.
Using JSCS to Achieve a Consistent Code Style Within Your Team
The more people who open a window, the more fingerprints that are left behind. Coding in a team is largely the same. Like a fingerprint, each developer has their own unique style that can look vastly different than others. Although there are linting libraries that will catch some of these style discrepancies, it can be difficult to
Simplify your Mobile Development with this SASS Mixin
Responsive Development can be painful when you have to worry about all of the different breakpoints in your code. Developing in SASS makes it a bit easier since you can assign your breakpoints to variables, however it doesn’t solve the problem of the duplicated @media selectors throughout your .scss code. Not to mention, you have to
Why Destructuring is a Terrible Idea in ES6
Destructuring is a concept introduced in ES6 that allows developers to destructure objects into variables without explicitly setting a variable to the object key/val. Confused? Yeah you’ll be even more confused as you start reading. What is happening in this statement?
1 2 |
let obj = { first: 'Tom', last: 'Alexander' }; let { first: f, last: l } = obj; |
Is it obvious to you that f and l are new variables created
ES6: The Future is Now
As web developers, we’re all familiar with the sloth-like pace of web standards from idea to implementation (there’s a reason JS hasn’t changed much over the years). ES6 was announced in 2008 and the first draft was published in 2011. It’s 2015 and we cannot fully use ES6 in the browser yet. It’s frustrating, but
Do’s and Don’ts of Code Comments
Comments in code are arguably more important than the code itself. Future you will thank present you if you are a good commenting citizen. I have read a ton of code in my lifetime and have come across some pretty amazing comments, but mostly awful ones. Here are some ways you can ensure you are writing good
Write more efficient, readable, and performant jQuery code
Performance is a BIG issue in applications that many developers pay no attention to. With the increasing speed of internet connections, performance issues become less and less apparent. However with mobile and tablet use, bandwidth issues and lower-processors can bring these issues to light and should help motivate developers to write better code. jQuery is by far the
Two ways to drastically improve the speed of your jQuery code
jQuery is often looked at synonymously with JavaScript; although jQuery is just a library wrapper around native JavaScript. While jQuery is easier to some degree, a lot of the tutorials and examples on the internet showcase code that isn’t nearly as performant as using native JavaScript APIs. Although I do not suggest you use jQuery in your
Learning Clojure: Thread-First macro
Clojure is a fun programming language with a ton of hidden features. At the surface, it seems like you might be lost in parenthesis hell and find yourself struggling to read code. Have you ever written code like this?
1 2 3 |
(conj (conj (conj [1 2 3] 4) 5) 6) => [123456] |
Where do you even start? Obviously this is a terribly trivial example on how to
Top 10 CSS Mistakes Even Advanced Developers Make
Specificity In short, specificity is a *bad* thing. Once upon a time, we all thought we were being all cute and organized by specifying parent tags in front of what we *really* needed to style. The smaller the selector, the faster and less specific it is, making it much easier to overwrite and extend.
1 2 3 4 5 |
/* Woah, broh! */ .grandparent .parent .header p.intro {} /* Better */ .intro {} |