Elixir: Saving a tuple in Postgres
You can sort of get it working - but should you? I'm writing a Connect Four game application in Elixir. I wrote game logic which expects to receive the coordinates of a coin position as a tuple…
You can sort of get it working - but should you? I'm writing a Connect Four game application in Elixir. I wrote game logic which expects to receive the coordinates of a coin position as a tuple…
There's a Node / TypeScript SDK for interacting with Azure Table Storage tables. The query capabilities of an Azure Table Storage table aren't great, but I found out that you can at least pass some…
Today I learnt about Azure Table storage. At work I needed to find out how many users prefer one UI setting over another. This data was saved in an Azure Table storage database table. What is Azure…
A few weeks ago I was lucky enough to work on a codebase that was getting setup with Terraform. I had never used it before, so it was great to learn about it! Here's what I understand so far... What…
...and I think that's a good thing! Let me explain why. I write JavaScript in my day job and nesting describe blocks in my tests is such common practise, that I hardly even think about it anymore. I'm…
I only just started working with styled components and they seemed pretty straight forward to use. You can use any HTML tag of your choice and pass it your CSS as a JavaScript object. Styling a div…
When you want to test some simple and repetitive logic, it makes sense to loop over the input and output data and run the test for each. A verbose example Let's imagine we're writing tests for a…
Lerna is a tool for managing mono-repos, i.e. Git repos that contain several projects. I'd worked on a repo before that used it but never understood its full capabilities. Now I learnt more! What it's…
Today I learnt that you can have conditional statements in your .gitconfig file. This was useful because I now have a second Github account for a client project in addition to my usual public account…
Prototype pollution seems to come up quite a lot when tells me to upgrade packages. It's a vulnerability that has to do with the way inheritance is done in JavaScript. Any object that is created in…
I've been learning more and more about web security recently and today I came across the concept of a web shell. I was going through a course on secure JavaScript coding which mentioned two prime…
Today I learnt that both of those function could potentially make your code vulnerable to remote code execution! I only knew that the and functions can take another function as an argument, which…
Who would have thought that I'd learn a new German word at a conference in Australia - from Martin Fowler! My first language is German. I haven't lived in Germany for over a decade now so I'm somewhat…
Adding salt to a password before hashing it makes it more secure. Recently I learnt exactly why that is. When you save a password in your database, you don't want to save it in plain text. In case…
We're migrating our old Hugo blog at work to use Gatsby. Mostly the markdown pages can stay the same - except the frontmatter sections at the top of each blog post. In Hugo we were using JSON and…
Smoke tests are tests that are run to ensure that the most basic functionality of a program works. So not testing all the edge cases but instead making sure that the main things that the program…
This is an awesome one. Let me explain. Today our whole team at work is spending a day of paying off technical debt. Ok, that’s not the awesome part. The awesome part is what my colleague just showed…
The first thing I learnt today was about CSS custom properties, also called CSS variables. I might be a bit late to the game here but today was the first time I actually saw these in use - in a PR…
Today I had an error because I was trying to set some data on a nested object in MongoDB, except that the parent key was null in one case. So I got an error because Mongo didn't know how to set null…
We had a little bit of an issue in live today, resulting from a large refactoring that was done this week. We had to urgently fix this issue. It was hard to debug, so we ended up reverting the code…
At work we have a pre-push hook on our repos that doesn’t allow us to push if we have npm vulnerabilities. That’s great for security, of course, and I see why that’s necessary. It’s not much fun if…
I was listening to the Shoptalk Show podcast episode about how to make money with your content on the web. And there’s a new way of doing that with one provider called Coil. I think there might be…
I'm reading The Pragmatic Programmer at the moment and they explain what orthogonal systems are. I feel like I had heard about it before but never really knew what it meant. Orthogonality is a term…
Every time I cook rice, I ask myself this question. Today I looked it up. I figured that it would have some sort of sensor to measure the temperature and/or maybe the humidity… but what exactly does…
I came across this philosophy in the new edition of the Pragmatic Programmer book. (I guess the original version talks about it too but I don’t think I ever read that). It’s a Japanese concept meaning…
We’re using expect.js at work for our test assertions. And today I learnt that you can have an assertion on whether an object has a key or not. I needed to assert that an object was not saved with a…
This is probably more a note for myself rather than anything else… but why not make it public? Maybe someone else is looking for just that. We had a test that was randomly failing when we were running…
I’ve recently done a lot with dates and times. And I found it really fiddly. Comparing dates, comparing times of days… and I learnt a few things about that. Firstly, moment.js is a life saver. It has…
Recently, while I was pairing with Federico, he wrote some code like this: And my reaction was: "You have a rogue comma there!" But no… he left it on purpose! If you’re familiar with destructuring in…
I did another one today to easier debugging in JavaScript. When your cursor is on a word in normal mode, you can type and it will insert a console.log statement with the word you’re on on the next…
The amount of times that I've finished writing the expectation of a test, then navigated up to the description of the test (usually using to match the closing bracket), then added a after the to…
I feel like every time I look at caniuse.com to see what the browser support is for certain CSS or JS features, there’s usually a mix of green and red - but there’s always one that’s red and nothing…
I’m really not keeping up with the latest web development trends… Today was the first time that I heard about WebP. It’s an image format which is superior to PNG and JPEG in terms of file size and…
One of the many wondrous things you can inspect in the Chrome developer console are the cache-control settings. The first value it specifies is either “private” or “public”. And then it shows the max…
What Express is trying to tell you is that your route is calling a controller function that doesn’t exist… Because you renamed it in the controller… and then you went and updated some other things…
I think threads on Slack are great - they keep the channel a lot tidier. It just always annoyed me that I couldn’t figure out which shortcut to use to close that little window on the right, that…
I’m working on a small side project in Elixir and last time I worked on it, I got stuck because I got this error. I had just written a Supervisor for the first time and created an Agent as a child of…
Wow, maybe this should have been obvious but I didn’t realise that until now. That’s so cool! I’m working on a slack bot and need to parse people’s commands to the bot. So I’ll be dealing with a lot…
Sounds pretty wild and like something you probably don’t want to touch with a bargepole! Au contraire. I’ve seen it all over our Tes codebase and now I’ve come across it again when I was setting up my…
I’ve been doing the MongoDB for JavaScript developers course by MongoDB University. Today I learnt about write concerns. Let’s say we are saving something in the database, but instead of just one node…
In Elixir you sometimes need an anonymous function instead of a named function. The difference is that an anonymous function has access to anything that is around it, while a named function only has…
As part of the MongoDB University course that I’m doing, I had to write an aggregation with a $lookup 😱 And I learnt that lookups are effectively left joins, as we know them from relational databases…
At work we’re aiming to build a new system in the most Lean way possible. Which basically means that we’re trying to get it up and running with the most minimum amount of work and code written. The…
I’ve worked with JavaScript for a while now but somehow I had never come across the function to display dates in the front end. The function is called on a date object and takes a language and…
Today I used React Hooks for the first time in a production project. Boom! Modern JavaScript. I used the state hook which replaces and . You no longer need a class component to keep track of state…
As a modern woman, I’d been thinking about upgrading to Neovim for a while. (OK, you might argue, that as a modern woman I should have upgraded to Neovim a long time ago. Or that I would not be using…
It’s as easy as this. In your code, use . And when you run your script with set the environment variables first. So it’ll be something like: That’s it! Oh, don’t put spaces around the equals sign…
I’m working on a story to take some data from one database, transform it and then save it in another database. So I need to write a script that does this. Luckily I’m not the first person to have…
I wanted to have a shortcut to find and replace words in the whole project. There’s this command that I googled and thought it was a bit long to type, let alone remember. I could see myself re…
An index on a specific fields means that when we do a query using that field, it will be more performant. But what happens when not all documents in the db have that field? Then we can use a sparse…
Today my colleague Federico introduced me to the functional programming library of lodash. We were using . Here’s how we used it: We had a JavaScript object which first needed to be transformed into…
Every time I have to do a MongoDB query I feel a bit uneasy… I know how to make some basic queries but the rest I always have to google. So I decided to start the Mongo University course for…
Most of us at work seem to be using Studio 3T to access our data in MongoDB. Here are a few things that I've learnt that help me use it better. Shell shortcut To open the shell to write Mongo queries…
I wrote some user stories for a new feature today. I tried to break them down into sensible chunks, as you do. Each story should bring value to the user, be independent of any other stories and be…
I picked up a story at work today which is related to indexes in MongoDB. Basically, one of my colleagues had run a query to evaluate the usage of our existing indexes for a specific collection and…
We’re using Joi validation to ensure that we’re saving the data of the correct types and with the correct fields into our database. I had created a new field which was a string, so I added this to the…
Refactoring usually means that you’re changing existing code without changing its behaviour - with the intention to make it better. One of my colleagues did a presentation yesterday in which he shared…
I was on holiday in Thailand this weekend. Yeah, digital nomad life is tough 🙂 But I still learnt something. My partner and I went on a snorkelling trip. And on the boat to the snorkelling spots we…
I read this interesting article this morning in bed (great excuse to stay in bed longer). It's about how someone refactored their frontend to use no (ok, minimal) JavaScript. One of the things the…
I had this code for adding a proposed candidate to our store of supply requests. And I needed to add a new key to the second argument - but only if it existed. The new key was . Instead of creating…