- 1
- 2
- 3
- 4
- 5
- 6
void MultMatrix(const GLfloat m1[16], const GLfloat m2[16], GLfloat result[16])
{
glLoadMatrixf(m1);
glMultMatrixf(m2);
glGetFloatv(GL_MODELVIEW_MATRIX, result);
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+6
void MultMatrix(const GLfloat m1[16], const GLfloat m2[16], GLfloat result[16])
{
glLoadMatrixf(m1);
glMultMatrixf(m2);
glGetFloatv(GL_MODELVIEW_MATRIX, result);
}
+6
// implicit_cast< >
// I believe this was originally going to be in the C++ standard but
// was left out by accident. It's even milder than static_cast.
// I use it instead of static_cast<> to emphasize that I'm not doing
// anything nasty.
// Usage is identical to static_cast<>
template <class OutputClass, class InputClass>
inline OutputClass implicit_cast(InputClass input){
return input;
}
// horrible_cast< >
// This is truly evil. It completely subverts C++'s type system, allowing you
// to cast from any class to any other class. Technically, using a union
// to perform the cast is undefined behaviour (even in C). But we can see if
// it is OK by checking that the union is the same size as each of its members.
// horrible_cast<> should only be used for compiler-specific workarounds.
// Usage is identical to reinterpret_cast<>.
// This union is declared outside the horrible_cast because BCC 5.5.1
// can't inline a function with a nested class, and gives a warning.
template <class OutputClass, class InputClass>
union horrible_union{
OutputClass out;
InputClass in;
};
template <class OutputClass, class InputClass>
inline OutputClass horrible_cast(const InputClass input){
horrible_union<OutputClass, InputClass> u;
// Cause a compile-time error if in, out and u are not the same size.
// If the compile fails here, it means the compiler has peculiar
// unions which would prevent the cast from working.
typedef int ERROR_CantUseHorrible_cast[sizeof(InputClass)==sizeof(u)
&& sizeof(InputClass)==sizeof(OutputClass) ? 1 : -1];
u.in = input;
return u.out;
}
Боль и страдание шаблонного программирования на С++98. Комменты и названия доставляют.
+6
// найдем максимальное значение идентификатора
$SQL = "SELECT MAX( id ) AS id FROM `filter_lists` WHERE project=1";
$id = query($SQL);
//новый идентификатор
$id = $id['0']['id'] + 1;
Auto increment PHP way
+6
public string GetRegion(CallContext context)
{
return "Регион";
}
+6
using System;
namespace Colculator
{
public partial class Form1 : Form
{
bool BOOL = {
true,true,true,true,true,true,true,false};
if(BOOL(new Random(1,8)){
Consosle.WriteLine("ДА");
}
Так делать нельзя!!!
+6
if(~window.location.href.indexOf('#')){
var el = window.location.href.slice(window.location.href.indexOf('#')+1,~window.location.href.indexOf('?')?window.location.href.indexOf('?'):window.location.href.length);
location.hash? не, не слышал
+6
if($_GET['menu_id']==5){header("Location:index.php?link=pages_blog&menu_id=101");}
if($_GET['menu_id']==2){header("Location:index.php?link=pages_blog&menu_id=102");}
if($_GET['menu_id']==9){header("Location:index.php?link=pages&id=113");}
if($_GET['menu_id']==16){header("Location:index.php?link=pages&id=114");}
if($_GET['menu_id']==11){header("Location:index.php?link=pages&id=115");}
if($_GET['menu_id']==10){header("Location:index.php?link=pages&id=116");}
if($_GET['id']==22){header("Location:index.php?link=pages&id=129");}
if($_GET['id']==23){header("Location:index.php?link=pages&id=130");}
if($_GET['id']==27){header("Location:index.php?link=pages&id=135");}
if($_GET['id']==19){header("Location:index.php?link=pages&id=125");}
if($_GET['id']==28){header("Location:index.php?link=pages&id=127");}
if($_GET['id']==30){header("Location:index.php?link=pages&id=132");}
if($_GET['id']==29){header("Location:index.php?link=pages&id=132");}
if($_GET['id']==26){header("Location:index.php?link=pages&id=134");}
if($_GET['id']==24){header("Location:index.php?link=pages&id=103");}
if($_GET['id']==1){ header("Location:index.php");}
if($_GET['id']==32){ header("Location:index.php?link=pages&id=116#1");}
if($_GET['id']==33){ header("Location:index.php?link=pages&id=116#2");}
if($_GET['id']==34){ header("Location:index.php?link=pages&id=116#3");}
if($_GET['id']==35){ header("Location:index.php?link=pages&id=116#4");}
if($_GET['id']==36){ header("Location:index.php?link=pages&id=116#5");}
if($_GET['id']==37){ header("Location:index.php?link=pages&id=116#6");}
if($_GET['id']==38){ header("Location:index.php?link=pages&id=116#7");}
if($_GET['id']==39){ header("Location:index.php?link=pages&id=116#8");}
if($_GET['menu_id']==12){header("Location:index.php?link=pages&id=117");}
if($_GET['menu_id']==14){header("Location:index.php?link=pages&id=118");}
if($_GET['menu_id']==13){header("Location:index.php?link=pages&id=119");}
if($_GET['menu_id']==34){header("Location:index.php?link=pages&id=119");}
if($_GET['menu_id']==15){header("Location:index.php?link=pages&id=120");}
if($_GET['menu_id']==31){header("Location:index.php?link=pages&id=121");}
if($_GET['menu_id']==3){header("Location:index.php?link=pages_blog&menu_id=103");}
if($_GET['id']==17){ header("Location:index.php?link=pages&id=122");}
if($_GET['menu_id']==17){ header("Location:index.php?link=pages&id=122");}
if($_GET['menu_id']==35){header("Location:index.php?link=pages&id=123");}
if($_GET['id']==18){ header("Location:index.php?link=pages&id=124");}
if($_GET['menu_id']==18){ header("Location:index.php?link=pages&id=124");}
if($_GET['id']==19){ header("Location:index.php?link=pages&id=125");}
if($_GET['id']==20){ header("Location:index.php?link=pages&id=126");}
if($_GET['id']==28){ header("Location:index.php?link=pages&id=127");}
if($_GET['menu_id']==32){header("Location:index.php?link=pages_blog&menu_id=103");}
if($_GET['menu_id']==7){header("Location:index.php?link=pages&menu_id=104");}
if($_GET['menu_id']==36){header("Location:index.php?link=pages&menu_id=105");}
if($_GET['menu_id']==6){header("Location:index.php?link=pages_blog&menu_id=106");}
if($_GET['id']==61){ header("Location:index.php?link=pages&id=143");}
if($_GET['id']==60){ header("Location:index.php?link=pages&id=112");}
if($_GET['id']==57){ header("Location:index.php?link=pages&id=111");}
if($_GET['id']==59){ header("Location:index.php?link=pages&id=110");}
if($_GET['id']==56){ header("Location:index.php?link=pages&id=109");}
if($_GET['id']==55){ header("Location:index.php?link=pages&id=108");}
if($_GET['id']==54){ header("Location:index.php?link=pages&id=107");}
if($_GET['id']==53){ header("Location:index.php?link=pages&id=106");}
if($_GET['id']==52){ header("Location:index.php?link=pages&id=105");}
if($_GET['id']==50){ header("Location:index.php?link=pages&id=103");}
if($_GET['id']==44){ header("Location:index.php?link=pages&id=102");}
$_GET марафет
+6
switch("пряные сухарики"){
case ".gif":{
header('content-type: image/gif');
break;
}
case ".jpg":{
header('content-type: image/jpeg');
break;
}
case ".jpeg":{
header('content-type: image/jpeg');
break;
}
case ".bmp":{
header('content-type: image/bmp');
break;
}
case ".png":{
header('content-type: image/png');
break;
}
case ".ogg":{
header('content-type: video/ogg');
break;
}
case ".mp4":{
header('content-type: video/mp4');
break;
}
}
+6
$('document,body').on('change','#sprrazmer',function(){
var dh=calc_dh(this);
//alert($(this).val());
filter_ajax(this,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,dh+'px',0);
});
$('document,body').on('change','#f_height_10_01',function(){
var dh=calc_dh(this);
filter_ajax(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this,0,0,0,0,0,dh+'px',0);
});
$('document,body').on('change','#f_height_11_17_02',function(){
var dh=calc_dh(this);
filter_ajax(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this,0,0,0,0,dh+'px',0);
});
$('document,body').on('change','#f_height_18_25_03',function(){
var dh=calc_dh(this);
filter_ajax(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this,0,0,0,dh+'px',0);
});
$('document,body').on('change','#f_height_26_04',function(){
var dh=calc_dh(this);
filter_ajax(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,this,0,0,dh+'px',0);
});
$('document,body').on('change','#f_price_01',function(){
var dh=calc_dh(this);
filter_ajax(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,dh+'px',0);
});
Web 2.0 ...
+6
//Добавление/удаление товара в корзину, вывод содержиого
function itemInCart(id, price, count) {
...........
Вот такой он, универсальный JavaScript )