Pollster is an incredibly minimal async executor for Rust that lets you block a thread until a future completes.
Whenever I learn something new or interesting that I'd like to share, this is where I post it I guess along with a few other social media sites. Not everything may interesting you, so feel free to filter it down using tags!
- clearTimeout and clearInterval are functionallly identical #
I used clearTimeout instead of clearInterval to clear a timeout and it worked.
Found a stackoverflow question: https://stackoverflow.com/q/9913719/1443630
- Vite dev server will auto-increment it's port but not for it's HMR #
Continuous socket.io connections quickly filled up the limit of 6 requests in my Firefox causing other requests to not get resolved either.
This is at least the case in Vite 7 I suppose. Could also be related to the particulars of my config. I will check later and see if I can reproduce this in a super small project.
The fix: just set the port again in the server section in your vite config. I suppose
strictPortonly would make sense here, then?This is related to this TIL: Firefox won’t tell you why it’s stalling your request
- Firefox won't tell you why it's stalling your request #
…or at least I did not find anything obvious that indicated the reason my requests were stalled was because there’s apparently a limit of 6 connections per domain it seems. More in another TIL.
also you can see the number of active connections at
about:networkingin Firefoxfound this on stackoverflow: https://stackoverflow.com/a/985704/1443630
- you can remove all event listeners on a webpage #
use
document.open- it will also clear all the nodes in your document though
If you want to remove event listeners for a specific element or a set of elements - just clone them and replace the real ones with their clones.
- hardwrap in vim with gqip #
Set the textwidth option first, e.g.
:set textwidth=77Then
gqwill reformat the lines you want.For example,
- select a block of text ->
gq - you’re in a paragraph and want to reformat the whole paragraph ->
gpip - reformat the next 10 lines ->
gq10j
Here’s how I configure this in my
.editorconfigto set a textwidth in markdown files:[*.md]max_line_length = 77 - select a block of text ->
- CSS clamp() function #
CSS has a clamp function that takes a min value, “preferred” value and a max value.
If the preferred value is between min and max, then the preferred value is returned, otherwise the output is clamped based on min and max.
I used this recently on the astro rewrite of this blog while setting margin for my “See all posts” CTA so that it’s dependent on viewport size such that it never goes out of the viewport and smoothly goes inside the viewport as we resize.
margin-right: clamp(-25.5px,calc((900px - 100vw) / 2 - 10px),0px);Ref: clamp() - CSS | MDN
- vim "+norm Go" "+startinsert" $filename #
Use the command
vim "+norm Go" "+startinsert" $filenameto automatically move at the end of the file and start editing.
This is useful when you are invoking vim from another script i.e. when you don’t want this to be the default behaviour but want it in a special case.
For me this was useful for my
journalscript which appends the current time at the end of a file and opens the file and (now) automatically moves to the end and goes to insert mode. - We can run queries across a range in google sheets #
Query Language Reference (Version 0.7) | Charts | Google for Developers
QUERY function - Google Docs Editors Help
Google Sheets supports a QUERY function using which we can run queries on a range of data.
The Google Visualization API Query Language has a SQL-like syntax and exposes a variety of functions to work on the selected range.
For example,
The following query groups by date summing the values in column B. The query runs on the rangeA:B=QUERY(A:B, "SELECT todate(A), SUM(B) GROUP BY todate(A)")
"Nobody exists on purpose. Nobody belongs anywhere. Everybody's gonna die. Come watch TV."
— Morty (Rick and Morty)