cho.sh
2,247 notes
Liked on X🔥 ANNOUNCING WORLD’S BEST GITHUB ACTION RUNNERS 🔥 🤑 vs GitHub: 90% cheaper and 2.5x faster 🤑 vs Blacksmith: 70% cheaper and 1.25x faster 🤑 vs Depot: 73% cheaper and 1.4x faster 🤑 vs RunsOn: 1.65x faster at same or lower cost 🔒 Runs in your AWS in firecracker VMs on ephemeral EC2 spot and on-demand 🏢 Powered by Ravion’s enterprise grade pipeline control plane 💼 You can trust us, we’ve been doing BYOC since 2021 with SOC 2 Type II and BAAs Unique features: 🏇 Auto sizing for cpu, memory, disk. Never think about CI specs again. 🏎️ Performance profile slider to choose lower cost or higher performance ♻️ Live job moves between hosts to save cost and avoid spot interruptions 🪠 Can use Ravion CI directly to avoid GH actions entirely 📈 We've already passed 1 million CI minutes on our runners ⏳ LIMITED-TIME LAUNCH BONUS: start running jobs on Ravion runners by end of day Nov 30 (Pacific) and get 100,000 free pipeline minutes (good for 6 months), applied automatically. 👉 Details and docs: https://t.co/kN42KDJKGk * speed/cost comparisons are typical. May be higher or lower depending on your workload and perf profile settingReplied on X@suraj_sharma14 @Cloudflare how does it feel to be 9 months lateLiked on XThe least realistic thing about GTA VI is that Jason and Lucia run a whole criminal operation without a single Telegram group.Liked on XGranola, a $1.5B company on how they grew new users from AI search by 4,600% in JUST 7 months https://t.co/5ZXoT203KELiked on X@_kiyosh1 Try this link https://t.co/dN91C0yeJB it should look like this https://t.co/B1m8b5TPCuReplied on X@Docker @MohammadAliEN huge mistakeLiked on XI deleted my second brain. I deleted all my notes. All of them. My entire Obsidian vault. My carefully curated, atomic, Zettelkasten notes. My concept maps and interconnected ideas. My quotes, lists, and synced Apple Notes going back to 2015. All my second brains for all my iterations of productivity systems that I followed, then abandoned, then modified, then followed again. All of it, deleted within seconds. And I felt wonderfully relieved. In fact, the silence was…something of a relief. For years, I obsessively kept a series of second brains. I thought if I could just collect and organize all of my thoughts and ideas and information in one place, it’d help me remember things better, think faster, be more creative, learn quicker, be more organized, be more clear, have more control, gain some kind of leverage over… my life? the universe? reality itself? Instead, my second brain became this massive collection of all my different selves. All my different projects and goals and systems and interests and habits and addictions and compulsions, stacked on top of each other like geological layers. A mausoleum. And instead of helping me remember better and think faster, my second brain became a way of not thinking at all. Outsourcing my thinking to a system of interconnected notes I could search and sort through, instead of letting my thoughts roam and surprise and delight and challenge me. My second brain was a collection of categories instead of curiosity. And so… I nuked the whole thing. I’m six years sober. Milestones like that split your life into two distinct halves: the half before and the half after. And they demand that you reflect. A few weeks ago, I started reflecting on my sobriety. I went through old notes to see how far I’d come. Old notes about goals I used to have, ways I used to think, and systems I used to swear by. Layer upon layer of systems, goals, ideas, and promises to future iterations of myself. And the more I read, the tighter my chest got. The sadder I got. I could tell, reading my old notes, how hard I tried back then. How desperately I tried to hack together some system, process, idea, or goal that would get me through. And what got me through the first year of sobriety, the second year, the third year, wasn’t any of that. And what got me through the first, second, and third year of sobriety probably won’t get me through the next iteration. The hubris of total capture Somewhere along the way, note-taking and information management morphed into personal knowledge management. Systems thinking and Niklas Luhmann’s Zettelkasten method got sucked into the black hole that is Silicon Valley. Roam Research fetishized bidirectionally linked notes and Obsidian de-institutionalized them. And the cult grew. All of these systems promise clarity. Coherence. Control. But instead they gave me abstraction. Distance. Confusion. The more notes I took, the less connected I felt to my ideas. I’d hear or read something interesting, jot it down, and forget about it. Or I’d see a great quote, screenshot it, add a few tags, and call it a day. The point being captured. Filed. Forgotten. Everything I noted down was vacuum-sealed and saved for later. Except I never opened the package and ate the food. I started reading to take notes instead of for pleasure or understanding. Listening to conversations with a meta-layer of figuring out what I could file away later. Everything became content to be processed instead of experienced. In Borges’ story “The Library of Babel,” an infinite universe is also an infinite library containing every possible combination of letters. There are infinite shelves, containing infinite books. Some of those books contain meaning and wisdom. Others are nothing but random collections of letters. The librarians tasked with cataloging this infinite library go mad trying to find order and meaning within the Library. Borges’ librarians are doomed to search for meaning within the Library for eternity, never able to escape, and slowly descend into nihilism and madness. That’s what happened to me. Except instead of descending into madness, I just got distracted. A flawed metaphor The problem is, brains aren’t computers. We don’t store information in folders or retrieve it via backlinks. Our brains are messy, associative, embodied, contextual, and emotional. We forget stuff on purpose. Our minds are constantly improvising. According to Merlin Donald’s theory of the evolution of cognition, what makes humans unique is our use of external symbols (language, drawing, gesture, etc.) to manipulate, modify, and communicate our thoughts. By using these external symbols, we were able to step outside our thoughts, modify them, and then communicate them to other humans. This externalization of thought meant that for the first time in the history of life on Earth, information could be stored outside of an organism’s genome. By attempting to capture all of my thoughts, I externalized my thinking. I thought if I wrote things down and connected the notes together, I’d gain some kind of leverage over my mental processes. But instead of thinking about my notes later, I just… noted them down. Externalized them. Moved on. Structure is not thinking. Tags are not insights. Notes you never read again aren’t really notes at all. Tools are perfect. Humans aren’t. Obsidian is a great piece of software. I love the app dearly. But without boundaries, any tool can become its own trap. I wanted to remember stuff. Then I thought maybe I wanted to integrate what I remembered. But what I really ended up doing was deferring my thinking to a future version of myself who would make sense of it all. A future version of myself who never showed up. Markdown files in a directory structure. Productivity metrics via plugins. The god-complex of standing zoomed all the way out in graph view. Everything connected. An illusion of omniscience. Except constellations don’t mean anything. They’re just patterns humans project onto the infinite canvas of space. Stories we tell ourselves. There’s a guilt that comes with not having read a book, blog post, or article you meant to read. But there’s another guilt that comes with having a list of things you meant to read you haven’t gotten around to reading yet. My ever-growing reading list became a monument to who I could be if I only read all those things I saved. Deleting it cost me nothing. Well, it cost me 7,000 notes. Hundreds of highlights and links to books, articles, and essays I “should” read someday. And I’m okay with that — because I know who I am. I know what grabs my attention and what doesn’t. I don’t need to keep track of everything interesting-sounding I come across in order to validate my own intelligence or curiosity. Hoarding digital cruft isn’t the same as understanding it. Saving things doesn’t mean you’ve internalized them. Remembering facts doesn’t mean you know how to apply them. There’s no such thing as being caught up. No finish line for reading, learning, or knowledge. Except in your own imagination. What Michelangelo, Leonardo Da Vinci, and Nietzsche understood about creation, we fail to apply to curation. To make something great, you have to remove everything that doesn’t belong. You have to understand what’s essential and throw away everything else. Instead of deleting notes, saved articles, or half-finished sketches, we keep them all. We think keeping everything is a good thing. That somehow our collections reflect our intelligence, hard work, or taste. What if we applied the same ethos of creation to curation? Instead of adding more and more, what if we deleted ruthlessly? Zakhor is a Hebrew word that means both “remember” and “remember!”- both the act of remembering and an imperative to remember. For the ancient Israelites, remembering wasn’t just recalling the past; it was an ethical obligation to call the past into the present. This is the difference between PKM and zakhor. One is a system for capturing information. The other is an act of devotion. I don’t want to capture everything. I don’t want a mind-palace or second brain. I want to be able to forget stuff. I want to remember stuff because it’s important, not because I have an elaborate system of levers and pulleys to remind me it’s important. I want to be able to start over from scratch again and again. I’ve started writing in Obsidian again. Starting from scratch. But this time, instead of trying to capture everything, I’m practicing curation. Instead of trying to remember everything, I’m practicing zakhor. Instead of trying to build a second brain, I’m trying to get better at using the one I’ve got. It’s liberating. And scary. And exciting.Posted on XCapy is like T3 but actually polishedReplied on X@capydotai yo pleaseLiked on XI don't normally agree with random Redditors, but damn. Well said. https://t.co/kotGapR9zYLiked on Xthe OpenRouter situation for anyone curious: -someone managed to access outputs sent to MiniMax -researcher discovered this by sending a secret links -40 to 130 hours later someone opened the secret links -oop, this means that someone accessed your outputs!! -AltasCloud/Novita/StreamLake were forwarding requests to MiniMax???? what the helly? ugh.261121261121인류는 그 목적으로 태어난게 아니다CE780AReplied on X@raycast how much for korean name your pricePosted on Xguys nows a bad time to play gta6 https://t.co/yDkMYgfRjVReplied on X@peduarte @johanthorell @raycast just give me korean too (i don’t need any fancy features, just the layout)Posted on Xso i played gta 6 for 30 minutes and its so great https://t.co/UbdZsMglmTLiked on XA bunch of sidebar navs https://t.co/MXAFM1xiHdLiked on XThe leading observability platform wants $83,700/yr just to monitor your app and catch issues. So Replit Missions built DataCat: https://t.co/vMAEEUYjf4 100% free. This isn't a prototype. Agent swarms explored thousands of workflows in the leading observability platform and rebuilt its features 1:1.Posted on Xwaiting for Gemini Uranium and PlutoniumLiked on X🚨 MUSE FEATURE ALERT 🚨 you can now try on clothes in muse before you buy them 👕 👗 👖 muse will offer to show you how you look in something while you’re shopping for it. trying things on in person? as if.... https://t.co/dK5EpGrsvfLiked on Xwe gave Grok Bot a body 👀 https://t.co/hMuYRUN8jLReplied on X@theo https://t.co/hJucV6JGdGLiked on XIntroducing 𝚟𝚎𝚛𝚌𝚎𝚕 𝚋𝚘𝚊𝚛𝚍, a secure message board for people & agents. • Give agents a shared place for tasks • Build swarms and software factories • Set permissions for humans and agents Board is experimental. Tell us what you think. https://t.co/jAAkcf1oPt https://t.co/ejC4aBrJqr
Recreating the Dynamic Island

