- 1
- 2
- 3
- 4
- 5
- 6
- 7
function trim(str) {
str = str.replace(/^\s\s*/, '');
let ws = /\s/;
let i = str.length;
while (ws.test(str.charAt(--i)));
return str.slice(0, i + 1);
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+165
function trim(str) {
str = str.replace(/^\s\s*/, '');
let ws = /\s/;
let i = str.length;
while (ws.test(str.charAt(--i)));
return str.slice(0, i + 1);
}
Очень суровый товарищ.
Посмотреть: https://addons.mozilla.org/ru/firefox/files/browse/106116 (bootstrap.js)
Если вдруг будет откорректировано, вот нужная версия: https://addons.mozilla.org/ru/firefox/addon/264089/versions/0.3.7.3
P.S. let: https://developer.mozilla.org/en/JavaScript/Reference/Statements/let
+160
// http://www.domw.net/js.js
function open(name){
document.getElementById(name).style.display = ''
}
// http://www.domw.net/
<a href="http://lite.webim.ru/decoda/webim/client.php?locale=ru" target="_blank" onclick="if(navigator.userAgent.toLowerCase().indexOf('opera') != -1 && window.event.preventDefault) window.event.preventDefault();this.newWindow = window.open('http://lite.webim.ru/decoda/webim/client.php?locale=ru', 'webim', 'toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width=600,height=420,resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;" style="font-size:14px;padding-left:30px;color:#A77934">Нашли ошибку?</a>
+142
В связи с минусаторной атакой в говнокоде 5186, просьба.
Страйкер, заблокируй пользователей с номерами
http://govnokod.ru/user/2689 -
http://govnokod.ru/user/2703
(весь диапазон оккупировали тролли-виртуалы)
И ИП-адрес, с которого эти пользователи логинились.
+123
WebClient webClient = new WebClient();
int i = 1;
while (true)
{
try
{
webClient.DownloadFile("http://sayt.ru/" + i.ToString() + ".exe", @i.ToString() + ".exe");
number += 1;
}
catch
{
break;
}
}
+158
$i=0;
foreach($info['members'] as $m_name){
$i++;
$date = date($fdate,$m_name['time']);
$block_vars['num_online'].='<a href="index.php?name=user&op=userinfo&user='.$m_name['u_id'].'">' .$m_name['u_name'].'</a>, ';
if($mcount>0)
if($i>$mcount) break;
}
+161
<?php
...
public function update() {
if($this->data['id'])
return false;
$values = array();
foreach($this->data AS $key => $value) {
if($key == 'id')
continue;
$values[] = "`{$key}` = " . ($value ? "'{$value}'" : "NULL");
}
$result = $this->sql->query("
UPDATE `users`
SET (".implode(', ' $values).")
WHERE `id` = '{$this->data['id']}'");
return (bool) $this->sql->affected_rows;
}
...
?>
Моё
+165
$query = mysql_query("SELECT * FROM `accounts` WHERE `login` = '".@$_COOKIE['sc2tACC']."' LIMIT 1");
if ($query and @isset($_COOKIE['sc2tACC']) AND mysql_num_rows($query)) {
$auth = mysql_fetch_array($query);
if($auth['password'] == $_COOKIE['sc2tPASS'] and @isset($_COOKIE['sc2tPASS'])) {
$AS = "OK";
if($_SERVER['PHP_SELF'] != "/chat.php" and $auth['status'] != 1) {
mysql_query("UPDATE `accounts` SET `timestamp` = '".microtime(1)."', `ip` = '".$_SERVER['REMOTE_ADDR']."', `lastpage` = '".$_SERVER['REQUEST_URI']."' WHERE `id` = '".$auth['id']."' LIMIT 1;");
}
} else {
$loginError = "Неверный пароль";
}
} else {
$loginError = "Неверный логин";
}
+125
int function(void) {
static int i, state = 0;
switch (state) {
case 0: /* start of function */
for (i = 0; i < 10; i++) {
state = 1; /* so we will come back to "case 1" */
return i;
case 1:; /* resume control straight after the return */
}
}
}
Нестандартное применение свитча.
Тут оно нафиг не нужно.
Источник: http://www.gamedev.ru/code/forum/?id=142536
+166
function isArray(o) {
return Object.prototype.toString.call(o) === '[object Array]';
}
ЖИСТОКЕ
+164
function isUTF8 ($str) {
return $utf8 = (preg_match("/^([\x09\x0A\x0D\x20-\x7E]|[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})*$/", $str)) ? true : false;
}
говно или нет?