I Don’t Hate Arrow Functions is an interesting step back from the debate about arrow functions, to comment on how we treat nuanced opinions in our culture, and how tooling helps and hurts our efforts to collaborate together.
Category Archives: JavaScript
The Simplest Way to Build a Gutenberg Block
The "Content Blocks: Advanced" repository has an example of the absolute minimal code you need to build a custom block, and progress from there.
Minimal CacheStorage API Example
It's not easy to find examples of using the
CacheStorage
API outside of service workers, or with the `await` operator, so I put one together. Composition vs Context to fix Prop Drilling in React Apps
People will often argue that either Composition or Context should be used to remove prop drilling, but I think it's better to use them both in a more nuanced way.
`await` is the Best Thing to Happen to JavaScript in Years
`await` makes dealing with JavaScript Promises simple and intuitive.
Snapshot Testing and Vague Assertions
Nick Gard's article on the bad parts of snapshot testing does a great job of articulating what I don't like it.
Exercising Care and Giving Users Control
Aaron Gustafson makes a great point about the responsibility that developers have to respect the users of their applications.
Programmatically Adding Comment Metadata from JavaScript
Creating comment meta from a client side script isn't as easy as it is on the PHP side, but it can be done.
Gutenberg and WordCamp.org’s Shortcodes
Corey McKrill presented a case study at WordCamp Portland about the process we went through to build Gutenberg blocks for WordCamp.org.
Best Good Practices
In episode 18 of the React Round Up podcast, Alex Moldovan articulates something I've been feeling lately, as I dive deeper into the modern JavaScript world.
Stop Breaking the Web
Reading Stop Breaking the Web by Nicolás Bevacqua's feels like a breath of fresh air.
He writes about how several common practices in the JavaScript community have led to poor user experiences, and violated some of the fundamental principles that made the Web what is today...
Polyfilling Responsive Images
Scott Jehl — one of the creators of Picturefill — wrote a thoughtful piece on the tradeoffs of polyfilling for responsive images.
Progressive Enhancement is Still Important
Jake Archibald makes a compelling case that progressive enhancement is still important, not because of users who’ve chosen to disable JavaScript, or because of outdated accessibility concerns, but because of graceful error handling and faster page rendering. He also dispels some myths, pointing out that building a progressively-enhanced application doesn’t have to require duplicating server-side logic and templating on the […]
Attaching Uploads to Custom Post Types
I’m working on a plugin that implements a custom post type, and it doesn’t need the editor, but I do want to upload files. I setup the everything like you normally would, but I noticed that the files weren’t being attached to the post when they were uploaded. I couldn’t find anything online, so I dug through […]
Progressive Enhancement with Backbone.js
I’m mostly focusing on back-end development these days, so I’m a bit behind the curve on a lot of the recent front-end practices, but I’ve been playing around with Backbone.js a bit, and one of the things that’s been nagging me is the hard dependency on JavaScript for the core functionality of the site. Looking around for some […]
Reusing P2’s ajaxUrl Short-Circuits Other AJAX Requests
I just spent awhile tracking down some odd AJAX behavior that was puzzling me, so I thought I’d share the solution. I was working on a plugin to extend P2 and my AJAX requests were always responding with -1. After a lot of digging and some trial-and-error, I figured out that it was happening because I was […]
Dynamically Adding HTML Elements to a Masonry Container
The official Masonry documentation doesn’t really cover this well, and all the external examples I found seem to be outdated. I got it working in v3.1.2 via trial and error. Basically, you just have to reload all the items before laying them out. Makes sense once you understand it… var mediaItemContainer = $( '#container' ); mediaItemContainer.masonry( […]
$( this ).attr( … ) Is Often Unnecessary
It’s often much more efficient to access DOM properties directly, rather than using jQuery. The downside to that approach is that there are differences between the various browsers, so in some cases it introduces bigger problems than the extra performance overhead.
Registering jQuery Event Handlers Before the Elements Exist
Update: I removed the link to the article because the site now contains malware. Dave Ward wrote an article Don’t let jQuery’s $(document).ready() slow you down that shows a few situations where execute the contents of a JavaScript file immediately, rather than wrapping it all inside jQuery( document ).ready(). The .live() method has been deprecated since he wrote the […]