- 1
*new
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−40
*new
Самая соль.
+151
ISQ.Widget.ContactForm.clickEventHandler=function(a){
switch(a.result){
case ISQ.Forms.clickEventEnum.SUBMIT:
ISQ.Widget.Log.add("contactForm submit");
ISQ.Widget.ContactForm.send(a.formElements);
ISQ.Widget.ContactForm.close(true);
break;
case ISQ.Forms.clickEventEnum.CANCEL:
if(ISQ.Cnf.limited){
break
}
ISQ.Widget.Log.add("contactForm cancel");
if(a.query!==""){
ISQ.Widget.HTML.queryField.value=a.query
}
ISQ.Widget.ContactForm.canceled=true;
ISQ.Widget.ContactForm.close();
break;
case ISQ.Forms.clickEventEnum.ERROR:
ISQ.Widget.Log.add("contactForm input error");
break
}
};
Если честно, то тут автор даже удивил. Как-то раньше ни разу не пришлось два брейка в одном кейсе делать, все как-то одним обходился.
−84
data (,) a b = (,) a b
deriving Generic
data (,,) a b c = (,,) a b c
deriving Generic
data (,,,) a b c d = (,,,) a b c d
deriving Generic
.......
data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__ i__ j__
= (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_ l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ a__ b__ c__ d__ e__ f__ g__ h__ i__ j__
-- deriving Generic
{- Manuel says: Including one more declaration gives a segmentation fault.
Вот такая вот реализация туплов:
http://www.haskell.org/ghc/docs/7.4.1/html/libraries/ghc-prim-0.2.0.0/src/GHC-Tuple.html
+110
private void button6_Click(object sender, EventArgs e)
{
string str;
FileStream fs = new FileStream("file.data", FileMode.Open,FileAccess.Read);
BinaryReader br = new BinaryReader(fs, Encoding.UTF8);
try
{
while (true)
{
str = br.ReadString();
listBox1.Items.Add(str);
}
}
catch { MessageBox.Show("Файл file.data успешно считан", "Успех!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); }
fs.Close();
br.Close();
}
while (true)-изюминка конечно =)
а так это из курсовой первокурсницы, так что простительно
−366
d:/mingw/lib/gcc/../../x86_64-w64-mingw32/include/io.h:175:16: error: 'long long long' is too long for GCC
+162
function reverseStack()
{
$this->stackNotation = array_reverse($this->stackNotation);
$this->lenght = count($this->stackNotation);
return $this->lenght;
}
function calculateNotation()
{
$this->result = $this->stackNotation[0];
for($this->i = 1; $this->i < $this->lenght; $this->i++) {
$this->j = $this->i — 1;
switch($this->arifmeticSign[$this->j] ) {
case ’*’:
$this->result = $this->result * $this->stackNotation[$this->i];
...
новое слово в пэхэпэ-оопэ.
http://dou.ua/forums/topic/5548/
+106
private void ReferenceButton_Click(object sender, EventArgs e)
{
this.ContentBox.Controls.Remove(this.BooksPanel);
this.ContentBox.Controls.Remove(this.LogoPanel);
this.ContentBox.Controls.Remove(this.SearchPanel);
this.ContentBox.Controls.Add(this.FAQPanel);
}
Удаляем старые контролы таким образом)
Почти в 100% случаев найдется умник, который назовет любой код - говном.
+142
#include <dos.h>
#include <conio.h>
#include <graphics.h>
void pix(unsigned int x, unsigned int y, unsigned char c){
unsigned char nb, ms, bt; //nomerbit maska bite
unsigned int ofs; //sdvig
unsigned char *pb; //ukazatel na bit
ofs= x/8 + y*80;
nb=7-(x % 8);
pb=(unsigned char *)MK_FP(0xA000, ofs);
bt=*pb;
ms=1<<nb;
if( c !=0 ){
bt=bt | ms;
}else{
bt=bt&(~ms);
};
*pb=bt;
};
void main(){
int drDriver, grMode;
drDriver=VGA;
grMode=VGAHI;
initgraph(&drDriver, &grMode, "C:\\BORLANDC\\BGI");
pix(60,30,15);
getch();
};
13: где взял адрес
28,29: с чего ты решил, что для паскалевского драйвера подходят определения сишного драйвера?
30: почему драйвер паскалевский?
all: ебанный пиздец, кто ж так пишет...
+1000
while (cin >> v1 >> v2 >> t >> f >> c)
{
...
}
Олимпиадная задачка, на вход подается всего 5 чисел. Все решение находится внутри вышеприведенного while'а.
+1006
int main()
{
// инициализация графики
...
while (!kbhit())
{
int start = rand();
srand(start);
// рисуем фейерверк
for (int i = 0; i < 100; i++)
{
int x = rand();
int y = rand();
int color = rand();
putPixel(x, y, color);
}
sleep(100);
// стираем
srand(start);
for (int i = 0; i < 100; i++)
{
int x = rand();
int y = rand();
rand();
if (getPixelColor(x, y) != BLACK)
putPixel(x, y, BLACK);
}
}
return 0;
}
Вот такой пример использования графической библиотеки нам давали в институте. (Набирал по памяти т.к. я решил это с доски не переписывать.)