Category: Coding
-
Static sites with Jekyll in Ubuntu
Setup Ruby Remove the default Ubuntu install, otherwise you’ll get an error You don’t have write permissions for the /var/lib/gems/3.x.x Directory and configure Ruby to install gems to a folder in your home. Install Jekyll Create a new project Edit project Jekyll has excellent documentation, the step-by-step guide will get you up to speed. In…
-
Expo on Codespaces
What will I need? How long will it take? About ten minutes. Lets give it a go! Create a new Codespace using the blank template: Once initalised, create an empty Expo React App (select (y)es when prompted): Install the expo-cli command line tool globally: Change into your example project’s folder and edit App.js, maybe adding…
-
Rainbows, decorators arguments & threads
Playing with Rainbow Hat I learned a few things about Python as a result I found out what a decorator is, the difference between args and kwargs and threads. I also learned that a lot of guides don’t understand either. If you can’t explain it simply, you don’t understand it well enough1. Decorators Rainbow Hat…
-
Python List Comprehension
I’ve been spending time with Python recently and am beginning to really like some of the language’s features. List comprehension creates a list by evaluating an expression on each item in each list, from left to right. It combines an expression and a loop: Apply a condition : It’s useful for combining lists: Pimoroni’s Rainbow Hat…
-
Using Threading rather than Thread
In an earlier post, I used Threads but the thread module in Python when I should be using threading. The documentation for threading says it builds upon the thread module (renamed _thread): This module provides low-level primitives for working with multiple threads (also called light-weight processes or tasks) — multiple threads of control sharing their global data…
-
Python’s with statement
Managing resources usually involves three steps – allocating, using, and releasing. You’re familiar with the try… finally pattern but Python also provides context managers.