Hidden gems of the Chrome DevTools, Part 1: The Console API
#web#chrome#tools#debugDebugging, or finding the reason why your code doesn't work, is one of the most important skills a software developer needs. If you can debug effectively, you'll catch problems faster and even gain a better understanding on how things work under the hood.
Setup Spectron and Testing Library to effectively test your Electron.js application
How using Testing Library will help you improve the accessibility of your application
Mocking GraphQL APIs with Mock Service Worker
#mocking#testing#graphqlMock Service Worker (MSW) is a library for mocking, or faking, a backend API. This is extremely useful when you are developing new features into your application, or when you are running tests.
Creating a VS Code theme
#vscodeEver wanted to create a theme for VS Code? It's simpler than you'd think but the process is a bit laborious and requires you to painstakingly go through all the attributes you need to change. If you want your theme to work, and look nice, on multiple programming languages, you'll need to add a lot of color definitions.
Use box-sizing: border-box for simpler element sizing
#cssThe CSS box model and it's behaviour with different box-sizing values might be difficult to visualize.
My year in review 2020
#review#2020This has been a horrible year for most of us. COVID-19 has killed millions of people and changed life for millions more. The pandemic has also changed the way we work and live our daily lives. In this article I'm going to focus on the more positive things which have happened to me in 2020.
A Tailwind CSS plugin for adding gradient masks
#tailwind#css#open sourceSome time ago I added excerpts to by blog. A small sample of the full blog text to is now shown on the front page after the post heading, date and tags. To make the exceprts look a bit nicer, I wanted add a effect which makes the text fade into the background.
Use useReducer to manage complex state
#react#hooks#reduceruseReducer is a React Hook which helps you manage complex state with a simple API. The hook takes a reducer function and the initial state as parameters. You can also pass in an optional argument which can be a function for lazy initialization of the state.
Manage React state with the useContext hook
#react#context#stateReact projects have many options for managing state. While libraries like redux and mobx are a popular choice, React also has it's own API for managing state. The Context API is useful when you have state which is accessed in multiple places in your app and you want to avoid prop drilling...
Make custom marker displaying users location and direction with react-native-maps on iOS
#react#react native#mapsIf you want to display the current GPS location with your own custom graphics in React Native Maps, you need to create a custom Marker. This is done fairly easily, since the Marker component accepts a View as child.
What is React Strict Mode?
#react#frontend#debuggingReact Strict Mode is a tool, which comes with React, for detecting possible issues and problems in your application. Currently (Sept. 2020) Strict Mode detects if you have unsafe lifecycle methods, usage of legacy string ref API, usage of findDOMNode, detecting unexpected side effects or detecting usage of legacy context API.
Access DOM element in a child component in React
#react#ref#domSometimes we need access a DOM element which is contained by another React component. If we try to just use ref and pass it to the child component, we get an error. This is because ref is a reserved prop name so you can't pass it to a child component. Instead we can use forwardRef when defining the child component.
Customize Django admin with list_display property
#django#pythonOne of the great "batteries included" features Django has, is the automatically generated admin panel. It provides a simple UI for creating, editing and deleting data defined with the Django ORM. In this article we are going to enable the admin user interface for a simple model and customize it from a simple list view to a more user friendly table like interface.
Using namedtuple to create simple data objects in Python
#python#namedtuplePython standard library has a handy collection factory function called namedtuple, which can be used to assign names for each position in a tuple. Named tuples behave otherwise like a normal tuples but each element has a name which can be used for retrieving the value just like with class objects.
Introduction to relative CSS units
#cssWith CSS you can use absolute units like the familiar px, pt or relative units like em and rem . Absolute units are quite simple to use and rarely cause confusion. Relative units however can twist your brain if your not familiar with how they work.
Create a React Hook to show browser online status
#react#hooksReact Hooks are a way of adding logic to your functional components in an simple and elegant way. In addition to the standard hooks like useState or useEffect you can also create your own hooks if find you need the same logic in multiple components.
Small projects for learning the Rust programming language
#rustInspired by some of Jon Gjensets Rust streams and videos I decided to start learning Rust (again!). I've previously read part of the Rust book but never started any projects with it so I didn't retain much of it.
Making API calls in React useEffect
Dark mode using prefers-color-scheme rule and CSS variables
#css#design#usabilityIn this article I'll show you how to implement dark mode in your blog or site using CSS variables and how the toggle it automatically based on the users preferred color scheme.
The very basics of React Hooks
Memoization in Python
#optimization#pythonMemoization is a optimization technique frequently used in functional programming. It means storing the result of a computationally intensive function call and returing the cached result when the function is called with the same arguments.
Python class and instance variables
#pythonConfusing class variables and instance variables in Python is a pretty common mistake. Or.. atleast I've made it more than once. Python doesn't use static keyword but instead the location the variables are defined in to differentiate between the two which will seem pretty foreign to people coming from other object oriented languages.
Generating forms from JSON schema in React applications Automatically generating UI from a schema document can be a powerful prototyping tool or can even be used to build simple apps if the requirements aren't too complex. One awesome library for generating UIs from json-schemas is react-jsonschema-form. react-jsonschema-from can be used to automatically generate forms in a React application from a JSON schema document.
Using django-registration for simple user registration Recently I had to setup a web app with simple one step user registration. After some searching I came accross a Django library called django-registration which seemed like the best way to implement user registration. It features single step and two step registration flows, some simple views and simple installation and configuration. In this blog post I’m going to go over the steps needed to implement user registration in a Django app.