Ведь это же тот же js, разве такие вещи могут писать дилетанты, что у одних нормальный код, а у других куча лишнего?первые версии ангуляра писали люди с опытом js около года. js недавно стал "мейнстримом" - там полно профанов
Подскажите, пожалуйста, почему их всё время сравнивают в скорости?потому что все они используются в продакшене у крупных компаний и других в "мейнстриме" просто нет
node first_app.js
node second_app.js
#include <limits.h>
#include <stdio.h>
#include <string.h>
#define N (sizeof(a) / sizeof(a[0]))
inline int sign(int d)
{
if (d == 0)
return 0;
return d < 0 ? -1 : 1;
}
inline int abs(int v)
{
return v < 0 ? -v : v;
}
int main()
{
int a[] = {2, 1, 3, 4, 0};
int q[N];
for (;;) {
int best_profit = INT_MIN;
int best_src = -1;
int best_dst = -1;
int i, src, dst, tmp;
for (i = 0; i < N; ++i)
q[i] = i - a[i];
for (src = 0; src < N; ++src)
for (dst = 0; dst < N; ++dst) {
int d = sign(dst - src);
int profit = abs(q[src]) - abs(q[src] + dst - src);
//printf("...%d -> %d: profit = %d", src, dst, profit);
for (i = src + d; i != dst + d; i += d) {
if (sign(q[i]) == d) {
++profit;
//printf(" + 1");
} else {
--profit;
//printf(" - 1");
}
}
//printf(" = %d\n", profit);
if (profit > best_profit) {
best_src = src;
best_dst = dst;
best_profit = profit;
//printf("... -- new best!\n");
}
}
printf("%d -> %d (profit = %d)\n", best_src, best_dst, best_profit);
if (best_profit == 0)
break;
tmp = a[best_src];
if (best_dst < best_src)
memmove(a + best_dst + 1, a + best_dst, (best_src - best_dst) * sizeof(int));
else
memmove(a + best_src, a + best_src + 1, (best_dst - best_src) * sizeof(int));
a[best_dst] = tmp;
for (i = 0; i < N; ++i)
printf("%d ", a[i]);
printf("\n");
}
return 0;
}
.header__nav
float: left
margin: 0
padding: 0
list-style-type: none
font-size: 0.875rem
li
display: inline-block
padding: 0 40 0 0
a
text-decoration: none
color: #000000
&:hover // здесь отступа не хватало
color: #FD683D
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
};
var myEfficientFn = debounce(function() {
// All the taxing stuff you do
}, 250);
window.addEventListener('resize', myEfficientFn);
var body = []; // Создаем переменную с массивом
request.on('data', function(chunk) { // Подписываем анонимную функцию на событие 'data'
// chunk - это блок полученных данных
body.push(chunk); // Добавляем блок данных в конец массива
}).on('end', function() { // Подписываем анонимную функцию на событие 'end'
body = Buffer.concat(body).toString(); // Объединяем все блоки даннных в один, затем конвертируем результат в строку и сохраняем в переменную body
});