- 1
select 7-(8-datepart(weekday,getDate())) % 7
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−108
select 7-(8-datepart(weekday,getDate())) % 7
Написал для конвертации дней недели начинающихся с SUNDAY=1, в привычные Пн-1, Вс-7
+147
<xsl:text disable-output-escaping="yes"><![CDATA[ ]]></xsl:text>
Такое ещё надо придумать
+120
/// <summary>
/// Calculates and returns a hashcode based on this user's
/// MarketName and default units. The hashcode should be
/// unique for each different combination of MarketName and
/// units.
/// </summary>
/// <returns>An int that may be positive or negative.</returns>
public override int GetHashCode()
{
// A function like this raises innumerable questions. Why did they over ride the
// hash code function? Why did they use an attribute that is not certain to be unique?
// why did they not use the one that is going to be unique? Why did they not cvheck to
// see if the thing they were hasing was not null? When did my life go so far off the rails
// that I have to deal with code like this? How many places call this code? Why did they not
// include any meaningful comments? Why does it suddenly start breaking after the 3.5 upgrade?
// in an effort to avoid thinking about those questions, I've justy changed the has to use the
// unique user id instead of the retarded defaultuserunits hash.
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(this.MarketName);
if (this.DefaultUserUnits != null)
{
sb.Append(Utility.StringUtility.GetJSObjectLiteral(this.DefaultUserUnits));
}
else
{
sb.Append(Utility.StringUtility.GetJSObjectLiteral(this.ID));
}
return sb.ToString().GetHashCode();
}
+124
_videoNum = (byte) (videoNum==0?videoNum:0);
попалось сегодня в исходниках рабочего проекта
+161
<html>
<head>
<script language="JavaScript">
<!-- hide
function check(input) {
var ok = true;
for (var i = 0; i < input.length; i++) {
var chr = input.charAt(i);
var found = false;
for (var j = 1; j < check.length; j++) {
if (chr == check[j]) found = true;
}
if (!found) ok = false;
}
return ok;
}
function test(input) {
if (!check(input, "1", "2", "3", "4",
"5", "6", "7", "8", "9", "0", "/", "-", " ")) {
alert("Input not ok.");
}
else {
alert("Input ok!");
}
}
// -->
</script>
</head>
<body>
<form>
Telephone:
<input type="text" name="telephone" value=>
<input type="button" value="Check"
onClick="test(this.form.telephone.value)">
</form>
</body>
</html>
http://www.webmasterwiki.ru/JavaScript/Formy
+146
<?php
$myKey = array('а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','п','р','с','т','о','у','ф','х','ц','ч','ш','щ','ь','ъ','э','ю','я','1','2','3','4','5','6','7','8','9','0');
$myRand = rand(0, count($myKey));
$key = $myKey[$myRand];
echo $key;
?>
+152
$paymentUser = new Zend_Form_Element_Hidden('user_id');
$paymentUser->setValue('000');
ZF инициализация скрытого поля под хранение ид пользователя.
+158
$(document).ready(function() {
var pan_button = $('#pan_uploadButton'), interval;
var celo_button = $('#celo_uploadButton'), interval;
var face_button = $('#face_uploadButton'), interval;
var l_prof_button = $('#l_prof_uploadButton'), interval;
var r_prof_button = $('#r_prof_uploadButton'), interval;
var upper_button = $('#upper_uploadButton'), interval;
var lower_button = $('#lower_uploadButton'), interval;
var add1_button = $('#add1_uploadButton'), interval;
var add2_button = $('#add2_uploadButton'), interval;
var add3_button = $('#add3_uploadButton'), interval;
var add4_button = $('#add4_uploadButton'), interval;
var order = $('#ord').val();
$.ajax_upload(pan_button, order, 1, {
action : 'stars_orders/uploadAjx/',
name : 'userfile',
onSubmit : function(file, ext) {
//$("#uploadButton font").text('Загрузка');
/*
* Выключаем кнопку на время загрузки файла
*/
this.disable();
},
onComplete : function(file, response) {
//$("#uploadButton font").text('Загрузить');
var path = "templates/star_smile/images/"+response;
var htmls = '<img width="187" height="124" src="'+path+'" />';
$("#pan_img").html(htmls);
$(".pan_loading").html('Изменить');
$(".pan_deleting").html('Удалить');
// снова включаем кнопку
this.enable();
// показываем что файл загружен
//$("<li>" + file + "</li>").appendTo("#files");
}
});
$.ajax_upload(celo_button, order, 2, {
action : 'stars_orders/uploadAjx/',
name : 'userfile',
onSubmit : function(file, ext) {
//$("#uploadButton font").text('Загрузка');
/*
* Выключаем кнопку на время загрузки файла
*/
this.disable();
},
onComplete : function(file, response) {
//$("#uploadButton font").text('Загрузить');
var path = "templates/star_smile/images/"+response;
var htmls = '<img width="187" height="124" src="'+path+'" />';
$("#celo_img").html(htmls);
$(".celo_loading").html('Изменить');
$(".celo_deleting").html('Удалить');
// снова включаем кнопку
this.enable();
// показываем что файл загружен
//$("<li>" + file + "</li>").appendTo("#files");
}
});
$.ajax_upload(face_button, order, 3, {
action : 'stars_orders/uploadAjx/',
name : 'userfile',
onSubmit : function(file, ext) {
//$("#uploadButton font").text('Загрузка');
/*
* Выключаем кнопку на время загрузки файла
*/
this.disable();
},
onComplete : function(file, response) {
//$("#uploadButton font").text('Загрузить');
var path = "templates/star_smile/images/"+response;
var htmls = '<img width="187" height="124" src="'+path+'" />';
$("#face_img").html(htmls);
$(".face_loading").html('Изменить');
$(".face_deleting").html('Удалить');
// снова включаем кнопку
this.enable();
// показываем что файл загружен
//$("<li>" + file + "</li>").appendTo("#files");
}
});
$.ajax_upload(l_prof_button, order, 4, { ... и вот так вот 11 раз
Полная жесть
−87
# bad, bad SQLAlchemy!
def assemble(self, message):
mdict = message.__dict__.copy()
self.__dict__.update(mdict)
def disassemble(self, message):
mdict = message.__dict__.copy()
instance_state = self.__dict__.get('_sa_instance_state')
self.__dict__.update(mdict)
self.__dict__['_sa_instance_state'] = instance_state
# /bad, bad SQLAlchemy!
Вот что приходится делать, если надо привязать класс к нескольким таблицам в SQLAlchemy
+147
http://www.viva64.com/media/images/content/a/ReactOS_ru/image1.png
Ḅ̩̝͓̆ͦͮ̅ͧ̏́ͅȌ̘̫ͯO̮̐̋ͪ̽̇ͯ̅L̸̜̯̩͗ ͔͕̦̗ͧͭ̕F̴̘͔̝̱̫̾ͫÄ̧̭̯͉̩̜̮͇́̍ͤS̮̦̰̺̗͈͆̄̄̓̚T̎̄͏̥̩͍̠̬͖ͅC̝̽̽̋ͅA̼̖̘̿ͧ̓͡L̝̝͚͚̬̓͌L̞͌
̿͊͆͏̫I̪̿ͮͦ͊ͮ̓̈͡n͖̱̾ͦ́͌tẸ͕̬̱̰̗̘̊͐̎ͨ̆̓ņͦ͐̽̄ͭ̆g̝͆G̬̝̲͙̼̞r̶͔̩̗̯̘̯͑ͤ͛͐̈a̫̥͇̠̗̪̔ͧ̾̾̎͜d̙̯̖͈̬ͤͤͭ͟i̢͇̥̰͔̙̺̿͛e̤̠͛̋ͭn̳͕̺͖ͨ̽̃ͬ͊̾t͖̰͓͎̼ͦ̓̑͂̚̚͜F̡̞̘̯̜i̪͕̪̲̝̬̫̋ͫ̔͌̒ͯ̿l̟͉̆l͔͔͙̗̖̄̒ͪ͑ͬ̍̍T̥͕̙̀r̮̜͓̽̉̎ͧ̈ͦͅȉ̢̹̲̝̤̫̳ͮ̆a̢̺̤͔̤ͬͮͪ̽̐̈̈n̫̄͝g̢͈̗̖ͦ̔̓ͯͫ͑̋l̡̟̬͚͍̐ͥ͐ͪ͗̽̏e͌ͫ̉͆ͪ̆͏(̳̺̪̯̎͑̓.̵̊̊ͪ͛̾ͩ̚.̔ͩ͝.̻̫̟̙ͣ̍͒͞)͍̻̠̯ͬ͛̄̕
̧̥̬̩̖̤ͯͪ̂̚{̲̻̪
͉ͬ͋͒̎͟ ̽͛ͤ̇͟ ͍̭̻̬̹̲̇̀̍ͫ̒͂͝.̲̬̳̦̀̄͐̔́̓.̬͓̭̊̏̅ͩ͊.͙͕̠̰͓̘
̸̤͉̬͓̲̠ͮ́ͯ̃͑ͥ ̲̥̝̞̝͓̂͐ ̑͋̾̿Ṣ̸͔̗̖̳̱͍̊̈͑̃W͔̳̰̫̿A͉̬͙͎͂̔̇ͫͨ̾́P͂ͯ(̂̓v̟̲̦̪̖̻̎͂́2͇̤̔,̧̺͎̞̞̈́̍v̘̟͕͚̘̞ͧ̒͊ͦ̚ͅ3̤̩̙̬̘̯̼,̣̰͕͑̂͌͆̉̍͢tͩ̏ͮ͋͌̆ͯ)̜̳̖̈́̎̏̏̎ͦ;̫̻̪̞̼̟̆͐̐ͨ̀̾̉
͛ ̹̮͓͎̑͆̌͂́ ̙̟̦̤.ͤ̎ͧ̀ͅ.̥̼̠̮͉̰̀.̧̥͙̻̲
̖̬̫̣̙̅̽̋̔ͤ̏̇}̵̬̞̻̜̮̟ͣ̄ͧͦ̊