r/shittyprogramming • • Mar 20 '18

<wrong_sub>this</wrong_sup> Click the appropriate 'Button'

Post image
224 Upvotes

r/shittyprogramming • • Mar 05 '16

[interesting] The story of how AT&T copyrighted an empty file, which was later optimized

Thumbnail
qr.ae
224 Upvotes

r/shittyprogramming • • Jun 10 '15

A fun piece of code in the Source SDK

Thumbnail
github.com
224 Upvotes

r/shittyprogramming • • Feb 02 '15

Why solve a project euler problem yourself when you can use a web solver!

Post image
224 Upvotes

r/shittyprogramming • • Sep 13 '16

This probably explains why the WD MyCloud Uninstaller Crashes

Post image
223 Upvotes

r/shittyprogramming • • Apr 21 '16

Should I switch to UTF-8 or is it better to wait for UTF-9?

223 Upvotes

Boss wants UTF-8 but it's like 40 yer old. Better wait no?

EDIT: someone pointed out UTF 2016 is a thing. So UTF-16 be it. Thanks for all the advice.


r/shittyprogramming • • Feb 06 '16

Will president Sanders break my projects when he does away with inheritance?

223 Upvotes

This seems bigger than y2k, why is nobody talking about the clear threat this man poses to languages that are too big to fail, like Java?


r/shittyprogramming • • Aug 02 '22

Extensions to Python's operators +=, -=, etc.

222 Upvotes

In Python, you can rewrite

a = a + b
a = a - b
a = a * b
a = a / b
# etc. for //, &, |, ^, **

as

a += b
a -= b
a *= b
a /= b
# etc. for //=, &=, |=, ^=, **=

I propose to extend these based on the fact that I keep wanting to do stuff like this.

a = ~a        -->  a ~=
a = a[:-1]    -->  a [:=] -1
a = a[1:]     -->  a [=:] 1
a = f(a)      -->  a f=
a = f(a,b)    -->  a f= b
a, = a        -->  a ,=
a = [a]       -->  a [=]
a = a == b    -->  a === b

Guido plz


r/shittyprogramming • • Sep 20 '19

"Our system uses a special algorithm to boost your products."

Post image
222 Upvotes

r/shittyprogramming • • Dec 04 '19

IsEven in compile time, best time

Post image
221 Upvotes

r/shittyprogramming • • Nov 18 '18

how to build an AI which asks questions on stack overflow to reprogram itself

221 Upvotes

I only accept O(1) answers, thanks


r/shittyprogramming • • Feb 03 '18

okay, think i understand cache memory now.

Post image
221 Upvotes

r/shittyprogramming • • May 27 '16

Hey, guys, I made this great Tic Tac Toe game!

Post image
221 Upvotes

r/shittyprogramming • • Dec 10 '14

This Google new code that makes Google search 100-150 milliseconds faster. Notice that the function ends in line 1.

Post image
221 Upvotes

r/shittyprogramming • • Feb 15 '14

Am I doing it right? [x-post from /r/webdev]

Post image
221 Upvotes

r/shittyprogramming • • Aug 31 '19

Browsing StackOverflow when I discovered this perfect way of exiting an application. It's perfect.

Post image
220 Upvotes

r/shittyprogramming • • Jan 23 '15

ShittyDB: a fast, scalable key-value store written in Python

220 Upvotes

ShittyDB is a fast, scalable key-value store written in Python. It is also asynchronous, purely functional, sharded, distributed, clean-coded, lightweight, and fault-tolerant even though I don't know what those words mean. It is also embeddable. Here is the entire source code:

#shittydb.py
import subprocess

def set(key, val):
    f = open(key, 'w')
    f.write(val)
    f.close()

def get(key):
    return subprocess.check_output(["cat", key])

The philosophy surrounding ShittyDB is: more code means less fast so tiny code means fast. There is very little code here so it will be lightning fast and very scalable. Here is how to use it:

