Skip to content

Instantly share code, notes, and snippets.

@agusmu
agusmu / supported_chars.php
Created October 12, 2022 10:17 — forked from ErikKalkoken/supported_chars.php
Simple script that checks if all characters of a given string are supported by OTF / TTF font and outputs the findings in a simple HTML table.
<?php
/**
* Checks if all characters of a given string are supported by OTF file
* Outputs the findings in a simple HTML table
*
* Needs: php-font-lib @ https://github.com/PhenX/php-font-lib
*/
require_once "../src/FontLib/Autoloader.php";
@agusmu
agusmu / NOTES.md
Created February 11, 2022 11:22 — forked from fatso83/NOTES.md
Installing Vagrant on Apple Silicon Macs (M1, M1X, etc)

VirtualBox only supports the x86 platform, so the default installation instructions for Vagrant does not work on Apple silicon. Thankfully Vagrant has a VMWare Provider (more on providers here), and so if I can get VMWare running on my M1 MacBook, I should be able to run Vagrant as well!

These are my notes during figuring this out.

Get the VMWare Tech Preview released in September 2021!

We are in luck, as VMWare released this just a few weeks ago.

  • See [their blog entry][1]
@agusmu
agusmu / vagrant-vmware-tech-preview-apple-m1-pro.md
Created February 11, 2022 11:22 — forked from sbailliez/vagrant-vmware-tech-preview-apple-m1-pro.md
Vagrant and VMWare Tech Preview on Apple M1 Pro

Vagrant and VMWare Tech Preview on Apple M1 Pro

This document summarizes notes taken while to make the VMWare Tech preview work on Apple M1 Pro, it originated from discussions in hashicorp/vagrant-vmware-desktop#22

Installing Rosetta

First install Rosetta if not already done, this is needed to run x86 code:

@agusmu
agusmu / wordpress-valet-install.md
Created December 23, 2021 09:59 — forked from orumad/wordpress-valet-install.md
How to install Wordpress from command line in Valet

How to install Wordpress from command line in Valet

I use Valet as my local web development environment (PHP, Laravel, Wordpress, ...)

This gist is my own recipe to install Wordpress from the command line to use it with Valet. Maybe this is useful for you too.

Install 'WP-CLI' command line tool

@agusmu
agusmu / flying-press.conf
Created October 4, 2020 23:30 — forked from gijo-varghese/flying-press.conf
Nginx Config for FlyingPress
location ~* \.html$ {
add_header x-flying-press-cache HIT;
add_header x-flying-press-source Nginx;
}
set $flying_press_cache 1;
set $flying_press_url "/wp-content/cache/flying-press/$request_uri/index.html";
set $flying_press_file "$document_root/wp-content/cache/flying-press/$request_uri/index.html";
if ($request_method = POST) {
@agusmu
agusmu / Customizerref.php
Created March 29, 2020 05:29 — forked from cryptexvinci/Customizerref.php
WordPress Customizer Sample Reference
<?php
/**
* WordPress Customizer Comprehensive Reference
* Compiled by @ti_asif
*/
Panel
Section
Go to Bitbucket and create a new repository (its better to have an empty repo)
git clone git@bitbucket.org:abc/myforkedrepo.git
cd myforkedrepo
Now add Github repo as a new remote in Bitbucket called "sync"
git remote add sync git@github.com:def/originalrepo.git
Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync"
git remote -v
@agusmu
agusmu / functions.php
Created October 10, 2016 02:55 — forked from fervous/functions.php
Show shipping by vendor next to item in cart
// SHIPPING IN CART
add_filter( 'woocommerce_cart_item_name', 'wcv_shipping_cart_item', 1, 3 );
function wcv_shipping_cart_item( $title = null, $cart_item = null, $cart_item_key = null ) {
$settings = get_option( 'woocommerce_wcv_pro_vendor_shipping_settings' );
$customer_address = array( 'country' => WC()->customer->get_shipping_country(), 'state' => WC()->customer->get_shipping_state() );
$package = array( 'destination' => $customer_address );
$shipping_rate = WCVendors_Pro_Shipping_Method::get_shipping_rate( $cart_item[ 'product_id' ], $cart_item['data']->post->post_author, $package, $settings );
if( $cart_item_key && is_cart() ) {
echo $title. '<br /><span class=""><br>Shipping : ' . get_woocommerce_currency_symbol(). $shipping_rate->fee . '</span>';
<?php
/**
* Filter the output of image_downsize() to return dynamically generated images for intermediate or inline sizes.
*
* <p>Because Wordpress generates all image sizes on first upload, if you change
* theme or size settings after the upload, there won't be a matching file for
* the requested size.<br/>
* This filter addresses the problem of the default downsize process laoding
* a large file and scaling it down in the browser if it doesn't find the right
* size image. This can cause large files to be loaded unnecessarily and will
if ( $post->post_parent )
{
wp_redirect( get_permalink( $post->post_parent ), 301 );
}
else
{
wp_redirect( site_url(), 301 ) );
}
die();