ДействиеСценарий / Говнокод #3206 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  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 wvxvw, (Updated )

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

ДействиеСценарий / Говнокод #3133 Ссылка на оригинал

0

  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 dimas_art, (Updated )

Комментарии (12, +12)

ДействиеСценарий / Говнокод #3063 Ссылка на оригинал

0

  1. 1
  2. 2
frmt = ("ISSUE" == "ISSUE") ? "@<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="503d7d102929">[email protected]</a>" : "@<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ff9b9bd2bf92">[email protected]</a>";
frmt = ("ISSUE" == "ISSUE") ? "@<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="066b2b467f7f">[email protected]</a>" : "@<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f69292dbb69b">[email protected]</a>";

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

dimas_art dimas_art, (Updated )

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

ДействиеСценарий / Говнокод #3051 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  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
package org.casalib.util {
    
    /**
        Utilities for constructing and working with Classes.
        
        @author Aaron Clinger
        @version 02/13/10
    */
    public class ClassUtil {
        
        /**
            Dynamically constructs a Class.
            
            @param type: The Class to create.
            @param arguments: Up to ten arguments to the constructor.
            @return Returns the dynamically created instance of the Class specified by <code>type</code> parameter.
            @throws Error if you pass more arguments than this method accepts (accepts ten or less).
            @example
                <code>
                    var bData:* = ClassUtil.construct(BitmapData, 200, 200);
                    
                    trace(bData is BitmapData, bData.width);
                </code>
        */
        public static function construct(type:Class, ...arguments):* {
            if (arguments.length > 10)
                throw new Error('You have passed more arguments than the "construct" method accepts (accepts ten or less).');
            
            switch (arguments.length) {
                    case 0 :
                        return new type();
                    case 1 :
                        return new type(arguments[0]);
                    case 2 :
                        return new type(arguments[0], arguments[1]);
                    case 3 :
                        return new type(arguments[0], arguments[1], arguments[2]);
                    case 4 :
                        return new type(arguments[0], arguments[1], arguments[2], arguments[3]);
                    case 5 :
                        return new type(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);
                    case 6 :
                        return new type(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
                    case 7 :
                        return new type(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6]);
                    case 8 :
                        return new type(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7]);
                    case 9 :
                        return new type(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7], arguments[8]);
                    case 10 :
                        return new type(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7], arguments[8], arguments[9]);
            }
        }
    }
}

Lavir_the_Whiolet Lavir_the_Whiolet, (Updated )

Комментарии (50, +50)

ДействиеСценарий / Говнокод #2839 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
if (_root["currKeyState"] == 3 and _root["currKeyStateCaps"] == "off") {
			_root["currKeyState"] = 1;
			if ("titleNewRec" == _root["currentInput"] or "msgText" == _root["currentInput"] or "prvSearchStr" == _root["currentInput"] or "mdengiId" == _root["currentInput"] or "fio" == _root["currentInput"] or "alfabplace" == _root["currentInput"] or "commut" == _root["currentInput"]) {
			} else {
			}
		} else if (_root["currKeyState"] == 4 and _root["currKeyStateCaps"] == "off") {
			_root["currKeyState"] = 2;
			if ("titleNewRec" == _root["currentInput"] or "msgText" == _root["currentInput"] or "prvSearchStr" == _root["currentInput"] or "mdengiId" == _root["currentInput"] or "fio" == _root["currentInput"] or "alfabplace" == _root["currentInput"] or "commut" == _root["currentInput"]) {
			} else {
			}
		}

Хотел посмотреть, как реализована логика в старом коде и нашел вот это...

-=Deus=- -=Deus=-, (Updated )

Комментарии (2, +2)

ДействиеСценарий / Говнокод #2689 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
var topItem:Object;
var rowNum:int;
var rowCount:int;
...
else if (!topItem && !rowNum == rowCount)
...

Чтобы не утомлять вас догадками, во что же это превратится и в каком порядке произойдут операции: это условие выполниться только когда:
topItem == null
rowNum != 0
rowCount == 0
Как следует из названий переменных, человек, написавший это ожидал, что количество строк может быть меньше, чем порядковый номер одной из строк...
Взято, опять же из Flex Framework mx.controls::Tree.
Скорее всего автор имел в виду следующее:

else if (!topItem && rowNum !== rowCount)

Но булевые переменные, они ж такие коварные :)

wvxvw wvxvw, (Updated )

Комментарии (8, +8)