The healing power of JavaScript



Just under a year ago, when Covid-19 lockdowns began to spread around the world, most people started stocking up on toilet paper and canned food. But personally, I was looking for something different: to implement a search function.



The purpose of the search function was not that important, I just needed to code. The code is calming because it allows you to feel in control in those moments when the world seemingly plunges into chaos. Basically, programming is about small puzzles to solve. Not just from puzzles lying passively on the table, but from puzzles in which you can breathe a mysterious life force. Puzzles capable of performing tasks, creating something, automating a routine or publishing texts available to the whole world.



Like many other writers and artists, I have a personal website that has been running for almost 20 years. Deciding to tackle the code, I dust off my rusty JavaScript knowledge and started looking for fuzzy search libraries that I can plug into a website to make it easier to find essays from my collection.



We split the task into parts. We write them into a to-do application (I love using Things). And this is how the creative universe is created. Every day, I step back from the global collapse of society that is unfolding outside my life, and immerse myself in research, one by one, crossing out the to-do points. Covid was massive; my to-do list was decent length.



The real pleasure of this project was not only to realize the search, but also to improve, polish, eliminate roughness. To get lost in the world I made myself. I may not be able to control a formidable pandemic, but I can manage this small handful of bits.



The whole process of work became an escape, but an escape with an impulse for growth. We set up the ideal keyboard navigation style, shift the moment of transmission of the search payload, find a balance between the size of the index and the usefulness of the search. Most importantly, we keep our code amazingly light. Wrap up, turn the code into a tiny "gist" on GitHub, and share it with the community. It's like passing the ball to other people: go ahead, now you can use this on your website. Ultra-fast and keyboard-optimized client search on Hugo.



He's imperfect, but damn good.



The bottom line is that the custom of trying to code is not only healing in itself, but also a trick for transforming the feeling of horror into something constructive: a function that adds a small but still valuable contribution to the whole.



I started coding when I was ten years old and have not given up since then. Basically I learned everything myself. Among other people, I feel extraordinary awkwardness, and the machine reassured me with its literality, and promised to let me into a world that even the adults around me could not comprehend. In this sense, the code has become a friend to me, a friend who will never judge.



The pattern developed: when I was tired of the complexities of social situations as a child, I turned to the code, becoming a recluse. Ellen Ullman in her book Life in Code: A Personal History of Technology writes: “Until I became a programmer, I did not fully understand the usefulness of such isolation: silence, reducing life to thought and form; for example, going into a dark room to work on a program when relationships with people get complicated. "



Reading assembly language books in high school or programming BBS software in high school didn’t seem like a lifesaver to me yet. My first conscious recognition of the healing power of code came a few years ago when I refactor my website from one content management system to another. It seems unimaginable, but it's true: I was healed by the CMS.



At that time, I suffered from personal and professional depression for a long time. I was completely unsettled. When I began to rethink my state, I realized that I was not where I wanted and expected to be.



This happens to me sometimes; this happens a lot to some people. When I feel the severity of depression descending on me, I often recall the epigraph to "Visible Darkness"William Styron: "For the terrible thing that I was terrified of, that overtook me ..." Usually this means that I did not get enough rest. I do not mean for days, but rather months or years. I tilt gradually, like a ship into which water enters through a stream. After some time, he will definitely drown. My brain was gradually sinking and I felt that he needed servers as a salvation. It turned out that servers are one of the safest places for me.



I've wanted to keep my flimsy and expensive Rackspace server alive for years, but I'm too lazy to do so. This is a voluminous and thankless task that requires constant concentration.



Almost everything server-related happens in the command line of the "terminal" - a world free of images and graphical interfaces. Text only. Every action is honed to the point and literally. A typo in a single character can destroy the system. In fact, when switching to administrator or "superuser" mode, servers have displayed this message for decades:



We trust that you have listened to the familiar lecture of your system administrator. It usually boils down to the following three points:



