Skip to content

Instantly share code, notes, and snippets.

View OksanaRomaniv's full-sized avatar

Oksana Romaniv OksanaRomaniv

  • Kalush, Ukraine
View GitHub Profile
@futtta
futtta / autoptimize_defer_inline_jquery.php
Last active November 11, 2022 21:43
POC to defer inline JS that requires jQuery
<?php
add_action('plugins_loaded','ao_defer_inline_init');
function ao_defer_inline_init() {
if ( get_option('autoptimize_js_include_inline') != 'on' ) {
add_filter('autoptimize_html_after_minify','ao_defer_inline_jquery',10,1);
}
}
function ao_defer_inline_jquery( $in ) {
@ahmadawais
ahmadawais / flywheel-local-xdebug-vscode.md
Last active November 23, 2023 16:55
Debug WordPress with Visual Studio Code | VSCode WordPress Debug Setup | WordPress xDebug Setup for Local by FlyWheel with VSCode | Part of the VSCode Learning Course → https://VSCode.pro

VSCode WordPress Debugging Setup: WordPress Xdebug Setup for Local by FlyWheel with VSCode


Consider supporting my work by purchasing the course this tutorial is a part of i.e. VSCode Power User

🚅 TL;DR

  • Make sure your Local by FlyWheel WordPress install is a custom install
@bjornjohansen
bjornjohansen / wordpress-menu-cache.php
Last active March 7, 2024 13:57
WordPress Menu Cache
<?php
/**
* WordPress menu cache.
*
* @package BJ\Menu
* @author bjornjohansen
* @version 0.1.0
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License version 2 (GPLv2)
*/
@zeshanshani
zeshanshani / html.json
Last active September 21, 2020 12:44
Expand PHP conditionals in HTML in VS Code.
{
// ECHO
"PHP Echo Tag": {
"prefix": "echo",
"body": [
"<?php echo ${1:\\$var}; ?>"
],
"description": "Expand \"echo\" into PHP echo block"
},
@zentala
zentala / formatBytes.js
Created September 27, 2017 11:57
Convert size in bytes to human readable format (JavaScript)
function formatBytes(bytes,decimals) {
if(bytes == 0) return '0 Bytes';
var k = 1024,
dm = decimals || 2,
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
// Usage:
@mavame
mavame / GoogleMapsApi.js
Last active December 6, 2023 21:53
A simple class for loading the Google Maps Javascript API in browser async using ES6 and Promise
/**
* Use this class to ensure Google Maps API javascript is loaded before running any google map specific code.
*/
export class GoogleMapsApi {
/**
* Constructor set up config.
*/
constructor() {
// api key for google maps
@spivurno
spivurno / gw-gravity-forms-checkbox-to-acf.php
Last active October 29, 2018 15:26
Gravity Wiz // Gravity Forms // Map GF Checkbox Field to ACF Checkbox Field
/**
* Gravity Wiz // Gravity Forms // Map GF Checkbox Field to ACF Checkbox Field
* http://graivtywiz.com/
*/
add_filter( 'gform_post_data', function( $data ) {
// Update "checkboxes" to your cusotm field name.
$data['post_custom_fields']['checkboxes'] = serialize( explode( ',', $data['post_custom_fields']['checkboxes'] ) );
return $data;
} );
@vishalkakadiya
vishalkakadiya / commands.txt
Created August 3, 2017 19:54
Commands to Upgrade PHPcs and WordPress_Coding_Standards
// Update PHPcs
sudo pear upgrade-all and sudo pear install PHP_CodeSniffer
// Check version of PHPcs
phpcs --version
// Go to Where coding standards available
/usr/local/pear/share/pear/PHP/CodeSniffer/Standards/WordPress-Coding-Standards
@nicomollet
nicomollet / yoastseo-remove-breadcrumb-link.php
Last active June 1, 2023 01:11
Yoast SEO remove breadcrumb link
@moso
moso / app.js
Last active December 15, 2022 07:28
laravel-mix config
// jQuery import
global.jQuery = require('jquery');
var $ = global.jQuery;
window.$ = $;
// Bootstrap 4 depends on Popper.js
// Popper.js import
//import Popper from 'popper.js';
//window.Popper = Popper;