Skip to content

Instantly share code, notes, and snippets.

View fabrizim's full-sized avatar

fabrizim

View GitHub Profile
{% capture email_title %}Thank you for your purchase! {% endcapture %}
{% capture email_body %}Hi {{ customer.first_name }}, we're getting your order ready to be shipped. We will notify you when it has been sent.{% endcapture %}
{% assign presale_order = false %}
{% for line in line_items %}
{% if line.sku == 'WAV-E-B1' %}
{% assign presale_order = true %}
{% endif %}
{% endfor %}
@fabrizim
fabrizim / snippet.html
Last active June 18, 2019 20:19
Installing the LIHTC chart
<div
style="margin-bottom: 30px; position: relative; z-index: 2"
data-freddiemac-chart="lihtc"
data-xls="PATH/TO/DIST/lihtc/data/LIHTC-data.xlsx"
></div>
<script type="text/javascript" src="PATH/TO/DIST/common/embed.js"></script>
import Cookies from './cookies';
import distance from './geo';
const $ = jQuery;
class UserLocation {
constructor(){
this.stores = cabothouse_config.locations;
this.initLocation();
this.initEvents();
function stripScript( html ){
let match;
const re = /<script[^>]+?src=['"](.+?)['"][^>]*?><\/script>/gi;
while( (match =re.exec(html)) ){
const script = document.createElement('script');
script.src = match[1];
document.body.appendChild( script );
}
html = html.replace(re, '');
@fabrizim
fabrizim / get_posts_related_by_common_terms.php
Last active June 22, 2021 12:42
get_posts_related_by_common_terms.php
@fabrizim
fabrizim / replace-bird-with-x.php
Last active May 28, 2024 09:00
Elementor: Replace Twitter Icon with new X Icon
<?php
add_filter( 'elementor/widget/render_content', function($output){
// replace the
$re = '/(<svg[^>]+class="[^"]*e-fab-twitter".*?<path\s+d=")(.+?)(".+?<\/svg>)/s';
$output = preg_replace_callback($re, function($matches){
$path = "M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8L200.7 275.5 26.8 48H172.4L272.9 180.9 389.2 48zM364.4 421.8h39.1L151.1 88h-42L364.4 421.8z";
return $matches[1].$path.$matches[3];
}, $output);
return $output;
@fabrizim
fabrizim / regex.txt
Created June 14, 2024 15:48
convert wpengine access log to a csv (tab separated) regex
^(\S+?)\s(\S+)\s-\s\[([^\]]+)\]\s"(\S+)\s(\S+)\s(\S+)"\s(\S+)\s(\S+)\s"(\S+)"\s"([^"]+)"
$1 $2 $3 $4 $5 $6 $7 $8 $9 $10