1. Список говнокодов пользователя gerasim13

    Всего: 3

  2. JavaScript / Говнокод #19985

    +5

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    $(document).on('click', 'a.switcher_link', function(e) {
        e.preventDefault();
        var btn = $(this);
        $.getJSON(btn.attr('href'), {type: 'json'}, function(data) {
          btn.parent().parent().parent().parent().parent().parent().parent().parent().replaceWith(data.data);
        });
      });

    Нашел и ахуел....

    gerasim13, 11 Мая 2016

    Комментарии (10)
  3. Ruby / Говнокод #18505

    −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
    begin
          # Это пиздец
          artist_title = row.title.split(/ - /)
          if artist_title.length > 1
            row.artist = artist_title[0]
            row.title  = artist_title[1]
          else
            artist_title = row.title.split(/ — /)
            if artist_title.length > 1
              row.artist = artist_title[0]
              row.title  = artist_title[1]
            else
              artist_title = row.title.split(/ - /)
              if artist_title.length > 1
                row.artist = artist_title[0]
                row.title  = artist_title[1]
              else
                artist_title = row.title.split(/ – /)
                if artist_title.length > 1
                  row.artist = artist_title[0]
                  row.title  = artist_title[1]
                else
                  artist = row.title.match(/\((.*?)\)/)
                  artist = artist.captures[0]
                  # puts artist_title
                  # puts row.title
                  # puts artist
                  row.artist = artist
                  row.title  = row.title.gsub('('+artist+')', '').strip
                end
              end
            end
          end
        rescue
          next
        end

    gerasim13, 21 Июля 2015

    Комментарии (44)
  4. Си / Говнокод #17534

    +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
    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
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    void MSSequencerPatternCopyToMusicTrack(MSSequencerPatternRef self, MusicTrack track)
    {
        // Get signature and length of pattern
        TimeSignature sign   = MSSequencerPatternGetTimeSignature(self);
        CABarBeatTime length = pattern_barbeat_duration_without_mutes(self);
        CABarBeatTime insert = CABarBeatTime(1, 1);
        // Get muted beats
        CFRange *mutedBeats = (CFRange*)CFDataGetBytePtr(self->mutedBeats);
        CFIndex  mutedCount = CFDataGetLength(self->mutedBeats) / sizeof(CFRange);
        // Copy with muted regions
        if (mutedCount > 0)
        {
            // Clear output track
            MSSequencerTrackClear(self->parent, track);
            // Copy phrase by phrase
            for (int i = 0; i < mutedCount; ++i)
            {
                CFRange muteRange  = mutedBeats[i];
                CFIndex beatsCount = (sign.numerator * sign.denominator);
                
                if ((beatsCount * (i + 1)) > muteRange.location + muteRange.length)
                {
                    if (muteRange.length > 0)
                    {
                        // Copy beats before mute range
                        if (muteRange.location > (beatsCount * i))
                        {
                            CFIndex start = (beatsCount * i);
                            CFIndex end   = muteRange.location;
                            insert = copy_beats_to_track_from_beat_to_beat(self, track, sign, insert, start, end);
                        }
                        // Copy beats after range
                        {
                            CFIndex start = (muteRange.location + muteRange.length);
                            CFIndex end   = (beatsCount * (i + 1));
                            insert = copy_beats_to_track_from_beat_to_beat(self, track, sign, insert, start, end);
                        }
                    }
                    else
                    {
                        // Copy without mutes
                        CFIndex start = (beatsCount * i);
                        CFIndex end   = (beatsCount * (i + 1));
                        insert = copy_beats_to_track_from_beat_to_beat(self, track, sign, insert, start, end);
                    }
                }
                else
                {
                    // Copy beats
                    CFIndex firstBeat = (muteRange.location + muteRange.length) % beatsCount;
                    CABarBeatTime start = CABarBeatTimeAddBeats(CABarBeatTime(1, 1), sign, (beatsCount * i) + firstBeat);
                    CABarBeatTime end   = CABarBeatTimeAddBeats(start, sign, (beatsCount - muteRange.length));
                    copy_beats_from_pattern_to_track(self, track, start, end, insert);
                    //CFLog("start: {%i, %i}, end: {%i, %i}, insert: {%i, %i}", (int)start.bar, (int)start.beat, (int)end.bar, (int)end.beat, (int)insert.bar, (int)insert.beat);
                    // Update insert time
                    insert = CABarBeatTimeAddBeats(insert, sign, (beatsCount - muteRange.length));
                }
            }
        }
        // Copy without muted regions
        else
        {
            copy_beats_from_pattern_to_track(self, track, insert, length, insert);
        }
        //CAShow(track);
    }

    Вот такая вот какашечка...

    gerasim13, 28 Января 2015

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