- 1
- 2
- 3
- 4
URL = '/some/url/here'
...
...
url = '{0}'.format(URL)
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−123
URL = '/some/url/here'
...
...
url = '{0}'.format(URL)
нашел в дебрях проекта...
+144
bool X = Glob.UserIsAdmin ? true : false;
+142
function array_to_file($array_name, $array, $filename = 0, $file = 0)
{
$level = 1;
if($file == 0) {
$level = 0;
$file = fopen($filename, "w");
if(!$file) {
return false;
}
fwrite($file, "<" . "?\n\$".$array_name." = ");
}
$cnt = count($array);
$i = 0;
fwrite($file, "\narray(\n");
foreach($array as $key => $value)
{
if($i++ != 0) {
fwrite($file, ",\n");
}
if(is_array($array[$key])) {
fwrite($file, "\"".$key."\" => ");
array_to_file($array_name, $array[$key], 0, $file);
} else {
$value = addcslashes($value, "\""."\\\\");
fwrite($file, str_repeat(" ", ($level + 1) * 2) . "\"".$key."\" => \"".$value."\"");
}
}
fwrite($file, ")");
if($level == 0) {
fwrite($file, ";\n?".">");
fclose($file);
return true;
}
}
−105
Функция КонтрИскл8(код)
КонтрИскл8=Справочники.Контрагенты.НайтиПоКоду(Код).Ссылка.ДополнительныеРеквизиты.Найти(ПланыВидовХарактеристик.ДополнительныеРеквизитыИСведения.НайтиПоНаименованию("Код_").Ссылка).Значение;
Искл8=КонтрИскл8;
Возврат Искл8;
КонецФункции
Укоадено с mista.ru. Не мог не поделиться. Когда впервые увидел, мой взгляд был примерно таким - 0_0
−160
n IN (6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25)
условие n >= 6 выполнено
+142
/* Background gallery by http://manos.malihu.gr */
//config
//set default images view mode
//$defaultViewMode="full"; //full, normal, original
$defaultViewMode="original"; //full, normal, original
$tsMargin=0; //first and last thumbnail margin (for better cursor interaction)
$scrollEasing=999888; //scroll easing amount (0 for no easing)
$scrollEasingType="easeOutCirc"; //scroll easing type
$thumbnailsContainerOpacity=0.9; //thumbnails area default opacity
$thumbnailsContainerMouseOutOpacity=0; //thumbnails area opacity on mouse out
$thumbnailsOpacity=1; //thumbnails default opacity
$nextPrevBtnsInitState="show"; //next/previous image buttons initial state ("hide" or "show")
$keyboardNavigation="on"; //enable/disable keyboard navigation ("on" or "off")
//cache vars
$thumbnails_wrapper=$("#thumbnails_wrapper");
$outer_container=$("#outer_container");
$thumbScroller=$(".thumbScroller");
$thumbScroller_container=$(".thumbScroller .container");
$thumbScroller_content=$(".thumbScroller .content");
$thumbScroller_thumb=$(".thumbScroller .thumb");
$preloader=$("#preloader");
$toolbar=$("#toolbar");
$toolbar_a=$("#toolbar a");
$bgimg=$("#bgimg");
$img_title=$("#img_title");
$nextImageBtn=$(".nextImageBtn");
$prevImageBtn=$(".prevImageBtn");
$bg=$("#bg");
$(window).load(function() {
$toolbar.data("imageViewMode",$defaultViewMode); //default view mode
if($defaultViewMode=="full"){
$toolbar_a.html("<img src='images/toolbar_n_icon.png' width='50' height='50' />").attr("onClick", "ImageViewMode('normal');return false").attr("title", "Restore");
} else {
$toolbar_a.html("<img src='images/toolbar_fs_icon.png' width='50' height='50' />").attr("onClick", "ImageViewMode('full');return false").attr("title", "Maximize");
}
/* var winWidth=$(window).width();
var winHeight=$(window).height();
$("#bg").attr("min-height",winHeight+"px"); */
ShowHideNextPrev($nextPrevBtnsInitState);
//thumbnail scroller
$thumbScroller_container.css("marginLeft",$tsMargin+"px"); //add margin
sliderLeft=$thumbScroller_container.position().left;
sliderLeft=0;
sliderWidth=$outer_container.width();
$thumbScroller.css("width",sliderWidth);
var totalContent=0;
fadeSpeed=200;
var $the_outer_container=document.getElementById("outer_container");
var $placement=findPos($the_outer_container);
$thumbScroller_content.each(function () {
var $this=$(this);
totalContent+=$this.innerWidth();
$thumbScroller_container.css("width",totalContent);
$this.children().children().children(".thumb").fadeTo(fadeSpeed, $thumbnailsOpacity);
});
$thumbScroller.mousemove(function(e){
if($thumbScroller_container.width()>sliderWidth){
var mouseCoords=(e.pageX - $placement[1]);
var mousePercentX=mouseCoords/sliderWidth;
var destX=-((((totalContent+($tsMargin*2))-(sliderWidth))-sliderWidth)*(mousePercentX));
var thePosA=mouseCoords-destX;
var thePosB=destX-mouseCoords;
if(mouseCoords>destX){
$thumbScroller_container.stop().animate({left: -thePosA}, $scrollEasing,$scrollEasingType); //with easing
} else if(mouseCoords<destX){
$thumbScroller_container.stop().animate({left: thePosB}, $scrollEasing,$scrollEasingType); //with easing
} else {
$thumbScroller_container.stop();
}
}
});
$thumbnails_wrapper.fadeTo(fadeSpeed, $thumbnailsContainerOpacity);
/* $thumbnails_wrapper.hover(
function(){ //mouse over
var $this=$(this);
$this.stop().fadeTo("slow", 1);
},
function(){ //mouse out
var $this=$(this);
$this.stop().fadeTo("slow", $thumbnailsContainerMouseOutOpacity);
}
); */
$thumbScroller_thumb.hover(
function(){ //mouse over
var $this=$(this);
$this.stop().fadeTo(fadeSpeed, 1);
},
function(){ //mouse out
var $this=$(this);
$this.stop().fadeTo(fadeSpeed, $thumbnailsOpacity);
}
);
carousel
+142
private int[] ListToArray(List<int> list)
{
try
{
int[] res = new int[list.Count];
for (int i = 0; i < list.Count; i++)
{
res[i] = list[i];
}
return res;
}
catch (Exception) { return new int[0]; }
}
А ещё он заполняет List<> в цикле for
+141
foo() ->
Du = os:cmd("du -b "++?PM_LOGS_PATH),
[DiscSize|_] = string:tokens(Du, "\t"),
case list_to_integer(DiscSize) > 10000000000 of
...
Вся мощь эрланга. В строке может быть не только число? Let it crash!
−84
BEGIN
select count(*) INTO var FROM table_name;
EXCEPTION WHEN OTHERS THEN
var:=0;
END;
Если что-то пойдет не так...
P.S.: count() всегда возвращает какое-либо значение. Ошибке не откуда взяться.
−176
and (ss_1<>'SS0001' or ss_1<>'SS0002' or ss_1<>'SS0010')
Сегодня на продакшене было обнаружено гениальное выражение в одном из запросов.