Grimdark fantasy with extra bonus mechs. A bard, a mage, and an all too willing assassin. When I’m not coding, I’m writing this.
Hi, I'm Nick Johnson!
Previously Front End Lead at Beamery. Currently Principle Front End at Cencora.
If you have an interesting project, possibly AI related, please feel free to get in touch at hello@nicholasjohnson.com. I'll be glad to have a chat.
Writings
-
What is Terraform? A Quick Devops Overview
Terraform is an infrastructure provisioning tool. It’s open source, made by Hashicorp, and has integrations with dozens of cloud platforms including AWS, Azure and GCP, anad many others.
Terraform allows you to automate and manage your infrastructure using declarative language. You say what you want to be true and terraform works out how to make it so.
-
What is Conda? What Can It Do?
Anaconda gives you three things:
- It’s a Python dependency management tool, like NPM.
- It’s a environment namagement tool like NVM or RVM.
- It’s a curated repository of a few thousand hand-verified libraries that you can rely on.
In this short article we look at Conda, how to use it, how it works with Pip, how to work with environments, and how to load, save, and share environments in a requirements.txt.
-
Passing additional props to React children with React.Children.map
React components are supposed to be modular and stackable, just like html. We achieve nesting in React components by passing children as an implicit prop to our component, but what if we want to do more than simply dump those children on to the page? What if we want to manipulate them in some way? Enter React.Children.map
-
Astro vs. Next vs. Eleventy
A Static site generator is a piece of software that lets you write pages, ideally in Markdown, then press a button to create a nested folder full of HTML that you can drop onto any old hosting environment. Static sites are fast, just HTML and CSS. They are trivial to make accessible, you actually don’t need any JavaScript at all.
My criteria for selecting a static site generator were as follows…
-
What is Babel, and how will it help you write JavaScript?
Babel is a JavaScript transpiler that converts edge JavaScript into plain old ES5 JavaScript that can run in any browser (even the old ones).
It makes available all the syntactical sugar that was added to JavaScript with ES6 and ES7, including classes, fat arrows, multiline strings, generators, and many more.
You can convert prety much any modern JavaScript features into code that will run on any browser, even the really old ones. This is fantastic news if you need to support older browsers, mobile browsers, Safari, IE11, or anything other than edge Chrome.
-
React Fundamentals For AngularJS Developers
TL;DR: AngularJS is a complex, monolithic framework that makes lots of choices for you. React is a DOM manipulation library that fits into a dynamic evolving ecosystem. Both are actually rather good.
-
How to do transclusion in Angular (ES5)
-
How does the TypeScript Angular DI magic work?
-
How to do Everything in Angular 2 using vanilla ES5 or ES6
-
What's the difference between annotations and decorators in Angular?
-
Today's Rails is the button_to helper
This little rockstar will make a whole RESTful form for you containing just one button, so you can make put, post and delete requests without relying on JavaScript.
A regular a link can only submit via get. To delete a resource you would usually submit a request via delete.
You can submit a delete request in two ways, either via JavaScript, or as a form submission. You don’t want an errant search engine spider hitting all your URLs and deleting all your data, so hiding delete links in this way is a good idea, since spiders generally won’t parse JavaScript or submit forms.
-
Using alias_method to preserve compatibility
The alias_method method allows us to alias call a method by a different name. If we change our API, we can still allow access using the old methods. This can save us a heavy refactoring job.
-
AngularJS vs. Angular
AngularJS and Angular are philosophically different. Angular 1 is at heart a DOM compiler. We write HTML, and the Angular compiler takes care of compiling it into a web application. It was a tidy little thing, and very small.
Over time Angular 1 was used to create larger and larger applications. We started arranging our code into components. We repurposed directives to make them serve as components, then used isolate scope to separate them one from another.
Angular 2 is the logical endpoint of this transformation. It is no longer a DOM compiler. Instead, it’s an component driven architecture with batteries included.
-
Using dup to dry up bang methods. Bang bang!
Hello, and today we’re going to take a dip into Active Support to look at how we can use Object#dup to dry up bang methods. As you probably know, most methods are non destructive, but a bang method modifies an object in place. Here’s a non-destructive method, it returns a modified copy of the object. The original object is not changed. This is what we want to do most of the time.
-
Using Object#blank? to check for whitespace
The blank? method is defined on object, and is not Rails specific. An object is blank if it is false, empty or a whitespace string.
-
Checking if an object is a subclass
Short tip today, checking if a class is a subclass of another object.
-
Delegating methods using extend
A change from Rails today, we’re dipping into Sinatra to look at how we can use extend to implement a Delegator. A delegator is an object which delegates responsibility to another object. Sinatra uses it to delegate methods called on the global scope to another object which can handle them.
-
Include vs. Extend
Include and Extend allow us to take methods from a module and add them to an object. They work slightly differently from each other though. Let’s take a look…
-
Using is_a? to vet method params
In Today’s Rails we’re inside the button_to helper once again. You may remember that this helper will make a whole RESTful form for you containing just one button.
-
Shuffling up method params with parallel assignation
This little rockstar will make a whole RESTful form for you containing just one button, so you can make put, post and delete requests without relying on JavaScript. In this section, we’re going to look at how parallel assignation gives us two clean and simple ways to call the helper.
-
Creating Read-Only & Virtual Attributes with JavaScript Getters and Setters
-
Why you should (sometimes) use MongoDB
-
How does ng-app work?
-
Organising your AngularJS code with Browserify
Organising JavaScript in a larger app becomes quite painful quite quickly. The issue is that order of inclusion matters. If I write a service that belongs to a module, I’d better make sure I have created my module before I try to append the service to it or my code will collapse in a messy heap. As we get more and more modules and more and more files, this becomes progressively harder.
-
BackboneJS - Step by Logical Step
Backbone is a the grand-daddy of all the JavaScript MVC frameworks. It’s the progenitor of frameworks like Ember, Angular, even Meteor. It’s a sensibly put together library full of tools to help you organise your web application, a toolkit for tidy JavaScript.
-
The JQuery Book,
JQuery is a library written in JavaScript which is primarily about DOM manipulation. It lets you find parts of a web page and make changes to them with very little code. It’s wildly popular and is used extensively across the Internet. It also forms the basis of other larger frameworks. If you’re serious about web development you need to know jQuery.
-
The Angular Book
Angular gives you super powers. You will be able to see through walls, climb tall buildings with your hands and shoot laser beams from your eyes.
With Angular you will be unstoppable. You will be able to pull in live streams of data from across the Internet and mash them into your page like a ninja. You will be able to construct your page in modules that download asynchronously. You will be able to create tabs, dynamic forms, live comment streams and other features in a fraction of the time you might have spent using jQuery. You will be able to handle events with NO WIRING CODE. You will be able to AJAX in content and integrate it onto your page with stealth and grace.
-
MVC JavaScript without a Framework
Looking at Rails or Angular there’s a tendency to think of MVC as something rather complicated and difficult to achieve, something that really demands a framework.
In fact, MV* style JavaScript really is trivially easy to write. It’s a pattern I’ll often drop into if I need to make anything beyond the basics, but I don’t want to break out Angular’s big guns.
In this post, we’ll create a simple MV pattern. We’ll build a Model and a View and wire these together using events.
-
Using a Rails concern to dry up Paperclip Attachments
Rails concerns have come in for a bit of a kicking lately, service objects clearly being a better solution in many instances, but I think there are valid use cases.
Concerns address the bloated model problem that plagues older Rails instances, where more and more methods are added to your fat models until they become huge and unwieldy. This slows your development as you now need to spend longer reading through code in order to get work done.
-
-