4 ms·
Hi, I'm Justin, creator of My Smoothie Stack. I'm a new developer so I'm grateful for any feedback on my source code [0]. Here's my personal recipe [1]. If yo
by somewhatjustin 4y ago
Hi, I'm Justin, creator of My Smoothie Stack. I'm a new developer so I'm grateful for any feedback on my source code [0].
Here's my personal recipe [1].
If you take a look at that URL, you'll see it's quite long. I wanted to be able to share recipes, but I don't have any backend knowledge. I had to get creative and store the object representing the recipe in an object encoded in Base64. This presented some character escaping issues, but those were manageable.
I don't expect this project to change the world. I just wanted a way to practice my newfound React skills and share some smoothie recipes. If you give this a try, please share your recipe!
Thanks for your time!
[0] https://github.com/somewhatJustin/smoothie-stack/ https://github.com/somewhatJustin/smoothie-stack/
[1] https://mysmoothiestack.com/?share=eyJpbmdyZWRpZW50cyI6WyJGcm96ZW4gcmFzcGJlcnJpZXMiLCJHcmVlayB5b2d1cnQiLCJQZWFudXQgYnV0dGVyIiwiUmF3IGFsbW9uZHMiLCJXaGV5IHByb3RlaW4gcG93ZGVyIiwiQXRobGV0aWMgZ3JlZW5zIChwb3dkZXIpIiwiQWxtb25kIG1pbGsiLCJDYWNhbyBuaWJzIiwiIl0sImFtb3VudCI6WyIxLzIgY3VwcyIsIjEvMyBjdXBzIiwiMS8zIGN1cHMiLCIxIHNtYWxsIGhhbmRmdWxsIiwiMSBzY29vcCIsIjEgc2Nvb3AiLCIyIG96IiwiMSB0c3AiLCIiXSwibm90ZXMiOiJBZGp1c3QgYWxtb25kIG1pbGsgYXMgbmVlZGVkIGZvciBjb25zaXN0ZW5jeS4gVGhpcyByZWNpcGUgaXMgb3B0aW1pemluZyBmb3IgcHJvdGVpbiB3aXRob3V0IGhhdmluZyB0b28gbXVjaCBzdWdhci4ifQ== https://mysmoothiestack.com/?share=eyJpbmdyZWRpZW50cyI6WyJGc...
- mdaniel 4y agoCongratulations on your launch! > This presented some character escaping issues, but those were manageable. In case you were interested, there's a section devoted to that in RFC 3548: https://datatracker.ietf.org/doc/html/rfc3548#section-4 https://datatracker.ietf.org/doc/html/rfc3548#section-4 with the tl;dr of `s/[+]/-/; s/[/]/_/` and then omitting the trailing "=" characters and just padding the incoming b64 since (AFAIK) one can add as many "=" as they'd like and it'll just ignore extra ones Depending on your interoperability interests, you can shave a bit of text out of it by shortening the JSON key names `"i"`, `"a"`, `"n"`, and then also `.filter(Boolean)` to nuke those two trailing empty strings
- normac2 4y ago> In case you were interested, there's a section devoted to that in RFC 3548: https://datatracker.ietf.org/doc/html/rfc3548#section-4 https://datatracker.ietf.org/doc/html/rfc3548#section-4 with the tl;dr of `s/[+]/-/; s/[/]/_/` and then omitting the trailing "=" characters and just padding the incoming b64 since (AFAIK) one can add as many "=" as they'd like and it'll just ignore extra ones Just to add one thing: in case Justin isn't familiar, "s/original_thing/replacement_thing" is a figure of speech often used in the hacker subculture to mean "replace original_thing with replacement_thing." It comes from some languages and editors like Perl and Vim/vi, where that syntax (and variations) are used for search and replace.
- somewhatjustin 4y agoThanks for clarifying, I was not aware!
- somewhatjustin 4y agoThanks for taking a look! > In case you were interested, there's a section devoted to that in RFC 3548: https://datatracker.ietf.org/doc/html/rfc3548#section-4 https://datatracker.ietf.org/doc/html/rfc3548#section-4 with the tl;dr of `s/[+]/-/; s/[/]/_/` and then omitting the trailing "=" characters and just padding the incoming b64 since (AFAIK) one can add as many "=" as they'd like and it'll just ignore extra ones Thanks! I'll check this out. > Depending on your interoperability interests, you can shave a bit of text out of it by shortening the JSON key names `"i"`, `"a"`, `"n"`, and then also `.filter(Boolean)` to nuke those two trailing empty strings This is a good idea. I might already be filtering those empty strings but I'll have to check.