- 1
- 2
- 3
- 4
Астрологи объявили неделю постов с хабра.
Взоржал.
http://habrahabr.ru/company/edison/blog/271621/
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
Астрологи объявили неделю постов с хабра.
Взоржал.
http://habrahabr.ru/company/edison/blog/271621/
+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) ?
+2
$d = getdate();
$formatMon = '';
if ($d['mon'] < 10) {
$formatMon = '0';
}
$formatMday = '';
if ($d['mday'] < 10) {
$formatMday = '0';
}
$formatHour = '';
if ($d['hours'] < 10) {
$formatHour = '0';
}
$formatMinutes = '';
if ($d['minutes'] < 10) {
$formatMinutes = '0';
}
$formatSeconds = '';
if ($d['seconds'] < 10) {
$formatSeconds = '0';
}
$today = $formatMday . $d['mday'] . '.' . $formatMon . $d['mon'] . '.' . $d['year'] . ' ' . $formatHour . $d['hours'] . ':' . $formatMinutes . $d['minutes'] . ':' . $formatSeconds . $d['seconds'];
Форматирование датывремени
+4
function checkRus($str)
{
$result = true;
$eng = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');
for ($i = 0; $i < strlen($str); $i++) {
if (in_array($str[$i], $eng)) {
$result = false;
break;
}
}
return $result;
}
Проверка на "русскость" строки
+2
bool isLiveLine = false;
bool isQALine = false;
if (lineInfo.IndexOf("QL") != -1)
{
isLiveLine = true;
isQALine = true;
}
else if (lineInfo.IndexOf("Q") != -1)
{
isLiveLine = false;
isQALine = true;
}
else if (lineInfo.IndexOf("L") != -1)
{
isLiveLine = true;
isQALine = false;
}
else
{
isLiveLine = false;
isQALine = false;
}
−1
"WCT" или "ебанутым нет покоя" - уже на главной Швабра!
http://habrahabr.ru/post/271519/
+1
section.static > div[style="display:block; border: solid 1px #cfcfcf; padding : 10px"]{
border: none !important;
padding: 0 !important;
}
css-костыль!)
+2
<ul class="top-level-menu">
<li style="width:14.185714285714%;" class="with-img" id="m_2641231722"> <span class="top-level-label"><a href="/catalog/plitnye_materialy_1/" title="Плитные материалы">Плитные материалы</a></span>
</li>
<li style="width:14.185714285714%;" class="with-img" id="m_1862201143"> <span class="top-level-label"><a href="/catalog/mebelnaya_furnitura_1/" title="Мебельная фурнитура">Мебельная фурнитура</a></span>
</li>
<li style="width:14.185714285714%;" class="with-img" id="m_2776938111"> <span class="top-level-label"><a href="/catalog/kromka_i_plastiki_1/" title="Кромка и пластики">Кромка и пластики</a></span>
</li>
<li style="width:14.185714285714%;" class="with-img" id="m_2757459272"> <span class="top-level-label"><a href="/catalog/stoleshnitsy_stenpaneli_1/" title="Столешницы, стенпанели">Столешницы, стенпанели</a></span>
</li>
<li style="width:14.185714285714%;" class="with-img" id="m_3136652235"> <span class="top-level-label"><a href="/catalog/razdvizhnye_sistemy_1/" title="Раздвижные системы">Раздвижные системы</a></span>
</li>
<li style="width:14.185714285714%;" class="with-img" id="m_3746925619"> <span class="top-level-label"><a href="/catalog/fasadnoe_napolnenie_1/" title="Фасадное наполнение">Фасадное наполнение</a></span>
</li>
<li style="width:14.185714285714%;" class="with-img" id="m_133346203"> <span class="top-level-label"><a href="/catalog/uslugi_1/" title="Услуги">Услуги</a></span>
</li>
</ul>
0
<section class="static"> <!--Первый-->
<style>
.simple-rotator-container-2 a.rot-partner-100127 {
background-image: url(/upload/iblock/129/petli.jpg);
background-position: center top;
}
.simple-rotator-container-2 a.rot-partner-100127:hover
{
background-image: url(/upload/iblock/129/petli.jpg);
background-position: center bottom;
}
.simple-rotator-container-2 a.rot-partner-100136 {
background-image: url(/upload/iblock/755/zamki.jpg);
background-position: center top;
}
.simple-rotator-container-2 a.rot-partner-100136:hover
{
background-image: url(/upload/iblock/755/zamki.jpg);
background-position: center bottom;
}
.simple-rotator-container-2 a.rot-partner-100137 {
background-image: url(/upload/iblock/dff/napravlyalki.jpg);
background-position: center top;
}
.simple-rotator-container-2 a.rot-partner-100137:hover
{
background-image: url(/upload/iblock/dff/napravlyalki.jpg);
background-position: center bottom;
}
.simple-rotator-container-2 a.rot-partner-100138 {
background-image: url(/upload/iblock/8a2/metiznaya.jpg);
background-position: center top;
}
.simple-rotator-container-2 a.rot-partner-100138:hover
{
background-image: url(/upload/iblock/8a2/metiznaya.jpg);
background-position: center bottom;
}
.simple-rotator-container-2 a.rot-partner-100139 {
background-image: url(/upload/iblock/6e9/kukhonne-_2_.jpg);
background-position: center top;
}
.simple-rotator-container-2 a.rot-partner-100139:hover
{
background-image: url(/upload/iblock/6e9/kukhonne-_2_.jpg);
background-position: center bottom;
}
.simple-rotator-container-2 a.rot-partner-100140 {
background-image: url(/upload/iblock/cb2/p_dyom.jpg);
background-position: center top;
}
.simple-rotator-container-2 a.rot-partner-100140:hover
{
background-image: url(/upload/iblock/cb2/p_dyom.jpg);
background-position: center bottom;
}
.simple-rotator-container-2 a.rot-partner-100141 {
background-image: url(/upload/iblock/e5a/catalogue_302kh302.jpg);
background-position: center top;
}
.simple-rotator-container-2 a.rot-partner-100141:hover
{
background-image: url(/upload/iblock/e5a/catalogue_302kh302.jpg);
background-position: center bottom;
}
</style>
<section class="static"> <!-- И после всего этого одного следующий секшин статик, прям внутри!-->
<!--Дальше отжигают контентщики-->
<p style="text-align: justify;"><img style="width: 1280px; height: 302px; " src="/upload/iblock/b72/muller.jpg" alt="Muller"></p>
<p style="text-align: center;"></p>
<div class="cube">
<div class="round_holder">
<a href="/catalog/petli_i_aksessuary_1/?arrFilter_49_4012090960=Y&set_filter=">
<img style="width: 302px; height: 302px; float: left;" src="/upload/iblock/129/petli.jpg" alt="Muller">
<p><ong><span style="color:#000;">Петли и аксессуары</span></ong></p>
</a>
</div>
<div class="round_holder">
<a href="/catalog/zamki_magnity_2/?arrFilter_49_4012090960=Y&set_filter=">
<img style="width: 302px; height: 302px; float: left;" src="/upload/iblock/755/zamki.jpg" alt="Muller">
<p><ong><span style="color:#000;">Замки</span></ong></p>
</a>
</div>
...
+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