- 1
var GetUrl = /\[(.*)\]/g.exec("$SECTION_NAME$")[1].replace(/\-/i, '~').replace(/\-/i, '~');
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+151
var GetUrl = /\[(.*)\]/g.exec("$SECTION_NAME$")[1].replace(/\-/i, '~').replace(/\-/i, '~');
фу ;(
+155
if($inc == true){
$counter_val = $cat[$this->FileCounterKey] + 1;
}else{
$counter_val = $cat[$this->FileCounterKey] - 1;
}
Класс деревьев в одной русской CMS. Метод пересчитывает кол-во файлов в категории после добавления/удаления.
+75
<% ServicePackage servicePackage = null; %>
<% char fi [] = {'g', 'v', 'p'}; %>
<% int ni [] = {3, 7, 11}; %>
<% for(int i = 0; i < fi.length; i++)
for(int j = 1; j <= ni[i]; j++)
{
String id = "", name = null, brief = null, price = null;
id += (char)fi[i];
if (j >= 10)
id += (char)('0' + j / 10);
id += (char)('0' + j % 10);
servicePackage = AllServicePackages.map.get(id);
if (servicePackage != null)
{
name = servicePackage.getName();
brief = servicePackage.getBrief();
price = servicePackage.getPrise();
}
%>
<% } %>
Автору хотелось перебрать все эл-ты map'а.
−120
if( (ori == UIInterfaceOrientationLandscapeLeft) || (ori == UIInterfaceOrientationLandscapeRight))
{
// Some code
}
else if(ori==UIInterfaceOrientationPortrait || ori==UIInterfaceOrientationPortraitUpsideDown)
{
// Some other code
}
else {
// God mode on!
}
Реальный проект после индусов... Что движет этими людьми я не понимаю...
+166
// say this is some existing structure. And we want to use
// a list. We can tell it that the next pointer
// is apple::next.
struct apple {
int data;
apple * next;
};
// simple example of a minimal intrusive list. Could specify the
// member pointer as template argument too, if we wanted:
// template<typename E, E *E::*next_ptr>
template<typename E>
struct List {
List(E *E::*next_ptr):head(0), next_ptr(next_ptr) { }
void add(E &e) {
// access its next pointer by the member pointer
e.*next_ptr = head;
head = &e;
}
E * head;
E *E::*next_ptr;
};
int main() {
List<apple> lst(&apple::next);
apple a;
lst.add(a);
}
c++ страшный язык :) (часть вторая)
C++: Pointer to class data member: http://stackoverflow.com/questions/670734/c-pointer-to-class-data-member
Такие конструкции "E *E::*next_ptr;" без подготовки не осилить.
+165
// Обработка запроса
for ($i = 1; $i<=300000; $i++)
{
$marat=$marat+10;
}
Эмуляция паузы при генерировании РНР-скриптом ответа для Flash-ки (сайт - онлайн казино)
−116
sub _check_sms_hash {
my $self = shift;
my $q = shift;
my $qs = $q->param('id').$q->param('phone').$q->param('trigger').$q->param('text').$q->param('date').$q->param('check').$self->_sicretsms();
my $hash = $self->{DB}->selectrow_array("SELECT MD5(?)", undef, $qs);
return 1 if $hash eq $q->param('sign');
return 0;
}
Православное вычисление контрольной суммы.
+151
$currN = 0;
$countN = count($news);
$currW = 0;
$countW = count($wall);
$time = time();
$date = date('Y-m-d H:i:s');
// Жестянка в сферическом ваккуме куба
foreach($lenta as $k => &$v)
{
while (($v['DZ'] <= $news[$currN]['DZ']))
{
while (($news[$currN]['DZ'] <= $wall[$currW]['DZ']) && ($currW < $countW))
{
$this->create_time($wall[$currW]['DZ'], $time, $date);
$this->display_wall($wall[$currW]);
++$currW;
}
$this->create_time($news[$currN]['DZ'], $time, $date);
$this->display_news($news[$currN]);
++$currN;
}
$this->create_time($v['DZ'], $time, $date);
$this->display_lenta($v, $usr);
}
while ($currN < $countN)
{
while (($news[$currN]['DZ'] <= $wall[$currW]['DZ']) && ($currW < $countW))
{
$this->create_time($wall[$currW]['DZ'], $time, $date);
$this->display_wall($wall[$currW]);
++$currW;
}
$this->create_time($news[$currN]['DZ'], $time, $date);
$this->display_news($news[$currN]);
++$currN;
}
while ($currW < $countW)
{
$this->create_time($wall[$currW]['DZ'], $time, $date);
$this->display_wall($wall[$currW]);
++$currW;
}
Просто и со вкусом.
+161
$key = 0;
foreach ($this->hosts as $key => $host) {
$key++;
.....
}
+143
cmp bl,1
je France_jmp
cmp ax,380
je Bulgaria_jmp
cmp ax,383
je Slavonia_jmp
cmp ax,385
je Croatia_jmp
mov bx,400
mov dx,440
call IfAnd
cmp bl,1
je Germany_jmp
jmp next_s
USA_jmp: jmp USA
Grinford_jmp: jmp Grinford
France_jmp: jmp France
Bulgaria_jmp: jmp Bulgaria
Slavonia_jmp: jmp Slavonia
Croatia_jmp: jmp Croatia
Germany_jmp: jmp Germany
next_s:
mov bx,450
mov dx,459
call IfAnd
cmp bl,1
je Japan_jmp
mov bx,460
mov dx,469
call IfAnd
cmp bl,1
je Russia_jmp
cmp ax,471
je Taiwan_jmp
cmp ax,474
je Estonia_jmp
cmp ax,475
je Litvia_jmp
cmp ax,477
jmp next_ss
Japan_jmp: jmp Japan
Russia_jmp: jmp Russia
Taiwan_jmp: jmp Taiwan
Estonia_jmp: jmp Estonia
Litvia_jmp: jmp Latvia
Lithuania_jmp: jmp Lithuania
Philippines_jmp: jmp Philippines
Ukraine_jmp: jmp Ukraine
Moldova_jmp: jmp Moldova
Hongkong_jmp: jmp Hongkong
Britain_jmp: jmp Britain
Greece_jmp: jmp Greece
Cyprus_jmp: jmp Cyprus
Macedonia_jmp: jmp Macedonia
Malta_jmp: jmp Malta
Ireland_jmp: jmp Ireland
Belgium_jmp: jmp Belgium
Portugal_jmp: jmp Portugal
Iceland_jmp: jmp Iceland
Denmark_jmp: jmp Denmark
next_ss:
je Lithuania_jmp
cmp ax,480
je Philippines_jmp
cmp ax,482
je Ukraine_jmp
cmp ax,484
je Moldova_jmp
cmp ax,489
je Hongkong_jmp
Прога для проверки правильности штрих-кодов по контрольной сумме и определение страны-производителя. Про таблицы перехода и near-адресацию конечно в те времена еще не догадывался, только начинал учить асм.
PS: А интерфейс у нее ничего такой был для ассемблера, правда слизал с NU: http://habrastorage.org/storage1/e4efe022/903c7848/d99f7f4f/33d1ed16.png