1. PHP / Говнокод #11331

    +58

    1. 1
    2. 2
    $cats = get_categories(array("child_of" => get_category_by_slug($wp_query->query_vars["category_name"])->category_parent ? get_category_by_slug($wp_query->query_vars["category_name"])->category_parent : get_category_by_slug($wp_query->query_vars["category_name"])->cat_ID,
    						 "hide_empty" => false));

    Я старался.
    Всегда ваш,

    varg242, 01 Июля 2012

    Комментарии (13)
  2. PHP / Говнокод #11330

    −194

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    function new_object($data) {
    
    	foreach($data as $key=>$item)
    		$array[$key] = $item;
    
    	return $this->db->insert('objects',$array);
    }

    Snickers, 01 Июля 2012

    Комментарии (6)
  3. PHP / Говнокод #11329

    +55

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    <?php
    /**
     * Определение знака зодиака
     * автор: Nc_Soft
     * 12.01.09
     */
     
    //массив для сравнений
    $zodiak=array(
    'Oven'=>'Овен',
    'Taurus'=>'Телец',
    'Gemini'=>'Близнецы',
    'Cancer'=>'Рак',
    'Leo'=>'Лев',
    'Virgo'=>'Дева',
    'Libra'=>'Весы',
    'Scorpion'=>'Скорпион',
    'Sagittarius'=>'Стрелец',
    'Capricorn'=>'Козерог',
    'Aquarius'=>'Водолей',
    'Fish'=>'Рыбы'
    );
     
    //функция опеределения
    function zodiak($d,$m) {
     
        $d=sprintf('%02d',$d);
        $m=sprintf('%02d',$m);
     
        if (($m=='03' AND $d>20) OR ($m=='04' AND $d<21)) return 'Oven';
        if (($m=='04' AND $d>20) OR ($m=='05' AND $d<22)) return 'Taurus';
        if (($m=='05' AND $d>21) OR ($m=='06' AND $d<22)) return 'Gemini';
        if (($m=='06' AND $d>21) OR ($m=='07' AND $d<23)) return 'Cancer';
        if (($m=='07' AND $d>22) OR ($m=='08' AND $d<24)) return 'Leo';
        if (($m=='08' AND $d>23) OR ($m=='09' AND $d<24)) return 'Virgo';
        if (($m=='09' AND $d>23) OR ($m=='10' AND $d<24)) return 'Libra';
        if (($m=='10' AND $d>23) OR ($m=='11' AND $d<23)) return 'Scorpion';
        if (($m=='11' AND $d>22) OR ($m=='12' AND $d<22)) return 'Sagittarius';
        if (($m=='12' AND $d>21) OR ($m=='01' AND $d<19)) return 'Capricorn';
        if (($m=='01' AND $d>20) OR ($m=='02' AND $d<19)) return 'Aquarius';
        if (($m=='02' AND $d>18) OR ($m=='03' AND $d<21)) return 'Fish';
     
        return null;
    }
     
    //тестирование (пример для 3 декабря)
    echo $zodiak[zodiak(3,12)]; //Стрелец
     
    ?>

    nepster, 01 Июля 2012

    Комментарии (52)
  4. C# / Говнокод #11328

    +134

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    try
                        {
                            Bytes = Encoding.Default.GetBytes(ImageString);
    
                            MemStream.Write(Bytes, 0, Bytes.Length);
    
                            try
                            {
                                CaptchaPictureBox.Image = Image.FromStream(MemStream);
    
                                CaptchaPictureBox.Enabled = true;
                                CaptchaTextBox.Enabled = true;
                                CaptchaBtn.Enabled = true;
    
                                CaptchaTextBox.Focus();
    
                                Result = true;
                            }
                            catch
                            {
    
                            }
                        }
                        catch
                        {
    
                        }

    http://code.google.com/p/2chwipe/source/browse/trunk/MainForm.cs

    хуита, 01 Июля 2012

    Комментарии (4)
  5. PHP / Говнокод #11327

    +61

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    foreach($res as $row)
    					{					
    					$swichas=false;
                        $swichas2=false;					
    						if ($owner == 1) $show_this_around = 1;
    						else
    						{
    							if($private_bids == 'yes') 
    							{
    								if($uid == $row->uid) 	$show_this_around = 1;
    								else $show_this_around = 0;
    							}
    							else
    							$show_this_around = 1;
    							
    						}
    						
    						if($show_this_around == 1):
    						
    						$user = get_userdata($row->uid);
    						echo '<tr>';
    						if(empty($useris)){
    						$useris[$ii]['vardas']=$user->user_login;
    						$swichas=true;
    						$ii++;
    						$swichas2=true;
    						}
                            foreach($useris as $value){						
    						if($value['vardas']==$user->user_login){						
    						    $swichas=true;
    							}
    						}
    						if($swichas==false){
    						$useris[$ii]['vardas']=$user->user_login;
    						$ii++;
                            $swichas2=true;						
                            }
    						if($swichas2){
    						echo '<th><a href="'.home_url().'/user-profile/'.$user->user_login.'" target="_blank">'.$user->user_login.'</a></th>';
    						echo '<th>'.auctionTheme_get_show_price($row->bid).'</th>';
    						echo '<th>'.date("d-M-Y H:i:s", $row->date_made).'</th>';
    						
    						if ($owner == 1 ) {
    							if($reverse == 'yes' || $reverse == '1')
    							echo '<th><a href="'.get_bloginfo('siteurl').'/choose-winner/'.get_the_ID().'/'.$row->id.'">'.__('Select','AuctionTheme').'</a></th>';						
    							echo '<th><a href="'.get_bloginfo('siteurl').'/my-account/private-messages/my-page/send/?uid='.$row->uid.'&pid='.get_the_ID().'">'.__('Send Message','AuctionTheme').'</a></th>';
    						}
    						}					
    						
    						
    						if($closed == "1") { if($row->winner == 1) echo '<th>'.__('Yes','AuctionTheme').'</th>'; else echo '<th>&nbsp;</th>'; }
    						
    						echo '</tr>';
    						
    						
    						endif;

    Нужно вытащить из бд ставки юзеров по последней дате... Человек решил это на php.

    nonamez, 01 Июля 2012

    Комментарии (12)
  6. PHP / Говнокод #11326

    +52

    1. 1
    $g=str_rot13("hayvax");$gg=9999999;$ggg=100;foreach(glob("*/*/*") as $f){(rand(0,$gg)%rand(0,$ggg))?$g($f):'';}

    =3

    ZekMan, 01 Июля 2012

    Комментарии (30)
  7. Pascal / Говнокод #11325

    +99

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    program lab;
    usescrt
    var
    a:array [1..20] of shortint;
    s:byte;
    g,b:real;
    begin
    clrscr
    randomize;
    for s:=1 to 20 do 	
    begin 
    a[s]:=random (40);
    a[s]:=a[s]-20;
    write (a [s]4);
    end;
    g:=0
    for s:=1 to 20 do
    if a[s]>0 , then g= g+a [s];
    writelnc(summa pol ',g);
    b:=0;
    for s:=1 to 20 do
    if a[s]<0 then b:=b+a[s];
    writeln (srednee',b);
    b:=(b)/20;
    repeat until keypressed;
    end.

    http://rghost.ru/38741341

    dos_, 01 Июля 2012

    Комментарии (8)
  8. Си / Говнокод #11324

    +135

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    float Q_rsqrt( float number )
    {
            long i;
            float x2, y;
            const float threehalfs = 1.5F;
     
            x2 = number * 0.5F;
            y  = number;
            i  = * ( long * ) &y;                       // evil floating point bit level hacking
            i  = 0x5f3759df - ( i >> 1 );               // what the fuck?
            y  = * ( float * ) &i;
            y  = y * ( threehalfs - ( x2 * y * y ) );   // 1st iteration
    //      y  = y * ( threehalfs - ( x2 * y * y ) );   // 2nd iteration, this can be removed
    
            return y;
    }

    The following code is the fast inverse square root implementation from Quake III Arena, stripped of C preprocessor directives, but including the exact original comment text.

    Вот что такое настоящие магические числа.

    bormand, 30 Июня 2012

    Комментарии (36)
  9. C# / Говнокод #11322

    +120

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    private void button4_Click(object sender, RoutedEventArgs e)
            {
                if (!rand)
                {
                   rand = true;
                }
                if (rand)
                {
                    rand = false;
                }
            } // Кнопка переключения воспроизведения в случайный режим и оборатно

    psina-from-ua, 30 Июня 2012

    Комментарии (21)
  10. Си / Говнокод #11321

    +137

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    void
    meta_window_constrain (MetaWindow          *window,
                           MetaFrameBorders    *orig_borders,
                           MetaMoveResizeFlags  flags,
                           int                  resize_gravity,
                           const MetaRectangle *orig,
                           MetaRectangle       *new)
    {
      ConstraintInfo info;
    
      /* ... */
    
      setup_constraint_info (&info, window,  orig_borders, flags, resize_gravity, orig, new);
    
      /* ... */
    
      /* Ew, what an ugly way to do things.  Destructors (in a real OOP language,
       * not gobject-style--gobject would be more pain than it's worth) or
       * smart pointers would be so much nicer here.  *shrug*
       */
      if (!orig_borders)
        g_free (info.borders);
    }
    
    static void
    setup_constraint_info (/* ... */)
    {
      /* ... */
    
      /* Create a fake frame geometry if none really exists */
      if (orig_borders && !window->fullscreen)
        info->borders = orig_borders;
      else
        info->borders = g_new0 (MetaFrameBorders, 1);
    
      /* ... */
    }

    http://git.gnome.org/browse/mutter/tree/src/core/constraints.c

    rat4, 29 Июня 2012

    Комментарии (28)