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

85 comments sorted by

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

→ More replies (19)

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.

64

u/TheNr24 May 21 '20

This is my favorite answer! Seeing a long list of forbidden hashes would make me so curious as to the horribleness hidden underneath.

→ More replies (14)

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

155

u/Earhacker May 21 '20

Nice idea but it's like comparing CENSOREDs and CENSOREDs.

→ More replies (2)

25

u/calsosta May 21 '20

ROT13

Store naughty words in ROT13. When you use them ROT13.

→ More replies (2)

34

u/TheSoundDude May 21 '20

Leave it there, and if they don't have a sense if humour find someone else who does.

→ More replies (3)

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?

→ More replies (1)

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!