>>> import shittydb
>>> shittydb.set('foo', 'this is really fast')
>>> shittydb.get('foo') # wow super fast

Please build your business on top of this super scalable data store


r/shittyprogramming • • Jan 01 '15

<wrong_sub>this</wrong_sup> Spotted in a GameTheory episode

Thumbnail
imgur.com
220 Upvotes

r/shittyprogramming • • Nov 02 '20

super approved I tried recreating the Windows troubleshooting feature. How'd I do?

219 Upvotes
#include <windows.h>
#include <stdio.h>

int main() {
    printf("Searching for problems...\n");
    Sleep(60000);
    printf("We didn't find any problems\n");
}

r/shittyprogramming • • Feb 11 '20

<%=quality comments; --!> When you dont know what .ToString() is

Post image
219 Upvotes

r/shittyprogramming • • Dec 01 '15

"We can't accept your pull request because it contains comments, which our style guide prohibits" - the Signal devs

Thumbnail
github.com
219 Upvotes

r/shittyprogramming • • May 03 '15

finals tomorrow

219 Upvotes

r/shittyprogramming • • Apr 19 '16

Pro Tip: To keep your commit history clean, always commit using "git commit --amend"

218 Upvotes

No one likes a cluttered commit history. Keeping your projects to just 1 commit reduces the number of commits you need to go through to find where a change was made.


r/shittyprogramming • • Feb 04 '16

OMG they were actually doing this.

218 Upvotes

So I inherited an iOS project from some shitty programmers in a highly populous non-USA nation which I will not mention by name. I'll let you just guess ;D

The project has an iOS client that, every minute, syncs with a server in the background while you're using the app. I was noticing that for some reason the Settings View Controller was constantly being allocated randomly even though I was not going near it.

Then I realized why... in the background syncing class, they did this fucking shit:

- (void)SyncToServerFinishedWithSuccess:(NSDictionary *)successDictionary {
    **SettingsViewController *settingsVC = [[SettingsViewController alloc] init];**
    **[settingsVC.settingsInfoTableView reloadData];**
    //rest of the code
}

Reminds me of a scene from Full Metal Jacket:

HARTMAN Holy Jesus! What is that? What is that, Private Pyle?!

PYLE Sir, a view controller initialization, sir!

HARTMAN A VC initialization?!

PYLE Sir, yes, sir!

HARTMAN How did it get here?

PYLE Sir, I copied it from the main view controller, sir!

HARTMAN Is UI allowed in the background threads, Private Pyle?

PYLE Sir, no, sir!

HARTMAN Are you allowed to write initialization methods, Private Pyle?

PYLE Sir, no, sir!

HARTMAN And why not, Private Pyle?

PYLE Sir, because I'm too slow, sir!

HARTMAN Because you are a horrifyingly stupid idiot, Private Pyle!

PYLE Sir, yes, sir!

HARTMAN Then why did you hide a view controller initialization method in the background web service thread, Private Pyle?

PYLE Sir, because the table wasn't updating, sir!

HARTMAN Because the table wasn't updating?

Holding out the iPad, HARTMAN walks down the row of recruits still standing with their arms outstretched.

HARTMAN Private Pyle has dishonored himself and dishonored the platoon! I have tried to help him, but I have failed! I have failed because you have not helped me! You people have not given Private Pyle the proper motivation! So, from now on, whenever Private Pyle fucks up, I will not punish him, I will punish all of you! And the way I see it, ladies, you owe me for one random view controller initialization statement in a background web service thread! Now, get on your faces!

HARTMAN (to PYLE) Press "Build"!

He shoves the iPad into PYLE's mouth.

HARTMAN They're paying for it, you eat it!

HARTMAN turns to the recruits.

HARTMAN Ready . . . exercise!

The platoon does push-ups.

RECRUITS (chanting in cadence)

One, two, three, four! I love the Marine Corps! One, two, three, four! I love the Marine Corps! One, two, three, four!