#javascript #web developmentAvoid null/undefined in JavaScript arraysHow to avoid TypeError: Cannot read property ___ of undefined using Array.filter(Boolean) tl;dr: Array.filter(Boolean) filters out falsy values (null, undefined, 0, false, '') and avoids Cannot read property of undefined errors. Table of contents: ...
#javascript #tipJavaScript array type check - “is array” vs object in-depthDetecting Array vs Object in JavaScript with examples tl;dr To detect if something is an Array in JavaScript, use Array.isArray(somethingObjectToCheck). This post is a quarter useful, quarter history lesson, half quirky JavaScript exploration. Table of contents: ...
#javascript #vuejs #nodePost Frequency: from prototype to production with Vue + NodeIf you want to ship, use the tools you know. — A lot of people Let’s apply that principle: I’m building Post Frequency/Accountable Blogging, I’m familiar with Vue and Node-based backends. Netlify makes frontend deployments trivial and I’ve settled on Dokku for ...
#javascript #meta #paymentAdd a Vanilla JavaScript paywall to a Hugo site using checkoutpage.coHow I created the buying mechanism for the Sequelize ES6 Cheatsheet using checkoutpage.co and sprinkles of vanilla JavaScript. This strictly isn’t a paywall, it’s all client-side and doesn’t check much. In principle you can display the whole things using a bit of CSS ...
#node #javascript #meta #gitA simple JavaScript/Node coding setup on Mac OS XHere’s how I get productive for JavaScript/Node on Mac OS. It includes iTerm2, zsh, Node, Visual Studio Code and some git commands. ...
#node #sequelize #git #cli #javascriptProgress and roadblocks: a journey into open-sourceEnhancing generators for ES6 in the Sequelize CLI This is the story of my discovery of ES6-class style model definitions with Sequelize (see Using ES6 classes for Sequelize 4 models). The realisation that the current Sequelize CLI model generator didn’t support it (as is e ...
#deployment #netlify #meta #javascriptA tiny case study about migrating to Netlify when disaster strikes at GitHub, featuring CloudflareLast Monday (22 October 2018) GitHub was going 💥, and scheduled content on Code with Hugo wasn’t going live. For context, the blog’s setup is documented in “Switching the lights on: Hugo vs Hugo config files”. tl;dr (as is relevant to this post) Cloudflare DNS + CDN + proxying + ...
#micro #node #javascript #es6 #architectureSimple, but not too simple: how using Zeit’s `micro` improves your Node applicationsLeave the Express comfort zone to expand how you think about Node application architecture. tl;dr using a function composition model for building HTTP servers is awesome Functions as a Service are great but have some drawbacks micro has a similar, simple API to FaaS but doesn&rs ...
#node #javascript #es6Use ES modules/ES6 import in Node without Babel/Webpack using `esm`Node has been implementing more and more ES6+ (ESNext) features natively. One of the features that is taking the longest to implement is modules. The reason for this is that Node and npm run on what is called CommonJS, with which you use require('module-name') to import from othe ...
#javascript #deployment #observablehqObservableHQ notebooks for JavaScript demos and prototypesObservableHQ is a platform being built by Mike Bostock (creator of the D3 visualisation library), Jeremy Ashkenas (“Made CoffeeScript, Backbone.js, Underscore and other ragbag” from his Twitter bio) and Tom MacWright (creator of the big presentation framework, simple-statistics a ...