- 1
Как вы думаете, что может делать функция getAlabamaTimezone(now: Date) ?
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
Как вы думаете, что может делать функция getAlabamaTimezone(now: Date) ?
0
// https://github.com/WebKit/WebKit/blob/31b77296cf6d85c40313812d9f65a003cf41f440/Source/WebCore/page/Quirks.cpp#L330
bool Quirks::isGoogleMaps() const
{
auto& url = m_document->topDocument().url();
return topPrivatelyControlledDomain(url.host().toString()).startsWith("google.") && url.path().startsWithIgnoringASCIICase("/maps/");
}
bool Quirks::shouldDispatchSimulatedMouseEvents() const
{
if (RuntimeEnabledFeatures::sharedFeatures().mouseEventsSimulationEnabled())
return true;
if (!needsQuirks())
return false;
auto doShouldDispatchChecks = [this] () -> bool {
auto* loader = m_document->loader();
if (!loader || loader->simulatedMouseEventsDispatchPolicy() != SimulatedMouseEventsDispatchPolicy::Allow)
return false;
if (isAmazon())
return true;
if (isGoogleMaps())
return true;
auto& url = m_document->topDocument().url();
auto host = url.host().convertToASCIILowercase();
if (host == "wix.com" || host.endsWith(".wix.com")) {
// Disable simulated mouse dispatching for template selection.
return !url.path().startsWithIgnoringASCIICase("/website/templates/");
}
if ((host == "desmos.com" || host.endsWith(".desmos.com")) && url.path().startsWithIgnoringASCIICase("/calculator/"))
return true;
if (host == "figma.com" || host.endsWith(".figma.com"))
return true;
if (host == "trello.com" || host.endsWith(".trello.com"))
return true;
if (host == "airtable.com" || host.endsWith(".airtable.com"))
return true;
if (host == "msn.com" || host.endsWith(".msn.com"))
return true;
if (host == "flipkart.com" || host.endsWith(".flipkart.com"))
return true;
if (host == "iqiyi.com" || host.endsWith(".iqiyi.com"))
return true;
if (host == "trailers.apple.com")
return true;
if (host == "soundcloud.com")
return true;
if (host == "naver.com")
return true;
if (host == "nba.com" || host.endsWith(".nba.com"))
return true;
if (host.endsWith(".naver.com")) {
// Disable the quirk for tv.naver.com subdomain to be able to simulate hover on videos.
if (host == "tv.naver.com")
return false;
// Disable the quirk for mail.naver.com subdomain to be able to tap on mail subjects.
if (host == "mail.naver.com")
return false;
// Disable the quirk on the mobile site.
// FIXME: Maybe this quirk should be disabled for "m." subdomains on all sites? These are generally mobile sites that don't need mouse events.
if (host == "m.naver.com")
return false;
return true;
}
return false;
};
if (!m_shouldDispatchSimulatedMouseEventsQuirk)
m_shouldDispatchSimulatedMouseEventsQuirk = doShouldDispatchChecks();
return *m_shouldDispatchSimulatedMouseEventsQuirk;
}
Дааа блядь, давайте в движке браузера захардкодим какие-то говнодомены, что типа вот для них какая-то там блядь симуляция событий мыши работала каким-то таким образом. Охуенно!
−1
https://habr.com/post/417047/
Гвидо уходит напитон из питона
+3
Оффтоп
Пишу либу для гуя в консоли. Столкнулся с проблемой медленного вывода в консоль на линуксе.
На винде есть няшный WriteConsoleOutput, который может вывести буфер разом на консоль, в линупсе ничего подобного не нашел.
Если использовать Console.WriteLine или libc-шный puts, все лагает неимоверно
Есть идеи?
+192
<शैली श्रेणी>
#समावेश <मानकपन.स>
श्रेणी जानवर
{
खुला:
भव व्योम लिखो()
{
म_लिखो("यह एक जानवर है।\n");
}
};
श्रेणी शेर : खुला जानवर
{
खुला:
व्योम लिखो()
{
म_लिखो("शेर एक जानवर है।\n");
}
};
श्रेणी चीता : खुला जानवर
{
खुला:
व्योम लिखो()
{
म_लिखो("चीता एक जानवर है।\n");
}
};
पूर्णांक मुख्य()
{
जानवर ज, *ज१;
शेर श;
चीता च;
ज.लिखो();
श.लिखो();
च.लिखो();
ज१=&ज;
ज१->लिखो();
ज१=&श;
ज१->लिखो();
ज१=&च;
ज१->लिखो();
वापस 0;
}
Вот вы все говорите про индусский код, а он на самом деле вот такой! Мне кажется, простой и логичный!
(Дистрибутив на http://hindawi.in/en_US/download.php)
0
template<typename T>
class SharedPtr {
T* value;
int* ref_count;
public:
SharedPtr(T* value) : value(value) {
ref_count = new int;
*ref_count = 1;
}
SharedPtr(const SharedPtr& other) {
value = other.value;
ref_count = other.ref_count;
(*ref_count)++;
}
SharedPtr(SharedPtr&& other) {
value = other.value;
ref_count = other.ref_count;
other.ref_count = nullptr;
}
~SharedPtr() {
if (ref_count == nullptr) {
return;
}
if (*ref_count == 1) {
delete value;
delete ref_count;
} else {
(*ref_count)--;
}
}
T& operator *() const {
return *value;
}
T* operator ->() const {
return value;
}
};
Реалейзовал минимальную версию shared_ptr. Есть ошибки/замечания?
https://ideone.com/g7gqBM
+3
&НаКлиенте
Процедура ИмяФайла_ПроизводственнаяПрограммаНачалоВыбора(Элемент, ДанныеВыбора, СтандартнаяОбработка)
ДиалогВыборФайла = Новый ДиалогВыбораФайла(РежимДиалогаВыбораФайла.Открытие);
ДиалогВыборФайла.Фильтр = "Файлы Microsoft Excel (*.xls, *.xlsx, *.xlsm)|*.xls; *.xlsx; *.xlsm|Все файлы (*.*)|*.*";
ДиалогВыборФайла.Показать(Новый ОписаниеОповещения("ИмяФайла_ПроизводственнаяПрограммаНачалоВыбораЗавершение", ЭтотОбъект, Новый Структура("ДиалогВыборФайла,ИмяФайла", ДиалогВыборФайла, Элемент.Имя)));
КонецПроцедуры
&НаКлиенте
Процедура ИмяФайла_ПроизводственнаяПрограммаНачалоВыбораЗавершение(ВыбранныеФайлы, ДополнительныеПараметры) Экспорт
ДиалогВыборФайла = ДополнительныеПараметры.ДиалогВыборФайла;
Если (ВыбранныеФайлы <> Неопределено) Тогда
ЭтаФорма[ДополнительныеПараметры.ИмяФайла] = ДиалогВыборФайла.ПолноеИмяФайла;
КонецЕсли;
КонецПроцедуры
Асинхронные вызовы??? Нее.... Не слышал...
−4
Андроидотред #3
#1: https://govnokod.xyz/_19062
#2: https://govnokod.xyz/_25537 (стерла пидорва сракер)
−2
#include <stdio.h>
#include <stdlib.h>
int main ()
{
int a=120;
printf("%i\n",*&*&*&*&*&
*&*&*&*&*&*&*&*&*&*&*&*&
*&*&*&*&*&*&*&*&*&*&*&*&
*&*&*&*&*&*&*&*&*&*&*&*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*&
*&*&*&*&*&*&*&*&*&*&*&*&
*&*&*&*&*&*&*&*&*&*&*&*&
*&*&*&*&*&*&*&*&*&*&*&*&
*&*&*&*&*&*&*&*&*&*&*&*&
*&*&*&a);
}
+18
template <typename T>
struct canref {
struct yes { uint8_t bytes[1]; };
struct no { uint8_t bytes[2]; };
template <typename U> static yes test(U*p);
template <typename U> static no test(...);
static const bool value = sizeof(test<T>(NULL)) == sizeof(yes);
};
template <typename T, int N, bool CanRef=canref<T>::value>
class array;
// class for all types
template <typename T, int N>
class array <T,N,true>
{
struct Bytes
{
uint8_t bytes[sizeof(T)];
};
struct TStruct
{
T t;
TStruct(T t):t(t){}
};
Bytes elements[N];
int count;
void copy_ctor (int index, const T& t)
{
new (&((*this)[index])) T(t);
}
void copy (int index, const T& t)
{
(*this)[index] = t;
}
void dtor (int index)
{
(*this)[index].~T();
}
public:
array () : count(0) {}
~array ()
{
resize(0);
}
T& operator [] (int index)
{
assert (index>=0 && index<count);
return ((TStruct*)(&elements[index]))->t;
}
const T& operator [] (int index) const
{
assert (index>=0 && index<count);
return ((TStruct*)(&elements[index]))->t;
}
template <int M>
array (const array<T,M> &a)
{
assert(a.count<=N);
count = a.count;
for (int i=0; i<count; ++i)
copyctor(i, a[i]);
}
template <int M>
array& operator = (const array<T,M> &a)
{
if (this != &a)
{
if (count>a.count)
{
for (int i=0; i<a.count; ++i) copy(i, a[i]);
for (int i=a.count; i<count; ++i) dtor(i);
count = a.count;
} else
{
assert(a.count<=N);
int ocount = count;
count = a.count;
for (int i=0; i<ocount; ++i) copy(i, a[i]);
for (int i=ocount; i<count; ++i) copy_ctor(i, a[i]);
}
}
}
int size()
{
return count;
}
Скоро даже сратору станет очевидно откуда это.