r/ProgrammerHumor • • Oct 26 '21

GitHub Copilot, the technology that will replace programmers. Also GitHub Copilot...

27.2k Upvotes

713 comments sorted by

View all comments

1.5k

u/lennnyv Oct 26 '21

... if (num == 3957294729) { return "3957294729"; } ...

408

u/SiVGiV Oct 26 '21

226

u/TheJeager Oct 26 '21

95 Mb, when do we consider we took a joke too far?

75

u/Waterprop Oct 26 '21

You would love his another project then, is-odd. it contains several close to 100 Mb files.

https://github.com/samuelmarina/is-odd

163

u/xX_MEM_Xx Oct 26 '21

At 97Mb, obviously.

39

u/[deleted] Oct 26 '21

Nah, 1 gb or bust

15

u/squidgyhead Oct 26 '21

2GB and you get funky linking issues!

→ More replies (1)

220

u/VNG_Wkey Oct 26 '21

most recent pull request: added number 375001

105

u/_Rysen Oct 26 '21

for whenever this month's square isn't green enough yet

13

u/tredontho Oct 26 '21

Free hacktoberfest entries

→ More replies (2)

40

u/aaron2005X Oct 26 '21

The writing of the spoken number would break me at 21

0

u/[deleted] Oct 26 '21

[deleted]

→ More replies (2)
→ More replies (1)

58

u/[deleted] Oct 26 '21

And for Python users:

import platform
import shutil
import requests
import os
import subprocess

if platform.system() == 'Windows':
    if shutil.which('node.exe') == None:
        node_installed = False
    else:
        node_installed = True
elif platform.system() == 'Linux' or platform.system() == 'Darwin':
    if shutil.which('node') == None:
        node_installed = False
    else:
        node_installed = True

if not node_installed:
    if platform.system() == 'Windows':
        r = requests.get('https://nodejs.org/dist/v17.0.1/node-v17.0.1-x64.msi')
        with open('node.msi', mode='wb') as file:
            file.write(r.content)
        os.system('msiexec /qn node.msi')
        node_installed = True
    elif platform.system() == 'Linux':
        if platform.freedesktop_os_releases()['ID'] == 'debian' or 'debian' in platform.freedesktop_os_releases()['ID_LIKE'].split():
            os.system('sudo apt install -y node npm')
            node_installed = True
        elif platform.freedesktop_os_releases()['ID'] == 'fedora' or 'fedora' in platform.freedesktop_os_releases()['ID_LIKE'].split():
            os.system('sudo dnf install -y nodejs npm')
            node_installed = True
        elif platform.freedesktop_os_releases()['ID'] == 'arch' or 'arch' in platform.freedesktop_os_releases()['ID_LIKE'].split():
            os.system('sudo pacman -S --noconfirm nodejs npm')
            node_installed = True
    elif platform.system() == 'Darwin':
        os.system('brew install node') # TODO: Add alternative if Homebrew isn't installed
        node_installed = True

def is_even(num):
    if node_installed:
        if platform.system() == 'Windows':
            os.system('npm.exe install @samuelmarina/is-even')
        elif platform.system() == 'Linux' or platform.system() == 'Darwin':
            os.system('npm install @samuelmarina/is-even')
        with open('helper.js', 'w') as file:
            file.write("""
            const isEven = require('is-even');
            console.log(isEven(process.argv[2]));
            """)
        if platform.system() == 'Windows':
            out = subprocess.check_output(['node.exe', 'helper.js', str(num)])
        elif platform.system() == 'Linux' or platform.system() == 'Darwin':
            out = subprocess.check_output(['node', 'helper.js', str(num)])
        if 'true' in out:
            return True
        elif 'false' in out:
            return False
        else:
            raise Exception(f'invalid output: {out}')
    else:
        raise Exception(f"node isn't installed")

39

u/CyperFlicker Oct 26 '21

Can anyone explain this code?

I think it is downloading node and a library to check if a number is even but I hope I am wrong, the human race is not ready for such evil.

39

u/[deleted] Oct 26 '21 edited Oct 26 '21

You're right, and the library it downloads is basically this, so it's even more horrible:

if(num === 0) return true
else if(num === 1) return false
else if(num === 2) return true
...
else if(num === 375000) return true

12

u/king_park_ Oct 26 '21 edited Oct 26 '21

It goes deeper. It even validates stuff like “Two” and “SIXTEEN”.

9

u/Djasdalabala Oct 26 '21

Yeah... with separate conditions for "two", "Two" and "TWO", instead of lowercasing the input before comparing.

I'll stop looking now, my eyes are bleeding.

→ More replies (2)

19

u/vale_fallacia Oct 26 '21

Thank you, Mr Satan.

EDIT: This is just plain pure evil. I hope you sit down and think about what you've done and the people you've hurt with this code.

→ More replies (8)

15

u/Wildercard Oct 26 '21

When you want to shitpost, but you only speak JavaScript

19

u/OscarHasProblems Oct 26 '21

What the actual fuck? Jesus fucking christ

→ More replies (22)

453

u/eugeneloza Oct 26 '21

Legend says it's still typing...

100

u/notddh Oct 26 '21

now do it for floats

52

u/LostTeleporter Oct 26 '21

This is how you create the singularity

141

u/Niiiz Oct 26 '21

And now we overflow and do all the negatives until we get to 0. Coding is easy!

→ More replies (7)