<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Blog — Bojan Vidanovic</title><link>https://bojanvidanovic.com/blog/</link><description>Blog on web development, tech, tools and productivity.</description><language>en</language><atom:link href="https://bojanvidanovic.com/blog/index.xml" rel="self" type="application/rss+xml"/><item><title>A great insight into climate change causes and their potential solutions</title><link>https://bojanvidanovic.com/blog/how-to-avoid-climate-disaster/</link><guid isPermaLink="true">https://bojanvidanovic.com/blog/how-to-avoid-climate-disaster/</guid><pubDate>Mon, 05 Dec 2022 18:41:02 +0100</pubDate><dc:creator>Bojan Vidanovic</dc:creator><category>blog</category><description>&lt;p&gt;&lt;a href="https://www.un.org/en/climatechange/what-is-climate-change"&gt;Climate change&lt;/a&gt; is happening, and the problems we are encountering caused by it are becoming more and more evident with every year passing. This year alone in 2022 we have seen more &lt;a href="https://www.wionews.com/world/climate-change-in-2022-brings-unprecedented-fire-activity-in-sw-europe-record-wildfire-carbon-output-globally-506627"&gt;wildfires&lt;/a&gt;, &lt;a href="https://www.theguardian.com/environment/2022/oct/20/flooding-world-climate-crisis-australia-venezuela-nigeria"&gt;floods&lt;/a&gt;, &lt;a href="https://www.carbonbrief.org/climate-change-made-2022s-northern-hemisphere-droughts-at-least-20-times-more-likely/"&gt;droughts&lt;/a&gt;, &lt;a href="https://public.wmo.int/en/media/press-release/eight-warmest-years-record-witness-upsurge-climate-change-impacts"&gt;record temperatures&lt;/a&gt;, hurricanes&amp;hellip; etc than ever before, and it seems it’s just the beginning. While most people agree on climate change, not many understand the real facts and the general complexity of the problem, because it’s not just cars and general transportation, it goes much deeper. Since it’s impacting all of us, I tried to learn more on this subject and stay informed from various sources but there was always a gap and missing pieces of the whole picture, but Bill Gates with his latest book &lt;a href="https://amzn.to/3B77IRi"&gt;“How to avoid a climate disaster”&lt;/a&gt; goes into details why this is happening, our potential breakthrough solution, and describes it as the hardest problem the humankind will need to solve very soon.&lt;/p&gt;
&lt;h2 id="51-billion-to-zero"&gt;51 billion to zero&lt;/h2&gt;
&lt;p&gt;Right from the start, I liked Bill’s direct approach to explaining things, like the opening of the book by going straight to the problem and the goal, “&lt;em&gt;There are two numbers you need to know about climate change, the first is 51 billion, the other is zero. Currently, we are putting 51 billion tons of greenhouse gases into the atmosphere every year, and that number is generally increasing, zero is what we need to aim for.&lt;/em&gt;”&lt;/p&gt;
&lt;p&gt;51 billion is a mind-boggling number and unfortunately for the planet, and us, that number is still going up, not down. Now, reducing it is already a challenge, but bringing it down to zero is a challenge on a whole new level. My first thought was “How the hell are we gonna do this!?”, which was in part also on Bill’s mind initially, but then he systematically goes in to categorize the biggest contributors of greenhouse gases and their potential solutions.&lt;/p&gt;
&lt;h2 id="problems-and-solutions"&gt;Problems and solutions&lt;/h2&gt;
&lt;p&gt;Most people probably think that cars, planes, and general transportation are the biggest contributors to greenhouse gases, at least that’s what I thought. Maybe because I’m mostly exposed to emissions in that category in my everyday life, but to my surprise and maybe yours, transportation falls to the 4th place on the list.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;31%: Making things (cement, steel, plastic)&lt;/li&gt;
&lt;li&gt;27%: Plugging in (electricity)&lt;/li&gt;
&lt;li&gt;19%: Growing things (plants, animals)&lt;/li&gt;
&lt;li&gt;16%: Transportation (cars, planes, trucks, ships)&lt;/li&gt;
&lt;li&gt;7%: Keeping warm and cool (heating, cooling, refrigeration)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Throughout the book, Bill goes into detail about every category’s problems and potential technological solutions, but generally, they all have one goal in common, not to burn oil.&lt;/p&gt;
&lt;h2 id="this-will-be-hard"&gt;This will be hard&lt;/h2&gt;
&lt;p&gt;This is a problem we should be quite concerned about, and this book helped me understand climate change much better. I can’t say I finished the book more optimistic about our future, the technological breakthroughs will need to happen soon. But if you want to understand what’s going on and get a better insight into how we could solve it, this is the book to pick up.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/how-to-avoid-climate-disaster/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;&lt;a href="https://www.un.org/en/climatechange/what-is-climate-change"&gt;Climate change&lt;/a&gt; is happening, and the problems we are encountering caused by it are becoming more and more evident with every year passing. This year alone in 2022 we have seen more &lt;a href="https://www.wionews.com/world/climate-change-in-2022-brings-unprecedented-fire-activity-in-sw-europe-record-wildfire-carbon-output-globally-506627"&gt;wildfires&lt;/a&gt;, &lt;a href="https://www.theguardian.com/environment/2022/oct/20/flooding-world-climate-crisis-australia-venezuela-nigeria"&gt;floods&lt;/a&gt;, &lt;a href="https://www.carbonbrief.org/climate-change-made-2022s-northern-hemisphere-droughts-at-least-20-times-more-likely/"&gt;droughts&lt;/a&gt;, &lt;a href="https://public.wmo.int/en/media/press-release/eight-warmest-years-record-witness-upsurge-climate-change-impacts"&gt;record temperatures&lt;/a&gt;, hurricanes&amp;hellip; etc than ever before, and it seems it’s just the beginning. While most people agree on climate change, not many understand the real facts and the general complexity of the problem, because it’s not just cars and general transportation, it goes much deeper. Since it’s impacting all of us, I tried to learn more on this subject and stay informed from various sources but there was always a gap and missing pieces of the whole picture, but Bill Gates with his latest book &lt;a href="https://amzn.to/3B77IRi"&gt;“How to avoid a climate disaster”&lt;/a&gt; goes into details why this is happening, our potential breakthrough solution, and describes it as the hardest problem the humankind will need to solve very soon.&lt;/p&gt;
&lt;h2 id="51-billion-to-zero"&gt;51 billion to zero&lt;/h2&gt;
&lt;p&gt;Right from the start, I liked Bill’s direct approach to explaining things, like the opening of the book by going straight to the problem and the goal, “&lt;em&gt;There are two numbers you need to know about climate change, the first is 51 billion, the other is zero. Currently, we are putting 51 billion tons of greenhouse gases into the atmosphere every year, and that number is generally increasing, zero is what we need to aim for.&lt;/em&gt;”&lt;/p&gt;
&lt;p&gt;51 billion is a mind-boggling number and unfortunately for the planet, and us, that number is still going up, not down. Now, reducing it is already a challenge, but bringing it down to zero is a challenge on a whole new level. My first thought was “How the hell are we gonna do this!?”, which was in part also on Bill’s mind initially, but then he systematically goes in to categorize the biggest contributors of greenhouse gases and their potential solutions.&lt;/p&gt;
&lt;h2 id="problems-and-solutions"&gt;Problems and solutions&lt;/h2&gt;
&lt;p&gt;Most people probably think that cars, planes, and general transportation are the biggest contributors to greenhouse gases, at least that’s what I thought. Maybe because I’m mostly exposed to emissions in that category in my everyday life, but to my surprise and maybe yours, transportation falls to the 4th place on the list.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;31%: Making things (cement, steel, plastic)&lt;/li&gt;
&lt;li&gt;27%: Plugging in (electricity)&lt;/li&gt;
&lt;li&gt;19%: Growing things (plants, animals)&lt;/li&gt;
&lt;li&gt;16%: Transportation (cars, planes, trucks, ships)&lt;/li&gt;
&lt;li&gt;7%: Keeping warm and cool (heating, cooling, refrigeration)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Throughout the book, Bill goes into detail about every category’s problems and potential technological solutions, but generally, they all have one goal in common, not to burn oil.&lt;/p&gt;
&lt;h2 id="this-will-be-hard"&gt;This will be hard&lt;/h2&gt;
&lt;p&gt;This is a problem we should be quite concerned about, and this book helped me understand climate change much better. I can’t say I finished the book more optimistic about our future, the technological breakthroughs will need to happen soon. But if you want to understand what’s going on and get a better insight into how we could solve it, this is the book to pick up.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/how-to-avoid-climate-disaster/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title>From EarPods to AirPods Pro</title><link>https://bojanvidanovic.com/blog/from-earpods-to-airpods-pro/</link><guid isPermaLink="true">https://bojanvidanovic.com/blog/from-earpods-to-airpods-pro/</guid><pubDate>Thu, 08 Apr 2021 10:36:02 +0100</pubDate><dc:creator>Bojan Vidanovic</dc:creator><category>blog</category><description>&lt;p&gt;So this year is the year for some technical upgrades, one of them was the
upgrade &lt;a href="https://bojanvidanovic.com/blog/from-iphone-6s-plus-to-iphone-12-pro/"&gt;from iPhones 6s Plus to iPhone 12 Pro&lt;/a&gt;, you can read about that in my previous post. The other
one is earbuds, from EarPods to &lt;a href="https://amzn.to/3t2glGO"&gt;AirPods Pro&lt;/a&gt;. The changes in the iPhone I would describe as incremental, which means faster, better, prettier. But in
the AirPods, it&amp;rsquo;s a whole new level of experience.&lt;/p&gt;
&lt;p&gt;If the iPhone had kept the audio jack, I doubt I’d change the good old EarPods
to anything else because they just worked perfectly fine. But since Apple
decided to remove the audio jack, I ended up with 2 choices, buy an adapter,
from lightning connector to audio jack, or buy the wireless headphones. The
idea of having the dongle hit me harder than recharging the headphones, so
I decided to get a pair of wireless earbuds.&lt;/p&gt;
&lt;p&gt;Initially, I started looking at earbuds reviews from different audio
manufactures, but the AirPods Pro had particularly good reviews and integration
with the iPhone and Mac, so I decided to jump the train and get them.&lt;/p&gt;
&lt;p&gt;After I got them and got to spend a fair amount of time using them I completely
fall in love with my new earbuds, the AirPods Pro. So much that I couldn’t see
myself going back to EarBuds never again.&lt;/p&gt;
&lt;p&gt;The differences between the two are enormous, and I think you can&amp;rsquo;t really
compare them side-by-side, except for sound and mic quality.&lt;/p&gt;
&lt;p&gt;Out-of-the-box there is a pretty straightforward setup experience, as with
everything that Apple makes. Immediately after opening the case and pulling out
the AirPods, they got recognized but the iPhone and get successfully paired.
But what I appreciated a lot was the integrated sealing test which let you find
the best ear-tip for your ear size. Here I discovered that my ear canals have
different sizes on each side, on the left I wear a small ear-tip, and on the
right medium.&lt;/p&gt;
&lt;p&gt;After finding the right ear-tips for my ears, I went straight to play some
music, and the differences are notable, but not overly notable as I expected.
After spending some time with them and doing tests with different kinds of
music genres, the sound is detailed and not over-saturated. But I’m not an
audiophile so don’t trust me on this one, there are good reviews on this
subject which you should check out if this one of your concerns.&lt;/p&gt;
&lt;p&gt;The audio listening is accompanied by 3 different listening modes, normal mode,
active noise cancellation, and transparency mode. And this is where they come
to shine.&lt;/p&gt;
&lt;p&gt;The active noise cancellation (ANC) mode is incredibly good and I love it. It
successfully eliminates almost all major external sounds, and I say almost
because some sounds still get through but it’s really a small percentage. So
listening to my favorite podcast while walking near the busy road or working in
the coffee shop is such a joy I almost cannot believe it. In theory, the sound
quality would deteriorate because of all filters applied, but that’s not the
case, the sound quality remains very good, I’d argue even better than without
activating the ANC.&lt;/p&gt;
&lt;p&gt;Another listening mode is the Transparency Mode, which is completely opposite
of ANC, it puts the external sounds at almost the same level as the output
sound. This comes in very handy in situations where I need to be aware of the
sounds around me, like for example while riding the bicycle. Sometimes
I completely forget that I’m wearing the AirPods, this mode really makes me
integrate with my surroundings instead of isolating.&lt;/p&gt;
&lt;p&gt;Then there is this thing Apple calls spatial sound, which is basically 3D surround
sound, as What HiFi describes it:&lt;/p&gt;
&lt;blockquote cite=""&gt;
&lt;p&gt;
Apple spatial audio takes 5.1, 7.1 and Dolby Atmos signals and applies
directional audio filters, adjusting the frequencies that each ear hears so
that sounds can be placed virtually anywhere in 3D space. Sounds will appear to
be coming from in front of you, from the sides, the rear and even above. The
idea is to recreate the audio experience of a cinema.
&lt;/p&gt;
&lt;footer&gt;
- Tom Parsons, &lt;cite&gt;What HiFi?&lt;/cite&gt;
&lt;/footer&gt;
&lt;/blockquote&gt;
&lt;p&gt;Well, I haven’t got the chance to really enjoy this feature, but from the tests
I did, it sounds interesting.&lt;/p&gt;
&lt;p&gt;The controls are placed on the stem, giving a clicky feeling, they work pretty
well, but unfortunately, I can’t manage the sound volume directly from the
stem, instead, it should be used Siri, or via the phone or mac, that is the
only thing I found that is missing.&lt;/p&gt;
&lt;p&gt;Now the most uncomfortable topic for any wearable device, the battery! The
AirPods Pro will work for 4.5 hours on a single charge, and 24 hours with the
charging case. To me, this is pretty great because I can’t wear them for more
than 2 hours, my ears get uncomfortable, and then I’ll put them back in the
case, if they stay in the case for at least 5 minutes, they’ll get charged for
another hour of listening time. So the only thing I should be worried about is
to not run out of juice in the case and I’m fine. I wish the new iPhone 12 had
a possibility of reverse-charging, but I guess we’ll need to wait for that.&lt;/p&gt;
&lt;p&gt;Speaking of design, the stem, which is way shorter than the one on “normal”
AirPods and looks better, doesn’t make any sense to me. It’s an old design for
wired earbuds, but for wireless, they could have design something more modern.
But I guess they are keeping that for the next releases.&lt;/p&gt;
&lt;p&gt;In conclusion, the AirPods Pro is really really good, but if you are already in the Apple
ecosystem, otherwise I&amp;rsquo;m not sure I&amp;rsquo;d recommend them.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/from-earpods-to-airpods-pro/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;So this year is the year for some technical upgrades, one of them was the
upgrade &lt;a href="https://bojanvidanovic.com/blog/from-iphone-6s-plus-to-iphone-12-pro/"&gt;from iPhones 6s Plus to iPhone 12 Pro&lt;/a&gt;, you can read about that in my previous post. The other
one is earbuds, from EarPods to &lt;a href="https://amzn.to/3t2glGO"&gt;AirPods Pro&lt;/a&gt;. The changes in the iPhone I would describe as incremental, which means faster, better, prettier. But in
the AirPods, it&amp;rsquo;s a whole new level of experience.&lt;/p&gt;
&lt;p&gt;If the iPhone had kept the audio jack, I doubt I’d change the good old EarPods
to anything else because they just worked perfectly fine. But since Apple
decided to remove the audio jack, I ended up with 2 choices, buy an adapter,
from lightning connector to audio jack, or buy the wireless headphones. The
idea of having the dongle hit me harder than recharging the headphones, so
I decided to get a pair of wireless earbuds.&lt;/p&gt;
&lt;p&gt;Initially, I started looking at earbuds reviews from different audio
manufactures, but the AirPods Pro had particularly good reviews and integration
with the iPhone and Mac, so I decided to jump the train and get them.&lt;/p&gt;
&lt;p&gt;After I got them and got to spend a fair amount of time using them I completely
fall in love with my new earbuds, the AirPods Pro. So much that I couldn’t see
myself going back to EarBuds never again.&lt;/p&gt;
&lt;p&gt;The differences between the two are enormous, and I think you can&amp;rsquo;t really
compare them side-by-side, except for sound and mic quality.&lt;/p&gt;
&lt;p&gt;Out-of-the-box there is a pretty straightforward setup experience, as with
everything that Apple makes. Immediately after opening the case and pulling out
the AirPods, they got recognized but the iPhone and get successfully paired.
But what I appreciated a lot was the integrated sealing test which let you find
the best ear-tip for your ear size. Here I discovered that my ear canals have
different sizes on each side, on the left I wear a small ear-tip, and on the
right medium.&lt;/p&gt;
&lt;p&gt;After finding the right ear-tips for my ears, I went straight to play some
music, and the differences are notable, but not overly notable as I expected.
After spending some time with them and doing tests with different kinds of
music genres, the sound is detailed and not over-saturated. But I’m not an
audiophile so don’t trust me on this one, there are good reviews on this
subject which you should check out if this one of your concerns.&lt;/p&gt;
&lt;p&gt;The audio listening is accompanied by 3 different listening modes, normal mode,
active noise cancellation, and transparency mode. And this is where they come
to shine.&lt;/p&gt;
&lt;p&gt;The active noise cancellation (ANC) mode is incredibly good and I love it. It
successfully eliminates almost all major external sounds, and I say almost
because some sounds still get through but it’s really a small percentage. So
listening to my favorite podcast while walking near the busy road or working in
the coffee shop is such a joy I almost cannot believe it. In theory, the sound
quality would deteriorate because of all filters applied, but that’s not the
case, the sound quality remains very good, I’d argue even better than without
activating the ANC.&lt;/p&gt;
&lt;p&gt;Another listening mode is the Transparency Mode, which is completely opposite
of ANC, it puts the external sounds at almost the same level as the output
sound. This comes in very handy in situations where I need to be aware of the
sounds around me, like for example while riding the bicycle. Sometimes
I completely forget that I’m wearing the AirPods, this mode really makes me
integrate with my surroundings instead of isolating.&lt;/p&gt;
&lt;p&gt;Then there is this thing Apple calls spatial sound, which is basically 3D surround
sound, as What HiFi describes it:&lt;/p&gt;
&lt;blockquote cite=""&gt;
&lt;p&gt;
Apple spatial audio takes 5.1, 7.1 and Dolby Atmos signals and applies
directional audio filters, adjusting the frequencies that each ear hears so
that sounds can be placed virtually anywhere in 3D space. Sounds will appear to
be coming from in front of you, from the sides, the rear and even above. The
idea is to recreate the audio experience of a cinema.
&lt;/p&gt;
&lt;footer&gt;
- Tom Parsons, &lt;cite&gt;What HiFi?&lt;/cite&gt;
&lt;/footer&gt;
&lt;/blockquote&gt;
&lt;p&gt;Well, I haven’t got the chance to really enjoy this feature, but from the tests
I did, it sounds interesting.&lt;/p&gt;
&lt;p&gt;The controls are placed on the stem, giving a clicky feeling, they work pretty
well, but unfortunately, I can’t manage the sound volume directly from the
stem, instead, it should be used Siri, or via the phone or mac, that is the
only thing I found that is missing.&lt;/p&gt;
&lt;p&gt;Now the most uncomfortable topic for any wearable device, the battery! The
AirPods Pro will work for 4.5 hours on a single charge, and 24 hours with the
charging case. To me, this is pretty great because I can’t wear them for more
than 2 hours, my ears get uncomfortable, and then I’ll put them back in the
case, if they stay in the case for at least 5 minutes, they’ll get charged for
another hour of listening time. So the only thing I should be worried about is
to not run out of juice in the case and I’m fine. I wish the new iPhone 12 had
a possibility of reverse-charging, but I guess we’ll need to wait for that.&lt;/p&gt;
&lt;p&gt;Speaking of design, the stem, which is way shorter than the one on “normal”
AirPods and looks better, doesn’t make any sense to me. It’s an old design for
wired earbuds, but for wireless, they could have design something more modern.
But I guess they are keeping that for the next releases.&lt;/p&gt;
&lt;p&gt;In conclusion, the AirPods Pro is really really good, but if you are already in the Apple
ecosystem, otherwise I&amp;rsquo;m not sure I&amp;rsquo;d recommend them.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/from-earpods-to-airpods-pro/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title>From iPhone 6s Plus to iPhone 12 Pro</title><link>https://bojanvidanovic.com/blog/from-iphone-6s-plus-to-iphone-12-pro/</link><guid isPermaLink="true">https://bojanvidanovic.com/blog/from-iphone-6s-plus-to-iphone-12-pro/</guid><pubDate>Fri, 12 Feb 2021 10:36:02 +0100</pubDate><dc:creator>Bojan Vidanovic</dc:creator><category>blog</category><description>&lt;p&gt;My first iPhone was the iPhone 6, which shortly after I upgraded to iPhone 6s
Plus. I got the 6s Plus soon after the release in September 2015, I can still remember the fuss that Apple started following the big-screen phone trend. So, since 2015, it was my daily horse, and went through everything, all the updates, 3 new screens, 2 new batteries, a few covers, and still working.&lt;/p&gt;
&lt;p&gt;Every year, with each new phone release I would consider upgrading
but never found any good reasons to do it. None of the models made any drastic
changes that I couldn&amp;rsquo;t do with my good old 6s Plus. But as every year passed the
only problem that was becoming very evident was the phone&amp;rsquo;s insufficient
memory and CPU power to cope with the latest iOS&amp;rsquo;s and apps. That problem
increasingly became more and more frustrating for doing everyday activities.
The apps would take longer and longer to open, my most used apps wouldn&amp;rsquo;t stay in the background so multitasking was becoming impossible. And after trying all the tricks in disabling all the system processes I don&amp;rsquo;t use, disabling all UI candy features, the problem would still persist. And to put the cherry on top Apple will discontinue supporting the iPhone 6s in 2020. After this, I knew that this time it needed a replacement, and I hoped the 2020 model would be just what I wanted both in performances, camera, design, and screen.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://amzn.to/3tbLnf9"&gt;iPhone 12 Pro&lt;/a&gt; was just &amp;ldquo;that&amp;rdquo; upgrade I wanted.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m not going in-depth review, because I think the internet really doesn&amp;rsquo;t need yet another
iPhone review. Instead, in this post, I&amp;rsquo;ll try to give my perspective on what has changed in the
last 5 years in the iPhones.&lt;/p&gt;
&lt;h2 id="design"&gt;Design&lt;/h2&gt;
&lt;p&gt;I would start with the fact that I love the new design. I was never a fan of
the rounded design language from the iPhone 6 to the iPhone X, I found them the
less appealing designs Apple ever did on the iPhone.
Then, I also was not a fan of the previous model design of the iPhone X, in
particular the back made of glass.&lt;/p&gt;
&lt;p&gt;But the iPhone 12 design is what I was waiting for. Its design, to me,
resembles the square design of the iPhone 4s, which in my opinion was one of
the best iPhone designs Apple ever did. So coming back to it from my iPhone 6s
rounded design was a dream.&lt;/p&gt;
&lt;p&gt;But not just from the design standpoint, also from the practical standpoint.
The problem with the rounded design was that it was very easy to drop. Rounded
angles are much more slippery in contrast to sharp edges.&lt;/p&gt;
&lt;h2 id="swipe-based-home-button"&gt;Swipe-Based Home Button&lt;/h2&gt;
&lt;p&gt;Removing the home button was the single biggest change that differentiates the
old iPhones from the new iPhones. It was a move that we all knew was coming,
and in my opinion, it marks a great evolution of the phones.&lt;/p&gt;
&lt;p&gt;After 5 years, it felt weird not having the home button. The muscle memory will
take some time to adjust, but after the initial period of adapting, which
didn’t take long, it felt so natural to manage the home screen. I found swiping
much easier than pressing the button which IMHO is a harder action than just
swiping up the thumb finger.&lt;/p&gt;
&lt;h2 id="triple-camera-system"&gt;Triple-Camera System&lt;/h2&gt;
&lt;p&gt;I never really complained about the camera on my old iPhone 6s Plus, I’m not
a photographer but I like to occasionally take photos when something
interesting captures my attention. I knew its limits, I just wished in certain
situations it was capable of zooming or taking the night photos, but I learned
to live with that.&lt;/p&gt;
&lt;p&gt;While I knew with every new iPhone there is some degree of improvement in the
camera, since the camera is one of the strongest points of every iPhone. But
the camera on the iPhone 12 Pro blew me out of the blue. It’s so good that it
basically makes anyone a good photographer.&lt;/p&gt;
&lt;p&gt;The triple-camera system is packed with 3 lenses, a standard, ultra-wide, and
telephoto camera. Which basically means you have optical zoom-in and zoom-out.
In addition to this camera system, there is also included a LiDAR scanner which
helps focus faster and take better photos at night.
The cameras on the iPhone 12 Pro are incredibly good and checks all the boxes.
So comparing the single-camera iPhone 6s Plus with this would not make any
sense, it’s just better in any possible way and hasn’t even scratched the
surface of its capabilities.&lt;/p&gt;
&lt;h2 id="super-retina-xdr-display"&gt;Super Retina XDR display&lt;/h2&gt;
&lt;p&gt;Removing the home button not only improved the UX with its swipe-based home
button but also made more room for the screen which who doesn’t like. The
iPhone 6s Plus is bigger in size than the iPhone&amp;rsquo;s 12 Pro by 1cm (0.39 inches),
but the 12 Pro has a bigger screen.&lt;/p&gt;
&lt;p&gt;The screen on the 12 Pro is an OLED with up to 1200 nits of screen brightness
and a 2000000:1 contrast ratio with true blacks called Super Retina XDR
display.&lt;/p&gt;
&lt;p&gt;Other than the obvious difference between the two in the size and different
aspect ratio, I haven’t found much of the difference in the picture quality. On
the paper, everything is better, but to the naked eye, they seem quite similar.&lt;/p&gt;
&lt;h2 id="the-notch"&gt;The Notch&lt;/h2&gt;
&lt;p&gt;Removing the bottom bezel where the home button was couldn&amp;rsquo;t be accompanied
without removing also the upper bezel, otherwise, it would be pretty ugly. But
that has left us with the notch. And one thing I really hate about the new
iPhones is the notch, and I don’t think we’ll see it removed anytime soon.&lt;/p&gt;
&lt;p&gt;Coming from a perfect notch-less screen to this isn’t pretty, and yes you kinda
use it and learn to ignore it but it’s still there.&lt;/p&gt;
&lt;h2 id="goodbye-touch-id-hello-face-id"&gt;Goodbye Touch ID, Hello Face ID&lt;/h2&gt;
&lt;p&gt;The Touch ID is the one future I really miss on the 12 Pro, especially now that
we are all wearing masks.&lt;/p&gt;
&lt;p&gt;The Face ID is great and makes the phone unlocking instantly, but not always.
There are few situations where my face wouldn’t get recognized and then it
would ask for the passcode, or alternatively, I would need to switch off the
screen and turn it on to try the facial recognition again. In these types of
situations having the Touch ID would work much better as an alternative.&lt;/p&gt;
&lt;p&gt;There are some rumors the Touch ID will find its way back to the iPhone inside
the power button, or possibly under the screen but these are just the rumors
for which I hope will come true in the coming models.&lt;/p&gt;
&lt;h2 id="battery"&gt;Battery&lt;/h2&gt;
&lt;p&gt;At the moment I need to charge the 12 Pro every 2 days, whereas my daily usage
is around 3/4 hours a day. So technically I should have around 6/7 hours of
battery life, and that is not bad for my needs, but… I had the same results
when I acquired the 6s Plus in 2015, which naturally slowly degraded over the
years.&lt;/p&gt;
&lt;p&gt;There are improvements in the battery capacity and usage, but the 12 Pro is
packed with more stuff and that stuff needs more juice.&lt;/p&gt;
&lt;h2 id="new-features"&gt;New Features&lt;/h2&gt;
&lt;p&gt;Aside from the improvements and differences between the two models, 5 years
later Apple brought some new features like:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;MagSafe: This is a great addition, it&amp;rsquo;s practical and probably will become the only way to charge the phone in the near future. I just wished Apple implemented reverse-charging, where I could charge the earbuds on-the-go.&lt;/li&gt;
&lt;li&gt;LiDAR: Still haven&amp;rsquo;t found a proper use for this except in camera.&lt;/li&gt;
&lt;li&gt;5G: Never tested, still not available in most places.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;As I stated at the beginning I never found a good reason for the upgrade in the
previous models, until the iPhone 12 and the apparent need to upgrade.&lt;/p&gt;
&lt;p&gt;The changes are notable, most in a good and some in a bad way. But it&amp;rsquo;s a nice
upgrade overall. Five years later and you can feel that Apple is moving in the
direction of the wireless and buttonless system.
But to see those changes the upgrade window should be around 5-6 years. Apple
is very good at marketing new phones but usually, those products offer an
incremental upgrade over the previous models, unless your workflow depends on
the newly released future you probably don’t need to upgrade yet.&lt;/p&gt;
&lt;p&gt;I would warmly suggest to iPhone 6/6s owners to upgrade, but I’m not sure I’d
suggest the same for the owners of the iPhone 8 and up.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/from-iphone-6s-plus-to-iphone-12-pro/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;My first iPhone was the iPhone 6, which shortly after I upgraded to iPhone 6s
Plus. I got the 6s Plus soon after the release in September 2015, I can still remember the fuss that Apple started following the big-screen phone trend. So, since 2015, it was my daily horse, and went through everything, all the updates, 3 new screens, 2 new batteries, a few covers, and still working.&lt;/p&gt;
&lt;p&gt;Every year, with each new phone release I would consider upgrading
but never found any good reasons to do it. None of the models made any drastic
changes that I couldn&amp;rsquo;t do with my good old 6s Plus. But as every year passed the
only problem that was becoming very evident was the phone&amp;rsquo;s insufficient
memory and CPU power to cope with the latest iOS&amp;rsquo;s and apps. That problem
increasingly became more and more frustrating for doing everyday activities.
The apps would take longer and longer to open, my most used apps wouldn&amp;rsquo;t stay in the background so multitasking was becoming impossible. And after trying all the tricks in disabling all the system processes I don&amp;rsquo;t use, disabling all UI candy features, the problem would still persist. And to put the cherry on top Apple will discontinue supporting the iPhone 6s in 2020. After this, I knew that this time it needed a replacement, and I hoped the 2020 model would be just what I wanted both in performances, camera, design, and screen.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://amzn.to/3tbLnf9"&gt;iPhone 12 Pro&lt;/a&gt; was just &amp;ldquo;that&amp;rdquo; upgrade I wanted.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m not going in-depth review, because I think the internet really doesn&amp;rsquo;t need yet another
iPhone review. Instead, in this post, I&amp;rsquo;ll try to give my perspective on what has changed in the
last 5 years in the iPhones.&lt;/p&gt;
&lt;h2 id="design"&gt;Design&lt;/h2&gt;
&lt;p&gt;I would start with the fact that I love the new design. I was never a fan of
the rounded design language from the iPhone 6 to the iPhone X, I found them the
less appealing designs Apple ever did on the iPhone.
Then, I also was not a fan of the previous model design of the iPhone X, in
particular the back made of glass.&lt;/p&gt;
&lt;p&gt;But the iPhone 12 design is what I was waiting for. Its design, to me,
resembles the square design of the iPhone 4s, which in my opinion was one of
the best iPhone designs Apple ever did. So coming back to it from my iPhone 6s
rounded design was a dream.&lt;/p&gt;
&lt;p&gt;But not just from the design standpoint, also from the practical standpoint.
The problem with the rounded design was that it was very easy to drop. Rounded
angles are much more slippery in contrast to sharp edges.&lt;/p&gt;
&lt;h2 id="swipe-based-home-button"&gt;Swipe-Based Home Button&lt;/h2&gt;
&lt;p&gt;Removing the home button was the single biggest change that differentiates the
old iPhones from the new iPhones. It was a move that we all knew was coming,
and in my opinion, it marks a great evolution of the phones.&lt;/p&gt;
&lt;p&gt;After 5 years, it felt weird not having the home button. The muscle memory will
take some time to adjust, but after the initial period of adapting, which
didn’t take long, it felt so natural to manage the home screen. I found swiping
much easier than pressing the button which IMHO is a harder action than just
swiping up the thumb finger.&lt;/p&gt;
&lt;h2 id="triple-camera-system"&gt;Triple-Camera System&lt;/h2&gt;
&lt;p&gt;I never really complained about the camera on my old iPhone 6s Plus, I’m not
a photographer but I like to occasionally take photos when something
interesting captures my attention. I knew its limits, I just wished in certain
situations it was capable of zooming or taking the night photos, but I learned
to live with that.&lt;/p&gt;
&lt;p&gt;While I knew with every new iPhone there is some degree of improvement in the
camera, since the camera is one of the strongest points of every iPhone. But
the camera on the iPhone 12 Pro blew me out of the blue. It’s so good that it
basically makes anyone a good photographer.&lt;/p&gt;
&lt;p&gt;The triple-camera system is packed with 3 lenses, a standard, ultra-wide, and
telephoto camera. Which basically means you have optical zoom-in and zoom-out.
In addition to this camera system, there is also included a LiDAR scanner which
helps focus faster and take better photos at night.
The cameras on the iPhone 12 Pro are incredibly good and checks all the boxes.
So comparing the single-camera iPhone 6s Plus with this would not make any
sense, it’s just better in any possible way and hasn’t even scratched the
surface of its capabilities.&lt;/p&gt;
&lt;h2 id="super-retina-xdr-display"&gt;Super Retina XDR display&lt;/h2&gt;
&lt;p&gt;Removing the home button not only improved the UX with its swipe-based home
button but also made more room for the screen which who doesn’t like. The
iPhone 6s Plus is bigger in size than the iPhone&amp;rsquo;s 12 Pro by 1cm (0.39 inches),
but the 12 Pro has a bigger screen.&lt;/p&gt;
&lt;p&gt;The screen on the 12 Pro is an OLED with up to 1200 nits of screen brightness
and a 2000000:1 contrast ratio with true blacks called Super Retina XDR
display.&lt;/p&gt;
&lt;p&gt;Other than the obvious difference between the two in the size and different
aspect ratio, I haven’t found much of the difference in the picture quality. On
the paper, everything is better, but to the naked eye, they seem quite similar.&lt;/p&gt;
&lt;h2 id="the-notch"&gt;The Notch&lt;/h2&gt;
&lt;p&gt;Removing the bottom bezel where the home button was couldn&amp;rsquo;t be accompanied
without removing also the upper bezel, otherwise, it would be pretty ugly. But
that has left us with the notch. And one thing I really hate about the new
iPhones is the notch, and I don’t think we’ll see it removed anytime soon.&lt;/p&gt;
&lt;p&gt;Coming from a perfect notch-less screen to this isn’t pretty, and yes you kinda
use it and learn to ignore it but it’s still there.&lt;/p&gt;
&lt;h2 id="goodbye-touch-id-hello-face-id"&gt;Goodbye Touch ID, Hello Face ID&lt;/h2&gt;
&lt;p&gt;The Touch ID is the one future I really miss on the 12 Pro, especially now that
we are all wearing masks.&lt;/p&gt;
&lt;p&gt;The Face ID is great and makes the phone unlocking instantly, but not always.
There are few situations where my face wouldn’t get recognized and then it
would ask for the passcode, or alternatively, I would need to switch off the
screen and turn it on to try the facial recognition again. In these types of
situations having the Touch ID would work much better as an alternative.&lt;/p&gt;
&lt;p&gt;There are some rumors the Touch ID will find its way back to the iPhone inside
the power button, or possibly under the screen but these are just the rumors
for which I hope will come true in the coming models.&lt;/p&gt;
&lt;h2 id="battery"&gt;Battery&lt;/h2&gt;
&lt;p&gt;At the moment I need to charge the 12 Pro every 2 days, whereas my daily usage
is around 3/4 hours a day. So technically I should have around 6/7 hours of
battery life, and that is not bad for my needs, but… I had the same results
when I acquired the 6s Plus in 2015, which naturally slowly degraded over the
years.&lt;/p&gt;
&lt;p&gt;There are improvements in the battery capacity and usage, but the 12 Pro is
packed with more stuff and that stuff needs more juice.&lt;/p&gt;
&lt;h2 id="new-features"&gt;New Features&lt;/h2&gt;
&lt;p&gt;Aside from the improvements and differences between the two models, 5 years
later Apple brought some new features like:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;MagSafe: This is a great addition, it&amp;rsquo;s practical and probably will become the only way to charge the phone in the near future. I just wished Apple implemented reverse-charging, where I could charge the earbuds on-the-go.&lt;/li&gt;
&lt;li&gt;LiDAR: Still haven&amp;rsquo;t found a proper use for this except in camera.&lt;/li&gt;
&lt;li&gt;5G: Never tested, still not available in most places.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;As I stated at the beginning I never found a good reason for the upgrade in the
previous models, until the iPhone 12 and the apparent need to upgrade.&lt;/p&gt;
&lt;p&gt;The changes are notable, most in a good and some in a bad way. But it&amp;rsquo;s a nice
upgrade overall. Five years later and you can feel that Apple is moving in the
direction of the wireless and buttonless system.
But to see those changes the upgrade window should be around 5-6 years. Apple
is very good at marketing new phones but usually, those products offer an
incremental upgrade over the previous models, unless your workflow depends on
the newly released future you probably don’t need to upgrade yet.&lt;/p&gt;
&lt;p&gt;I would warmly suggest to iPhone 6/6s owners to upgrade, but I’m not sure I’d
suggest the same for the owners of the iPhone 8 and up.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/from-iphone-6s-plus-to-iphone-12-pro/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title>CSS Solutions to Fix FOUC</title><link>https://bojanvidanovic.com/blog/css-solutions-fouc/</link><guid isPermaLink="true">https://bojanvidanovic.com/blog/css-solutions-fouc/</guid><pubDate>Sat, 24 Oct 2020 15:53:06 +0200</pubDate><dc:creator>Bojan Vidanovic</dc:creator><category>blog</category><description>&lt;p&gt;Today, I&amp;rsquo;ve finally decided to fix a bug I&amp;rsquo;ve been seeing for a long time,
which I always would leave for later as it was a minor bug. This bug is called
FOUC or Flash of Unpainted Content, so I decided to share with you these
2 solutions to this simple problem.&lt;/p&gt;
&lt;p&gt;The problem is relatively simple, avoid showing unstyled HTML elements
scattered through the page while the CSS file is being loaded.&lt;/p&gt;
&lt;p&gt;There are 2 solutions to this problem, a longer one and a quicker one, you
decide which one works best for you.&lt;/p&gt;
&lt;h2 id="solution-1"&gt;Solution 1:&lt;/h2&gt;
&lt;p&gt;This solution is more complicated to implement but much better. The idea is to
extract critical CSS from the file and inline in the head. By saying critical
I mean all the styles of the above-the-fold content visible on the page load.&lt;/p&gt;
&lt;p&gt;This technique will make the page instantly interactable without showing
unstyled elements, while the rest of the CSS file will load in async without
blocking.&lt;/p&gt;
&lt;p&gt;There are a few NPM plugins to achieve this without going manually over files,
like &lt;a href="https://github.com/addyosmani/critical"&gt;Critical&lt;/a&gt;, &lt;a href="https://github.com/filamentgroup/criticalCSS"&gt;CriticalCSS&lt;/a&gt;&amp;hellip;&lt;/p&gt;
&lt;h2 id="solution-2"&gt;Solution 2:&lt;/h2&gt;
&lt;p&gt;A quicker solution would be hiding the HTML element while the CSS file is being
loaded. This not-so-great solution would make the time-to-interactivity longer,
but it will avoid showing unstyled elements and CLS.&lt;/p&gt;
&lt;p&gt;First we will set the visibility rule to hidden in the head of the HTML file, this will hide the page while the CSS file is being downloaded:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;head&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ...
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;style&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;html&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;visibility&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;hidden&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;style&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/&lt;span style="color:#f92672"&gt;head&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then, in the CSS file, we&amp;rsquo;ll set the visibility to visible, which when loaded will
automatically show the page already styled.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-css" data-lang="css"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;html&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;visibility&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;visible&lt;/span&gt; &lt;span style="color:#75715e"&gt;!important&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Depending on the structure, urgency, and importance of the project you can
always consider one of the two solutions.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/css-solutions-fouc/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;Today, I&amp;rsquo;ve finally decided to fix a bug I&amp;rsquo;ve been seeing for a long time,
which I always would leave for later as it was a minor bug. This bug is called
FOUC or Flash of Unpainted Content, so I decided to share with you these
2 solutions to this simple problem.&lt;/p&gt;
&lt;p&gt;The problem is relatively simple, avoid showing unstyled HTML elements
scattered through the page while the CSS file is being loaded.&lt;/p&gt;
&lt;p&gt;There are 2 solutions to this problem, a longer one and a quicker one, you
decide which one works best for you.&lt;/p&gt;
&lt;h2 id="solution-1"&gt;Solution 1:&lt;/h2&gt;
&lt;p&gt;This solution is more complicated to implement but much better. The idea is to
extract critical CSS from the file and inline in the head. By saying critical
I mean all the styles of the above-the-fold content visible on the page load.&lt;/p&gt;
&lt;p&gt;This technique will make the page instantly interactable without showing
unstyled elements, while the rest of the CSS file will load in async without
blocking.&lt;/p&gt;
&lt;p&gt;There are a few NPM plugins to achieve this without going manually over files,
like &lt;a href="https://github.com/addyosmani/critical"&gt;Critical&lt;/a&gt;, &lt;a href="https://github.com/filamentgroup/criticalCSS"&gt;CriticalCSS&lt;/a&gt;&amp;hellip;&lt;/p&gt;
&lt;h2 id="solution-2"&gt;Solution 2:&lt;/h2&gt;
&lt;p&gt;A quicker solution would be hiding the HTML element while the CSS file is being
loaded. This not-so-great solution would make the time-to-interactivity longer,
but it will avoid showing unstyled elements and CLS.&lt;/p&gt;
&lt;p&gt;First we will set the visibility rule to hidden in the head of the HTML file, this will hide the page while the CSS file is being downloaded:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;head&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ...
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;style&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;html&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;visibility&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;hidden&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;style&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/&lt;span style="color:#f92672"&gt;head&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then, in the CSS file, we&amp;rsquo;ll set the visibility to visible, which when loaded will
automatically show the page already styled.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-css" data-lang="css"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;html&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;visibility&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;visible&lt;/span&gt; &lt;span style="color:#75715e"&gt;!important&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Depending on the structure, urgency, and importance of the project you can
always consider one of the two solutions.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/css-solutions-fouc/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title>Embedding YouTube Videos Without Impacting Web Perf</title><link>https://bojanvidanovic.com/blog/an-alternative-way-of-embedding-youtube-videos-without-impacting-web-perf/</link><guid isPermaLink="true">https://bojanvidanovic.com/blog/an-alternative-way-of-embedding-youtube-videos-without-impacting-web-perf/</guid><pubDate>Tue, 22 Sep 2020 19:42:27 +0200</pubDate><dc:creator>Bojan Vidanovic</dc:creator><category>blog</category><description>&lt;p&gt;Yesterday I had to embed some YouTube videos in one of the articles I was
writing about &lt;a href="https://devandgear.com/13-useful-project-ideas-for-your-raspberry-pi-with-tutorials/"&gt;Raspberry Pi&amp;rsquo;s&lt;/a&gt;,
and since I usually do not embed videos that often and rarely
multiple of them, I never really upset about the performances penalty for one iframe,
but after I added multiple of them I saw a massive web page loading degradation.&lt;/p&gt;
&lt;p&gt;So it occurred to me how could I embed YouTube videos more efficiently. The first
idea that came into my mind was lazy-loading, but that would require JavaScript
and listen for scrolling events, so that idea turned me off immediately.&lt;/p&gt;
&lt;p&gt;The next idea was how about just showing a link to the YouTube page with
a video thumbnail inside. Now that looked more efficient to me.&lt;/p&gt;
&lt;p&gt;So I started Duck Ducking the web for YouTube thumbnails API if there
was any publicly available without registering for the dev program and all those
hassles. To my surprise I found the answer immediately on the stack overflow
question &lt;a href="https://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api"&gt;How do I get a YouTube video thumbnail from the YouTube
API?&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Apparently, you can get a thumbnail image for any YouTube video from one of their subdomains like
&lt;a href="https://img.youtube.com"&gt;https://img.youtube.com&lt;/a&gt; or &lt;a href="https://i.ytimg.com"&gt;https://i.ytimg.com&lt;/a&gt;. Now, this probably isn&amp;rsquo;t the best way, since at any moment
Google could change or limit access to these domains. So a more secure and proper way would be signing up for the &lt;a href="https://developers.google.com/youtube/v3/"&gt;Data API&lt;/a&gt; and have peace of mind, but that I wanted a quick solution so I accepted the risk for the moment.&lt;/p&gt;
&lt;p&gt;Back to the YouTube video images! This &lt;a href="https://stackoverflow.com/a/20542029"&gt;answer&lt;/a&gt; on Stack Overflow has put a nice table on
all sizes of images you can access:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Width | Height | URL
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ------|--------|----
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 120 | 90 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/1.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 120 | 90 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/2.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 120 | 90 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/3.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 120 | 90 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/default.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 320 | 180 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/mq1.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 320 | 180 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/mq2.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 320 | 180 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/mq3.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 320 | 180 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/mqdefault.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 480 | 360 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/0.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 480 | 360 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/hq1.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 480 | 360 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/hq2.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 480 | 360 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/hq3.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 480 | 360 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/hqdefault.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 640 | 480 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/sd1.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 640 | 480 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/sd2.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 640 | 480 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/sd3.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 640 | 480 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/sddefault.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 1280 | 720 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/hq720.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 1920 | 1080 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/maxresdefault.jpg&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And in addition, all these images are also provided in WebP image format which
is nice, the problem is it&amp;rsquo;s not available for images so it&amp;rsquo;s better to stick with jpg format.&lt;/p&gt;
&lt;h2 id="html-markup"&gt;HTML markup&lt;/h2&gt;
&lt;p&gt;Now that I can access the video thumbnails, I did quick markup of how the code
would look like:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;div&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;class&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;youtube&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;a&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;href&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://www.youtube.com/watch?v=VIDEO_ID&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;target&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;_blank&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;figure&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;img&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;src&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://img.youtube.com/vi/VIDEO_ID/maxresdefault.jpg&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;alt&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;VIDEO_TITLE&amp;#34;&lt;/span&gt; /&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;figcaption&lt;/span&gt;&amp;gt;VIDEO_TITLE&amp;lt;/&lt;span style="color:#f92672"&gt;figcaption&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;figure&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;a&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/&lt;span style="color:#f92672"&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;But considering the different image sizes, we could easily make a responsive
markup using the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset"&gt;srcset&lt;/a&gt; property.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;div&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;class&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;youtube&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;a&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;href&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://www.youtube.com/watch?v=VIDEO_ID&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;target&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;_blank&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;figure&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;img&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;src&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://img.youtube.com/vi/VIDEO_ID/default.jpg&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;srcset&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://img.youtube.com/vi/VIDEO_ID/mqdefault.jpg 320w,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; https://img.youtube.com/vi/VIDEO_ID/hqdefault.jpg 480w,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; https://img.youtube.com/vi/VIDEO_ID/sddefault.jpg 640w,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; https://img.youtube.com/vi/VIDEO_ID/hq720.jpg 1280w,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; https://img.youtube.com/vi/VIDEO_ID/maxresdefault.jpg 1920w&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;alt&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;VIDEO_TITLE&amp;#34;&lt;/span&gt; /&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;figcaption&lt;/span&gt;&amp;gt;VIDEO_TITLE&amp;lt;/&lt;span style="color:#f92672"&gt;figcaption&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;figure&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;a&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/&lt;span style="color:#f92672"&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="css-styling"&gt;CSS styling&lt;/h2&gt;
&lt;p&gt;My goal was to make it look as much as possible as the YouTube iframe without
complicating the HTML markup too much. I managed to do that with some use of &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements"&gt;CSS
pseudo-elements&lt;/a&gt;, for example, to add the shadow under the title of the video and make it more readable, and place the &lt;a href="https://github.com/feathericons/feather/blob/master/icons/youtube.svg"&gt;YouTube SVG icon&lt;/a&gt; from the beautiful &lt;a href="https://feathericons.com/"&gt;Feather Icons&lt;/a&gt; as the play button.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-css" data-lang="css"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;.&lt;span style="color:#a6e22e"&gt;youtube&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;position&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;relative&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;a&lt;/span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;text-decoration&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;none&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;amp;:before&lt;/span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;content&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#39;&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;width&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;%&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;height&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;20&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;%&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;position&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;absolute&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;top&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;background-image&lt;/span&gt;: linear-gradient(&lt;span style="color:#ae81ff"&gt;#000&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;transparent&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;:&lt;span style="color:#a6e22e"&gt;after&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;content&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;background&lt;/span&gt;: url(&lt;span style="color:#e6db74"&gt;https://cdn.jsdelivr.net/npm/feather-icons@4.28.0/dist/icons/youtube.svg&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;no-repeat&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;background-position&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;center&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;background-size&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;px&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;px&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;position&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;absolute&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;top&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;bottom&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;right&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;left&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;img&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;width&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;%&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;height&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;auto&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;figure&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;margin&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;figcaption&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;position&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;absolute&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;top&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;px&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;left&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;px&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;right&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;px&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;color&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;white&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;white-space&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;nowrap&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;overflow&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;hidden&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;text-overflow&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;ellipsis&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;text-align&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;left&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="the-result"&gt;The result&lt;/h2&gt;
&lt;p&gt;The result is very pleasing aesthetically and offering some big performance improvements at the same time, the only trade-off to this approach is that the visitors
will not be able the play the video directly from the page but they will be redirected to the YouTube page, and I can live with that.&lt;/p&gt;
&lt;p&gt;Take a look at the &lt;a href="https://codepen.io/bojanvidanovic/pen/bGpOBwW?editors=1100"&gt;demo on Codepen&lt;/a&gt;, or visit &lt;a href="https://devandgear.com/13-useful-project-ideas-for-your-raspberry-pi-with-tutorials/"&gt;this page on Dev &amp;amp; Gear&lt;/a&gt; to see it in production.&lt;/p&gt;
&lt;p class="codepen" data-height="500" data-theme-id="light" data-default-tab="result" data-user="bojanvidanovic" data-slug-hash="bGpOBwW" data-preview="true" style="height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;" data-pen-title="An alternative way of embedding YouTube videos without impacting web perf"&gt;
&lt;span&gt;See the Pen &lt;a href="https://codepen.io/bojanvidanovic/pen/bGpOBwW"&gt;
An alternative way of embedding YouTube videos without impacting web perf&lt;/a&gt; by Bojan Vidanovic (&lt;a href="https://codepen.io/bojanvidanovic"&gt;@bojanvidanovic&lt;/a&gt;)
on &lt;a href="https://codepen.io"&gt;CodePen&lt;/a&gt;.&lt;/span&gt;
&lt;/p&gt;
&lt;h2 id="conlusion"&gt;Conlusion&lt;/h2&gt;
&lt;p&gt;This technique at the end is a very simple one, and it can be easily implemented in any framework as a reusable component. I implemented it in &lt;a href="https://gohugo.io"&gt;Hugo&lt;/a&gt; as a shortcode for example. Anyway, I believe that every code has some room for improvement just like this one, so if you think this can be done better let me know in the comments.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/an-alternative-way-of-embedding-youtube-videos-without-impacting-web-perf/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;Yesterday I had to embed some YouTube videos in one of the articles I was
writing about &lt;a href="https://devandgear.com/13-useful-project-ideas-for-your-raspberry-pi-with-tutorials/"&gt;Raspberry Pi&amp;rsquo;s&lt;/a&gt;,
and since I usually do not embed videos that often and rarely
multiple of them, I never really upset about the performances penalty for one iframe,
but after I added multiple of them I saw a massive web page loading degradation.&lt;/p&gt;
&lt;p&gt;So it occurred to me how could I embed YouTube videos more efficiently. The first
idea that came into my mind was lazy-loading, but that would require JavaScript
and listen for scrolling events, so that idea turned me off immediately.&lt;/p&gt;
&lt;p&gt;The next idea was how about just showing a link to the YouTube page with
a video thumbnail inside. Now that looked more efficient to me.&lt;/p&gt;
&lt;p&gt;So I started Duck Ducking the web for YouTube thumbnails API if there
was any publicly available without registering for the dev program and all those
hassles. To my surprise I found the answer immediately on the stack overflow
question &lt;a href="https://stackoverflow.com/questions/2068344/how-do-i-get-a-youtube-video-thumbnail-from-the-youtube-api"&gt;How do I get a YouTube video thumbnail from the YouTube
API?&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Apparently, you can get a thumbnail image for any YouTube video from one of their subdomains like
&lt;a href="https://img.youtube.com"&gt;https://img.youtube.com&lt;/a&gt; or &lt;a href="https://i.ytimg.com"&gt;https://i.ytimg.com&lt;/a&gt;. Now, this probably isn&amp;rsquo;t the best way, since at any moment
Google could change or limit access to these domains. So a more secure and proper way would be signing up for the &lt;a href="https://developers.google.com/youtube/v3/"&gt;Data API&lt;/a&gt; and have peace of mind, but that I wanted a quick solution so I accepted the risk for the moment.&lt;/p&gt;
&lt;p&gt;Back to the YouTube video images! This &lt;a href="https://stackoverflow.com/a/20542029"&gt;answer&lt;/a&gt; on Stack Overflow has put a nice table on
all sizes of images you can access:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Width | Height | URL
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ------|--------|----
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 120 | 90 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/1.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 120 | 90 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/2.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 120 | 90 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/3.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 120 | 90 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/default.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 320 | 180 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/mq1.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 320 | 180 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/mq2.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 320 | 180 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/mq3.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 320 | 180 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/mqdefault.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 480 | 360 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/0.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 480 | 360 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/hq1.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 480 | 360 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/hq2.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 480 | 360 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/hq3.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 480 | 360 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/hqdefault.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 640 | 480 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/sd1.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 640 | 480 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/sd2.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 640 | 480 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/sd3.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 640 | 480 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/sddefault.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 1280 | 720 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/hq720.jpg
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 1920 | 1080 | //i.ytimg.com/vi/&amp;lt;VIDEO ID&amp;gt;/maxresdefault.jpg&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;And in addition, all these images are also provided in WebP image format which
is nice, the problem is it&amp;rsquo;s not available for images so it&amp;rsquo;s better to stick with jpg format.&lt;/p&gt;
&lt;h2 id="html-markup"&gt;HTML markup&lt;/h2&gt;
&lt;p&gt;Now that I can access the video thumbnails, I did quick markup of how the code
would look like:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;div&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;class&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;youtube&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;a&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;href&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://www.youtube.com/watch?v=VIDEO_ID&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;target&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;_blank&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;figure&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;img&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;src&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://img.youtube.com/vi/VIDEO_ID/maxresdefault.jpg&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;alt&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;VIDEO_TITLE&amp;#34;&lt;/span&gt; /&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;figcaption&lt;/span&gt;&amp;gt;VIDEO_TITLE&amp;lt;/&lt;span style="color:#f92672"&gt;figcaption&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;figure&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;a&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/&lt;span style="color:#f92672"&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;But considering the different image sizes, we could easily make a responsive
markup using the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset"&gt;srcset&lt;/a&gt; property.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;div&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;class&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;youtube&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;a&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;href&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://www.youtube.com/watch?v=VIDEO_ID&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;target&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;_blank&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;figure&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;img&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;src&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://img.youtube.com/vi/VIDEO_ID/default.jpg&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;srcset&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://img.youtube.com/vi/VIDEO_ID/mqdefault.jpg 320w,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; https://img.youtube.com/vi/VIDEO_ID/hqdefault.jpg 480w,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; https://img.youtube.com/vi/VIDEO_ID/sddefault.jpg 640w,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; https://img.youtube.com/vi/VIDEO_ID/hq720.jpg 1280w,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt; https://img.youtube.com/vi/VIDEO_ID/maxresdefault.jpg 1920w&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;alt&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;VIDEO_TITLE&amp;#34;&lt;/span&gt; /&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;figcaption&lt;/span&gt;&amp;gt;VIDEO_TITLE&amp;lt;/&lt;span style="color:#f92672"&gt;figcaption&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;figure&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;a&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/&lt;span style="color:#f92672"&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="css-styling"&gt;CSS styling&lt;/h2&gt;
&lt;p&gt;My goal was to make it look as much as possible as the YouTube iframe without
complicating the HTML markup too much. I managed to do that with some use of &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements"&gt;CSS
pseudo-elements&lt;/a&gt;, for example, to add the shadow under the title of the video and make it more readable, and place the &lt;a href="https://github.com/feathericons/feather/blob/master/icons/youtube.svg"&gt;YouTube SVG icon&lt;/a&gt; from the beautiful &lt;a href="https://feathericons.com/"&gt;Feather Icons&lt;/a&gt; as the play button.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-css" data-lang="css"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;.&lt;span style="color:#a6e22e"&gt;youtube&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;position&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;relative&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;a&lt;/span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;text-decoration&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;none&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;amp;:before&lt;/span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;content&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#39;&amp;#39;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;width&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;%&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;height&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;20&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;%&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;position&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;absolute&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;top&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;background-image&lt;/span&gt;: linear-gradient(&lt;span style="color:#ae81ff"&gt;#000&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;transparent&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt;:&lt;span style="color:#a6e22e"&gt;after&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;content&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;background&lt;/span&gt;: url(&lt;span style="color:#e6db74"&gt;https://cdn.jsdelivr.net/npm/feather-icons@4.28.0/dist/icons/youtube.svg&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;no-repeat&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;background-position&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;center&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;background-size&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;px&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;px&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;position&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;absolute&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;top&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;bottom&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;right&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;left&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#960050;background-color:#1e0010"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;img&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;width&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;%&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;height&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;auto&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;figure&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;margin&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;figcaption&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;position&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;absolute&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;top&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;px&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;left&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;px&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;right&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;px&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;color&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;white&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;white-space&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;nowrap&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;overflow&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;hidden&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;text-overflow&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;ellipsis&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;text-align&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;left&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#960050;background-color:#1e0010"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="the-result"&gt;The result&lt;/h2&gt;
&lt;p&gt;The result is very pleasing aesthetically and offering some big performance improvements at the same time, the only trade-off to this approach is that the visitors
will not be able the play the video directly from the page but they will be redirected to the YouTube page, and I can live with that.&lt;/p&gt;
&lt;p&gt;Take a look at the &lt;a href="https://codepen.io/bojanvidanovic/pen/bGpOBwW?editors=1100"&gt;demo on Codepen&lt;/a&gt;, or visit &lt;a href="https://devandgear.com/13-useful-project-ideas-for-your-raspberry-pi-with-tutorials/"&gt;this page on Dev &amp;amp; Gear&lt;/a&gt; to see it in production.&lt;/p&gt;
&lt;p class="codepen" data-height="500" data-theme-id="light" data-default-tab="result" data-user="bojanvidanovic" data-slug-hash="bGpOBwW" data-preview="true" style="height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;" data-pen-title="An alternative way of embedding YouTube videos without impacting web perf"&gt;
&lt;span&gt;See the Pen &lt;a href="https://codepen.io/bojanvidanovic/pen/bGpOBwW"&gt;
An alternative way of embedding YouTube videos without impacting web perf&lt;/a&gt; by Bojan Vidanovic (&lt;a href="https://codepen.io/bojanvidanovic"&gt;@bojanvidanovic&lt;/a&gt;)
on &lt;a href="https://codepen.io"&gt;CodePen&lt;/a&gt;.&lt;/span&gt;
&lt;/p&gt;
&lt;h2 id="conlusion"&gt;Conlusion&lt;/h2&gt;
&lt;p&gt;This technique at the end is a very simple one, and it can be easily implemented in any framework as a reusable component. I implemented it in &lt;a href="https://gohugo.io"&gt;Hugo&lt;/a&gt; as a shortcode for example. Anyway, I believe that every code has some room for improvement just like this one, so if you think this can be done better let me know in the comments.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/an-alternative-way-of-embedding-youtube-videos-without-impacting-web-perf/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title>My Top Productivity Apps and Tools in 2020</title><link>https://bojanvidanovic.com/blog/my-top-productivity-apps-and-tools-in-2020/</link><guid isPermaLink="true">https://bojanvidanovic.com/blog/my-top-productivity-apps-and-tools-in-2020/</guid><pubDate>Wed, 02 Sep 2020 09:27:56 +0200</pubDate><dc:creator>Bojan Vidanovic</dc:creator><category>blog</category><description>&lt;p&gt;I consider myself as a productivity junkie, as I’m always on the lookout for
a better, more efficient way of accomplishing my tasks and staying on the track
of projects, maybe because programming taught me to be organized and efficient
in order to avoid chaos. But as am I working on multiple projects
simultaneously, the organization is the key to have a stress-free day and check
out all the tasks.&lt;/p&gt;
&lt;p&gt;So I like periodically to invest some time in trying new tools and methods.
During the years, I have flipped through so many apps, some stayed with me until
this day, many I have discarded. So I never had the same routine of working, every year it changed.&lt;/p&gt;
&lt;p&gt;Recently I have experimented a lot with CLI apps since I spend most of my time in Tmux/Vim, and &lt;a href="https://taskwarrior.org/"&gt;TaskWarrior&lt;/a&gt; struck me the most. I have not added it to the list as I&amp;rsquo;m still in the process of learning its workflow and commands, but it&amp;rsquo;s the kind of simplicity I&amp;rsquo;m looking for in an app. It&amp;rsquo;s one of the kinds of apps that follow the Unix philosophy:&lt;/p&gt;
&lt;blockquote cite="https://en.wikipedia.org/wiki/Unix_philosophy"&gt;
&lt;p&gt;
Write programs that do one thing and do it well.
&lt;/p&gt;
&lt;footer&gt;
- Peter H. Salus, &lt;cite&gt;A Quarter-Century of Unix&lt;/cite&gt;
&lt;/footer&gt;
&lt;/blockquote&gt;
&lt;p&gt;As of today in 2020, I decided to share the list of tools and apps I use the
most for a personal and professional organization:&lt;/p&gt;
&lt;h2 id="moleskine-notebook"&gt;Moleskine notebook&lt;/h2&gt;
&lt;p&gt;Personally, I think sometimes only a simple notebook is all that you need. I got my first &lt;a href="https://amzn.to/3gOWDaz"&gt;Moleskine Notebook&lt;/a&gt; back
in 2013 and changed me completely, I never looked back and always have one with me. What is great about physical notebooks is they influence
my thinking differently than an app, not sure how to explain it but having the
pen and a paper trigger my creative thinking in a different way. I use it mostly for brainstorming, writing down ideas and logging my workouts.&lt;/p&gt;
&lt;p&gt;I had different brands of notebooks but what I like most about Moleskine are the quality of the paper and different sizes and styles,
my favorite has always been the &lt;a href="https://amzn.to/2Dp9i6w"&gt;Pocket version&lt;/a&gt;, small and yet spacious to
be portable everywhere with me.&lt;/p&gt;
&lt;p&gt;If you are interested in getting a notebook, see an &lt;a href="http://www.openculture.com/2018/08/leonardo-da-vincis-earliest-notebooks-now-digitized-and-made-free-online.html"&gt;example&lt;/a&gt; of how Leonardo da Vinci used his notebooks.&lt;/p&gt;
&lt;h2 id="post-it"&gt;Post-it&lt;/h2&gt;
&lt;p&gt;I can&amp;rsquo;t live without them, I have them on my fridge, on my desk, on my monitor, on my doors.. everywhere!
&lt;a href="https://amzn.to/3hPHEhS"&gt;Post-it&lt;/a&gt; makes it really easy to remind me of things I have to do, just
need to attach them where visible. For the important tasks, I find them much
more effective than an app notification.&lt;/p&gt;
&lt;p&gt;Another powerful type of Post-it are &lt;a href="https://amzn.to/3gQXQyb"&gt;colorful Post-it&amp;rsquo;s&lt;/a&gt;, I use them a lot in software development by assigning a different color to a different category of tasks, for example: bug, feature, to-do, etc.&lt;/p&gt;
&lt;h2 id="bear-app"&gt;Bear App&lt;/h2&gt;
&lt;p&gt;The &lt;a href="https://bear.app/"&gt;Bear App&lt;/a&gt; is one of my absolute favorite apps for macOS and iOS.
It&amp;rsquo;s a note-taking app beautifully designed and with some key features I use
the most:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Tags&lt;/li&gt;
&lt;li&gt;Encryption&lt;/li&gt;
&lt;li&gt;Touch ID support&lt;/li&gt;
&lt;li&gt;Focus mode&lt;/li&gt;
&lt;li&gt;And much more&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It&amp;rsquo;s very fast which is another key point for me!&lt;/p&gt;
&lt;p&gt;I mostly use the Bear app to take notes on
the go, some to-do&amp;rsquo;s, and keep information about the projects I am working on.
I highly recommended it if you are on the Apple ecosystem.&lt;/p&gt;
&lt;h2 id="mind-node"&gt;Mind node&lt;/h2&gt;
&lt;p&gt;Very often before starting a project, it&amp;rsquo;s good to have a clear picture of the
idea. That can make a big difference in the project and tasks organization.
But converting a mental picture in a complex system of dots is not easy, that&amp;rsquo;s
where &lt;a href="https://mindnode.com/"&gt;Mind node&lt;/a&gt; makes its way through. Like the Bear
app, Mind Node is my another essential app for macOS and iOS. It&amp;rsquo;s simple,
beautiful, and fast.&lt;/p&gt;
&lt;p&gt;I use it always to plan personal and professional projects, it gives me a clear picture of
what I&amp;rsquo;m working on and that helps a lot in thinking.&lt;/p&gt;
&lt;h2 id="reminders-by-apple"&gt;Reminders by Apple&lt;/h2&gt;
&lt;p&gt;I switched through many to-do apps, the lastest I have used were &lt;a href="https://www.any.do/"&gt;Any.do&lt;/a&gt; and
&lt;a href="https://www.wunderlist.com/"&gt;Wunderlist&lt;/a&gt; which later was acquired by Microsoft
and announced the end to start building &lt;a href="https://todo.microsoft.com"&gt;Microsoft To Do&lt;/a&gt;,
which I also tried.&lt;/p&gt;
&lt;p&gt;But out of them all, also those not mentioned, Any.do does the
best job, but what turned me off was that recurring tasks are a premium feature,
which requires a monthly subscription to service. And the fact that the MacOS app
is a hungry Electon web app. Probably later one more than the first point.&lt;/p&gt;
&lt;p&gt;So after Apple updated the &lt;a href="https://apps.apple.com/us/app/reminders/id1108187841"&gt;Reminders app&lt;/a&gt; for both macOS and iOS, I was immediately sold, because it offers plenty of features, even the recurring tasks built as native apps on both platforms at no additional costs.&lt;/p&gt;
&lt;h2 id="concluding"&gt;Concluding&lt;/h2&gt;
&lt;p&gt;As you can see I don&amp;rsquo;t like all-in-one apps, bloated software, or complex
tools. I like to keep the workflow as simple as possible.&lt;/p&gt;
&lt;p&gt;Do you use any of these tools or apps? Or have any suggestions? Let me know in
the comment.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/my-top-productivity-apps-and-tools-in-2020/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;I consider myself as a productivity junkie, as I’m always on the lookout for
a better, more efficient way of accomplishing my tasks and staying on the track
of projects, maybe because programming taught me to be organized and efficient
in order to avoid chaos. But as am I working on multiple projects
simultaneously, the organization is the key to have a stress-free day and check
out all the tasks.&lt;/p&gt;
&lt;p&gt;So I like periodically to invest some time in trying new tools and methods.
During the years, I have flipped through so many apps, some stayed with me until
this day, many I have discarded. So I never had the same routine of working, every year it changed.&lt;/p&gt;
&lt;p&gt;Recently I have experimented a lot with CLI apps since I spend most of my time in Tmux/Vim, and &lt;a href="https://taskwarrior.org/"&gt;TaskWarrior&lt;/a&gt; struck me the most. I have not added it to the list as I&amp;rsquo;m still in the process of learning its workflow and commands, but it&amp;rsquo;s the kind of simplicity I&amp;rsquo;m looking for in an app. It&amp;rsquo;s one of the kinds of apps that follow the Unix philosophy:&lt;/p&gt;
&lt;blockquote cite="https://en.wikipedia.org/wiki/Unix_philosophy"&gt;
&lt;p&gt;
Write programs that do one thing and do it well.
&lt;/p&gt;
&lt;footer&gt;
- Peter H. Salus, &lt;cite&gt;A Quarter-Century of Unix&lt;/cite&gt;
&lt;/footer&gt;
&lt;/blockquote&gt;
&lt;p&gt;As of today in 2020, I decided to share the list of tools and apps I use the
most for a personal and professional organization:&lt;/p&gt;
&lt;h2 id="moleskine-notebook"&gt;Moleskine notebook&lt;/h2&gt;
&lt;p&gt;Personally, I think sometimes only a simple notebook is all that you need. I got my first &lt;a href="https://amzn.to/3gOWDaz"&gt;Moleskine Notebook&lt;/a&gt; back
in 2013 and changed me completely, I never looked back and always have one with me. What is great about physical notebooks is they influence
my thinking differently than an app, not sure how to explain it but having the
pen and a paper trigger my creative thinking in a different way. I use it mostly for brainstorming, writing down ideas and logging my workouts.&lt;/p&gt;
&lt;p&gt;I had different brands of notebooks but what I like most about Moleskine are the quality of the paper and different sizes and styles,
my favorite has always been the &lt;a href="https://amzn.to/2Dp9i6w"&gt;Pocket version&lt;/a&gt;, small and yet spacious to
be portable everywhere with me.&lt;/p&gt;
&lt;p&gt;If you are interested in getting a notebook, see an &lt;a href="http://www.openculture.com/2018/08/leonardo-da-vincis-earliest-notebooks-now-digitized-and-made-free-online.html"&gt;example&lt;/a&gt; of how Leonardo da Vinci used his notebooks.&lt;/p&gt;
&lt;h2 id="post-it"&gt;Post-it&lt;/h2&gt;
&lt;p&gt;I can&amp;rsquo;t live without them, I have them on my fridge, on my desk, on my monitor, on my doors.. everywhere!
&lt;a href="https://amzn.to/3hPHEhS"&gt;Post-it&lt;/a&gt; makes it really easy to remind me of things I have to do, just
need to attach them where visible. For the important tasks, I find them much
more effective than an app notification.&lt;/p&gt;
&lt;p&gt;Another powerful type of Post-it are &lt;a href="https://amzn.to/3gQXQyb"&gt;colorful Post-it&amp;rsquo;s&lt;/a&gt;, I use them a lot in software development by assigning a different color to a different category of tasks, for example: bug, feature, to-do, etc.&lt;/p&gt;
&lt;h2 id="bear-app"&gt;Bear App&lt;/h2&gt;
&lt;p&gt;The &lt;a href="https://bear.app/"&gt;Bear App&lt;/a&gt; is one of my absolute favorite apps for macOS and iOS.
It&amp;rsquo;s a note-taking app beautifully designed and with some key features I use
the most:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Tags&lt;/li&gt;
&lt;li&gt;Encryption&lt;/li&gt;
&lt;li&gt;Touch ID support&lt;/li&gt;
&lt;li&gt;Focus mode&lt;/li&gt;
&lt;li&gt;And much more&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It&amp;rsquo;s very fast which is another key point for me!&lt;/p&gt;
&lt;p&gt;I mostly use the Bear app to take notes on
the go, some to-do&amp;rsquo;s, and keep information about the projects I am working on.
I highly recommended it if you are on the Apple ecosystem.&lt;/p&gt;
&lt;h2 id="mind-node"&gt;Mind node&lt;/h2&gt;
&lt;p&gt;Very often before starting a project, it&amp;rsquo;s good to have a clear picture of the
idea. That can make a big difference in the project and tasks organization.
But converting a mental picture in a complex system of dots is not easy, that&amp;rsquo;s
where &lt;a href="https://mindnode.com/"&gt;Mind node&lt;/a&gt; makes its way through. Like the Bear
app, Mind Node is my another essential app for macOS and iOS. It&amp;rsquo;s simple,
beautiful, and fast.&lt;/p&gt;
&lt;p&gt;I use it always to plan personal and professional projects, it gives me a clear picture of
what I&amp;rsquo;m working on and that helps a lot in thinking.&lt;/p&gt;
&lt;h2 id="reminders-by-apple"&gt;Reminders by Apple&lt;/h2&gt;
&lt;p&gt;I switched through many to-do apps, the lastest I have used were &lt;a href="https://www.any.do/"&gt;Any.do&lt;/a&gt; and
&lt;a href="https://www.wunderlist.com/"&gt;Wunderlist&lt;/a&gt; which later was acquired by Microsoft
and announced the end to start building &lt;a href="https://todo.microsoft.com"&gt;Microsoft To Do&lt;/a&gt;,
which I also tried.&lt;/p&gt;
&lt;p&gt;But out of them all, also those not mentioned, Any.do does the
best job, but what turned me off was that recurring tasks are a premium feature,
which requires a monthly subscription to service. And the fact that the MacOS app
is a hungry Electon web app. Probably later one more than the first point.&lt;/p&gt;
&lt;p&gt;So after Apple updated the &lt;a href="https://apps.apple.com/us/app/reminders/id1108187841"&gt;Reminders app&lt;/a&gt; for both macOS and iOS, I was immediately sold, because it offers plenty of features, even the recurring tasks built as native apps on both platforms at no additional costs.&lt;/p&gt;
&lt;h2 id="concluding"&gt;Concluding&lt;/h2&gt;
&lt;p&gt;As you can see I don&amp;rsquo;t like all-in-one apps, bloated software, or complex
tools. I like to keep the workflow as simple as possible.&lt;/p&gt;
&lt;p&gt;Do you use any of these tools or apps? Or have any suggestions? Let me know in
the comment.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/my-top-productivity-apps-and-tools-in-2020/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title>How to Find and Replace All in Vim With Substitute Command</title><link>https://bojanvidanovic.com/blog/how-to-find-and-replace-all-in-vim-with-substitute-command/</link><guid isPermaLink="true">https://bojanvidanovic.com/blog/how-to-find-and-replace-all-in-vim-with-substitute-command/</guid><pubDate>Fri, 28 Aug 2020 12:42:54 +0200</pubDate><dc:creator>Bojan Vidanovic</dc:creator><category>blog</category><description>&lt;p&gt;Following my last tutorial on Vim, &amp;ldquo;&lt;a href="https://bojanvidanovic.com/posts/5-most-essential-vim-commands-for-beginners/"&gt;5 Most Essential Vim Commands for
Beginners&lt;/a&gt;&amp;rdquo; if you haven&amp;rsquo;t read make sure to check it out. In this article,
I wanted to share one of the most useful commands you may find trivial to use
in any text editor and that is a substitute command. If you have used &lt;a href="https://www.sublimetext.com/"&gt;Sublime
Text&lt;/a&gt;, chances are you have used Replace toolbar, which find and replace the
desired string or all occurrences of the string in the current file, well, that&amp;rsquo;s just what
substitute does. At any point in your coding career, you will find your self in
a need to change a large selection of strings. Doing it manually is one
solution, doing it pragmatically is another better solution. And Vim offers an
extremely fast and efficient way of doing it with the substitute command.&lt;/p&gt;
&lt;ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-9401752794288868"
data-ad-slot="2055838653"&gt;&lt;/ins&gt;
&lt;h2 id="syntax"&gt;Syntax&lt;/h2&gt;
&lt;p&gt;Substitute command is invoked from the command mode, by calling &lt;code&gt;:s&lt;/code&gt;, which
stands for s[ubstitute]. But before any executions, it&amp;rsquo;s better to start with
reading the Vim&amp;rsquo;s documentation for the better get knowing.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:help :substitute
&lt;/code&gt;&lt;/pre&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;:&lt;span style="color:#f92672"&gt;[&lt;/span&gt;range&lt;span style="color:#f92672"&gt;]&lt;/span&gt;s&lt;span style="color:#f92672"&gt;[&lt;/span&gt;ubstitute&lt;span style="color:#f92672"&gt;]&lt;/span&gt;/&lt;span style="color:#f92672"&gt;{&lt;/span&gt;pattern&lt;span style="color:#f92672"&gt;}&lt;/span&gt;/&lt;span style="color:#f92672"&gt;{&lt;/span&gt;string&lt;span style="color:#f92672"&gt;}&lt;/span&gt;/&lt;span style="color:#f92672"&gt;[&lt;/span&gt;flags&lt;span style="color:#f92672"&gt;]&lt;/span&gt; &lt;span style="color:#f92672"&gt;[&lt;/span&gt;count&lt;span style="color:#f92672"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;For each line in &lt;span style="color:#f92672"&gt;[&lt;/span&gt;range&lt;span style="color:#f92672"&gt;]&lt;/span&gt; replace a match of &lt;span style="color:#f92672"&gt;{&lt;/span&gt;pattern&lt;span style="color:#f92672"&gt;}&lt;/span&gt; with &lt;span style="color:#f92672"&gt;{&lt;/span&gt;string&lt;span style="color:#f92672"&gt;}&lt;/span&gt;.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;For the &lt;span style="color:#f92672"&gt;{&lt;/span&gt;pattern&lt;span style="color:#f92672"&gt;}&lt;/span&gt; see pattern.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;{&lt;/span&gt;string&lt;span style="color:#f92672"&gt;}&lt;/span&gt; can be a literal string, or something special; see
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sub-replace-special.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;When &lt;span style="color:#f92672"&gt;[&lt;/span&gt;range&lt;span style="color:#f92672"&gt;]&lt;/span&gt; and &lt;span style="color:#f92672"&gt;[&lt;/span&gt;count&lt;span style="color:#f92672"&gt;]&lt;/span&gt; are omitted, replace in the current line only. When
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt;count&lt;span style="color:#f92672"&gt;]&lt;/span&gt; is given, replace in &lt;span style="color:#f92672"&gt;[&lt;/span&gt;count&lt;span style="color:#f92672"&gt;]&lt;/span&gt; lines, starting with the last line in
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt;range&lt;span style="color:#f92672"&gt;]&lt;/span&gt;.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;When &lt;span style="color:#f92672"&gt;[&lt;/span&gt;range&lt;span style="color:#f92672"&gt;]&lt;/span&gt; is omitted start in the current line. E939
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt;count&lt;span style="color:#f92672"&gt;]&lt;/span&gt; must be a positive number. Also, see cmdline-ranges.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;See :s_flags &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; &lt;span style="color:#f92672"&gt;[&lt;/span&gt;flags&lt;span style="color:#f92672"&gt;]&lt;/span&gt;.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;The delimiter doesn&lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;t need to be /, see pattern-delimiter.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So basically, the most basic usage would be:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:s/search/replace
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="examples"&gt;Examples&lt;/h2&gt;
&lt;h3 id="find-and-replace-the-first-occurrence-in-the-current-line"&gt;Find and replace the first occurrence in the current line&lt;/h3&gt;
&lt;p&gt;When the range parameter is not provided to the function, it will find and
replace only the first occurrence in the current line:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:s/search/replace
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="find-and-replace-all-occurrences"&gt;Find and replace all occurrences&lt;/h3&gt;
&lt;p&gt;By adding the percentage sign in front of the s we are giving the max range, so
the function will look up through the whole file and replace them:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:%s/search/replace
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="find-and-replace-all-occurrences-in-the-range-of-lines"&gt;Find and replace all occurrences in the range of lines&lt;/h3&gt;
&lt;p&gt;We can also limit the function lookup only to some lines [start, end], which
will find and replace all the occurrences only inside those lines:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:1,10s/search/replace
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="change-only-whole-words-exactly-matching"&gt;Change only whole words exactly matching&lt;/h3&gt;
&lt;p&gt;To avoid removing wrong selections, we can select only the whole words using
regex:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:%s/\&amp;lt;foo\&amp;gt;/bar/
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="flags"&gt;Flags&lt;/h2&gt;
&lt;p&gt;Flags offer some caution and control in executing the substitute command, for
example:&lt;/p&gt;
&lt;h3 id="global-g"&gt;Global (g)&lt;/h3&gt;
&lt;p&gt;This flag will look throughout the whole files, assuming the default setting
for the &amp;lsquo;gdefault&amp;rsquo; and &amp;rsquo;edcompatible&amp;rsquo; option is off.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:%s/search/replace/g
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="confirmation-c"&gt;Confirmation (c)&lt;/h3&gt;
&lt;p&gt;By adding c flag the command will ask for confirmation for every occurrence
before changing.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:s/search/replace/c
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="insensitive-i"&gt;Insensitive (i)&lt;/h3&gt;
&lt;p&gt;This will set up case insensitive lookup order.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:s/search/replace/i
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="sensitive-i"&gt;Sensitive (I)&lt;/h3&gt;
&lt;p&gt;Meanwhile capital I will set up case insensitive lookup order.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:s/search/replace/I
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="conslusion"&gt;Conslusion&lt;/h2&gt;
&lt;p&gt;This is the most basic usage of the substitute command, for the more advance
usage I recommend reading the documentation and &lt;a href="https://vim.fandom.com/wiki/Search_and_replace"&gt;Vim Fandom article&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/how-to-find-and-replace-all-in-vim-with-substitute-command/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;Following my last tutorial on Vim, &amp;ldquo;&lt;a href="https://bojanvidanovic.com/posts/5-most-essential-vim-commands-for-beginners/"&gt;5 Most Essential Vim Commands for
Beginners&lt;/a&gt;&amp;rdquo; if you haven&amp;rsquo;t read make sure to check it out. In this article,
I wanted to share one of the most useful commands you may find trivial to use
in any text editor and that is a substitute command. If you have used &lt;a href="https://www.sublimetext.com/"&gt;Sublime
Text&lt;/a&gt;, chances are you have used Replace toolbar, which find and replace the
desired string or all occurrences of the string in the current file, well, that&amp;rsquo;s just what
substitute does. At any point in your coding career, you will find your self in
a need to change a large selection of strings. Doing it manually is one
solution, doing it pragmatically is another better solution. And Vim offers an
extremely fast and efficient way of doing it with the substitute command.&lt;/p&gt;
&lt;ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-9401752794288868"
data-ad-slot="2055838653"&gt;&lt;/ins&gt;
&lt;h2 id="syntax"&gt;Syntax&lt;/h2&gt;
&lt;p&gt;Substitute command is invoked from the command mode, by calling &lt;code&gt;:s&lt;/code&gt;, which
stands for s[ubstitute]. But before any executions, it&amp;rsquo;s better to start with
reading the Vim&amp;rsquo;s documentation for the better get knowing.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:help :substitute
&lt;/code&gt;&lt;/pre&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;:&lt;span style="color:#f92672"&gt;[&lt;/span&gt;range&lt;span style="color:#f92672"&gt;]&lt;/span&gt;s&lt;span style="color:#f92672"&gt;[&lt;/span&gt;ubstitute&lt;span style="color:#f92672"&gt;]&lt;/span&gt;/&lt;span style="color:#f92672"&gt;{&lt;/span&gt;pattern&lt;span style="color:#f92672"&gt;}&lt;/span&gt;/&lt;span style="color:#f92672"&gt;{&lt;/span&gt;string&lt;span style="color:#f92672"&gt;}&lt;/span&gt;/&lt;span style="color:#f92672"&gt;[&lt;/span&gt;flags&lt;span style="color:#f92672"&gt;]&lt;/span&gt; &lt;span style="color:#f92672"&gt;[&lt;/span&gt;count&lt;span style="color:#f92672"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;For each line in &lt;span style="color:#f92672"&gt;[&lt;/span&gt;range&lt;span style="color:#f92672"&gt;]&lt;/span&gt; replace a match of &lt;span style="color:#f92672"&gt;{&lt;/span&gt;pattern&lt;span style="color:#f92672"&gt;}&lt;/span&gt; with &lt;span style="color:#f92672"&gt;{&lt;/span&gt;string&lt;span style="color:#f92672"&gt;}&lt;/span&gt;.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;For the &lt;span style="color:#f92672"&gt;{&lt;/span&gt;pattern&lt;span style="color:#f92672"&gt;}&lt;/span&gt; see pattern.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;{&lt;/span&gt;string&lt;span style="color:#f92672"&gt;}&lt;/span&gt; can be a literal string, or something special; see
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sub-replace-special.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;When &lt;span style="color:#f92672"&gt;[&lt;/span&gt;range&lt;span style="color:#f92672"&gt;]&lt;/span&gt; and &lt;span style="color:#f92672"&gt;[&lt;/span&gt;count&lt;span style="color:#f92672"&gt;]&lt;/span&gt; are omitted, replace in the current line only. When
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt;count&lt;span style="color:#f92672"&gt;]&lt;/span&gt; is given, replace in &lt;span style="color:#f92672"&gt;[&lt;/span&gt;count&lt;span style="color:#f92672"&gt;]&lt;/span&gt; lines, starting with the last line in
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt;range&lt;span style="color:#f92672"&gt;]&lt;/span&gt;.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;When &lt;span style="color:#f92672"&gt;[&lt;/span&gt;range&lt;span style="color:#f92672"&gt;]&lt;/span&gt; is omitted start in the current line. E939
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt;count&lt;span style="color:#f92672"&gt;]&lt;/span&gt; must be a positive number. Also, see cmdline-ranges.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;See :s_flags &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; &lt;span style="color:#f92672"&gt;[&lt;/span&gt;flags&lt;span style="color:#f92672"&gt;]&lt;/span&gt;.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;The delimiter doesn&lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;#39;&lt;/span&gt;t need to be /, see pattern-delimiter.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So basically, the most basic usage would be:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:s/search/replace
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="examples"&gt;Examples&lt;/h2&gt;
&lt;h3 id="find-and-replace-the-first-occurrence-in-the-current-line"&gt;Find and replace the first occurrence in the current line&lt;/h3&gt;
&lt;p&gt;When the range parameter is not provided to the function, it will find and
replace only the first occurrence in the current line:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:s/search/replace
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="find-and-replace-all-occurrences"&gt;Find and replace all occurrences&lt;/h3&gt;
&lt;p&gt;By adding the percentage sign in front of the s we are giving the max range, so
the function will look up through the whole file and replace them:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:%s/search/replace
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="find-and-replace-all-occurrences-in-the-range-of-lines"&gt;Find and replace all occurrences in the range of lines&lt;/h3&gt;
&lt;p&gt;We can also limit the function lookup only to some lines [start, end], which
will find and replace all the occurrences only inside those lines:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:1,10s/search/replace
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="change-only-whole-words-exactly-matching"&gt;Change only whole words exactly matching&lt;/h3&gt;
&lt;p&gt;To avoid removing wrong selections, we can select only the whole words using
regex:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:%s/\&amp;lt;foo\&amp;gt;/bar/
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="flags"&gt;Flags&lt;/h2&gt;
&lt;p&gt;Flags offer some caution and control in executing the substitute command, for
example:&lt;/p&gt;
&lt;h3 id="global-g"&gt;Global (g)&lt;/h3&gt;
&lt;p&gt;This flag will look throughout the whole files, assuming the default setting
for the &amp;lsquo;gdefault&amp;rsquo; and &amp;rsquo;edcompatible&amp;rsquo; option is off.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:%s/search/replace/g
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="confirmation-c"&gt;Confirmation (c)&lt;/h3&gt;
&lt;p&gt;By adding c flag the command will ask for confirmation for every occurrence
before changing.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:s/search/replace/c
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="insensitive-i"&gt;Insensitive (i)&lt;/h3&gt;
&lt;p&gt;This will set up case insensitive lookup order.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:s/search/replace/i
&lt;/code&gt;&lt;/pre&gt;&lt;h3 id="sensitive-i"&gt;Sensitive (I)&lt;/h3&gt;
&lt;p&gt;Meanwhile capital I will set up case insensitive lookup order.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;:s/search/replace/I
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id="conslusion"&gt;Conslusion&lt;/h2&gt;
&lt;p&gt;This is the most basic usage of the substitute command, for the more advance
usage I recommend reading the documentation and &lt;a href="https://vim.fandom.com/wiki/Search_and_replace"&gt;Vim Fandom article&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/how-to-find-and-replace-all-in-vim-with-substitute-command/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title>A Keyboard With Blank Keycaps Made Me an Expert Typist</title><link>https://bojanvidanovic.com/blog/a-keyboard-with-blank-keycaps-made-me-an-expert-typist/</link><guid isPermaLink="true">https://bojanvidanovic.com/blog/a-keyboard-with-blank-keycaps-made-me-an-expert-typist/</guid><pubDate>Tue, 11 Aug 2020 11:58:21 +0200</pubDate><dc:creator>Bojan Vidanovic</dc:creator><category>blog</category><description>&lt;p&gt;If you are someone like me who spends hours and hours a day typing then you
might be interested in investing in learning how to properly type, more
precisely on learning how to &lt;a href="https://en.wikipedia.org/wiki/Touch_typing"&gt;touch-type&lt;/a&gt;.
My story begins 2 years ago when I saw one person typing so fluently and elegantly with almost no effort, focusing on
the result and not the process that it triggered in me to start noting how
badly I was typing and how badly many others were typing.&lt;/p&gt;
&lt;p&gt;The problem is that almost all people are a self-taught typist and everyone
with their technique, this technique is usually correlated with inefficiency,
and sometimes speed. I saw many people typing very fast with only 4 fingers, which
in result makes more noise by jumping from one letter to another very fast but
on that particular keyboard, on another keyboard they would struggle because
the muscle memory doesn’t recognize a different keyboard. And it makes so much
harder improving the speed when not using all of your fingers.&lt;/p&gt;
&lt;p&gt;I had the same problem as the majority of people, and I wasn’t recognizing it.
For years I would use 4-6 fingers and always from time to time I would
take a look at the keyboard for a specific character or a letter. The right
hand would type the keys on the left side and opposite. That was my typing
technique.&lt;/p&gt;
&lt;ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-9401752794288868"
data-ad-slot="2055838653"&gt;&lt;/ins&gt;
&lt;p&gt;So I started doing some research and got to know better how touch-typing works.
Luckily the web is full of touch-typing resources and training websites, that
I settled for &lt;a href="https://www.typingclub.com/"&gt;TypingClub&lt;/a&gt;. The website is full of exercises and statistics
on your writing progress in beautiful UI that it satisfies all of my nerdy
requirements, and it’s completely free or supports the services and get some
additional features with as little as 7.50 euros a month.&lt;/p&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/"
srcset="https://res.cloudinary.com/bojan/image/upload/w_320,f_auto,q_auto/ 320w, https://res.cloudinary.com/bojan/image/upload/w_480,f_auto,q_auto/ 480w, https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/ 860w, https://res.cloudinary.com/bojan/image/upload/w_1280,f_auto,q_auto/ 1280w, https://res.cloudinary.com/bojan/image/upload/w_1600,f_auto,q_auto/ 1600w"
sizes="auto, (min-width: 1440px) and (min-height: 540px) 774px, (min-width: 1280px) and (min-height: 540px) calc(100vw - 666px), (min-width: 1100px) and (min-height: 540px) 750px, (min-width: 768px) and (min-height: 540px) min(750px, calc(100vw - 226px)), (min-width: 1440px) 1054px, (min-width: 1280px) calc(100vw - 386px), (min-width: 840px) 750px, calc(100vw - 64px)"
alt="touch-type fingers" class="w-full" decoding="async"
loading="lazy"&gt;
&lt;/figure&gt;
&lt;p&gt;Doing the research and signing up for the website was the easy part, the hard
part was creating a practicing routing and trying to touch-type as much as
possible. That is easier said than done. The beggining was painful, I was slow at
work and I was wasting a lot of my concentration on typing. My fingers were
feeling tired and sometimes in pain, they have never done anything like that.
Changing the muscle memory and rewiring my brain after many years to something
almost unknown was getting into my way.&lt;/p&gt;
&lt;p&gt;So I decided to make a switch from an &lt;a href="https://amzn.to/31H9Qgc"&gt;Apple keyboard&lt;/a&gt; to a mechanical keyboard.
And I got the idea that if I get a keyboard with the blank keycaps I would be
obligated to learn to touch-type and forget about looking at the keyboard. The
idea was promising but also scary for the scenarios like typing a password,
typing with one hand.. so again I did some research! And many people confirmed
my idea and I decided to follow it.&lt;/p&gt;
&lt;p&gt;Finding a good keyboard that would last and endure a lot typing was my initial
idea, but there aren’t many keyboards with blank keycaps unless you customize
it. So the list came down to these candidates:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://amzn.to/3acp0On"&gt;Das Keyboard 4&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://amzn.to/3kBK9WP"&gt;Filco Ninja Majestouch-2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://amzn.to/3kSckkI"&gt;Happy Hacking Keyboard (HHKB) Professional2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Filco keyboard is a little different than the other two, by having the keycaps
printed on the bottom side instead on top. This would work better in cases like
typing a password or typing anything with one hand. For someone who doesn&amp;rsquo;t
want to go extreme this is a good solution.&lt;/p&gt;
&lt;p&gt;All of these keyboards are exceptionally good, but having already had
experience with MX Cherry switches, I decided to give a try to Topre
switches with an HHKB. It&amp;rsquo;s more Vim-style orianted by having no arrow keys
with a clean and minimal design.&lt;/p&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/"
srcset="https://res.cloudinary.com/bojan/image/upload/w_320,f_auto,q_auto/ 320w, https://res.cloudinary.com/bojan/image/upload/w_480,f_auto,q_auto/ 480w, https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/ 860w, https://res.cloudinary.com/bojan/image/upload/w_1280,f_auto,q_auto/ 1280w, https://res.cloudinary.com/bojan/image/upload/w_1600,f_auto,q_auto/ 1600w"
sizes="auto, (min-width: 1440px) and (min-height: 540px) 774px, (min-width: 1280px) and (min-height: 540px) calc(100vw - 666px), (min-width: 1100px) and (min-height: 540px) 750px, (min-width: 768px) and (min-height: 540px) min(750px, calc(100vw - 226px)), (min-width: 1440px) 1054px, (min-width: 1280px) calc(100vw - 386px), (min-width: 840px) 750px, calc(100vw - 64px)"
alt="Happy Hacking Keyboard" class="w-full" decoding="async"
loading="lazy"&gt;
&lt;/figure&gt;
&lt;p&gt;After purchasing the new keyboard there was no going back, I had the tool
and the school to deep dive into this. At the begging I was struggling, but
a keyboard like this pushes you to learn a proper fingers placement on the
home row and unlink all the habits of looking down for a key. It took time
and a lot of practice but it paid off. Today I type comfortably on a blank
keyboard with the average speed of 70-90 wpm and I&amp;rsquo;m still improving. It is
a huge productivity boost.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/a-keyboard-with-blank-keycaps-made-me-an-expert-typist/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;If you are someone like me who spends hours and hours a day typing then you
might be interested in investing in learning how to properly type, more
precisely on learning how to &lt;a href="https://en.wikipedia.org/wiki/Touch_typing"&gt;touch-type&lt;/a&gt;.
My story begins 2 years ago when I saw one person typing so fluently and elegantly with almost no effort, focusing on
the result and not the process that it triggered in me to start noting how
badly I was typing and how badly many others were typing.&lt;/p&gt;
&lt;p&gt;The problem is that almost all people are a self-taught typist and everyone
with their technique, this technique is usually correlated with inefficiency,
and sometimes speed. I saw many people typing very fast with only 4 fingers, which
in result makes more noise by jumping from one letter to another very fast but
on that particular keyboard, on another keyboard they would struggle because
the muscle memory doesn’t recognize a different keyboard. And it makes so much
harder improving the speed when not using all of your fingers.&lt;/p&gt;
&lt;p&gt;I had the same problem as the majority of people, and I wasn’t recognizing it.
For years I would use 4-6 fingers and always from time to time I would
take a look at the keyboard for a specific character or a letter. The right
hand would type the keys on the left side and opposite. That was my typing
technique.&lt;/p&gt;
&lt;ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-9401752794288868"
data-ad-slot="2055838653"&gt;&lt;/ins&gt;
&lt;p&gt;So I started doing some research and got to know better how touch-typing works.
Luckily the web is full of touch-typing resources and training websites, that
I settled for &lt;a href="https://www.typingclub.com/"&gt;TypingClub&lt;/a&gt;. The website is full of exercises and statistics
on your writing progress in beautiful UI that it satisfies all of my nerdy
requirements, and it’s completely free or supports the services and get some
additional features with as little as 7.50 euros a month.&lt;/p&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/"
srcset="https://res.cloudinary.com/bojan/image/upload/w_320,f_auto,q_auto/ 320w, https://res.cloudinary.com/bojan/image/upload/w_480,f_auto,q_auto/ 480w, https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/ 860w, https://res.cloudinary.com/bojan/image/upload/w_1280,f_auto,q_auto/ 1280w, https://res.cloudinary.com/bojan/image/upload/w_1600,f_auto,q_auto/ 1600w"
sizes="auto, (min-width: 1440px) and (min-height: 540px) 774px, (min-width: 1280px) and (min-height: 540px) calc(100vw - 666px), (min-width: 1100px) and (min-height: 540px) 750px, (min-width: 768px) and (min-height: 540px) min(750px, calc(100vw - 226px)), (min-width: 1440px) 1054px, (min-width: 1280px) calc(100vw - 386px), (min-width: 840px) 750px, calc(100vw - 64px)"
alt="touch-type fingers" class="w-full" decoding="async"
loading="lazy"&gt;
&lt;/figure&gt;
&lt;p&gt;Doing the research and signing up for the website was the easy part, the hard
part was creating a practicing routing and trying to touch-type as much as
possible. That is easier said than done. The beggining was painful, I was slow at
work and I was wasting a lot of my concentration on typing. My fingers were
feeling tired and sometimes in pain, they have never done anything like that.
Changing the muscle memory and rewiring my brain after many years to something
almost unknown was getting into my way.&lt;/p&gt;
&lt;p&gt;So I decided to make a switch from an &lt;a href="https://amzn.to/31H9Qgc"&gt;Apple keyboard&lt;/a&gt; to a mechanical keyboard.
And I got the idea that if I get a keyboard with the blank keycaps I would be
obligated to learn to touch-type and forget about looking at the keyboard. The
idea was promising but also scary for the scenarios like typing a password,
typing with one hand.. so again I did some research! And many people confirmed
my idea and I decided to follow it.&lt;/p&gt;
&lt;p&gt;Finding a good keyboard that would last and endure a lot typing was my initial
idea, but there aren’t many keyboards with blank keycaps unless you customize
it. So the list came down to these candidates:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://amzn.to/3acp0On"&gt;Das Keyboard 4&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://amzn.to/3kBK9WP"&gt;Filco Ninja Majestouch-2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://amzn.to/3kSckkI"&gt;Happy Hacking Keyboard (HHKB) Professional2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Filco keyboard is a little different than the other two, by having the keycaps
printed on the bottom side instead on top. This would work better in cases like
typing a password or typing anything with one hand. For someone who doesn&amp;rsquo;t
want to go extreme this is a good solution.&lt;/p&gt;
&lt;p&gt;All of these keyboards are exceptionally good, but having already had
experience with MX Cherry switches, I decided to give a try to Topre
switches with an HHKB. It&amp;rsquo;s more Vim-style orianted by having no arrow keys
with a clean and minimal design.&lt;/p&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/"
srcset="https://res.cloudinary.com/bojan/image/upload/w_320,f_auto,q_auto/ 320w, https://res.cloudinary.com/bojan/image/upload/w_480,f_auto,q_auto/ 480w, https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/ 860w, https://res.cloudinary.com/bojan/image/upload/w_1280,f_auto,q_auto/ 1280w, https://res.cloudinary.com/bojan/image/upload/w_1600,f_auto,q_auto/ 1600w"
sizes="auto, (min-width: 1440px) and (min-height: 540px) 774px, (min-width: 1280px) and (min-height: 540px) calc(100vw - 666px), (min-width: 1100px) and (min-height: 540px) 750px, (min-width: 768px) and (min-height: 540px) min(750px, calc(100vw - 226px)), (min-width: 1440px) 1054px, (min-width: 1280px) calc(100vw - 386px), (min-width: 840px) 750px, calc(100vw - 64px)"
alt="Happy Hacking Keyboard" class="w-full" decoding="async"
loading="lazy"&gt;
&lt;/figure&gt;
&lt;p&gt;After purchasing the new keyboard there was no going back, I had the tool
and the school to deep dive into this. At the begging I was struggling, but
a keyboard like this pushes you to learn a proper fingers placement on the
home row and unlink all the habits of looking down for a key. It took time
and a lot of practice but it paid off. Today I type comfortably on a blank
keyboard with the average speed of 70-90 wpm and I&amp;rsquo;m still improving. It is
a huge productivity boost.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/a-keyboard-with-blank-keycaps-made-me-an-expert-typist/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title>How to Setup Vim as an IDE for React/TypeScript</title><link>https://bojanvidanovic.com/blog/how-to-setup-vim-as-an-ide-for-react-typescript/</link><guid isPermaLink="true">https://bojanvidanovic.com/blog/how-to-setup-vim-as-an-ide-for-react-typescript/</guid><pubDate>Tue, 04 Aug 2020 16:21:21 +0200</pubDate><dc:creator>Bojan Vidanovic</dc:creator><category>blog</category><description>&lt;p&gt;Thanks to the Vim&amp;rsquo;s vast choice of &lt;a href="https://vimawesome.com/"&gt;plugins&lt;/a&gt;, I&amp;rsquo;ve been using Vim daily for developing React applications in TypeScript. I classify these plugins as essential to make Vim a perfect IDE environment for programming although you might not need them as you can already do anything out-of-the-box, I&amp;rsquo;d still recommend installing them and making code writing more enjoyable and less error-prone.&lt;/p&gt;
&lt;p&gt;I assume you have some basic skills in Vim or read my &lt;a href="https://bojanvidanovic.com/posts/5-most-essential-vim-commands-for-beginners/"&gt;previous article&lt;/a&gt; as a starting point.&lt;/p&gt;
&lt;h2 id="install-plugin-manager"&gt;Install plugin manager&lt;/h2&gt;
&lt;p&gt;Before we install any of the plugins, first we will need a plugin manager. There are many plugins managers for Vim, but always recommend using &lt;a href="https://github.com/junegunn/vim-plug"&gt;vim-plug&lt;/a&gt; mainly for its simplicity and ease-of-use.&lt;/p&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://raw.githubusercontent.com/junegunn/i/master/vim-plug/installer.gif" alt="vim plug" class="w-full" decoding="async" loading="lazy" &gt;
&lt;/figure&gt;
&lt;p&gt;So go ahead and execute this command in the CLI:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl -fLo ~/.vim/autoload/plug.vim --create-dirs &lt;span style="color:#ae81ff"&gt;\ &lt;/span&gt;https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After it finished, add a vim-plug section to your ~/.vimrc file.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;call plug#begin&lt;span style="color:#f92672"&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34; In this section you will manage all of your future plugins.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt; Plug &lt;span style="color:#e6db74"&gt;&amp;#39;example-path-to-git-repository&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;call plug#end&lt;span style="color:#f92672"&gt;()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Essentially, in this block of code we have added you will include the path to the repository of the plugin you want to install by inserting &lt;code&gt;Plug 'path-to-repo'&lt;/code&gt; and from inside Vim you will call: &lt;code&gt;PlugInstall&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="asynchronous-lint-engine"&gt;Asynchronous Lint Engine&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://github.com/dense-analysis/ale"&gt;ALE&lt;/a&gt; is a plugin that will provide linting with syntax checking and semantic errors for your code.&lt;/p&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://user-images.githubusercontent.com/3518142/59195938-3a81b100-8b85-11e9-8e8d-6a601b1db908.gif" alt="ale vim" class="w-full" decoding="async" loading="lazy" &gt;
&lt;/figure&gt;
&lt;p&gt;Let&amp;rsquo;s install it by including it in the Vim Plug and call :PlugInstall&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Plug &lt;span style="color:#e6db74"&gt;&amp;#39;dense-analysis/ale&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After this, I recommend reading the documentation of the plugin to adjust the plugin better to your style of writing code.&lt;/p&gt;
&lt;h2 id="coc---conquer-of-completion"&gt;CoC - Conquer of completion&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://github.com/neoclide/coc.nvim"&gt;CoC&lt;/a&gt; is a completion engine and you really really want this one. This plugin saves me a lot of typing and peaking into other files for properties verification.&lt;/p&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://user-images.githubusercontent.com/251450/55285193-400a9000-53b9-11e9-8cff-ffe4983c5947.gif" alt="vim coc" class="w-full" decoding="async" loading="lazy" &gt;
&lt;/figure&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Plug &lt;span style="color:#e6db74"&gt;&amp;#39;neoclide/coc.nvim&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="yats-yet-another-typescript-syntax"&gt;YATS: Yet Another TypeScript Syntax&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://github.com/HerringtonDarkholme/yats.vim"&gt;YATS&lt;/a&gt; is a TypeScript syntax highlighter with the most appealing color scheme for TypeScript code. Not just making your beautiful but also much more readable.&lt;/p&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/v1596551519/yats_viclae.png"
srcset="https://res.cloudinary.com/bojan/image/upload/w_320,f_auto,q_auto/v1596551519/yats_viclae.png 320w, https://res.cloudinary.com/bojan/image/upload/w_480,f_auto,q_auto/v1596551519/yats_viclae.png 480w, https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/v1596551519/yats_viclae.png 860w, https://res.cloudinary.com/bojan/image/upload/w_1280,f_auto,q_auto/v1596551519/yats_viclae.png 1280w, https://res.cloudinary.com/bojan/image/upload/w_1600,f_auto,q_auto/v1596551519/yats_viclae.png 1600w"
sizes="auto, (min-width: 1440px) and (min-height: 540px) 774px, (min-width: 1280px) and (min-height: 540px) calc(100vw - 666px), (min-width: 1100px) and (min-height: 540px) 750px, (min-width: 768px) and (min-height: 540px) min(750px, calc(100vw - 226px)), (min-width: 1440px) 1054px, (min-width: 1280px) calc(100vw - 386px), (min-width: 840px) 750px, calc(100vw - 64px)"
alt="yats" class="w-full" decoding="async"
loading="lazy"&gt;
&lt;/figure&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Plug &lt;span style="color:#e6db74"&gt;&amp;#39;HerringtonDarkholme/yats.vim&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="ctrlpvim---fuzzy-finder"&gt;ctrlp.vim - Fuzzy finder&lt;/h2&gt;
&lt;p&gt;You might have used this feature in VSCode, with &lt;a href="https://github.com/ctrlpvim/ctrlp.vim"&gt;ctrlp.vim&lt;/a&gt; plugin we can get the same functionality. Very useful for searching the files on the go.&lt;/p&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/v1596551519/fuzzy_parwqn.png"
srcset="https://res.cloudinary.com/bojan/image/upload/w_320,f_auto,q_auto/v1596551519/fuzzy_parwqn.png 320w, https://res.cloudinary.com/bojan/image/upload/w_480,f_auto,q_auto/v1596551519/fuzzy_parwqn.png 480w, https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/v1596551519/fuzzy_parwqn.png 860w, https://res.cloudinary.com/bojan/image/upload/w_1280,f_auto,q_auto/v1596551519/fuzzy_parwqn.png 1280w, https://res.cloudinary.com/bojan/image/upload/w_1600,f_auto,q_auto/v1596551519/fuzzy_parwqn.png 1600w"
sizes="auto, (min-width: 1440px) and (min-height: 540px) 774px, (min-width: 1280px) and (min-height: 540px) calc(100vw - 666px), (min-width: 1100px) and (min-height: 540px) 750px, (min-width: 768px) and (min-height: 540px) min(750px, calc(100vw - 226px)), (min-width: 1440px) 1054px, (min-width: 1280px) calc(100vw - 386px), (min-width: 840px) 750px, calc(100vw - 64px)"
alt="ctrlp vim" class="w-full" decoding="async"
loading="lazy"&gt;
&lt;/figure&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Plug &lt;span style="color:#e6db74"&gt;&amp;#39;ctrlpvim/ctrlp.vim&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;These are some of the most essential plugins to get you going writing the code in React and TypeScript.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/how-to-setup-vim-as-an-ide-for-react-typescript/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;Thanks to the Vim&amp;rsquo;s vast choice of &lt;a href="https://vimawesome.com/"&gt;plugins&lt;/a&gt;, I&amp;rsquo;ve been using Vim daily for developing React applications in TypeScript. I classify these plugins as essential to make Vim a perfect IDE environment for programming although you might not need them as you can already do anything out-of-the-box, I&amp;rsquo;d still recommend installing them and making code writing more enjoyable and less error-prone.&lt;/p&gt;
&lt;p&gt;I assume you have some basic skills in Vim or read my &lt;a href="https://bojanvidanovic.com/posts/5-most-essential-vim-commands-for-beginners/"&gt;previous article&lt;/a&gt; as a starting point.&lt;/p&gt;
&lt;h2 id="install-plugin-manager"&gt;Install plugin manager&lt;/h2&gt;
&lt;p&gt;Before we install any of the plugins, first we will need a plugin manager. There are many plugins managers for Vim, but always recommend using &lt;a href="https://github.com/junegunn/vim-plug"&gt;vim-plug&lt;/a&gt; mainly for its simplicity and ease-of-use.&lt;/p&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://raw.githubusercontent.com/junegunn/i/master/vim-plug/installer.gif" alt="vim plug" class="w-full" decoding="async" loading="lazy" &gt;
&lt;/figure&gt;
&lt;p&gt;So go ahead and execute this command in the CLI:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;curl -fLo ~/.vim/autoload/plug.vim --create-dirs &lt;span style="color:#ae81ff"&gt;\ &lt;/span&gt;https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After it finished, add a vim-plug section to your ~/.vimrc file.
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;call plug#begin&lt;span style="color:#f92672"&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34; In this section you will manage all of your future plugins.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt; Plug &lt;span style="color:#e6db74"&gt;&amp;#39;example-path-to-git-repository&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;call plug#end&lt;span style="color:#f92672"&gt;()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Essentially, in this block of code we have added you will include the path to the repository of the plugin you want to install by inserting &lt;code&gt;Plug 'path-to-repo'&lt;/code&gt; and from inside Vim you will call: &lt;code&gt;PlugInstall&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="asynchronous-lint-engine"&gt;Asynchronous Lint Engine&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://github.com/dense-analysis/ale"&gt;ALE&lt;/a&gt; is a plugin that will provide linting with syntax checking and semantic errors for your code.&lt;/p&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://user-images.githubusercontent.com/3518142/59195938-3a81b100-8b85-11e9-8e8d-6a601b1db908.gif" alt="ale vim" class="w-full" decoding="async" loading="lazy" &gt;
&lt;/figure&gt;
&lt;p&gt;Let&amp;rsquo;s install it by including it in the Vim Plug and call :PlugInstall&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Plug &lt;span style="color:#e6db74"&gt;&amp;#39;dense-analysis/ale&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;After this, I recommend reading the documentation of the plugin to adjust the plugin better to your style of writing code.&lt;/p&gt;
&lt;h2 id="coc---conquer-of-completion"&gt;CoC - Conquer of completion&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://github.com/neoclide/coc.nvim"&gt;CoC&lt;/a&gt; is a completion engine and you really really want this one. This plugin saves me a lot of typing and peaking into other files for properties verification.&lt;/p&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://user-images.githubusercontent.com/251450/55285193-400a9000-53b9-11e9-8cff-ffe4983c5947.gif" alt="vim coc" class="w-full" decoding="async" loading="lazy" &gt;
&lt;/figure&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Plug &lt;span style="color:#e6db74"&gt;&amp;#39;neoclide/coc.nvim&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="yats-yet-another-typescript-syntax"&gt;YATS: Yet Another TypeScript Syntax&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://github.com/HerringtonDarkholme/yats.vim"&gt;YATS&lt;/a&gt; is a TypeScript syntax highlighter with the most appealing color scheme for TypeScript code. Not just making your beautiful but also much more readable.&lt;/p&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/v1596551519/yats_viclae.png"
srcset="https://res.cloudinary.com/bojan/image/upload/w_320,f_auto,q_auto/v1596551519/yats_viclae.png 320w, https://res.cloudinary.com/bojan/image/upload/w_480,f_auto,q_auto/v1596551519/yats_viclae.png 480w, https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/v1596551519/yats_viclae.png 860w, https://res.cloudinary.com/bojan/image/upload/w_1280,f_auto,q_auto/v1596551519/yats_viclae.png 1280w, https://res.cloudinary.com/bojan/image/upload/w_1600,f_auto,q_auto/v1596551519/yats_viclae.png 1600w"
sizes="auto, (min-width: 1440px) and (min-height: 540px) 774px, (min-width: 1280px) and (min-height: 540px) calc(100vw - 666px), (min-width: 1100px) and (min-height: 540px) 750px, (min-width: 768px) and (min-height: 540px) min(750px, calc(100vw - 226px)), (min-width: 1440px) 1054px, (min-width: 1280px) calc(100vw - 386px), (min-width: 840px) 750px, calc(100vw - 64px)"
alt="yats" class="w-full" decoding="async"
loading="lazy"&gt;
&lt;/figure&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Plug &lt;span style="color:#e6db74"&gt;&amp;#39;HerringtonDarkholme/yats.vim&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="ctrlpvim---fuzzy-finder"&gt;ctrlp.vim - Fuzzy finder&lt;/h2&gt;
&lt;p&gt;You might have used this feature in VSCode, with &lt;a href="https://github.com/ctrlpvim/ctrlp.vim"&gt;ctrlp.vim&lt;/a&gt; plugin we can get the same functionality. Very useful for searching the files on the go.&lt;/p&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/v1596551519/fuzzy_parwqn.png"
srcset="https://res.cloudinary.com/bojan/image/upload/w_320,f_auto,q_auto/v1596551519/fuzzy_parwqn.png 320w, https://res.cloudinary.com/bojan/image/upload/w_480,f_auto,q_auto/v1596551519/fuzzy_parwqn.png 480w, https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/v1596551519/fuzzy_parwqn.png 860w, https://res.cloudinary.com/bojan/image/upload/w_1280,f_auto,q_auto/v1596551519/fuzzy_parwqn.png 1280w, https://res.cloudinary.com/bojan/image/upload/w_1600,f_auto,q_auto/v1596551519/fuzzy_parwqn.png 1600w"
sizes="auto, (min-width: 1440px) and (min-height: 540px) 774px, (min-width: 1280px) and (min-height: 540px) calc(100vw - 666px), (min-width: 1100px) and (min-height: 540px) 750px, (min-width: 768px) and (min-height: 540px) min(750px, calc(100vw - 226px)), (min-width: 1440px) 1054px, (min-width: 1280px) calc(100vw - 386px), (min-width: 840px) 750px, calc(100vw - 64px)"
alt="ctrlp vim" class="w-full" decoding="async"
loading="lazy"&gt;
&lt;/figure&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Plug &lt;span style="color:#e6db74"&gt;&amp;#39;ctrlpvim/ctrlp.vim&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;These are some of the most essential plugins to get you going writing the code in React and TypeScript.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/how-to-setup-vim-as-an-ide-for-react-typescript/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title>5 Most Essential Vim Commands for Beginners</title><link>https://bojanvidanovic.com/blog/5-most-essential-vim-commands-for-beginners/</link><guid isPermaLink="true">https://bojanvidanovic.com/blog/5-most-essential-vim-commands-for-beginners/</guid><pubDate>Sat, 01 Aug 2020 12:25:37 +0200</pubDate><dc:creator>Bojan Vidanovic</dc:creator><category>blog</category><description>&lt;p&gt;Oh.. Vim, some people love it, most people hate it. Just the idea of having to modify a simple file in Vim makes some people dizzy. Having to learn all the keyboard commands and not seeing any buttons that you can click with your mouse in a program &lt;a href="https://twobithistory.org/2018/08/05/where-vim-came-from.html"&gt;from 80&amp;rsquo;s&lt;/a&gt; is already an ugly presentation. I remember the first day at the new company in Spain my coworkers asking me what I&amp;rsquo;m using to program, and I answered: Vim. You should have seen their reaction to that! I admit the path to using Vim as a default IDE, (yes IDE!) wasn&amp;rsquo;t so pleasant at the begging, but with some practice, you&amp;rsquo;ll understand why some people love it. So this is the first post of Vim-series where I&amp;rsquo;ll show you 5 most essential commands to kick-start your journey in Vim or just to edit some files on the fly.&lt;/p&gt;
&lt;h2 id="1-hjkl-moving-around-the-file"&gt;1. hjkl: Moving around the file&lt;/h2&gt;
&lt;p&gt;This is the first command you will need to move around your file, these four letters are positioned on your home row, under your right hand. And they represent:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;h: Move the cursor left
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;j: Move the cursor down
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;k: Move the cursor up
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;l: Move the cursor right&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="2-gg-and-g-jump-to-start-or-end-of-file"&gt;2. gg and G: Jump to start or end of file&lt;/h2&gt;
&lt;p&gt;If you find your self in file with hundreds of lines, using &amp;lsquo;j&amp;rsquo; or &amp;lsquo;k&amp;rsquo; keys to get
to the end of the file would be painful. So we use &amp;lsquo;gg&amp;rsquo; and &amp;lsquo;G&amp;rsquo; keys to jump up and down the file, so:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;gg: Double pressing g key will move the cursor the start of the file
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;G: Capital G &lt;span style="color:#f92672"&gt;(&lt;/span&gt;Shift + g&lt;span style="color:#f92672"&gt;)&lt;/span&gt; will move the cursor to the end of the file&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="3-i-insert-text"&gt;3. i: Insert text&lt;/h2&gt;
&lt;p&gt;After you move the cursor to the desired position in the file, editing text
is possible after entering the &amp;lsquo;Insert mode&amp;rsquo; by pressing the &amp;lsquo;i&amp;rsquo; key. After
editing the text press &amp;lsquo;ESC&amp;rsquo; and return to &amp;lsquo;Normal mode&amp;rsquo;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;1. Press &lt;span style="color:#e6db74"&gt;&amp;#39;i&amp;#39;&lt;/span&gt; key and start editing
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;2. Press &lt;span style="color:#e6db74"&gt;&amp;#39;ESC&amp;#39;&lt;/span&gt; when finished&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="4-w-saving-a-file"&gt;4. w: Saving a file&lt;/h2&gt;
&lt;p&gt;To save your file changes is simple, it&amp;rsquo;s a 2-step process:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;1. Enter the command mode by pressing &lt;span style="color:#e6db74"&gt;&amp;#34;:&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;(&lt;/span&gt;Shif+;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;2. Press the &lt;span style="color:#e6db74"&gt;&amp;#39;w&amp;#39;&lt;/span&gt; key, which stands &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; write&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="5-q-quit-vim"&gt;5. q: Quit Vim&lt;/h2&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/v1596278701/wwRO3GiXgni7IZ1OevNh5xnUXhzhn4VAURCppmt--LI_n0w48v.webp"
srcset="https://res.cloudinary.com/bojan/image/upload/w_320,f_auto,q_auto/v1596278701/wwRO3GiXgni7IZ1OevNh5xnUXhzhn4VAURCppmt--LI_n0w48v.webp 320w, https://res.cloudinary.com/bojan/image/upload/w_480,f_auto,q_auto/v1596278701/wwRO3GiXgni7IZ1OevNh5xnUXhzhn4VAURCppmt--LI_n0w48v.webp 480w, https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/v1596278701/wwRO3GiXgni7IZ1OevNh5xnUXhzhn4VAURCppmt--LI_n0w48v.webp 860w, https://res.cloudinary.com/bojan/image/upload/w_1280,f_auto,q_auto/v1596278701/wwRO3GiXgni7IZ1OevNh5xnUXhzhn4VAURCppmt--LI_n0w48v.webp 1280w, https://res.cloudinary.com/bojan/image/upload/w_1600,f_auto,q_auto/v1596278701/wwRO3GiXgni7IZ1OevNh5xnUXhzhn4VAURCppmt--LI_n0w48v.webp 1600w"
sizes="auto, (min-width: 1440px) and (min-height: 540px) 774px, (min-width: 1280px) and (min-height: 540px) calc(100vw - 666px), (min-width: 1100px) and (min-height: 540px) 750px, (min-width: 768px) and (min-height: 540px) min(750px, calc(100vw - 226px)), (min-width: 1440px) 1054px, (min-width: 1280px) calc(100vw - 386px), (min-width: 840px) 750px, calc(100vw - 64px)"
alt="" class="w-full" decoding="async"
loading="lazy"&gt;
&lt;/figure&gt;
&lt;p&gt;Now that last and most famous command you will ever need is quit command. Again
it&amp;rsquo;s a 2-step process where we will need to enter in command mode:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;1. Enter the command mode by pressing &lt;span style="color:#e6db74"&gt;&amp;#34;:&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;(&lt;/span&gt;Shif+;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;2. Press the &lt;span style="color:#e6db74"&gt;&amp;#39;q&amp;#39;&lt;/span&gt; key, which stands &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; quit and has exited Vim&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="6-bonus"&gt;6. Bonus&lt;/h2&gt;
&lt;p&gt;I know you like easter-eggs, so here is one for you:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;1. Enter the command mode by pressing &lt;span style="color:#e6db74"&gt;&amp;#34;:&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;(&lt;/span&gt;Shif+;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;2. Type &lt;span style="color:#e6db74"&gt;&amp;#39;smile&amp;#39;&lt;/span&gt; and press &lt;span style="color:#e6db74"&gt;&amp;#39;Enter&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Learning Vim is a life-long process, you always learn something new but you need to know just a few commands to do your daily tasks efficiently. If your are serius about more in-depth learning, I highly recommend &lt;a href="https://amzn.to/3hENouv"&gt;Pracitcal Vim&lt;/a&gt; book by Drew Neil.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/5-most-essential-vim-commands-for-beginners/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;Oh.. Vim, some people love it, most people hate it. Just the idea of having to modify a simple file in Vim makes some people dizzy. Having to learn all the keyboard commands and not seeing any buttons that you can click with your mouse in a program &lt;a href="https://twobithistory.org/2018/08/05/where-vim-came-from.html"&gt;from 80&amp;rsquo;s&lt;/a&gt; is already an ugly presentation. I remember the first day at the new company in Spain my coworkers asking me what I&amp;rsquo;m using to program, and I answered: Vim. You should have seen their reaction to that! I admit the path to using Vim as a default IDE, (yes IDE!) wasn&amp;rsquo;t so pleasant at the begging, but with some practice, you&amp;rsquo;ll understand why some people love it. So this is the first post of Vim-series where I&amp;rsquo;ll show you 5 most essential commands to kick-start your journey in Vim or just to edit some files on the fly.&lt;/p&gt;
&lt;h2 id="1-hjkl-moving-around-the-file"&gt;1. hjkl: Moving around the file&lt;/h2&gt;
&lt;p&gt;This is the first command you will need to move around your file, these four letters are positioned on your home row, under your right hand. And they represent:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;h: Move the cursor left
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;j: Move the cursor down
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;k: Move the cursor up
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;l: Move the cursor right&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="2-gg-and-g-jump-to-start-or-end-of-file"&gt;2. gg and G: Jump to start or end of file&lt;/h2&gt;
&lt;p&gt;If you find your self in file with hundreds of lines, using &amp;lsquo;j&amp;rsquo; or &amp;lsquo;k&amp;rsquo; keys to get
to the end of the file would be painful. So we use &amp;lsquo;gg&amp;rsquo; and &amp;lsquo;G&amp;rsquo; keys to jump up and down the file, so:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;gg: Double pressing g key will move the cursor the start of the file
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;G: Capital G &lt;span style="color:#f92672"&gt;(&lt;/span&gt;Shift + g&lt;span style="color:#f92672"&gt;)&lt;/span&gt; will move the cursor to the end of the file&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="3-i-insert-text"&gt;3. i: Insert text&lt;/h2&gt;
&lt;p&gt;After you move the cursor to the desired position in the file, editing text
is possible after entering the &amp;lsquo;Insert mode&amp;rsquo; by pressing the &amp;lsquo;i&amp;rsquo; key. After
editing the text press &amp;lsquo;ESC&amp;rsquo; and return to &amp;lsquo;Normal mode&amp;rsquo;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;1. Press &lt;span style="color:#e6db74"&gt;&amp;#39;i&amp;#39;&lt;/span&gt; key and start editing
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;2. Press &lt;span style="color:#e6db74"&gt;&amp;#39;ESC&amp;#39;&lt;/span&gt; when finished&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="4-w-saving-a-file"&gt;4. w: Saving a file&lt;/h2&gt;
&lt;p&gt;To save your file changes is simple, it&amp;rsquo;s a 2-step process:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;1. Enter the command mode by pressing &lt;span style="color:#e6db74"&gt;&amp;#34;:&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;(&lt;/span&gt;Shif+;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;2. Press the &lt;span style="color:#e6db74"&gt;&amp;#39;w&amp;#39;&lt;/span&gt; key, which stands &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; write&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="5-q-quit-vim"&gt;5. q: Quit Vim&lt;/h2&gt;
&lt;figure class="w-full"&gt;
&lt;img src="https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/v1596278701/wwRO3GiXgni7IZ1OevNh5xnUXhzhn4VAURCppmt--LI_n0w48v.webp"
srcset="https://res.cloudinary.com/bojan/image/upload/w_320,f_auto,q_auto/v1596278701/wwRO3GiXgni7IZ1OevNh5xnUXhzhn4VAURCppmt--LI_n0w48v.webp 320w, https://res.cloudinary.com/bojan/image/upload/w_480,f_auto,q_auto/v1596278701/wwRO3GiXgni7IZ1OevNh5xnUXhzhn4VAURCppmt--LI_n0w48v.webp 480w, https://res.cloudinary.com/bojan/image/upload/w_860,f_auto,q_auto/v1596278701/wwRO3GiXgni7IZ1OevNh5xnUXhzhn4VAURCppmt--LI_n0w48v.webp 860w, https://res.cloudinary.com/bojan/image/upload/w_1280,f_auto,q_auto/v1596278701/wwRO3GiXgni7IZ1OevNh5xnUXhzhn4VAURCppmt--LI_n0w48v.webp 1280w, https://res.cloudinary.com/bojan/image/upload/w_1600,f_auto,q_auto/v1596278701/wwRO3GiXgni7IZ1OevNh5xnUXhzhn4VAURCppmt--LI_n0w48v.webp 1600w"
sizes="auto, (min-width: 1440px) and (min-height: 540px) 774px, (min-width: 1280px) and (min-height: 540px) calc(100vw - 666px), (min-width: 1100px) and (min-height: 540px) 750px, (min-width: 768px) and (min-height: 540px) min(750px, calc(100vw - 226px)), (min-width: 1440px) 1054px, (min-width: 1280px) calc(100vw - 386px), (min-width: 840px) 750px, calc(100vw - 64px)"
alt="" class="w-full" decoding="async"
loading="lazy"&gt;
&lt;/figure&gt;
&lt;p&gt;Now that last and most famous command you will ever need is quit command. Again
it&amp;rsquo;s a 2-step process where we will need to enter in command mode:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;1. Enter the command mode by pressing &lt;span style="color:#e6db74"&gt;&amp;#34;:&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;(&lt;/span&gt;Shif+;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;2. Press the &lt;span style="color:#e6db74"&gt;&amp;#39;q&amp;#39;&lt;/span&gt; key, which stands &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; quit and has exited Vim&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="6-bonus"&gt;6. Bonus&lt;/h2&gt;
&lt;p&gt;I know you like easter-eggs, so here is one for you:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;1. Enter the command mode by pressing &lt;span style="color:#e6db74"&gt;&amp;#34;:&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;(&lt;/span&gt;Shif+;&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;2. Type &lt;span style="color:#e6db74"&gt;&amp;#39;smile&amp;#39;&lt;/span&gt; and press &lt;span style="color:#e6db74"&gt;&amp;#39;Enter&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Learning Vim is a life-long process, you always learn something new but you need to know just a few commands to do your daily tasks efficiently. If your are serius about more in-depth learning, I highly recommend &lt;a href="https://amzn.to/3hENouv"&gt;Pracitcal Vim&lt;/a&gt; book by Drew Neil.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/5-most-essential-vim-commands-for-beginners/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title>Moving away from Pocket to my Hugo website and Firefox bookmarks</title><link>https://bojanvidanovic.com/blog/moving-away-from-pocket-to-my-hugo-website-and-firefox-bookmarks/</link><guid isPermaLink="true">https://bojanvidanovic.com/blog/moving-away-from-pocket-to-my-hugo-website-and-firefox-bookmarks/</guid><pubDate>Wed, 29 Jul 2020 08:52:19 +0000</pubDate><dc:creator>Bojan Vidanovic</dc:creator><category>blog</category><description>&lt;p&gt;I&amp;rsquo;ve been using &lt;a href="https://getpocket.com/" title="Pocket"&gt;Pocket&lt;/a&gt; for the last few years, actually moved from &lt;a href="https://www.instapaper.com/" title="Instapaper"&gt;Instapaper&lt;/a&gt; after the &lt;a href="https://www.theverge.com/2018/5/23/17387146/instapaper-gdpr-europe-access-shut-down-privacy-changes" title="GDPR incident"&gt;GDPR incident&lt;/a&gt;, and I&amp;rsquo;ve been happy ever since. But I decided to move all of my public links to my static website. The reason for this has nothing to do with the company, I think they offer a great service for free. It is just I never liked that another company owns my data, especially in this case when a service is easily replaceable by a simple note-taking app.&lt;/p&gt;
&lt;p&gt;So how am I going to replace Pocket? Well, all my favorite links will be exported from Pocket to a &lt;a href="https://bojanvidanovic.com/bookmarks" title="dedicated page"&gt;dedicated page&lt;/a&gt; on my website and will be publicly available, as on the &lt;a href="https://getpocket.com/@bojanvidanovic" title="Pocket profile"&gt;Pocket profile&lt;/a&gt; page. Then I&amp;rsquo;ll manage all my future links through Git or &lt;a href="https://forestry.io/" title="CMS"&gt;CMS&lt;/a&gt;. While the read-it-later type of links will be bookmarked in &lt;a href="https://support.mozilla.org/en-US/kb/bookmarks-firefox" title="Firefox"&gt;Firefox&lt;/a&gt; and synced across all my devices, which I&amp;rsquo;ve been already using for a while and find it much easier to use.&lt;/p&gt;
&lt;ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-9401752794288868"
data-ad-slot="2055838653"&gt;&lt;/ins&gt;
&lt;h3 id="exporting-data-from-pocket"&gt;Exporting data from Pocket&lt;/h3&gt;
&lt;p&gt;Requesting your data from Pocket is a one-click operation, the problem is that they don&amp;rsquo;t give you any options on what file type you want. All your data is by default exported in an HTML file with a bunch of list items.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;ul&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;&amp;lt;&lt;span style="color:#f92672"&gt;a&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;href&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://jmperezperez.com/assess-performance-impact/&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;time_added&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;1595837017&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;tags&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&amp;gt;How to Estimate Web Performance Impact Before Making Fixes - José M. Pérez&amp;lt;/&lt;span style="color:#f92672"&gt;a&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;&amp;lt;&lt;span style="color:#f92672"&gt;a&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;href&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://increment.com/frontend/ask-an-expert-why-is-css-the-way-it-is/&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;time_added&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;1595518932&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;tags&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&amp;gt;Ask an expert: Why is CSS . . . the way it is? – Increment: Frontend&amp;lt;/&lt;span style="color:#f92672"&gt;a&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;&amp;lt;&lt;span style="color:#f92672"&gt;a&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;href&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://alexnixon.github.io/2019/12/10/writing.html&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;time_added&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;1595403017&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;tags&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&amp;gt;It&amp;amp;#039;s time to start writing&amp;lt;/&lt;span style="color:#f92672"&gt;a&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;&amp;lt;&lt;span style="color:#f92672"&gt;a&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;href&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://tim.blog/podcast/&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;time_added&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;1594717067&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;tags&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&amp;gt;Podcast — The Tim Ferriss Show – The Blog of Author Tim Ferriss&amp;lt;/&lt;span style="color:#f92672"&gt;a&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ...
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;ul&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id="converting-to-json"&gt;Converting to JSON&lt;/h3&gt;
&lt;p&gt;So, I slightly modified the exported HTML file to use dataset attributes for tags like time_added and tags, copied it to &lt;a href="https://codepen.io" title="Codepen"&gt;Codepen&lt;/a&gt; and ran this code to get the list in JSON format:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-javascript" data-lang="javascript"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;var&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;list&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;$&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;ul a&amp;#39;&lt;/span&gt;).&lt;span style="color:#a6e22e"&gt;each&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;function&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;idx&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;item&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;list&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;push&lt;/span&gt;({
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;href&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;$&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;item&lt;/span&gt;).&lt;span style="color:#a6e22e"&gt;attr&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;href&amp;#39;&lt;/span&gt;),
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;title&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;item&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;textContent&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;date&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;item&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;dataset&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;date&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;tags&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;item&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;dataset&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;tags&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; });
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; });
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;JSON&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;stringify&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;list&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;null&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34; &amp;#34;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id="importing-to-static-website"&gt;Importing to static website&lt;/h3&gt;
&lt;p&gt;After obtaining the list in JSON format, I needed to create a Markdown file for every entry in the JSON file. This is where the Python magic comes in:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;import&lt;/span&gt; json
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; f &lt;span style="color:#f92672"&gt;=&lt;/span&gt; open(&lt;span style="color:#e6db74"&gt;&amp;#39;export.json&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; data &lt;span style="color:#f92672"&gt;=&lt;/span&gt; json&lt;span style="color:#f92672"&gt;.&lt;/span&gt;load(f)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; link &lt;span style="color:#f92672"&gt;in&lt;/span&gt; data:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; filename &lt;span style="color:#f92672"&gt;=&lt;/span&gt; link[&lt;span style="color:#e6db74"&gt;&amp;#34;text&amp;#34;&lt;/span&gt;]&lt;span style="color:#f92672"&gt;.&lt;/span&gt;lower()&lt;span style="color:#f92672"&gt;.&lt;/span&gt;replace(&lt;span style="color:#e6db74"&gt;&amp;#34; &amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;-&amp;#34;&lt;/span&gt;)&lt;span style="color:#f92672"&gt;.&lt;/span&gt;replace(&lt;span style="color:#e6db74"&gt;&amp;#34;?&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;)&lt;span style="color:#f92672"&gt;.&lt;/span&gt;replace(&lt;span style="color:#e6db74"&gt;&amp;#34;/&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;-&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;with&lt;/span&gt; open(filename &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;.md&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;w&amp;#34;&lt;/span&gt;) &lt;span style="color:#66d9ef"&gt;as&lt;/span&gt; md_file:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; md_file&lt;span style="color:#f92672"&gt;.&lt;/span&gt;write(&lt;span style="color:#e6db74"&gt;&amp;#39;---&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;\n&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; md_file&lt;span style="color:#f92672"&gt;.&lt;/span&gt;write(&lt;span style="color:#e6db74"&gt;&amp;#39;title: &amp;#34;&amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;+&lt;/span&gt; link[&lt;span style="color:#e6db74"&gt;&amp;#34;text&amp;#34;&lt;/span&gt;]&lt;span style="color:#f92672"&gt;.&lt;/span&gt;encode(&lt;span style="color:#e6db74"&gt;&amp;#39;utf-8&amp;#39;&lt;/span&gt;) &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;&amp;#34;&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;\n&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; md_file&lt;span style="color:#f92672"&gt;.&lt;/span&gt;write(&lt;span style="color:#e6db74"&gt;&amp;#39;date: &amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;+&lt;/span&gt; link[&lt;span style="color:#e6db74"&gt;&amp;#34;date&amp;#34;&lt;/span&gt;] &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;\n&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; md_file&lt;span style="color:#f92672"&gt;.&lt;/span&gt;write(&lt;span style="color:#e6db74"&gt;&amp;#39;link: &amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;+&lt;/span&gt; link[&lt;span style="color:#e6db74"&gt;&amp;#34;href&amp;#34;&lt;/span&gt;] &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;\n&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; md_file&lt;span style="color:#f92672"&gt;.&lt;/span&gt;write(&lt;span style="color:#e6db74"&gt;&amp;#39;---&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; md_file&lt;span style="color:#f92672"&gt;.&lt;/span&gt;close()
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; f&lt;span style="color:#f92672"&gt;.&lt;/span&gt;close()&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This simple script created a Markdown file for Hugo for every link from the list.&lt;/p&gt;
&lt;h3 id="conclusion"&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;As you can see, with a few simple scripts I have back my data and transferred to my &lt;a href="https://gohugo.io" title="Hugo"&gt;Hugo&lt;/a&gt; website. And replaced the core Pocket functionality with Firefox bookmarks.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/moving-away-from-pocket-to-my-hugo-website-and-firefox-bookmarks/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;I&amp;rsquo;ve been using &lt;a href="https://getpocket.com/" title="Pocket"&gt;Pocket&lt;/a&gt; for the last few years, actually moved from &lt;a href="https://www.instapaper.com/" title="Instapaper"&gt;Instapaper&lt;/a&gt; after the &lt;a href="https://www.theverge.com/2018/5/23/17387146/instapaper-gdpr-europe-access-shut-down-privacy-changes" title="GDPR incident"&gt;GDPR incident&lt;/a&gt;, and I&amp;rsquo;ve been happy ever since. But I decided to move all of my public links to my static website. The reason for this has nothing to do with the company, I think they offer a great service for free. It is just I never liked that another company owns my data, especially in this case when a service is easily replaceable by a simple note-taking app.&lt;/p&gt;
&lt;p&gt;So how am I going to replace Pocket? Well, all my favorite links will be exported from Pocket to a &lt;a href="https://bojanvidanovic.com/bookmarks" title="dedicated page"&gt;dedicated page&lt;/a&gt; on my website and will be publicly available, as on the &lt;a href="https://getpocket.com/@bojanvidanovic" title="Pocket profile"&gt;Pocket profile&lt;/a&gt; page. Then I&amp;rsquo;ll manage all my future links through Git or &lt;a href="https://forestry.io/" title="CMS"&gt;CMS&lt;/a&gt;. While the read-it-later type of links will be bookmarked in &lt;a href="https://support.mozilla.org/en-US/kb/bookmarks-firefox" title="Firefox"&gt;Firefox&lt;/a&gt; and synced across all my devices, which I&amp;rsquo;ve been already using for a while and find it much easier to use.&lt;/p&gt;
&lt;ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-9401752794288868"
data-ad-slot="2055838653"&gt;&lt;/ins&gt;
&lt;h3 id="exporting-data-from-pocket"&gt;Exporting data from Pocket&lt;/h3&gt;
&lt;p&gt;Requesting your data from Pocket is a one-click operation, the problem is that they don&amp;rsquo;t give you any options on what file type you want. All your data is by default exported in an HTML file with a bunch of list items.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;ul&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;&amp;lt;&lt;span style="color:#f92672"&gt;a&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;href&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://jmperezperez.com/assess-performance-impact/&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;time_added&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;1595837017&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;tags&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&amp;gt;How to Estimate Web Performance Impact Before Making Fixes - José M. Pérez&amp;lt;/&lt;span style="color:#f92672"&gt;a&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;&amp;lt;&lt;span style="color:#f92672"&gt;a&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;href&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://increment.com/frontend/ask-an-expert-why-is-css-the-way-it-is/&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;time_added&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;1595518932&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;tags&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&amp;gt;Ask an expert: Why is CSS . . . the way it is? – Increment: Frontend&amp;lt;/&lt;span style="color:#f92672"&gt;a&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;&amp;lt;&lt;span style="color:#f92672"&gt;a&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;href&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://alexnixon.github.io/2019/12/10/writing.html&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;time_added&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;1595403017&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;tags&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&amp;gt;It&amp;amp;#039;s time to start writing&amp;lt;/&lt;span style="color:#f92672"&gt;a&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;&amp;lt;&lt;span style="color:#f92672"&gt;a&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;href&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://tim.blog/podcast/&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;time_added&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;1594717067&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;tags&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&amp;gt;Podcast — The Tim Ferriss Show – The Blog of Author Tim Ferriss&amp;lt;/&lt;span style="color:#f92672"&gt;a&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ...
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;ul&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id="converting-to-json"&gt;Converting to JSON&lt;/h3&gt;
&lt;p&gt;So, I slightly modified the exported HTML file to use dataset attributes for tags like time_added and tags, copied it to &lt;a href="https://codepen.io" title="Codepen"&gt;Codepen&lt;/a&gt; and ran this code to get the list in JSON format:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-javascript" data-lang="javascript"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;var&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;list&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; [];
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;$&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;ul a&amp;#39;&lt;/span&gt;).&lt;span style="color:#a6e22e"&gt;each&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;function&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;idx&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;item&lt;/span&gt;){
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;list&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;push&lt;/span&gt;({
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;href&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;$&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;item&lt;/span&gt;).&lt;span style="color:#a6e22e"&gt;attr&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;href&amp;#39;&lt;/span&gt;),
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;title&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;item&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;textContent&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;date&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;item&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;dataset&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;date&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;tags&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;item&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;dataset&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;tags&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; });
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; });
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;JSON&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;stringify&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;list&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;null&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34; &amp;#34;&lt;/span&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id="importing-to-static-website"&gt;Importing to static website&lt;/h3&gt;
&lt;p&gt;After obtaining the list in JSON format, I needed to create a Markdown file for every entry in the JSON file. This is where the Python magic comes in:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;import&lt;/span&gt; json
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; f &lt;span style="color:#f92672"&gt;=&lt;/span&gt; open(&lt;span style="color:#e6db74"&gt;&amp;#39;export.json&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; data &lt;span style="color:#f92672"&gt;=&lt;/span&gt; json&lt;span style="color:#f92672"&gt;.&lt;/span&gt;load(f)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; link &lt;span style="color:#f92672"&gt;in&lt;/span&gt; data:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; filename &lt;span style="color:#f92672"&gt;=&lt;/span&gt; link[&lt;span style="color:#e6db74"&gt;&amp;#34;text&amp;#34;&lt;/span&gt;]&lt;span style="color:#f92672"&gt;.&lt;/span&gt;lower()&lt;span style="color:#f92672"&gt;.&lt;/span&gt;replace(&lt;span style="color:#e6db74"&gt;&amp;#34; &amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;-&amp;#34;&lt;/span&gt;)&lt;span style="color:#f92672"&gt;.&lt;/span&gt;replace(&lt;span style="color:#e6db74"&gt;&amp;#34;?&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#34;&lt;/span&gt;)&lt;span style="color:#f92672"&gt;.&lt;/span&gt;replace(&lt;span style="color:#e6db74"&gt;&amp;#34;/&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;-&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;with&lt;/span&gt; open(filename &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;.md&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;w&amp;#34;&lt;/span&gt;) &lt;span style="color:#66d9ef"&gt;as&lt;/span&gt; md_file:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; md_file&lt;span style="color:#f92672"&gt;.&lt;/span&gt;write(&lt;span style="color:#e6db74"&gt;&amp;#39;---&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;\n&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; md_file&lt;span style="color:#f92672"&gt;.&lt;/span&gt;write(&lt;span style="color:#e6db74"&gt;&amp;#39;title: &amp;#34;&amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;+&lt;/span&gt; link[&lt;span style="color:#e6db74"&gt;&amp;#34;text&amp;#34;&lt;/span&gt;]&lt;span style="color:#f92672"&gt;.&lt;/span&gt;encode(&lt;span style="color:#e6db74"&gt;&amp;#39;utf-8&amp;#39;&lt;/span&gt;) &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;&amp;#34;&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;\n&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; md_file&lt;span style="color:#f92672"&gt;.&lt;/span&gt;write(&lt;span style="color:#e6db74"&gt;&amp;#39;date: &amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;+&lt;/span&gt; link[&lt;span style="color:#e6db74"&gt;&amp;#34;date&amp;#34;&lt;/span&gt;] &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;\n&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; md_file&lt;span style="color:#f92672"&gt;.&lt;/span&gt;write(&lt;span style="color:#e6db74"&gt;&amp;#39;link: &amp;#39;&lt;/span&gt; &lt;span style="color:#f92672"&gt;+&lt;/span&gt; link[&lt;span style="color:#e6db74"&gt;&amp;#34;href&amp;#34;&lt;/span&gt;] &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;\n&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; md_file&lt;span style="color:#f92672"&gt;.&lt;/span&gt;write(&lt;span style="color:#e6db74"&gt;&amp;#39;---&amp;#39;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; md_file&lt;span style="color:#f92672"&gt;.&lt;/span&gt;close()
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; f&lt;span style="color:#f92672"&gt;.&lt;/span&gt;close()&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This simple script created a Markdown file for Hugo for every link from the list.&lt;/p&gt;
&lt;h3 id="conclusion"&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;As you can see, with a few simple scripts I have back my data and transferred to my &lt;a href="https://gohugo.io" title="Hugo"&gt;Hugo&lt;/a&gt; website. And replaced the core Pocket functionality with Firefox bookmarks.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/moving-away-from-pocket-to-my-hugo-website-and-firefox-bookmarks/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title>Speeding up static websites with PJAX</title><link>https://bojanvidanovic.com/blog/speeding-up-static-websites-with-pjax/</link><guid isPermaLink="true">https://bojanvidanovic.com/blog/speeding-up-static-websites-with-pjax/</guid><pubDate>Fri, 24 Jul 2020 16:27:25 +0200</pubDate><dc:creator>Bojan Vidanovic</dc:creator><category>blog</category><description>&lt;p&gt;With the fast-growing trend of static websites, many people are moving their blogs from &lt;a href="https://wordpress.org/"&gt;WordPress&lt;/a&gt;, &lt;a href="https://medium.com"&gt;Medium&lt;/a&gt;, etc, to static websites built with &lt;a href="https://gohugo.io"&gt;Hugo&lt;/a&gt; or &lt;a href="https://jekyllrb.com"&gt;Jekyll&lt;/a&gt;. And there is a good reason for that. One of the reasons is security, cutting down server costs, ease of maintenance, performances, and many others. But in this article, I would like to focus on performances.&lt;/p&gt;
&lt;p&gt;As everybody knows, static websites offer out-of-the-box very fast performances without any configuration. You have no database, no dynamically generated content, just serving HTML files from your hosting. As simple as that. But using the PJAX technique we can improve loading performances and enhance the user&amp;rsquo;s experience a lot!&lt;/p&gt;
&lt;ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-9401752794288868"
data-ad-slot="2055838653"&gt;&lt;/ins&gt;
&lt;h2 id="what-is-pjax-and-how-it-works"&gt;What is PJAX and how it works?&lt;/h2&gt;
&lt;p&gt;PJAX technique is using &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/History/pushState"&gt;PushState&lt;/a&gt; and &lt;a href="https://en.wikipedia.org/wiki/Ajax_%28programming%29"&gt;AJAX&lt;/a&gt;. Basically, on a page request, we will manually update the URL and inject the new content on the page, thus avoiding reloading your page&amp;rsquo;s layout or any resources (JS, CSS), giving a fast page load.&lt;/p&gt;
&lt;p&gt;Here are the steps of the process with &lt;a href="https://barba.js.org/"&gt;Barba.js&lt;/a&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Check if the link is valid and eligible for PJAX. If yes, prevent normal browser behavior.&lt;/li&gt;
&lt;li&gt;Change the URL using the push state API.&lt;/li&gt;
&lt;li&gt;Start fetching the new page via an XMLHttpRequest.&lt;/li&gt;
&lt;li&gt;Create a new transition instance.&lt;/li&gt;
&lt;li&gt;As soon the new page is loaded, barba.js parses the new HTML (taking .barba-container) and puts the new content on the DOM inside #barba-wrapper.&lt;/li&gt;
&lt;li&gt;The transition instance will take care of hiding the old container and showing the new one.&lt;/li&gt;
&lt;li&gt;As soon as the transition is finished, the old container is removed from the DOM.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="how-to-implement-pjax-on-a-website"&gt;How to implement PJAX on a website?&lt;/h2&gt;
&lt;p&gt;There are many PJAX libraries, like &lt;a href="https://barba.js.org/"&gt;Barba.js&lt;/a&gt;, &lt;a href="https://sennajs.com/"&gt;Senna.js&lt;/a&gt;, &lt;a href="https://github.com/turbolinks/turbolinks"&gt;Turbolinks&lt;/a&gt;, &lt;a href="https://github.com/MoOx/pjax"&gt;Pjax&lt;/a&gt;, etc. Usually, they all offer extremely easy implementation, I prefer using Barba.js for simple websites and Senna.js for more complex ones as it has a better API. In this article, I will use Barba.js&lt;/p&gt;
&lt;p&gt;The implementation consists of 2 parts:
Setting up DOM markup
Script initialization.&lt;/p&gt;
&lt;h3 id="setting-up-dom-markup"&gt;Setting up DOM markup&lt;/h3&gt;
&lt;p&gt;Barba.js needs to know how your website is set up, so it will need a few HTML attributes:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;body&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;data-barba&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;wrapper&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;&amp;lt;!-- put here content that will not change
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt; between your pages, like &amp;lt;header&amp;gt; or &amp;lt;nav&amp;gt; --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;main&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;data-barba&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;container&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;&amp;lt;!-- put here the content you wish to change
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt; between your pages, like your main content &amp;lt;h1&amp;gt; or &amp;lt;p&amp;gt; --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;main&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;&amp;lt;!-- put here content that will not change
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt; between your pages, like &amp;lt;footer&amp;gt; --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/&lt;span style="color:#f92672"&gt;body&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The wrapper is the main Barba section that contains all your page structure and the Barba container.
The container defines a section in which content is updated automatically when you navigate between your pages.&lt;/p&gt;
&lt;h3 id="script-initialization"&gt;Script initialization&lt;/h3&gt;
&lt;p&gt;After setting up the DOM attributes we simply include Barba.js script in the head of the document and initialize the script:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;script&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;type&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;text/javascript&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;src&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://cdn.jsdelivr.net/npm/@barba/core&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;async&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;onload&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;barba.init({})&amp;#34;&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style="color:#f92672"&gt;script&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;That&amp;rsquo;s it.&lt;/p&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;This approach will give a SPA-like feeling of the website since there are much fewer server requests.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/speeding-up-static-websites-with-pjax/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;With the fast-growing trend of static websites, many people are moving their blogs from &lt;a href="https://wordpress.org/"&gt;WordPress&lt;/a&gt;, &lt;a href="https://medium.com"&gt;Medium&lt;/a&gt;, etc, to static websites built with &lt;a href="https://gohugo.io"&gt;Hugo&lt;/a&gt; or &lt;a href="https://jekyllrb.com"&gt;Jekyll&lt;/a&gt;. And there is a good reason for that. One of the reasons is security, cutting down server costs, ease of maintenance, performances, and many others. But in this article, I would like to focus on performances.&lt;/p&gt;
&lt;p&gt;As everybody knows, static websites offer out-of-the-box very fast performances without any configuration. You have no database, no dynamically generated content, just serving HTML files from your hosting. As simple as that. But using the PJAX technique we can improve loading performances and enhance the user&amp;rsquo;s experience a lot!&lt;/p&gt;
&lt;ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-9401752794288868"
data-ad-slot="2055838653"&gt;&lt;/ins&gt;
&lt;h2 id="what-is-pjax-and-how-it-works"&gt;What is PJAX and how it works?&lt;/h2&gt;
&lt;p&gt;PJAX technique is using &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/History/pushState"&gt;PushState&lt;/a&gt; and &lt;a href="https://en.wikipedia.org/wiki/Ajax_%28programming%29"&gt;AJAX&lt;/a&gt;. Basically, on a page request, we will manually update the URL and inject the new content on the page, thus avoiding reloading your page&amp;rsquo;s layout or any resources (JS, CSS), giving a fast page load.&lt;/p&gt;
&lt;p&gt;Here are the steps of the process with &lt;a href="https://barba.js.org/"&gt;Barba.js&lt;/a&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Check if the link is valid and eligible for PJAX. If yes, prevent normal browser behavior.&lt;/li&gt;
&lt;li&gt;Change the URL using the push state API.&lt;/li&gt;
&lt;li&gt;Start fetching the new page via an XMLHttpRequest.&lt;/li&gt;
&lt;li&gt;Create a new transition instance.&lt;/li&gt;
&lt;li&gt;As soon the new page is loaded, barba.js parses the new HTML (taking .barba-container) and puts the new content on the DOM inside #barba-wrapper.&lt;/li&gt;
&lt;li&gt;The transition instance will take care of hiding the old container and showing the new one.&lt;/li&gt;
&lt;li&gt;As soon as the transition is finished, the old container is removed from the DOM.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="how-to-implement-pjax-on-a-website"&gt;How to implement PJAX on a website?&lt;/h2&gt;
&lt;p&gt;There are many PJAX libraries, like &lt;a href="https://barba.js.org/"&gt;Barba.js&lt;/a&gt;, &lt;a href="https://sennajs.com/"&gt;Senna.js&lt;/a&gt;, &lt;a href="https://github.com/turbolinks/turbolinks"&gt;Turbolinks&lt;/a&gt;, &lt;a href="https://github.com/MoOx/pjax"&gt;Pjax&lt;/a&gt;, etc. Usually, they all offer extremely easy implementation, I prefer using Barba.js for simple websites and Senna.js for more complex ones as it has a better API. In this article, I will use Barba.js&lt;/p&gt;
&lt;p&gt;The implementation consists of 2 parts:
Setting up DOM markup
Script initialization.&lt;/p&gt;
&lt;h3 id="setting-up-dom-markup"&gt;Setting up DOM markup&lt;/h3&gt;
&lt;p&gt;Barba.js needs to know how your website is set up, so it will need a few HTML attributes:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;body&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;data-barba&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;wrapper&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;&amp;lt;!-- put here content that will not change
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt; between your pages, like &amp;lt;header&amp;gt; or &amp;lt;nav&amp;gt; --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;main&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;data-barba&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;container&amp;#34;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;&amp;lt;!-- put here the content you wish to change
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt; between your pages, like your main content &amp;lt;h1&amp;gt; or &amp;lt;p&amp;gt; --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;main&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;&amp;lt;!-- put here content that will not change
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt; between your pages, like &amp;lt;footer&amp;gt; --&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/&lt;span style="color:#f92672"&gt;body&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The wrapper is the main Barba section that contains all your page structure and the Barba container.
The container defines a section in which content is updated automatically when you navigate between your pages.&lt;/p&gt;
&lt;h3 id="script-initialization"&gt;Script initialization&lt;/h3&gt;
&lt;p&gt;After setting up the DOM attributes we simply include Barba.js script in the head of the document and initialize the script:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-html" data-lang="html"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;&lt;span style="color:#f92672"&gt;script&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;type&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;text/javascript&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;src&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;https://cdn.jsdelivr.net/npm/@barba/core&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;async&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;onload&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;barba.init({})&amp;#34;&lt;/span&gt;&amp;gt;&amp;lt;/&lt;span style="color:#f92672"&gt;script&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;That&amp;rsquo;s it.&lt;/p&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;This approach will give a SPA-like feeling of the website since there are much fewer server requests.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/speeding-up-static-websites-with-pjax/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title>My static website updates in 2020</title><link>https://bojanvidanovic.com/blog/my-static-website-updates-in-2020/</link><guid isPermaLink="true">https://bojanvidanovic.com/blog/my-static-website-updates-in-2020/</guid><pubDate>Tue, 30 Jun 2020 00:00:00 +0000</pubDate><dc:creator>Bojan Vidanovic</dc:creator><category>blog</category><description>&lt;p&gt;Some time ago I decided to build a personal website that would last through time. So nothing fancy, no cool animations, no pages, almost no JavaScript and 3rd party services just a plain single page with my basic who-i-am Infos and contact information. And I realized that plan with a static website built with &lt;a href="https://gohugo.io" title="Hugo"&gt;Hugo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But today after some planning and brainstorming, I decided to make updates to this website but keeping in mind the principles I&amp;rsquo;ve set to myself from the begging.&lt;/p&gt;
&lt;p&gt;So here is what&amp;rsquo;s changed&amp;hellip;&lt;/p&gt;
&lt;ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-9401752794288868"
data-ad-slot="2055838653"&gt;&lt;/ins&gt;
&lt;h2 id="hosting"&gt;Hosting&lt;/h2&gt;
&lt;p&gt;I have had my website hosted on &lt;a href="https://firebase.google.com" title="Firebase"&gt;Firebase&lt;/a&gt; for more than a year or two because it was free and with a pretty simple deployment procedure using their CLI tool. After some research, I decided to give a try to &lt;a href="https://netlify.com" title="Netlify"&gt;Netlify&lt;/a&gt;, which has a much more generous free plan than Firebase. But what really made me switch to Netlify was their automatic deployment. After setting up the build commands, Netlify would make a new build and deploy on every git commit, so cool!&lt;/p&gt;
&lt;h2 id="optimizations"&gt;Optimizations&lt;/h2&gt;
&lt;p&gt;Initially, I would build a website and pass it through some &lt;a href="https://gulpjs.com/" title="Gulp"&gt;Gulp&lt;/a&gt; modules for code minification and optimizations. But that operation could be expensive on Netlify since on a free plan you have only 300 minutes of monthly build time. This is more than enough for this kind of website but I wanted not to worry about that in the future, so I removed gulp and moved all minifications and optimizations to &lt;a href="https://cloudflare.com" title="Cloudflare"&gt;Cloudflare&lt;/a&gt;, which also takes care of caching and content distribution across their CDN network.&lt;/p&gt;
&lt;h2 id="content-management"&gt;Content management&lt;/h2&gt;
&lt;p&gt;The biggest change was the implementation of blogging functionality, which I was missing right from the begging. Doing this was fairly straightforward in Hugo, I even made &amp;ldquo;works&amp;rdquo; section to share past and current projects. Hugo also provides out-of-box shortcodes for more dynamic content like YouTube, Twitter post.. etc. Everything went flawlessly.&lt;/p&gt;
&lt;p&gt;The only thing I wanted less &amp;ldquo;technical&amp;rdquo; was how I was managing content. Which is, I would open Vim, edit content, and push the change to GitHub. This approach is ok, but I wanted to edit the content from anywhere and without CLI.&lt;/p&gt;
&lt;p&gt;So the solution was &lt;a href="https://forestry.io" title="Forestry"&gt;Forestry&lt;/a&gt;, which is Git-based CMS with support for Hugo. It&amp;rsquo;s a free service for up to 3 websites, and it does just what I wanted.&lt;/p&gt;
&lt;h2 id="images"&gt;Images&lt;/h2&gt;
&lt;p&gt;Adding blogging functionality also brings images and this where it can get tricky. Hugo already provides some basic image processing functionality but the implementation is not that easy and if not handled well all of the free build time and bandwidth would be used. So I moved all of the images hosting and manipulation to the &lt;a href="https://cloudinary.com/invites/lpov9zyyucivvxsnalc5/eguswydqkh52glxjybrs" title="Cloudinary"&gt;Cloudinary&lt;/a&gt; service.&lt;/p&gt;
&lt;p&gt;Cloudinary has a powerful manipulation API, where I manage all placeholders and responsive images through their HTTP-based API parameters. Besides that, with their free hosting plan I would off-load the unnecessary bandwidth usage from Netlify.&lt;/p&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;That&amp;rsquo;s it as of the upgrades, I hope you like and found useful my first blog post.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/my-static-website-updates-in-2020/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</description><content:encoded>&lt;p&gt;Some time ago I decided to build a personal website that would last through time. So nothing fancy, no cool animations, no pages, almost no JavaScript and 3rd party services just a plain single page with my basic who-i-am Infos and contact information. And I realized that plan with a static website built with &lt;a href="https://gohugo.io" title="Hugo"&gt;Hugo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But today after some planning and brainstorming, I decided to make updates to this website but keeping in mind the principles I&amp;rsquo;ve set to myself from the begging.&lt;/p&gt;
&lt;p&gt;So here is what&amp;rsquo;s changed&amp;hellip;&lt;/p&gt;
&lt;ins class="adsbygoogle"
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-9401752794288868"
data-ad-slot="2055838653"&gt;&lt;/ins&gt;
&lt;h2 id="hosting"&gt;Hosting&lt;/h2&gt;
&lt;p&gt;I have had my website hosted on &lt;a href="https://firebase.google.com" title="Firebase"&gt;Firebase&lt;/a&gt; for more than a year or two because it was free and with a pretty simple deployment procedure using their CLI tool. After some research, I decided to give a try to &lt;a href="https://netlify.com" title="Netlify"&gt;Netlify&lt;/a&gt;, which has a much more generous free plan than Firebase. But what really made me switch to Netlify was their automatic deployment. After setting up the build commands, Netlify would make a new build and deploy on every git commit, so cool!&lt;/p&gt;
&lt;h2 id="optimizations"&gt;Optimizations&lt;/h2&gt;
&lt;p&gt;Initially, I would build a website and pass it through some &lt;a href="https://gulpjs.com/" title="Gulp"&gt;Gulp&lt;/a&gt; modules for code minification and optimizations. But that operation could be expensive on Netlify since on a free plan you have only 300 minutes of monthly build time. This is more than enough for this kind of website but I wanted not to worry about that in the future, so I removed gulp and moved all minifications and optimizations to &lt;a href="https://cloudflare.com" title="Cloudflare"&gt;Cloudflare&lt;/a&gt;, which also takes care of caching and content distribution across their CDN network.&lt;/p&gt;
&lt;h2 id="content-management"&gt;Content management&lt;/h2&gt;
&lt;p&gt;The biggest change was the implementation of blogging functionality, which I was missing right from the begging. Doing this was fairly straightforward in Hugo, I even made &amp;ldquo;works&amp;rdquo; section to share past and current projects. Hugo also provides out-of-box shortcodes for more dynamic content like YouTube, Twitter post.. etc. Everything went flawlessly.&lt;/p&gt;
&lt;p&gt;The only thing I wanted less &amp;ldquo;technical&amp;rdquo; was how I was managing content. Which is, I would open Vim, edit content, and push the change to GitHub. This approach is ok, but I wanted to edit the content from anywhere and without CLI.&lt;/p&gt;
&lt;p&gt;So the solution was &lt;a href="https://forestry.io" title="Forestry"&gt;Forestry&lt;/a&gt;, which is Git-based CMS with support for Hugo. It&amp;rsquo;s a free service for up to 3 websites, and it does just what I wanted.&lt;/p&gt;
&lt;h2 id="images"&gt;Images&lt;/h2&gt;
&lt;p&gt;Adding blogging functionality also brings images and this where it can get tricky. Hugo already provides some basic image processing functionality but the implementation is not that easy and if not handled well all of the free build time and bandwidth would be used. So I moved all of the images hosting and manipulation to the &lt;a href="https://cloudinary.com/invites/lpov9zyyucivvxsnalc5/eguswydqkh52glxjybrs" title="Cloudinary"&gt;Cloudinary&lt;/a&gt; service.&lt;/p&gt;
&lt;p&gt;Cloudinary has a powerful manipulation API, where I manage all placeholders and responsive images through their HTTP-based API parameters. Besides that, with their free hosting plan I would off-load the unnecessary bandwidth usage from Netlify.&lt;/p&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;That&amp;rsquo;s it as of the upgrades, I hope you like and found useful my first blog post.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bojanvidanovic.com/blog/my-static-website-updates-in-2020/"&gt;View the complete entry on Bojan Vidanovic&lt;/a&gt;&lt;/p&gt;</content:encoded></item></channel></rss>