- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
class store_mod_multi_ftp extends store_mod_ftp {
public function __construct($options) {
//...
}
protected function connect($url, $login) {
parent::__construct($url, $login);
}
//...
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+156
class store_mod_multi_ftp extends store_mod_ftp {
public function __construct($options) {
//...
}
protected function connect($url, $login) {
parent::__construct($url, $login);
}
//...
}
ФТП-мод, который умеет стягивать файлы с разных серверов сразу, в отличие от своего родителя. И ведь работает, зараза!
+156
$phone = str_replace("с",",",$phone);
$phone = str_replace("до","",$phone);
$phone = str_replace("д",",",$phone);
$phone = str_replace("раб","",$phone);
$phone = str_replace("м.","",$phone);
$phone = str_replace("т","",$phone);
$phone = str_replace("и",",",$phone);
−144
СуммаРЗ = СуммаРЗ;
Капитан, это вы?
+199
_bc_do_compare: function (n1, n2, use_sign, ignore_last) {
var n1ptr, n2ptr; // int
var count; // int
/* First, compare signs. */
if (use_sign && (n1.n_sign != n2.n_sign)) {
if (n1.n_sign == libbcmath.PLUS) {
return (1); /* Positive N1 > Negative N2 */
} else {
return (-1); /* Negative N1 < Positive N1 */
}
}
/* Now compare the magnitude. */
if (n1.n_len != n2.n_len) {
if (n1.n_len > n2.n_len) { /* Magnitude of n1 > n2. */
if (!use_sign || (n1.n_sign == libbcmath.PLUS)) {
return (1);
} else {
return (-1);
}
} else { /* Magnitude of n1 < n2. */
if (!use_sign || (n1.n_sign == libbcmath.PLUS)) {
return (-1);
} else {
return (1);
}
}
}
if (count !== 0) {
if (n1.n_value[n1ptr] > n2.n_value[n2ptr]) { /* Magnitude of n1 > n2. */
if (!use_sign || n1.n_sign == libbcmath.PLUS) {
return (1);
} else {
return (-1);
}
} else { /* Magnitude of n1 < n2. */
if (!use_sign || n1.n_sign == libbcmath.PLUS) {
return (-1);
} else {
return (1);
}
}
}
/* They are equal up to the last part of the equal part of the fraction. */
if (n1.n_scale != n2.n_scale) {
if (n1.n_scale > n2.n_scale) {
for (count = (n1.n_scale - n2.n_scale); count > 0; count--) {
if (n1.n_value[n1ptr++] !== 0) { /* Magnitude of n1 > n2. */
if (!use_sign || n1.n_sign == libbcmath.PLUS) {
return (1);
} else {
return (-1);
}
}
}
} else {
for (count = (n2.n_scale - n1.n_scale); count > 0; count--) {
if (n2.n_value[n2ptr++] !== 0) { /* Magnitude of n1 < n2. */
if (!use_sign || n1.n_sign == libbcmath.PLUS) {
return (-1);
} else {
return (1);
}
}
}
}
}
Свежий подход к написанию бульщитов от создателей phpjs.
+200
for (k = 0; k < xl; k += 16) {
AA = a;
BB = b;
CC = c;
DD = d;
a = _FF(a, b, c, d, x[k + 0], S11, 0xD76AA478);
d = _FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756);
c = _FF(c, d, a, b, x[k + 2], S13, 0x242070DB);
b = _FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE);
a = _FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF);
d = _FF(d, a, b, c, x[k + 5], S12, 0x4787C62A);
c = _FF(c, d, a, b, x[k + 6], S13, 0xA8304613);
b = _FF(b, c, d, a, x[k + 7], S14, 0xFD469501);
a = _FF(a, b, c, d, x[k + 8], S11, 0x698098D8);
d = _FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF);
c = _FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1);
b = _FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE);
a = _FF(a, b, c, d, x[k + 12], S11, 0x6B901122);
d = _FF(d, a, b, c, x[k + 13], S12, 0xFD987193);
c = _FF(c, d, a, b, x[k + 14], S13, 0xA679438E);
b = _FF(b, c, d, a, x[k + 15], S14, 0x49B40821);
a = _GG(a, b, c, d, x[k + 1], S21, 0xF61E2562);
d = _GG(d, a, b, c, x[k + 6], S22, 0xC040B340);
c = _GG(c, d, a, b, x[k + 11], S23, 0x265E5A51);
b = _GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA);
a = _GG(a, b, c, d, x[k + 5], S21, 0xD62F105D);
d = _GG(d, a, b, c, x[k + 10], S22, 0x2441453);
c = _GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681);
<40 строк поспипано>
b = _II(b, c, d, a, x[k + 9], S44, 0xEB86D391);
a = addUnsigned(a, AA);
b = addUnsigned(b, BB);
c = addUnsigned(c, CC);
d = addUnsigned(d, DD);
}
http://phpjs.org/downloads/phpjs.commonjs.js.
Там оказалось реально много жира. Я сначала подумал, что сеть Фейштеля, но потом-таки разглядел MD5.
Говносути это конечно не меняет.
+153
$('#panAll').click( function(){
$(this).addClass('panactive');
$('#panPan').removeClass('panactive');
$('#pan3D').removeClass('panactive');
$('#panVtour').removeClass('panactive');
$('#AllDesc').css('display', 'block');
$('#PanDesc').css('display', 'none');
$('#3DDesc').css('display', 'none');
$('#VtourDesc').css('display', 'none');
});
$('#panPan').click( function(){
$(this).addClass('panactive');
$('#panAll').removeClass('panactive');
$('#pan3D').removeClass('panactive');
$('#panVtour').removeClass('panactive');
$('#AllDesc').css('display', 'none');
$('#PanDesc').css('display', 'block');
$('#3DDesc').css('display', 'none');
$('#VtourDesc').css('display', 'none');
});
$('#pan3D').click( function(){
$(this).addClass('panactive');
$('#panAll').removeClass('panactive');
$('#panPan').removeClass('panactive');
$('#panVtour').removeClass('panactive');
$('#AllDesc').css('display', 'none');
$('#PanDesc').css('display', 'none');
$('#3DDesc').css('display', 'block');
$('#VtourDesc').css('display', 'none');
});
$('#panVtour').click( function(){
$(this).addClass('panactive');
$('#panAll').removeClass('panactive');
$('#panPan').removeClass('panactive');
$('#pan3D').removeClass('panactive');
$('#AllDesc').css('display', 'none');
$('#PanDesc').css('display', 'none');
$('#3DDesc').css('display', 'none');
$('#VtourDesc').css('display', 'block');
});
Висит задание в црм - доделать ***.
Таким вот образом был реализован функционал
переключения между 4мя дивами, содержащими в себе данные.
+209
const evalScript = "with (__win__.__scope__.vars) { with (__win__.__scope__.api) { with (__win__.__scope__.userVars) { with (__win__) {" +
"try {" +
"__win__.__scope__.callback(eval(__win__.__scope__.expr));" +
"} catch (exc) {" +
"__win__.__scope__.callback(exc, true);" +
"}" +
"}}}}";
http://code.google.com/p/fbug/source/browse/branches/firebug1.2/content/firebug/commandLine.js?r=444
+142
Zend_Validate::is('20120225 21:57:44', 'Date', array('Ymd H:i:s') // return false
Zend_Validate::is('20120225', 'Date', array('Ymd') // return true
Zend_Validate::is('21:57:44', 'Date', array('H:i:s') // return true
Как сделать, что бы первая строка возвращала true?
+157
<?php
function getRusMonth($month)
{
if($month > 12 || $month < 1) return FALSE;
$aMonth = array('январь',
'февраль',
'март',
'апрель',
'май',
'июнь',
'июль',
'август',
'сентябрь',
'октябрь',
'ноябрь',
'декабрь');
return $aMonth[$month - 1];
}
function gen_months_list()
{
global $monthnum;
$year = date("Y");
for($month = 1; $month <= 12; $month++)
{
if($month <= 9)
{
if("0".$month == $monthnum) $mn_active = " class=\"active\"";
$month_list .= "<li><a href=\"/".$year."/0".$month."/\"".$mn_active.">".getRusMonth($month)."</a></li>\n";
}
else
{
if($month == $monthnum) $mn_active = " class=\"active\"";
$month_list .= "<li><a href=\"/".$year."/".$month."/\"".$mn_active.">".getRusMonth($month)."</a></li>\n";
}
$mn_active = "";
}
return $month_list;
}
?>
V 2.0
+155
$pathToAction = str_replace("\\", "/", $pathToAction);
while (substr($pathToAction, strlen($pathToAction) - 1, 1) == "/")
$pathToAction = substr($pathToAction, 0, strlen($pathToAction) - 1);