Posts

Showing posts from December, 2025

Falling asleep while coding

Image
 I try to move around if I am falling asleep in the evenings while coding. At first, I wrongly tried having a nap. I drink lots of decaffeinated tea when coding.  Normal tea makes my anxiety worse. I tried hot milk for a while. I like Yorkshire tea.

Setting the 'class' of an SVG element

Image
 I could not set the 'class' of an SVG element using the 'className' property in JavaScript. For example:     var bfyvSVG =              document.createElementNS('http://www.w3.org/2000/svg', 'svg');     bfyvSVG.id = 'bfyvSVG';     bfyvSVG.className = 'bfyvSvg-defs'; One answer is to use 'setAttribute':     bfyvSVG.setAttribute("class","bfyvSvg-defs"); I found the answer on 'stackoverflow.com':     stackoverflow.com/questions/37943006/unable-to-change-class-name-of-svg-element For an SVG, 'className' means something a little different. I could have used 'className.baseVal'

Draw ellipses with 'border-radius'

Image
 You can draw ellipses and other curved shapes by giving two values to 'border-radius' in CSS. For example:      border-radius: 50% 49% 40% 40% /                     45% 45% 45% 45%; The first set of values are horizontal radii and the second are vertical radii. This is used in a Github icon that I adapted. See:       https://codepen.io/Bert-Beckwith/pen/yyNYeZm The border-radius value above is used for the head which has an 'aqua' color.

Old copies of Progressive Web Apps

Image
 If a webpage is a 'Progressive Web App' (PWA) then someone may have an installed copy of the webpage that is old. I copied some images into a sub-directory to try to speed up the access time. But I cannot remove the original images from the top directory because an old PWA might use the original images. So it is just a little bit slower accessing the new copies of the images in the sub-directory. I tell Chrome the webpage is a PWA by registerng a 'do-nothing' service-worker.  Chrome warns about having a 'do-nothing' service-worker as it needs to be loaded which takes time.