- 1
- 2
- 3
- 4
- 5
try {
renderer = new THREE.WebGLRenderer({ antialias: true, preserveDrawingBuffer: !!navigator.userAgent.match(/Trident.*rv[ :]*11\./) });
} catch (mammothFeces) {
renderer = new THREE.CanvasRenderer();
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1
try {
renderer = new THREE.WebGLRenderer({ antialias: true, preserveDrawingBuffer: !!navigator.userAgent.match(/Trident.*rv[ :]*11\./) });
} catch (mammothFeces) {
renderer = new THREE.CanvasRenderer();
}
клиент тестирует на сафари 5. а я думал, ие11 (/Trident.*rv[ :]*11\./) это худшее, что случится на проекте
+1
$RECORDS = array();
$qRecords = ' SELECT `id`, `original_name`, `urn_name` FROM `ac_brands` ORDER BY `original_name` ASC ';
$rqRecords = mysql_query($qRecords, $mysql) or die(mysql_error());
// общее количество объявлений в БД
$totalAmt = 0;
while($RECORD = mysql_fetch_assoc($rqRecords))
{
// получаем количество объявлений в БД для данного бренда
$qAmtAds = ' SELECT `count_ads` FROM `ac_brands` WHERE `id` = "'.intval($RECORD['id']).'"';
$rqAmtAds = mysql_query($qAmtAds, $mysql) or die(mysql_error());
$RECORD['amt_ads'] = mysql_fetch_object($rqAmtAds)->{"count_ads"};
$totalAmt += $RECORD['amt_ads'];
$RECORDS[] = $RECORD;
}
Что ОН, б**ть, делает? =)
Походу чувак не знает про COUNT() и GROUP BY...
+1
/**
* Метод проверяет и правит корректность символов кодировки
* @param іекштп $str Проверяемая строка
* @param string $charset Кодировка строки
* @return string
*/
public function fixCharset($str, $charset = 'utf-8'){
$return = '';
// Проверяем строку на корректность, если нет, дробим на два и проверяем первую часть,
// и т.д. проверяем первую часть от части, пока не найдём корректную или не останется 1 символ
// который отбрасываем
while(($len = strlen($str)) > 0){
while(($iconv = @iconv($charset,
(strtolower($charset) == "utf-8" ? "cp1251" : "utf-8"),
substr($str,0,$len))) === false){
if($len == 1){
break;
}
$len = ceil($len / 2);
}
if($iconv){
$return .= substr($str,0,$len);
}
$str = substr($str,$len);
}
return $return;
}
Человек знал про iconv //IGNORE и все равно такое сотворил.
+1
<div class="body">
<span method="POST" rm=""> <input type="hidden" value="sendquestion" name="action">
<div>
Задайте вопрос по интересующим Вас товарам и услугам. Оставьте, пожалуйста, контактную информацию, и наш менеджер свяжется с Вами. Мы работаем с 9:00 до 18:00.
</div>
<br>
<div class="input-field">
<input type="text" placeholder="Ваше Имя" maxlength="200" size="60" name="name" required="">
</div>
<div class="input-field">
<input type="text" placeholder="Ваш email" maxlength="100" size="60" name="email" required="">
</div>
<div class="input-field user-phone rfield" placeholder="(__) ___-__-__">
<input type="tel" name="phone-namber" class="user-phone rfield" placeholder="(__) ___-__-__">
</div>
<textarea name="question" rows="5" placeholder="Ваш вопрос"></textarea> <br>
<button class="btn_submit" type="button">
Отправить </button> </span>
</div>
Дизайнер иногда "подверстывает"...
+1
string str3 = Strings.Trim(ID);
do
{
num2 = (short) Strings.InStr(str3, " ", CompareMethod.Binary);
if (num2 > 0)
{
str3 = str3.Substring(0, num2 - 1) + Strings.Mid(str3, num2 + 1);
}
}
while (num2 > 0);
А зачем нам str3.Replace(" ", string.Empty) ?
+1
section.static > div[style="display:block; border: solid 1px #cfcfcf; padding : 10px"]{
border: none !important;
padding: 0 !important;
}
css-костыль!)
+1
function getQuarter(month) {
if (0 <= month && month <= 2) return "Q1 ";
if (3 <= month && month <= 5) return "Q2 ";
if (6 <= month && month <= 8) return "Q3 ";
return "Q4 ";
};
function getDate(lastActionDate) {
var dateString = lastActionDate.split(/\-|\s/);
var date = new Date(dateString.slice(0, 2));
var month = date.getMonth();
var year = date.getFullYear();
var quarter = getQuarter(month);
return "<span>Last Action Plan: <br> " + quarter + year + "</span>";
}
на проекте активно используется momentjs
+1
<?php
$gudir = opendir("../text/$book");
$guarray = Array();
while(false != ($gufile = readdir($gudir)))
{
if(strstr($gufile, "gu@"))
{
$guarray[count($guarray)] = $gufile;
}
}
closedir($gudir);
if(count($guarray))
{
rsort($guarray);
foreach($guarray as $gucomment)
{
/*Здесь движок отображения комментариев*/
include "../text/$book/$gucomment";
}
}
?>
Я не знаю, что делает этот код. Никаких файлов с символами gu@ в каталогах не осталось. Лет 8 назад с другом книгу писали, решили замутить сайт. Ту книгу мы потом посчитали фигней и забросили. Про БД я тогда и не подозревал. Все хранилось в таких файлах:
chapter#prae#prae#Предисловие#previous#0 #0#next#1#1
chapter#1#1#Глава 1.1#previous#prae#prae#next#1#2
chapter#1#2#Глава 1.2#previous#1#1#next#0#0
+1
$dbh = new PDO("mysql:host=$this->dbHost;dbname=$this->dbName", $this->dbUser, $this->dbPassword);
$dbh->exec("set names utf8");
$street = $streetPart.'%';
if (isset($arChooseCity[$cityIndex])) {
$condition =
"(city_az LIKE '$city'"
." OR city_az LIKE '$arChooseCity[$cityIndex]'"
." OR city_ru LIKE '$arChooseCity[$cityIndex]'"
." OR city_en LIKE '$arChooseCity[$cityIndex]'"
." OR city_ru LIKE '$city'"
." OR city_en LIKE '$city')"
." AND (geo_az LIKE '$street'"
." OR geo_ru LIKE '$street'"
." OR geo_en LIKE '$street'"
." OR geo_az LIKE '% $street'"
." OR geo_en LIKE '% $street'"
." OR geo_ru LIKE '% $street')"
;
}
else {
$condition =
"(city_az LIKE '$city'"
." OR city_ru LIKE '$city'"
." OR city_en LIKE '$city')"
." AND (geo_az LIKE '$street'"
." OR geo_ru LIKE '$street'"
." OR geo_en LIKE '$street'"
." OR geo_az LIKE '% $street'"
." OR geo_en LIKE '% $street'"
." OR geo_ru LIKE '% $street')"
;
}
$condition_type = " AND type = 'geo_object'";
$condition_street = " AND type = 'street'";
$query_street = $dbh->prepare("SELECT * from `addresses_new_new` WHERE $condition $condition_street GROUP BY street_{$lang}, city_{$lang} ORDER BY weight DESC LIMIT 0, {$maxLimit}");
$query_type = $dbh->prepare("SELECT * from `addresses_new_new` WHERE $condition $condition_type LIMIT 0, {$maxLimit}");
$query_street->execute();
$query_type->execute();
match - against никому не нужен! пользуйся только like.
+1
$(".lucky-card-divforCheck").hover(
function () {
if (document.getElementById('lucky-card-p-mail').getElementsByTagName('input')[0].value=="" &&
document.getElementById('lucky-card-p-phone').getElementsByTagName('input')[0].value==""
) {
$(document.getElementById("lucky-card-butt1")).hide();
$(document.getElementById("lucky-card-butt2")).show();
/*document.getElementById('lucky-card-err_fio').innerHTML='Не работает элс';*/
} else {
/*document.getElementById('lucky-card-err_fio').innerHTML='Работает элс';*/
};
}
,
function () {
$(document.getElementById("lucky-card-butt2")).hide();
$(document.getElementById("lucky-card-butt1")).show();
}
);
$('#lucky-card-empty-butt').click(function(){
document.getElementById('lucky-card-err_fio').innerHTML='Напишите хотя бы почту или телефон';
});
изящная валидация