what does "highly granular" mean? hibefisfkdk
bepiis bappas
nebbllbly
burbess
Note - Juked by a Chicken
I swear, I almost had a stroke putting the chicken away today.
I have had way too little sleep, way too little to eat, and stretched myself out way too thin to function.
Almost twice in the past 48 hours, I nearly fainted from standing up too fast.
I remember feeling the onset of faintness, bracing myself against a wall or preparing to fall safely in case I couldn't control my landing.
So when I say I thought I almost died chasing this chicken, I mean it.
Chasing chickens is an art.
You have to juke the chickens.
They'll run circles around tables or go under things you can't go under.
They'll run under chairs or through bushes, under fences, between your legs. All you can do is limit their escape routes until you're close enough to gently grab them without hurting them.
It's a mindless game of chess.
Like chess, the first two moves decide the winner.
Like chess, the rules have no meaning.
Like chess, it can take you 30 seconds, or it could take you an hour.
But a chicken plays chess like a hedge fund manager plays the stock market: mindless gambles with zero calculation.
Their brains have the exact required caloric intake to function at any level.
They are min-max machines of stupidity and survival.
Yesterday, she made no fuss coming inside, but today I could tell it was going to be a struggle. We began with the customary dance of slowly strafing around each other, assessing the layout of the battlefield.
This was the cease-fire.
After a few laps around the patio table, I realized this was going to be difficult.
You grow slower as the hunt drags on. There was no time to waste.
I began to increase my pace, hone my agility, and juke the chicken.
I had juked her into a corner: between two plant cages and a reclining patio chair. I was straddling the chair, slowly moving my hands to guard the left and right exit opportunities she had.
To catch a chicken, you have to think like a chicken.
And the only way to think like a chicken is to not think at all.
I rendered my mind a blank slate, regressed to my most basal nature.
I approached carefully, mindful she could make the bolt at any second, and I wouldn't be able to counter because I was wrapping my arms and legs around this chair.
I'm closing in, and I get to the point where I know I'm in range.
She usually surrenders once she knows you're in range. I relax my guard. The hunt is complete.
But suddenly, I could sense she was not going to freeze.
In her eyes, I witnessed the very incarnation of the words fight or flight. I saw the gunpowder spark of the starter pistol itself.
The world came to slow motion. Space collapsed around us, and we became alone together, locked in this singular moment in time for eternities.
I could see her mind executing quantum-speed processing: solving the single-source shortest path exit, solving the traveling salesmen problem while she was at it.
I saw her navigate the maze of the bars of the patio chair, my arms, and the plant cages like she was Neo from the Matrix. It was like watching water flow through river rocks, like wind through trees.
She bolted underneath the patio chair and forced me to nearly about-face to try and meet her.
As soon as I lurched up, a sharp shock was sent to my nervous system. My vision blacked out for a moment. Those shapes and colors you see when you're rubbing your eyes too much appeared, those strange wavy patterns and avant-garde paintings that flash in your mind when you do. Then, I felt a sharpness, like needles punching through all the veins in my forearms and neck.
A pain so intense it made me contemplate the pain of death.
And that was my thought:
"This is the end."
"This is how I will die."
"Out juked by a chicken."
There's a lot more required to actually get our search service to use these values and sort the results in the order provided.
I won't go over all of it, but I do want to tie everything together.
From the onset, our goal was to take what's in the url bar:
And get it into our search feature so we can filter and sort on the values.
First, I will show you the code that generates the sort function our search feature will use:
It's nice we wrote all those re-usable helper functions! That made the logic for these components much simpler.
And here is where we put it (mostly, finally) all together:
Now we can pass our filters
and transformResults
to our search feature and it will only return
pages that match the ids we specified and in
the same order as we specified them.
That's a lot of work just to enable creating ordered lists just via url params, isn't it!
I think it's worth it though. I enjoyed the process and I have a neat little tool I can leverage as I experiment building the website and its pages. A better solution may present itself, but for now, this is an idiomatic and intuitive way to create saved lists without requiring any data being saved to a server. This is excellent for my usecase: ad-hoc arrangements of data accessible by URL.
It's possible I'll never use this feature again. However, if it's useful, it may become central to how the application and pages work and the concept may be extended to enable writing even more powerful queries--just with URL query params. 😉
This method is certainly with its limitations. Browsers are only required to support 2048 characters in a URL, so your lists cap out at a certain length. Additionally, even modest page chains generate a large URL that is not entirely savory to look at. Eventually, I will need to allow users to create custom filters that are saved to the database. But for simpler use cases, I think it does the trick.
Thank you for tuning in and stay copacetic.
- Pat
To unfurl or provide previews of text content, you can include metadata in your HTML or webpage. Here are some commonly used metadata elements that can help with unfurling and previews:
<meta property="og:title" content="Page Title">
: Specifies the title of the page for social media sharing and previews.
<meta property="og:description" content="Page Description">
: Provides a short description or summary of the page's content for social media sharing and previews.
<meta property="og:image" content="image_url">
: Specifies an image URL representing the page content for social media sharing and previews.
<meta name="description" content="Page Description">
: Provides a brief description or summary of the page's content for search engine previews.
<meta name="keywords" content="keyword1, keyword2, keyword3">
: Lists relevant keywords related to the page's content for search engine previews.
<meta name="author" content="Author Name">
: Specifies the author's name for search engine previews and metadata.
These metadata elements are part of Open Graph protocol (og) and are widely supported by social media platforms and search engines. Including these metadata elements in your HTML can enhance the unfurling and preview experience when sharing your content on various platforms.
Additionally, make sure to set appropriate <title>
and <body>
tags to further improve the unfurling and preview experience.
Remember that different platforms and services may have specific requirements for unfurling and previews. You can refer to their documentation for more details on the metadata elements they support and the requirements for effective unfurling and previews.
It's worth noting that unfurling and previews are ultimately dependent on how the platform or application processing the shared URL consumes and displays the metadata provided.
I wrote some code that allows you to send a message like this to the chat bot:
And it will apply those updates to the targeted node.
In this case, we're adding the special-group
and public
group to the viewers of the node
if they are not already added.
In order to make this work, I wanted to extend a javascript library called immutability-helper
If you're familiar with React, then you know why an immutability helper would be useful.
If you aren't, you can read about why
immutability-helper
is useful using the
link I provided above.
Now, in order to use this libary, you do something like this:
However, I'm not a big fan of all those curly braces.
I thought it would be neat to be able to define these change sets using YAML.
Additionally, I wanted to be able to pass complex functions that take arguments and then apply those changes to the field.
Immutability helper supports custom functions, but it does not support custom functions which take arguments. Custom functions only support functions which take the current value of the field you are updating.
In order to enable the behavior I wanted, I had to to write some helper functions that take the arguments defined in your YAML change set and curry them.
What folows is my solution.
For the benefit of the reader, I included verbose comments.
If you don't understand how this code works, that's ok. Neither do I. And I wrote it 3 days ago.
No coding article would be complete without tests, which you can see here, if you're interested: tests. The tests are worth checking out to at least see how I used the factory functions to create the appropiate mocked functions to enable testing.
Today I will be describing how to build a simple,
performant React hook for tracking the window size
as the user resizes a window. This approach uses
requestAnimationFrame
which places less
burden on your UI thread because it is only
called when the UI needs to be redrawn, instead of
on every resize event.
Here is an example using React hooks and requestAnimationFrame
. This also uses pure js without any libraries like lodash,
Here is a gist showing it in use: Img.tsx with useResize. Alternatively, you can see it in my repo here for more context.
Some resources on why you should do this instead of debouncing your function:
Thank you for coming to my Ted Talk.
fiction
dystopian novel idea / short story / fiction
centered around The Company
and a man who works for them who begins to feel that he no longer has a choice that he works for them
// maybe he is a high ranking person, or simply a very technically prolific or mission critical component. being used to an extent greater than which he knows
the company had become so entrenched in society
they had vans everywhere. vans that could bring you things. vans that could take you away.
they knew where you lived
when you're not home
where you are
what you like
you've given them a complete profile on everything they need to do to manipulate, control and coerce you.
the concept of not being able to quit work never occurred to you because it had never occurred to you to quit
they had crafted the perfect little programmed worker
not working wasn't in his code
it's astounding to consider how little we think of freely giving all of our data to a private entity
no true warranties can be made about the protection and use of that data
even the data in your "cloud" has security limitations. systems can only become more secure, never "secure". The only secured data is data that does not exist.
this all is provided the entity with whom you trust your data with is actually trustworthy and not malicious. it assumes that they are competently executing their strict privacy policies in practice. if they aren't, what mechanisms of accountability are in place? And do those mechanisms actually work?
If the answer is the government, what happens when The Company is the government?
he noticed the changes slightly at first
then suddenly, the changes grew more constant and severe
when he couldnt cash a check
when the banks all had trouble with their payment systems
when they disconnected his phone service
when they interfered in any way possible in his attempts to exit their grid.
to keep him in such a desperate position
that his only alternative was doing the exact job The Company had prescribed
or be stripped of all possessions
and even then, if he tried to run
he would be captured
and if he refused to work
he would be starved
and if he refused to live
he would be tortured
kept alive artificially
intubated with feeders down his throat. fitted with catheters and waste trays
made so miserable to exist that he only truly had one option
and then
they reward him
not only do they lift the shackles
but they restore his possessions
no longer programmed by ignorance--
programmed by fear
Summary: React code sample of a rapidly prototyped feature rich tooltip toast.
This is a very long read. Be warned. I've changed my mind, take me back.
There is a document somwhere where I detailed how to build this step by step and the motivation behind each design decision. Until I find that document, please use the comments to navigate this article.
In this article I will show you how I built a click to copy button. It has the following features:
useEffect
s,
setTimeout
s, and addEventListener
to achieve these effectsExample usage:
Thank you for coming to my TED talk.
tags: react
I want to be able to tap to select visual elements. Double tapping could bring up their context menu.
Note, c= or cursor, or focus, will be tracked internally via cookies or remote server and then when a user is about to unmount the page it quickly pushes the route so a back button will return them to their last location.
See https://stackoverflow.com/questions/11896160/any-way-to-identify-browser-tab-in-javascript
a short story by patrick michaelsen
whenever you do a line of coke, it makes sense to smoke a little weed to take the edge off
of course, weed makes you paranoid, so you should take a glass of whiskey to dull the senses
a bit of coffee to pick you up and relax you. don't want to blow through all the coke in one sitting. spread it out. ride the waves of energy. conceal the lows with other substances
a perfected process
i spent all day doing coke and coffee and none of it actually working
so much for productivity. i wasn't productive, but on the bright side, i felt i was on the constant verge of it the entire time
a knock at the door
"hello???" he bellows without leaving his desk
"hi" a faint voice on the other side
he approaches the door and opens it
on the other side of the security screen stands a small young man holding a clipboard next to his chest
in his open bathrobe and yellow-tinted sunglasses, the man gives his visitor an empty stare
"hello sir--"
"what do you want?"
"well, sir--"
"do you need me to sign anything? what's your pitch?"
"well we're just going around the neighborhood--"
"are you a solicitor? get lost. i'm busy"
he walks back from his door, towards his post. his writing station
the young man, a lost cause pitched against a lost cause, keeps on with the smarmery
what is it that you do?
i'm a writer
what do you write?
he approaches rapidly
what do you do?
... what do i?... do?
yeah, outside of work.
passions, hobbies?
school
what do you study?
accounting
well, everyone's passionate about something
the poet walks away as the salesman continues his pitch
"can't you see i'm busy?" he barks
halfway back to his post, he abouts face. he faces the man still silhouetted in his security screen door
"hey! you're trespassing!"
"sir i just--"
"i want you off my property!" he raises a finger and steps forward
they stand about 30' away from each other but it's close enough
this was just a bit too unhinged for the young man
this was not worth $12.50/hr
// the line above is narrated, not spoken
the salesman turns away from the security door and heads across the porch
"$12.50 an hour? is that what they make these days?" says the writer to himself, out loud
he watches through the blinds as the man walks down the driveway
he enters a nondescript van
(beat)
"cia?" he asks himself
he clambers back to his computer
on his machine, he types:
the cia knock at his door
he stops. he types again
"this is it. this is the moment" he thinks
he pauses again. he gets up. we hear the toilet flush. he returns to his post.
he gets up again
"this establishes the uncertain and startling nature of this characters life and mentality. he is on constant alert. his mind must fire on all cylinders. he must embrace his madness. but soon, madness follows him"
"good, that's good"
he weaves back to his desk. his legs bent too low, his arms splicing the air like a... like a... jagged desert tree..
// or plant, or palo verde, or lightning bolt of energy, or
his hands spiral and his fingers twirl
he arrives at his destination
"you're editing", he tells himself "don't edit"
// or maybe he doesn't
he types
of course, it wasn't the cia that came, it was simply a man selling solar
another knock
he checks his phone security camera
its ok, he's expecting him
"hello" he says, with a reverent sheepishness yet resolute in his message. "hello" he said. it was firm, respectable, but not aggressive. they were equals. but he knew he had one leg to stand on, and josh had two.
he had to show submission, show his regret. but dominant, affirmed in his actions.
CUT TO
INT. TABLE - DAY
// a tea kettle is boiling in the background. the writer prepares a french press. he pours coffee beans into the grinder. grinds them. fills the press with grounds. walks over with two empty cups. he places one in front of josh, and sits down
the two sit across from each other
the writer starts
"how are you doing?"
well and yourself
keeping busy, as you know. i wish we could have met under better circumstances
yeah, yeah, but it is what is is
we see the men rummaging around in a back house
well, we can't see them, only hear them and the clamoring of furniture and objects
// envision a scene from a wes anderson film. fantastic mr. fox meets fear and loathing in las vegas
the trunk of a car is slammed shut
two hands shake
"thank you"
"hey, no worries, i just want to keep the peace"
"i wish it were under better circumstances"
"right. sure."
the car drives away. the writer is left standing in the middle of street, watching him drive away.
the writer is at his post
the car drives away,
he typed
suddenly, a knock
this time. there's no one there.
not that he can see.
he sits down
he types
the writer is left standing...
he pauses. he looks from one side to another, without moving his head. right to left. he enters stealth mode. he enters high alert. his senses were primed.
someone. was in the house.
ACT II
the thing about searching a house for a person is
there's a lot more places for a person to hide than you realize
and you have to search it fast because they could move from room to room
that means if you're searching your own home, by yourself
you have to check under every bed, in every closet, in every row of coats in your closet (because just a quick glance won't do, one has to be scrupulous), every sofa, every corner behind the door, every shower curtain, the garage, the cupboards, hell, even the ceiling.
in a matter of minutes!
they could be in the hvac closet. they could be here to kill you, right now!
simply open this door and bam!
they're not behind this door, but perhaps the one by the water heater?
there's a moment where you realize you have enough enemies
to ever leave the door unlocked
you're relaxing in the evening
time to unwind with a nice bath
you slip into the tub
hot water streaming down from above
when suddenly you remember
you didn't lock the front door
that would be fine. except this was a day your enemy's had already paid you a visit. had an opportunity to scope you out. play it nice. play it "no hard feelings"
and then you receive ominously threatening messages afterwards
of all the days, this would be the day to play it safe
but then again, this had become so normal to you, that you might as well leave it open
and see how it plays out
they might be here to beat you
it doesn't worry you
until you remember leon
suddenly you leap up
no fucking way am i letting that happen
half naked in a towel waist wrap, you slowly get up and wait patiently for sounds outside the bathroom door
hearing nothing of suspicion, you grab your glasses from the counter
you don't put them on yet; too much steam
you brace yourself to arm them the moment you open the door and the fog dissipates
not a moment in the battle of war could be without sight
you can't leave a door unlocked when you have as many enemies as i have
you take a shower but you can hardly enjoy it
you re-enter the bathroom
content, more or less, you had fulfilled your obligated effort required to absolve yourself from regret, you sleek gently back into your shower
safe, at last
you realize, you didn't lock the door
but you're being paranoid
// the watch on the counter shows 2:31am
not narrated: suddenly someone bust through the door with a bat and the character wakes up. he had fell asleep in the bath.
i don't ever lose sleep on the things i did to other people
but i lose sleep over what they might do back
you can't leave a door unlocked when you have as many enemies as i have
ACT III
"that's good" he nods
as we see on his screen the words that were just narrated.
// he begins typing the final monologue, as we hear it narrated to us. actions below will be seen simultaneously
CUT TO
INT. BATHROOM - NIGHT
a hand turns on a bathtub spout
he undresses
he throws his watch onto the counter
2:05am
as the bath draws, he prepares a few lines
just a night-cap
if you don't manage your drug habit effectively, it can go unmanaged for a long time
an unmanaged drub habit becomes unmanageable
an unmanageable drug habit only ends one way
// we see him getting ready for bed. but we also see him typing. the two moments unfold, interleaved, as he writes the following monologue:
it's almost like we choose our own destiny
he dons a robe. the bath water is still drawing. we see him cleaning up, putting away the untouched coffee cups. dumping the unused boiled water. he continues chores until he prepares a bath. even better, he should finish making the coffee but never actually serve it. that way we can have a long awkward silence as he prepares the coffee
// these moments are interleaved this with moments from earlier in the story
we write our own story
not necessarily the characters
but the outcome, we do write
certainly, the outcome is one of your design
one of your machinations
the fate you chose.
your pen is your actions
your story is yours
what are you writing?
what ending will you choose?
and if you had to pick one book
only one book to read
for the rest of your life
would you pick the one you wrote?
or someone else's
he throws his watch on the counter
2:30 am
he drops his towel. he places one leg into the bath
// typing:
the fourth wall is when the fiction acknowledges it was written
he slips into the bath.
the fifth wall is when the fiction acknowledges it was written by you
and closes his eyes.
the sixth wall is acknowledging you are the fiction
and breaths out
KNOCK KNOCK KNOCK
CUT FROM BLACK
he wakes up. his eyes move right to left. high alert. slow motion.
the seventh
the water moves slowly.
the sound of the water is slowed
we can hear his breathing.
is meeting your writer
we see him type:
CUT TO BLACK.
domains:
tags: rixfeed dev log