- 1
- 2
- 3
- 4
- (int) getRandomValue {
int rnd = 1000;
return rnd;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−118
- (int) getRandomValue {
int rnd = 1000;
return rnd;
}
И это было уже в предрелизе..
+150
(получаем каждый $array из $all_arr){
for ($i=0; $i<=7; $i++){
switch("value".$i){
case "value0":
echo $array['value0'];
break;
case "value5":
echo $array['value5'];
break;
}
}
}
Имеем массив $all_arr, где каждый элемент имеет значение:
$array = array(
"value0" => "sometext0",
"value1" => "sometext1",
"value2" => "sometext2",
"value3" => "sometext3",
"value4" => "sometext4",
"value5" => "sometext5"
);
Необходимо, вывести заданные значения из каждого элемента $all_arr.
Спустя пару недель, пересматривая код, сократил.
+83
/**
* intended to be used for enums implementation
*/
public interface NullValueHolder<T> {
T getNullValue();
}
// в тесте
enum TestEnum implements NullValueHolder<TestEnum> {
TEST;
public TestEnum getNullValue() {
return null;
}
}
Видимо, часть метафабрики для создания метапрограмм
Может, я чего-то в этой жизни не понимаю?
+116
protected void chxPeriodCostDeviationGreater_CheckedChanged(object sender, EventArgs e)
{
foreach (Pair lstPair in lstPairs)
{
if (lstPair.First.Equals(sender))
{
(lstPair.Second as TextBox).Enabled = (lstPair.First as CheckBox).Checked;
return;
}
}
}
задаем видимость контролов :)
+163
<!--/** Блог Алексея отключен
<div class="rightadd"><a rel="dofollow" href="/blog_alex.html"><h3>Блог Алексея Сафиоллина</h3></a>
<div class="txt">
<?
foreach ($a_news_1 as $key => $val) {
?>
<div class="item">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="vertical-align:top;width:70px">
<div class="pic"><a rel="nofollow" href="<?=$val['url']?>"><img src="<?=$val['photo_70']?>" width="70" height="70" alt="" /></a></div>
</td>
<td style="vertical-align:top;">
<a rel="nofollow" href="<?=$val['url']?>"><?=$val['cap']?></a> <?=util::getDotWord($val['s_body'], 110)?>
</td>
</tr>
</table>
</div>
<?}?>
</div>
</div>
*/-->
Отключили блог...
P.S. И вот такое, люди называют "системой".
+156
<?php if(isset($_GET["fullVersion"])) $_SESSION["fullVersion"]="on"; ?><?php if($_SESSION["fullVersion"]!='on' && (substr_count($_SERVER["HTTP_USER_AGENT"],'Android') || substr_count($_SERVER["HTTP_USER_AGENT"],'iPhone'))){
header("Location: /m/redirects/?withjs");
exit;
}
else if($_SESSION["fullVersion"]!='on' && substr_count($_SERVER["HTTP_USER_AGENT"],'Opera Mini')){
header("Location: /m/redirects/?operamini");
exit;
}
?><?php if($_GET["ClockId"] && $_GET["str"] && $_GET["frompartnerka"]==1){ header("Location: http://vip-timeclub.ru/catalog/articul/?ClockId=".(int)$_GET["ClockId"]."&str=2");} ?>
<?php if(function_exists('vtPrice')==false){
function vtPrice($price=0,$sale=0,$priceGold=0){
if($priceGold){
$priceOld = $price;
$price = $priceGold;
}
else if($sale){
$priceOld = $price;
$price = ceil(intval($priceOld)-((intval($priceOld)/100)*(intval($sale))));
}
else{
$priceOld = 0;
}
return array('price'=>$price,'priceOld'=>$priceOld);
}
}if(function_exists('vtPriceGood')==false){
function vtPriceGood($price){
if(intval(substr($price,-1)) > 0 && intval(substr($price,-1)) < 5)
$price = intval($price) + (5-intval(substr($price,-1)));
else if(intval(substr($price,-1)) > 5 && intval(substr($price,-1)) <= 9)
$price = intval($price) + (10-intval(substr($price,-1)));
return $price;
}
} ?>
spam, club-viptime DOT RU
−90
def runRidor():
isDirty = 0
#Except (DebugSize <= 14) and (ImageVersion <= 760) and (VirtualSize2 > 992) and (ExportSize <= 80.5) => isDirty = 1 (1702.0/16.0) [855.0/5.0]
if input.DebugSize <= 14 and input.ImageVersion <= 760 and input.VirtualSize2 > 992 and input.ExportSize <= 80.5:
isDirty = 1
#Except (DebugSize <= 14) and (ImageVersion <= 4525) and (ExportSize <= 198.5) and (ResourceSize <= 37532) and (VirtualSize2 <= 6) and (ResourceSize <= 7348) and (ResourceSize > 1773) => isDirty = 1 (106.0/0.0) [48.0/0.0]
elif input.DebugSize <= 14 and input.ImageVersion <= 4525 and input.ExportSize <= 198.5 and input.ResourceSize <= 7348 and input.VirtualSize2 <=6 and input.ResourceSize > 1773:
isDirty = 1
#Except (DebugSize <= 14) and (ImageVersion <= 4950) and (ExportSize <= 192) and (IatRVA > 256) and (VirtualSize2 > 42) and (ExportSize <= 56) and (NumberOfSections > 3.5) => isDirty = 1 (193.0/0.0) [91.0/0.0]
elif input.DebugSize <= 14 and input.ImageVersion <= 4950 and input.ExportSize <= 56 and input.IatRVA > 256 and input.VirtualSize2 > 42 and input.NumberOfSections > 3.5:
isDirty = 1
#Except (DebugSize <= 14) and (ImageVersion <= 4950) and (VirtualSize2 <= 6) and (ResourceSize <= 37532) and (ResourceSize <= 17302) => isDirty = 1 (388.0/0.0) [216.0/7.0]
elif input.DebugSize <= 14 and input.ImageVersion <= 4950 and input.VirtualSize2 <= 6 and input.ResourceSize > 17302:
isDirty = 1
#Except (DebugSize <= 14) and (NumberOfSections > 2.5) and (ResourceSize > 1776) and (IatRVA <= 6144) and (ExportSize <= 219.5) and (VirtualSize2 > 2410) and (VirtualSize2 <= 61224) => isDirty = 1 (238.0/0.0) [116.0/0.0]
elif input.DebugSize <= 14 and input.NumberOfSections >= 2.5 and input.ResourceSize <= 1776 and input.IatRVA <= 6144 and input.ExportSize <= 219.5 and input.VirtualSize2 > 2410 and input.VirtualSize2 <= 61224:
isDirty = 1
Пример того, как не надо писать на питоне, показывает Adobe. Полная версия: http://voxel.dl.sourceforge.net/project/malclassifier.adobe/AdobeMalwareClassifier.py
+153
do
{
$firstDate = ConvertTimeStamp($firstDateSt, "SHORT");
$lastDate = ConvertTimeStamp($lastDateSt, "SHORT");
$arPeriod = Array(
"TITLE" => CSchool::GetDiaryPeriod($firstDate, $lastDate),
"HREF" => $APPLICATION->GetCurPageParam('START_WEEK='.$firstDate.'&END_WEEK='.$lastDate, array("START_WEEK", "END_WEEK"))
);
Битрикс...
do без while? лаконично
+163
//fucking designers
if ( $page->importantshort ) $page->short = true;
if ( $page->importantNOTshort ) $page->short = false; // так то!
+76
} catch (IllegalArgumentException e) {
// checked exceptions are stupid
throw new UnexpectedException(e);
}
https://github.com/lmcalpin/Play--Paginate/blob/master/src/play/modules/paginate/strategy/JPARecordLocatorStrategy.java#L149
Well...
public class IllegalArgumentException extends RuntimeException