Better HN
topnewbestaskshowjobs
Log inSign up

lbatchelor

90 karma · joined Nov 3, 2016 (10y ago) · 20 submissions

Submissions

comment 1w ago · link · parent

I can't tell if this is trolling or not.. but this is complete gibberish right?

comment 11mo ago · link · parent

Your landing page makes a lot of claims that are not true

- that the code is 100% mit licensed (it's not)

- that this is in any way gdpr compliant (there are literal rules around this)

- that your data is encrypted and private (it isn't encrypted? Unless being written in Italian is encryption now?)

- that they'll have 99.9% uptime (there is no SLA for vercel hobby tiers)

- "No middlemen. No third-party storage. Every submission lives in your GitHub..." (that is the very definition of third-party storage and a middleman)

comment 3y ago · link · parent

You are on a completely different level. Wow. I am going to spend absolutely too long tomorrow trying to work out how on earth you've done that. Cheers!

comment 3y ago · link · parent

Can't update the post now, but I've actually got it down to 713 bytes, which I'm pretty happy with! I could remove features/colors/styles at this point, but I think I'll leave it there for now.

If anyone's interested, I've tried to annotate a fair amount of the tricks I've used so far: https://github.com/lukebatchelor/url-snake/blob/main/golf/de...

let e=document.body,t="Space: start/reset. Arrows: Move<div><canvas id=a><style>#a{border:solid}{background:tan}</style>",r=40,n=400,o,d=[[4,3]],s=d[0],c="#000",p=(e="red",t=n,a=0,l=a)=>{C[f="fillStyle"]=e,C.fillRect(ar,lr,t,t)},h=(e,t=n/2,a=t,l="center")=>{C[f]=c,C.textAlign=l,C.fillText(e,t,a)};e.innerHTML=t,C=a.getContext`2d`,a.height=a.width=n,C.font="30px f",e.onkeyup=({which:e})=>{36<e&&e<41?H=e-38:32!=e||o||(o=1,d=[[4,3]],H=2,S=0)},setInterval(i=>{if(o){let[e,t]=d[0],a=e+H%2,l=t+(H-1)%2,n=([e,t])=>e==a&&t==l;if(d.pop(),a<0||9<a||l<0||9<l||d.some(n))return o=0,p(),h`:(`;d=[[a,l],...d],n(s)&&(d[++S]=d[S-1],s=[(D=new Date)%10,DS%10]),p`tan`,d.map(e=>p(c,r,...e)),p(i,r,...s),h(S,9,30,"left")}},n);

comment 3y ago · link · parent

I think it was changed by mods unfortunately :/

comment 3y ago · link · parent

Ooh! Don't know how I missed that, I'll give it a go! Cheers!

comment 3y ago · link · parent

Edit: I've actually managed to get the javascript down to a measly 859 bytes now. Pretty happy with some of the code golfing techniques I came up with

comment 3y ago · link · parent

That was actually the original plan! But unfortunately it seems like my phone's qr code reader won't open it in a browser automatically. I then tried using a url shortener to link to it but absolutely no shortener that I could find would take a data: url.

I could host my own shortener to do it, but it feels like that is cheating the spirit of the challenge.

I'll keep playing with it though, add touch device controls, maybe a site to allow generating different versions of the url (different colours, sizes, game over messages, etc).

comment 3y ago · link · parent

Wow, that's actually impressive. Any idea how chat gpt would know that? Surely it's not making the request for it and surely it's not actually decoding any base64 right?

10.

Show HN: URL Snake(github.com ↗)

114 points · by lbatchelor · 3y ago · 32 comments

comment 5y ago · link · parent

Ha! That is so cool. I was super interested in the idea so tried doing it myself without looking at your solution and came up with a quite an elegant solution using only 8 formulas and some named ranges (could be 4 if you inlined them more but I kept them separate for clarity).

https://docs.google.com/spreadsheets/d/1T3bv8ThluHc18ghI8u9m...

Thank you for the inspiration!

comment 6y ago · link · parent

Inspired by ts-sql (https://github.com/codemix/ts-sql) and json-parser-in-typescript-very-bad-idea-please-dont-use (https://github.com/jamiebuilds/json-parser-in-typescript-ver...) I decided to try writing a tic tac toe ai in typescripts type system. Mainly as a way to get exposure to more complex typing. It's not as clean or impressive as these other implementations but I learned a lot building it!

Massive shout out to Barld Boot who's tic tac toe implementation I based this off! https://medium.com/@bakeds/play-tic-tac-toe-with-the-help-of...

13.

Show HN: Tic Tac Toe AI Implemented in TypeScript Type System(github.com ↗)

4 points · by lbatchelor · 6y ago · 1 comment

comment 8y ago · link · parent

Not working for me either, in Australia

comment 8y ago · link · parent

Oh! Apologies. You are completely right. No idea how I missed that.

Pushed a fix. Thanks for reporting!

comment 8y ago · link · parent

Hiya, I pushed a fix last night when someone reported something similar.

I tried your sequence and it looks like it loses now so I think that might be fixed.

17.

Show HN: A Tic Tac Toe “AI” Built with Only HTML and CSS(css-ttt.netlify.com ↗)

9 points · by lbatchelor · 8y ago · 6 comments