- 1
- 2
- 3
- 4
- 5
- 6
CFG ; start: scasb
DCG ; salc
AEEAFF ; and al,'\'-'/'
AAEAFO ; add al,'/'
DBFAFB ; int 29h
DFDDGG ; jmp start
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+114
CFG ; start: scasb
DCG ; salc
AEEAFF ; and al,'\'-'/'
AAEAFO ; add al,'/'
DBFAFB ; int 29h
DFDDGG ; jmp start
Генератор лабиринта на Wct.
+59
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *fp;
char hc1,hc2,mc1,mc2;
int hi1,hi2,mi1,mi2,hour,minute;
system("echo %time% >time.txt");
fp=fopen("time.txt","r");
if(fp==NULL)
exit(1) ;
hc1=fgetc(fp);
hc2=fgetc(fp);
fgetc(fp);
mc1=fgetc(fp);
mc2=fgetc(fp);
fclose(fp);
remove("time.txt");
hi1=hc1;
hi2=hc2;
mi1=mc1;
mi2=mc2;
hi1-=48;
hi2-=48;
mi1-=48;
mi2-=48;
hour=hi1*10+hi2;
minute=mi1*10+mi2;
printf("Current time is %d:%d\n",hour,minute);
return 0;
}
Как узнать текущее время особо извращенным образом. http://stackoverflow.com/questions/5141960/get-the-current-time-in-c
+55
On Wed, 29 Oct 2014 20:29:33 +0000
via Digitalmars-d <[email protected]> wrote:
> On Wednesday, 29 October 2014 at 20:13:34 UTC, ketmar via
> Digitalmars-d wrote:
> > On Wed, 29 Oct 2014 13:07:38 -0700
> > Walter Bright via Digitalmars-d <[email protected]>
> > wrote:
> >
> >> There are still two string types, something you can't quite
> >> escape dealing with.
> > and D has three string types. it's even better than C++!
>
> Only three? C++ has seven:
>
> 1. const char* /* zero terminated single byte*/
> 2. const char* /* zero terminated multi byte */
> 3. const wchar_t* /* zero terminated wide */
> 4. std::string
> 5. std::wstring
> 6. std::u16string
> 7. std::u32string
ah, D has those 'char*' family too, but i don't count them as string
types. ok, C++ wins. again. ;-)
Хоть и не код, но смешно.
Источник: http://forum.dlang.org/thread/[email protected]?page=3
+166
function chekemailandpas(e) {
var email1val = $('#email1').val();
var pas1val = $('#password1').val();
var name1val = $('#name1').val();
var famil2val = $('#famil2').val();
name1val = del_spaces(name1val);
famil2val = del_spaces(famil2val);
email1val = del_spaces(email1val);
pas1val = del_spaces(pas1val);
email1 = email1val.length;
pas1 = pas1val.length;
if(!e) {
e = event || window.event;
}
if(e == '[object MouseEvent]' || e.keyCode == 13 && email1val !== '' && pas1val !== '') {
if(email1 < 5) {
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128, 0.1)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.2)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.3)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.4)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.5)');
}, 50);
}, 50);
}, 50);
}, 50);
}, 500);
if($('#email1').css('background', 'rgba(240,128,128,0.5)')) {
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128, 0.4)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.3)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.2)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.1)');
setTimeout(function() {
$('#email1').css('background', 'rgba(240,128,128,0.0)');
}, 50);
}, 50);
}, 50);
}, 50);
}, 500);
}
}
if(pas1 < 2) {
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128, 0.1)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.2)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.3)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.4)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.5)');
}, 50);
}, 50);
}, 50);
}, 50);
}, 500);
if($('#password1').css('background', 'rgba(240,128,128,0.5)')) {
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128, 0.4)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.3)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.2)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.1)');
setTimeout(function() {
$('#password1').css('background', 'rgba(240,128,128,0.0)');
}, 50);
}, 50);
}, 50);
}, 50);
}, 500);
}
}
if(email1 > 4 && pas1 > 1) {
var pagename = 'email='+email1val+'&password='+pas1val+'&name='+name1val+'&famil='+famil2val;
sendRequest(pagename);
}
}
}
+140
type func = function (x : real) : real;
const
eps = 0.0000003;
pi = 3.14159265358979;
function Integral (f : func; a, b : real) : real;
var center : real;
begin
center := (a + b) / 2;
if abs(b - a) < eps then
Integral := f(center) * (b - a)
else Integral := Integral(f, a, center) +
Integral(f, center, b);
end;
function myFunc(x : real) : real;
begin
myFunc := cos(x) / x;
end;
begin
writeln(Integral(myFunc, pi/2, pi));
readln;
end.
Толи я дурачек, толи автор кода - школьник....
+64
int i;
кода на самом деле нет, но это достойно говнокод.ру
на сервере был http метод GET /rest/user/anon/create
по непонятной причине был заменён на POST /rest/user/anon/create1
старый метод теперь возвращает 405 ошибку "Method not allowed" с заголовком Allow: POST, OPTIONS
+162
<?php
/**
* Project: Smarty: the PHP compiling template engine
* File: Smarty.class.php
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* For questions, help, comments, discussion, etc., please join the
* Smarty mailing list. Send a blank e-mail to
* [email protected]
*
* @link http://www.smarty.net/
* @copyright 2001-2005 New Digital Group, Inc.
* @author Monte Ohrt <monte at ohrt dot com>
* @author Andrei Zmievski <[email protected]>
* @package Smarty
* @version 2.6.26
*/
/* $Id: Smarty.class.php 3163 2009-06-17 14:39:24Z monte.ohrt $ */
/**
* DIR_SEP isn't used anymore, but third party apps might
*/
echo ".";
?>
+88
var
s: string := '1 2 4 8 16 32 64 128 256 512';
sum: integer;
num,p: integer;
numstr: string;
begin
sum := 0;
while s.Length>0 do
begin
while s[1]=' ' do // Удаление лидирующих пробелов
Delete(s,1,1);
p := Pos(' ',s); // Поиск следующего пробела
if p=0 then // Если он не найден, то до конца строки находится последнее число
p := s.Length;
numstr := Copy(s,1,p);
Delete(s,1,p);
num := StrToInt(numstr);
sum += num;
end;
writeln('Сумма чисел строки равна ',sum);
end.
"Pascal" не умеет в split?
http://pascalabc.net/wiki/index.php/Строки_и_символы._Тексты_программ
+119
public static RuntimeException propagate(Throwable throwable)
This method always throws an exception. The RuntimeException return type is only for client code to make Java type system happy in case a return value is required by the enclosing method.
Давно пора сделать аннотацию типа noreturn, чтобы компилятор не ругался и подсвечивал мёртвый код.
+68
public static String elvis(String value, String ifNull) {
return value == null ? ifNull : value;
}
public static Boolean elvis(Boolean value, Boolean ifNull) {
return value == null ? ifNull : value;
}
public static Object elvis(Object value, Object ifNull) {
return value == null ? ifNull : value;
}
- Objects#firstNotNull()?
- нет, не слышал