Skip to content

Instantly share code, notes, and snippets.

View beardlessman's full-sized avatar

Dmitrii Mungalov beardlessman

View GitHub Profile
const qsort = (arr) => {
if (arr.length < 2) {
return arr;
} else {
// Опорная точка для деления массива, выбирается случайно
const pivotPosition = Math.floor(Math.random() * arr.length);
const pivot = arr[pivotPosition];
// Значения меньшие, либо равные опорному
// попадают в новый массив less
const less = arr.filter((value, index) => {
@beardlessman
beardlessman / wp_query.php
Created March 13, 2018 09:41 — forked from akella/wp_query.php
wp query
<?php
$args = array(
'category_name' => 'news',
'posts_per_page' => 3
);
$my_query = new WP_Query( $args );
if ( $my_query->have_posts() ) {
@beardlessman
beardlessman / webpack.banner.js
Created April 17, 2018 04:50 — forked from kevinSuttle/webpack.banner.js
Webpack auto-injecting banner into each file
const pkg = require('./package.json');
const moment = require('moment');
const localTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone
const timeStamp = moment().format('LLLL');
const banner = `
Generated on ${timeStamp} - ${localTimeZone}
Description: ${pkg.description}
Package: ${pkg.name}
Version: v${pkg.version}
Contributors: ${pkg.contributors.map(function(contributor){ return contributor})}