Tag: programming

  • My 10 simple UX rules

    My 10 simple UX rules

    Creating a user interface that offers a positive user experience (UX) requires a certain level of skill, and admittedly, design is not my primary area of expertise as I am a programmer. Nevertheless, I have gathered some fundamental principles over the years that aid me in delivering a satisfactory user interface. 1. Always respond to…

  • VSCode keyboard shortcuts I’m actually using

    VSCode keyboard shortcuts I’m actually using

    Visual Studio Code contains centillions of keyboard shortcuts, but in everyday life I use only a fraction of them. I have also mapped them to key combinations that are easier to access. These three-finger shortcuts are really crazy, while others I never use, like “Cursor Undo”, are mapped to “Ctrl-U”.Your mileage may vary, but I…

  • How to loop through an array with a variable starting element

    How to loop through an array with a variable starting element

    Recently I was faced with an interesting problem. I needed to create a simplified (pseudo-) cron interface: The task is to find the next selected day.

  • The modern way of checking radio groups

    The modern way of checking radio groups

    Checking radio groups in JavaScript has always been a bit tricky because you can only check if a particular radio button is selected, not the whole group at once. Wow, that looks archaic. There must be a better way using the new ES6 features, and there is! As of ES2015, NodeList contains a forEach method().…

  • Using JavaScript modules in your WordPress plugins

    Using JavaScript modules in your WordPress plugins

    Modules are nothing new in JavaScript programming, and it’s a good practice to modularize your code. WordPress does not offer the option to load scripts as modules out of the box. There’s a ticket from mid 2022, but it hasn’t gained much traction yet. So we need a workaround for the time being. Fortunately, WordPress…

  • Chrome side panel: Simulate close event

    The new side panel in Chrome does not contain a close event, which could come handy if you want to clean up stuff after the panel has been closed. You can simulate the event by opening a permanent connection between the side panel and the background script. This connection fires an onDisconnect event if the…

  • How-to split a number into equal chunks

    How-to split a number into equal chunks

    The other day I had to iterate over a large number of items but to avoid a timeout I could only compute a certain amount at a time. So I had to split the number into equal chunks and a remainder. Here’s an easy way to determine the chunk size: The code return the following…