Most of the code I've written has bad parts in it, but they're all either inefficient and superficially good-looking or too esoteric for anyone else to make sense of. On the whole, my tripcode searcher isn't one of these, and I think it has much cleaner code than certain other things named OpenSSL.
Except for this line in the SHA-1 function.
((unsigned long long*)shatemp)[(ilen + (56-(ilen%64)))/8] = ilen*8;
I'd have replaced it with something cleaner and more reasonable for compiler internals, but I have to admit that I'm not quite sure how it works anymore.
(http://astrange.ithinksw.net/tools/tripper/sha1.c)
There's quite a lot of stuff over at http://thedailywtf.com/ as well.
I use to write really short codes. Many one liners. But then I had this hellish crazy comp sci prof who forced every student to write code the way he did. His style was whether inefficient or not, your code was be so readable that even a layman can see whats going on.
Now after that traumatic experience Ive been stuck writing readable code not caring about efficiency.
(continuation)
And that meant like if the code was all crammed into one line, he will demand you put each bit in its own line.
And spaces after every curve bracket....
From Thorn's Administration templates:
Delete cache: <input type="checkbox" value="fragcache" />
"Dammit, why doesn't the 'Delete cache' function trigger?"
After weeks, I just figured this one out earlier today. What a moron. (Of course, it should be name="fragcache"
, not value
. Dumbass.)
The code I had to implement to get around the problem I was ranting about in http://4-ch.net/code/kareha.pl/1124146196/ got pretty horribly dumb. What I needed to do was to find out when a drag ended outside my view, even if I didn't accept the drag when it was inside. The problem is that if I didn't accept it, I got sent a dragExited
message when the user released the button, thus I couldn't rely on simply keeping track on entered and exited messages.
-(void)dragImage:(NSImage *)image at:(NSPoint)loc offset:(NSSize)offset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)src slideBack:(BOOL)slide
{
[super dragImage:image at:loc offset:offset event:event pasteboard:pboard source:src slideBack:NO];
outside=NO;
suggest_outside=NO;
}
-(NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
outside=NO;
return [super draggingEntered:sender];
}
-(void)draggingExited:(id <NSDraggingInfo>)sender
{
suggest_outside=YES;
[super draggingExited:sender];
}
-(void)draggedImage:(NSImage *)draggedImage movedTo:(NSPoint)screenPoint
{
if(suggest_outside)
{
outside=YES;
suggest_outside=NO;
}
}
-(void)draggedImage:(NSImage *)image endedAt:(NSPoint)point operation:(NSDragOperation)op
{
if(outside&&op!=NSDragOperationEvery)
{
// do stuff when dropped outside view
}
}