- 1
http://habrahabr.ru/post/168723/
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+141
http://habrahabr.ru/post/168723/
Я даже копипастить всё не буду.
+141
adsfasdf
fdas
+141
protected override Type GetEntryType()
{
return typeof(ReportEntry);
}
Код из реального проекта
+141
window.onload = function () {
var жирнота = [
600,
700,
800,
900
],
свэг = document.getElementById("swag");
свэг.innerHTML = "";
"SWAG".split("").forEach(function (буква) {
свэг.innerHTML += "<span>" + буква + "</span>"
});
function ослучайнить(что) {
return Math.floor(Math.random() * что);
}
function минимальноРаскрашываетСвэг() {
Array.prototype.forEach.call(свэг.children, function (буква) {
буква.style.color = "#" + ослучайнить(0xffffff).toString(16);
буква.style.fontSize = 250 + ослучайнить(175) + "px";
буква.style.fontWeight = жирнота[ослучайнить(жирнота.length)];
});
}
setInterval(минимальноРаскрашываетСвэг, 500);
};
+141
/// услуга
$discount = $addservdata['oldcost'] ; // мудак
дальше переменная используется, потому и сделал такой хак.
суть:
сторонний проект шлёт мне данные. и когда они в очередной раз что-то наломали, я не стал их лишний раз дёргать.
+141
#include <stdio.h>
#include <conio.h>
#include <windows.h>
int main()
{
nachalo: system("cls");
int a;
printf("Write first number...");
scanf("%i", &a);
int b;
printf("Write second number...");
scanf("%i", &b);
int res1;
res1=a+b;
int res2;
res2=a-b;
int res3;
res3=a*b;
float res4;
res4=(float)a/b;
int res5;
res5=a*a;
int res6;
res6=b*b;
printf("\nSumm of %i + %i = %i\n", a, b, res1);
printf("Difference of %i - %i = %i\n", a, b, res2);
printf("Production of %i * %i = %i\n", a, b, res3);
printf("Private of %i / %i = %.4f\n\n", a, b, res4);
printf("Square of %i is %i\n", a, res5);
printf("Square of %i is %i\n\n", b, res6);
int max;
max = (b>a) ? b:a;
printf("The greatest number of %i and %i is %d\n\n", a, b, max);
int choice;
printf("To run program again, press number 1, else numbers \nor symbols will close the program...\n> ");
scanf("%i", &choice);
if (choice == 1)
{
goto nachalo;
}
else (choice != 1);
{
return 0;
}
}
Калькулятор. Nuff said
+141
if(is_dir('install')|| is_dir('migrate')) {
if (!file_exists(PATH.'/includes/config.inc.php')){
header('location:/install/');
die();
} else {
include(PATH.'/core/messages/installation.html');
die();
}
}
+141
<?php
function createOperator($a = [])
{
$IOperator = [
'index' => 1,
'iteration' => "",
'f' => 'print_r($a);if(++$a["index"] < $a["count"])
return eval($a["iteration"]);
else
return $a["result"];',
'run' => 'return eval',
];
if(!empty($a))
{
$IOperator['run'] = '$a = $'.$a['title'] . '; ' . $IOperator['run'] . '($a["iteration"]);';
$IOperator['iteration'] = '$a = array_merge($a, ' . $a['operation'] . ');' . "\n" . $IOperator['f'];
$IOperator = array_merge($a, $IOperator);
}
return $IOperator;
}
$fib = createOperator([
'first' => 1,
'result' => 1,
'count' => 5,
'title' => 'fib',
'operation' => '["first" => $a["result"], "result" => $a["first"]+$a["result"]]'
]);
echo eval($fib['run']);
$fac = createOperator([
'result' => 1,
'count' => 5,
'title' => 'fac',
'operation' => '["result" => $a["result"]*$a["index"]]',
]);
echo eval($fac['run']);
Меня потянуло сделать какую-то фигню. Встречайте, рефлексивное программирование.
+141
1/-0 == 42
Внезапно.
+141
//void wyslij(int pin, char mode[] = "open") { //было
void wyslij(int pin, int mode) { //стало
if (pin != -1)
{
if (mode == "open")
{
//...
else if ( (mode == "touch") && ( (error != 1) || (olej_error == 1) ) )
Кусок дипломной работы польского студента, код для ардуино. Выцарапано отсюда: http://vimeo.com/47656204, примерно с 1:15.