References to items in PHP's arrays have a seemingly unexplainable quirk/bug. If one manipulates an array by using references to some items, then he makes a copy of the array and manipulates that afterwards, somehow this modifies the original array too. This isn't shallow copying of objects; this happens with primitive types like ints and strings.
PHP Arrays' Primitive Reference Conversions
December 22, 2023Home Assistant's Logic-Lacking Variables
October 24, 2023The whole point of home automation is to do things conditionally. Maybe you want to change the light color depending on the time of day. Maybe you want to play a noise when someone hits a button. Or, in my case, I want to adjust the thermostat based on the temperature and people's locations. Regardless of what you want to do, the go-to software is the mostly-lovely Home Assistant. It makes it easy to integrate all your devices with whatever setup you want and then lets you run automations to…a...
How to Scope CSS by Moving an Element to the Shadow DOM
January 29, 2019(tl;dr: Jump to the actual moving)
Scope is an important concept in programming. It allows you to just write small sections of code to do what you need them to do without having to worry about something else in your code using the same name and messing everything up. Declarations (such as of variables or functions) will only be visible to code also in the same scope, usually some block of code.
MDN has a good example of the effects of scope in Javascript:
let x = 1;
if (x === 1) {...