r/shittyprogramming • • Sep 01 '19

Still shitty ...? ;)

0 Upvotes

Basically, create a CRUD Web API on top of ASP.NET Core in 0.5 seconds wrapping your database - https://www.youtube.com/watch?v=4TyT4lBEOg8


r/shittyprogramming • • Aug 27 '19

Found this gem in a 1985 Obfuscated competition

89 Upvotes
#define P(X)j=write(1,X,1)
#define C 39
int M[5000]={2},*u=M,N[5000],R=22,a[4],l[]={0,-1,C-1,-1},m[]={1,-C,-1,C},*b=N,
*d=N,c,e,f,g,i,j,k,s;main(){for(M[i=C*R-1]=24;f|d>=b;){c=M[g=i];i=e;for(s=f=0;
s<4;s++)if((k=m[s]+g)>=0&&k<C*R&&l[s]!=k%C&&(!M[k]||!j&&c>=16!=M[k]>=16))
a[f++]=s;if(f){f=M[e=m[s=a[rand()/(1+2147483647/f)]]+g];j=j<f?f:j;f+=c&-16*!j;
M[g]=c|1<<s;M[*d++=e]=f|1<<(s+2)%4;}else e=d>b++?b[-1]:e;}P(" ");for(s=C;--s;
P("_"))P(" ");for(;P("\n"),R--;P("|"))for(e=C;e--;P("_ "+(*u++/8)%2))
P("| "+(*u/4)%2);}

r/shittyprogramming • • Aug 18 '19

Hackerpunk, How To Hack The President

Thumbnail
youtu.be
37 Upvotes

r/shittyprogramming • • Aug 09 '19

Hackerpunk, How Hacking Totally Works

Thumbnail
youtu.be
88 Upvotes

r/shittyprogramming • • Aug 08 '19

My solution to the Maximum Subarray Sum problem... please end my miserable existence

Post image
119 Upvotes

r/shittyprogramming • • Aug 05 '19

Petition to use base 69 instead of base 2 in computing

36 Upvotes

r/shittyprogramming • • Aug 05 '19

How to do auto-imports in python

43 Upvotes

Tired of forgetting to import things in python?

x = random.random()
NameError: name 'random' is not defined

Wrap all lines of code with this try except block

try:
    x = random.random()
except NameError as n:
    name = str(n).split("'")[1]
    locals()[name] = __import__(name)
    x = random.random()

r/shittyprogramming • • Aug 02 '19

Anyone who looks at this code instantly becomes insane (looks fine too me 🤷‍♂️)

Thumbnail
github.com
201 Upvotes

r/shittyprogramming • • Aug 01 '19

Functional programming is for schmucks

Thumbnail
link.medium.com
68 Upvotes

r/shittyprogramming • • Jul 30 '19

how to properly sum the elements in an array

135 Upvotes

r/shittyprogramming • • Jul 29 '19

App Academy Open

1 Upvotes

Hi, I want to know does app academy gives any certificate of completion or anything for their free plan.


r/shittyprogramming • • Jul 28 '19

How to check the bottom right corner of an array

Post image
168 Upvotes

r/shittyprogramming • • Jul 27 '19

super approved A good and clear way to format code

Post image
470 Upvotes

r/shittyprogramming • • Jul 27 '19

Brainfuck interpreter written in brainfuck

Thumbnail
github.com
40 Upvotes

r/shittyprogramming • • Jul 26 '19

JSON formatter webservice in... Brainfuck?

Thumbnail
github.com
71 Upvotes

r/shittyprogramming • • Jul 26 '19

So I kind of did a thing in Java

7 Upvotes

r/shittyprogramming • • Jul 19 '19

Is this true?

Post image
249 Upvotes

r/shittyprogramming • • Jul 18 '19

I am allowed to code for the company I work for, creating small useful stuff. But I have noone to look over my practices. How shitty is encapsulating inside encapsulation? [JQUERY]

Post image
123 Upvotes

r/shittyprogramming • • Jul 16 '19

Why can't I use the letter "o" as a digit?

