MSMaciek Sitkowskiinblog.macieksitkowski.com·Dec 10, 2022 · 1 min readHow to split string to strings of equal length in JavaScript?Solution 'abcdabcdabcdabcdabcd'.match(/.{1,4}/g) // ['abcd', 'abcd', 'abcd', 'abcd', 'abcd'] Here's original StackOverflow answer. Context In today's Advent of Code challenge, I had to simulate drawing pixels on 40x6 CRT screen. First I computed li...00
MSMaciek Sitkowskiinblog.macieksitkowski.com·Dec 5, 2022 · 2 min readAdvent of Code - preparing input dataWhen solving Advent of Code puzzles, sometimes you will come across an input data, that consist of two parts: configuration and instructions: [S] [C] [Z] [F] [J] [P] [T] [N] [G] [H] [G] [Q] [G] [D] ...00
MSMaciek Sitkowskiinblog.macieksitkowski.com·Dec 1, 2022 · 1 min readImprove your problem solving skills with Advent of CodeIt's December already, so it's time for another edition of Advent of Code. Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. I usu...00
MSMaciek Sitkowskiinblog.macieksitkowski.com·Nov 26, 2022 · 1 min readHow to add overlay color to <img />If you want to change the color of a remote image, that you display like this: <img alt="freeCodeCamp logo" src="https://unpkg.com/simple-icons@7.20.0/icons/freecodecamp.svg" /> You can use CSS filter property. It offers a variety of different co...00
MSMaciek Sitkowskiinblog.macieksitkowski.com·Nov 25, 2022 · 1 min readHow to query image dimensions from Sanity?I haven't used Sanity before, so it took me a while to figure out, how to get photos dimensions using GROQ queries. Here's how I've done it: GROQ query export const query = groq` *[_type == "photo"] { image{ "dimensions": asset->metadata...00