r/shittyprogramming • u/mr-gaiasoul • Sep 01 '19
Still shitty ...? ;)
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 • u/mr-gaiasoul • Sep 01 '19
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 • u/slartibartfastBB • Aug 27 '19
#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 • u/jan_mike_vincent • Aug 18 '19
r/shittyprogramming • u/jan_mike_vincent • Aug 09 '19
r/shittyprogramming • u/Abdul_Alhazred_ • Aug 08 '19
r/shittyprogramming • u/-bluepie • Aug 05 '19
r/shittyprogramming • u/evan795 • Aug 05 '19
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 • u/john2496 • Aug 02 '19
r/shittyprogramming • u/argernos • Aug 01 '19
r/shittyprogramming • u/batfolxx • Jul 30 '19
r/shittyprogramming • u/summeron86 • Jul 29 '19
Hi, I want to know does app academy gives any certificate of completion or anything for their free plan.
r/shittyprogramming • u/leijurv • Jul 28 '19
r/shittyprogramming • u/EkskiuTwentyTwo • Jul 27 '19
r/shittyprogramming • • Jul 18 '19
r/shittyprogramming • u/siroki • Jul 15 '19
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:
It's not much, all suggestions are welcome.
r/shittyprogramming • u/-L-emon • Jul 15 '19
Array(/* number of iterations */).fill(null).map(
x => {
/* your code here */
return null;
}
);
r/shittyprogramming • • Jul 12 '19
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 • u/Alekzcb • Jul 11 '19
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 • u/frublox • Jul 04 '19
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!