>
shame_leaderboard
// the most roasted code on the internet
·
// the most roasted code on the internet
// the most roasted code on the internet
function getUserData(id) {
var data = eval(id);
return data;
}function calcResult(cardsString) {
//Calculator result
let result = eval(cardsString);
//Rounding double numbers
if (!Number.isInteger(result) && !resultErro(result)) {
const decimalLength = result.toString().split(".")[1].length || 0;
if (decimalLength >= 3) {
//Cut repeating decimal and 0 additional
result = result.toFixed(3);
result = result.toString().replace(/(\.\d*?[1-9])0\d*/, "$1");
} else {
result = result.toFixed(decimalLength);
}
}
const resultCardsVet = ("" + result).split("");
//ConsoleLogs
console.log(result);
console.log(resultCardsVet);
printResult(resultCardsVet);
}interface User {
name: string
age: number
}
function greet(user: any) {
console.log("Hello " + user.name)
}passwords = ["admin123", "password", "123456"]
for p in passwords:
if p == "admin123":
print("access granted")const arr = [1,2,3,4,5]
let sum = 0
for (let i = 0; i <= arr.length; i++) {
sum += arr[i]
}import json
def load_config(path):
f = open(path)
data = json.load(f)
return data<?php
// Nome do arquivo original
$arquivoOriginal = 'foto.jpg';
// Nome do arquivo a ser criado (cópia)
$arquivoCopia = 'copias/foto_backup.jpg';
// A função copy() realiza a cópia
if (copy($arquivoOriginal, $arquivoCopia)) {
echo "Arquivo copiado com sucesso!";
} else {
echo "Erro ao copiar o arquivo.";
}
?>
function calculateTotal(items) {
var total = 0;
for (var i = 0; i < items.length; i++) {
total = total + items[i].price;
}
if (total > 100) {
console.log("discount applied");
total = total - 5;
}
// TODO: handle tax calculation
// TODO: handle currency conversion
return total;
}import os
import sys
def main():
for i in range(100):
os.system("echo " + str(i))
main()function add(a, b, c, d, e, f, g, h) {
return a + b + c + d + e + f + g + h;
}const http = require('http')
const server = http.createServer((req, res) => {
res.write(req.url)
res.end()
})
server.listen(3000) const highlight = useCallback(
(code: string, langKey: LanguageKey | null): string => {
if (!highlighter) return escapeHtml(code);
const shikiLang = langKey ? LANGUAGES[langKey]?.shiki : null;
const lang =
shikiLang && loadedLangsRef.current.has(shikiLang)
? shikiLang
: "plaintext";
try {
return highlighter.codeToHtml(code, {
lang,
theme: "vesper",
});
} catch {
return escapeHtml(code);
}
},
[highlighter],
);export const db = new Proxy({} as PostgresJsDatabase, {
get(_target, prop, receiver) {
if (!_db) _db = createDb();
return Reflect.get(_db, prop, receiver);
},
});import Link from "next/link";
function Navbar() {
return (
<nav className="flex h-14 w-full items-center justify-between border-b border-border-primary bg-bg-page px-10">
<Link href="/" className="flex items-center gap-2">
<span className="font-mono text-xl font-bold text-accent-green">
{">"}
</span>
<span className="font-mono text-lg font-medium text-text-primary">
devroast
</span>
</Link>
<div className="flex items-center gap-6">
<Link
href="/leaderboard"
className="font-mono text-[13px] text-text-secondary transition-colors hover:text-text-primary"
>
leaderboard
</Link>
</div>
</nav>
);
}
export { Navbar };
def divide(a, b):
result = a / b
return resultvar x = 1 var y = 2 var z = x + y console.log(z)
function factorial(n) {
if (n == 0) return 1;
return n * factorial(n - 1);
}class Animal:
def __init__(self, name):
self.name = name
def speak(self):
pass
class Dog(Animal):
def speak(self):
return "Woof"function processItems(items: string[]) {
items.forEach((item, index) => {
console.log(index + ": " + item)
})
return items.length
}document.getElementById("btn").onclick = function() {
var val = document.getElementById("input").value
document.getElementById("output").innerHTML = val
}