- 1
- 2
- 3
- 4
- 5
$pos = strpos($pp_req, '&FIRSTNAME=');
if ($pos === false) {
$pos = strpos($pp_req, '&SHIPTONAME=');
}
return $res;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+158
$pos = strpos($pp_req, '&FIRSTNAME=');
if ($pos === false) {
$pos = strpos($pp_req, '&SHIPTONAME=');
}
return $res;
−352
#!/bin/bash
function f() {
sleep "$1"
echo "$1"
}
while [ -n "$1" ]
do
f "$1" &
shift
done
wait
example usage:
./sleepsort.bash 5 3 6 3 6 3 1 4 7
Метод сортировки :)
Взято с:
http://dis.4chan.org/read/prog/1295544154
+174
// привет помоги почему скрипт не работает? он делает лоадер загрузки страницы а потом когда уже все загружено то скрипты подключает
if($(document).ready(function(){return "true";})) {
$(document).ready(function(){//
$('div:eq(32)').addClass('LOADED'"+);
$('body').removeClass('LOADIING');
$("head").html(+$("head").html()+"+<script type=text/javascript src=../jquery.1.6.min.js></script>"+");
$(function(){
if(typeof jquery===function && typeof $===typeof jquery){$.get('/load/0-0-0-0-17',function(DATA){
if(data){
if(data!=undefined){
$("div:contains('Друзья')").html($("[id*=entry]", DATA).append("true"))}}
})}
})
})
} else {alert("ОШИБКА ЗАГРУЗКИ СТРАНИЦЫ!"+\n")}
Йобаннаврот!
+93
Label 1, 2;
var
M,n:integer;
B:real;
Begin
Read(m,n);
2:
B:=m mod n;
If b=0 then goto 1 else
Begin
M:=n; n:=b;
Goto 2;
End;
1:
Write(n);
End.
Кaк бэ прогрaммноe рeaлизaциё aлгоритмa Евклидa, нaхождeниe мaксимaльного дeлитeля двух чисeл, кaк-то тaк.
+147
#include <math.h>
#include <iostream>
#include <conio.h>
#include <istream>
using namespace std;
class Complex{
public:
double real;
double image;
Complex(){};
Complex(double re){real = re; image = 0;}
Complex(double re, double im){real = re ; image = im ;}
~Complex(){}
Complex & operator=(Complex &);
Complex & operator=(double);
double abs(){
return sqrt(real * real + image * image);
}
double arg(){
return (2*atan(image/(real+abs())));
}
double imag(){
return image;
}
double re(){
return real;
}
inline friend Complex operator+(const Complex, const Complex);
Complex operator+();
inline friend Complex operator-(const Complex, const Complex);
inline friend Complex operator*(const Complex, const Complex);
inline friend Complex operator*(Complex, double);
inline friend Complex operator/(const Complex, const Complex);
inline friend Complex operator/(const Complex, const double);
inline friend Complex operator+=(Complex, Complex);
inline friend Complex operator+=(Complex, double);
inline Complex conj(Complex fp1);
inline Complex Complex::expon(Complex fp1);
inline Complex Complex::sinus(Complex fp1);
inline Complex Complex::cosinus(Complex fp1);
inline Complex Complex::hypercosinus(Complex fp1);
inline Complex Complex::hypersinus(Complex fp1);
inline Complex Complex::logarithm(Complex fp1);
friend ostream &operator<<(ostream &, Complex &);
friend istream &operator>>(istream &, Complex &);
};
const Complex _i = Complex(0,1);
Complex Complex::operator+()
{
return *this;
}
Complex operator+(const Complex fp1, const Complex fp2)
{
Complex fp;
fp.real = fp1.real + fp2.real;
fp.image = fp1.image + fp2.image;
return fp;
}
Complex operator+=(Complex fp1, Complex fp2)
{
fp1.real = fp1.real + fp2.real;
fp1.image = fp1.image + fp2.image;
return fp1;
}
Complex operator+=(Complex fp1, double dbl)
{
fp1.real = fp1.real + dbl;
return fp1;
}
Complex operator-(const Complex fp1, const Complex fp2)
{
Complex fp;
fp.real = fp1.real - fp2.real;
fp.image = fp1.image - fp2.image;
return fp;
}
Complex operator*(const Complex fp1, const Complex fp2)
{
Complex fp;
fp.real = fp1.real * fp2.real - fp1.image * fp2.image;
fp.image = fp1.real * fp2.image + fp1.image * fp2.real;
return fp;
}
Complex operator*(Complex fp1, double dbl)
{
fp1.real = dbl * fp1.real;
fp1.image = dbl * fp1.image;
return fp1;
}
Complex operator/(const Complex fp1, const Complex fp2)
{
double k;
Complex fp;
лаба по ИВТ.. класс для работы с комплексными числами
+148
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <iostream>
#include <string.h>
#include <io.h>
#include <fcntl.h>
struct student {
char FIO[40];
char Group[10];
int TaoN;
char Ball[3];
}qt,st,zt,*zap;
int flen(char * fname){
int handle, len;
handle = open(fname,O_RDWR);
len = filelength(handle);
close(handle);
return len;
}
void writte(FILE *f){
int ret;
printf("\t\t\tЗАПОЛНЕНИЕ БАЗЫ:\n\n");
printf("ФИО:\t\t");
scanf("%s", &st.FIO);
printf("ГРУППА:\t\t");
scanf("%s", &st.Group);
printf("НОМЕР ЗАЧЕТКИ:\t");
scanf("%d", &st.TaoN);
printf("БАЛЛ:\t\t");
scanf("%s", &st.Ball);
ret = atoi(st.Ball);
for(;;)
if((ret != 1) && (ret != 2) && (ret != 3) && (ret != 4) && (ret != 5)){
printf("Неверный символ. Введите число\n");
printf("БАЛЛ:\t\t");
scanf("%s", &st.Ball);
ret = atoi(st.Ball);
}
else break;
f = fopen("data.txt","a+");
fwrite(&st, sizeof(st), 1, f);
fclose(f);
};
void readd(student st,FILE *f){
int len,i,n;
system("cls");
printf("\t\t\tЧТЕНИЕ БАЗЫ:\n\n");
f = fopen("data.txt","r+");
len = flen("data.txt");
n = len/sizeof(st);
for(i = 0; i < n; i++)
{
fread(&st, sizeof(st), 1, f);
printf("ФИО:\t\t%s\n", st.FIO);
printf("ГРУППА:\t\t%s\n", st.Group);
printf("ЗАЧЕТКА:\t%d\n", st.TaoN);
printf("БАЛЛ:\t\t%d\n", st.Ball);
printf("\n");
}
}
void Searc(student zt,student st,FILE *f){
int len, n, i;
system("cls");
printf("\t\t\tПОИСК В БАЗЕ:\n\n");
printf("ФИО: ");
scanf("%s", &zt.FIO);
printf("\n");
if (strlen(zt.FIO) != 0){
f = fopen("data.txt","r+");
len = flen("data.txt");
n = len/sizeof(st);
for(i = 0; i < n; i++){
fread(&st, sizeof(st), 1, f);
int rt = strcmp(st.FIO, zt.FIO);
if (rt == 0)
{
printf("ФИО: ");
printf("\t\t%s\n", st.FIO);
printf("ГРУППА: ");
printf("\t%s\n", st.Group);
printf("ЗАЧЕТКА: ");
printf("\t%d\n", st.TaoN);
printf("БАЛЛ: ");
printf("\t\t%d\n", st.Ball,"\n");
}
}
+162
<?php
$opis = trim(esc(implode(NULL,file($dir_loads.'/'.$file.'.txt')))); // читаем файл
echo $opis;
?>
Без комментариев даже..
+132
<div class="su_mainText">
<h2>
<p>Thank you for taking the time to provide us with your suggestion(s).</p>
<p>Out intent is to continually enhance our program and we are</p>
<p>looking to our customer for guidance.</p>
</h2>
</div>
....задаем стиль текста на странице
+162
if (!empty($login) & !empty($pass) & !empty($compIDS)) {
if (($login != "admin") | ($pass != "qwe754wwQ")) {
print <<<HERE
<script language="JavaScript">
<!--
alert ("Имя пользователя и (или) пароль неверны!");
//-->
</script>
HERE;
}
else {
}
}
Враг не пройдет!
+158
$y=date("Y"); $m=date("n"); $d=date("d");
if($d>1) {$d1=$d-1; $m1=$m; $y1=$y;}
if($d==1 && $m>1) {$d1=date('t',mktime(0, 0, 0, $m-1, 1, $y)); $m1=$m-1; $y1=$y;}
if($d==1 && $m==1) {$d1=date('t',mktime(0, 0, 0, 12, 1, $y)); $m1=12; $y1=$y-1;}
echo "Вчера - $d1.$m1.$y1";
if($d>2) {$d2=$d-2; $m2=$m; $y2=$y;}
if($d==2 && $m>1) {$d2=date('t',mktime(0, 0, 0, $m-1, 1, $y)); $m2=$m-1; $y2=$y;}
if($d==2 && $m==1) {$d2=31; $m2=12; $y2=$y-1;}
if($d==1 && $m>1) {$d2=date('t',mktime(0, 0, 0, $m-1, 1, $y))-1; $m2=$m-1; $y2=$y;}
if($d==1 && $m==1) {$d2=30; $m2=12; $y2=$y-1;}
echo "Позавчера - $d2.$m2.$y2";
Решение в лоб - зато полностью рабочее. Обнаружил в собственном проекте (вполне действующем).