Skip to content

Instantly share code, notes, and snippets.

View byevhen2's full-sized avatar

Biliavskyi Yevhen byevhen2

View GitHub Profile
@byevhen2
byevhen2 / apiRequest.js
Last active September 9, 2024 07:19 — 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 / 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?