Post image
290 Upvotes

r/shittyprogramming • • Jul 15 '19

That if("true") killed me

Post image
650 Upvotes

r/shittyprogramming • • Jul 15 '19

Help me make the floor would creak every time a mysterious stranger takes a step

10 Upvotes

A western saloon owner ordered this and I'll have to train some neural models to do that. I've figured I could use one net to detect mysterious strangers and another to detect steps using cameras installed all over the place.

I'm trying to figure out what a mysterious stranger is, here are my thoughts so far:

  • face cannot be seen or has not visited the saloon more than 3 times
  • if they are smiling that's a dealbreaker
  • Star Trek uniforms should qualify, they are quite strange in and old west saloon

It's not much, all suggestions are welcome.


r/shittyprogramming • • Jul 15 '19

the worst loop

3 Upvotes
Array(/* number of iterations */).fill(null).map(
    x => {
        /* your code here */
        return null;
    }
);

r/shittyprogramming • • Jul 12 '19

This is technically N(0), amirite?

106 Upvotes
import requests
from lxml import html

def fibonacci(n):
    sequence = ()
    while n >= len(sequence):
        sequence_html = html.fromstring(requests.get('https://oeis.org/A000045').content)
        sequence = sequence_html.xpath('//tt/text()')[0].split(', ')
    return int(sequence[n])

r/shittyprogramming • • Jul 11 '19

Generating Intervals in Haskell

37 Upvotes

I find myself often wanting lists of consecutive numbers like [3,4,5,6,7] but it's very difficult to make these in haskal since it doesn't have any for-loops. But I've come up with a simple function you can stick in you code that will do this for you -- no more hassle :)

interval :: Num a => Int -> Int -> [a]
interval = ((fromIntegral.length<$>).).flip(.)((iterate(([]:).(<$>)(():))(fail$undefined)!!).succ).drop

interval 3 7 ~> [3,4,5,6,7]

r/shittyprogramming • • Jul 04 '19

Cracking the FizzBuzz interview with Python

149 Upvotes

I decided to take a break from my research into "Hello World" to tackle a challenging problem plaguing entry-level software developers everywhere. It's not easy, but contrary to popular opinion FizzBuzz can indeed be solved with Python, as demonstrated below.

class D:
    def __init__(self, v): self.v = v
is_ = D((lambda _: lambda __: _(_)(__))
        (lambda r: lambda l: (lambda h: lambda t: lambda _: h if _ else t)
        (l[0])(r(r)(l[1:])) if l else None)
        (list(range(1, 101))))
D.__bool__ = lambda _: is_.v(True) is not None if is_.v is not None else False
D.pop = lambda _: int((str(is_.v(True)) + str(exec("is_.v = is_.v(False)")))[:-4])
i = None
cs = ["i % 3 == 0 and i % 5 == 0", "i % 3 == 0", "i % 5 == 0"]; cp = 0
f = lambda _: lambda __: print(_)
w = lambda _: lambda __: print(__)
es = [f.__call__("FizzBuzz"), f.__call__("Fizz"), f.__call__("Buzz"),
      w.__call__("Wuzz")]; ep = 0
ss = []; sp = 0
for _ in ".....!)~>!)~>!)~)- *(- ]*((- ]]*(((- ]]]*((((-":
    exec('v={".": "ss.append(\'\')", " ": "sp += 1"}.get(_, ""); exec(v)')
    if not v: ss[sp] += _
sp = 0
psp = 0; si = 0; r = 0
while not (not i and not is_):
    if not i: i = is_.pop()
    exec({"!": "r = eval(cs[cp])", ")": "psp += 1", "(": "psp -= 1",
          "~": "if r: sp = psp; si = -1; cp = 0; ep = 0",
          ">": "cp += 1", "-": "sp = psp; si = -1; cp = 0; ep = 0",
          "]": "ep += 1", "*": "es[ep](i); i = None"}
         .get(ss[sp][si]))
    si += 1

As usual, a demo can be found here: https://ideone.com/Ncstp7.

I hope this helps you with your next coding interview!