1. ActionScript / Говнокод #14432

    −121

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    private function taskResizer_resizeFinished(event:ResizerEvent):void {
                var width:int = event.width;
                var height:int = event.height;
                task.changeSize(width, height);
                // Wake up bindings
                var zones:* = zones; // AHAHAHHAHAHA
                this.zones = null;
                this.zones = zones;
                taskResizer.width = width;
                taskResizer.height = height;
            }

    Апдейт биндингов и контрольный выстрел в (шестой) строке.

    maleka, 28 Января 2014

    Комментарии (20)
  2. ActionScript / Говнокод #14349

    −117

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    //try setting up POST request, if failed settle with GET
            try {
                if (url_variables == null || (params && params.method == URLRequestMethod.GET)) throw new ArgumentError();
                url_request.data = url_variables;
                url_request.method = URLRequestMethod.POST;
            }
            catch(er:Error) {
                url_request.url = url;
                url_request.method = URLRequestMethod.GET;
            }

    Ветвление с помощью try..catch.
    Возьму себе на заметку.

    strax, 13 Января 2014

    Комментарии (7)
  3. ActionScript / Говнокод #14265

    −118

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    public static function cancel (tween : T) : void {
        delete _dict[tween];
    }
    
    public function cancel () : void {
        delete _dict[this];
    }

    Пыщ пыщ, я развлекаюсь

    kyzi007, 23 Декабря 2013

    Комментарии (111)
  4. ActionScript / Говнокод #14079

    −152

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    protected function get_resource_getter(xml:XML,name:String):Function {
            try {
                var getter:Function = this["get_"+name+"_xml"] as Function;
    
                return function():int{ return getter(xml)};
            } catch (e:*) {}
            if(xml.attribute(name).length()==0){
                return null;
            }
            return function():int{ return get_resource_xml(xml,name)};
        }

    Задача стояла предельно простая: получить количество некоторого игрового ресурса.
    Автор подошел к решению неординарно.

    strax, 07 Ноября 2013

    Комментарии (13)
  5. ActionScript / Говнокод #13927

    −92

    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
    package
    {
        import flash.display.Stage;
    
        public class StageLocator {
    
            public static var instance:StageLocator;
    
            public static var stage:Stage;
    
            public function StageLocator (_stage:Stage) {
    
                instance = this;
    
                stage = _stage;
            }
        }
    }

    Гадаю, в чем же заключается сокровенный смысл instance и вообще этого класса.

    strax, 10 Октября 2013

    Комментарии (29)
  6. ActionScript / Говнокод #13787

    −121

    1. 1
    if(!(plant is CropBase && !(plant is TreeBase)))

    Гениально-простое построение выражения

    strax, 13 Сентября 2013

    Комментарии (10)
  7. ActionScript / Говнокод #13129

    −170

    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
    public function set flip(value:Boolean):void {
        if (this.object.flip != value) {
            this.object.flip = value;
            this.clearCells();
            var cell:Cell = this.cell;
        }
    }
    
    public function get cell():Cell {
        if (!this._cell) {
            createCell();
        }
        return this._cell;
    }

    Ненавижу подергивание.

    kyzi007, 07 Июня 2013

    Комментарии (40)
  8. ActionScript / Говнокод #13010

    −89

    1. 1
    2. 2
    if (view_clip.parent.contains(view_clip))
      view_clip.parent.removeChild(view_clip);

    это надо было до такого додуматься

    slavara, 16 Мая 2013

    Комментарии (24)
  9. ActionScript / Говнокод #13000

    −86

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    ...
    _testMode = new uint(1);
    ...
    _appID =  new String("blah_blah");
    ...

    Продолжаю вкуривать в новый чужой проект. Не устает радовать.

    crazy_horse, 14 Мая 2013

    Комментарии (85)
  10. ActionScript / Говнокод #12985

    −163

    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
    public function algorithmChanged(arg1:flash.events.Event):*
            {
                var loc1:*;
                loc1 = null;
                if (currentAlgorithm != null)
                    removeChild(currentAlgorithm);
                loc1 = arg1.target.selectedLabel;
                currentAlgorithm = null;
                animationManager.resetAll();
                if (loc1 != "Heap")
                    if (loc1 != "Comparison Sort")
                        if (loc1 != "Counting Sort")
                            if (loc1 != "Bucket Sort")
                                if (loc1 != "Radix Sort")
                                    if (loc1 != "Heap Sort")
                                        if (loc1 != "Binary Search Tree")
                                            if (loc1 != "AVL Tree")
                                                if (loc1 != "Open Hashing")
                                                    if (loc1 != "Closed Hashing")
                                                        if (loc1 != "Graph")
                                                            if (loc1 != "DFS")
                                                                if (loc1 != "BFS")
                                                                    if (loc1 != "Connected Components")
                                                                        if (loc1 != "Dijkstra")
                                                                            if (loc1 != "Prim")
                                                                                if (loc1 != "Kruskal")
                                                                                    if (loc1 != "Topological Sort")
                                                                                        if (loc1 != "Floyd-Warshall")
                                                                                            if (loc1 != "B Tree")
                                                                                                if (loc1 != "Binomial Queue")
                                                                                                    if (loc1 != "Disjoint Sets")
                                                                                                        if (loc1 != "Array Stack")
                                                                                                            if (loc1 != "Array Queue")
                                                                                                                if (loc1 != "Linked List Stack")
                                                                                                                    if (loc1 != "Linked List Queue")
                                                                                                                        if (loc1 != "Red Black Tree")
                                                                                                                            if (loc1 != "Closed Hashing (buckets)")
                                                                                                                                if (loc1 == "B+ Tree")
                                                                                                                                {
                                                                                                                                    currentAlgorithm = new BPlusTree(animationManager);
                                                                                                                                    addChildAt(currentAlgorithm, 0);
                                                                                                                                }
                                                                                                                            else 
                                                                                                                            {
                                                                                                                                currentAlgorithm = new ClosedHash2(animationManager);
                                                                                                                                addChildAt(currentAlgorithm, 0);
                                                                                                                            }
                                                                                                                        else 
                                                                                                                        {
                                                                                                                            currentAlgorithm = new RedBlackTree(animationManager);
                                                                                                                            addChildAt(currentAlgorithm, 0);
                                                                                                                        }
    и т.д. пока не закроются все if'ы

    Визуализатор сортировок университета Сан-Франциско

    alexprey, 12 Мая 2013

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