async
is all present in JavaScript for two reasons:- you make network requests all the time
- JavaScript is single threaded, so if you are waiting for a network request, the UI freezes, see remarks on the deprecation of synchronous HTTP request at: developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Synchronous_and_Asynchronous_Requests
However, it is also Hell: how to convert
async
to sync in JavaScript.Sometimes, these are more than just mechanics, but also have deeper life analogues. The title of Zen and the Art of Motorcycle Maintenance comes to mind. Sometimes they are just mechanics.
With more philosophical metaphors:
- when your bike breaks, that provides an unique opportunity to learn how to fix it: try to fix your own bike before taking it to the shop
- if the wind is blowing against you on the way out, it will likely blow behind you on the way back. But remember that the other way around also applies.
- always take one extra clothing layer than what you think you will need in your back pocket or sport bag, especially when time is changing fast in Sprint and Autumn. The weather on the road outside of town can change very quickly!
- if you took a turn, and it feels wrong, stop to check the map, and possibly backtrack to safety. When it feels wrong, it usually is a bad idea, e.g. roads where cars are too fast/too many. But if you take a wrong turn and it feels right, then follow it without fear and see what it leads to!
- don't carry a speedometer on your bike. Analysis can be done afterwards on Strava. The only measurement that matters is "how awesome am I feeling right now?". Live in the moment instead of checking your speedometer every 10 seconds.
- cycle when you body calls it out of addiction, not out a goal that you've made up that must be reached
With less philosophical metaphors:
- learn how much water and food you need to take for a trip. Otherwise, you will bonk at some time, when you least expect, it happens very suddenly.And then you better hope to God that you can find a food shop nearby. Luckily this was the case for Ciro's first and only bonk so far.And besides bonking all out, being tired and hungry makes you make stupid decision, especially where traffic is involved!Food is safety. Light is safety. Time is safety. Calm is safety. Chocolate bars and candy cannot count as lunch food, only delay lunch. A sandwich with ham cheese and salad is food. A bag of M&M's with a can of soda can bring you back from the dead.When you are not in familiar grounds, take twice as much as you think you might possibly ever need. Hofstadter's law.You will also learn that, surprise surprise, carbohydrates that you ate one or two days before a ride stay stored in your liver and muscles, and also greatly affect how quickly you will bonk, thus the concept of carbohydrate loading.And surprise surprise: heat can also make you bonk! Who would have thought!
- correct saddle hight is fundamental, your legs must be almost fully stretched at the bottom position
- it is impossible to reach the correct tire pressure with (cheap?) hand pumps, their only purpose is to fill up a flat tire so you can get home after a long ride. But a track pump.
- clean and lube your chain. The speed benefit is instantaneous and mind blowing. It also greatly improves gear shifting.This also prevents the chain from rusting, because the lube takes up the place where water would stay, and the muck makes it harder for water to evaporate.This is the most common bike maintenance mistake you see on the streets: people with that high pitched overly dry chain noise.
- when a piece on your bike breaks and has no clear name written on it, you can try to identify it Google images
- the more you watch YouTube maintenance videos without haste, the more you end up learn random new stuff that unexpectedly saves you later
- if you took a turn, and it feels wrong, stop to check the map, and possibly backtrack to safety. When it feels wrong, it usually is a bad idea, e.g. roads where cars are too fast/too many
- public place with lots of people are bicycle parking Hell, because due to anonymity and the large number of distractions, it becomes exponentially more likely that someone will fuck you bike somehow, e.g. by dropping it on the ground. Always search a bit for a reasonable place to park, and avoid overcrowded parking spaces at all costs.
- gear change matters
- when you get on your bike to start riding, start riding slowly and gradually switch up pedal forces and gears. Things may have shifted in a weird position as it gets kicked around in parking. Ciro managed to bend his derailleur like that!
- spin to win, AKA learn to user your gears
- it is not shameful to ride on your lower gears on a hill. You can actually go surprisingly fast with them, and conserve energy for later. Learn when to use each gear ratio.
- learn to identify your suppliers:
- www.wiggle.co.uk/: in Europe, this is best place to buy clothing from, and also good for some bike parts. It is the most organized website, and contains non-generic shit which Amazon is full of.For bike parts Amazon is also worth looking into however. Bike parts a bit different from clothing because you have to make sure that stuff fits, so you hopefully know exactly the part name before before buying it, and therefore website organization is not as crucial.Wiggle is however guilty of shameless: discounts that happen more often than not
- always take your lights off the bike into your bag when you park, anywhere, and for any amount of time, even if a quick stop. Drug addicts are everywhere, always ready love to steal and resell them.
- sometimes you do something stupid like going into a really muddy path, and it is really fun, because you've never been there in your life. But then your bike gets really dirty, and your feet are wet and freezing, and you promise yourself you will never do something that stupid again. But then you do it again in a different location, because it was too much fun. Once more unto the breach just comes to Ciro's mind every such time. Embrace this.
2022: saddle and seat post stolen near home. Burn in Hell, motherfuckers. Bought a seatpost marked SP342 MICROPOST ALLOY 3 30.4mm. Like this: web.archive.org/web/20220208115055/https://www.ebay.co.uk/itm/Lightweight-Alloy-Micropost-Bike-MTB-Seatpost-25-4mm-Seat-Pin-300m-Long-Silver-/402311713393 but 30.4mm. OK, bought the Park Tool PW-5 15mm pedal wrench tool. Wasn't expensive at all.
TODO understand other markings on receipt: "18 Flourish FS W Sil XS".
The exact specs pages is lost forever. Closest one we've got is the 2020: web.archive.org/web/20200927204537/https://www.liv-cycling.com/gb/flourish-2
Frame: size: XS. Marking near bottom bracket: F/N GY17Z1327 DK: WGI GY17Z1327 F ES:BI-2339.
Seatpost: TODO diameter. Measured in store 30.4mm after original stolen, although 2020 says 30.9. 30.4mm seemed to fit OK, and measuring with ruler gives 30.5/30.6, I don't think a 30.9 can possibly fit.
Saddle: Liv Contact Comfort Plus Saddle, color golden brown. Same as this but blown: www.liv-cycling.com/gb/contact-comfort-plus-saddle-liv Actual color:
As if Chinese character weren't evil enough, their fast hand written form is even more unintelligible. It is like Hell within Hell.
It is also very beautiful it must be said.
Framework built on top of React.
Officially recommended by React[ref]:
Recommended ToolchainsIf you’re building a server-rendered website with Node.js, try Next.js.
gothinkster/realworld blog example by Ciro Santilli: node Express Sequelize Next.js realworld example app.
Basically what this does is to get server-side rendering just working by React, including hydration, which is a good thing.
Next.js sends the first pre-rendered HTML page along with the JavaScript code. Then, JavaScript page switches just load the API data.
Next.js does this nicely by forcing you to provide page data in a serialized JSON format, even when rendering server-side (e.g. the return value of
getServerSideProps
). This way, it is also able to provide either the full HTML, or just the JSON.Some general downsides:
- it does feel like they don't document deployment very well however, especially non-Vercel options, which is the company behind Next.js. I'm unable to find how to use a non Vercel CDN with ISR supposing that is possible.
- Next.js is very opinionated, and like any opinionated library it is sometimes hard to know why something is/isn't happening, and sometimes it is hard/impossible to do what you want with it unless they add support. They have done good progress, but even as of 2022, some aspects just feel so immature, some major-looking use cases are not very well done.
In theory, Next.js could be the "ultimate frontend framework". It does have a lot of development difficulties that need to be ironed out, but the general concepts, and things it tries to integrate, including e.g. webpack, TypeScript, etc. are good. Maybe the question is when will someone put it together with an amazing backend library and dominate and finally put an end to the infinite number of Js Frameworks!
In-tree examples at: github.com/vercel/next.js/tree/canary/examples
In order to offer its amazing features, Next.js is also extremely opinionated, which means that if something wasn't designed to be possible, it basically isn't.
No prerender with custom server? It forces you to write your API with next as well? Or does it mean something else?
TODO can it statically generate pages that are created at runtime? E.g. if I create a new blog post, will it automatically upload a static page? It seems that yes, and that this is exactly what Incremental Static Regeneration means:However, Ciro can't find any mention of how to specify where the pages are uploaded to... this is pat of the non-Vercel deployment problem.
- github.com/vercel/next.js/discussions/25410
- vercel.com/docs/next.js/incremental-static-regeneration
- github.com/vercel/next.js/discussions/17711
- www.reddit.com/r/nextjs/comments/mvvhym/a_complete_guide_to_incremental_static/
- github.com/vercel/next.js/discussions/11552#discussioncomment-115595
- stackoverflow.com/questions/62105756/how-to-use-aws-with-next-js
- github.com/vercel/next.js/discussions/17080
- github.com/vercel/next.js/discussions/16852
Can't ISR prerenter by URL query parameters:
That plus the requirement to have one page per file under
pages/
leads to a lot of useless duplication, because then you are forced to place the URL parameters on the pathnames."Module not found: Can't resolve 'fs'" Hell. The main reason this happens seems to be the that in a higher order component, webpack can't determine if callbacks use the require or not to remove it from frontend code. Fully investigated and solved at:
Overviews:
- www.reddit.com/r/reactjs/comments/8evy5d/what_are_the_downsides_to_nextjs/ 2017 What are the downsides to Next.js?