- 1
if (!jQuery(this).html().length > 0) {....}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+174
if (!jQuery(this).html().length > 0) {....}
нашел в своем старом проекте
+177
$lists['arrDateYear']=array(2000=>2000,2001=>2001,2002=>2002,2003=>2003,2004=>2004,2005=>2005,2006=>2006,2007=>2007,2008=>2008,2009=>2009,2010=>2010);
$lists['arrDateDay']=array(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);
1=1
+69
final double base = 10.0;
final int minCode = (int)Math.pow(base, CODE_LENGTH - 1) - 1;
final int maxCode = (int)Math.pow(base, CODE_LENGTH) - 1;
while (true)
{
final int code = codeGenerator.nextInt();
if ((code > minCode) && (code <= maxCode))
{
return String.valueOf(code);
}
}
Геренация случайного пина с определенным интервалом.
+155
http://govnokod.reformal.ru/proj/govnokod?ia=613048
надеюсь, меня поддержат
+157
$infopage = file_get_contents("http://instagram.com/api/v1/users/".$match."/info/", false, $context);
$isprivate = substr($infopage,strpos($infopage,',"is_private":')+14,strpos($infopage,',"external_url":"')-strpos($infopage,',"is_private":')-14);
$fullname = substr($infopage,strpos($infopage,'","full_name":"')+15,strpos($infopage,'","follower_count":')-strpos($infopage,'","full_name":"')-15);
$mediacount = substr($infopage,strpos($infopage,',"media_count":')+15,strpos($infopage,',"following_count":')-strpos($infopage,',"media_count":')-15);
$following = substr($infopage,strpos($infopage,',"following_count":')+19,strpos($infopage,',"geo_media_count":')-strpos($infopage,',"following_count":')-19);
$isint2 = is_numeric($following);
if ($isint2 == false){$following = substr($infopage,strpos($infopage,',"following_count":')+19,strpos($infopage,',"profile_pic_url":"')-strpos($infopage,',"following_count":')-19);}
$followers = substr($infopage,strpos($infopage,',"follower_count":')+18,strpos($infopage,',"pk":')-strpos($infopage,',"follower_count":')-18);
$avatar = stripslashes(substr($infopage,strpos($infopage,'"profile_pic_url":"')+19,strpos($infopage,'","biography":"')-strpos($infopage,'"profile_pic_url":"')-19));
$bio = substr($infopage,strpos($infopage,'","biography":')+15,strpos($infopage,'","full_name":"')-strpos($infopage,'","biography":')-15);
$website = stripslashes(substr($infopage,strpos($infopage,'"external_url":"')+16,strpos($infopage,'"}}')-strpos($infopage,'"external_url":"')-16));
$countq = mysql_query("SELECT COUNT(*) FROM `links` WHERE `ownerID` = '".$match."'");
$countf = mysql_fetch_array($countq);
Парсинг API Instagram. JSON - слишком неправославно, да.
+143
if (medicalRecords == null)
new List<MedicalRecordDispatchingInfoViewModel>();
Просто сделай мне лист
+115
library ch;
uses
Windows,SysUtils,controls,graphics,extctrls,shellapi,Unit1 in 'Unit1.pas' {Form1};
type
NTStatus = cardinal;
far_jmp = packed record
push: byte;
PProc: pointer;
ret: byte;
end;
OldCode = packed record
one: dword;
two: dword;
end;
const
STATUS_ACCESS_DENIED = NTStatus($C0000022);
STATUS_SUCCESS = NTStatus($00000000);
function CreateProcessW(lpApplicationName: PWideChar; lpCommandLine: PWideChar;
lpProcessAttributes, lpThreadAttributes: PSecurityAttributes;
bInheritHandles: BOOL; dwCreationFlags: dword; lpEnvironment: pointer;
lpCurrentDirectory: PWideChar; const lpStartupInfo: TStartupInfo;
var lpProcessInformation: TProcessInformation): BOOL; stdcall;
external 'kernel32.dll' name 'CreateProcessW';
var
CPA: pointer;
OldCPA: OldCode;
JmpCPA: far_jmp;
b:cardinal;
procedure UnHook;
begin
WriteProcessMemory(INVALID_HANDLE_VALUE, CPA, @OldCPA, sizeof(OldCode), b);
end;
function FalseCreateProcessW():boolean;
begin
SetLastError(ERROR_ACCESS_DENIED);
result:=falsecreateprocessw
end;
function TrueCreateProcessW(lpApplicationName: PWideChar;
lpCommandLine: PWideChar; lpProcessAttributes, lpThreadAttributes
: PSecurityAttributes; bInheritHandles: BOOL; dwCreationFlags: dword;
lpEnvironment: pointer; lpCurrentDirectory: PWideChar;
const lpStartupInfo: TStartupInfo;
var lpProcessInformation: TProcessInformation): BOOL; stdcall;
begin
WriteProcessMemory(INVALID_HANDLE_VALUE, CPA, @OldCPA, sizeof(OldCode), b);
Result := CreateProcessW(lpApplicationName, lpCommandLine,
lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags,
lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation);
WriteProcessMemory(INVALID_HANDLE_VALUE, CPA, @JmpCPA, sizeof(far_jmp), b);
end;
function NewCreateProcessW(lpApplicationName: PWideChar;
lpCommandLine: PWideChar; lpProcessAttributes, lpThreadAttributes
: PSecurityAttributes; bInheritHandles: BOOL; dwCreationFlags: dword;
lpEnvironment: pointer; lpCurrentDirectory: PWideChar;
const lpStartupInfo: TStartupInfo;
var lpProcessInformation: TProcessInformation): bool; stdcall;
var
reason:string;
begin
result:=true;// подавляем ошибку "Доступ запрещен"
// если что-то нам не понравилось, выходм
else
// или выполняем командную строку
Result := TrueCreateProcessW(lpApplicationName, lpCommandLine,
lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags,
lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation);
end;
procedure SetHook;
begin
CPA := GetProcAddress(getmodulehandle('kernel32.dll'), 'CreateProcessW');
ReadProcessMemory(INVALID_HANDLE_VALUE, CPA, @OldCPA, sizeof(OldCode), b);
JmpCPA.push := $68;
JmpCPA.PProc := @NewCreateProcessW;
JmpCPA.ret := $C3;
WriteProcessMemory(INVALID_HANDLE_VALUE, CPA, @JmpCPA, sizeof(far_jmp), b);
end;
function MessageProc(code: integer; wParam: word; lParam: longint)
: longint; stdcall;
begin
Result := CallNextHookEx(0, code, wParam, lParam);
end;
procedure SetGlobalHookProc();
begin
SetWindowsHookEx(WH_GETMESSAGE, @MessageProc, HInstance, 0);
sleep(infinite);
end;
procedure SetGlobalHook();
var
//hMutex: dword;
TrId: dword;
begin
CreateMutex(nil, False, 'Vhook@016');
if GetLastError = 0 then
CreateThread(nil, 0, @SetGlobalHookProc, nil, 0, trid)
end;
procedure DLLEntryPoint(dwReason: dword);
begin
case dwReason of
DLL_PROCESS_ATTACH:
begin
SetHook;
SetGlobalHook;
end;
DLL_PROCESS_DETACH:
begin
UnHook;
end;
end;
end;
begin
DllProc := @DLLEntryPoint;
DLLEntryPoint(DLL_PROCESS_ATTACH);
end.
+131
private void аффинныйШифрToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Form childForm in MdiChildren)
{
childForm.Close();
}
foreach (Form f in this.MdiChildren)
{
return;
}
Affiniy af = new Affiniy();
af.TopLevel = false;
af.Show();
tabPage1.Controls.Add(af);
af.WindowState = System.Windows.Forms.FormWindowState.Maximized;
}
Попросили посмотреть код. 15 методов с различными простейшими шифрами, но чудо foreach -> return, присутствует в каждом. И не лень кому-то было...
+135
public static void InsertSalesPerson(
ref int? SalesPersonID, int DealerProfileID, int DealerID, int? WebSiteID, string LastName, string FirstName, string Phone, string Email, string Password,
int AccessLevelID, int? StatusID, int? LanguageID, int? TimeZoneID, string Title, string SpokenLanguages, bool IsShownInWebSite, bool IsUserInWebSite, string UserName)
+130
catch (Exception e)
{
CommonAPI.SetErrorApp(0, MethodBase.GetCurrentMethod().DeclaringType.Name + "." + MethodBase.GetCurrentMethod().Name, e.Message);
#if DEBUG
throw e;
#else
return 0;
#endif
}