Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Kirill Novik kino6052

View GitHub Profile
@kino6052
kino6052 / webpack.config.js
Created Oct 27, 2018
webpack-configuration-example
View webpack.config.js
const path = require( 'path' );
const webpack = require( 'webpack' );
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = ( env, options ) => {
return {
entry: './src/block.js',
output: {
path: path.resolve( __dirname, 'build' ),
@kino6052
kino6052 / alert-on-scroll-to-bottom.js
Last active Sep 10, 2018
Determine if user scrolled all the way to the bottom
View alert-on-scroll-to-bottom.js
// https://stackoverflow.com/questions/9439725/javascript-how-to-detect-if-browser-window-is-scrolled-to-bottom
window.onscroll = function(ev) {
if ((window.innerHeight + window.pageYOffset) >= document.body.offsetHeight) {
alert("you're at the bottom of the page");
}
};
@kino6052
kino6052 / array-remove-value-by-index.js
Last active Aug 31, 2018
Elegant way to remove value from an array by index
View array-remove-value-by-index.js
let array = [1, 2, 3];
let index = 1; // Any index
let filteredArray = array.filter((el, i) => i !== index); // [1, 3]
You can’t perform that action at this time.