- 1
- 2
- 3
<style Language="JavaScript">
...
</style>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+132
<style Language="JavaScript">
...
</style>
WUT
+40
Function DateDiff ($interval,$date1,$date2)
{
// получает количество секунд между двумя датами
$timedifference = $date2 - $date1;
switch ($interval) {
case 'w':
$retval = bcdiv($timedifference,604800);
break;
case 'd':
$retval = bcdiv($timedifference,86400);
break;
case 'h':
$retval =bcdiv($timedifference,3600);
break
case 'n':
$retval = bcdiv($timedifference,60);
break;
case 's':
$retval = $timedifference;
break;
}
return $retval;
}
Не моё, где-то на просторах интернета обнаружил.
+46
$confs = array();
$q = new WP_Query(array('post_type' => 'conference',
'posts_per_page' => -1,
'meta_key' => 'cd-conference-date-start',
'orderby' => 'meta_value_num',
'order' => 'DESC'
));
while($q->have_posts()): $q->the_post();
$confs[date("Y", get_post_meta($post->ID, 'cd-conference-date-start', true))][] = array('conf_title' => get_the_title(),
'conf_date_start' => get_post_meta($post->ID, 'cd-conference-date-start', true),
'conf_date_end' => get_post_meta($post->ID, 'cd-conference-date-end', true),
'conf_link' => get_permalink(),
'conf_city' => get_post_meta($post->ID, 'cd-conference-city', true),
'conf_icon' => get_the_post_thumbnail()
);
endwhile;
wp_reset_postdata();
WordPress. Глубже, чем вы себе можете представить.
+127
override def text: String = super.text
https://github.com/scala/scala/blob/master/src/library/scala/xml/Node.scala
+19
Lennart lennart=new Lennart;
Надпись жёлтым цветом на гпавном меню minecraft.
+57
if( $data['id_Account'] =! $this->user->Account )
+74
//переворачиваем массив с ног на голову, отрезаем голову, чтоб осталось 10 элементов и ставим все что осталось на ноги
$_lasts = array_reverse(array_splice(array_reverse($last_view), 5));
"казнь" массива
+38
SkinDog* crateDog()
{
return reinterpret_cast<SkinDog*>( new Dog() );
};
void deleteDog( SkinDog* pDog)
{
delete reinterpret_cast<Dog*>( pDog );
}
EvilDog::bite()
{
Dog* pDog = mutationDog();
Не удержался, чтоб не запостить. Сами знаете откуда.
+41
int sheeps(int pole[10][10])
{
int i,j,f,k,r;
int rand_chislo, rand_chislo1, ts,s;
srand(time(NULL));
for (i=0;i<10;i++)
for (j=0;j<10;j++)
pole [i][j]=0;
do{ f=0;
rand_chislo = 0 + rand() %10;
rand_chislo1= 0 + rand() %10;
ts = 1+rand()%4;
if (ts==1) {for(i=0;i<3;i++) if(rand_chislo==i)f=1;}
if (ts==2) {for(i=7;i<10;i++) if(rand_chislo==i)f=1;}
if (ts==3) {for(i=0;i<3;i++) if(rand_chislo1==i)f=1;}
if (ts==4) {for(i=7;i<10;i++) if(rand_chislo1==i)f=1;}
}
while (f==1);
switch (ts){
case 1: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo-1][rand_chislo1]=1;
pole[rand_chislo-2][rand_chislo1]=1;pole[rand_chislo-3][rand_chislo1]=1; break;
case 2: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo+1][rand_chislo1]=1;
pole[rand_chislo+2][rand_chislo1]=1;pole[rand_chislo+3][rand_chislo1]=1; break;
case 3: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo][rand_chislo1-1]=1;
pole[rand_chislo][rand_chislo1-2]=1;pole[rand_chislo][rand_chislo1-3]=1;break;
case 4: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo][rand_chislo1+1]=1;
pole[rand_chislo][rand_chislo1+2]=1;pole[rand_chislo][rand_chislo1+3]=1; break; }
for (k=0;k<3;k++)
{
do{ f=0;
rand_chislo = 0 + rand() %10;
rand_chislo1= 0 + rand() %10;
ts = 1+rand()%4;
if (ts==1) {if(rand_chislo!=0){ for (i=rand_chislo-2;i<rand_chislo+2;i++)
for (j=rand_chislo1-1;j<=rand_chislo1+1;j++)
{if (pole[i][j]!=0){f=1;}}}else f=1; }
if (ts==2) {if (rand_chislo!=9) { for (i=rand_chislo-1;i<=rand_chislo+2;i++)
for (j=rand_chislo1-1;j<=rand_chislo1+1;j++)
{ if (pole[i][j]!=0){ f=1;}}}else f=1; }
if (ts==3) { if (rand_chislo1!=0) { for (i=rand_chislo-1;i<=rand_chislo+1;i++)
for (j=rand_chislo1-2;j<=rand_chislo1+1;j++)
{ if (pole[i][j]!=0){ f=1;}}}else f=1; }
if (ts==4) { if (rand_chislo1!=9) { for (i=rand_chislo-1;i<=rand_chislo+1;i++)
for (j=rand_chislo1-1;j<=rand_chislo1+2;j++)
{ if (pole[i][j]!=0){ f=1;}}}
else f=1; }
}
while (f==1);
switch (ts){
case 1: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo-1][rand_chislo1]=1; break;
case 2: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo+1][rand_chislo1]=1; break;
case 3: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo][rand_chislo1-1]=1;break;
case 4: pole[rand_chislo][rand_chislo1]=1; pole[rand_chislo][rand_chislo1+1]=1; break; }
}
for (k=0;k<2;k++)
{
do{ f=0;
rand_chislo = 0 + rand() %10;
rand_chislo1= 0 + rand() %10;
/*зесь еще 2 таких же while (if==1) и for k<3 и k<4 */
return pole[10][10];
}
курсовик первокурсника "морской бой". функция расстановки кораблей
+137
{- Haskell -}
bruteforceGeneratorWithEasySimplication :: Description d => d -> [StandartTable]
bruteforceGeneratorWithEasySimplication description =
let width = size_h description; height = size_v description; vHeader = headerV description in
do
table <- genListBasedOn (map lineVariants vHeader)
return (ST table)
where
lineVariants :: [Int] -> [[Bool]]
lineVariants headerLine = let
всё_я_задолбался_однако = True -- K.O.
количество_цельных_блоков = length headerLine
число_промежутков = количество_цельных_блоков - 1
число_свободных_пробелов_которые_нам_нужно_распихать_между_цельными_блоками = ширина_поля - суммарная_длина_цельных_блоков
ширина_поля = size_h description
суммарная_длина_цельных_блоков = sum headerLine
возможная_строка_использующая :: [Int] -> [Bool]
возможная_строка_использующая разбиение = replicate (head разбиение) False ++
concat (zipWith (\x y -> replicate y True ++ replicate x False) (tail разбиение) headerLine)
и = and
по = undefined
in do
разбиение <- получить_разбиение_для_строки по (число_свободных_пробелов_которые_нам_нужно_распихать_между_цельными_блоками) и (число_промежутков)
return (возможная_строка_использующая разбиение :: [Bool])
получить_разбиение_для_строки по числу_свободных_элементов и числу_промежутков = do ...
Из раннего.
По-видимому, задолбался писать на тарабарщине, захотелось выражаться родными русскими словами.