Innhold om Frontend
Totalt 322 innlegg
Side 10 av 22
Reducing boilerplate code in Elm with Maybe.andThen
Working with the Maybe type in Elm may result in excessive pattern matching because Elm forces us to handle all possible outcomes. In this article, we investigate how the Maybe.andThen function can be used to improve readability by reducing unnecessary pattern matching and boilerplate code.
Working with the Maybe type in Elm may result in excessive pattern matching because Elm forces us to handle all possible outcomes. In this article, we investigate how the Maybe.andThen function can be used to improve readability by reducing unnecessary pattern matching and boilerplate code.
Making sounds with React and Tone.js
By utilizing Tone.js one could easily produce some sounds, and if you’re lucky it could be quite musical. In this article we’ll look at combining React with Tone.js to make a simple sequencer.
By utilizing Tone.js one could easily produce some sounds, and if you’re lucky it could be quite musical. In this article we’ll look at combining React with Tone.js to make a simple sequencer.
Reusing existing JavaScript-code in your React app
A couple of years ago, a colleague and I created a small JavaScript application to toy around with some image processing techniques. I really enjoyed the project, and the other day I decided put the same functionality in my new React code. One way of doing this would be to rewrite the whole thing, and to be honest, it probably would not have been that much work. But it got me thinking, how would I go about injecting the already written code into my React application? I haven't done anything like this before, and if you haven't either, this is a blog post for you!
A couple of years ago, a colleague and I created a small JavaScript application to toy around with some image processing techniques. I really enjoyed the project, and the other day I decided put the same functionality in my new React code. One way of doing this would be to rewrite the whole thing, and to be honest, it probably would not have been that much work. But it got me thinking, how would I go about injecting the already written code into my React application? I haven't done anything like this before, and if you haven't either, this is a blog post for you!
Combining Maybes in Elm
Have you ever needed to combine different Maybe-values to produce another value? In this article, we explore just that.
Have you ever needed to combine different Maybe-values to produce another value? In this article, we explore just that.
Higher-order functions in JavaScript
If you are well-versed in the JavasScript-universe, you probably know that functions are also objects in JavaScript. Everything you can do with regular objects and values, you can do with functions as well. You can pass them as parameters to other functions, declare them as variables or pass them around as you’d like. Since functions can be passed as parameters or returned as an output from another function, this has enabled higher-order functions to be built into the language. In this article I will demonstrate how higher-order functions have allowed me to write readable and more maintainable code with fewer bugs, and how it coincidentally completely removed the need to write for-loops in my code!
If you are well-versed in the JavasScript-universe, you probably know that functions are also objects in JavaScript. Everything you can do with regular objects and values, you can do with functions as well. You can pass them as parameters to other functions, declare them as variables or pass them around as you’d like. Since functions can be passed as parameters or returned as an output from another function, this has enabled higher-order functions to be built into the language. In this article I will demonstrate how higher-order functions have allowed me to write readable and more maintainable code with fewer bugs, and how it coincidentally completely removed the need to write for-loops in my code!
The delicious Event Loop
Have you ever wondered what the amazing Christmas dinner and the Event Loop in JavaScript have in common? Well, not much. But I will use the preparation of this delicious meal to make the event loop a bit more edible.
Have you ever wondered what the amazing Christmas dinner and the Event Loop in JavaScript have in common? Well, not much. But I will use the preparation of this delicious meal to make the event loop a bit more edible.
What do we do with what's inside the box?
Elm doesn't have nulls or undefineds, it has a Maybe type. While it's a pleasent type to work with, it might take some getting used to if you're coming from a language like Java or Python. Let's take a look at how we perform some basic operations over the Maybe type.
Elm doesn't have nulls or undefineds, it has a Maybe type. While it's a pleasent type to work with, it might take some getting used to if you're coming from a language like Java or Python. Let's take a look at how we perform some basic operations over the Maybe type.
A Hot Chocolate Map with React Leaflet and TypeScript
For the last decade I've called Oslo my home. And aside from the usual goals of getting an education, landing a job and living my life, I've had a side quest: Finding the best places for hot chocolate in town.
For the last decade I've called Oslo my home. And aside from the usual goals of getting an education, landing a job and living my life, I've had a side quest: Finding the best places for hot chocolate in town.
Creating a Chrome Extension with React and TypeScript
Did you know most Chrome extensions are written in good ol' JavaScript? Turns out, creating one with React is pretty straight forward, too! Let's look at how you can use your existing JavaScript skills to spread some holiday cheer!
Did you know most Chrome extensions are written in good ol' JavaScript? Turns out, creating one with React is pretty straight forward, too! Let's look at how you can use your existing JavaScript skills to spread some holiday cheer!
Operators are functions, too
Much of Elm's power stems from the fact that most things are just functions. So how do operators fit in?
Much of Elm's power stems from the fact that most things are just functions. So how do operators fit in?
Smooth Operators
Provided I didn't miscount (I am not the Count von Count, so it's quite possible), there are 46 operators in JavaScript which are available in all modern web browsers. Many of them are inevitable (e.g. arithmetical and logical operators), while others are more uncommon. But the list doesn't end there and the family of operators is still growing. Let's have a brief look at the latest additions, and new operators which are just around the corner!
Provided I didn't miscount (I am not the Count von Count, so it's quite possible), there are 46 operators in JavaScript which are available in all modern web browsers. Many of them are inevitable (e.g. arithmetical and logical operators), while others are more uncommon. But the list doesn't end there and the family of operators is still growing. Let's have a brief look at the latest additions, and new operators which are just around the corner!
Back to basics - Setting up a minimal React project from scratch
It's so easy nowadays to get a web application up and running in just a couple of minutes. We've got tools like Create-react-app, React boilerplate, Slingshot etc., which let developers set up and prototype anything blazing fast. These tools come with Webpack, Babel and more already configured for you, so you don't have to know anything about them or what they are used for. This is obviously very valuable and cost-effective, but we also have to remember to keep in touch with our roots and get some sense of what is going on under the hood. So for today's topic we will be going back to the basics and see how we can set up most of what we need from scratch!
It's so easy nowadays to get a web application up and running in just a couple of minutes. We've got tools like Create-react-app, React boilerplate, Slingshot etc., which let developers set up and prototype anything blazing fast. These tools come with Webpack, Babel and more already configured for you, so you don't have to know anything about them or what they are used for. This is obviously very valuable and cost-effective, but we also have to remember to keep in touch with our roots and get some sense of what is going on under the hood. So for today's topic we will be going back to the basics and see how we can set up most of what we need from scratch!
Lord of the pipes
If the bulk of your programming experience comes from C-like languages, there’s a chance you find pipes, |>and <| some of the most distinct features of Elm. Roll up your sleeves, it's time to master the art of piping.
If the bulk of your programming experience comes from C-like languages, there’s a chance you find pipes, |>and <| some of the most distinct features of Elm. Roll up your sleeves, it's time to master the art of piping.
Enhanced strings with tagged template literals
Have you ever wanted to add extra functionality to strings? With tagged template literals you can build useful templates, add logic, or write different languages inside strings. How can that be useful, and how does it even work? Dive into how tagged template literals let us build enhanced strings!
Have you ever wanted to add extra functionality to strings? With tagged template literals you can build useful templates, add logic, or write different languages inside strings. How can that be useful, and how does it even work? Dive into how tagged template literals let us build enhanced strings!