1: Respect the privacy of others.



2: Think before you hit the keys.



3: With great strength comes great responsibility.


One can feel weakness in the knees, realizing how much the work of the mechanism of the world depends on the accuracy of keyboard input. But this is exactly the case, and when you explore the insides of your favorite Linux distribution, you watch with an open mouth the absurdity and beauty of the intersections of streams that support the functioning of the web and most of our digital infrastructure (and indirectly, physical).



This is partly the reason for the appeal of systems: moving through this chaos, with all its twisted poetry grep , vi , git , apacheand * .ini— *, with the help of lightning-fast movements of the fingers on the keyboard, is amazing. You feel like an alchemist. Yes, and you are. You enter mysterious words, almost gibberish, into a line-by-line text interface, and now a simple application is ready, access to which instantly appears to a huge number of people around the world.



People I love often felt embarrassed or even suspicious when they accidentally found out that I was good at bash.(a kind of terminal shell for entering commands). As if I was hiding some unpleasant secret from them. Once, entering the world of text, with a few quick keystrokes, I helped a friend's teenage son install mods for Minecraft. From his look, I realized that I instantly became for him something like a rock star. Thanks to two hundred clicks, a bridge was created between two generations.



I find peace in the dark chaos of this world. Code and servers are my home, and this feeling is difficult to explain to those for whom they are not home.



So in my tilted, slightly depressed state, I started moving websites from the old to the new server. My tasks were recorded on my reliable to-do list. The URLs of old sites marked unique eras in my life through the lenses of which I once saw myself.



My old websites are ghosts. No one will view them or attack them. I transferred them because I felt responsible for them, I felt that they have the right to continue life in beats.



Most of the server work involved making complex sites less complex. That is, turn dynamic into static. Rip these sites out of their PHP cores, bring them back to placid HTML and CSS, and make them fast to maintain and future proof. It's funny that even something as simple as a MYSQL database requires pruning and feeding, just like plants. That a seemingly harmless PHP script becomes obsolete after a dozen years due to the evolution of the mental models of languages. But if you take an HTML page from the early 90s, it will render on almost any device with a screen.



In this sprint when migrating your home pageI also converted it into a so called static site. In a simpler version, which will continue to work in a few hundred years. She looks almost the same as she did before. Coming to static sites, we made a full circle like exhausted poets who traveled around the world and tried every poetic form, and in the end realized: to see us through our tragedies, a simple haiku is enough.



As with most infrastructure work, such monotonous behind-the-scenes tasks are often ignored, ridiculed as unimportant and underfunded. This happens until something breaks or until a pandemic begins. Then we understand that infrastructure is everything, and without it our world will return to a cave troglodyte state, or even worse.



In the late 1990s, we had little choice, everyone had to be the owner, cleaner, and systems engineer of their home page. Today it is possible to push this responsibility onto third parties. Tumblr, Ghost, Facebook, Blogger, Wordpress - many platforms have sprung up where you can focus solely on content and instead lower your level of control.



You can raise the level of responsibility too high. It probably happened to me. No matter how much effort you put into the system, the effect of this cannot exceed a certain value. But it doesn't bother me.



This line-by-line problem solving sometimes becomes exactly what gets me out of bed. Do you know this feeling? “I don’t want to get out from under the covers”? Every morning of the last year for all mankind, perhaps the greatest desire was to stay in bed, this world turned out to be so unbalanced. But then under this blanket I start thinking Aha!I know how to solve the X server problem, or how to deal with the strange behavior of Y. I know how to fix this search code. And thanks to this, I can get up and become a human (or at least partially human), enter this world of lines, where no one will judge you. It contains only you and the mechanics of systems; systems that become more beautiful the more time you spend on them. For me, this responsibility is therapy.



And so I destroy the system - the system that I loved and that has served me faithfully for many years, in order to come up with a better and more stable framework for the code, and maybe partly for the world.



All Articles