med-mastodon.com is one of the many independent Mastodon servers you can use to participate in the fediverse.
Medical community on Mastodon

Administered by:

Server stats:

339
active users

#javascript

58 posts56 participants1 post today
🌧️ jschof 🌼<p>I was assigned a pretty straightforward bug last week: we were miscalculating the end of day datetime...</p><p><a href="https://c.im/tags/javascript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>javascript</span></a> <a href="https://c.im/tags/dates" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>dates</span></a> <a href="https://c.im/tags/timezones" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>timezones</span></a></p><p><a href="https://jschof.dev/posts/2025/9/dont-write-your-own-date-library/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">jschof.dev/posts/2025/9/dont-w</span><span class="invisible">rite-your-own-date-library/</span></a></p>
neocolapsar<p>I made a portfolio with HTML, CSS and a bit of Javascript.</p><p><a href="https://hypnonauta.github.io/Portfolio/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">hypnonauta.github.io/Portfolio/</span><span class="invisible"></span></a></p><p><a href="https://sunny.garden/tags/WebDesign" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>WebDesign</span></a> <a href="https://sunny.garden/tags/webdevelopment" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>webdevelopment</span></a> <a href="https://sunny.garden/tags/html" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>html</span></a> <a href="https://sunny.garden/tags/css" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>css</span></a> <a href="https://sunny.garden/tags/javascript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>javascript</span></a></p>
Gardiner Bryant<p>Hey Mastodon! I've built a new feature into my <a href="https://mastodon.online/tags/blog" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>blog</span></a> and my <a href="https://mastodon.online/tags/peertube" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>peertube</span></a> instance!</p><p>Check out my write-up. I'm pretty stoked about it.</p><p><a href="https://mastodon.online/tags/ghostblog" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ghostblog</span></a> <a href="https://mastodon.online/tags/independentpublishing" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>independentpublishing</span></a> <a href="https://mastodon.online/tags/webdesign" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>webdesign</span></a> <a href="https://mastodon.online/tags/programming" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>programming</span></a> <a href="https://mastodon.online/tags/coding" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>coding</span></a> <a href="https://mastodon.online/tags/mongodb" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>mongodb</span></a> <a href="https://mastodon.online/tags/php" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>php</span></a> <a href="https://mastodon.online/tags/javascript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>javascript</span></a> </p><p><a href="https://gardinerbryant.com/i-built-a-new-feature-for-the-blog-and-my-peertube-heres-how-it-works/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">gardinerbryant.com/i-built-a-n</span><span class="invisible">ew-feature-for-the-blog-and-my-peertube-heres-how-it-works/</span></a></p>
Thomas Weibel<p>Web app "Meton II" (updated today): The virtual mechanism calculates lunar phases and predicts both lunar and solar eclipses with millennial precision. </p><p><a href="https://www.thomasweibel.ch/meton-ii/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="">thomasweibel.ch/meton-ii/</span><span class="invisible"></span></a> </p><p><a href="https://swiss.social/tags/moon" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>moon</span></a> <a href="https://swiss.social/tags/history" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>history</span></a> <a href="https://swiss.social/tags/antiquity" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>antiquity</span></a> <a href="https://swiss.social/tags/astronomy" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>astronomy</span></a> <a href="https://swiss.social/tags/mathematics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>mathematics</span></a> <a href="https://swiss.social/tags/physics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>physics</span></a> <a href="https://swiss.social/tags/astrophysics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>astrophysics</span></a> <a href="https://swiss.social/tags/mechanics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>mechanics</span></a> <a href="https://swiss.social/tags/simulation" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>simulation</span></a> <a href="https://swiss.social/tags/opendata" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>opendata</span></a> <a href="https://swiss.social/tags/openglam" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>openglam</span></a> <a href="https://swiss.social/tags/openeducation" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>openeducation</span></a> <a href="https://swiss.social/tags/digitalhumanities" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>digitalhumanities</span></a> <a href="https://swiss.social/tags/webdev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>webdev</span></a> <a href="https://swiss.social/tags/html" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>html</span></a> <a href="https://swiss.social/tags/css" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>css</span></a> <a href="https://swiss.social/tags/javascript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>javascript</span></a> <a href="https://swiss.social/tags/js" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>js</span></a></p>
Hacker News 50<p>Why do browsers throttle JavaScript timers?</p><p>Link: <a href="https://nolanlawson.com/2025/08/31/why-do-browsers-throttle-javascript-timers/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">nolanlawson.com/2025/08/31/why</span><span class="invisible">-do-browsers-throttle-javascript-timers/</span></a><br>Discussion: <a href="https://news.ycombinator.com/item?id=45224542" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">news.ycombinator.com/item?id=4</span><span class="invisible">5224542</span></a></p><p><a href="https://social.lansky.name/tags/javascript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>javascript</span></a></p>
Inautilo<p><a href="https://mastodon.social/tags/Development" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Development</span></a> <a href="https://mastodon.social/tags/Tutorials" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Tutorials</span></a><br>Building an AI agent, on-device · All you need is Chrome or Edge to get started <a href="https://ilo.im/166h7q" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">ilo.im/166h7q</span><span class="invisible"></span></a></p><p>_____<br><a href="https://mastodon.social/tags/AI" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>AI</span></a> <a href="https://mastodon.social/tags/Agents" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Agents</span></a> <a href="https://mastodon.social/tags/JavaScript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>JavaScript</span></a> <a href="https://mastodon.social/tags/Device" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Device</span></a> <a href="https://mastodon.social/tags/Chrome" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Chrome</span></a> <a href="https://mastodon.social/tags/Edge" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Edge</span></a> <a href="https://mastodon.social/tags/Browser" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Browser</span></a> <a href="https://mastodon.social/tags/DevTools" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>DevTools</span></a> <a href="https://mastodon.social/tags/WebDev" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>WebDev</span></a> <a href="https://mastodon.social/tags/Frontend" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Frontend</span></a></p>
Leanpub<p>Game Studio Starter Kit (6 Game Collection) <a href="http://leanpub.com/set/leanpub/ugsskitc" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">http://</span><span class="ellipsis">leanpub.com/set/leanpub/ugsski</span><span class="invisible">tc</span></a> by Stephen Gose is the featured Track on the Leanpub homepage! <a href="https://leanpub.com" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">leanpub.com</span><span class="invisible"></span></a> <a href="https://mastodon.social/tags/ProjectManagement" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ProjectManagement</span></a> <a href="https://mastodon.social/tags/GameDevelopment" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>GameDevelopment</span></a> <a href="https://mastodon.social/tags/Html" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Html</span></a> <a href="https://mastodon.social/tags/Javascript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Javascript</span></a> <a href="https://mastodon.social/tags/WebDevelopment" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>WebDevelopment</span></a> <a href="https://mastodon.social/tags/Education" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Education</span></a> <a href="https://mastodon.social/tags/Diy" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Diy</span></a> <a href="https://mastodon.social/tags/games" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>games</span></a> <a href="https://mastodon.social/tags/gaming" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>gaming</span></a> <a href="https://mastodon.social/tags/videogames" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>videogames</span></a> <a href="https://mastodon.social/tags/contentcreator" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>contentcreator</span></a></p>
Freexian :debian:<p>We have a new blog post on Debusine to share with you!</p><p>It's our first design story for the UI, covering our unique approach towards JavaScript. It goes into detail on how to avoid having Debian infrastructure depend on it, how to integrate interactive widgets with Django, and how to keep complexities down to make Debusine code easier to write and to maintain.</p><p>Read more about us using JavaScript in Debusine without depending on JavaScript: <a href="https://www.freexian.com/blog/debusine-and-javascript/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="ellipsis">freexian.com/blog/debusine-and</span><span class="invisible">-javascript/</span></a></p><p><a href="https://hachyderm.io/tags/Debusine" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Debusine</span></a> <a href="https://hachyderm.io/tags/Django" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Django</span></a> <a href="https://hachyderm.io/tags/JavaScript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>JavaScript</span></a> <a href="https://hachyderm.io/tags/freexian" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>freexian</span></a></p>
Pete Alex Harris🦡🕸️🌲/∞🪐∫<p>Mysterious <a href="https://mastodon.scot/tags/javascript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>javascript</span></a> question that is harder than it looks:</p><p>What does jest.mock(module_path) do?</p><p>Not what effect is intended by it. Not what is it for. What does it ACTUALLY DO? What entity at runtime or compile time is changed and in what way?</p>
Knut 🏳️‍🌈 🇳🇴🧸<p>I've dabbled in <a href="https://mstdn.social/tags/rust" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>rust</span></a> and alot of my favorite projects these days are in Rust, like <a href="https://mstdn.social/tags/niri" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>niri</span></a> I suck as an application developer. But backend stuff that nobody sees is my art. Because I'm an architect. If I need down to metal language, I use <a href="https://mstdn.social/tags/pascal" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>pascal</span></a>. For more backend-ey stuff I use <a href="https://mstdn.social/tags/python" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>python</span></a> because <a href="https://mstdn.social/tags/javascript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>javascript</span></a> sucks, but I'm LOVING <a href="https://mstdn.social/tags/lisp" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>lisp</span></a> as a pocket knife that can do everything. But all these beautiful TUI apps are in Rust. They are just beautiful. And I avoid GUI apps when possible.</p>
Michael Kohl 🇦🇹🇹🇭<p>Behind The Scenes of Bun Install</p><p><a href="https://bun.com/blog/behind-the-scenes-of-bun-install" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">bun.com/blog/behind-the-scenes</span><span class="invisible">-of-bun-install</span></a></p><p>Super interesting read, not just for people into <a href="https://chaos.social/tags/javascript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>javascript</span></a> and <a href="https://chaos.social/tags/bun" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>bun</span></a> but also anyone into optimizing systems programming tasks.</p>
Stephen<p>I love <a href="https://mastodon.social/tags/Remarkjs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Remarkjs</span></a> for creating <a href="https://mastodon.social/tags/slides" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>slides</span></a> from <a href="https://mastodon.social/tags/Markdown" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Markdown</span></a>, that is, until I noticed the library is ~650 kB. So, then I went full on <a href="https://mastodon.social/tags/FrugalComputing" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>FrugalComputing</span></a> and looked for the smallest <a href="https://mastodon.social/tags/HTML" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>HTML</span></a> <a href="https://mastodon.social/tags/presentation" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>presentation</span></a> library...</p><p>That honour, AFAICT, goes to Mark Dalgleish's modular <a href="https://mastodon.social/tags/Bespokejs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Bespokejs</span></a>. The <a href="https://mastodon.social/tags/Yeoman" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Yeoman</span></a> generator failed for me, but with a little perseverance I hand coded a demo:<br><a href="https://blog.harlow.net.nz/presentations/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">blog.harlow.net.nz/presentatio</span><span class="invisible">ns/</span></a><br>that only required 8 kB of <a href="https://mastodon.social/tags/Javascript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Javascript</span></a>. Remarkably, that's 1/80th of Remark.js!</p><p>👉 <a href="https://markdalgleish.com/projects/bespoke.js/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">markdalgleish.com/projects/bes</span><span class="invisible">poke.js/</span></a></p>
Reg Braithwaite 🍓<p>“This kind of book is not just a book: this is full of wonders and interesting territories you would like explore and spend some time it.</p><p>“You’d like to try these out, build a new toy, play with it, compare it to your well known solutions, try to break it, find its strengths and weak points.”</p><p>—pxbdgn on Reddit, 2019</p><p><a href="https://raganwald.com/assets/books/javascriptallongesix.pdf" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">raganwald.com/assets/books/jav</span><span class="invisible">ascriptallongesix.pdf</span></a></p><p><a href="https://social.bau-ha.us/tags/JavaScript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>JavaScript</span></a> <a href="https://social.bau-ha.us/tags/Allonge" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Allonge</span></a></p>
Terence Eden<p>🆕 blog! “Reasonably accurate, privacy conscious, cookieless, visitor tracking for WordPress”</p><p>I am vain. I like to know which of my blog posts have "done numbers". I get a little thrill knowing that an old post I wrote has been read by someone in a land I've never visited. I'm curious and want to know if a newsletter has…</p><p>👀 Read more: <a href="https://shkspr.mobi/blog/2025/09/reasonably-accurate-privacy-conscious-cookieless-visitor-tracking-for-wordpress/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">shkspr.mobi/blog/2025/09/reaso</span><span class="invisible">nably-accurate-privacy-conscious-cookieless-visitor-tracking-for-wordpress/</span></a><br>⸻<br><a href="https://mastodon.social/tags/HTML" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>HTML</span></a> <a href="https://mastodon.social/tags/javascript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>javascript</span></a> <a href="https://mastodon.social/tags/seo" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>seo</span></a> <a href="https://mastodon.social/tags/WordPress" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>WordPress</span></a></p>
Terence Eden’s Blog<p><strong>Reasonably accurate, privacy conscious, cookieless, visitor tracking for WordPress</strong></p><p><a href="https://shkspr.mobi/blog/2025/09/reasonably-accurate-privacy-conscious-cookieless-visitor-tracking-for-wordpress/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">shkspr.mobi/blog/2025/09/reaso</span><span class="invisible">nably-accurate-privacy-conscious-cookieless-visitor-tracking-for-wordpress/</span></a></p><p></p><p>I am vain. I like to know which of my blog posts have "done numbers". I get a little thrill knowing that an old post I wrote has been read by someone in a land I've never visited. I'm curious and want to know if a newsletter has linked to me.</p><p>At the same time, I don't want to know <em>too</em> much about people. I don't want to stalk them around the web. I refuse to care how long they spend with me. I can't be bothered setting up a foolproof system that captures 100% accurate information.</p><p>After trying several analytics plugins for WordPress, I've decided to have a go at writing my own0.</p><p>Before embarking on this, please do read "<a href="https://blog.yossarian.net/2023/12/24/You-dont-need-analytics-on-your-blog" rel="nofollow noopener" target="_blank">You Don't Need Analytics on Your Blog</a>" and the slightly more provocative "<a href="https://www.thisdaysportion.com/posts/contra-analytics/" rel="nofollow noopener" target="_blank">You do not need “analytics” for your blog because you are neither a military surveillance unit nor a commodity trading company</a>". Both give excellent examples of why this is at best foolish and at worse injurious. Proceed with caution in your heart.</p><p><strong>Background</strong></p><p>As a consequence of the way the web works, every time you click on a link the website's owner gets the following pieces of information.</p><ul><li>The time you clicked,</li><li>The page you visited,</li><li>The name of the web browser you use,</li><li>The URl of the page which you clicked to get here,</li><li>The IP address your computer has.</li></ul><p>There are a few other things sent along but they're not interesting to me.</p><p>Using that information, I can construct a reasonably accurate view of how many times a post has been viewed and how many people viewed it.</p><p><strong>Defining a page view</strong></p><p>If a web page is loaded, that counts as a view. I'm not going to track whether the user stayed for more than 30 seconds or closed their browser in disgust after reading the headline. If the page is loaded, that's a view.</p><p>But what if one person repeatedly hits refresh on the same post? To deal with that, I'll need a concept of a visitor.</p><p><strong>Defining a visitor</strong></p><p>The "normal" way of doing things is to stick a cookie in the user's browser and track them that way. I can't be bothered with that. And, besides, it doesn't account for a person reading on their laptop and then moving to their phone.</p><p>So I'm going to use a proxy by creating a cryptographic hash of the visitor's IP address and the browser's User Agent string.</p><p>Of course, a household might have one IP address and multiple people with the same phone. But, equally, one person might rove over several WiFi networks in the course of one browsing session, getting a different IP each time.</p><p>The aim is to be <em>reasonably</em> accurate.</p><p>Hashing the contents means I don't need to store the user's IP address. Once hashed, the information becomes a string like <code>db050e7b853e5856</code> which is functionally impossible to <a href="https://www.techsolvency.com/passwords/dehashing-reversing-decrypting/" rel="nofollow noopener" target="_blank">crack</a> back to an IP address &amp; UA string1.</p><p>This also means that I can redefine the concept of a page view. If the same visitor refreshed the page multiple times, it will only count as a single visit.</p><p>I'll reset the counter at midnight in my local timezone. If someone visits just before midnight and then just after, it'll count as two visits. Oh well.</p><p><strong>Where did they come from?</strong></p><p>Generally speaking, there are two ways that visitors share their referrer. One is the "referer" header (yes, it is misspelled). It contains a URl of the referring site or application. For example, if someone clicked from a search result it might say <code>https://yahoo.com</code>.</p><p>The other way is using "Urchin Tracking Module" query strings. At the end of the URl they visit, they might append something like <code>?utm_source=alices-newsletter</code>.</p><p>Some sites, like Reddit, might use multiple subdomains - <code>old.reddit.com</code> or <code>out.reddit.com</code> - so some deduplication may be necessary.</p><p><strong>Where in the world are they?</strong></p><p>A user's IP address is <em>somewhat</em> accurate method of detecting their location. Yes, users could be proxying through a VPN or using a SIM card from a foreign country. But this isn't an exercise in precise tracking. Rough and ready is fine.</p><p>There are a variety of <a href="https://mailfud.org/geoip-legacy/" rel="nofollow noopener" target="_blank">GeoIP Databases</a> which are updated semi-regularly. I'm only interested in the country of origin, I don't care about finer resolution than that.</p><p>Again, the aim isn't precise targetting. I'd just like to know that people in Sudan ever read my blog posts.</p><p><strong>What else could we use?</strong></p><p>It <em>might</em> be nice to know if someone is using a small-screen or large device. But my CSS is responsive, so I don't care.</p><p>Similarly, their Internet connection speed might be available. But, again, I try to optimise things so that isn't necessary to know.</p><p>Do I need to know if someone speaks Hungarian? No. There's nothing useful I can do with that information.</p><p>Could I extract their operating system, device, and browser from their User-Agent? I guess. Would I use the information that X% of my readers use Firefox on Linux? Doubtful!</p><p><strong>Collect the information</strong></p><p>There are two main methods of collecting these data.</p><p>First is a "no JavaScript" solution. This tells the browser to request an image which has a query string to send along the details of the page requested.</p><pre><span class=""><span> PHP</span></span><code>&lt;noscript&gt; &lt;img src=<span>"/tracking.php?ID=&lt;?php echo $postID ?&gt;"</span> alt=<span>""</span> width=1 height=1 class=hidden&gt;&lt;/noscript&gt;</code></pre><p>The downside is that there's no way to capture referer information. If each page were dynamically generated, I could grab it from PHP's <code>$_SERVER</code> superglobal. But my website is heavily cached, so that isn't possible.</p><p>It <em>is</em> possible to use JavaScript to dynamically send the information for collection:</p><pre><span class=""><span> JavaScript</span></span><code><span>let</span> formData = <span>new</span> <span>FormData</span>();formData.<span>append</span>(<span>"HTTP_REFERER"</span>, document.<span>referrer</span>);formData.<span>append</span>(<span>"ID"</span>, &lt;?php echo $postID ?&gt;);<span>fetch</span>(<span>"/tracking.php"</span>, { <span>method</span>: <span>"POST"</span>, <span>body</span>: formData,});</code></pre><p>This approach has three distinct advantages.</p><ol><li>It works whether the user has JS enabled or not.</li><li>Repeated requests for the same page will usually reload the image from cache, so won't double-count.</li><li>It doesn't count hits from bots. They typically don't execute JavaScript or don't request images.</li></ol><p><strong>Bot Detection</strong></p><p>Not all traffic originates from humans. There are lots of bots which crawl the web. Some are useful - like search engines building up a map. Others are harmful - like AI agents aggressively scraping content to plagiarise.</p><p>There are <a href="https://www.humansecurity.com/learn/blog/crawlers-list-known-bots-guide/" rel="nofollow noopener" target="_blank">lots of identifiable bots</a> out there - and more which obfuscate themselves. There are some, like <a href="https://github.com/GoogleChrome/lighthouse/pull/14384" rel="nofollow noopener" target="_blank">Lighthouse</a> which cloak themselves.</p><p>I'm not trying to eliminate everything which <em>could</em> be a bot. I am trying for <em>reasonably</em> accurate. So I eliminate any User-Agent which contains:</p><p><code>"/bot|crawl|spider|seo|lighthouse|facebookexternalhit|preview|HeadlessChrome/i"</code></p><p>There are some <a href="https://github.com/fabiomb/is_bot" rel="nofollow noopener" target="_blank">big lists of bots</a> you can use - but they don't seem to trigger my analytics because they aren't requesting the images or executing the JS.</p><p><strong>What bits of the site to measure?</strong></p><p>I only care about how many visitors my posts and pages get. I don't need to know if someone visited a tag page, or scrolled back to page 100 of posts from 2019. Those sorts of deep pages are usually only accessed by bots anyway.</p><p>I also don't want to count visits from me, myself, and I.</p><p>So the tracking is only inserted on single pages which are viewed by non-admins:</p><pre><span class=""><span> PHP</span></span><code><span>if</span> ( <span>is_singular</span>() <span class="">&amp;&amp;</span> !<span>current_user_can</span>( <span>"edit_posts"</span> ) ) { …}</code></pre><p><strong>Oddities</strong></p><p>Sometimes, the URl requested will look something like: <code>https://shkspr-mobi.translate.goog</code> - that just means Google has translated it.</p><p>Sometimes, the referer will look something like: <code>android-app://com.google.android.gm/</code> - that just means they clicked from an Android app.</p><p>Sometimes, the URl requested will include a fragment or a query string - they can be ignored.</p><p>Sometimes, the <code>utm_</code> will contain all sorts of weird stuff. It isn't always possible to pull out exactly where it has come from.</p><p>Sometimes, the referer and <code>utm_</code> will disagree. Ah well, never mind.</p><p>Sometimes, RSS views are counted and sometimes not. Perhaps I should fix that?</p><p>Sometimes, users block trackers or use a text-only browser. That's fine, they can keep their secrets.</p><p><strong>Saving the data</strong></p><p>I started this by just shoving what I collected into a CSV.</p><pre><span class=""><span> PHP</span></span><code><span>// Write the CSV.</span><span>$line</span> = [<span>date</span>(<span>"c"</span>), <span>$ID</span>, <span>$UA</span>, <span>$referer</span>, <span>$domain</span>, <span>$country</span>, <span>$user</span>];<span>// Date-based filename.</span><span>$filename</span> = <span>"log-"</span> . <span>date</span>(<span>"Y-m-d"</span>) . <span>".csv"</span>;<span>// Append mode.</span><span>$handle</span> = <span>fopen</span>( <span>$filename</span>, <span>"a"</span> );<span>fputcsv</span>( <span>$handle</span>, <span>$line</span> );<span>fclose</span>( <span>$handle</span> );</code></pre><p>Nothing fancy. Something easily grepable with the ability to query it in more detail if I need. At the number of hits that my site gets, it is less than 1MB per day.</p><p>I've since moved it into a single MySQL table. That might not be sustainable with hundreds of thousands of rows. But that's tomorrow's problem.</p><p><strong>Accuracy</strong></p><p>I've been running this for a couple of days - simultaneously with my other, more professional, stats plugin. It is within 5% accuracy. It appears to <em>slightly</em> exaggerate the number of visitors and undercount my page-views. That's good enough for my purposes and probably good for my ego!</p><p><strong>Putting it all together</strong></p><p>You can take a look at all the code <a href="https://gitlab.com/edent/blog-theme/" rel="nofollow noopener" target="_blank">on my GitLab repo</a>.</p><p><strong>What does it look like?</strong></p><p>If you've made it this far, you can have a little pictorial treat! Aren't you lucky?</p><p></p><p><strong>What's next?</strong></p><p>For now, a simple table structure is fine. I've shoved it in a basic database. Sure, I don't have any indexes or fancy stuff like that. But modern computers are pretty fast.</p><p>Eventually I'll need to create some new tables which will consolidate the data. Perhaps a table for individual posts, using date and country? Or maybe referer? I'll have to see.</p><p>I also need a way to get historic data into it. I've blog stats going back to 2009 which I am anxious not to lose.</p><p>And, yeah, I'll need a better front-end than manually running SQL queries.</p><p>Above all, I want to keep it simple enough that my puny mortal brain can understand it after several years of not touching anything. I want to build something which can run without constant maintenance.</p><p>Remember, this is only an exercise in self-learning, self-hosting, and self-respect.</p> <ol start="0"><li><p>I enjoy learning. If you're about to say "Why not just install…" then you've missed the point. I like understanding how things work, I get joy from discovering some new function, my brain feels happy when it is working on a problem. I don't want to just click install, hit next a few times, and fiddle with a few options. <a href="https://shkspr.mobi/blog/2020/12/build-dont-buy/" rel="nofollow noopener" target="_blank">I've written more about my philosophy here</a>.&nbsp;↩︎</p></li><li><p>Or is it? There are 4 billion IPv4 addresses - although slightly fewer in actual use. Creating a rainbow table with 4 billion rows is possible if I was <em>just</em> using IP addresses. But there are an almost infinite variety of User Agent strings. It is probably possible to create a rainbow table of, for example, the 10 most popular UAs, concatenate them with every possible IP address, and then see which hashes to <code>65fef01fef257963</code>. But even then, what would that get an attacker? Knowing that the most popular model of iPhone is on a mobile network's IP range isn't exactly private information.&nbsp;↩︎</p></li></ol> <p></p><p><a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://shkspr.mobi/blog/tag/html/" target="_blank">#HTML</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://shkspr.mobi/blog/tag/javascript/" target="_blank">#javascript</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://shkspr.mobi/blog/tag/seo/" target="_blank">#seo</a> <a rel="nofollow noopener" class="hashtag u-tag u-category" href="https://shkspr.mobi/blog/tag/wordpress/" target="_blank">#WordPress</a></p>
Dan 🌻<p>been doing some cad</p><p>3d printing is fun!!</p><p>look at this cool little guy!!</p><p>(i've been using <a href="https://jscad.app" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">jscad.app</span><span class="invisible"></span></a>, it's been really nice overall)</p><p><a href="https://mastodon.social/tags/cad" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>cad</span></a> <a href="https://mastodon.social/tags/3dprinting" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>3dprinting</span></a> <a href="https://mastodon.social/tags/javascript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>javascript</span></a></p>
PrivacyDigest<p>18 Popular Code Packages <a href="https://mas.to/tags/Hacked" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Hacked</span></a>, Rigged to Steal <a href="https://mas.to/tags/Crypto" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Crypto</span></a></p><p>At least 18 popular <a href="https://mas.to/tags/JavaScript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>JavaScript</span></a> code packages that are collectively downloaded more than two billion times each week were briefly <a href="https://mas.to/tags/compromised" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>compromised</span></a> with <a href="https://mas.to/tags/malicious" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>malicious</span></a> software today, after a developer involved in maintaining the projects was <a href="https://mas.to/tags/phished" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>phished</span></a>. The <a href="https://mas.to/tags/attack" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>attack</span></a> appears to have been quickly contained and was narrowly focused on stealing <a href="https://mas.to/tags/cryptocurrency" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>cryptocurrency</span></a>. <br><a href="https://mas.to/tags/security" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>security</span></a></p><p><a href="https://krebsonsecurity.com/2025/09/18-popular-code-packages-hacked-rigged-to-steal-crypto/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">krebsonsecurity.com/2025/09/18</span><span class="invisible">-popular-code-packages-hacked-rigged-to-steal-crypto/</span></a></p>
Jobs for Developers<p>Aircall is hiring Senior Software Engineer - Bellevue</p><p>🔧 <a href="https://mastodon.world/tags/javascript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>javascript</span></a> <a href="https://mastodon.world/tags/python" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>python</span></a> <a href="https://mastodon.world/tags/ruby" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ruby</span></a> <a href="https://mastodon.world/tags/typescript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>typescript</span></a> <a href="https://mastodon.world/tags/aws" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>aws</span></a> <a href="https://mastodon.world/tags/azure" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>azure</span></a> <a href="https://mastodon.world/tags/gcp" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>gcp</span></a> <a href="https://mastodon.world/tags/seniorengineer" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>seniorengineer</span></a><br>🌎 Seattle, Washington<br>⏰ Full-time<br>🏢 Aircall</p><p>Job details <a href="https://jobsfordevelopers.com/jobs/senior-software-engineer-bellevue-at-aircall-io-jan-23-2025-bd6339?utm_source=mastodon.world&amp;utm_medium=social&amp;utm_campaign=posting" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">jobsfordevelopers.com/jobs/sen</span><span class="invisible">ior-software-engineer-bellevue-at-aircall-io-jan-23-2025-bd6339?utm_source=mastodon.world&amp;utm_medium=social&amp;utm_campaign=posting</span></a><br><a href="https://mastodon.world/tags/jobalert" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>jobalert</span></a> <a href="https://mastodon.world/tags/jobsearch" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>jobsearch</span></a> <a href="https://mastodon.world/tags/hiring" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>hiring</span></a></p>
benbrown's bookmarks<p><strong><a href="https://github.com/kripken/ammo.js/?tab=readme-ov-file" rel="nofollow noopener" target="_blank">kripken/ammo.js: Direct port of the Bullet physics engine to JavaScript using Emscripten</a></strong><br>Very sophisticated physics engine</p><p><a href="https://bookmarks.benbrown.com/tagged/javascript" class="mention hashtag" rel="nofollow noopener" target="_blank">#javascript</a></p>
Marquis de Geek<p>Here's a little <a href="https://ohai.social/tags/game" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>game</span></a> from my 20 years in <a href="https://ohai.social/tags/JavaScript" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>JavaScript</span></a> <a href="https://ohai.social/tags/development" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>development</span></a>: A <a href="https://ohai.social/tags/retro" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>retro</span></a> <a href="https://ohai.social/tags/remake" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>remake</span></a> of Stone Raider II, from the <a href="https://ohai.social/tags/Dragon32" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Dragon32</span></a> (a game which, itself, was a<br>remake) <a href="https://www.marquisdegeek.com/stoneraider2" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="">marquisdegeek.com/stoneraider2</span><span class="invisible"></span></a> <a href="https://ohai.social/tags/html5" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>html5</span></a> <a href="https://ohai.social/tags/canvas" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>canvas</span></a> <a href="https://ohai.social/tags/game" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>game</span></a><br><a href="https://ohai.social/tags/quickhacks" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>quickhacks</span></a> <a href="https://ohai.social/tags/retro" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>retro</span></a></p>