- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
class Point {
x = 0;
y = 0;
}
function main() {
const pt = new Point();
// Prints 0, 0
print(`${pt.x}, ${pt.y}`);
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
class Point {
x = 0;
y = 0;
}
function main() {
const pt = new Point();
// Prints 0, 0
print(`${pt.x}, ${pt.y}`);
}
вот пока вы тут языки чесали - я наваял новую фичу. а кто догадается что особенного в этом классе? в чем фича?
+2
class Animal {
name: string;
constructor(name: string) {
this.name = name;
}
speak() {
print(`${this.name} makes a noise.`);
}
}
class Dog extends Animal {
constructor(name: string) {
super(name); // call the super class constructor and pass in the name parameter
}
speak() {
print(`${this.name} barks.`);
}
}
function main() {
let d = new Dog("Mitzie");
d.speak(); // Mitzie barks.
print(d.name);
}
Я вам принес нового говнокода для нового говнокомпилятора.... дамп в следующем посту
+1
async Create(id, subscribe_yyyymmdd) {
const query = "INSERT INTO users(id,subscribe_yyyymmdd) VALUES ($1,$2) RETURNING *";
const values = [id, subscribe_yyyymmdd];
try {
const result = await this.db.query(query, values);
return result.rows[0].id;
} catch (error) {
this.logger.error(error);
}
},
async Update() {
const query = "UPDATE users SET subscribe_yyyymmdd = $1 where id=$2 RETURNING *";
const values = [id, subscribe_yyyymmdd];
try {
const result = await this.db.query(query, values);
return result.rows[0].id;
} catch (error) {
this.logger.error(error);
}
},
Из https://vk.com/wall521764930_6553 .
0
class Animal {
move(distanceInMeters = 0) {
print(`Animal moved ${distanceInMeters}m.`);
}
}
function main() {
const dog = new Animal();
dog.move(10);
const dog2 = Animal();
dog2.move(11);
}
Загадка дня... кто знает что первый вызов конструктора отличается от второго?
+1
class C {
_length: number;
constructor() {
this._length = 10;
}
get length() {
return this._length;
}
set length(value: number) {
this._length = value;
}
}
function main() {
const c = new C();
print(c.length);
c.length = 20;
print(c.length);
delete c;
print("done.");
}
пока вы тут балаболили я тут наговнокодил "property" или "accessors"
+2
class c1 {
pin: number;
hello() {
this.#hello();
}
#hello() {
print("Hello World", this.pin);
this.pin = 20;
}
}
function main() {
const c = new c1();
c.pin = 10;
c.hello();
print("Hello World", c.pin);
delete c;
print("done.");
}
Хорошие говно-новости по говно-помпилятору. Начал имплементировать классы. (когда меня это зае...т я еще не знаю, но чую что скоро)
+2
namespace fooX.bar.baz {
export class A {
foo() {
glb1++
}
}
export function b() {
glb1++
glb1++
}
}
import bz = fooX.bar.baz
import AA = fooX.bar.baz.A
function testImports() {
glb1 = 0
bz.b()
let x = new AA()
x.foo()
assert(glb1 == 3, "imports")
}
function main()
{
testImports()
}
Даже и не знаю, что вам тут еще наговнокодить... вот работаю над неймспейсами ..
−1
const gearIcon = new Vivus(
'gears',
{
type: 'delayed',
duration: 200
}
);
+1
function main() {
let a = 10;
function f() {
print(a);
}
f();
print("done.");
}
С виду этот простой кодик - это то что не может С и я так долго трахался что бы смочь его проимлементировать.... но я бля сделал
0
function ToggleClients(id, translit)
{
long_clients = document.getElementById(id);
elemID = translit + '_short_clients';
button = document.getElementById(elemID);
long_clients.style.display = "";
button.style.display = "none";
return false;
}
function ToggleClients2(id, translit)
{
long_clients = document.getElementById(id);
elemID2 = translit + '_long_clients';
button = document.getElementById(elemID2);
long_clients.style.display = "";
button.style.display = "none";
return false;
}
Компания делает рейтинги других компаний.. имеет в своих сорцах такое.. а судьи кто?