- 1
echo $table = new Table(new Db_pars(new Db_mysql(new Db_query('SELECT_ALL'))));
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+173
echo $table = new Table(new Db_pars(new Db_mysql(new Db_query('SELECT_ALL'))));
+156
case "delete":
$id=$_GET['id'];
if(!isset($id)){
// no id? GTFO
header('Location: index.php?go=manage_costumes&act=view');
exit();
}else{
// id exists
...
)))
+172
<td class="td_caption" style="width: 40%"><label for="pohuy">Запомнить</label></td>
<td class="td_value"><input type="checkbox" name="pohuy" checked="checked" id="pohuy"/></td>
"Я ХАЧУ ГАЛОЧКУ ЗАПОМНИТЬ ПОД ПАРОЛЕМ БИЛЯТЬ", - как скажешь начальник.
*параметр "pohuy" как вы поняли нигде и никак не обрабатывается.
+1001
bool f = true;
short c0 = a0, c1 = a1, c2 = a2, c3 = a3;
if (a0 < c1) { f = false; a0 = c1; a1 = c0 - c1; a2 = c1 - c2; a3 = c1 - c3; }
if (a0 < c2) { f = false; a0 = c2; a1 = c2 - c1; a2 = c0 - c2; a3 = c2 - c3; }
if (a0 < c3) { f = false; a0 = c3; a1 = c3 - c1; a2 = c3 - c2; a3 = c0 - c3; }
if (f) { a0 = c0; a1 = c0 - c1; a2 = c0 - c2; a3 = c0 - c3; }
Чувак не знает про else / else if. :(
+1001
// Функция регистрирующая ошибку
VOID SetError(DWORD dwError)
{
CHAR szErr[256];
sprintf(szErr, "%lu", dwError);
SetEnvironmentVariable("0xdeadc0de", szErr);
}
// Шеллкод
__declspec(dllexport)
VOID WINAPI Shell(REMSTART *pCtx)
{
pCtx->pLoadLibraryA(pCtx->sz);
CHAR szVar[] = {'0','x','d','e','a','d','c','0','d','e','\0'};
CHAR szErr[256];
if (!pCtx->pGetEnvironmentVariableA(szVar, szErr, sizeof(szErr)))
pCtx->pExitThread(ERROR_LOAD_HOOK_DLL);
DWORD dwError = 0;
for (DWORD i = 0; szErr[i]; i++)
{
dwError *= 10;
dwError += szErr[i] - '0';
}
pCtx->pExitThread(dwError);
}
Удивительнейший способ регистрации ошибок в функции DllMain при инжекте библиотеки шеллкодом из другого процесса (кто знает - тот поймет)... линк: http://www.wasm.ru/forum/viewtopic.php?id=43291
+166
var numb = '0123456789';
var lwr = 'abcdefghijklmnopqrstuvwxyz';
var upr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
function isValid(parm,val) {
if (parm == "") return true;
for (i=0; i<parm.length; i++) {
if (val.indexOf(parm.charAt(i),0) == -1) return false;
}
return true;
}
http://javascript.about.com/library/blvalid02.htm
Вырезка из шапки:
Javascript does not contain functions that test specifically for alphabetic or numeric content but we can easily provide these functions for ourselves...
+76
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.FIELD})
public static @interface Property { String value(); }
public static class PropertyImpl implements Property {
private final String value;
public PropertyImpl(String value) { this.value = value; }
@Override public Class<? extends Annotation> annotationType() { return Property.class; }
@Override public String value() { return this.value; }
@Override public int hashCode() { return (127 * "value".hashCode()) ^ value.hashCode(); }
@Override public boolean equals(Object o) {
if (!(o instanceof Property)) { return false; }
Property other = (Property) o;
return value.equals(other.value());
}
}
отформатировал для компактности.
Идеи для чего делать реализцию аннотации?
−119
public function checkDrop (pos: Array): Array
{
checkItem ();
var res: Array = [];
var item: Array
var mc: MovieClip
for (var i: int = 0; i < pos.length; i++)
{
item = pos[i];
if (itemList[item[0]])mc = itemList[item[0]][item[1]] as MovieClip;
if (mc)
{
if (mc.blcd != 0 && ((item[2] == 2 && mc.blcd == 2) || (item[2] == 1 && mc.blcd == 2) || (item[2] == 2 && mc.blcd == 1))) res[i] = 1;
}
}
return res;
}
Проверка проходимости сетки. И, да, эти мувики не в дисплейлисте, они просто хранят информацию.
+163
if ($linksCount == 0) $linksCount = -1; // for no error
$percent = round(($linksOkIndex/$linksCount)*100, 0);
if ($linksCount == -1) $linksCount = 0; // for no error
Я так избегаю деления на ноль -)
+71
setCookie(new String[] {username, Long.toString(expiryTime), signatureValue}, tokenLifetime, request, response);
int tokenLifetime = calculateLoginLifetime(request, successfulAuthentication);
protected int calculateLoginLifetime(HttpServletRequest request, Authentication authentication) {
return getTokenValiditySeconds();
}
protected int getTokenValiditySeconds() {
return tokenValiditySeconds;
}
private int tokenValiditySeconds = TWO_WEEKS_S;
public static final int TWO_WEEKS_S = 1209600;
Spring Security........
Логирование по куки токену.....