- 1
- 2
- 3
- 4
- 5
- 6
if ($myrow9['fupload'] =='' or empty($myrow9['fupload']))
{
$avachat = "../file/avatars/net-avatara.jpg";
} else {
$avachat = $myrow9['fupload'];
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+153
if ($myrow9['fupload'] =='' or empty($myrow9['fupload']))
{
$avachat = "../file/avatars/net-avatara.jpg";
} else {
$avachat = $myrow9['fupload'];
}
Говно высшей пробы....
+75
public static String ellipsizeText(String text, Context cnt) {
int COUNT_OF_CHARACTERS_LDPI = 10;
int COUNT_OF_CHARACTERS_MDPI = 20;
int COUNT_OF_CHARACTERS_HDPI = 30;
String ellipsizeT = "...";
String newText = text;
switch (cnt.getResources().getDisplayMetrics().densityDpi) {
case DisplayMetrics.DENSITY_LOW:
if (text.length() > COUNT_OF_CHARACTERS_LDPI) {
newText = text.substring(0, COUNT_OF_CHARACTERS_LDPI) + ellipsizeT;
}
break;
case DisplayMetrics.DENSITY_MEDIUM:
if (text.length() > COUNT_OF_CHARACTERS_MDPI) {
newText = text.substring(0, COUNT_OF_CHARACTERS_MDPI) + ellipsizeT;
}
break;
case DisplayMetrics.DENSITY_HIGH:
if (text.length() > COUNT_OF_CHARACTERS_HDPI) {
newText = text.substring(0, COUNT_OF_CHARACTERS_HDPI) + ellipsizeT;
}
break;
}
return newText;
}
Android
Таким нехитрым способом заменяется реализация стандартной процедуры TextView.setEllipsize(TextUtils.Truncate At.END);
−852
SELECT * FROM users WHERE sex=1;
Долго думал, sex=1 это мужики или дамы. Оказалось мужики.
+147
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
говно
+162
if (!empty($login) & !empty($pass) & !empty($compIDS)) {
if (($login != "admin") | ($pass != "qwe754wwQ")) {
print <<<HERE
<script language="JavaScript">
<!--
alert ("Имя пользователя и (или) пароль неверны!");
//-->
</script>
HERE;
}
else {
}
}
Враг не пройдет!
+159
function setBlockStatus()
{
global $adminTpl, $core, $db;
..........
}
function setCommentStatus()
{
global $adminTpl, $core, $db;
..........
}
function deleteBlock()
{
global $adminTpl, $core, $db;
..........
}
И еще десятки других функций которые так любят глобальные переменные в Toogle CMS =)
+958
if (args.Cube == null)
{
args.Cube = null;
stringBuilder.AppendLine(Properties.Resources.ErrorCubeEmpty);
}
else if(...)
{
...
}
else if (...)
{
...
}
else
{
...
}
int num = args.Cube.NumSamplesIJK.K;
+113
public string GetNormalImage(int newWidth, int newHeight, string sufix = "normal") {
String[] tmp = _originalImagePath.Split('.');
String newImagePath = "";
for (int i = 0; i < tmp.Length - 1; i++)
{
newImagePath += tmp[i];
newImagePath += "_";
}
newImagePath += sufix + ".";
newImagePath += tmp[tmp.Length - 1];
Image oldImage = Image.FromFile(_originalImagePath);
if (oldImage.Height >= oldImage.Width) {
Image newImage;
newImage = FixedSize(oldImage, newWidth, newHeight);
newImage.Save(newImagePath);
} else {
float heightRatio = (float)newHeight / (float)oldImage.Height;
float widthRatio = (float)newWidth / (float)oldImage.Width;
float bestRatio = 1;
if (heightRatio < widthRatio) {
bestRatio = heightRatio;
} else {
bestRatio = widthRatio;
}
var result = new System.Drawing.Bitmap((int)Math.Round(oldImage.Width * bestRatio), (int)Math.Round(oldImage.Height * bestRatio));
using (var graphics = Graphics.FromImage(result))
{
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.DrawImage(oldImage, new Rectangle(Point.Empty, new Size((int)Math.Round(oldImage.Width * bestRatio), (int)Math.Round(oldImage.Height * bestRatio))));
}
result.Save(newImagePath);
}
return newImagePath;
}
ресайз изображения
−104
<%= !!@case[:img] ? image_tag(@case[:img]) : "" %>
−144
#! /bin/sh
# some code
daemon1="/usr/home/daemon1.sh"
daemon2="/home/daemon2.sh"
# some code with variables
Скрипт на BSD. Хомяк находится в /usr/home, а /home симлинк на него