- 1
- 2
// TODO: Rewiew
// ...
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+144
// TODO: Rewiew
// ...
жопой чую, что ниже этих строк - пиздец
+120
string makesig(string mid, string apiid, string method, string secret, string[] param)
{
string[] fullparams = new string[] { "api_id=" + apiid, "method=" + method, "v=3.0", "format=JSON" };
string methodparams = String.Join("©", param);
string fullparams_j = String.Join("©", fullparams);
string fpr = String.Join("©", new string[] { fullparams_j, methodparams });
string[] fpr_s = fpr.Split(new char[] { Convert.ToChar("©") });
Array.Sort(fpr_s);
fpr = String.Join("", fpr_s);
string last = String.Concat(mid, fpr, secret);
return getMd5Hash(last);
}
Так люди делают подпись для запроса к API ВКонтакте
+134
TestIssue = new Issue(Id, ProjectId, ProjectName, Code, Title,
Description, CategoryId, CategoryName, PriorityId,
PriorityName,PriorityImageUrl, StatusId, StatusName,
StatusImageUrl, IssueTypeId, IssueTypeName,IssueTypeImageUrl,
ResolutionId, ResolutionName,ResolutionImageUrl,
AssignedDisplayName, AssignedUsername, AssignedUserId,
CreatorDisplayName, CreatorUsername, CreatorUserId,
OwnerDisplayName, OwnerUsername, OwnerUserId, DueDate,
MilestoneId, MilestoneName, MilestoneImageUrl,
MilestoneDueDate, AffectedMilestoneId, AffectedMilestoneName,
AffectedMilestoneImageUrl, Visibility, TimeLogged, Estimation,
DateCreated, LastUpdate, LastUpdateUsername,
LastUpdateDisplayName, Progress, Disabled, Votes);
В конструкторе класса Issue 47 аргументов (http://codehelper.ru/questions/156).
+126
public string ConvDoubToStr(double doub)
{
string str = ((int)doub).ToString();
double k = (doub - (int)doub);
if (k > 0)
str += ",";
while (k > 0)
{
k = k * 10;
switch ((int)k)
{
case 0:
str += "0";
break;
case 1:
str += "1";
break;
case 2:
str += "2";
break;
case 3:
str += "3";
break;
case 4:
str += "4";
break;
case 5:
str += "5";
break;
case 6:
str += "6";
break;
case 7:
str += "7";
break;
case 8:
str += "8";
break;
case 9:
str += "9";
break;
}
k = k - (int)k;
}
return str;
}
Мега конверт
http://www.cyberforum.ru/csharp-net/thread20446.html#post667930
+121
/// <summary>
/// Returns current UTC time
/// </summary>
/// <returns></returns>
public static DateTime GetCurrentTimeUtc()
{
DateTime dt = DateTime.UtcNow;
return dt;
}
Индус-стайл метод
+142
void InitializeComponent()
{
ResizeRedraw = true;
this.Paint += new PaintEventHandler(Do);
}
void Do(object sender, PaintEventArgs e)
{
object[] ob = { e.Graphics };
new Thread(Update).Start(ob);
}
void Update(Graphics e)
{
PointF[] pp = new PointF[this.Width];
for (int i = 0; i < this.Width; i++)
{
pp[i].X = i;
pp[i].Y = this.Height / 2;
}
e.DrawCurve(new Pen(Color.Black, 3), pp);
}
+113
double x, y;
void InitializeComponent()
{
this.MouseClick += new MouseEventHandler(Form1_Click);
this.Paint += new PaintEventHandler(Form1_Paint);
}
void Form1_Paint(object sender, PaintEventArgs e)
{
PointF p = new PointF(0, 0);
PointF pp = new PointF((float)x, (float)y);
e.Graphics.DrawPolygon(new Pen(Color.Black, 3), new PointF[2] { p, pp });
}
void Form1_Click(object sender, MouseEventArgs e)
{
x = e.X;
y = e.Y;
AsyncDraw(ref x, ref y);
}
void AsyncDraw(ref double x, ref double y)
{
x = x;
y = y;
}
+143
void Draw(object sender, PaintEventArgs e)
{
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
//X
e.Graphics.DrawLine(new Pen(Color.Blue, 3), new Point(0, this.Height / 2), new Point(this.Width, this.Height / 2));
//Y
e.Graphics.DrawLine(new Pen(Color.Red, 3), new Point(this.Width / 2, this.Height), new Point(this.Width / 2, 0));
PointF[] p = new PointF[this.Width];
//MessageBox.Show((Math.PI / 180 * 1).ToString());
for(int i = 0, z = this.Width; i < (this.Height / 2); i++, z++)
{
p[i].X = (float)Math.Cos(z) * this.Width;
p[i].Y = (float)Math.Sin(i) * this.Height;
}
e.Graphics.DrawCurve(new Pen(Color.LightSkyBlue, 2), p, 2);
}
+112
//Floating
float k = 0.0001f;
for (float i = 10.9f; i >= -10.9f; i--)
{
i += +1 - k;
e.Graphics.DrawEllipse(new Pen(Color.Green, 5), 15 * (float)Math.Sin(i), 15 * i, 5, 5);
}
Учусь рисовать окружность
+113
Guid RespondentId = Guid.NewGuid();
if (RespondentId != Guid.Empty)