- 1
- 2
- 3
function _random_key() {
return '_' + new Date().getTime();
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
function _random_key() {
return '_' + new Date().getTime();
}
Fucking random!
0
var comment = document.querySelector('textarea#formElm_text');
var info = comment.parentNode;
if(!comment || !info) return;
https://github.com/1024--/govnokod.ru-userscripts/blob/master/bbcode.user.js
0
list.forEach((element1) => {
if (element1.parent_id == null){
output.push(element1);
list.forEach((element2) => {
if (element2.parent_id == element1.id) {
output.push(element2);
list.forEach((element3) => {
if (element3.parent_id == element2.id) {
output.push(element3);
list.forEach((element4) => {
if (element4.parent_id == element3.id) {
output.push(element4);
}
})
}
})
}
})
}
})
Super forEach
−2
if (query) {
searchParams.area = query.area_from && query.area_from !== 'all' && query.area_from.length !== 0 && query.area_to && query.area_to !== 'all' && query.area_to.length !== 0 ? [query.area_from, query.area_to] : ['0', '100']
searchParams.price = query.price_from && query.price_from !== 'all' && query.price_from.length !== 0 && query.price_to && query.price_to !== 'all' && query.price_to.length !== 0 ? [query.price_from, query.price_to] : ['0', '10']
searchParams.floor = query.floor_from && query.floor_from !== 'all' && query.floor_from.length !== 0 && query.floor_to && query.floor_to !== 'all' && query.floor_to.length !== 0 ? [query.floor_from, query.floor_to] : ['0', '100']
searchParams.last_first = query.last_first && query.last_first !== 'all' && query.last_first.length !== 0 ? query.last_first : null
searchParams.promo = query.promo && query.promo !== 'all' && query.promo.length !== 0 ? query.promo : null
searchParams.assignment = query.assignment && query.assignment !== 'all' && query.assignment.length !== 0 ? query.assignment : null
no coments
+4
function isPalindrom1(str) {
if (str.toLowerCase().replace(/[^а-яА-ЯёЁ]/g, '') === str.toLowerCase().replace(/[^а-яА-ЯёЁ]/g,
'').split('').reverse().join('')) {
return true;
} else {
return false;
}
}
"Красиво, просто, изящно."
h: post/351874/
0
$(document).ready(function() {
console.log("Ready");
var
block_1 = document.getElementsByClassName('block_1')[0],
block_2 = document.getElementsByClassName('block_2')[0],
block_3 = document.getElementsByClassName('block_3')[0],
block_4 = document.getElementsByClassName('block_4')[0],
open_1 = document.getElementsByClassName('open-1')[0],
open_2 = document.getElementsByClassName('open-2')[0],
open_3 = document.getElementsByClassName('open-3')[0],
open_4 = document.getElementsByClassName('open-4')[0];
open_1.onclick = function(){
block_1.style.display = "block";
block_2.style.display = "none";
block_3.style.display = "none";
block_4.style.display = "none";
};
open_2.onclick = function() {
block_2.style.display = "block";
block_1.style.display = "none";
block_3.style.display = "none";
block_4.style.display = "none";
};
open_3.onclick = function() {
block_2.style.display = "none";
block_1.style.display = "none";
block_3.style.display = "block";
block_4.style.display = "none";
};
open_4.onclick = function() {
block_2.style.display = "none";
block_1.style.display = "none";
block_3.style.display = "none";
block_4.style.display = "block";
};
});
+4
var net = require("net");
Array.from({ length: 1000 }, (x, i) => i).map(id => makeClient(id));
function makeClient(id) {
var client = net.createConnection({ host: "46.101.246.194", port: 80 }, () =>
console.log(`[${id}] connected`)
);
client.on("end", () => console.log(`[${id}] disconnect`));
return client;
}
govnokod dudos script
+2
/**
* Вхождения слова "питушня" в говнокодах по языкам
*/
{
"C++": 124,
"PHP": 56,
"Куча": 54,
"C": 41,
"JavaScript": 39,
"C#": 25,
"Python": 11,
"Java": 10,
"Pascal": 8,
"SQL": 7,
"VisualBasic": 2,
"Swift": 2,
"ActionScript": 1,
"Assembler": 1,
"Perl": 1,
"Haskell": 1,
"Ruby": 1,
"1C": 0,
"Lua": 0,
"Objective C": 0,
"bash": 0
}
0
/**
* Peetushna
* Node.js 10
* node index.js > report.csv
*/
const { get } = require("axios");
const { load } = require("cheerio");
Promise.resolve().then(async () => {
const responses = reqGen(1, 25000);
const peetushna = /питушня/g;
for await (const resp of responses) {
if (resp.status != 200) break;
const wordCount = resp.data.match(peetushna);
const count = wordCount ? wordCount.length : 0;
const html = load(resp.data);
const lang = html('a[rel="chapter"]')
.text()
.replace("Си", "C");
console.log(`"${lang}", ${count}`);
}
});
async function* reqGen(first, max) {
while (first <= max) {
try {
const resp = await get("http://govnokod.ru/" + first++);
yield resp;
} catch (e) {
//
}
}
}
−1
function running(html, clear) {
var id, brk = true;
if(clear)
html.className = "";
if(html.className != "Ready") {
if(html.children.length > 0) {
if(!clear) {
for(id = 1; id < html.childNodes.length; ++ id) {
var active = findActive(html.childNodes[id]);
if(active == null) {
brk = true;
break;
}
brk = active.className != "Ready" ? false : brk;
}
}
if(!brk && html.childNodes[0].value && html.childNodes[0].max) {
if(clear)
html.childNodes[0].value = 1;
else
if(html.childNodes[0].value <= html.childNodes[0].max) {
++ html.childNodes[0].value;
if(brk) {
for(id = 1; id < html.childNodes.length; ++ id)
findActive(html.childNodes[id], true);
html.parentNode.className = "";
}
return null;
} else {
html.parentNode.className = "Ready";
html.className = "";
return html;
}
}
if(!clear)
html.className = html.className != "Active" ? "Active" : "Ready";
return null;
} else {
if(!clear)
html.className = html.className != "Active" ? "Active" : "Ready";
return html;
}
}
return html;
}
Должен бегать по вложенным элементам и анимировать их.