Typescript Dependency Injection in 200 LOC
9 hours ago, devto

One of the most common patterns in object oriented programming is dependency injection, and the inversion of control principle, (IOC). IOC containers are often feature packed, complex beasts that can stump even seasoned programmers. They take a collection of types with dependencies and when you need an instance of something they can automagically wire one up for you. You might have seen Typescript containers in frameworks like Angular, and NestJs with their module systems. Or maybe you are usin...

4 things that I always manually test
12 hours ago, devto

When I was a Drupal developer, a great deal of interest went into Automated Accessibility Testing. I very much loved working on automation especially when it was incorporated into our Continuous Integration. This would fail builds that introduced accessibility errors, which was a great way to ensure that we were thinking about accessibility from the start and not adding new problems. However, I feel like we like to automate our problems away and it cannot fix everything for you. Automated acce...

Building microservices with Dropwizard, MongoDB & Docker
12 hours ago, devto

Dropwizard making magic. 😎 In this tutorial I will create a microservice using Dropwizard, this framework provides all kind of libraries to build a web application. Some of the libraries that include are: Jetty Server: this is an open-source web server, lightweight and easy to embed in any application. Jersey: implementation for creating RESTful web services. Jackson: allows you manipulation from JSON objects to POJOs and vice versa. Metrics: provides information about the state of HTTP re...

Where to initiate data load in NgRx
12 hours ago, devto

In NgRx, loading data from a data source, such as a REST API or a DB, is done using an effect. However, something has to dispatch the action that triggers the effect in the first place. I've seen a few different suggestions / approaches to doing this: Use an effect triggered by the INIT action when the app starts @Effect() loadData$ = this.actions$.pipe( ofType(INIT), switchMap(() => forkJoin( ordersService.load(), customersService.load() )), switchMap(([orders, customers])...

Engineer, mechanic, craftsperson
12 hours ago, devto

I just finished replacing the battery in a car and it got me thinking about the different roles we play as developers. We go through so many different stages and roles that narrowing down any one can be difficult. As I was thinking about the car and the things I feel comfortable fixing on it, I started to realize some of the roles I play at any given time. On any given day, at any given time, I may be working as an engineer, a mechanic, a craftsperson or some combination of the three. Let me e...

OPS - Rethinking Cloud Infrastructure
14 hours ago, devto

Unikernels have been a technology that have been predicted for the past few years to be the future of software infrastructure. Wait - hold up - what's a unikernel!? One way to think of a unikernel is what would happen if you converted your application into it's own operating system. It is a single purpose operating system versus a general purpose one like Linux. Another really large difference is that a unikernel is meant to only run one application per server. Since practically everything that ...

Do we really need a CSS Framework?
14 hours ago, devto

We're all well-versed with the capabilities and limits of Bootstrap. But of course, there once was a time when if somebody asked, "What's Bootstrap?", we were all like this That time is over now, and using CSS frameworks has become standard practice across the industry as they save us a lot of time. But the question I want to pose today is this: Do we really need them in 2019? Perhaps not. 🤔 In this post, we will go through why you may not need a CSS framework anymore. Let's jump right into it...

HTML Rendering: An Important Lesson
14 hours ago, devto

Header image: Field notes and pencil by helloquence I put out a tweet at the weekend: dotnetcore.show @dotnetcoreshow That moment when you take a page load from 2.99 seconds down to 700ms (without having to use caching)#kindOfABigDeal #webOptimisation 14:31 PM - 19 Jan 2019 14 And I thought that I'd explain just what was going on and how I'd managed to speed up page render time from almost 3 seconds down to 700 milliseconds without (and this is the key part) needing to use any kind of cac...

Web APIs exploration
15 hours ago, devto

This post is taken from my blog so be sure to check it out for more up-to-date content 😉 JavaScript allows developers to create amazing interactive experiences for users across different browsers. In fact, that's why all web content got so much more immersive in the last couple of years - because of JS! But just one programming language is not enough to harness the power of the web. No, no. You need a lot more than just that! Sure, there are tons of JS builtin types, objects, classes etc. provid...

Get a ruby method block source
16 hours ago, devto

