- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
function update_order($d)
{
/*
* [...] Всё погрызли злобные снусмумрики
*/
return $true;
}
Ъ
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+145
function update_order($d)
{
/*
* [...] Всё погрызли злобные снусмумрики
*/
return $true;
}
Ъ
+139.1
// Get required auth level
$required_auth_level = 0;
if ($d["status"] > 1) $required_auth_level = 1;
if ($d["status"] > 3) $required_auth_level = 2;
Магия чисел
+159.9
eval("\$value = \"$value\";");
AdsManager - компонент для Joomla!
Я не сразу понял что делает эта строчка...
+157.9
var ext = /(\.[^.]*?)$/.exec(filename)?/(\.[^.]*?)$/.exec(filename)[1]:/[\/\\]([^\/\\]*?)$/.exec(filename)?/[\/\\]([^\/\\]*?)$/.exec(filename)[1]:filename; // I love JavaScript :)
получаем расширение файла )
+144
for (int i = 0; i < arr.Length; i++)
{
for (int j = 0; j < arr[i].Length; j++)
{
for (int k = 0; k < arr[i][j].Length; k++)
Console.Write(arr[i][j][k] + " ");
Console.Write("\n");
}
Console.Write("\n");
}
хотя это просто
вот, господа, пользуйтесь - говнокодец ещё свеженький))
+149
// для хранения 3 квадратных матриц в одном массиве
// 5 5 5 5 5 5
// 5 5 5 5 5
// 5 5 5
int[][][] arr = new int [3][][];
arr[0] = new int[1][];
arr[0][0] = new int[1] { 5 };
arr[1] = new int[2][];
arr[1][0] = new int[2] { 5, 5 };
arr[1][1] = new int[2] { 5, 5 };
arr[2] = new int[3][];
arr[2][0] = new int[3] { 5, 5, 5 };
arr[2][1] = new int[3] { 5, 5, 5 };
arr[2][2] = new int[3] { 5, 5, 5 };
якобы для хранения трех матриц разных размерностей в одном jagged-массиве
(на самом деле это не так)
вопрос: как выглядит код для отображения содержимого данного jagged-массива, например, в консоль?
+145.2
// тип System.Int32[]
int[] d = new int[0] { };
// тип System.Int32[,]
int[,] d = new int[3,0] { {}, {}, {} }
// тип System.Int32[,]
int[,] d = new int[1,0] { {} };
// тип System.Int32[, ,]
int[, ,] d = new int[2, 1, 0] { { { } }, { { } } };
// тип System.Int32[, , , , ,] и т.д.
int[, , , , ,] d = new int[1, 1, 1, 1, 1, 0] { { { { { { } } } } } };
// System.Int32[][][][][][][][][][][][][][][][][][][][][][][][][]
// (jagged array)
int[][][][][][][][][][][][][][][][][][][][][][][][][] d =
new int[5][][][][][][][][][][][][][][][][][][][][][][][][];
главное все работает
теперь осталось найти применение.. :)
+140.8
private String mPrimaryCorrelationKey;
public String getPrimaryCorrelationKey()
{
long current = System.currentTimeMillis();
current++;
return new Long(current).toString();
}
public void setPrimaryCorrelationKey(String mPrimaryCorrelationKey) {
this.mPrimaryCorrelationKey = mPrimaryCorrelationKey;
}
соответствующий геттер для этой проперти должен возвращать всегда уникальный id
+143
public final class SqliteWrapper {
private static final String SQLITE_EXCEPTION_DETAIL_MESSAGE
= "unable to open database file";
...
// FIXME: need to optimize this method.
private static boolean isLowMemory(SQLiteException e) {
return e.getMessage().equals(SQLITE_EXCEPTION_DETAIL_MESSAGE);
}
...
}
Android source
+149.2
$page = preg_replace( array( "/action=.*?\\&/i",
"/bx_event_calendar_request=.*?\\&/i",
"/clear_cache=.*?\\&/i",
"/bitrix_include_areas=.*?\\&/i",
"/bitrix_show_mode=.*?\\&/i",
"/back_url_admin=.*?\\&/i"), "", $arParams['pageUrl']."&" );
$page = preg_replace( array( "/^(.*?)\\&\$/i", "/^(.*?)\\?\$/i" ), "\$1", $page );
как перечислить возможные слова или символы в регулярке? Нормальные программисты делают это через (word1|word2) и [&?], но в битриксе...