Skip to content

Instantly share code, notes, and snippets.

@vova-learn
vova-learn / js-get-max-value-array.js
Last active May 10, 2024 00:32
We get two maximum values ​​from the array while maintaining with index / Получить два максимальных значения массива с сохранением индекса
const carsSale = [
{
brand: `KIA`,
model: `Ceed`,
miles: 32080,
}, {
brand: `TESLA`,
model: `MODEL X`,
miles: 2080,
}, {
@vova-learn
vova-learn / Hello, world!
Last active May 10, 2024 00:32
Just for test!
<script>
alert( 'Hello, world!' );
</script>
@vova-learn
vova-learn / css-visually-hidden.css
Last active May 10, 2024 00:31
Visually hidden template / Шаблон css-правила для скрытия элемента
.visually-hidden {
position: absolute;
clip: rect(1px 1px 1px 1px);
clip: rect(1px, 1px, 1px, 1px);
padding:0;
border:0;
height: 1px;
width: 1px;
overflow: hidden;
}
@vova-learn
vova-learn / js-magic-digit.js
Last active May 10, 2024 00:31
Find the magic digit / Найти магическое число
'use strict';
class MakeNumber {
constructor() {
this._number = null;
}
create() {
this._number = Math.ceil(Math.random() * 100);
if (this._number) {
@vova-learn
vova-learn / throttle.js
Created April 10, 2023 09:02
Функция throttle для пропуска кадров
// Функция взята из интернета и доработана
// Источник - https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_throttle
function throttle (callback, delayBetweenFrames) {
// Используем замыкания, чтобы время "последнего кадра" навсегда приклеилось
// к возвращаемой функции с условием, тогда мы его сможем перезаписывать
let lastTime = 0;
return (...rest) => {
// Получаем текущую дату в миллисекундах,
'use strict';
var watchify = require('watchify');
var browserify = require('browserify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var gutil = require('gulp-util');
var sourcemaps = require('gulp-sourcemaps');
var lodash = require('lodash');
var reactify = require('reactify');
@genadyp
genadyp / javascript-useful-links.md
Last active May 10, 2024 00:30
javascript (js) useful links
@Zeokat
Zeokat / gist:3b5c1273a7da48e1ad94
Created August 30, 2014 01:47
/etc/apache2/apache2.conf
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/ for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
#
#
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
<!-- Add this to the Head section of your super site -->
<script>
// Say we host our Super site in a subdirectory e.g. https://example.com/blog
// We can redirect it properly in Cloudflare Worker, but relative links will break
// So we require some custom code to override absolute href paths & history state changes
if (window.location.origin === 'https://example.com') {
var baseDir = '/blog';
function historyMethodOverride(target, thisArg, argArray) {
// prepend baseDir if it isn't there
@tomnk
tomnk / javascriptLodashUnderscore.md
Created October 22, 2018 16:12
102120254: Javascript You don't (may not) know Lodash/Underscore

You don't (may not) know Lodash/Underscore

In response to You-Dont-Need-Lodash-Underscore made by @cht8687, yes some of the methods could be replaced by native methods. This is not the case when things get a bit more complex. According to the Lodash author, @jdalton:

If you're only using a handful of methods on arrays and don't care about nullish guards, object iteration, smoothing over enviro/ES5/ES6 issues, FP goodies, iteratee shorthands, lazy evaluation, or other enhancements then built-ins are the way to go. Folks who use lodash know its 270+ modules work great combo'ed with ES6, enabling cleaner code and empowering beyond built-ins.

ESLint?

There is a plugin