Johnny

@smpnjn

3156 Points 55 Followers

163 Posts

0 Answers

Engineer, Product

Johnny · 1 day ago

How to count all files in a directory in Linux

To count all files in a directory in linux, simply cd to that directory and then run the following command: ls | wc -l Alternatively, you can select the directory by adding the directory to...

Johnny · 1 day ago

Python: The Difference Between Sets, Lists, Dictionaries and Tuples

Python has four types of data collections. When to use which, and why we have four, can be confusing. In this guide I'll go through what each of the types are, and how to use them. The four...

Johnny · 1 day ago

Python Dictionaries: A Complete Guide

Dictionaries are an important way to store data in Python. They let us store information as key value pairs which are indexed by key name rather than index like in Python Lists. In this guid...

Johnny · 1 day ago

Python Lists: A Complete Guide

Python lists are a fundamental data type in Python. They are similar to Arrays in other languages, such as Javascript. You can learn more about the main Python data structures here. To creat...

Johnny · 1 day ago

Python Sets: A Complete Guide

Sets in python provide a method to create a unique set of unordered items with no duplicates. Their main use case is for checking is an item exists in a set of items, which can be useful in...

Johnny · 1 day ago

Python Tuples: A Complete Guide

Tuples are an important data structure in Python which are quite similar to Python lists. The main difference between tuples and lists, is tuples cannot be modified. Once it's created, it is...

Johnny · 1 day ago

How to get all keys in Redis

In Redis, we use KEYS to retrieve specific keys we've defined in our database. For example, if we'd created a Redis key like this: set someKeyName someValue Then we could get that value by...

Johnny · 1 day ago

A Complete Guide to Redis Hashes

Redis hashes are a type of record stored in a Redis database. They are a little like JSON objects, and store data as key value pairs. They are mutable, so can be easily changed and updated d...

Johnny · 5 days ago

A Complete Guide to Javascript Maps

You're probably familiar with Javascript Objects - but did you know there is another way to create sets of data in Javascript, known as Maps? You might be using Javascript plain old objects...
5

Johnny · 1 week ago

Using Only CSS to Recreate Windows 98

As part of my continuous work to see how much I can do with just CSS (see other work such as the CSS only Minecraft Chicken), I decided to try and recreate Windows 98 using nothing else apar...
3

Johnny · 2 weeks ago

Deleting an Item in an Array at a Specific Index

In a previous article, I covered how to insert items into an array at a specific index, so now let's look at how to delete items. Arrays, which are common data structures in Javascript, look...
1

Johnny · 2 weeks ago

Everything you need to know about Javascript Arrays

With arrays, there are usually a set number of specific things you want to achieve. Below is a list of pretty much any action you would want to perform on an array, and how to do it in Javas...
4

Johnny · 2 weeks ago

Inserting an Item into an Array at a Specific Index in Javascript

Arrays are common data structures found in Javascript, which typically look a bit like this: let myArray = [ 'some', 'data', 'here' ] They act a lot like arrays found in other languages, an...
1

Johnny · 2 weeks ago

How to Kill a Process Running on a Port

It is common in Node.js and other languages to run a script on a certain port. Since ports can come in and out of use, it's also common to get the following error: Error: listen EADDRINU...
1

Johnny · 2 weeks ago

The Difference between TypeScript Interfaces and Types

In TypeScript, you might have noticed you can declare custom types in two different ways. One is with the interface keyword, and the other is with the type keyword. As such, you may find you...
2

Johnny · 2 weeks ago

How to delete all keys and everything in Redis

Sometimes we all need a new start - and this goes for Redis too. There are many situations where you will want to entirely wipe all data from Redis. Fortunately, it's easy to wipe your Redis...
2

Johnny · 2 weeks ago

Git Stash - Everything about stashing changes in git

Sometimes, when we are making changes to a project in git, we realise we suddenly need to revert back to the last clean working directory version of our project - that meaning the version wi...
2

Johnny · 3 weeks ago

Navigation between views in Vue with Vue Router

After creating an application in Vue, you'll often want it to consist of multiple views or pages. To do this, we need to use an additional package known as vue-router. Creating a simple Vue...
4

Johnny · 3 weeks ago

How to undo a git pull

Have you ever been working on a project, ran a git pull only to realise you've majorly messed up? Now all your code has been overwritten with whatever was in your remote repository - and som...
3

Johnny · 4 weeks ago

How to make Git ignore file permission (chmod) changes

Have you ever made some changes in git, and then changed the files permissions too, only to realise you only want to publish the changes to the files, and not the file permissions? Or maybe...
2

Johnny · 4 weeks ago

What are the three dots (...) or spread operator in Javascript?

The spread operator, spread syntax or 3 dots (...), is a type of syntax in Javascript which is used by both function calls and in arrays/objects. It has a multitude of different uses, so let...
2

Johnny · 4 weeks ago

Vue Tips: Optimize your Vue Apps with v-once and v-memo

Vue is like any other tool we use on the web - your mileage will vary depending on how you use it. If you write poorly optimised code, you'll still get a slow website, even if Vue has lots o...
1

Johnny · 4 weeks ago

Vue Tips: Dynamic CSS with Vue Reactive Variables

If you use Vue, you might be used to having to apply different classes to tags based on the logic in your code. That's because we might want to reactively update an elements class based on w...

Johnny · 1 month ago

Git blame - How to find out who modified a line with Git

Have you ever found a bug inducing line change in your code, and wondered who made the change to that line? Fortunately, git has a command for that! git blame lets you pick a file and show w...
2

Johnny · 1 month ago

Using Git to see recent changes in specified a time period

Have you ever gone on a long holiday and wanted to check the updates your team have made since 2 weeks ago? Or maybe even in just the last week. Sure, you could trawl through PRs, but there...

Johnny · 1 month ago

How to amend and update a git commit

Have you ever made a commit message with git commit like this? git commit -m "Fixed CSS" Only to remember the hundreds of articles you've read on writing "real" commit m...

Johnny · 1 month ago

How to force overwrite local changes with 'git pull'

Have you ever been working on a project in git and ran into an error telling you that you can't use git pull because you have local changes? error: Untracked working tree file 'App.vue' woul...
5

Johnny · 1 month ago

Making a Morphing 3D Sphere in Javascript with Three.js

I love 3d effects on the internet, and they're increasingly all over the place. They can add an extra dimension to a website that helps to catch a user's attention. I have previously covered...
6

Johnny · 1 month ago

How TypeScript Default Parameters Work

In a previous article, I covered the concept of optional parameters in TypeScript. In this guide, we used the ? question mark symbol to denote if a function's argument was optional. In this...
6

Johnny · 1 month ago

Using .env Environment Variables in Vue

When we make a Node.js application, it's pretty typical that we also create a .env file that stores all of our environment variables. This file is typically private, and can be used to store...
2

Loading More Content