- 1
private static string TestExistFiles(ref int maxd, ref Hashtable executedgroups)
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+132
private static string TestExistFiles(ref int maxd, ref Hashtable executedgroups)
+133
if (SellMenuEnable)
{
GUI.Box (new Rect (Screen.width/2 - 200, Screen.height/2 - 300, 400, 480),"");
if (GUI.Button (new Rect (Screen.width/2 + 180, Screen.height/2 - 300, 20, 20), "X" ))
{
SellMenuEnable = false;
}
// ШМОТКИ слево
if (SLOT1)
{
GUI.Box (new Rect (Screen.width/2 - 170, Screen.height/2 - 270, 160, 50),"1");
}
if (SLOT3)
{
GUI.Box (new Rect (Screen.width/2 - 170, Screen.height/2 - 210, 160, 50),"3");
}
if (SLOT5)
{
GUI.Box (new Rect (Screen.width/2 - 170, Screen.height/2 - 150, 160, 50),"5");
}
if (SLOT7)
{
GUI.Box (new Rect (Screen.width/2 - 170, Screen.height/2 - 90, 160, 50),"7");
}
if (SLOT9)
{
GUI.Box (new Rect (Screen.width/2 - 170, Screen.height/2 - 30, 160, 50),"9");
}
if (SLOT11)
{
GUI.Box (new Rect (Screen.width/2 - 170, Screen.height/2 + 30, 160, 50),"11");
}
if (SLOT13)
{
GUI.Box (new Rect (Screen.width/2 - 170, Screen.height/2 + 90, 160, 50),"13");
}
// ШМОТКИ с права
if (SLOT2)
{
GUI.Box (new Rect (Screen.width/2 + 10, Screen.height/2 - 270, 160, 50),"2");
}
if (SLOT4)
{
GUI.Box (new Rect (Screen.width/2 + 10, Screen.height/2 - 210, 160, 50),"4");
}
if (SLOT6)
{
GUI.Box (new Rect (Screen.width/2 + 10, Screen.height/2 - 150, 160, 50),"6");
}
if (SLOT8)
{
GUI.Box (new Rect (Screen.width/2 + 10, Screen.height/2 - 90, 160, 50),"8");
}
if (SLOT10)
{
GUI.Box (new Rect (Screen.width/2 + 10, Screen.height/2 - 30, 160, 50),"10");
}
if (SLOT12)
{
GUI.Box (new Rect (Screen.width/2 + 10, Screen.height/2 + 30, 160, 50),"12");
}
if (SLOT14)
{
GUI.Box (new Rect (Screen.width/2 + 10, Screen.height/2 + 90, 160, 50),"14");
}
}
http://unity3d.ru/distribution/viewtopic.php?f=105&t=16515
+140
private String GetCardType(String creditCardType)
{
switch (creditCardType)
{
case "A":
return "A";
case "Z":
return "D";
case "M":
return "M";
case "V":
return "V";
}
return "0";
}
+134
class Slovo
{
public string Word;
public int Count;
public Slovo(string slovo, int kolichestvo)
{
Word = slovo;
Count = kolichestvo;
}
}
class Program
{
static void Main(string[] args)
{
string s = "Один два четыре восемь число один и два дают вместе восемь а один умножить на один будет один";
List<string> word = new List<string>();
List<int> count = new List<int>();
string[] word_collection = s.ToLower().Split(' ');
foreach (string str in word_collection) if (!word.Contains(str))
{
word.Add(str);
count.Add(1);
}
else count[word.IndexOf(str)]++;
List<Slovo> spisok = new List<Slovo>();
for (int i = 0; i < word.Count; i++) spisok.Add(new Slovo(word[i], count[i]));
spisok.Sort((a, b) => b.Count - a.Count);
foreach (Slovo slovo in spisok) Console.WriteLine(slovo.Word.PadRight(12) + slovo.Count.ToString());
Console.ReadKey();
}
}
Найти в строке самые частоповторяющиеся слова
+124
private void HideActiveButtons()
{
try
{
}
catch (Exception)
{
throw;
}
}
Откопано в форме Windows Forms в страшном legacy-коде.
+132
int count = _repository.GetObjectList().Select(x => x).Where(x => x.Id > 4).Count();
Sql style
+126
<td width="150">\n\
<% if (editableParts.warehouseAssignment || shipping_map.length > 1) { %>\n\
<a class="shipping-map-link dashed" href="#">\n\
<% } else { %>\n\
<span class="grey">\n\
<% } %>\n\
<% if (shipping_map.length == 0) { %>\n\
не указан</span>\n\
<% } else { %>\n\
<% if (shipping_map.length == 1) { %>\n\
<%= shipping_map[0].warehouse.name %>\n\
<% } else { %>\n\
с нескольких складов\n\
<% } %>\n\
<% } %>\n\
<% if (editableParts.warehouseAssignment) { %>\n\
</a>\n\
<% } else { %>\n\
</span>\n\
<% } %>\n\
</td>\n\
+136
public static bool isLaterThan()
{
string hd = DateTime.Now.ToString("tt", new CultureInfo("en-US")).ToLower();
if (hd == "pm")
return false;
return DateTime.Now.Hour < 1;
}
уже есть час ночи?
+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);
}
+138
// Преобразует BCD формат в число
private static int BCDToInt(byte bIn)
{
return ((((bIn / 0x10) * 10) + bIn) - ((bIn / 0x10) * 0x10));
}
// Преобразует число в BCD формат
private static byte IntToBCD(int value)
{
value -= (value / 100) * 100;
byte bTH = (byte)(value / 10);
byte bTL = (byte)(value - (bTH * 10));
return (byte)(bTL + ((byte)(bTH << 4)));
}
навеяло сложными запутывающими большими и маленькими индейцами для элитных программистов
референс-код от партнеров для конверсии binary-coded decimal вперёд и взад
чтобы как бы верно срослось между ихним с# и нашим сраным с++