Skip to content

Instantly share code, notes, and snippets.

View mindaugasbudreika's full-sized avatar

Mindaugas Budreika mindaugasbudreika

View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active October 7, 2026 00:48
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@fevangelou
fevangelou / default.vcl_PREFACE.md
Last active May 13, 2026 16:23
The perfect Varnish configuration for WordPress, Joomla, Drupal & other (common) CMS based websites

The perfect Varnish configuration for WordPress, Joomla, Drupal & other (common) CMS based websites

Updated on December 15th, 2021

IMPORTANT: Read this before implementing one of the configuration files below (for either Varnish 3.x or 4.x+).

USE: Replace the contents of the main Varnish configuration file located in /etc/varnish/default.vcl (root server access required - obviously) with the contents of the configuration you'll use (depending on your Varnish version) from the 2 examples provided below.

IMPORTANT: The following setup assumes a 180 sec (3 minute) cache time for cacheable content that does not have the correct cache-control HTTP headers. You can safely increase this to 300 sec (or more) for less busier sites or drop it to 60 sec or even 30 sec for high traffic sites. It obviously depends on your use case.

@wpexplorer
wpexplorer / gist:7b865df164c4c7d0bed2
Created November 23, 2015 18:58
Custom WordPress Walker
<?php
/**
* /!\ This is a copy of Walker_Nav_Menu_Edit class in core
*
* Create HTML list of nav menu input items.
*
* @package WordPress
* @since 3.0.0
* @uses Walker_Nav_Menu
*/
@eexit
eexit / Getting a Moto X back to stock on OSX Raw.md
Last active November 28, 2020 17:37
Getting a Moto X back to stock on OSX

Getting a Moto X back to stock on OSX

Backup, first!

  1. Downloads the Android SDK Command Line Tools

     $ unzip android-sdk-macosx.zip
     $ cd android-sdk-macosx
    
  2. Create a backup folder

@Arinerron
Arinerron / permissions.txt
Last active September 5, 2026 03:27
A list of all Android permissions...
android.permission.ACCESS_ALL_DOWNLOADS
android.permission.ACCESS_BLUETOOTH_SHARE
android.permission.ACCESS_CACHE_FILESYSTEM
android.permission.ACCESS_CHECKIN_PROPERTIES
android.permission.ACCESS_CONTENT_PROVIDERS_EXTERNALLY
android.permission.ACCESS_DOWNLOAD_MANAGER
android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED
android.permission.ACCESS_DRM_CERTIFICATES
android.permission.ACCESS_EPHEMERAL_APPS
android.permission.ACCESS_FM_RADIO
@janneleppanen
janneleppanen / elasticpress-polylang.php
Last active June 4, 2020 20:48
ElasticPress - Polylang
// Filter Elasticsearch posts by current language
add_filter( 'ep_formatted_args', function($formatted_args, $args) {
$formatted_args['post_filter']['bool']['must'][] = [
'term' => [
'lang' => pll_current_language()
]
];
return $formatted_args;
}, 10, 2);
@gmanen
gmanen / .editorconfig
Created June 7, 2017 08:04
Editorconfig for Symfony projects
# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = LF
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
@sveggiani
sveggiani / instructions.md
Last active July 15, 2023 21:52
[Configure XDebug, Visual Studio Code for a Vagrant VM] #debug #vm #vscode #masscode

Configure XDebug, Visual Studio Code for a Vagrant VM

1. Assumptions

  • Project (Drupal) is served on /var/www/html in the Vagrant box
  • Local project files location: c:\Users\username\Work\projects\my-project\repo\html
  • Guest machine IP is 10.0.2.2 (if this doesn't work, run route -nee in the VM and look for the gateway address)

2. Configuration

@malkafly
malkafly / woocommerce-custom-shipping-method.php
Created February 20, 2018 18:10 — forked from alordiel/woocommerce-custom-shipping-method.php
Adding custom shipping method for WooCommerce (v. 3.2.6)
<?php
//Works with WooCommerce 3.2.6
add_action( 'woocommerce_shipping_init', 'econt_shipping_method' );
function econt_shipping_method() {
if ( ! class_exists( 'WC_Econt_Shipping_Method' ) ) {
class WC_Econt_Shipping_Method extends WC_Shipping_Method {
public function __construct( $instance_id = 0 ) {
$this->instance_id = absint( $instance_id );
$this->id = 'econt';//this is the id of our shipping method
@haze83
haze83 / create-config.sh
Last active September 11, 2026 16:02
WP-CLI
#!/bin/bash
# bash -c "$(curl -s https://gist.githubusercontent.com/haze83/0a8c65479b793285e00e92f561e66f8d/raw/d2537e8e3db767a9eb0954446e6bde571f107dc1/create-config.sh)"
echo "WP user: "
read WP_USER
echo "PROD (no leading /, relative to $HOME): "
read WP_PATH_PROD
echo "STAGING (no leading /, relative to $HOME): "
read WP_PATH_STAGING