- 1
- 2
- 3
- 4
- 5
- 6
class Z {
public function __toString() { return 'zzzzzzzz'; }
}
$zz = array();
$zz[call_user_func_array('sprintf', array('%s', new Z))] = 1;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+159
class Z {
public function __toString() { return 'zzzzzzzz'; }
}
$zz = array();
$zz[call_user_func_array('sprintf', array('%s', new Z))] = 1;
нахуй так жить?
+151
error_reporting( 0 );
unset( $x[new XSLTProcessor()][new RecursiveArrayIterator()] );
−151
if( my $row = &dbselectrow( $sql ) )
{
if( $row -> { 'ofid' } == 9782 ) # moscow
{
if( $row -> { 'jt' } =~ /Начальник /i )
{
&subscribe_to_management( $row -> { 'email' } );
}
}
}
Автоматическая подписка сотрудника руководящей должности на список рассылки для руководителей.
+138
private function toDBFields($fields){
$db_fields = array();
if ($fields){
foreach($fields as $field){
switch ($field){
case 'p_bits':
if (!array_search('b1',$db_fields)) $db_fields[] = 'b1';
break;
case 'n2':
if (!array_search('b1',$db_fields)) $db_fields[] = 'b1';
break;
case 'n1':
if (!array_search('b1',$db_fields)) $db_fields[] = 'b1';
break;
case 'cntdf':
if (!array_search('cntdf',$db_fields)) $db_fields[] = 'cntdf';
break;
case 'first_pckg':
break;
case 'az':
if (!array_search('az',$db_fields)) $db_fields[] = 'az';
break;
case 'akb_v':
//if (!array_search('b2',$db_fields)) $db_fields[] = 'b2';
if (!array_search('b3',$db_fields)) $db_fields[] = 'b3';
break;
case 'p1code':
case 'ignition_ap1':
if (!array_search('b4',$db_fields)) $db_fields[] = 'b4';
if (!array_search('b6',$db_fields)) $db_fields[] = 'b6';
break;
case 'fuel_p2':
case 'fuel_p2_debug':
case 'p2code':
if (!array_search('b5',$db_fields)) $db_fields[] = 'b5';
if (!array_search('b6',$db_fields)) $db_fields[] = 'b6';
break;
case 'fuel_p3':
case 'fuel_p3_debug':
case 'p3code':
case 'p3code_debug':
if (!array_search('b7',$db_fields)) $db_fields[] = 'b7';
if (!array_search('b6',$db_fields)) $db_fields[] = 'b6';
break;
case 'fuel_p3p4_2drt':
if (!array_search('b8',$db_fields)) $db_fields[] = 'b8';
if (!array_search('b7',$db_fields)) $db_fields[] = 'b7';
if (!array_search('b6',$db_fields)) $db_fields[] = 'b6';
break;
case 'fuel_p2p3':
if (!array_search('b5',$db_fields)) $db_fields[] = 'b5';
if (!array_search('b7',$db_fields)) $db_fields[] = 'b7';
if (!array_search('b6',$db_fields)) $db_fields[] = 'b6';
break;
case 'fuel_p4':
case 'p4code_debug':
case 'p4code':
if (!array_search('b8',$db_fields)) $db_fields[] = 'b8';
if (!array_search('b6',$db_fields)) $db_fields[] = 'b6';
break;
}
}
}
return $db_fields;
Вот такой кейс который используется в системе для перевода типа переменной к названию поле в таблице ....
+154
<?php
session_start();
include("database.php");
include("filter.php");
$filter = new Filter();
isset($_GET['cat']) ? $id = $filter->Symbols($_GET['cat']) : exit("Вы зашли на страницу без параметра!");
if ( !isset($_POST['class']) && empty($_POST['class']) )
{
include('header.php');
echo '
<title>Title</title>
';
include('slider.php');
echo '
<div id="Content">
';
}
$query_amount = $mysqli->query("SELECT COUNT(id) FROM `page_film` WHERE `genre_film`='$id' ");
$amount_film = $query_amount->fetch_row();
$query = $mysqli->query("SELECT * FROM `page_film` WHERE `genre_film`='$id' ORDER BY `id` DESC ");
if ( $amount_film[0] > 0 )
while( $row = $query->fetch_array(MYSQLI_ASSOC) )
echo '
<div class="block-film">
<a class="block-link-image" href="../films/film.php?id='.$row['id'].'">
<img src="'.$row['poster'].'" />
</a>
<div class="block-film-text">
<p class="film-name">
<a href="../films/film.php?id='.$row['id'].'">'.$row['title'].'</a>
</p>
<p class="film-mini-name">
<a href="../films/film.php?id='.$row['id'].'">'.$row['desc'].'</a>
</p>
<p class="film-genre"><span>'.$row['genre'].'</span></p>
<p class="film-description">'.$row['description'].'</p>
</div>
</div>
';
if ( !isset($_POST['class']) && empty($_POST['class']) )
{
echo '
</div>
</body>
</html>
';
}
?>
+51
template <class T> class return_1_t: public std::unary_function<T, T> {
public:
return_1_t(const T & Ret) : _ret(Ret) {}
T operator()(T Arg) const { return _ret; }
private:
T _ret;
};
template <class Arg1, class Arg2> class project1st: public std::binary_function<Arg1, Arg2, Arg1> {
public:
Arg1 operator()(const Arg1 & X, const Arg2 & Y) { return X; }
};
template <class Arg1, class Arg2> class project2nd: public std::binary_function<Arg1, Arg2, Arg2> {
public:
Arg2 operator()(const Arg1 & X, const Arg2 & Y) { return Y; }
};
template <class T> class identity: public std::unary_function<T, T> {
public:
T operator()(const T & Arg) const { return Arg; }
};
template <class To, class From> class static_cast_t: public std::unary_function<To, From> {
public:
To operator()(From obj) const { return static_cast<To>(obj); }
};
template <class T> class take_address: public std::unary_function<T&, T*> {
public:
result_type operator()(argument_type arg) const { return &(arg); }
};
template <class T> class take_const_address: public std::unary_function<const T&, const T*> {
public:
result_type operator()(argument_type arg) const { return &(arg); }
};
template <class T> class creator: public std::unary_function<void, T*> {
public:
result_type operator()(void) const { return new T(); }
};
template <class T, class Arg1> class creator_1_par: public std::unary_function<Arg1, T*> {
public:
result_type operator()(argument_type arg) const { return new T(arg); }
};
template <class T, class Arg1, class Arg2> class creator_2_par: public std::binary_function<Arg1, Arg2, T*> {
public:
result_type operator()(first_argument_type arg1, second_argument_type arg2) const { return new T(arg1, arg2); }
};
template <class T> class maker: public std::unary_function<void, T> {
public:
result_type operator()(void) const { return T(); }
};
template <class T, class Arg1> class maker_1_par: public std::unary_function<Arg1, T> {
public:
result_type operator()(argument_type arg) const { return T(arg); }
};
template <class T, class Arg1, class Arg2> class maker_2_par: public std::binary_function<Arg1, Arg2, T> {
Вот до чего доводит людей отсутствие частичного применения и лямбд.
+116
#include <stdio.h>
#include <stdlib.h>
int main() {
printf("%s\n", NULL);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main() {
const char str[] = "%s\n";
printf(str, NULL);
return 0;
}
Эквивалентные программы такие эквивалентные. А всё из-за printf optimization в GCC.
Стандарт, кстати, разрешает, потому что это UB.
Вообще пора создать ub.govnokod.ru и складывать туда примеры разного поведения на каждое UB из стандарта.
−168
Если СтрНС <> Неопределено Цикл
Если СтрНС.Значение <> Справочники.Номенклатура.ПустаяСсылка() тогда
Тост = ОстаткиПоСкладамУпр(СтрНС.Значение);
Синхро = Истина;
Если Тост[0].Остаток <> 0 тогда
НаличиеНаСкладе = Истина;
Конецесли;
КонецЕсли;
КонецЕсли;
//...
Если НаличиеНаСкладе Тогда
// другой быдлокод
КонецЕсли;
Переменная НаличиеНаСкладе объявляется только один раз во всем модуле, в приведенном мною куске.
Угадай, в каком месте выпадает ошибка?
+133
string dirUp = striBuildDir + striBinaryDir + "\\" + striTempDir + "\\";
string dirRelease = strDirBin;
int i = 1;
while (ConfigurationSettings.AppSettings["SettingDir" + i] != null)
{
и еще строк 100500 такого же стиля
+127
Переустановил я, значит, Шиндоус 7 (лицуха), ставлю VS 2012
Все встало без проблем, предупреждений и криков о помощи.
При запуске ВНЕЗАПНО всплыло окошко
"Внимание! Данная программа имеет известные проблемы совместимости с данной версией Windows"
Visual Studio 2012 несовместим с семеркой? Ну охуеть теперь.