- 1
- 2
- 3
- 4
public ActionResult Exception()
{
throw new Exception("You better not to execute this!");
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
public ActionResult Exception()
{
throw new Exception("You better not to execute this!");
}
нашел говнокод, оставленный прошлым архитектором)
+2
switch (button.Tag.ToString()) {
case "Ezp":
{
if (nowLayer.OpenedFiles.Count == 0)
{
nowLayer.OpenedFiles = new List<ExemplarFile> { new ExemplarFile("") };
}
if (nowLayer.OpenedFiles[0].EdinZemleps == null)
{
nowLayer.OpenedFiles[0].EdinZemleps = new List<EdinZemlep>();
}
var strName = ":ЕЗ" + (nowLayer.OpenedFiles[0].EdinZemleps.Count + 1);
nowLayer.OpenedFiles[0].EdinZemleps.Add(new EdinZemlep(strName) { Status = StatusEnum.Образуемый });
_ezpListTreeView.Add(new EzpTreeView { NameEzp = strName, ContourList = new List<ContourTreeView>(), ParcelList = new List<PartZuTreeView>(), IsEzpVisible = true, IsSelectedEzp = false } );
_dictionaryEzpTreeViewFile.Add(_ezpListTreeView[_ezpListTreeView.Count - 1], nowLayer.OpenedFiles[0]);
_dictionaryEzpTreeViewEdinZemlep.Add(_ezpListTreeView[_ezpListTreeView.Count - 1], nowLayer.OpenedFiles[0].EdinZemleps[nowLayer.OpenedFiles[0].EdinZemleps.Count - 1]);
break;
}
case "ContourEzp":
{
indexEz = TreeViewStackPanelMain.Children.IndexOf(((button.Parent as Grid).Parent as StackPanel).Parent as Grid) - _partZuListTreeView.Count;
var strName = (nowLayer.OpenedFiles[0].EdinZemleps[indexEz].CadNum != "" ? nowLayer.OpenedFiles[0].EdinZemleps[indexEz].CadNum : nowLayer.OpenedFiles[0].EdinZemleps[indexEz].LastName) + "(" + (nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Contours.Count + 1) + ")";
nowLayer.OpenedFiles[0].EdinZemleps[indexEz].AddContour(new Contour(strName) { Status = StatusEnum.Образуемый });
if (_ezpListTreeView[indexEz].ContourList == null)
{
_ezpListTreeView[indexEz].ContourList = new List<ContourTreeView>();
}
strName = nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Contours.Last().Name;
_ezpListTreeView[indexEz].ContourList.Add(new ContourTreeView { NameContour = strName, IsContourVisible = true, IsSelectedContour = false } );
for (var i = 0; i < _ezpListTreeView[indexEz].ContourList.Count; i++)
{
_ezpListTreeView[indexEz].ContourList[i].NameContour = nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Contours[i].Name;
}
break;
}
case "ZuEzp":
{
indexEz = TreeViewStackPanelMain.Children.IndexOf(((button.Parent as Grid).Parent as StackPanel).Parent as Grid) - _partZuListTreeView.Count;
var strName = ":ЗУ" + (nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels.Count + 1);
if (_ezpListTreeView[indexEz].ParcelList == null)
{
_ezpListTreeView[indexEz].ParcelList = new List<PartZuTreeView>();
}
nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels.Add(new Parcel(strName) { Status = StatusEnum.Образуемый });
_ezpListTreeView[indexEz].ParcelList.Add(new PartZuTreeView { NamePartZu = strName, ContourList = new List<ContourTreeView>(), PartList = new List<PartTreeView>(), IsPartZuVisible = true, IsSelectedPartZu = false });
_dictionaryPartZuTreeViewFile.Add(_ezpListTreeView[indexEz].ParcelList[_ezpListTreeView[indexEz].ParcelList.Count - 1], nowLayer.OpenedFiles[0]);
_dictionaryPartZuTreeViewParcel.Add(_ezpListTreeView[indexEz].ParcelList[_ezpListTreeView[indexEz].ParcelList.Count - 1], nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels.Count - 1]);
break;
}
case "PartZuEzp":
{
indexEz = TreeViewStackPanelMain.Children.IndexOf(((((((button.Parent as Grid).Parent as StackPanel).Parent as Grid).Parent as StackPanel).Parent as Grid).Parent as StackPanel).Parent as Grid) - _partZuListTreeView.Count;
indexZu = ((((((button.Parent as Grid).Parent as StackPanel).Parent as Grid).Parent as StackPanel).Parent as Grid).Parent as StackPanel).Children.IndexOf((((((button.Parent as Grid).Parent as StackPanel).Parent as Grid).Parent as StackPanel).Parent as Grid));
var sbPrclName = nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[indexZu].LastName + "/чзу" + (nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[indexZu].Subparcels.Count + 1);
nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[indexZu].Subparcels.Add(new Subparcel(sbPrclName) { Status = StatusEnum.Образуемый });
if (_ezpListTreeView[indexEz].ParcelList[indexZu].PartList == null)
{
_ezpListTreeView[indexEz].ParcelList[indexZu].PartList = new List<PartTreeView>();
}
_ezpListTreeView[indexEz].ParcelList[indexZu].PartList.Add(new PartTreeView { NamePart = sbPrclName, ContourList = new List<ContourTreeView>(), IsPartVisible = true, IsSelectedPart = _ezpListTreeView[indexEz].ParcelList[indexZu].IsSelectedPartZu });
_dictionaryPartTreeViewSubparcel.Add(_ezpListTreeView[indexEz].ParcelList[indexZu].PartList[_ezpListTreeView[indexEz].ParcelList[indexZu].PartList.Count - 1], nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[indexZu].Subparcels[nowLayer.OpenedFiles[0].EdinZemleps[indexEz].Parcels[indexZu].Subparcels.Count - 1]);
break;
}
и это продолжается, продолжается и продолжается....
+1
namespace SmalltalkPHP
{
class Model
{
internal static void CreateClass(string className)
{
ClassObject = new Class(className);
}
public static Class ClassObject { get; set; }
public class Message
{
public class Arguments
{
private SortedList arguments = new SortedList();
public void Add(String key, String name)
{
this.arguments.Add(key, name);
}
public String AsPhp()
{
String[] sb = new String[arguments.Count];
int i = 0;
foreach (DictionaryEntry arg in arguments)
{
if ((String)(arg.Value) != "") sb[i] = "$" + arg.Value;
i++;
}
return String.Join(", ", sb);
}
public String MakeFunctionName()
{
String[] sb = new String[arguments.Count];
int i = 0;
foreach (DictionaryEntry arg in arguments)
{
if ((String)(arg.Key) != "") sb[i] = (String)arg.Key;
i++;
}
return String.Join("_", sb);
}
}
public class Generic
{
public virtual string AsPhp()
{
return "nya";
}
}
public class Unary : Generic
{
public Unary(String name, Boolean isStatic = false)
{
this.Name = name;
this.Arguments = new Arguments();
this.IsStatic = isStatic;
}
public string Name { get; set; }
public Arguments Arguments { get; set; }
public Boolean IsStatic { get; set; }
public string PhpHeader
{
get
{
return String.Format("public {0}function {1}()", IsStatic ? "static " : "", Name);
}
}
public override string AsPhp()
{
return PhpHeader;
}
}
public class Keyword : Generic
{
public Keyword(Boolean isStatic = false)
{
this.Arguments = new Arguments();
this.IsStatic = isStatic;
}
public string Name { get { return Arguments.MakeFunctionName(); } }
public Arguments Arguments { get; set; }
public Boolean IsStatic { get; set; }
public string PhpHeader
{
get
{
return String.Format("public {0}function {1}({2})", IsStatic ? "static " : "", Name, Arguments.AsPhp());
}
}
public override string AsPhp()
{
return PhpHeader;
}
}
}
}
}
Писал конвертер Smalltalk -> PHP
Где-то еще валяется Smalltalk -> Erlang
−2
var indexes = T.Select((item, index) => new { Item = item, Index = index })
.Where(nitem => n.Item == 0).Select(nindex => n.Index).ToArray();
Console.WriteLine("Первый: {0}, последний: {1}", indexes.First(), indexes.Last());
Не слишком много item index? index item?
+8
if(user.pass = pass_to_hash(password)){
return done(null, user);
}else{
return done('incorrect password');
}
Факир был пьян, и запер дверь, забыв ее закрыть)
+1
var cloths = {
<?php foreach ($clothList as $cloth): ?>
"<?=$cloth->id()?>": {
"id": <?=$cloth->id()?>,
"name": "<?=$cloth->name()?>",
"public_name": "<?=str_replace('"', '\"', $cloth->public_name())?>"
},
<?php endforeach; ?>
"dummy": {}
};
+2
if (!$subscription) {
return $this->redirect(['action' => 'cancel_success']);
throw new BadRequestException();
}
0
$(window).load(function () {
$(".sidebar-list").mCustomScrollbar({
// scrollButtons:{enable:true,scrollType:"stepped"},
keyboard: {
scrollType: "stepped"
},
mouseWheel: {
scrollAmount: 188
}, // theme:"rounded-dark",
scrollbarPosition: "inside",
autoExpandScrollbar: false,
snapAmount: 188,
snapOffset: 65
});
if ("onhashchange" in window && location.hash) {
match = location.hash.match(/^[?#!]*(.*)$/)[1];
scrollToPage(match);
};
if (!isMob.any() && isRoot) {
// return false;
var navM = $('.menu a');
var section = $.map($(".section"), function (e) {
var $e = $(e);
var pos = $e.position();
return {
top: pos.top - 75,
bottom: pos.top - 75 + $e.height(),
hash: '#!' + $e.attr('id'),
indx: $e.index()
};
});
//Checking scroll
var top = null;
var changed = false;
var currentHash = null;
$(window).scroll(function () {
var newTop = $(document).scrollTop();
changed = newTop != top;
if (changed) {
top = newTop;
// step();
}
});
function step() {
if (!changed) {
return setTimeout(step, 200);
}
var count = section.length;
var p;
while (p = section[--count]) {
if (p.top >= top || p.bottom <= top) {
continue;
}
if (currentHash == p.hash) {
break;
}
var scrollTop = $(document).scrollTop();
window.location.hash = currentHash = p.hash;
$(document).scrollTop(scrollTop);
}
setTimeout(step, 200);
}
setTimeout(step, 200);
}
});
Сей гениальный код должен управлять прокруткой и главным меню на сайте.
0
if ((*entry_it)->flags & (kNoAntialiasRenderFlag == kNoAntialiasRenderFlag)) {
...
}
−94
ВыборкаПоПроектам = ВзаиморасчетыСКонтрагентами.ПолучитьЗаполженностьКонтрагентовНаДату(МассивОрганизаций, КонецДня(ДатаОтчета), Истина, Истина, Истина);
Если ВыборкаПоПроектам <> Неопределено Тогда
ТаблицаВзаиморасчетов = Новый ТаблицаЗначений;
ДополнитьТаблицуКолонками(ТаблицаВзаиморасчетов);
Пока ВыборкаПоПроектам.Следующий() Цикл /// Проект
Если ВыборкаПоПроектам.СуммаОстаток <> 0 Тогда
ВыборкаПоКонтрагентам = ВыборкаПоПроектам.Выбрать(ОбходРезультатаЗапроса.ПоГруппировкам);
Пока ВыборкаПоКонтрагентам.Следующий() Цикл /// Контрагент
Если ВыборкаПоКонтрагентам.СуммаОстаток <> 0 Тогда
ВыборкаПоПлательщикам = ВыборкаПоКонтрагентам.Выбрать(ОбходРезультатаЗапроса.ПоГруппировкам);
Пока ВыборкаПоПлательщикам.Следующий() Цикл // плательщик
Если (ВыборкаПоПлательщикам.СуммаОстаток <> 0) Тогда
ВыборкаПоДоговорам = ВыборкаПоПлательщикам.Выбрать(ОбходРезультатаЗапроса.ПоГруппировкам);
Пока ВыборкаПоДоговорам.Следующий() Цикл // договор
Если ВыборкаПоДоговорам.СуммаОстаток <> 0 Тогда
ВыборкаПоДокументам = ВыборкаПоДоговорам.Выбрать();
Пока ВыборкаПоДокументам.Следующий() Цикл // документ
СтрокаВзаиморасчетов = ТаблицаВзаиморасчетов.Добавить();
ЗаполнитьЗначенияСвойств(СтрокаВзаиморасчетов, ВыборкаПоДокументам);
А потом вот такая таблица помещается в СКД, на неё накладывается отбор... и даже по 1 контрагенту отчёт формируется минут 5. Научили дурака Богу молиться...