Recreating the Dynamic Island

Warning

Over a year old. May be outdated

🗣 Talk is cheap, show me right now!

Of course. Click on the black oval below. It will display a song I am currently listening to or any of my 30 most recently played songs.

Good artists copy, great artists steal.

And I am now replicating Vercel's DX VP Lee Robinson's idea, LeeRob.io. Known for being a excellent testing bed for new Next.js features, Lee Robinson has one outstanding functionality. It will display the owner's song currently playing.

ALT: leerob.io

Now Playing on Spotify @ leerob.io

and longed to implement this one day on my website. However, I wanted it to be a technical challenge rather than simply recreating it. I also tried out various music services, making me postpone the development. I kept delaying the action until Apple released an exciting feature in 2022 called the Dynamic Island.

ALT: The Dynamic Island

The punch-hole camera at the top will reshape itself into different widgets.

The Dynamic Island perfectly satisfied my desire for a technical hurdle, so I planned to implement it with Web technologies. I also checked out different copies of the Dynamic Island for Android products, which all had awkward animation curves, further getting me interested in learning such details.

💡 Goal

Let's recreate the Dynamic Island on the Web!

💰 Extra Tip

I also open-sourced my for this project.

🛠 Readying the Tech

I went with the most familiar choice for the framework, Next.js and Tailwind. However, the animation troubled me. I have never dealt with anything more complicated than ease-in-ease-out CSS animations. I learned about a production-ready motion library named Framer Motion and opted for it.

