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

    −91

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    public function clearGrid():void
    {
    	if(clearGrid != null)
    	{
    		if (selectedChild is AbstractIssueGrid)
    		{
    			(selectedChild["setGridDataProvider"] as Function) (new ArrayCollection());
    		}
    	}
    }

    Держите меня семеро Х_х

    dimas_art, 30 Июня 2010

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

    −93

    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
    if (!DocumentClass.getInstance().branding)
        DocumentClass.getInstance().branding = new Branding;
    if (!DocumentClass.getInstance().encryption)
        DocumentClass.getInstance().encryption = new TEAEncryption;
     if (!DocumentClass.getInstance().eventManager)
        DocumentClass.getInstance().eventManager = new EventManager;
     if (!DocumentClass.getInstance().panelManager)
        DocumentClass.getInstance().panelManager = new PanelManager;
     if (!DocumentClass.getInstance().playLogger)
        DocumentClass.getInstance().playLogger = new PlayLogger;
     if (!DocumentClass.getInstance().sharedObject)
        DocumentClass.getInstance().sharedObject = new SharedObjectManager;
     if (!DocumentClass.getInstance().soundManager)
        DocumentClass.getInstance().soundManager = new SoundManager;
     if (!GameDocumentClass.getInstance().dataManager)
        GameDocumentClass.getInstance().dataManager = new DataManager;

    Кусочек template для игростроя :)

    dimas_art, 08 Июня 2010

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

    −172

    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
    private static function copyByteArray(source:ByteArray, destination:ByteArray, length:uint = 0):void
        {
            var oldPosition:int = source.position;
    
            source.position = 0;
            destination.position = 0;
            var i:uint = 0;
    
            while (source.bytesAvailable > 0 && i < length)
            {
                destination.writeByte(source.readByte());
                i++;
            }
    
            source.position = oldPosition;
            destination.position = 0;
        }

    Только вы не думайте, что это школьная лаба. Это все он же родимый, Flex framework, mx.utils.Base64Decoder, прошу любить и жаловать! :)
    Для тех, кто не в курсе, у ByteArray есть "родные" методы readBytes и writeBytes которые делают то, что описано в этом методе, ну только в пару раз быстрее...

    wvxvw, 05 Июня 2010

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

    −87

    1. 1
    if(_smcWindowContent._smcShowOnStartup.contains(_smcWindowContent._smcShowOnStartup._sbtShowHelpOn))_smcWindowContent._smcShowOnStartup.removeChild(_smcWindowContent._smcShowOnStartup._sbtShowHelpOn);

    (c) Tom Wrasseller Flash Lead of Arkadium Games

    dimas_art, 19 Мая 2010

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

    −86

    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
    _data_provider.request(DataProvider.GET_USER_INFO,
    {
    	onComplete: function(data) 
    	{
    		self._user_info.user_id = data.user_id; 
    		self._user_info.user_name = data.user_name;
    
    		// Make next request after 500 ms delay because of API restriction (3 reqsts per second)
    		setTimeout(function()
    		{
    			self._data_provider.request(DataProvider.GET_SERVER_TIME, 
    			{
    				onComplete: function(data) 
    				{
    					var current_time = (new Date()).getTime();
    					self._time_offset = current_time - parseInt(data) * 1000;
    					dispatchEvent(new DataAccessEvent(DataAccessor.INIT));
    				}
    			});
    		}, 500);
    	}
    });

    http://vkontakte.ru/apps.php?act=s&mid=1&id=2
    [пруф]

    Обсуждение можно почитать тут, спасибо XDiaBLo за находку.
    http://flasher.ru/forum/showthread.php?t=139847

    wvxvw, 12 Мая 2010

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

    −86

    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
    if (event.customerName != "")
    {
    	criteria.xmlCriteria =
    		"<criteria>" +
    		"<billingDetailsName>" + event.customerName + "</billingDetailsName>" +
    		"</criteria>";
    }
    else
    {
    	criteria.xmlCriteria =
    		"<criteria>" +
    		"</criteria>";
    }

    voice, 12 Мая 2010

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

    −87

    1. 1
    2. 2
    3. 3
    ...;
     (button && button.timer ) ? b = ((button.timer.repeatCount - button.timer.currentCount) > 0) : b = true;
    ...;

    а мне нравится, изящно так...

    hman, 06 Мая 2010

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

    −155

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    <mx:VBox xmlns:mx="...">
      
      <mx:ComboBox ... />
    
      <mx:Box width="{width}" height="100%">
        <mx:DataGrid id="grid" dataProvider="{rawData}" height="100%"/>
      </mx:Box>
    </mx:VBox>

    В гриде дохрена колонок. В таком манёвре горизонтальный скорлл есть, а до вертикального нужно "доскролить" горизонтальным.
    Задача: сделать чтобы были видны оба.
    Видимо горе девелопер сделал <mx:DataGrid id="grid" dataProvider="{rawData}" width="100%" height="100%"/> без Box-а... и взгруснул от ширины колонок. Ему, бедному, не пришло в голову что при 2х дюжинах колонок можно смело поставить horizontalScrollpolicy="on" и не городить огород (и не смешить общественность).
    ... ё-маё и это Сеньёр Флекс Девелопер.

    dimas_art, 29 Апреля 2010

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

    −86

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    for (i = 0; i < 3; i++) {
        if (smth) {
         blnCardValue = true;
         i = 4;
        }
       }

    клевый способ выйти из цикла

    dimas_art, 29 Апреля 2010

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

    −88

    1. 1
    2. 2
    frmt = ("ISSUE" == "ISSUE") ? "@m-@yy" : "@dd-@m";
    frmt = ("ISSUE" == "ISSUE") ? "@m-@yy" : "@dd-@m";

    И не дают мне уснуть эти 2 строки. Наверное 2, чтобы наверняка, но вот условие я даже не знаю как интерпретировать Х_х

    dimas_art, 21 Апреля 2010

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