Details
-
AboutCoder
-
SkillsPython, JavaScript and Golang
Joined devRant on 5/29/2018
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
-
What the fuck is happening with that whole Vue vs React thing? Use whatever you want, don't start some fucking war. I see people saying that one is better than other, but it's truly not. Use the one that peovides you with everything you need and fuck off from the other one8
-
"We are looking for a GDPR expert to be hired in our company"
"I am an experienced data protection manager"
"Oh, fine! May you give us your phone number?"
"No"
"Your email address?"
"No"
"You're hired"4 -
Client: I want a mobile game with Leaderboards, Social media sign-ins, In-game store, Ads, IAP etc in 2 months
Me: Cool, what’s your budget?
Client: $5020 -
So, I've been having to deal with server issues and other BS. All of these issues have caused all of my websites to be down. For the longest time, I couldn't get Nginx to find my websites' directories except for the default Nginx website, so I changed the default Nginx website to what you see in the image.
I tried to be funny, did I succeed? Even a little bit?8 -
I really like React and I thought for a second that Vue will overcome React with stars but fortunately developers know what is better 😂😂😂😍21
-
That awkward/awesome moment when you are looking at dank memes at work and your boss is standing behind you and laughs :')1
-
I wrote a database migration to add a column to a table and populated that column upon record creation.
But the code is so freaking convoluted that it took me four days of clawing my eyes out to manage this.
BUT IT'S FINALLY DONE.
FREAKING YAY.
Why so long, you ask? Just how convoluted could this possibly be? Follow my lead ~
There's an API to create a gift. (Possibly more; I have no bloody clue.)
I needed the mobile dev contractor to tell me which APIs he uses because there are lots of unused ones, and no reasoning to their naming, nor comments telling me what they do.
This API takes the supplied gift params, cherry-picks a few bits of useful data out (by passing both hashes by reference to several methods), replaces a couple of them with lookups / class instances (more pass-by-reference nonsense). After all of this, it logs the resulting (and very different) mess, and happily declares it the original supplied params. Utterly useless for basically everything, and so very wrong.
It then uses this data to call GiftSale#create, which returns an instance of GiftSale (that's actually a Gift; more on that soon).
GiftSale inherits from Gift, and redefines three of its methods.
GiftSale#create performs a lot of validations / data massaging, some by reference, some not. It uses `super` to call Gift#create which actually maps to the constructor Gift#initialize.
Gift#initialize calls Gift#pre_init (passing the data by reference again), which does nothing and returns null. But remember: GiftSale inherits from Gift, meaning GiftSale#pre_init supersedes Gift#pre_init, so that one is called instead. GiftSale#pre_init returns a Stripe charge object upon success, or a Gift (and a log entry containing '500 Internal') upon failure. But this is irrelevant because the return value is never actually used. Pass by reference, remember? I didn't.
We're now back at Gift#initialize, Rails finally creates a Gift object using the args modified [mostly] in-place by all of the above.
Another step back and we're at GiftSale#create again. This method returns either the shiny new Gift object or an error string (???), and the API logic branches on its type. For further confusion: not all of the method's returns are explicit, and those implicit return values are nested three levels deep. (In Ruby, a method will return the last executed line's return value automatically, allowing e.g. `def add(a,b); a+b; end`)
So, to summarize: GiftSale#create jumps back and forth between Gift five times before finally creating a Gift instance, and each jump further modifies the supplied params in-place.
Also. There are no rescue/catch blocks, meaning any issue with any of the above results in a 500. (A real 500, not a fake 500 like last time. A real 500, with tragic consequences.)
If you're having trouble following the above... yep! That's why it took FOUR FREAKING DAYS! I had no tests, no documentation, no already-built way of testing the API, and no idea what data to send it. especially considering it requires data from Stripe. It also requires an active session token + user data, and I likewise had no login API tests, documentation, logging, no idea how to create a user ... fucking hell, it's a mess.)
Also, and quite confusingly:
There's a class for GiftSale, but there's no table for it.
Gift and GiftSale are completely interchangeable except for their #create methods.
So, why does GiftSale exist?
I have no bloody idea.
All it seems to do is make everything far more complicated than it needs to be.
Anyway. My total commit?
Six lines.
IN FOUR FUCKING DAYS!
AHSKJGHALSKHGLKAHDSGJKASGH.7 -
I’ve finally gotten a desktop for work. So I don’t have to use my own mbp.
I think I’ve got enough screens, for now.
What annoys me is that none of them are same type, size or brightness12 -
Interview.
X: So, do you have any weaknesses?
Y: Yes, I'm very honest.
X: But I don't think that's a weakness
Y: I don't give a fuck what you think2 -
*15 new emails*
We have updated our privacy policy
We have updated our privacy policy
We have updated our privacy policy
We have updated our privacy policy
We have updated our privacy policy
We have updated our privacy policy
We have updated our privacy policy
We have updated our privacy policy
We have updated our privacy policy
We have updated our privacy policy
We have updated our privacy policy
We have updated our privacy policy
We have updated our privacy policy
We have updated our privacy policy
We have updated our privacy policy41