- 1
- 2
- 3
- 4
- 5
- 6
- 7
uses crt;
var s:integer;
begin
readln(s);
writeln(ord(s[0]));
readln;
end.
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+155
uses crt;
var s:integer;
begin
readln(s);
writeln(ord(s[0]));
readln;
end.
+123
this.Border1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(111)))), ((int)(((byte)(111)))), ((int)(((byte)(111)))));
Встретилось такое внутри сгенеренной системой InitializeComponent()
+143
// find the start and end of the upload file.
static FILE * _uploadGet(request *wp, unsigned int *startPos, unsigned *endPos) {
FILE *fp=NULL;
struct stat statbuf;
unsigned char c, *buf;
if (wp->method == M_POST)
{
fstat(wp->post_data_fd, &statbuf);
lseek(wp->post_data_fd, SEEK_SET, 0);
printf("file size=%d\n",statbuf.st_size);
fp=fopen(wp->post_file_name,"rb");
if(fp==NULL) goto error;
}
else goto error;
//printf("_uploadGet\n");
do
{
if(feof(fp))
{
printf("Cannot find start of file\n");
goto error;
}
c= fgetc(fp);
if (c!=0xd)
continue;
c= fgetc(fp);
if (c!=0xa)
continue;
c= fgetc(fp);
if (c!=0xd)
continue;
c= fgetc(fp);
if (c!=0xa)
continue;
break;
}while(1);
(*startPos)=ftell(fp);
if(fseek(fp,statbuf.st_size-0x200,SEEK_SET)<0)
goto error;
do
{
if(feof(fp))
{
printf("fmmgmt: Cannot find end of file\n");
goto error;
}
c= fgetc(fp);
if (c!=0xd)
continue;
c= fgetc(fp);
if (c!=0xa)
continue;
c= fgetc(fp);
if (c!='-')
continue;
c= fgetc(fp);
if (c!='-')
continue;
break;
}while(1);
(*endPos)=ftell(fp);
return fp;
error:
return NULL;
}
Вот так вот китайцы парсят MIME при загрузке прошивки в роутер.
+122
internal sealed class FontKeeper
{
private static readonly FontConverter s_converter = new FontConverter();
private static readonly Regex s_font = new Regex(@"^(?<name>\w[\s\w]+);\s*(?<size>\d+)pt\s*(?:;(?<style>.*))?$", RegexOptions.IgnoreCase);
private static readonly Regex s_style = new Regex(@"^\s*style\s*=\s*([\w\s,]+)$", RegexOptions.IgnoreCase);
private const int defaultSize = 14;
public FontKeeper(Font font) : this(s_converter.ConvertToString(font)) { }
public FontKeeper(string fontString)
{
Match m = s_font.Match(fontString);
if (!m.Success)
throw new ArgumentException("Неверный формат строки");
Name = m.Groups["name"].Value.Trim();
int sz;
if (!int.TryParse(m.Groups["size"].Value, out sz))
sz = defaultSize;
Size = sz;
//Флаги стиля
ParseStyle(m.Groups["style"].Value);
}
private void ParseStyle(string value)
{
Match m = s_style.Match(value);
if (!m.Success) return;
string[] styles = m.Groups[1].Value.Split(new[] { ',' });
foreach (var style in styles)
{
try
{
Style |= (FontStyle)Enum.Parse(typeof(FontStyle), style.Trim(), true);
}
catch { }
}
}
public string Name { get; set; }
public int Size { get; set; }
public FontStyle Style { get; set; }
public float FontFactor
{
get { return (float)Size / defaultSize; }
set { Size = (int)(value * defaultSize); }
}
public Font CreateFont()
{
return new Font(Name, Size, Style);
}
}
Небольшой класс для хранения и динамического изменения шрифтов
+163
elseif (intval($countryID)>0 && intval($regionID)>0){
$SQL = "SELECT DISTINCT ".TABLE_PREFIX."hotels".LANG_PREFIX.".stars FROM ".TABLE_PREFIX."hotels".LANG_PREFIX.", ".TABLE_PREFIX."regions".LANG_PREFIX."
WHERE ".TABLE_PREFIX."regions".LANG_PREFIX.".id=".TABLE_PREFIX."hotels".LANG_PREFIX.".region_id
AND ".TABLE_PREFIX."regions".LANG_PREFIX.".id =".$regionID."";
$qRS = mysql_query ($SQL) or die ("<hr size=\"1\"><b>Не удалось выполнить: </b> \"" . $SQL . "\"<br>" . mysql_error());
if (mysql_num_rows($qRS)) {
while ($row = mysql_fetch_object($qRS)) {
$stars[$row->stars]++;
}
}
krsort($stars);
foreach ($stars as $key=> $value) {
$ret .= get_hotels($key, 100, $regionID, $countryID);
}
−88
try:
dday = time.strftime("%d", time.localtime(os.path.getmtime(path + d))).lstrip('0')
dmonth = time.strftime("%m", time.localtime(os.path.getmtime(path + d))).lstrip('0')
dhour = time.strftime("%H", time.localtime(os.path.getmtime(path + d))).lstrip('0')
dmin = time.strftime("%M", time.localtime(os.path.getmtime(path + d))).lstrip('0')
screenpath = os.listdir(spath)
for screen in screenpath:
sday = time.strftime("%d", time.localtime(os.path.getmtime(spath + screen))).lstrip('0')
smonth = time.strftime("%m", time.localtime(os.path.getmtime(spath + screen))).lstrip('0')
shour = time.strftime("%H", time.localtime(os.path.getmtime(spath + screen))).lstrip('0')
smin = time.strftime("%M", time.localtime(os.path.getmtime(spath + screen))).lstrip('0')
if dday == sday:
if dmonth == smonth:
if dhour == shour:
if dmin == smin:
scr = spath + screen
if scr:
return str(scr)
else:
return None
except:
return "None"
Проверка даты создания двух файлов
−318
self._DEBUG=Debug.Debug(debug)
В библиотеке xmpppy. Дебаг на дебаге.
+156
// ...html-параша и верстка таблицей
<?php
if (isset($charsetList)) {
echo "<tr>";
echo "<td class=\"inputfield\">";
echo __("Charset") . ":";
echo "</td>";
echo "<td>";
echo "<select id=\"DBCHARSET\">";
echo "<option></option>";
$defaultCharSql = $conn->query("SHOW VARIABLES LIKE 'character_set_server'");
if ($conn->isResultSet($defaultCharSql)) {
$defaultCharset = $conn->result($defaultCharSql, 0, "Value");
}
foreach ($charsetList as $charset) {
echo "<option value=\"" . $charset . "\"";
if (isset($defaultCharset) && $charset == $defaultCharset) {
echo ' selected="selected"';
}
echo ">" . $charset . "</option>";
}
echo "</select>";
echo "</td>";
echo "</tr>";
}
?>
// ... html-параша
Кусок кода системы управления MySQL. http://www.sqlbuddy.com/
Посмотрел в код и потянуло блевать.
+139
img[width=120] {
width: 120px;
}
Наткнулся в стилях dleшного шаблона....
+147
make: предупреждение: Неправильный ход часов. Сборка может быть неполной.
mooncrafter@ubuntu:~/allthis/4_mesg$ make lol
make: Внимание: Файл `Makefile' имеет будущее время 1,6e+03 s модификации
gcc -c create_matrix/create_matrix.c
gcc -c source/server.c source/lib/do.h source/lib/scmsg.h source/lib/msg.h
gcc server.o -o server
gcc -c source/client.c source/lib/do.h source/lib/scmsg.h source/lib/msg.h
rm create_matrix.o server.o client.o source/lib/do.h.gch source/lib/scmsg.h.gch source/lib/msg.h.gch
apt-get moo
(__)
(oo)
/------\/
/ | ||
* /\---/\
~~ ~~
...."Have you mooed today?"...
sleep 1.5
clear
make: предупреждение: Неправильный ход часов. Сборка может быть неполной.
mooncrafter@ubuntu:~/allthis/4_mesg$ clear
- называется перевёл чася на час наЗад!