HackerTrans
TopNewTrendsCommentsPastAskShowJobs

nelsontky

no profile record

Submissions

Show HN: Decentralized Pokemon game on the Solana blockchain

solana.playspokemon.xyz
2 points·by nelsontky·4 ปีที่แล้ว·0 comments

Show HN: I created a URL shortener that can be entirely hosted on GitHub Pages

github.com
355 points·by nelsontky·6 ปีที่แล้ว·176 comments

comments

nelsontky
·4 ปีที่แล้ว·discuss
Nope it really depends on the plan/pricing you get. The cheapest "droplet" is lousier than a chromebook but there is a wide range of VPSes of varying specs you could choose from! https://docs.digitalocean.com/products/droplets/concepts/cho...
nelsontky
·4 ปีที่แล้ว·discuss
Nice thats what i do too! I use a combination of code-server running on a gcloud instance and chrome remote desktop to do my work on a lenovo duet chromebook!
nelsontky
·6 ปีที่แล้ว·discuss
Cuz they are supposed to be called by people building various apps, and it does not make sense to limit the source of the network requests
nelsontky
·6 ปีที่แล้ว·discuss
Thank you for the reply! I definitely learnt a lot from your comprehensive replies. Personally, I am just getting started in web development and I have traditionally written everything with the help of frameworks like ReactJS and the like and the abstractions these frameworks provide means I actually don't know the nitty gritty of how things work. Cross browser compatibility or efficiency was definitely not something I considered and they are definitely very valid considerations. And HTTP redirects via service workers sounds damn interesting! I will go read up on those now! Thank you for the comment I did learn a lot and will work these suggestions into the code base when I do have the time :')
nelsontky
·6 ปีที่แล้ว·discuss
Wow.. I don't even know where to start.. Thanks for the heads up that's cool beans!
nelsontky
·6 ปีที่แล้ว·discuss
Base64 would probably be longer than the original URL. I can't really see how short pieces of text (like URLs) could be compressed to become smaller. That being said it's definitely a cool concept! I once worked on a code playground kinda thing for my school and there was a function to share the code written in a URL. How we did it was just to include the whole piece of code as a URL param in base64!
nelsontky
·6 ปีที่แล้ว·discuss
Oh that is cool! It does remind me of https://telegra.ph/ by Telegram! (Even though they weren't really advertising it as a universal shortener). Just a quick question, how did you promote your platform!
nelsontky
·6 ปีที่แล้ว·discuss
I would suppose doing a push every time a new URL is added would be quite expensive for GitHub too. Plus, GitHUb pages is not updated immediately upon push and it takes some time for new links to work. That being said, this is definitely not the most realistic implementation of a URL shortener. It is meant to be cool and hacky and definitely not used for production!
nelsontky
·6 ปีที่แล้ว·discuss
Well I would believe that even a `json` file or any other form of storage written to disk is considered a database, But your suggestion definitely brings it further away from an actual database!
nelsontky
·6 ปีที่แล้ว·discuss
I do have YOURLS on my personal domain/server. It does work well for me and has no spam as link creation can be made private!
nelsontky
·6 ปีที่แล้ว·discuss
Indeed and especially with many shorteners not being maintained and going down. That being said, this one is not meant to be an actual URL shortener, but rather, a cool hack and it is not meant to be used widely or used in production.
nelsontky
·6 ปีที่แล้ว·discuss
Hmm having a GitHub action redeploy the site is not instantaneous and it does take up to 1 minute for the site (and consequently the new short link) to be updated. Nevertheless, that is a sweet idea, and there are other replies that suggested using a static site generator to generate one html file per short link, with each html file containing a "redirect" tag in <head>. This idea can definitely be combined with a GitHub action. Personally I feel that is overkill, because if I were doing something so elaborate, I would have opted for a simpler and more scalable option like Google Cloud Firestore or Firebase URLs
nelsontky
·6 ปีที่แล้ว·discuss
I am calling GitHub's official API. APIs are not supposed to have any CORS restrictions.
nelsontky
·6 ปีที่แล้ว·discuss
If the links were to be stored in files, I probably would run a GitHub action on every push to statically generate the pages for new links!
nelsontky
·6 ปีที่แล้ว·discuss
Probably GitHub's API went down for an instance since I didn't make any new pushes then!
nelsontky
·6 ปีที่แล้ว·discuss
Thank you for the advice! I love that domain though, have always been trying to find a 4 character URL shortener since GoDaddy killed x.co. Will definitely use your service more than I use my own HAHA. That being said, my project is not meant to be seriously used, just kinda a cool hack that is not meant to work forever/work reliably. Appreciate your comments and all the best for your service! You just gained one more (non) malicious user!
nelsontky
·6 ปีที่แล้ว·discuss
I figured that since the dependencies were only used in the build step it's not really considered. That being said, I didn't know ES2015 had `.then()` and was kinda trying out babel since I always used CRA and never knew what was going on behind the scenes. The dependencies were definitely not needed but in the production build, they aren't really "unminimal"
nelsontky
·6 ปีที่แล้ว·discuss
My fault. Didn't know that ES2015 actually supported `.then()`. Anyway, this was also an exercise for me to learn about babel (I use CRA all the time so have no idea what is going on behind the scenes) and this was a nice intro!
nelsontky
·6 ปีที่แล้ว·discuss
Thank you for the kind comments! That's was the aim of the project, to make it fun and easy to create new short links!
nelsontky
·6 ปีที่แล้ว·discuss
This is definitely just a fun hack and not meant for production! For production ready short links with low overheads I would personally recommend using Firebase URLs or cloud firestore.