- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
public static ListBox GetListBox()
{
var list = _customList as ListBox;
if (list != null)
{
return list;
}
return null;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+137
public static ListBox GetListBox()
{
var list = _customList as ListBox;
if (list != null)
{
return list;
}
return null;
}
Наверное это бояный пример говнокода, но все же я скопировал его собственными руками
+136
begin
if(TimerVremya.Enabled = True) then
begin
if(CheckBox1.Checked = False) then
begin
Bass_channelPlay(Channel, false);
Panel1.Caption := 'Playing';
TimerFraza.Enabled := False;
end
else
begin
Bass_channelPlay(Privlek, false);
Timer2.Enabled := True;
TimerFraza.Enabled := False;
end;
end;
А не ударить ли нам по басам? Вот только запашок не к месту, с чего бы такая оказия?..
+152
if (!jQuery('#email').attr('value')){
jQuery('#email').css('border', '1px solid red');
jQuery('div.errors').append('<p>Не указан "E-Mail"</p>');
error=true;
}
else{
email=jQuery('#email').attr('value');
if ((email.length<8) || (email.search(/[а-яёЁ,~><|\/*#№`!"'$:;%^&?)(_=+]/i)+1) || (email.indexOf(' ')+1) || (email.indexOf('--')+1) || (email.indexOf('-.')+1) || (email.indexOf('.-')+1) || (email.indexOf('\\')+1) || (email.indexOf('..')+1) || (email.indexOf('.')==0) || (email.indexOf('-')==0) || (email.indexOf('@')==0) || (!(email.indexOf('@')+1)) || ((email.indexOf('@')!=email.lastIndexOf('@')) && (email.lastIndexOf('@')+1)) || (email.indexOf('@')>email.lastIndexOf('.')) || (!(email.lastIndexOf('.')<(email.length-2)))){
jQuery('#email').css('border', '1px solid red');
jQuery('div.errors').append('<p>E-mail указан некорректно</p>');
error=true;
}
else jQuery('#email').attr('style', null);
}
Функция проверки Email на валидность.
Regexp для слабых.
+147
$(".rating").each(function() {
$(this).find('input').hide();
});
Самое интересное, что в блоке .rating никогда нет и не было input
+129
// Delpih 7 отказывается компилировать этот код, тогда как в Delphi 2010 он вполне успешно компилируется.
// Отчего это?
for pthread in lst do
...
>>[Error] Unit1.pas(89): Operator not applicable to this operand type
−170
public function set flip(value:Boolean):void {
if (this.object.flip != value) {
this.object.flip = value;
this.clearCells();
var cell:Cell = this.cell;
}
}
public function get cell():Cell {
if (!this._cell) {
createCell();
}
return this._cell;
}
Ненавижу подергивание.
−80
Если Найти(Строка(ТипЗнч(Ссылка)),"Документ") Тогда
Проверка, является ли переданная ссылка документом. Сегодня без авторства.
+129
public static MvcHtmlString TextWithLinks(this HtmlHelper helper, string inputStr)
{
string html = String.Empty;
Uri url;
string[] arr = inputStr.Split(' ');
for (int i = 0; i < arr.Length; i++)
{
if (i != 0)
{
html += " ";
}
if (Uri.TryCreate(arr[i],UriKind.Absolute, out url))
{
html += String.Format("<a href='{0}' target='_blank'>{0}</a>", url.AbsoluteUri);
}else
{
html += arr[i];
}
}
return new MvcHtmlString(html);
}
−85
by :: Int -> [a] -> [[a]]
by _ [] = []
by n xs = take n xs: by n (drop n xs)
words2 :: String -> (String, String)
words2 str = conc $ words str where
conc (x:xs) = (x, concat xs)
groupTemplates :: String -> [(String, String)]
groupTemplates xs = map (words2) (lines xs)
decodeOne :: String -> [(String, String)] -> String
decodeOne _ [] = ""
decodeOne str (x:xs) | str == fst x = fst x ++ " " ++ snd x ++ "\n"
decodeOne str (_:xs) = decodeOne str xs
decode :: [String] -> [(String, String)] -> String
decode bs ts = concat $ map (\b -> decodeOne b ts) bs
main = do
bits <- readFile "bits.txt"
templates <- readFile "templates.txt"
writeFile "out.txt" $ decode (by 4 bits) (groupTemplates templates)
http://www.cyberforum.ru/haskell/thread723767.html
+46
for($i=0;$i<=100;$i++)echo(!$i?$i:($i%3==0&&$i%5==0?'FizzBuzz':($i%3==0?'Fizz':($i%5==0?'Buzz':$i)))).'<br>';
FizzBuzz - мое решение.