- 1
movie_data["genres"][i]["ru"].lower().encode("utf-8").decode("utf-8")
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−86
movie_data["genres"][i]["ru"].lower().encode("utf-8").decode("utf-8")
Хм...
+118
private String compileOwnerName() {
return Joiner.on(' ').skipNulls().
String firstName = ownerFirstName.getValue();
String lastName = ownerLastName.getValue();
final StringBuilder buffer = new StringBuilder();
boolean first = true;
if (firstName != null) {
firstName = firstName.trim();
if (!"".equals(firstName)) {
buffer.append(firstName);
first = false;
}
}
if (lastName != null) {
lastName = lastName.trim();
if (!"".equals(lastName)) {
if (!first) {
buffer.append(" ");
}
buffer.append(lastName);
}
}
return buffer.toString();
}
В итоге заменено однострочником на Perl:
return Joiner.on(' ').skipNulls().join(Strings.emptyToNull(ownerFirstName.getValue().trim()),
ownerLastName.getValue().trim()));
−194
function new_object($data) {
foreach($data as $key=>$item)
$array[$key] = $item;
return $this->db->insert('objects',$array);
}
+1
WORD StrLen(PChar s)
{
ASSERT(s!=NULL);
int i;
for (i=0; ( (*(s+i)!=0) && (i<=WORDMAX) ); i++) {};
ASSERT(i<=WORDMAX);
return (WORD)i;
};
По заявкам из http://govnokod.ru/11318
+62
function find( &$db, $id) {
$statement = Contact::findStatement() . " WHERE id = $id";
$dbResult = ActiveRecord::abstractFind( $db, $statement);
foreach ($dbResult as $dbRow) {
return Contact::load( $db, $dbRow);
}
return null;
}
−155
override public function execute():void
{
var maintainProductAttributePresenter:ITableBasedPresentrer = this.appPresenter.maintainProductAttributePresenter;
var maintainProductAttributeView:View = maintainProductAttributePresenter.view;
this.appView.showModuleView(maintainProductAttributeView);
this.appView.showModuleHeader(maintainProductAttributePresenter.getModuleTitle());
maintainProductAttributePresenter.updateData();
}
Сижу, копипазжу... Специально не стала выбиваться из стандарта... Может хоть на секунду мысль о том что мы занимаемся маразмом кому нибудь в голову придет?
−93
# -*- coding: utf-8 -*-
from django.db import models
# Create your models here.
class SheduleItem(models.Model):
WIKDI = (
('monday', 'Понедельник'),
('tuesday', 'Вторник'),
('wednesday', 'Среда'),
('thursday', 'Четверг'),
('friday', 'Пятница'),
('saturday', 'Суббота'),
('sunday', 'Воскресенье'),
)
TAIM = (
('08:00', '08:00'),
('09:00', '09:00'),
('10:00', '10:00'),
('11:00', '11:00'),
('12:00', '12:00'),
('13:00', '13:00'),
('14:00', '14:00'),
('15:00', '15:00'),
('16:00', '16:00'),
('17:00', '17:00'),
('18:00', '18:00'),
('19:00', '19:00'),
('20:00', '20:00'),
('21:00', '21:00'),
)
weekday = models.CharField(max_length=20, choices=WIKDI)
time = models.CharField(max_length=6, choices=TAIM)
action = models.CharField(max_length=30)
trainer = models.ForeignKey('trainers.StrongTrainer')
def __unicode__(self):
return self.action
Django-модель для таблицы расписания занятий. Выдавлено в 2 часа ночи под Сержа Танкяна.
+50
<?php
require('url_to_absolute.php');
ini_set('display_errors','On');
error_reporting('E_ALL');
$ext=array(
'pictures'=>array('bmp','jpg','jpeg','pgm','rgb','tga','png','gif','ico'),
'docs'=>array('rtf','doc','docx','pdf','txt'),
'html'=>array('shtml','html','xml','css','htm','xhtml'),
'audio'=>array('mp3','mp4','mpeg','flv','3gp','webm'),
'arch'=>array('zip','rar','gz','bz2','tar','7zip','ar','tar\.gz','tar\.bz2','xz'),
'pack'=>array('deb','rpm','jar'),
'scripts'=>array('sh','pl','py','php','js')
);
$murl="";
$sext="";
$routh='|((?<=[" ])[^" ]+/[a-z0-9-_%.]+\.';
foreach($ext as $sk=>$sval){
foreach($sval as $exts){
$routh.='(?!'.$exts.'")';
}
}
$routh.='[a-z0-9]{1,5}(?=[" ]))|i';
echo $routh."<br\ >";
if(isset($_GET['url'])){
$url=$_GET['url'];echo $url."<br>";
preg_match('|(ftp)?(http)?(?:s)?://[a-z0-9-]+\.[a-z]+(\.[a-z0-9-_&+?=%]+)*(?::[0-9]+)?|i',$url,$ures);
if(!empty($ures[0])){echo $ures[0];$murl=$ures[0];echo "<br>murl ".$murl."<br> ";}
$html=file_get_contents($url);
foreach($ext as $key=>$val){
echo "<h2>$key</h2><br\>";
foreach($val as $mext){
echo "$mext<br>";
preg_match_all('|((/[.a-z0-9_-]*)*/[a-z0-9-_.%]+\.'.$mext.'(?![a-z])(?!/))|i',$html,$result);
if(!empty($result)){
if(!empty($result[0])){
$result[0]=array_unique($result[0]);
foreach($result[0] as $vres){
$aurl=url_to_absolute($url,$vres);
echo("<a href=\"$aurl\">".$aurl."</a> ");}
}
}
preg_match_all('|((http(?:s)?://)[a-z0-9-]+\.[a-z]+(?:\.[a-z0-9-_&+?=%]+)*(?::[0-9]+)?(?:/[a-z0-9_-.]*)/[.a-z0-9-_%]+\.'.$mext.'(?![a-z])(?!/))|i',$html,$result);
if(!empty($result)){
if(!empty($result[0])){
$result[0]=array_unique($result[0]);
foreach($result[0] as $vres){
$aurl=url_to_absolute($url,$vres);
echo("<a href=\"$aurl\">".$aurl."</a> ");}
}
}
preg_match_all('|((?<=[" ])[^" ]+\.'.$mext.'(?=[" ]))|i',$html,$result);
if(!empty($result)){
if(!empty($result[0])){
$result[0]=array_unique($result[0]);
foreach($result[0] as $vres){
$aurl=url_to_absolute($url,$vres);
echo("<a href=\"$aurl\">".$aurl."</a> ");}
}
}
}
}
preg_match_all($routh,$html,$result);
if(!empty($result)){
if(!empty($result[0])){
$result[0]=array_unique($result[0]);
echo "<br><h2>Other documents</h2><br>";
foreach($result[0] as $vres){
$aurl=url_to_absolute($url,$vres);
echo("<a href=\"$aurl\">".$aurl."</a><br \> ");
}
}
}
} else { printf("No url\n");}
?>
Вытягивает ссылки на картинки с html файла
+110
if (M[1]<>M[2]) and (M[1]<>M[3]) and (M[1]<>M[4]) and (M[1]<>M[5]) and (M[1]<>M[6]) then
begin
if (M[1]<>M[7]) and (M[1]<>M[8]) and (M[1]<>M[9]) and (M[1]<>M[10]) then
write(' ',M[1],' ');
end;
if (M[2]<>M[1]) and (M[2]<>M[3]) and (M[2]<>M[4]) and (M[2]<>M[5]) and (M[2]<>M[6]) then
begin
if (M[2]<>M[7]) and (M[2]<>M[8]) and (M[2]<>M[9]) and (M[2]<>M[10]) then
write(' ',M[2],' ');
end;
if (M[3]<>M[1]) and (M[3]<>M[2]) and (M[3]<>M[4]) and (M[3]<>M[5]) and (M[3]<>M[6]) then
begin
if (M[3]<>M[7]) and (M[3]<>M[8]) and (M[3]<>M[9]) and (M[3]<>M[10]) then
write(' ',M[3],' ');
end;
if (M[4]<>M[1]) and (M[4]<>M[2]) and (M[4]<>M[3]) and (M[4]<>M[5]) and (M[4]<>M[6]) then
begin
if (M[4]<>M[7]) and (M[4]<>M[8]) and (M[4]<>M[9]) and (M[4]<>M[10]) then
write(' ',M[4],' ');
end;
if (M[5]<>M[1]) and (M[5]<>M[2]) and (M[5]<>M[3]) and (M[5]<>M[4]) and (M[5]<>M[6]) then
begin
if (M[5]<>M[7]) and (M[5]<>M[8]) and (M[5]<>M[9]) and (M[5]<>M[10]) then
write(' ',M[5],' ');
end;
if (M[6]<>M[1]) and (M[6]<>M[2]) and (M[6]<>M[3]) and (M[6]<>M[4]) and (M[6]<>M[5]) then
begin
if (M[6]<>M[7]) and (M[6]<>M[8]) and (M[6]<>M[9]) and (M[6]<>M[10]) then
write(' ',M[6],' ');
end;
if (M[7]<>M[1]) and (M[7]<>M[2]) and (M[7]<>M[3]) and (M[7]<>M[4]) and (M[7]<>M[5]) then
begin
if (M[7]<>M[6]) and (M[7]<>M[8]) and (M[7]<>M[9]) and (M[7]<>M[10]) then
write(' ',M[7],' ');
end;
readln;
if (M[8]<>M[1]) and (M[8]<>M[2]) and (M[8]<>M[3]) and (M[8]<>M[4]) and (M[8]<>M[5]) then
begin
if (M[8]<>M[6]) and (M[8]<>M[7]) and (M[8]<>M[9]) and (M[8]<>M[10]) then
write(' ',M[8],' ');
end;
if (M[9]<>M[1]) and (M[9]<>M[2]) and (M[9]<>M[3]) and (M[9]<>M[4]) and (M[9]<>M[5]) then
begin
if (M[9]<>M[6]) and (M[9]<>M[7]) and (M[9]<>M[8]) and (M[8]<>M[10]) then
write(' ',M[9],' ');
end;
if (M[10]<>M[1]) and (M[10]<>M[2]) and (M[10]<>M[3]) and (M[10]<>M[4]) and (M[10]<>M[5]) then
begin
if (M[10]<>M[6]) and (M[10]<>M[7]) and (M[10]<>M[8]) and (M[10]<>M[9]) then
write(' ',M[10],' ');
end;
Циклы? Не, не слышал...
+67
<?if($metaid == 16 || $metaid == 44 || $metaid == 52 || $metaid == 60 || $metaid == 90 ||
$metaid == 132 || $metaid == 136 || $metaid == 174 || $metaid == 192 || $metaid == 196 ||
$metaid == 238 || $metaid == 388 || $metaid == 462 || $metaid == 470 || $metaid == 480 ||
$metaid == 500 || $metaid == 530 || $metaid == 533 || $metaid == 548 || $metaid == 580 ||
$metaid == 584 || $metaid == 662 || $metaid == 666 || $metaid == 678 || $metaid == 690 ||
$metaid == 772 || $metaid == 780 || $metaid == 833){?>на<?} else if($metaid == 250 ||
$metaid == 254 || $metaid == 258 || $metaid == 704){?>во<?}else{?>в<?}?>
Одно из пятнадцати подобных условий в файле. Было написано в одну строку, поэтому тело условия увидели не сразу. Разнес по строкам для удобства чтения.