- 1
- 2
- 3
long id;
try { id = long.Parse(e.Item.Cells[0].Text); }
catch { id = 0; }
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+132
long id;
try { id = long.Parse(e.Item.Cells[0].Text); }
catch { id = 0; }
Эта жемчужина прекрасно описывает весь говнокод производимый различными группами людей в моей компании.
−147
function myfunc(e:Event):void
{
kolobok.x+=pathX;
kolobok.y+=pathY;
if(kolobok.x==25&&kolobok.y==25) {pathX=10;pathY=0;}
if(kolobok.x==475&&kolobok.y==25) {pathX=0;pathY=10;}
if(kolobok.x==475&&kolobok.y==475) {pathX=-10;pathY=0;}
if(kolobok.x==25&&kolobok.y==475) {pathX=0;pathY=-10;}
}
Помогите разобраться с циклом, вообще колобок, делает круг вокруг формы, а после он должен опять делать круг но он почему то уходит, я не пойму почему..
+95
// same as Callable but without exception
public interface Executable<T>
{
public T call();
}
/*В другом классе: методы для конверсии туда-сюда */
public Callable<T> toCallable(final Executable<T> ex){
return new Callable<T>(){
public T call() throws Exception{
return ex.call();
}
};
}
public Executable<T> toExecutable(final Callable<T> c)
{
return new Executable<T>(){
public T call(){
try{
return c.call();
}catch (Exception e){
throw new RuntimeException(e);
}
}
};
}
+98
public interface FunctionWithException<F,T,E extends Throwable>
{
public T call(F f) throws E;
}
......
public interface Function<F,T> extends FunctionWithException<F,T,RuntimeException>
{
public T call(F f) throws RuntimeException;
}
В этом сезоне в моде всё функциональное.
−33
bool operator()(int x,int y)
{return x<y;}
Вторая часть) реально интересуются люди
"надо два объекта моего класса сравнить, так?"
ну, вообще жесть
+141
function toArray($xml) {
$xml = simplexml_load_string($xml);
$json = json_encode($xml);
return json_decode($json,TRUE);
}
Но зачем?!
−25
bool operator<(const A *obj){
if (obj->n < this->n)
return true;
else if (this->n < obj->n)
return false;
};
Перегрузка оператора сравнения
+54
foreach($Articles as $art){
$id = $art['id'];
$count++;
if(isset($_GET['str'])){
$str = (int)$_GET['str'];
$mn = $number*($str-1)+1;
}else{
$str = 1;
$_GET['str'] = 1;
}
if($count == $mn){
$flag = true;
$k=5;
}
if($flag && $k!=0){
$k--;
$title = $art['title'];
$content = $art['content'];
$author = $art['author'];
$date = $art['date'];
printf("<h1>%s</h1><br /><h3 align='left'>%s</h3>%s <a href='index.php?id=articles&str=%s&nomer=%s'>Далее</a><hr /><br />",$title,$date, substr($content, 0,800),$nav, $id);
}
}
Постраничная навигация
−27
class Screen
{
private:
unsigned char *data; // do not move
size_t size; // do not move
+141
http://viois.ru/thread.txt
Приходится признать, что это мой код...