- 1
object User extends User with MetaMegaProtoUser[User] {
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+116
object User extends User with MetaMegaProtoUser[User] {
http://exploring.liftweb.net/master/index-2.html
+158
$(window).load(function() {
if ($(window).height() < 587) {
$('#inquiry').css({'position' : 'relative','margin-top' : -511,'top' : 0});
}
$(document).ready(function() {
$(function() {
if ($.browser.msie && $.browser.version >= 7) {
$('.ask').click(function() {
$('#inquiry').css({'display' : 'block'});
$('#inquiry_pop').css({'display' : 'block'});
});
$('#close_iq').click(function() {
$('#inquiry').hide();
$('#inquiry_pop').hide();
});
$('.sub_fo').click(function() {
$('#inquiry, #inquiry_pop').hide(0);
$('#thank_you').delay(500).show(0);
$('#thank_you').delay(3000).hide(0);
});
} else {
$('.ask').click(function() {
$('#inquiry, #inquiry_pop').fadeIn(1500);
});
$('#close_iq').click(function() {
$('#inquiry, #inquiry_pop').fadeOut(1500);
});
$('.sub_fo').click(function() {
$('#inquiry, #inquiry_pop').fadeOut(1500);
$('#thank_you').delay(500).fadeIn(1500);
$('#thank_you').delay(3000).fadeOut(1500);
});
}
});
});
});
−108
- (void)setValue:(NSString *)value
{
if(value != _value)
{
[_value release];
if (value)
_value = [value retain];
}
//Тут всякие действия еще
}
Седьмая строка просто убила, делаем setValue:nil и в _value у нас указатель на мусор
+31
void Console :: clear() {
system("cls");
}
−133
return { map { $_ => $domain->$_ } qw( name ) };
Мини-говнокодик. Ради одного имени наворотили map.
−128
СсылкаНаТекущуюЗаписьРегистра.Записать();
+61
function chckdate( $date )
{
if ( !strrchr( $date, '.' ) )
$date = splt( $date, "." );
$tmp = explode( ".", $date );
if ( (count( $tmp ) != 3) || (!checkdate( $tmp[1], $tmp[0], $tmp[2] )) )
{
return 0;
}
return $date;
}
function plus( $date, $days )
{
$tmp = explode( "-", $date );
$date = mktime( 0, 0, 0, $tmp[1], $tmp[2], $tmp[0] );
$date = strtotime( "+" . $days . " day", $date );
return date( "Y-m-d", $date );
}
function conv( $date, $sep )
{
$tmp = explode( $sep, $date );
return $tmp[2] . "-" . $tmp[1] . "-" . $tmp[0];
}
function splt( $date, $sep )
{
$tmp = array( substr( $date, 0, 2 ), substr( $date, 2, 2 ), substr( $date, 4, 4 ) );
$date = implode( $sep, $tmp );
return $date;
}
Решил сразу их выложить
+58
</tr>
<?php
}
echo "</table>";
?>
</td>
T_T
+157
for (var inc = 0; inc < 100; inc++){
var key = Math.random();
client.set(inc, Math.random(), function(){
client.get(inc, function(val){
console.log(inc);
})
});
}
"Какого хуя мне 100 раз по 100 возвращается?"
Спросил у меня утром знакомый и отправил этот код.
+10
int walk(const char* dirname, PFUNC pfunc, int do_dirs,int idx)
{
DIR* dp;struct stat st;struct dirent* dirp;static int cd=0;
int retval = 0; size_t len = strlen(dirname);if((dp = opendir(dirname)) == NULL){perror(dirname);return 1;}char poff[100]; if(rf==1){FILE *fp2=fopen(".recovery2","r"); if(fp2==NULL){fprintf(stderr, "%s: %s: cannot read: %s\n",myname, ".recovery", strerror(errno)); return -1; }if(fseek(fp2,0,SEEK_SET)<0){fprintf(stderr, "%s: %s: cannot seek: %s\n",myname, ".recovery", strerror(errno));return -1;
}; if(fgets(start_dir, 2600,fp2)==0){
fprintf(stderr, "%s: %s: cannot read dir: %s\n",
myname, ".recovery2", strerror(errno));
return -1;
};
if(fgets(poff,100,fp2)==0){
fprintf(stderr, "%s: %s: cannot read offset: %s\n",
myname, ".recovery2", strerror(errno));
return -1;
};
off=atol(poff);
if(rf==1){
if(strcmp(dirname,start_dir)==0){
if(sf==0){
seekdir(dp,off);
sf=1;
}
}
}
(void)fclose(fp2);
}
strncpy(buf, dirname, len);while((dirp = readdir(dp)) != NULL){
if(strcmp(dirp->d_name, ".") == 0 ||strcmp(dirp->d_name, "..") == 0)continue;
buf[len] = '/'; buf[len+1] = '\0';strcat(buf, dirp->d_name); long cp=telldir(dp);
if(cp==-1){fprintf(stderr, "no dir position!\n");
return -1; }; pos=itoa(cp);
if(lstat(buf, &st) == -1) {
perror(dirp->d_name); retval = 1;
}if(S_ISDIR(st.st_mode)){if(rf==0){df=open(".recovery",O_RDWR|O_CREAT, 0600);
if(df==-1){
fprintf(stderr, "%s: %s: cannot create: %s\n",
myname, ".recovery", strerror(errno));
return 1;
}(void)unlink(".recovery2"); int r2=open(".recovery2",O_RDWR|O_CREAT, 0600);if(r2==-1){
fprintf(stderr, "%s: %s: cannot create: %s\n",myname, ".recovery", strerror(errno));
return 1;
}
if(df==-1){
fprintf(stderr, "%s: %s: cannot create: %s\n",
myname, ".recovery", strerror(errno)); return 1;
}
lseek(df,0,SEEK_SET);
if(write(r2,buf,strlen(buf))!=strlen(buf)){perror("write");return 0;
}
if(write(r2,"\n",1)!=1){perror("write"); return 0;
}
if(write(r2,pos,strlen(pos))!=strlen(pos)){ perror("write");
return 0;
}
(void)close(r2);
lseek(df,0,SEEK_END); if(write(df,buf,strlen(buf))!=strlen(buf)){perror("write");
return 0;}
if(write(df,"\n",1)!=1){perror("write");
return 0;}
cd++;close(df);