- 1
- 2
Обратите внимание:
http://govnokod.ru/user/4866
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+160
Обратите внимание:
http://govnokod.ru/user/4866
−118
int CurrentPos;
NSInteger cnt = [ListOfFtpFiles count];
CurrentPos = [[[NSUserDefaults standardUserDefaults] objectForKey:@"DownLoadIndex" ] intValue];
if (CurrentPos==nil) CurrentPos=0;
if (CurrentPos == 0)
{
//...
for (int i = 0; i < (int)cnt; i=i+1)
//...
}
−114
for(i=0;i<5;i++){
if(_root.positions[i] == number){
// поменяем мувиклипы местами
p2=_root.positions[i+1];
with(_root){
switch(p2){
case 2: tx=b._x; ty=b._y; b._x=c._x; b._y=c._y; c._x=tx; c._y=ty; break;
case 1: tx=a._x; ty=a._y; a._x=c._x; a._y=c._y; c._x=tx; c._y=ty; break;
case 4: tx=d._x; ty=d._y; d._x=c._x; d._y=c._y; c._x=tx; c._y=ty; break;
case 5: tx=e._x; ty=e._y; e._x=c._x; e._y=c._y; c._x=tx; c._y=ty; break;
case 6: tx=f._x; ty=f._y; f._x=c._x; f._y=c._y; c._x=tx; c._y=ty; break;
default: break;
}
}
Когда-то давно написал это, чтобы менять местами два прямоугольника, лежащие рядом, по нажатию на кнопку на одном из них. До сих пор горжусь тем, какой же я крутой кодер.
−89
def get_caller_module_dict(levels):
try:
raise RuntimeError
except RuntimeError:
e,b,t = sys.exc_info()
f = t.tb_frame
while levels > 0:
f = f.f_back
levels -= 1
ldict = f.f_globals.copy()
if f.f_globals != f.f_locals:
ldict.update(f.f_locals)
return ldict
+76
public class Xorer {
private static long SHIFR= 71180519;
private Xorer() {
}
/**
* ��������� �������� value XOR shifr
* @param value ������� �������� �������� � ��������� �������
* @return ��������� ��� �������� �������� � ��������� �������
*/
public static synchronized String executeString(String value){
String res=null;
long code=0;
try{
code=Long.parseLong(value);
} catch(Exception e){
e.printStackTrace();
}
res=execute(code);
return res;
}
/**
* ��������� �������� value XOR shifr
* @param code ������� �������� �������� � ������� long
* @return ��������� ��� �������� �������� � ��������� �������
*/
public static synchronized String execute(long code){
String res=null;
if(code>0){
long newvalue= code ^ SHIFR;
res=""+newvalue;
}
return res;
}
}
Вот вам ещё еда.
+132
local obj_on_cursor = objSetup:get("obj_on_cursor").value
if ( obj_on_cursor == "none" and
obj_on_cursor ~= "tool_pincers" and
obj_on_cursor ~= "tool_knife" ) then
objSetup:get("rope_clicked").value = 1
quest_callSFAction(objGame, "onRopeAttrition")
sf_worktable_rope_research_complete()
elseif ( obj_on_cursor ~= "none" and
obj_on_cursor == "tool_pincers" and
obj_on_cursor ~= "tool_knife" ) then
objSetup:get("rope_clicked").value = 1
quest_callSFAction(objGame, "onRopeAttritionPincers")
sf_worktable_rope_research_complete()
elseif ( obj_on_cursor ~= "none" and
obj_on_cursor ~= "tool_pincers" and
obj_on_cursor ~= "tool_knife" ) then
quest_callSFAction(objGame, "onWrongTool")
end
Прислали баг по миниигре. Человек, который делал минигру в отпуске, пришлось мне разбираться. Полез в код, а там такое... ХЗ, может и нормально, но у меня чуть глаза не выпали. Такой фигни там много, ~ 1.5К строк, хотя обычно минигра пишется максимум на 500 строк.
+162
function url_rewriter(){
$rules=file_get_contents("system/static/rewrite_rules.conf");
$rules=explode("\n",$rules);
for ($i=0;$i<count($rules);$i++){
$z=explode(" ",$rules[$i]);
$r[$z[0]]=$z[1];
}
foreach ($r as $n => $v)
{
if ("si".$_GET['url']==$n or "si".$_GET['url']==$n."/") { $_GET['page']=$v; $ok=1;}
if ("ab".$_GET['url']==$n or "ab".$_GET['url']==$n."/") { $_GET['page']=$v; $ok=1;}
if ("inter".$_GET['url']==$n or "inter".$_GET['url']==$n."/") {$_GET['page']=$v; $ok=1;}
if ("he".$_GET['url']==$n or "he".$_GET['url']==$n."/") {$_GET['page']=$v; $ok=1;}
}
if ("inter".$_GET['url']=="internet-service/cabinet/basket/mobileterminal"||
"inter".$_GET['url']=="internet-service/cabinet/basket/mobileterminal/"){
$_GET['page']=14;
$ok=1;
$_GET['mobileterminal']="on";
unset($_GET['url']);
}
return $ok;
}
Реализация ЧПУ...
+121
// Getting first account data and binding it to control
List<string> cardList = new List<string>();
List<string> permissionList = new List<string>();
string x1 = "";
string x2 = "";
string x3 = "";
string x4 = "";
string x6 = "";
string x7 = "";
string x8 = "";
try
{
x8 = getCardNumberByAccountNumber(CustAcc1.Text);
}
catch { }
GetAllCustomerAccountValue(de_ca1, ref x1, ref x2, ref x3, ref x4, ref cardList, ref permissionList, ref x6, ref x7, ref x8); //, ref x2, ref x3, ref x4, ref cardList, ref x5, ref x6, ref x7, ref x8);
FormCustomerAccount1.accountNum = x1;
FormCustomerAccount1.fullName = x2;
FormCustomerAccount1.streetBuild = x3;
FormCustomerAccount1.postalCode = x4;
FormCustomerAccount1.creditNote = x6;
FormCustomerAccount1.accountBalance = x7;
FormCustomerAccount1.cards = cardList;
FormCustomerAccount1.permissions = permissionList;
(
+80
/** ���� ��������� ���� @P@R@I@V@E@T@ @1@8 - ���� ��� ���� ������ */
public static String removeSabakaCoding(String inStr)
{
try {
char[] chars = inStr.toCharArray();
StringBuffer sb = new StringBuffer();
boolean mustBe = true;
boolean sobakaCoding = true;
for (int i = 0; i < inStr.length(); i++)
{
if (mustBe)
{
if (chars[i] == '@')
{ // ���� ��� sobakaCoding � ����..
} else
{
sobakaCoding = false;
break;
}
} else
sb.append(chars[i]);
mustBe=!mustBe;
}
if (sobakaCoding)
return sb.toString();
} catch (Exception e)
{
e.printStackTrace();
}
return inStr;
}
Чмоке всем в этам чяте!!!111
+173
echo $table = new Table(new Db_pars(new Db_mysql(new Db_query('SELECT_ALL'))));