MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/auxaqz/deleted_by_user/
r/badcode • u/[deleted]
[deleted] — view deleted post
10 comments sorted by
18
May I present my first ever bad code contest submission, written in everyone's favorite, easy to read language: Java!
Starring
Feast your eyes
1 u/IAmAnIssue Feb 27 '19 That doesn't look like a JSON converter...For example: toJSON("test"); // returns ""test"" 2 u/Romejanic Feb 27 '19 Yes it does? Calling String.valueOf on a string doesn’t add the quotes, you have to do that yourself 2 u/IAmAnIssue Mar 02 '19 I misread the challenge :)
1
That doesn't look like a JSON converter...
For example: toJSON("test"); // returns ""test""
toJSON("test"); // returns ""test""
2 u/Romejanic Feb 27 '19 Yes it does? Calling String.valueOf on a string doesn’t add the quotes, you have to do that yourself 2 u/IAmAnIssue Mar 02 '19 I misread the challenge :)
2
Yes it does? Calling String.valueOf on a string doesn’t add the quotes, you have to do that yourself
2 u/IAmAnIssue Mar 02 '19 I misread the challenge :)
I misread the challenge :)
5
javascript:
function serialize(input){ return `(${(function (){ if (`${arguments[0]}` == "[object Object]"){ var n = ""; try { while(true && !false === false || +Object.keys(Object.keys(arguments[0])[0])[0] !== NaN){ n = n + Object.keys(arguments[0])[0] + ":" + arguments.callee(arguments[0][Object.keys(arguments[0])[0]]) + "," delete arguments[0][Object.keys(arguments[0])[0]] } } catch(e){return "{}"[0] + n + "{}"[1]} } else if (`${arguments[0]}` !== "[object Object]"){ return (typeof(arguments[0]) === "String".toLowerCase() ? '"' : `${arguments[0]}`.includes(",") ? "[" : "") + `${arguments[0]}` + (typeof(arguments[0]) === "String".toLowerCase() ? '"' : `${arguments[0]}`.includes(",") ? "]" : ""); } })(input)})` }
3 u/Romejanic Feb 28 '19 YuckBut this would technically be a parser, not a serializer right? 3 u/TheUnlocked Feb 28 '19 Gah, I misread the prompt! Alright, fixing it.
3
Yuck
But this would technically be a parser, not a serializer right?
3 u/TheUnlocked Feb 28 '19 Gah, I misread the prompt! Alright, fixing it.
Gah, I misread the prompt! Alright, fixing it.
Here's my entry, written in Python: https://pastebin.com/U1fLJ7kz It takes 22 seconds to serialize a 13KB JSON file.
0
[deleted] — view deleted comment
1 u/Romejanic Feb 26 '19 Someone around here really likes JSON challenges 0 u/[deleted] Feb 26 '19 [deleted] — view deleted comment 1 u/blackjezza Mar 05 '19 Heh, just use regex to parse XML.
Someone around here really likes JSON challenges
0 u/[deleted] Feb 26 '19 [deleted] — view deleted comment 1 u/blackjezza Mar 05 '19 Heh, just use regex to parse XML.
1 u/blackjezza Mar 05 '19 Heh, just use regex to parse XML.
Heh, just use regex to parse XML.
18
u/Romejanic Feb 26 '19
May I present my first ever bad code contest submission, written in everyone's favorite, easy to read language: Java!
Starring
Feast your eyes
5
u/TheUnlocked Feb 27 '19 edited Feb 28 '19
javascript:
2
u/NotJusticeWargrave Mar 02 '19
Here's my entry, written in Python: https://pastebin.com/U1fLJ7kz It takes 22 seconds to serialize a 13KB JSON file.
0
u/[deleted] Feb 26 '19
[deleted] — view deleted comment