- 1
- 2
- 3
for ($i = 0, $cnt = count($arList); $i < $cnt; $i++) {
$arConfig["CONFIG"]["category"]["VALUES"][$arList[$i]] = GetMessage('SALE_DH_RUSSIANPOST_CONFIG_CATEGORY_'.$arList[$i]);
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+151
for ($i = 0, $cnt = count($arList); $i < $cnt; $i++) {
$arConfig["CONFIG"]["category"]["VALUES"][$arList[$i]] = GetMessage('SALE_DH_RUSSIANPOST_CONFIG_CATEGORY_'.$arList[$i]);
}
... вместо человеческого foreach($arList as $k => $v) { ... }
−112
_friend_.D2.mc_LOJKA.gotoAndStop(_friend_.D2.mc_LOJKA._totalframes)
if (FR_GETKEY(64) == "A") {_friend_.D2.mc_LOJKA.gotoAndStop(1)}
if (FR_GETKEY(352) == "A") {_friend_.D2.mc_LOJKA.gotoAndStop(2)}
if (FR_GETKEY(356) == "A") {_friend_.D2.mc_LOJKA.gotoAndStop(3)}
if (FR_GETKEY(363) == "A") { _friend_.D2.mc_LOJKA.gotoAndStop(4) }
if (FR_GETKEY(353) == "A") {_friend_.D2.mc_LOJKA.gotoAndStop(4)}
_friend_.D2.mc_TARELKI.gotoAndStop(_friend_.D2.mc_TARELKI._totalframes)
if (FR_GETKEY(5) == "A") {_friend_.D2.mc_TARELKI.gotoAndStop(1)}
if (FR_GETKEY(4) == "A") {_friend_.D2.mc_TARELKI.gotoAndStop(2)}
if (FR_GETKEY(3) == "A") {_friend_.D2.mc_TARELKI.gotoAndStop(3)}
_friend_.D4.mc_BUTILKA.gotoAndStop(_friend_.D4.mc_BUTILKA._totalframes)
if (FR_GETKEY(42) == "A") {_friend_.D4.mc_BUTILKA.gotoAndStop(1)}
if (FR_GETKEY(43) == "A") {_friend_.D4.mc_BUTILKA.gotoAndStop(2)}
if (FR_GETKEY(44) == "A") {_friend_.D4.mc_BUTILKA.gotoAndStop(3)}
_friend_.D4.mc_NEPROLIVAIKA.gotoAndStop(_friend_.D4.mc_NEPROLIVAIKA._totalframes)
if (FR_GETKEY(357) == "A") {_friend_.D4.mc_NEPROLIVAIKA.gotoAndStop(1)}
if (FR_GETKEY(26) == "A") {_friend_.D4.mc_NEPROLIVAIKA.gotoAndStop(2)}
_friend_.D4.mc_SOSKA.gotoAndStop(_friend_.D4.mc_SOSKA._totalframes)
if (FR_GETKEY(40) == "A") {_friend_.D4.mc_SOSKA.gotoAndStop(1)}
if (FR_GETKEY(38) == "A") {_friend_.D4.mc_SOSKA.gotoAndStop(2)}
if (FR_GETKEY(37) == "A") {_friend_.D4.mc_SOSKA.gotoAndStop(3)}
_friend_.D4.mc_ERSHIK.gotoAndStop(_friend_.D4.mc_ERSHIK._totalframes)
if (FR_GETKEY(121) == "A") {_friend_.D4.mc_ERSHIK.gotoAndStop(1)}
_friend_.D5.mc_NAGRUDNIK.gotoAndStop(_friend_.D5.mc_NAGRUDNIK._totalframes)
if (FR_GETKEY(362) == "A") {_friend_.D5.mc_NAGRUDNIK.gotoAndStop(1)}
_friend_.D5.mc_TERMOS.gotoAndStop(_friend_.D5.mc_TERMOS._totalframes)
if (FR_GETKEY(46) == "A") {_friend_.D5.mc_TERMOS.gotoAndStop(1)}
_friend_.D7.F47.gotoAndStop(_friend_.D7.F47._totalframes)
if (FR_GETKEY(47) * 1 > 0) { _friend_.D7.F47.gotoAndStop(1); _friend_.D7.F47.NUM.gotoAndStop(FR_GETKEY(47)*1)}
_friend_.D7.F50.gotoAndStop(_friend_.D7.F50._totalframes)
if (FR_GETKEY(50) * 1 > 0) { _friend_.D7.F50.gotoAndStop(1);_friend_.D7.F50.NUM.gotoAndStop(FR_GETKEY(50)*1)}
_friend_.D7.F49.gotoAndStop(_friend_.D7.F49._totalframes)
if (FR_GETKEY(49) * 1 > 0) { _friend_.D7.F49.gotoAndStop(1);_friend_.D7.F49.NUM.gotoAndStop(FR_GETKEY(49)*1)}
_friend_.D7.F48.gotoAndStop(_friend_.D7.F48._totalframes)
if (FR_GETKEY(48) * 1 > 0) { _friend_.D7.F48.gotoAndStop(1); _friend_.D7.F48.NUM.gotoAndStop(FR_GETKEY(48)*1)}
_friend_.D8.F17.gotoAndStop(_friend_.D8.F17._totalframes)
if (FR_GETKEY(17) * 1 > 0) { _friend_.D8.F17.gotoAndStop(1);_friend_.D8.F17.NUM.gotoAndStop(FR_GETKEY(17) * 1)}
_friend_.D8.F61.gotoAndStop(_friend_.D8.F61._totalframes)
if (FR_GETKEY(61) * 1 > 0) { _friend_.D8.F61.gotoAndStop(1);_friend_.D8.F61.NUM.gotoAndStop(FR_GETKEY(61)*1)}
_friend_.D8.F62.gotoAndStop(_friend_.D8.F62._totalframes)
if (FR_GETKEY(62) * 1 > 0) { _friend_.D8.F62.gotoAndStop(1);_friend_.D8.F62.NUM.gotoAndStop(FR_GETKEY(62)*1)}
_friend_.D8.F20.gotoAndStop(_friend_.D8.F20._totalframes)
if (FR_GETKEY(20) * 1 > 0) { _friend_.D8.F20.gotoAndStop(1);_friend_.D8.F20.NUM.gotoAndStop(FR_GETKEY(20)*1)}
_friend_.D8.F19.gotoAndStop(_friend_.D8.F19._totalframes)
if (FR_GETKEY(19) * 1 > 0) { _friend_.D8.F19.gotoAndStop(1);_friend_.D8.F19.NUM.gotoAndStop(FR_GETKEY(19)*1)}
_friend_.D8.F18.gotoAndStop(_friend_.D8.F18._totalframes)
if (FR_GETKEY(18) * 1 > 0) { _friend_.D8.F18.gotoAndStop(1);_friend_.D8.F18.NUM.gotoAndStop(FR_GETKEY(18)*1)}
_friend_.D9.F25.gotoAndStop(_friend_.D9.F25._totalframes)
if (FR_GETKEY(25) * 1 > 0) { _friend_.D9.F25.gotoAndStop(1);_friend_.D9.F25.NUM.gotoAndStop(FR_GETKEY(25)*1)}
_friend_.D10.F24.gotoAndStop(_friend_.D10.F24._totalframes)
И еще 200 строк продолжения за кадром.
+153
http://www.gamedev.ru/flame/forum/?id=154244
Новый язык программирования.
+125
/// <summary>
/// Конвертирование String - Decimal
/// </summary>
/// <param name="text"></param>
/// <param name="value"></param>
/// <returns></returns>
public static decimal GetDecimal(this string text)
{
decimal number;
CultureInfo culture = null;
if (String.IsNullOrEmpty(text))
throw new ArgumentNullException("The input string is invalid.");
try
{
culture = CultureInfo.CurrentCulture;
number = decimal.Parse(text, culture);
return number;
}
catch
{
}
try
{
culture = culture.Parent;
number = decimal.Parse(text, culture);
return number;
}
catch
{
}
culture = CultureInfo.InvariantCulture;
try
{
number = decimal.Parse(text, culture);
return number;
}
catch (FormatException e)
{
throw new FormatException(String.Format("Unable to parse '{0}'.", text), e);
}
}
Это финиш.
−108
select replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(t1.PART_NUMBER, '@i@', ' '),'@a@', '/'),'@@@', '\'),'@b@', ':'),'@c@', '*'),'@d@', '?'),'@e@', '"'),'@f@', '<'),'@g@', '>'),'@h@', '|'),'@j@', '&'),'@k@', ''''),'@l@', ',') as 'PART_NUMBER',.....
+132
(#~m=^(?:GET|POST|HEAD) /.*?\r\n[Hh][Oo][Ss][Tt]: ([\w-.:]{3,100})\r\n=s
Часть серверного приложения на Lisp. Я лично нихрена не понял, возможно не прав.
−109
command = gets.chomp
while command != 'ПОКА'
if command != command.upcase
puts 'АСЬ?! ГОВОРИ ГРОМЧЕ, ВНУЧЕК!'
else
puts 'НЕТ, НИ РАЗУ С 1938 ГОДА!'
end
end
puts 'ПОКА, ВНУЧЕК!'
Нашёл ошибку, лишь когда вписывал код сюда.
Бесконечный цикл, как видите.
+130
public void ExportOrderDetails()
{
char comma = ',';
StringBuilder sb = new StringBuilder();
string line = "";
line += "Order No" + comma;
line += "Customer" + comma;
line += "Order Date" + comma;
line += "Order Status" + comma;
line += "Subtotal" + comma;
line += "Tax Total" + comma;
line += "Shipping Cost" + comma;
line += "Shipping Method" + comma;
line += "Order Total" + comma;
line += "Payment Method" + comma;
line += "Total Quantity" + comma;
line += "Date Shipped" + comma;
line += "Tracking No" + comma;
line += "Order Currency Code" + comma;
line += "Exchange Rate" + comma;
line += "Billing First Name" + comma;
line += "Billing Last Name" + comma;
line += "Billing Company" + comma;
line += "Billing Address" + comma;
line += "Billing Address 2" + comma;
line += "Billing City" + comma;
line += "Billing Zip" + comma;
line += "Billing State Code" + comma;
line += "Billing Country ISO2" + comma;
line += "Billing Phone" + comma;
line += "Billing Phone 2" + comma;
line += "Billing Email" + comma;
line += "Shipping First Name" + comma;
line += "Shipping Last Name" + comma;
line += "Shipping Company" + comma;
line += "Shipping Address" + comma;
line += "Shipping Address 2" + comma;
line += "Shipping City" + comma;
line += "Shipping Zip" + comma;
line += "Shipping State Code" + comma;
line += "Shipping Country ISO2" + comma;
line += "Shipping Phone" + comma;
line += "Shipping Phone 2" + comma;
line += "Shipping Email" + comma;
line += "Combined Product Weight" + comma;
line += "Product Qty" + comma;
line += "Product SKU" + comma;
line += "Product Name" + comma;
line += "Product Variation Details" + comma;
line += "Product Unit Price" + comma;
line += "Product Unit Cost" + comma;
line += "Product Weight" + comma;
line += "Product Total Price" + comma;
line += "Product Total Cost" + comma;
sb.AppendLine(line.Remove(line.Length - 1));
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment; filename=orders-details-" + DateTime.Now.ToString("yyyy-MM-dd") + ".csv");
Response.ContentEncoding = Encoding.Default;
Response.Write(sb.ToString());
Response.End();
}
Норм так)
−101
def api_login() :
url = 'https://api.vk.com/oauth/authorize'
values = {
'client_id' : '1998533',
'response_type' : 'token'
}
headers = {
'User-Agent' : 'Opera/9.80 (Windows NT 6.1; U; ru) Presto/2.9.168 Version/11.51',
'Cookie' : 'remixsid=' + sid
}
try:
data = urllib.urlencode(values)
req = urllib2.Request(url, data, headers)
response = urllib2.urlopen(req)
res = response.read()
geturl = response.geturl()
if geturl != url :
reg = 'access_token=(.*?)&'
rg = re.compile(reg,re.IGNORECASE|re.DOTALL)
m = rg.search(geturl)
if m:
token=m.group(1)
print 'API: login'
return token
else :
reg='\?hash=(.*?)&'
rg = re.compile(reg,re.IGNORECASE|re.DOTALL)
m = rg.search(res)
if m:
hash = m.group(0)
url = 'https://api.vk.com/oauth/grant_access'+hash+'client_id=1998533&redirect_uri=blank.html&response_type=token'
req = urllib2.Request(url, '', headers)
response = urllib2.urlopen(req)
res = response.read()
geturl = response.geturl()
reg = 'access_token=(.*?)&'
rg = re.compile(reg,re.IGNORECASE|re.DOTALL)
m = rg.search(geturl)
if m:
token = m.group(1)
print 'API: login'
return token
except Exception, detail:
print "Error ", detail
def api(method, values = {}) :
url = 'https://api.vk.com/method/' + method + '.json'
values.update({'access_token' : token})
headers = {
'User-Agent' : 'Opera/9.80 (Windows NT 6.1; U; ru) Presto/2.9.168 Version/11.51',
'Cookie' : 'remixsid=' + sid
}
try:
data = urllib.urlencode(values)
req = urllib2.Request(url, data, headers)
response = urllib2.urlopen(req)
res = response.read()
return res
except Exception, detail:
print "Error ", detail
+75
private enum UpdateToken {
W, A, F, D, H;
private static final Pattern PATTERN = compilePattern(UpdateToken.class);
}
private static Pattern compilePattern(Class<? extends Enum> clazz) {
StringBuilder builder = new StringBuilder("(");
for (Enum enumConstant : clazz.getEnumConstants()) {
if (enumConstant.ordinal() > 0) {
builder.append("|");
}
builder.append(enumConstant.name());
}
builder.append(")");
return Pattern.compile(builder.toString());
}
//и это добро вот так используется:
if (!UpdateToken.PATTERN.matcher(token).matches()) {
continue;
}
UpdateToken setupToken = UpdateToken.valueOf(token);
https://github.com/aichallenge/aichallenge/blob/epsilon/ants/dist/starter_bots/java/AbstractSystemInputParser.java