- 1
- 2
- 3
function GetPath(path){
return path;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+163
function GetPath(path){
return path;
}
Коротко и ясно! Единственный метод в модуле.
+160
TINY.accordion=function(){
function slider(n){this.n=n; this.a=[]}
slider.prototype.init=function(t,e,m,o,k){
var a=T$(t), i=s=0, n=a.childNodes, l=n.length; this.s=k||0; this.m=m||0;
for(i;i<l;i++){
var v=n[i];
if(v.nodeType!=3){
this.a[s]={}; this.a[s].h=h=T$$(e,v)[0]; this.a[s].c=c=T$$('div',v)[0]; h.onclick=new Function(this.n+'.pr(0,'+s+')');
if(o==s){h.className=this.s; c.style.height='auto'; c.d=1}else{c.style.height=0; c.d=-1} s++
}
}
this.l=s
};
slider.prototype.pr=function(f,d){
for(var i=0;i<this.l;i++){
var h=this.a[i].h, c=this.a[i].c, k=c.style.height; k=k=='auto'?1:parseInt(k); clearInterval(c.t);
if((k!=1&&c.d==-1)&&(f==1||i==d)){
c.style.height=''; c.m=c.offsetHeight; c.style.height=k+'px'; c.d=1; h.className=this.s; su(c,1)
}else if(k>0&&(f==-1||this.m||i==d)){
c.d=-1; h.className=''; su(c,-1)
}
}
};
function su(c){c.t=setInterval(function(){sl(c)},20)};
function sl(c){
var h=c.offsetHeight, d=c.d==1?c.m-h:h; c.style.height=h+(Math.ceil(d/5)*c.d)+'px';
c.style.opacity=h/c.m; c.style.filter='alpha(opacity='+h*100/c.m+')';
if((c.d==1&&h>=c.m)||(c.d!=1&&h==1)){if(c.d==1){c.style.height='auto'} clearInterval(c.t)}
};
return{slider:slider}
}();
http://installauto.ru/ajax/script.js
чья-то реализация аккордиона. и почему же оно хреново в ИЕ пашет?
−120
# Find out what mail program to use !! Terrible kludge !!
$mailprogram = "/usr/bin/mail";
if (! -x "$mailprogram") {
if (-x "/bin/mail") {
$mailprogram = "/bin/mail";
} else {
if (-x "/usr/sbin/sendmail") {
$mailprogram = "/usr/sbin/sendmail";
} else {
if (-x "/usr/lib/sendmail") {
$mailprogram = "/usr/lib/sendmail";
} else {
if (-x "/usr/bin/mutt") {
$mailprogram = "/usr/bin/mutt";
} else {
if (-x "/usr/sbin/exim4") {
$mailprogram = "/usr/sbin/exim4";
} else {
if (-x "/usr/bin/elm") {
$mailprogram = "/usr/bin/elm";
} else {
print "Cannot find a mail program to use\n";
}
}
}
}
}
}
}
В changelog автор честно признался, что не знал, как реализовать иначе.
−145
$ if [ "0" != "0" ]; then make i8086gui;else echo "GTK GUI is disabled - may be you lack of gtk!";fi;
GTK GUI is disabled - may be you lack of gtk!
Странная какая-то проверка наличия GTK в мєйкфайле...
+145
<?
// Функция для того, чтобы иЗ***оВаТь текст
$str = 'бросайте вы корявить текст';
function koryavka ($t){
$c = strlen($t);
for($i=0;$i<$c;$i++) {
$t[$i] = (is_int($i/2)) ? strtoupper($t[$i]) : $t[$i];
$ret[] = $t[$i];
}
return implode('',$ret);
}
echo koryavka ($str);
?>
−858
create function is_numeric (
@a varchar(100)
) returns int as begin
declare @retval int
set @a = replace(@a, '0', '')
set @a = replace(@a, '1', '')
set @a = replace(@a, '2', '')
set @a = replace(@a, '3', '')
set @a = replace(@a, '4', '')
set @a = replace(@a, '5', '')
set @a = replace(@a, '6', '')
set @a = replace(@a, '7', '')
set @a = replace(@a, '8', '')
set @a = replace(@a, '9', '')
set @a = replace(@a, '.', '')
if len(rtrim(ltrim(@a))) > 0 set @retval = 0
else set @retval = 1
return @retval
end
Вот такая хитрая скалярная функция была найдена в недрах сопровождаемой системы. Согласно ей "...42...42..." -- это число, такие дела.
+154
http://vkontakte.ru/
<noscript><meta http-equiv="refresh" content="0; URL=/badbrowser.php"></noscript>
http://vkontakte.ru/badbrowser.php
<script type="text/javascript">
<!--
//window.checkbrowser = true;
if (window.checkbrowser) {
try {
if (new XMLHttpRequest()) {
location.replace('/');
}
} catch(e) {
try {
if (new ActiveXObject('Msxml2.XMLHTTP')) {
location.replace('/');
}
} catch(e) {}
try {
if (new ActiveXObject('Microsoft.XMLHTTP')) {
location.replace('/');
}
} catch(e) {}
}
}
-->
</script>
Вот так суровые вконтактостроители отправляют на йуг пользователей NoScript.
+159
public static function encode($value, $cycleCheck = false, $options = array())
{
$encoder = new self(($cycleCheck) ? true : false, $options);
return $encoder->_encodeValue($value);
}
Zend Framework, Zend_Json_Encoder
+76
for (int j = 0; j < fieldsToRemove.size(); j++) {
if (fieldsToDelete.getField(j).getKind().equals("GroupField")) {
resFieldContr.remove(j--);
}
}
собственно цикл.
нашел в рабочем проекте
+84
http://svn.codehaus.org/groovy/trunk/groovy/groovy-core/src/main/org/codehaus/groovy/runtime/ArrayUtil.java
/*
* Copyright 2003-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.groovy.runtime;
public class ArrayUtil {
private static final Object[] EMPTY = new Object[0]
;
public static Object[] createArray() {
return EMPTY;
}
public static Object[] createArray(Object arg0) {
return new Object[]{
arg0};
}
public static Object[] createArray(Object arg0, Object arg1) {
return new Object[]{
arg0, arg1};
}
public static Object[] createArray(Object arg0, Object arg1, Object arg2) {
return new Object[]{
arg0, arg1, arg2};
}
public static Object[] createArray(Object arg0, Object arg1, Object arg2, Object arg3) {
return new Object[]{
arg0, arg1, arg2, arg3};
}
public static Object[] createArray(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4) {
return new Object[]{
arg0, arg1, arg2, arg3, arg4};
}
public static Object[] createArray(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) {
return new Object[]{
arg0, arg1, arg2, arg3, arg4, arg5};
}
public static Object[] createArray(Object arg0, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {
return new Object[]{
arg0, arg1, arg2, arg3, arg4, arg5, arg6};
}
............