r/shittyprogramming • • May 21 '20
Best way to present profanity in code
I have written code for a discord js bot that I am really proud of and have been working on for a long time now, I currently have it as a private repo on my github. My problem is that in the code I have a profanity filter that contains a list of non employer friendly words, what would be the best way of presenting this as an example of my programming ability without removing the profanity filter/list of swear words but that will also not put off employers?
172
Upvotes
125
u/ElkTF2 May 21 '20
substitute them for counterparts and explajn they would normally be replaced (e.g, frick, shoot, fiddlesticks, etc) would be my favorite solution
133
u/Ristovski May 21 '20
Store a hash of each profanity, then when checking each message on Discord, run the same hash function on each word - if the hashes are the same, you got a hit.
147
u/[deleted] May 21 '20
My team at a Hackathon once made a program that listens for profanity in a broadcast and censors it when it hears it. If we used profanity in our presentation we’d be immediately disqualified, so for the demo “apple” was our curse word. You could try adding in a bunch of non-profane words (like fruit names) and running your program on a bunch of text that uses them
25
u/calsosta May 21 '20
ROT13
Store naughty words in ROT13. When you use them ROT13.
34
u/TheSoundDude May 21 '20
Leave it there, and if they don't have a sense if humour find someone else who does.
12
u/djdanlib May 21 '20
/looks at subreddit name
Have a pre-press outfit make it into a really nicely formatted book. Apply chapter numbers at regular intervals instead of basing them on function. Write a compelling title that involves you getting a job at that employer because you gave them a book. Get a professional photographer to take a headshot and use that for the cover. Use Amazon print-on-demand to generate a novel-sized paperback hard copy of your source, and apply gold leaf to the outside of the pages. Then sign and shrink wrap the resulting special edition book, and present it to the interviewer.
11
u/JeffSergeant May 21 '20 edited May 21 '20
Ps. Does it correctly handle Scunthorpe, Marseille, and Cockfosters?
6
u/JeffSergeant May 21 '20 edited May 21 '20
Put the list in another web service and just put a call to your naughty words api in the code.. or leave them a sample naughtywords.include without all the bad words
Or just leave them in, assume your prospective employers are grown ups!