- 1
- 2
- 3
- 4
function refreshPage() {
//alert(document.location);
document.location = document.location;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+146
function refreshPage() {
//alert(document.location);
document.location = document.location;
}
Стырена с моего мира mail.ru
+146
/**
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
public int compareTo( HandValue pValue ) throws NullPointerException
{
if(getCategory() == null || pValue.getCategory() == null || mTopCards == null)
throw new NullPointerException();
int toReturn = getCategory().compareTo(pValue.getCategory());
if(toReturn != 0)
return toReturn;
for(int i = 0; getCard(i) != null; i++)
{
toReturn = getCard(i).compareTo(pValue.getCard(i));
if(toReturn != 0)
return toReturn;
}
return 0;
}
очень долго смеялся, увидев этот код.
+146
<?php
$link="http://cert.vatsim.net/cert/vatsimnet/idstatus.php?cid=111111";
$contents = file_get_contents($link);
if ($contents!=FALSE) {
$xml = simplexml_load_string($contents);
$output = "<code>".$contents."</code><br>LAST NAME: ".$xml->user->name_last;
$output.="<br>EMAIL: ".$xml->user->email;
return $output;
}
else {
return "FAILED";
}
?>
Парсерчег XML статов из сети ВАТСИМ
+146
Товарищ, помни! Выкладывание кода сюда скорее всего нарушает права на интеллектуальную собственность твоего белого господина!
+146
<?php
class db {
function db_conn ($host,$user,$pass,$db) {
if(!($this->link = @mysqli_connect($host,$user,$pass)))
{
echo "<font color=\"red\">Error:</font> connect to host: $host";
//exit();
}
if(!mysqli_select_db($this->link,$db))
{
echo "<font color=\"red\">Error:</font> select database $db";
exit();
}
return $this->link;
}
function sql_query ($query) {
$result = mysqli_query($this->link, $query);
if (!$result)
{
$this->error_msg = mysqli_error ($result);
return $this->error_msg;
}
return $result;
}
function sql_fetch_assoc ($query) {
$res=$this->sql_query($query);
//$array = array();
$row = mysqli_fetch_array($res);
mysqli_free_result($res);
return $row;
}
}
?>
+146
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, DB, DBTables, Grids, DBGrids;
type
TForm_magnituda = class(TForm)
DataSource2: TDataSource;
Table1: TTable;
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Button2: TButton;
DBGrid1: TDBGrid;
Table1Id: TStringField;
Table1Data: TStringField;
Table1Shirota: TStringField;
Table1Dolgota: TStringField;
Table1Magnituda: TStringField;
Table1Glubina: TStringField;
Table1Bal: TStringField;
Table1Local: TStringField;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form_magnituda: TForm_magnituda;
implementation
uses unit1;
{$R *.dfm}
procedure TForm_magnituda.Button1Click(Sender: TObject);
begin
form1.show;
form_magnituda.Hide;
end;
procedure TForm_magnituda.Button2Click(Sender: TObject);
begin
form_magnituda.Table1.Append;
end;
end.
+146
(
define
(
lazy-reader
reader
)
(
lambda
(
port
)
(
make-lazy-list1
(
lambda
(
)
(
let
(
(
it
(
reader
port
)
)
)
(
if
(
eof-object?
it
)
'
(
)
it
)
)
)
)
)
)
Идиотское форматирование в Scheme
+146
++$i--;
операция "передёргивания"
+146
#import "Hehe.h"
@implementation Hehe
- (IBAction)click {
[textArea setText:(@"Hello World!")];
}
@end
Objective-C =) Помойму самый красивый ейзык =)
+146
#include <stdio.h>
#include <ctype.h>
unsigned int wordsCount(const char *str);
int main(int argc, char *argv[]) {
char *chr;
if(argc != 2)
return 255;
puts(argv[1]);
if(wordsCount(argv[1]) > 1) {
chr = argv[1];
while(*chr) {
if (*chr == '*')
*chr = '3';
if (*chr == '+')
*chr = '1';
if (*chr == '-')
*chr = '2';
chr++;
}
}
puts(argv[1]);
return 0;
}
unsigned int wordsCount(const char *str) {
unsigned int wordsCount = 0;
char isWord = 0;
while(*str) {
if(isalpha(*str)) {
isWord = 1;
} else if(isWord) {
wordsCount++;
isWord = 0;
}
str++;
}
if(isWord)
wordsCount++;
return wordsCount;
}