- 1
- 2
- 3
- 4
- 5
- 6
- 7
/// <summary>
/// I hate you guys.
/// You guys are assholes.
/// Especially author of this class.
/// I hate him the most.
/// </summary>
public partial class ProfileEditor
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+122
/// <summary>
/// I hate you guys.
/// You guys are assholes.
/// Especially author of this class.
/// I hate him the most.
/// </summary>
public partial class ProfileEditor
+164
void Attr::setConvertedValue(std::string pValue)
{
/* ............. - BEGIN - Place the HTML code instead of the */
/* plain values. This is needed since special XML characters */
/* might exist. */
for(int i = 0; i < pValue.length(); i++)
{
int ascii = (int)pValue[i];
if(!( (ascii == 32 ) ||
(ascii >= 48 && ascii <= 57) ||
(ascii >= 65 && ascii <= 90) ||
(ascii >= 97 && ascii <= 122) ) )
{
if( ascii < 0 )
ascii += 256;
std::ostringstream stream;
stream << ascii;
std::string newString = stream.str();
newString = "&#" + newString + ';';
pValue.replace(i, 1, newString);
i += newString.length() - 1;
}
}
/* ............. - END - Place the HTML code instead of the */
/* plain values. This is needed since special XML characters */
/* might exist. */
mConvertedValue = pValue;
}
я стою на асфальте, ноги в лыжы абуты.
мы эскайпим значения для ХМЛ.
вы тут посмейтесь, а я пошел головой об стенку стучатся.
ЗЫ пысано в Бразилии.
+153
function ini_size_to_bytes($value)
{
$value = trim($value);
$retval = intval($value);
switch(strtolower($value[strlen($value) - 1]))
{
case 'g':
$retval *= 1024;
/* break missing intentionally */
case 'm':
$retval *= 1024;
/* break missing intentionally */
case 'k':
$retval *= 1024;
break;
}
return $retval;
}
vBulletin 4.0.3 (лицензионка, есть согласие на публикацию)
+159
for (i = 1; i < <?php echo count($prog[1])?>; i++){
if (document.getElementById('module'+i).checked)
module_tmp= Math.abs($('#module'+i).val())+module_tmp;
−85
private function createPanel(isPlay:String):void
{
if(NativeApplication.supportsSystemTrayIcon){
iconMenu.removeAllItems();
if(isPlay!='play')
{
var playCommand:NativeMenuItem = iconMenu.addItem(new NativeMenuItem("Воспроизвести"));
playCommand.addEventListener(Event.SELECT, playHandler);
}
if(isPlay=='play')
{
var pauseCommand:NativeMenuItem = iconMenu.addItem(new NativeMenuItem("Пауза"));
pauseCommand.addEventListener(Event.SELECT, pauseHandler);
}
if(isPlay!='stop'){
var stopCommand:NativeMenuItem = iconMenu.addItem(new NativeMenuItem("Стоп"));
stopCommand.addEventListener(Event.SELECT, stopHandler);
}
/*----Volume------*/
var vulumeNativeMenu:NativeMenu = new NativeMenu();
var volumeSubMenu:NativeMenuItem = iconMenu.addSubmenu(vulumeNativeMenu,'Громкость');
var volume100:NativeMenuItem = vulumeNativeMenu.addItem(new NativeMenuItem("100%"));
volume100.addEventListener(Event.SELECT, volume100Handler);
var volume75:NativeMenuItem = vulumeNativeMenu.addItem(new NativeMenuItem("75%"));
volume75.addEventListener(Event.SELECT, volume75Handler);
var volume50:NativeMenuItem = vulumeNativeMenu.addItem(new NativeMenuItem("50%"));
volume50.addEventListener(Event.SELECT, volume50Handler);
var volume25:NativeMenuItem = vulumeNativeMenu.addItem(new NativeMenuItem("25%"));
volume25.addEventListener(Event.SELECT, volume25Handler);
/*----End Volume------*/
var exitCommand:NativeMenuItem = iconMenu.addItem(new NativeMenuItem("Выход"));
exitCommand.addEventListener(Event.SELECT, exinHandler);
}
}
Немного моего айро-высера... Думать было ой как в лом =)
+160
<?php
include '/system/config_bd.php'; // соединение с базой
class pagination_start {
public $page;
public $CountListPage=10;
public $sql="SELECT * FROM `news`";
public $start;
public $limit;
public $ires;
public function page_settings() {
$this->page_get();
$this->start=($this->page-1)*$this->CountListPage;
$this->limit=" LIMIT $this->start,$this->CountListPage";
$this->ires=mysql_query($this->sql.$this->limit);
}
public function page_get() {
if(empty($_GET['page'])){$this->page=1;}
else {$this->page=$_GET['page'];}
}
}
class pagination_end extends pagination_start{
public $link_interval;
public $i;
public $sp;
public function pagination($class_all,$class_once) {
$link_page = '';
$this->page_get();
$count=mysql_num_rows(mysql_query($this->sql));
if($count>$this->CountListPage){
$CountList=ceil($count/$this->CountListPage);
if($this->page > 3 && $CountList > 5){echo '<span class="'.$class_all.'"><a href="?page=1'.$this->link_interval.'">1</a></span><span class="'.$class_all.'">...</span>';}
if($this->page > 3 && $CountList > 5){$this->sp=$this->page-2;}else{$this->sp=1;}
if($this->page > $CountList-3 && $CountList > 5){$this->sp=$CountList-4; }
if($CountList>5)$cpc=5;else $cpc=$CountList;
for($this->i=$this->sp;$this->i<$this->sp+$cpc;$this->i++){
if($this->i == $this->page){ printf ('<span class="'.$class_once.'">%s</span>',$this->i); }
else{ $suit=$this->link_interval.$this->i;
$links_cent = '<span class="'.$class_all.'"><a href="?page='.$suit.'">'.$this->i.'</a></span>';
echo $links_cent; } }
$suit=$this->link_interval."?page=".$CountList."";
if($this->page<=$CountList-3 and $CountList>5){echo '<span class="'.$class_all.'">...</span> <span class="'.$class_all.'"><a href="'.$suit.'">'.$CountList.'</a></span> ';} }
}
}
$CountListPage = 5; // Сколько объектов отображать на странице # по умолчанию 10
$sql="SELECT * FROM `news` "; // SQL запрос # по умолчанию "SELECT * FROM `news`"
$class_all='page_all'; // Css класс всех страниц кроме текущей
$class_once='class_once'; // Css класс всех страниц кроме текущей
/* Формирование страниц и sql запрос */
$pagination = new pagination_start();
$pagination->CountListPage = $CountListPage;
$pagination->sql = $sql;
$pagination->page_settings();
while($ires_result=mysql_fetch_array($pagination->ires))
{
echo $ires_result['id']."<br/>";
}
/* Пагенирование */
$pagination_end = new pagination_end();
$pagination_end->CountListPage = $CountListPage;
$pagination_end->sql = $sql;
$pagination_end->pagination($class_all,$class_once); // От css клас от 2 страници до предпоследней
−314
#pragma mark -
#pragma mark Table view delegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 3 && indexPath.row == 0) {
CGSize fitSize = [[item objectForKey:@"note"]
sizeWithFont:[UIFont boldSystemFontOfSize:18]
constrainedToSize:CGSizeMake([UIScreen mainScreen].bounds.size.width - 50, MAXFLOAT)
lineBreakMode:UILineBreakModeWordWrap];
return fitSize.height;
}
return [self.tableView rowHeight];
}
Я тут на Objective C говнокодить стал, вот моя почти первая аппса
http://itunes.apple.com/ru/app/qx9pro/id408832020?mt=8
+37
error_log('json_upload(): called');
error_log('json_upload(): dump $_POST');
foreach(explode("\n", var_export($_POST, TRUE) ) as $val) error_log('advupload_json_upload() dump: ' . $val);
error_log('json_upload(): dump $_GET');
foreach(explode("\n", var_export($_GET, TRUE) ) as $val) error_log('advupload_json_upload() dump: ' . $val);
отладка аццкого json вызова который вызываецо с клиента для загрузке файла покускам.
думать было лень. наговнякал :)
потом tail -f /var/log/apache2/errors.log в консоли и фпирет
+104
public class BuildActivity
{
private class RequestLimit : ICloneable
{
//несколько свойств
}
private class Request : IDisposable
{
// оберка вокруг stream
}
private class Response
{
// несколько методов
}
private class Document
{
// 4 простых свойства
}
//примерно с десяток методов
}
еще один пример навороченных структур на ровном месте. В достаточно простом классе имеем 4 (sic!) private вложенных класса - которые ниоткуда никем больше не используются. Все потому что человек не умел дизайнить классы так что бы не приходилось временные данные передавать из одной процедуры в другую. Страшно представить что он будет писать когда узнает про Tupels :)
+160
/*
...
*/
/* Add some salt */
$sold = $settings['users']['password_salt'];
$password = $sold.$password;
/* 1. MD5 */
$password = md5($password);
/* 2. SHA1 */
$password = sha1($password);
/* 4. Base64 */
$password = base64_encode($password);
/* 5. Fatality! */
$password = sha1($password);
/* Well done! */
return $password;
Мощно