- 1
http://www.microsoft.com/ru-ru/events/html5camp/
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+144
http://www.microsoft.com/ru-ru/events/html5camp/
+161
public function selectItems( $id, $withStrictment = 'no' /* $withStrictment = no, retail, discount */ ) {
if( $withStrictment == 'discount' ) $onlyWithRetailPriceSql = " and items.articul in ( select articul from items_discount ) ";
if( $withStrictment == 'retail' ) $onlyWithRetailPriceSql = " and items.articul in ( select articul from retailPrice ) ";
$a = database::select(" SELECT items.* FROM items WHERE items.id = '$id' and items.deleted = 'no' ");
$a = $a[0];
$this->data = database::select("SELECT items.*,
IF(DATEDIFF(now(),created) <= 30, 'Новинка! ', '') as fresh,
( items.quantity - coalesce(view_pendeditemsquantity.sum,0) ) as quantity,
items_comments.comment as dopDescr, items_comments.comment as comment, items_discount.priceAsUSD as discountPrice,
items_packing.packing,
concat(items.name, ' - ', items.quantity) as name
FROM items
LEFT JOIN view_pendeditemsquantity ON items.articul = view_pendeditemsquantity.articul
LEFT JOIN items_comments ON items.articul = items_comments.articul
left join items_discount on items.articul = items_discount.articul
left join items_packing on items.articul = items_packing.articul
WHERE items.group_id in ( select articul from items where is_group = '1' and name = '{$a['name']}' and group_id = '' )
and items.deleted = 'no'
$onlyWithRetailPriceSql
order by items.quantity desc, items.name asc
");
}
+186
$__language = ($__language == 'en')?'ru':'lv';
мозговынос
+147
[color=red]Обратите внимание:[/color]
http://govnokod.ru/user/4847
+147
Обратите внимание:
http://govnokod.ru/user/4847
+967
try
{
var spWave = new SoundPlayer(open.FileName);
spWave.Play();
spWave.Stop();
fileCorrect = true;
}
catch (InvalidOperationException)
{
MessageBox.Show("Файл не является верным WAV-файлом");
fileCorrect = false;
}
catch
{
MessageBox.Show("Ошибка при открытии файла");
fileCorrect = false;
}
Код мой. Писать толковый парсер не было времени.
+162
$('.tdiv').find('.cancel').parent().append('<span class="error">' + r.msg + '</span>')
чистая параноя
+177
if (preg_replace("/[\D]+/" , '', $word)) {
$word = str_replace('.','',$word);
$word = str_replace(',','',$word);
$word = str_replace(' ','',$word);
$word = str_replace('$','',$word);
$word = str_replace('*','',$word);
}
Увидев первую строчку я уж обрадовался, оказалось рано.
+165
try {
$newUserId = $users->insert($data);
} catch (Exception $e) {
if ($e->getCode() == '23000') {
$this->customRedirect(
array(
'notice',
'User already exists',
)
);
return;
} else {
throw new Exception(null, null, $e);
}
}
Быстрая проверка на уникальность.
+167
if (is_file($GLOBALS['fldr']."modules/sell/images/items/small_".str_replace("<img src=http://www.site.ru/modules/sell/images/items/small_", "", str_replace(" border=0>","",$M['icon'])))) {
echo "<a href='".$GLOBALS['fldr']."marki/models/object/current/index.php?id=".$M['id']."'>".replace_icon($M['icon'])."</a>";
}
function replace_icon($var) {
return str_replace("<img src=http://www.site.ru/modules/sell/images/items/", "<img src=".$GLOBALS['fldr']."modules/sell/images/items/?img_name=", $var);
}
Мы легких путей не ищем...