- 1
- 2
- 3
- 4
public static function create(AdGroupVO $vo)
{
UtilLog::debug('FUCK');
...
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+43
public static function create(AdGroupVO $vo)
{
UtilLog::debug('FUCK');
...
+160
jQuery('#text div.catalog_light div.num input[type="text"]').spinner({max: 999, min: 1});
jQuery('#text div.catalog_light div.num .ui-spinner-up').html('').css({'width' : '22px'}).css({'height' : '22px'});
jQuery('#text div.catalog_light div.num .ui-spinner-down').html('').css({'width' : '22px'}).css({'height' : '22px'});
jQuery('#text div.catalog_item_right div.line div.spinner input[type="text"]').spinner({max: 999, min: 1});
jQuery('#text div.catalog_item_right div.line div.spinner .ui-spinner-up').html('').css({'width' : '22px'}).css({'height' : '22px'});
jQuery('#text div.catalog_item_right div.line div.spinner .ui-spinner-down').html('').css({'width' : '22px'}).css({'height' : '22px'});
jQuery('#text div.catalog_item_additional div.double table div.spinner input[type="text"]').spinner({max: 999, min: 1});
jQuery('#text div.catalog_item_additional div.double table div.spinner .ui-spinner-up').html('').css({'width' : '22px'}).css({'height' : '22px'});
jQuery('#text div.catalog_item_additional div.double table div.spinner .ui-spinner-down').html('').css({'width' : '22px'}).css({'height' : '22px'});
jQuery('#text div.catalog div.content div.text div.spinner input[type="text"]').spinner({max: 999, min: 1});
jQuery('#text div.catalog div.content div.text div.spinner .ui-spinner-up').html('').css({'width' : '22px'}).css({'height' : '22px'});
jQuery('#text div.catalog div.content div.text div.spinner .ui-spinner-down').html('').css({'width' : '22px'}).css({'height' : '22px'});
+175
public static IEnumerable<float> Single(float from, float to, float step)
{
if (step <= 0.0f) step = (step == 0.0f) ? 1.0f : -step;
if (from <= to)
{
for (float f = from; f <= to; f += step) yield return f;
}
else
{
for (float f = from; f >= to; f -= step) yield return f;
}
}
public static IEnumerable<double> Double(double from, double to, double step)
{
if (step <= 0.0) step = (step == 0.0) ? 1.0 : -step;
if (from <= to)
{
for (double d = from; d <= to; d += step) yield return d;
}
else
{
for (double d = from; d >= to; d -= step) yield return d;
}
}
Такие методы накопированы для всех типов данных, которые известны поциенту.
Но особо интересны эти джва метода
Unlike some other programmimg languages (notably F#), C# doesn't have any built-in support for dealing with ranges of numbers. The .NET Framework does have the Enumerable.Range() method.
- It can only deal with Int32's.
- You can't specify a 'step' from one element of the range to the next. In effect, the step is always one. In this article, I'd therefore like to present a static Range class to deal with these deficiencies.
http://www.c-sharpcorner.com/uploadfile/b942f9/dealing-with-ranges-of-numbers-in-C-Sharp
+63
Лех, разве код <?php CREATE DATABASE tbl_name; ?> не должен создать БД?
Пришло в аське
+34
void
XmlRpcDispatch::work(double timeout)
{
...
nEvents = select(maxFd+1, &inFd, &outFd, &excFd, NULL);
...
}
void XmlRpcDispatch::terminate() {
...
XmlRpcSocket::connect(_cmd_sock, "127.0.0.1", port);
...
}
Не то чтобы говнокод, но забавный костыль. А как еще корректно выйти из select'a, ждущего входящих соединений? Создать соединение самому.
−102
obj_l = list()
for obj, obj_id in [(QuizQuestion, quest_id), (QuizAssigment, ass_id), (QuizQuestionAnswer, answ_id)]:
q_set = getattr(getattr(obj, 'objects'), 'filter')(id=obj_id)
obj_l.append(getattr(q_set, 'count')() > 0 and q_set[0] or False)
(False in obj_l or obj_l[2].question != obj_l[0] or (user and obj_l[0].user)) and abort(IntegrityError())
1) хер такое прочтешь
2) для осмысления прочитанного нужно выпить
3) за осмысление такого нужно выпить еще раз
4) чувак узнал про getattr, хотя стоило вызвать напрямую obj.objects.filter(id=obj_id)
5) q_set.count() > 0 and q_set[0] or false
пятая строка поддается пониманию но катастрофически быстро начинает от этого терять смысл
+55
function GetNumberOfLinks ($cat){
$queue[] = intval($cat);
$query = "select count(*) from #__jxlspp_prices where ( 0!=0";
while (list($key, $cat) = each($queue)) {
$query .= " or catid = $cat";
}
$query = $query . " ) and published=1";
$database->setQuery($query);//это от Джумлы
$result = $database->query();//и это от Джумлы
$val = mysql_fetch_row($result);//а это с бодуна
return $val[0];
}
Сижу, скучаю, ковыряю очередной говносайт и, вдруг!
Аж от души отлегло.
−94
def __call__(self, *args, **kw):
# ...
if args and len(args) > 1 and args[0] is args[1][0]:
# fml...
temp = list(args)
temp.pop(1)
args = tuple(temp)
return self._execute(*args, **kw)
Быль про архитектуру.
+122
class xxxxxxxxxx
{
private $string_services;
public function init() {
$this->string_services = '<script type="text/javascript" src="//yandex.st/share/share.js" charset="utf-8"></script>
<div class="yashare-auto-init" data-yashareL10n="ru" data-yashareType="none" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,lj,friendfeed,moikrug,gplus"></div> ';
}
public function run() {
if(empty($this->string_services))
{
$this->init();
}
echo $this->string_services;
}
}
В нашел в проекте над которым работаю.
+56
public function bugreportAction() {
if (!isset($_POST['Type']) || !isset($_POST['Text']) || !isset($_POST['Module']))
return false;
if (trim($_POST['Text']) == "Ваш текст здесь...")
return false;
$rzt = $this->Debug->AddReport($_POST['Type'], $_POST['Text'], $_POST['Module']);
if ($rzt)
echo "OK";
else
echo "FAIL";
return $rzt;
}
На работе нашел в проектах у других программистов, особенно понравилось.
if (trim($_POST['Text']) == "Ваш текст здесь...")
return false;