Overview I try it. block_source.rb (require RUBY_VERSION >= '2.6.0' def inspector(ast:, &block) ast.children.each do |child| next unless child.instance_of?(RubyVM::AbstractSyntaxTree::Node) yield child inspector(ast: child, &block) end end def find_node(ast:, type:, lineno:) inspector(ast: ast) do |node| return node if node.type == type && node.first_lineno == lineno end nil end def extract_source(node:, source:) first_lineno = node.first_lineno - 1 first_c...

JavaScript Modules: From IIFEs to CommonJS to ES6 Modules
18 hours ago, devto

I’ve taught JavaScript for a long time to a lot of people. Consistently the most commonly under-learned aspect of the language is the module system. There’s good reason for that. Modules in JavaScript have a strange and erratic history. In this post we’ll walk through that history and you’ll learn modules of the past to better understand how JavaScript modules work today. If you'd prefer to watch rather than read, here's a video that covers the same material. Feel free to subscribe if you like i...

My plan to become a better developer in 2019.
18 hours ago, devto

I know what you might be thinking: "It is almost February and the cliché New Year's resolution posts are still rolling on my timeline (now on dev.to)." And I do not blame you! But even that I do not normally take part of the New Year's resolution fever (normally I end up frustrated for not keeping them afterwards) this year I felt that I needed one, that I needed to formulate a good plan if I wanted to see tangible results by the end of the year. The reason Looking back at 2018, it was a ...

React - Context API
19 hours ago, devto

Hasta antes de la versión 16, solo había una forma -nativa- de compartir propiedades entre componentes y era por medio de Prop drilling o, dicho en español, taladramiento ,que quiere decir, que las propiedades fluyen de arriba hacia abajo en una jerarquía previamente establecida. Prop Drilling y Redux Era común tener componentes como el siguiente: class Me extends React.Component<P, S> { state = { lastName = 'Garzaki' } render = _ => ( <div> <p>Hola, yo soy Gustavo {thi...

Announcing v0.5 of my Metadata Reflection API polyfill for TypeScript decorators
20 hours ago, devto

What is Reflection @abraham/reflection is a lightweight ES Module implementation of reflect-metadata API so you can ship decorators with TypeScript with fewer bytes. Usage Install @abraham/reflection through npm: npm install @abraham/reflection Import into your code: import '@abraham/reflection'; Check out how to write a decorator: TypeScript method decorators example Simon Cleriot #typescript#javascript What's Changed Update test names Add import example enable ...

Running Argo Workflows Across Multiple Kubernetes Clusters
20 hours ago, devto

Originally published in Admiralty's blog. We recently open-sourced multicluster-scheduler, a system of Kubernetes controllers that intelligently schedules workloads across clusters. In this blog post, we will use it with Argo to run multicluster workflows (pipelines, DAGs, ETLs) that better utilize resources and/or combine data from different regions or clouds. Most enterprises that use Kubernetes manage multiple clusters. For various reasons, you may have one or several clusters per team, regio...

Ruby nil value objects
20 hours ago, devto

TL;DR A value object can be much more concisely defined if you dedicate a different class to handling null values. The null value class can be a Ruby singleton, so only one instance is ever instantiated, saving memory. Problem So value objects in Ruby are great. But not everything has a value all of the time. Nils are everywhere, and how do you efficiently handle them? If you get it wrong then you're going to be staring at this sort of thing: class ISBN def initialize(input) @i...

How to Organize Your Components
21 hours ago, devto

It can be pretty easy to write code - but how do you organize it? I've worked with dozens of developers working with React Native and have seen a variety of ways of organizing code. From putting everything into one file to files that have less than 10 lines on average. In this tutorial I want to give you a balanced approach. A way to organize your code so it's easy to work with and maintain but not a burden to manage/stick to. Overall Project Structure We're just covering the UI components...

One-click HTTP debugging for any CLI tool
21 hours ago, devto

Debug all HTTP(S) sent by git, npm, apt-get, or anything else The command line is powerful, but can be hard to understand, and extremely hard to debug. Ever run a command, see it fail with a cryptic error, and have no idea why? Better tools can help you understand what's really going on. They can let you see inside the command you're running to understand how it's communicating, see what data it's working with, and debug it in depth. Excitingly I've just shipped one-click terminal interception t...

How to create an equal height grid using Flexbox CSS
21 hours ago, devto

If you enjoyed this screencast, consider subscribing to my YouTube channel for more screencasts about HTML, CSS, and JavaScript....

Emulating Components in Twig
21 hours ago, devto

Components are one of my favorite things about JavaScript frameworks like Vue.js. They allow you to follow DRY principles by removing repetition of code in your markup, and they provide a fantastic developer experience. When I work in Twig templates, not having access to bona fide components is definitely one of the things I miss most. Because of that, I've been looking for a solution to this problem for a while. Before I talk about the solutions I tried out, and the one I've landed on, let me f...

Next