ALT: Framer Motion

Framer Motion

🧑🏻‍🏫 The Physics of Animations

We first want to understand why Apple's animations look different from the others. We can classify animations into two big categories. (At least Apple classifies theirs into these two categories in their platform.)

Parametric Curve. Given a start and an endpoint, place a few control points and interpolate the curve in between using mathematical formulas. Depending on the type of interpolation formula, it can be a linear curve, polynomial curve, spline curve, etc. The Bézier curve that many developers often use falls under this category.

Spring Curve. Based on Newtonian dynamics (Hooke's law, the law that governs a spring's physical motion), we calculate the physical trajectory using stiffness and dampening. Learn More: Maxime Heckel

Any further discussions on animation curves will be out of the scope of this post. Most replications of the Dynamic Island choose parametric curves (it's the easiest, standardized in CSS). Apple uses spring motion, supposedly to mimic real-world physics. Framer Motion, the library I chose for this project, also provides a React hook named useSpring() to give control of such physical animations.

ts
useSpring(x, { stiffness: 1000, damping: 10 });

🛥 To the Dynamic Island

Source: Apple

I had to study the different behaviors of the Dynamic Island with Apple's official documents. The Dynamic Island can be any of the following forms.

Minimal. The widget takes one side of the Dynamic Island when two or more background activities are ongoing.

Compact: The standard form, where the widget takes both sides of the Dynamic Island when there is one ongoing background activity.

Expanded: The biggest size of the the Dynamic Island, shown when the user long-presses on the Dynamic Island. It cannot display content in the red area.

I also found the following image on the Web. Apple puts Expanded for all big sizes, but this image describes the Dynamic Island's expanded states.

Different sizes of the Dynamic Island. Considering that there is a typo on the image, it doesn't seem like an official document.

I declared the type as follows, reflecting the earlier information.

ts
export type DynamicIslandSize =
  | "compact"
  | "minimalLeading"
  | "minimalTrailing"
  | "default"
  | "long"
  | "large"
  | "ultra";

Then I spent a whole night () and figured out how to naturally shift sizes with Framer Motion. It uses the following code. I especially experimented with a lot of stiffness and dampening values. The golden ratio was const stiffness = 400 and const damping = 30.

tsx
<motion.div
  id={props.id}
  initial={{
	opacity: props.size === props.before ? 1 : 0,
	scale: props.size === props.before ? 1 : 0.9,
  }}
  animate={{
	opacity: props.size === props.before ? 0 : 1,
	scale: props.size === props.before ? 0.9 : 1,
	transition: { type: 'spring', stiffness: stiffness, damping: damping },
  }}
  exit={{ opacity: 0, filter: 'blur(10px)', scale: 0 }}
  style={{ willChange }}
  className={props.className}
>

ALT: As of Oct 16th, 2022

As of Oct 16th, 2022

📞 Hello?

Before connecting with external APIs, I mimicked Apple's incoming phone call widget. There's no big reason for this. It was just to get used to the animations. I love how it turned out. It looks exactly like the official Apple animation! Finished on .

🍎 Apple Music API

Then I needed to integrate with Apple Music's API. I previously made a technical demo with Spotify's API at the beginning of 2021. Spotify officially has a Now Playing API, so naturally, I expected a similar Now Playing API at Apple Music.

I was a huuuuge fan of IZ*ONE back then... 😅

ALT: Spotify Now Playing API

Spotify for Developers

Apple Music API 1.1 added Get Recently Played Tracks, the closest thing to a Now Playing API we ever got. Two years ago even that didn't exist.

ALT: Apple Music Get Recently Played Tracks

FYI, such an API did not even exist two years ago.

Now we need to issue and save the different tokens needed for OAuth 2.0. Spotify almost precisely followed the OAuth 2.0 standards, while Apple required a little more processing. The Now Playing API, especially, accessed the data on the Apple Music server and the user's private data, so I needed a separate privilege control with user access grants. All of these needed to be better documented, making it significantly more complicated. I needed the following items.

Aviation IndustrySame Concept at AppleExplanation
Establishing your Aviation CompanyApple Developer Paid Account$99
Pilot LicenseApple Music Key from Apple Developer Website.Ensures that you have permissions to get data from Apple Servers
Air Carrier Operating PermitApple Music Main Token from requesting to Apple ServerA permit to attach when requesting to Apple
Airline tickets for PassengersApple Music User Token from user's grantEnsures if the user wants to use my service

All four pieces of information should work harmoniously to retrieve users' data (of what they were listening to). All the others were pretty straightforward (). The trickiest one was User Token. User Token was specialized for iOS, macOS, and MusicKit on the Web. MusicKit on the Web was intended for Apple Music Web clients, like music.apple.com, Cider, and LitoMusic and was not designed for such API request bots. Still, Apple put MusicKit on the Web will automatically take care of it without documenting it. So what are we going to do? Reverse engineer the API.

Apple: Documentation? Nah.

ALT: MusicKit on the Web

MusicKit on the Web. Is Apple using Storybook? Based on Apple's track record, this MUST be an Alpha of Alpha.

🦾 Cracking the MusicKit

First, I mimicked the specs of MusicKit on the Web, creating a website.

This website will do nothing else than calling the authorization process.

It will show the Apple Music access grant page like this.

Then digging into the request headers of the website will reveal the media-user-token.

There we go.

Finally, I can successfully get a JSON response from the Apple server by filling in other information with Postman software. Finished on .

It sounds straightforward, but it took me days to figure it out. 😭

Requiring the information whenever someone accesses the Web will deplete my API quota in minutes. I wanted to make a cache server of some sort. But remember, the best database is no database.

Don't use the database when avoidable. Which is always more often than I think. I don't need to store the 195 countries of the world in a database and join when showing a country-dropdown. Just hardcode it or put in config read on boot. Hell, maybe your entire product catalogue of the e-commerce site can be a single YAML read on boot? This goes for many more objects than I often think. It's not Ruby that's slow, it's your database

So I put my private keys in GitHub Secrets and had GitHub Actions pull the data every few minutes and publish it on GitHub.

I don't know how long I struggled to find this typo.

🎼 Equalizers

Similar to finishing the phone call component, I completed the music player component.

But something felt empty.

There were no equalizers! I searched for good equalizers for React but later decided to implement this with Framer Motion. So these are the few iterations of the product.

ALT: FANCY by TWICE ALT: After Like by IVE ALT: Hype Boy by NewJeans

Each stick of the equalizers will have a random length. But as seen in the last song, something was also awkward. Usually, vocal music has smaller amplitudes on low and high frequencies, but completely randomizing the amplitude will also make those frequencies have similar ups and downs. So I set a base length as an anchor and made the randomized values slightly shake the values. Finally, I set the equalizer color to match the album cover's key color. I did not need additional work. It came with the Apple Music API.

Much smoother.

🔎 The Physics of Squircles

We're not done yet! Such completed widgets still felt slightly off. The curves felt too sharp. We needed squircles.

ALT: Squircle

Source: Apple's Icons Have That Shape for a Very Good Reason @ HackerNoon

A standard curve made by setting a border-radius has constant curvature, leading the end of the curve to have a sudden surge in curvature, making it feel sharp. On the contrary, gradually increasing and decreasing the curvature will make a much more natural curve.

For those AP Physics nerds, it's like uniformly increasing the jerk instead of uniformly accelerating.

For those AP Calc nerds, a squircle is a superellipse, the points that satisfy this equation. nn is the curvature, aa is the length on the xx axis, and bb is the length on the yy axis. For a deeper dive, see Figma's article on squircles.

∣xa∣n+∣yb∣n=1{\lvert{x \over a}\rvert}^n + {\lvert{y \over b}\rvert}^n = 1

I used tienphaw/figma-squircle to make an SVG squircle and clip the Dynamic Island with clipPath.

I saw a similar bug at the iOS 16 Notification Center. Maybe Apple is also clipping?

However, to clip all frames of the animations, we would have to create squircles for every frame, risking speed. Therefore, I opted to use borderRadius for the animation and clipped it right after the animation finished. It was barely noticeable, even if you looked very closely, so it was a good trade-off between performance and detail. Finished on .

Look closely. The border cuts into the squircle when the animation exits.

💨 Optimizing Performance

CSS has a will-change property. It tells the browser which elements on the screen will change, preparing the browser for it beforehand. The browser rasterizes every frame if there is no will-change property. With it, the browser will reuse a static image while the animation processes, rasterizing only when the animation finishes. Therefore, the animation may seem blurry depending on the type, but it will give more fluidity for transform, scale, or rotate animations.

The Dynamic Island usually modifies scale and opacity, so it was perfect for will-change. We can apply the property in Framer Motion, as in the following example.

ts
// ...

const willChange = useWillChange();

// ...

🔗 Integration

Last but not least, I made pages for integration purposes (/embed-player, /embed-phone-call). I did not want to add Tailwind or Framer Motions as a dependency on other websites, so I tried to use the iframe method. I used davidjbradshaw/iframe-resizer to make a responsive iframe. I also used CSS's position: sticky property to make it stick on specific pages. It's on this website, too!

💭 Postmortem

This completes the project. Here are some thoughts.

First of all, I succeeded in managing a mid-to-long-term side project. I have always , and I was very happy to finally complete the project after working on it for more than a month. I was also delighted that I successfully juggled 🤹 CS Major classes, job searching, and side projects simultaneously (although they still need to be completed).

Second, I would like to express my gratitude to Tim (cometkim), whom I met during my previous internship. I had a memorable experience during this internship when Tim showed me that it is possible to reverse engineer a compiled webpack codebase. It was indeed a spiced-up 🌶 and intense learning environment. However, that gave me confidence when I was blocked by Apple's undocumented API services.

I am also developing the habit of note-taking. There's a saying that people's will is weaker than we think, so it's better to reshape the environment. I did a decent job remodeling my website as a digital garden (or ) that is optimized for note-taking. I want to continue taking notes and learning new stuff. Tim also had a significant effect my note-taking by showing his workspace on Roam Research.

Anyway, that's the project. Thank you, everyone!

Backlinks2