- 1
http://s006.radikal.ru/i213/1203/4a/bd0bfaac05e6.jpg
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+122
http://s006.radikal.ru/i213/1203/4a/bd0bfaac05e6.jpg
Очень хочется посмотреть что это за эксепшн...http://clck.ru/0kyq9
+122
for (byte b4 = 0; b4 < 8; b4 += 1)
{
this.setBit(ref value4, b4, !this.getBit(value4, b4));
}
this.RA.Value = value4;
if (value4 == 0)
{
this.setBit(ref value, 0, true);
}
}
}
}
else
{
if (command <= 56)
{
if (command != 48)
{
if (command != 52)
{
if (command == 56)
{
byte value4 = this.RA.Value;
if (this.getBit(value4, 0))
{
this.setBit(ref value, 1, true);
}
for (byte b5 = 0; b5 < 7; b5 += 1)
{
this.setBit(ref value4, b5, this.getBit(value4, b5 + 1));
}
this.setBit(ref value4, 7, false);
this.RA.Value = value4;
if (value4 == 0)
{
this.setBit(ref value, 0, true);
}
}
}
else
{
byte value4 = this.RA.Value;
if (this.getBit(value4, 7))
{
this.setBit(ref value, 1, true);
}
for (byte b6 = 7; b6 > 0; b6 -= 1)
{
this.setBit(ref value4, b6, this.getBit(value4, b6 - 1));
}
this.setBit(ref value4, 0, false);
this.RA.Value = value4;
if (value4 == 0)
{
this.setBit(ref value, 0, true);
}
}
}
else
{
byte value2 = this.RA.Value;
byte value3 = this.RB.Value;
byte b = 0;
for (byte b7 = 0; b7 < 8; b7 += 1)
{
this.setBit(ref b, b7, this.getBit(value2, b7) ^ this.getBit(value3, b7));
}
this.RA.Value = b;
if (b == 0)
{
this.setBit(ref value, 0, true);
}
}
}
else
{
switch (command)
{
case 60:
{
int value5 = (int)this.RA.Value;
int value6 = (int)this.RB.Value;
int num = value5 + value6;
if (num == 0)
{
this.setBit(ref value, 0, true);
}
if (num > 255)
{
this.setBit(ref value, 1, true);
}
this.RA.Value = (byte)num;
break;
}
case 61:
case 62:
case 63:
break;
Элсы,свечи,ифы и просто хороший код №2
(продолжение следует)
годная реализация того что можно было написать в 10 строчек
+122
input.for-blind, select.for-blind, textarea.for-blind {
font-size: 5em !important;
/*font-family: "Louis Braille";
font-convexity: 3mm;*/
}
ДОСТАЛО!!11
+122
while (!requestedTermination)
{
// ...
// тут 130 строк кода...
// ...
if (requestedTermination)
{
break;
}
else
{
// to prevent excess CPU usage
Thread.Sleep(100);
}
}
requestedTermination - Property, изменяемое другим потоком
Мораль: не пишите длинные циклы - к концу цикла забудете, какое у него было условие завершения.
+122
Controller.cs
public ActionResult SomeAction()
{
return View("My message");
}
SomeAction.cshtml
@{
Layout = null;
}
@Html.Raw(string.Format("{0}", Model.ToString()))
Да, это ASP.Net MVC
+122
internal static class ExceptionHelper
{
public static void Throw()
{
Throw("Syntax error.");
}
public static void Throw(string msg)
{
new Exception(msg);
}
}
Просто и красиво! Архитектурное решение - архитектор жжет!
+122
@SuppressWarnings("unused")
// Sure it's used. By Guice. So stop complaining.
protected ColQueryProvider() {
try {
// Exhibit one: ye olde dependency hell.
// We *should* be able to just use new EclipseCompiler(), but GWT complains
// in dev mode when ECJ is in the Eclipse classpath. So it's not.
// ECJ is still loaded by the servlet container, so this is not an issue in deployment.
final JavaCompiler compiler = (JavaCompiler)
Class.forName("org.eclipse.jdt.internal.compiler.tool.EclipseCompiler").newInstance();
// Tweaked based on QueryEngine.DEFAULT
final DefaultEvaluatorFactory evaluatorFactory = new DefaultEvaluatorFactory(ColQueryTemplates.DEFAULT,
(URLClassLoader) DefaultEvaluatorFactory.class.getClassLoader(), compiler);
queryEngine = new DefaultQueryEngine(evaluatorFactory);
} catch (final ClassNotFoundException e) {
throw new ProvisionException("Eclipse compiler cannot be loaded", e);
} catch (final InstantiationException e) {
throw new ProvisionException("Eclipse compiler cannot be loaded", e);
} catch (final IllegalAccessException e) {
throw new ProvisionException("Eclipse compiler cannot be loaded", e);
}
}
+122
if (!0.Equals(callResult.ValueOf("@retValue"))) // оба инт'ы
...
Мы не ищем легких путей сравнения.
+122
<html>
<head> <title> PROEKT</title> </head>
<body>
<body background="images/фон.JPeG" TEXT="crimson">
<h1 align="center">LIVE IN MUSIC</H1>
<br><img src="images/music.gif"><img src="images/music.gif">
<br><form action="avtor.php" method="get">
Логин: <input name="login" type="text">
Пароль: <input name="pass" type="text">
<a href="indexator.html">Войти</a>
</form>
<br><img src="images/Lights.gif"><img src="images/Lights.gif"><img src="images/Lights.gif"><img src="images/Lights.gif"><img src="images/Lights.gif">
</body>
</html>
<br><img src="images/Lights.gif"><img src="images/Lights.gif"><img src="images/Lights.gif"><img src="images/Lights.gif"><img src="images/Lights.gif">
+122
for (int y = 0; y < bmp.Height; y++)
{
for (int x = 0; x < bmp.Width; x++)
{
Color col = bmp.GetPixel(x, y);
col = Color.FromArgb((col.R + col.G + col.B) / 3,
(col.R + col.G + col.B) / 3,
(col.R + col.G + col.B) / 3);
int rValue = int.Parse(col.R.ToString());
html.Append(getGrayShade(rValue));
if (x == bmp.Width - 1)
html.Append("<br/&rt");
}
}
Нашел проект на codeproject, для конвертации изображения в аscii-art