1. Лучший говнокод

    В номинации:
    За время:
  2. PHP / Говнокод #25736

    −2

    1. 1
    2. 2
    Мне было 8, я видел пхп
    Теперь мне 28, а пхп говно

    Ksyrx, 29 Июля 2019

    Комментарии (20)
  3. JavaScript / Говнокод #25735

    +1

    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
    parse: function() {
                    let c = dstack[dstack.length - 1];
                    c = c == ' ' ? '\\s' : s.replace(/[^\w\s]/g, '\\$&');
                    const regex = new RegExp('^[^' + c + ']*', 'g');
                    const match = regex.exec(rest_source);
                    dstack.push(match[0]);
                    rest_source = rest_source.slice(regex.lastIndex, rest_source.length);
                    output.push(match[0]);
                },
                word: function() {
                    let c = dstack[dstack.length - 1];
                    c = c == ' ' ? '\\s' : s.replace(/[^\w\s]/g, '\\$&');
                    const regex = new RegExp('^[' + c + ']*', 'g');
                    const match = regex.exec(rest_source);
                    rest_source = rest_source.slice(regex.lastIndex, rest_source.length);
                    output.push(match[0]);
                    words.parse();
                },
                name: function() {
                    dstack.push(' ');
                    words.word();
                },

    /докт[ао]р,?\s*у\s*м[еи]ня\s*регулярк[аои]\s*г[ао]л[ао]вного\s*мо(ск|зг)а/i

    666_N33D135, 27 Июля 2019

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

    +1

    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
    function getCartMiniViewDisplayString($cart_entries) {
        $count = $cart_entries->getProductCount();
        $suffix = "";
        $remainder = $count % 10;
        switch($remainder) {
            case 1:
                $suffix = " товар";
                break;
            case 2:
            case 3:
            case 4:
                $suffix = " товара";
                break;
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 0:
                $suffix = " товаров";
                break;
        }
        return $count . $suffix;
    }

    Мой, переписывать с if в лень.

    OlegUP, 06 Апреля 2019

    Комментарии (20)
  5. Python / Говнокод #25447

    0

    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
    import sqlite3
    from bs4 import BeautifulSoup
    import requests, hashlib
    from io import open as iopen
    from urlparse import urlsplit
    
    def md5sum(filename, blocksize=65536):
    	hash = hashlib.md5()
    	with open(filename, "rb") as f:
    		for block in iter(lambda: f.read(blocksize), b""):
    			hash.update(block)
    	return hash.hexdigest()
    
    def parse_image_url(url):
    	html_doc = requests.get(url).text
    	soup = BeautifulSoup(html_doc, 'html.parser')
    	first = soup.find(class_='postContainer')
    	two = first.find_all('img')
    	requests_image(two[1].get('src'))
    
    def unic_check(file_name):
    	check_sum = md5sum(file_name)
    	if c.execute("SELECT * FROM sums WHERE sum = '%s'" % check_sum) != None:
    		cur.close()
    		conn.close()
    		return
    	else:
    		c.execute("INSERT INTO sums VALUES (%s)" % check_sum)
    		c.commit()
    		cur.close()
    		conn.close()
    		return
    
    def requests_image(file_url):
    	suffix_list = ['jpg', 'gif', 'png', 'tif', 'svg',]
    	file_name =  urlsplit(file_url)[2].split('/')[-1]
    	file_suffix = file_name.split('.')[1]
    	i = requests.get(file_url)
    	if file_suffix in suffix_list and i.status_code == requests.codes.ok:
    		with iopen(file_name, 'wb') as file:
    			file.write(i.content)
    	else:
    		return False
    	unic_check(file_name)
    
    def main():
    	Anime_types = ['http://anime.reactor.cc/tag/Anime+%D0%9D%D1%8F%D1%88%D0%B8', 'http://anime.reactor.cc/tag/Anime+Cosplay', 'http://anime.reactor.cc/tag/Anime+%D0%9A%D0%BE%D0%BC%D0%B8%D0%BA%D1%81%D1%8B', 'http://anime.reactor.cc/tag/Anime+Art']
    	global conn
    	global c
    	conn = sqlite3.connect('anime.db')
    	c = conn.cursor()
    	for x in Anime_types:
    		parse_image_url(x)
    		
    if __name__ == "__main__":
    	main()

    marataziat, 13 Марта 2019

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

    0

    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
    <?php 
    require_once("JavaScriptPacker.php");
    function pack_js($input){
    	return (new \JavaScriptPacker($input, 62, TRUE, FALSE))->pack();
    }
    ?>
    
    <script>
    <?php ob_start("pack_js"); ?>
    //awal penulisan javascript
    alert('Hello world');
    //akhir penulisan javascript
    <?php ob_end_flush(); ?>
    </script>

    Нужно угадать для чего нужен JavaScriptPacker

    OCETuHCKuu_nemyx, 18 Февраля 2019

    Комментарии (20)
  7. Python / Говнокод #25350

    −1

    1. 1
    # -- coding: cp866 --

    https://github.com/h4ckzard/wpseyes/blob/master/Windows/wpseyes.py
    В чём это писалось???

    syoma, 02 Февраля 2019

    Комментарии (20)
  8. JavaScript / Говнокод #25317

    +2

    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
    (function(_){
    _.mixin({makeCarouselWidget: function (container, el, width, height, tmpl) {
        var list_of_rows = _(container).groupBy(function(e, index){
            return Math.floor(index / (width * height));
        });                                             // transform collection to list by 'num_of_cols' chunks
        _(list_of_rows).each(function(row){
            var list_of_chunks = _(row).groupBy(function(e, index){
                return Math.floor(index/width);
            });
            var li = $('<li>').appendTo(el);
            _.each(list_of_chunks, function(chunk){
                var r = $('<div>').attr('class','row fooitem')
                    .attr('style', "margin-right:50px;").appendTo(li);
                _.each(chunk, function(item){
                    r.append(
                        tmpl.render(item)
                    );
                });
            })
        });                                             // each list_of_rows
    }});
    })(_);

    Я хочу быть кочегаром, кочегаром, кочегаром.
    Работать сутки-через-трое, через-трое, через-трое...

    gueest8, 20 Января 2019

    Комментарии (20)
  9. Куча / Говнокод #25189

    +1

    1. 1
    Откуда пошло выражение "... тебе за щеку, проверь"?

    LinuxGovno, 13 Декабря 2018

    Комментарии (20)
  10. Swift / Говнокод #24885

    0

    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
    enum ErrorViewHelper {
    
        static var errorIsShown = false
        static var errorView: ErrorView?
    
        private static var errorWindow: UIWindow = {
            let width = (UIApplication.shared.delegate as? AppDelegate)?.window?.frame.size.width ?? 300
            let window = UIWindow(frame: CGRect(x: 0, y: 0, width: width, height: 300))
            return window
        }()
    
        static func show(error: Error) {
            if let error = error as? RequestError {
                switch error {
                case .error(description: let text):
                    showErrorView(error: text)
                case .errorWithMeta(description: let text, meta: _):
                    showErrorView(error: text)
                case .needAuthError:
                    showErrorAlert(title: nil, message: R.string.localizable.needAuthError()) {
                        // TODO: remove router from this class
                        AuthRouterImpl().showAuthPage()
                        AuthRouterImpl().showAuthFlowModally()
                    }
                case .badResponse:
                    showErrorView(error: R.string.localizable.badResponse())
                default: break
                }
            } else {
                showErrorView(error: error.text)
            }
        }

    vkasci, 09 Октября 2018

    Комментарии (20)
  11. Куча / Говнокод #24751

    0

    1. 1
    2. 2
    3. 3
    4. 4
    https://r.mradx.net/img/02/039F10.png
    
    
    Даже такой гигант, как "Mail.Ru", использует "SQL". А вы продолжайте подтекать от "NoSQL"-говна.

    tuberkulez, 12 Сентября 2018

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