Ccoolboy

u/Ccoolboy



I was trying to find a way to store the API key for our mission-critical data. I was looking into two-way hashing algorithms, but it turns out the most elegant solution was hidden right in front of us: String.fromCharCode() returns a string from a UTF-16 code. Using this, we can encrypt evertyhing SAFELY without the user ever knowing what the value is because they can't ctrl + f the code!

For example:

var adminPassword = String.fromCharCode(89)
+ String.fromCharCode(111)
+ String.fromCharCode(117)
+ String.fromCharCode(32)
+ String.fromCharCode(99)
+ String.fromCharCode(97)
+ String.fromCharCode(110)
+ String.fromCharCode(39)
+ String.fromCharCode(11
11519

r/shittyprogramming•

Let's say I have this code right here:

var condition = true;
if(condition === true) {
    return true;
} else {
    return false;
}

Wouldn't it be way more faster if I did this?

var condition = true; if(condition === true) { return true; } else { return false; }

That way the compiler doesn't have to hop to the next line to keep reading the code. This eliminates a lot of work that the compiler usually does that may slow down my application.

12223


r/shittyprogramming•

So normally, you would have JavaScript code placed in another file or in a <script> tag, right? What if we don't want corporations stealing our code? I figured out how to fix that.

Put this little snippet of code at the bottom of your HTML file:

<link rel="stylesheet" href="nothing-important-here.css">
<script id="super-secret-code"></script>

then create another file named nothing-important-here.css with the following:

#super-secret-code::before {
    content: "alert('hello world!1!!one!11!!')"
}

Place whatever JavaScript you want in the content attribute of the script tag, and watch as those corporations scramble to find out how you

13716