- 1
- 2
- 3
- 4
- 5
- 6
- 7
ВЫБРАТЬ
SEO.титл КАК Титл,
SEO.Описание КАК дескриптионс,
SEO.Кейворд КАК Кейворд,
SEO.Ссылка КАК сео
ИЗ
Справочник.SEO КАК SEO
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+4
ВЫБРАТЬ
SEO.титл КАК Титл,
SEO.Описание КАК дескриптионс,
SEO.Кейворд КАК Кейворд,
SEO.Ссылка КАК сео
ИЗ
Справочник.SEO КАК SEO
импортозамещение...
+1
private static int CalcCheckSum(byte[] BinFile)
{
int length = ((IEnumerable<byte>) BinFile).Count<byte>();
if (length > 0)
{
int num = 0;
for (int index = 0; index < length; ++index)
num = num + (int) BinFile[index] & (int) ushort.MaxValue;
}
return num;
}
Израильский инновационный вариант rolling hash'а :facepalm:
Здесь есть всё: и альтернативное определение длины массива, и обилие приведений к инту, и придающая особую таинственность битовая операция &
На первый взгляд может показаться, что результатом будет простая сумма всех байт, но не дайте себя обмануть! Результат - это суперсекретная(!!!11) сумма всех байт.
0
public ReadFile(string path)
{
byte[] BinFile = File.ReadAllBytes(path);
if (((IEnumerable<byte>) BinFile).Count<byte>() <= 25)
return;
this._Version = BinFile[0].ToString() + "." + BinFile[1].ToString() + "." + BinFile[2].ToString();
}
Я вам тут израильского инжиниринга принёс. Читаем файл, читаем версию.
В этом коде прекрасно всё...
0
https://github.com/VKCOM/bot-example-php/blob/master/html/bot/bot.php
В великом и недосягаемом "ВКонтакте" переменные в текст по-прежнему включают с помощью фигурных скобок.
0
function checkAnswer(lastId, connectionString, success, unsuccess, installationNumber) {
var result;
for(var i=0;i<3*15/*15min*/;i++) {
Delay(periodCheckingComponentsInstalled, "Waiting components to be installed");
result = getDataFromDB(connectionString, lastId);
var k = [];
for(var i=0;i<success.length; i++) {
k.push(false);
}
for(var i=0;i<success.length;i++) {
if ((success[i] == "RemoteSuccess") || (success[i] == "RemoteUnSuccess")) {
k[i] = true;
break;
}
else {
for(var j=0;j<result.length ; j++) {
if (result[j].length > 40) {
k[i] = includeArray(result, success[i]);//40 symb
if (includeArray(result, unsuccess[i])) Log.Error("error while installing, number installation = " + installationNumber);
}
}
}
}
var bool = true;
for (var i=0;i<success.length; i++) {
bool = bool&&k[i];
}
if (bool) return true; else continue;
return false;
}
}
Остался скрипт от тестировщика. Блядь, и такого там с мегабайт.
0
/**
* Queries the DOM for the HTML element based on selector string passed.
* @param {String} selector Selector we are querying for.
* @param {String} [parent] Parent is optional, if passed the function will look for a child element of that parent.
* @param {Boolean} [returnEmptyList] If set to true the function won't throw an error even if the element is not found.
* @return {Array} HTML objects.
*/
function getEl( selector, parent, returnEmptyList )
{
var classOnly,
match,
elPrefix,
selPrefix,
context,
safeNode,
nodes;
classOnly = /^\.([\w\-]+)$/;
match = classOnly.exec( selector );
elPrefix = '.js-';
selPrefix = selector.substring( 0, 4 );
if ( ( selPrefix !== elPrefix || !typeCheck.isString( selector ) ) && match !== null )
{
throw new Error( 'Please make sure you input a valid class name that begins with a proper prefix.' );
}
if ( typeCheck.isString( parent ) )
{
context = document.getElementsByClassName( parent.substring( 1 ) )[ 0 ];
}
else if ( typeCheck.isElement( parent ) )
{
context = parent;
}
else
{
context = document;
}
nodes = match === null ? context.querySelectorAll( selector ) : context.getElementsByClassName( match[ 1 ] );
safeNode = nodes.length > 0 && nodes;
if ( safeNode || !safeNode && returnEmptyList )
{
return [].slice.call( nodes ); //converts it to a proper array.
}
else
{
throw new Error( 'Element with selector "' + selector + '" does not exist on the page.' );
}
}
+5
// PHP при делении может неявно конвертировать целые в плавающие, и всех этих int-ограничений для него не существует
echo 12 / 5; // 2.4
// Было бы логично предположить, что другие операторы работают так же, но эта камбала неявно кастует уже плавающее к целому в соседнем операторе
echo 9 % 0.9;
PHP Fatal error: Uncaught DivisionByZeroError: Modulo by zero in Command line code:1
Stack trace:
#0 {main}
thrown in Command line code on line 1
0
def _code_length(code=''):
CODE_MIN_LENGTH = 6
CODE_MAX_LENGTH = 8
if code in range(self.HS_CODE_MIN_LENGTH, self.HS_CODE_MAX_LENGTH + 1):
return code
_cut = lambda hsl: hsl[:self.HS_CODE_MIN_LENGTH]
_pad = lambda hsl: hsl.extend(repeat(0, self.HS_CODE_MIN_LENGTH + 1 - len(hsl)))
hsl = harmonized_code.split()
if len(hsl) < CODE_MIN_LENGTH:
return ''.join(_pad(hsl))
if len(hsl) > CODE_MAX_LENGTH:
return ''.join(_cut(hsl))
+2
kvm_rpm_table="[censored]/function/html/data.htm"
xen_rpm_table="[censored]/function/html/data1.htm"
if [ $1 != "kvm" ] && [ $1 != "xen" ]; then
echo "Please, specify kvm or xen"
exit 1
fi
if [ $1 != "kvm" ]; then
line=`wget $kvm_rpm_table -q -S -O - 2>&1 | grep 'Download' -m1`;
fi
if [ $1 != "xen" ]; then
line=`wget $xen_rpm_table -q -S -O - 2>&1 | grep 'Download' -m1`;
fi
По какой-то причине человек решил задефайнить в переменную про KVM страницу со ссылками на ядра с Xen, а в перменную про Xen -- страницу со ссылками на ядра с KVM. Чем и вызван весь дальнейший цирк.
+2
function isLogged() {
return '0';
return '';
}
function getForumPrefix() {
return 'forum/';
}
https://dota2.ru/forum/