- 1
- 2
- 3
$janres = serialize(isset($_POST['janres']) ? SafeEnv($_POST['janres'], 11, int) : array());
if($tree->IdCats[$cat]['janres'] == "0") $janres = serialize(array());
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+155
$janres = serialize(isset($_POST['janres']) ? SafeEnv($_POST['janres'], 11, int) : array());
if($tree->IdCats[$cat]['janres'] == "0") $janres = serialize(array());
Бредокод
+133
#include <stdio.h>
#include <stdlib.h>
#define $ /* */
#define ARGV argv
#define if($x) int main(int argc, char *argv[])
#define $start 1
#if PERL
sub atoi { $_[0] }
$ argc=@ARGV;
$ start=0;
$ x=1;
#endif
if($x)
{
int $ sum;
int $ i;
$ sum=0;
for ( $ i = $start; $ i < $ argc ; $ i++) {
$ sum += atoi ($ ARGV [$ i]);}
printf("%d\n", $ sum);
exit(0);
}
Пришла в голову вот такая вот идея, уже пишу серьезный проект, а вам даю на оценку вот такой вот код.
Думаю вообще связать это все дело еще и с PHP, вот таким вот образом:
<?php system('./home/Cuberpunk/private/iGuruCodder/SeriousProject/main 15 12 15'); ?>
Хотел запостить на Хабр, но нету там аккаунта, поэтому пишу сюда ;)
Оценивайте, комментируйте. Сейчас работаю над крупным проектом на эту тему, ждите.
Если кому интересно, то вот моя темка на форуме, где все более подробно описано:
http://forum.antichat.ru/threadedpost2883414.html
+154
function getDirName($artistId)
{
$dirName = 1;
$startNumber = 500;
$result = false;
while(!$result) {
if ($artistId <= $startNumber) {
$result = true;
}
else {
$dirName++;
$startNumber += 500;
}
}
return $dirName;
}
Весь прикол такой, что фотки на сервере лежат по 500 штук и зная id артиста можно узнать в какой из директории лежит его фотка. Вместо того чтобы написать, что то типа - $dirName = round($artistId / 500); я выдумал вот такую несуразицу :)
+131
data М = М { unМ :: String }
instance Show М where
show = map succ . unМ
main = print $ М"ФТИ"
Синтетический баян...
+75
int i128 = 0, i256 =0, i384=0, i512=0, i640=0, i786=0, i896=0, i1024=0, i1152=0, i1280=0, i1408=0, i1536=0;
for (int index: data) {
if (index>max) max = index;
if (min>index) min = index;
if (0<=index & index<128) i128++;
else if (128<=index & index<256) i256++;
else if (256<=index & index<384) i384++;
else if (384<=index & index<512) i512++;
else if (512<=index & index<640) i640++;
else if (640<=index & index<786) i786++;
else if (786<=index & index<896) i896++;
else if (896<=index & index<1024) i1024++;
else if (1024<=index & index<1152) i1152++;
else if (1152<=index & index<1280) i1280++;
else if (1280<=index & index<1408) i1408++;
else if (1408<=index & index<1536) i1536++;
Считаем количество попаданий index в различные диапазоны значений.
+164
if (
$arItem["DEPTH_LEVEL"]==$previousLevel
&&$arItem["IS_PARENT"]
&&$arItem["DEPTH_LEVEL"]>3
||$arItem["DEPTH_LEVEL"]<$previousLevel
&&$arItem["IS_PARENT"]
&&$arItem["DEPTH_LEVEL"]==3
&&$previousLevel-$arItem["DEPTH_LEVEL"]==1
)
.....
Paranoid mode deteсted! Внимание! (Г)Код был в строку, для удобства чтения отформатировал.
−116
// было
-(BOOL)textFieldShouldReturn:(UITextField *)textField {
if (textField == firstName) {
[lastName becomeFirstResponder];
}
else if (textField == lastName) {
[zip becomeFirstResponder];
}
else if (textField == emailAdr) {
[confirmEmailAdr becomeFirstResponder];
}
else if (textField == confirmEmailAdr) {
[zip becomeFirstResponder];
}
else if (textField == zip) {
[street becomeFirstResponder];
}
else if (textField == street) {
[city becomeFirstResponder];
}
else if (textField == city) {
[telephonNumber becomeFirstResponder];
}
else if (textField == telephonNumber) {
[wachtwoord becomeFirstResponder];
}
else{
[textField resignFirstResponder];
}
return YES;
}
// решил заменить на ( при условии что все текстфилды протаганы от 1 до N):
-(BOOL)textFieldShouldReturn:(UITextField *)textField {
int tag = textField.tag;
UITextField* tf = (UITextField*)[self.scrollView viewWithTag:tag+1];
if ( tf )
[tf becomeFirstResponder];
else
[textField resignFirstResponder];
return YES;
}
+80
@Deprecated
private byte getLoByte(int i) {
byte ret = 0x00;
String hex = Integer.toHexString(i);
int length = hex.length();
if (length == 1) {
ret = Integer.valueOf(hex.substring(length - 1), 16).byteValue();
} else if (length >= 2) {
ret = Integer.valueOf(hex.substring(length - 2), 16).byteValue();
}
return ret;
}
@Deprecated
private byte getHiByte(int i) {
String hex = Integer.toHexString(i);
byte ret = 0x00;
int length = hex.length();
if (length > 3) {
ret = Integer.valueOf(hex.substring(length - 4, length - 2), 16).byteValue();
} else if (length == 3) {
ret = Integer.valueOf(hex.substring(length - 3, length - 2), 16).byteValue();
}
return ret;
}
Вытаскивание старшего и младшего байтов числа из последних одного или двух байтов
−102
Сегодня мы отказались от 1С.
Сегодня, когда день апплодировал стоя.
А в штанах остались желтые бумажки. В назидание?
−128
if (players.indexOf(String(Game.uid)) == 0)
players.shift();
else
players.pop();