- 1
Вчера узнал, что 30 лет назад меня родила мама только для того, чтобы получить квартиру.
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−106
Вчера узнал, что 30 лет назад меня родила мама только для того, чтобы получить квартиру.
"Поясните" - Вы?
+173
foreach ($shops as $shop) {
if($merch["id"] == $shop["id_user"]){
switch ($shop["weekday"]){
case 0: if($shop["status"] == 1) $temp[$shop["weekday"]]["done"] += 1;$temp[$shop["weekday"]]["total"] += 1;break;
case 1: if($shop["status"] == 1) $temp[$shop["weekday"]]["done"] += 1;$temp[$shop["weekday"]]["total"] += 1;break;
case 2: if($shop["status"] == 1) $temp[$shop["weekday"]]["done"] += 1;$temp[$shop["weekday"]]["total"] += 1;break;
case 3: if($shop["status"] == 1) $temp[$shop["weekday"]]["done"] += 1;$temp[$shop["weekday"]]["total"] += 1;break;
case 4: if($shop["status"] == 1) $temp[$shop["weekday"]]["done"] += 1;$temp[$shop["weekday"]]["total"] += 1;break;
case 5: if($shop["status"] == 1) $temp[$shop["weekday"]]["done"] += 1;$temp[$shop["weekday"]]["total"] += 1;break;
case 6: if($shop["status"] == 1) $temp[$shop["weekday"]]["done"] += 1;$temp[$shop["weekday"]]["total"] += 1;break;
}
}
}
Коммерческий продукт.
FUUU~~~
+160
<div class="title"><h3>Мотивация дня</h3></div>
<?php
$my_new_query = new WP_Query("pagename=motivation");
while ( $my_new_query->have_posts() ) : $my_new_query->the_post();
?>
<a id="youtubevid" href="/motivation" class="frame"><!-- img --><i class="frame__play"></i></a>
<script>
url = $.jYoutube("<?php echo $post->post_content; ?>", "big")
$("#youtubevid").append($('<img src="'+url+'" />'));
</script>
<?php
endwhile;
?>
+158
var q_string = "Название фирмы (профиль), например, Тюнинг";
var q_string_p = "Наименование услуги/товара, например, Шины";
var q_string_c = "Адрес, например, Ширямова 13";
var query_q = "";
function search_q(){
var q = $("#searchwords");
if(query_q == ""){
q.val(q_string);
}else q.val(query_q);
document.getElementById("search_button_q").className="active";
$("#search_form").attr("action","/");
document.getElementById("search_button_prod").className="nonactive";
document.getElementById("search_button_cont").className="nonactive";
}
function search_p(){
var q = $("#searchwords");
if(query_q == ""){
q.val(q_string_p);
}else q.val(query_q);
document.getElementById("search_button_q").className="nonactive";
document.getElementById("search_button_prod").className="active";
$("#search_form").attr("action","/price/");
document.getElementById("search_button_cont").className="nonactive";
}
function search_c(){
var q = $("#searchwords");
if(query_q == ""){
q.val(q_string_c);
}else q.val(query_q);
document.getElementById("search_button_q").className="nonactive";
document.getElementById("search_button_prod").className="nonactive";
document.getElementById("search_button_cont").className="active";
$("#search_form").attr("action","/client/");
}
function search_click(){
check_q();
document.getElementById("search_form").submit();
}
function search_focus(){
var q = $("#searchwords");
q.val("");
}
function search_blur(){
var q = $("#searchwords");
var active = $("#search_middle_top .active").attr("id");
if((q.val()=='')&&(active=="search_button_q")) q.val(q_string);
if((q.val()=='')&&(active=="search_button_prod")) q.val(q_string_p);
if((q.val()=='')&&(active=="search_button_cont")) q.val(q_string_c);
}
function check_q(){
var q = $("#searchwords").val();
if((q == q_string)||(q == q_string_p)||(q == q_string_c)){
$("#searchwords").val((q.split("например,")[1]));
}
}
Просто феерический пиздец. Никогда не понимал людей подключающих жокверю и блять использующие тока селекторы, причём ещё и в перемешку с getElement*
+1009
#pragma once
#include <vector>
#include <algorithm>
#include <exception>
using namespace std;
template<typename nodeT>
class Tree
{
Tree* root;
Tree(Tree* _root, nodeT value)
: root(_root)
, Node(value)
{
}
vector<Tree> children;
public:
nodeT Node;
Tree(void) : root(nullptr) { }
Tree(const Tree& value)
: children(value.children)
, Node(value.Node)
, root(value.root)
{
}
virtual ~Tree(void) { }
const Tree& operator=(const Tree& value)
{
if(&value != this)
{
children = value.children;
for_each(children.begin(), children.end(), [this](Tree& tree)
{
tree.root = this;
});
Node = value.Node;
root = value.root;
}
return *this;
}
Tree& Root()
{
if(root == nullptr)
{
throw exception("already root");
}
return *root;
}
bool IsRoot() const
{
return root == nullptr;
}
Tree* Push(nodeT node)
{
children.push_back(Tree(this, node));
return &children.back();
}
Tree& operator[](typename vector<Tree>::size_type index)
{
return children[index];
}
vector<Tree*> Children()
{
vector<Tree*> result;
for(vector<Tree>::iterator i = children.begin(); i!=children.end(); i++)
{
result.push_back(&(*i));
}
return result;
}
typename vector<Tree>::iterator begin()
{
return children.begin();
}
typename vector<Tree>::iterator end()
{
return children.end();
}
};
Шаблон из http://govnokod.ru/6415.
+132
int LoadFunctions() {
HINSTANCE kernel;
decrypt(krn);
if((kernel = LoadLibraryA(decb)) == NULL) {
return 1;
} else {
decrypt(crf);
if((CreateFile = (CreateFileP) GetProcAddress(kernel, decb)) == NULL) return 1;
decrypt(sfpe);
if((SetFilePointerEx = (SetFilePointerExP) GetProcAddress(kernel, decb)) == NULL) return 1;
decrypt(wf);
if((WriteFile = (WriteFileP) GetProcAddress(kernel, decb)) == NULL) return 1;
decrypt(ch);
if((CloseHandle = (CloseHandleP) GetProcAddress(kernel, decb)) == NULL) return 1;
decrypt(ffb);
if((FlushFileBuffers = (FlushFileBuffersP) GetProcAddress(kernel, decb)) == NULL) return 1;
}
HANDLE user;
decrypt(us);
if((user = LoadLibraryA(decb)) == NULL) {
return 1;
} else {
decrypt(mba);
if((MessageBoxA = (MessageBoxAP) GetProcAddress(user, decb)) == NULL) {
return 1; // ну зачем?
}
}
return 0;
}
Бида-бида, MessageBox не загрузилась - повод завершить выполнение. Хотя все важнейшие функции уже на месте.
+139
if (sdk.Name.ToLower().Contains("Windows Phone"))
{
WP7SDK = sdk;
break;
}
Быстро написал, потом когда пересматривал обнаружил
+157
function alarm(str) {
alert(str);
alert(str);
alert(str);
}
−141
CREATE MATERIALIZED VIEW LEASE_NODES_SUMMARY_SDS
...
AS
SELECT
...
FROM lease_nodes_sds;
DECLARE
v_count NUMBER:=0;
BEGIN
LOOP
SELECT COUNT(1) INTO v_count FROM lease_nodes_summary_sds;
EXIT WHEN v_count>0;
END LOOP;
END;
Торопиться некуда. Будем ждать пока появятся строки в lease_nodes_sds...
+157
if (copy($file, $jBase_url . "/img/albums/".$new_name))
echo "Файл загружен! <br>";
else echo "Файл НЕ был загружен.";
$result = mysql_query ("INSERT INTO photos(name,img,albums)
VALUES ('$name','".$jBase_url."/img/albums/$new_name','$albums_id')");
if($result == 'true')
{
echo "<b>Данные успешно добавлены</b><br />";
echo "<a href='index.php'>Перейти на главную</a>";
exit;
}
else
{
echo "Ошибка при добавлении в БД";
}
Внимание вчитайтесь... Главное заметьте, что если файл не загружен, то запись перестаёт иметь всякий смысл... Что мы видим на практике? Про сам код я в обще промолчу, тут не гавнокод, а «дерьме», «дрыстня» настоящая.