Skip to content

Instantly share code, notes, and snippets.

View byevhen2's full-sized avatar

Biliavskyi Yevhen byevhen2

View GitHub Profile
@byevhen2
byevhen2 / PHP 7+: New Features.md
Last active December 4, 2025 17:59
PHP: New Features

PHP 8.1 (Unfinished)

  • never return-only type indicating the function does not terminate: calls exit(), throws an exception, or is an infinite loop.
    • Cannot be part of a union type declaration.

PHP 8.0

All features.

  • mixed pseudo-type: function parse_int(mixed $input) (in addition to bool, int, float, string, array, object, iterable, callable, self, parent and interface/class name).
@byevhen2
byevhen2 / apiRequest.js
Last active October 7, 2025 22:04 — forked from phpbits/apiRequest.js
Using wp.apiRequest to access custom endpoints.
// See: wp-includes/js/api-request.js
// Returns a jqXHR object. See: https://api.jquery.com/jQuery.ajax/#jqXHR
wp.apiRequest({path: '/namespace/vendor/v1/config'})
.then(configOptions => console.log(configOptions));
// jqXHR object has method then(), but does not have methods catch() or
// finally(). Use fail() or always() instead
wp.apiRequest({path: '/namespace/vendor/v1/config'})
.done(configOptions => console.log(configOptions))
@byevhen2
byevhen2 / Build both .js and .min.js with webpack.md
Last active October 22, 2022 11:58
How to build both minified and uncompressed bundle with Webpack

Q: How to build both minified and uncompressed bundle with Webpack?

A1: Use plugin UglifyJsPlugin (before webpack 4)

let webpack = require("webpack");

module.exports = {
    entry: {
        'bundle': './entry.js',
 'bundle.min': './entry.js'
@byevhen2
byevhen2 / less-is-more.md
Last active December 4, 2018 19:00 — forked from carlosschults/less-is-more.md
Less Is More

Less is more


NOTE: This gist is a translation from an article by Marcos Douglas. Here is the original version, in Brazilian Portuguese: http://objectpascalprogramming.com/posts/menos-e-mais/.


Have you ever wondered what would be the ideal quantity of arguments in a method? And how about the number of methods on an interface or class? And how many classes would you put inside a single unity?