Skip to content

Latest tips / 2

Create QR codes in Chrome to send URLs to your smartphone

January 19, 2023

If you want to open a website on your smartphone, i.e. to test it on a mobile device, you can use the sharing feature of Chrome to create a QR code that you can scan with your smartphone. Click on the share icon in the address bar and select "Create QR Code". Then scan the QR code with the camera app of your smartphone to open the website.

Generate QR code in Chrome

Find the gitignore rule that excludes a file from git

October 27, 2022

When a file is ignored by git you can use the check-ignore command which shows you why the file is ignored. This is useful if you have multiple .gitignore files or some complex patterns in your rules.

git check-ignore -v path/to/a/file.png

Empty Cache and Hard Reload in Chrome

October 27, 2022
#devtools #chrome

We all know cache invalidation is hard. If you experience some cache problems while working on a web project in Chrome you can empty the cache and do a hard reload. Just open the DevTools, right click (or long press) on the reload icon in the toolbar and choose "Empty Cache and Hard Reload":

Empty cache and Hard Reload in Chrome

Search & replace with RegEx groups in VS Code

September 22, 2022

The search & replace feature in VS Code cannot just search for static strings but accepts RegEx patterns. Just click on the .* icon in the search input to enable RegEx search.

For the replace pattern you can reference a RegEx group by using "$" and the index of the group. $0 references the entire match, $1 references the first group, $2 the second group and so on.

Let's make an example: The search pattern Hello (\S+) will find strings like "Hello John". The group (\S+) captures the name (here "John") which can be referenced in the replace pattern using $1. With the replace pattern Hi $1! we'll get the following results:

- Hello John
+ Hi John!

- Hello Jane
+ Hi Jane!

Let VoiceOver on iOS read a split element as a single element with the text role

September 22, 2022
#a11y #html

VoiceOver on iOS reads each element individually when a user swipes across the screen. If an element like a link is composed of several span elements, VoiceOver will not read the entire link text but only the text of the active span element (the one that the user has swiped on). Buttons are an exception - VoiceOver will read all child elements at once.

For cases where you want VoiceOver to read the whole text at once you can use the unofficial role text which causes VoiceOver to read the split element as one element. Note that this role is not an official role but just used by VoiceOver. In addition, the role should not be placed on the a tag directly but on a child element because it would overwrite the implicit link role of the a tag.

<a href="">
<!-- Let VoiceOver on iOS read the entire link text at once -->
<span role="text">
<span class="material-icons" aria-label="(external)">open_in_new</span>