- 1
- 2
- 3
- 4
function is_negative($num)
{
return ord("$num")==45;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+158.6
function is_negative($num)
{
return ord("$num")==45;
}
Как уже ясно, определяет знак числа...
Кстати, всего одна строчка ;)
//by HTMLCODER.exe
+148
[root@v6704 ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@v6704 ~]# cd /var/www/vhosts/i-tech.me/subdomains/store/httpdocs/
[root@v6704 httpdocs]# ls
access dblist i2 installer license.txt settings.xml showmucontent.php update.xml
ajaxhandler.php domxml-php4-to-php5.php includes install.js login setupguide.htm sitemap.php www.tar.gz
backup dumper.php index.php install.log published shop system
data help install.css kernel readme.txt showdblist.php temp
[root@v6704 httpdocs]# rm -Rf *.*
[root@v6704 httpdocs]# ls
access backup data dblist help i2 includes installer kernel login published shop system temp
[root@v6704 httpdocs]# rm -Rf *
[root@v6704 httpdocs]# ls
[root@v6704 httpdocs]#
[root@v6704 ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@v6704 ~]# cd /var/www/vhosts/i-tech.me/subdomains/store/httpdocs/
−856.5
select sum(all_.allscores) as allscores, sum(all_.matched) as matched, all_.id, all_.title, cc.name, cc.id as cmpId
from
(select SE.assid as id, SE.allcurrent as allscores, SE.matched, SE.title-- SE.name -- ,SE.title,SE.cmpId
FROM
(select allb.assid, sum(allb.allcurrent) as allcurrent, sum(allb.match_cnt) as matched, allb.title -- ,cc.name,cc.id as cmpId, -- , aa.id
from
(select * from
(SELECT assa.title, IFNULL(allcur.allcurrent,0) as allcurrent, assa.id as assid , IFNULL(SUM( res.weight),0) AS match_cnt
FROM
ass_assignment assa LEFT JOIN
(SELECT DISTINCT pss.cv_i
....
ёбаные лесенки...
+140.8
class vector_ptd //pointed vector - вектор заданный 2 точками, т.е. привязанный к опр.месту в пространстве
{
...
/*vector operator =(point& _p)
{
vector _v;
_v.vx=_p.x;
_v.vy=_p.y;
_v.vz=_p.z;
return _v;
}*/
...
};
vector vectorp(point& _p)
{
vector _v;
_v.vx=_p.x;
_v.vy=_p.y;
_v.vz=_p.z;
return _v;
}
Класс, реализующий вектор в трёхмерном пространстве (для трассировщика лучей). Автор не осилил оператор присваивания и тихо закомментил его, сделав вместо него функцию преобразования.
+191.4
<?php
$maxuploadsize = 1024 * 1024 * 2; //4Mb
?>
+153
var c:longint;
begin
c:= 12345;
write( char( ( ((( (c div 10000) mod 10 ) mod 2) + 1) mod 2) * (( (c div 10000) mod 10 ) +
byte( '0' )) + (( (c div 10000) mod 10 ) mod 2) * byte(' ') ) ,
char( ( ((( (c div 1000) mod 10 ) mod 2) + 1) mod 2) * (( (c div 1000) mod 10 ) +
byte( '0' )) + (( (c div 1000) mod 10 ) mod 2) * byte(' ') ) ,
char( ( ((( (c div 100) mod 10 ) mod 2) + 1) mod 2) * (( (c div 100) mod 10 ) +
byte( '0' )) + (( (c div 100) mod 10 ) mod 2) * byte(' ') ) ,
char( ( ((( (c div 10) mod 10 ) mod 2) + 1) mod 2) * (( (c div 10) mod 10 ) +
byte( '0' )) + (( (c div 10) mod 10 ) mod 2) * byte(' ') ) ,
char( ( ((( (c div 1) mod 10 ) mod 2) + 1) mod 2) * (( (c div 1) mod 10 ) +
byte( '0' )) + (( (c div 1) mod 10 ) mod 2) * byte(' ') ) );
readln;
end.
На одном чайникофоруме попросили решить задачу на паскале: вывести все чётные цифры пятизначного числа. При этом нельзя пользоваться функциями, циклами и условными операторами. Вот, что у меня из этого получилось :)
+133.8
iplist += "<ul id='iplist'>";
jsonData="[";
for(var i=0;i<selections.length;i++) {
jsonData += Ext.util.JSON.encode(selections[i])+",";
iplist += "<li>" + selections[i] + "; </li>";
}
jsonData = jsonData.substring(0,jsonData.length-1) + "]";
iplist += "</ul>";
win.show();
Ext.get("list").update(iplist);
win.hide();
win.show();
В ExtJS не хотел обновляться компонент окна.
+139
print( '?> <span class="TextContentRedBig"> <? В одноместный двоих не селят ?> </span><? ');
Блин почему не работает???
+145
<?php
require_once('global.php');
$id = $_GET['id'];
if( !$lore_system->db->id_exists( $id, 'lore_articles') )
{
$lore_system->te->assign('error_message', 'invalid_article');
$lore_system->te->display('error_message.tpl');
exit;
}
if( !$lore_db_interface->article_is_published( $id ) )
{
$lore_system->te->assign('error_message', 'article_not_published');
$lore_system->te->display('error_message.tpl');
exit;
}
$action = ( isset( $_REQUEST['action'] ) ) ? $_REQUEST['action'] : 'article';
switch( $action )
{
case 'print':
$article = $lore_db_interface->get_article_info( $id );
$article['comments'] = $lore_db_interface->get_article_comments( $id );
$lore_system->te->assign('category_path', $lore_db_interface->get_category_path( $article['category_id'] ));
$lore_system->te->assign('article', $article);
$lore_system->te->display('article_print.tpl');
break;
case 'article':
if( !@in_array( $id, $lore_user_session->session_vars['viewed_articles'] ) )
{
$lore_db_interface->increment_article_views( $id );
$lore_user_session->session_vars['viewed_articles'][] = $id;
}
$article = $lore_db_interface->get_article_info( $id );
$article['comments'] = $lore_db_interface->get_article_comments( $id );
$article['num_comments'] = count($article['comments']);
$article['attachments'] = $lore_db_interface->get_article_attachments( $id );
$article['allow_comments'] = $lore_db_interface->can_comment_on_article( $id );
$article['related_articles'] = $lore_db_interface->get_related_articles( $id );
if( $lore_user_session->has_article_write_permission( $id ) )
{
$article['display_edit_link'] = true;
}
if( $lore_system->settings['enable_glossary_popups'] )
{
$glossary_terms = $lore_db_interface->get_glossary_terms();
if( count($glossary_terms) )
{
$term_html = array();
$html_tags = array();
$term_c = 0;
// strip out HTML tags first
@preg_match_all("/<[^>]+>/", $article['content'], $matches);
for( $i = 1; $i < count($matches[0]); $i++ )
{
// save html tag for later
$html_tags[$i] = $matches[0][$i];
// parse in placeholder
$article['content'] = str_replace( $matches[0][$i], "{{h$i}}", $article['content']);
}
foreach( $glossary_terms AS $term )
{
// Add "i" (NOT case sensitive) modifier to regular expression if necessary
$case = ( $term['case_sensitive'] ) ? '' : 'i';
$term['definition'] = ereg_replace("[\n\r]", '', $term['definition']);
$lore_system->te->assign('term', htmlspecialchars(str_replace("'", "\\'", $term['term'])) );
+149
$article['content'] = preg_replace("/\b" . $matches[0][$i] . "\b/", "{{g$term_c}}", $article['content']);