Skip to content

Instantly share code, notes, and snippets.

@marcus-at-localhost
marcus-at-localhost / split.php
Created April 13, 2020 18:27
[Split by Comma but not if in Parenthesis] #regex #split #array
<?php
$filters = "1,2,4,(5,6,7),8;9";
var_dump(preg_split("~[,|;](?![^(]*\\))~", $filters));
/*
array (size=6)
0 => string '1' (length=1)
1 => string '2' (length=1)
2 => string '4' (length=1)
@xeoncross
xeoncross / YouTubeURLFormats.txt
Created January 16, 2021 03:55 — forked from rodrigoborgesdeoliveira/ActiveYouTubeURLFormats.txt
Example of the various YouTube url formats
http://www.youtube.com/watch?v=-wtIMTCHWuI
http://www.youtube.com/v/-wtIMTCHWuI?version=3&autohide=1
http://youtu.be/-wtIMTCHWuI
http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D-wtIMTCHWuI&format=json
http://www.youtube.com/attribution_link?a=JdfC0C9V6ZI&u=%2Fwatch%3Fv%3DEhxJLojIE_o%26feature%3Dshare
@nima-rahbar
nima-rahbar / linkvertise-bypass.js
Created January 30, 2021 13:08
Linkvertise Bypass
// ==UserScript==
// @name Linkvertise Bypass
// @namespace https://github.com/nima-rahbar/
// @version 1.0
// @description Bypass links that cannot be bypassed by Universal Bypass
// @author Nima Rahbar
// @match *://*.linkvertise.com/*
// @match *://*.linkvertise.net/*
// @match *://*.link-to.net/*
// @icon https://nimarahbar.com/wp-content/uploads/2017/07/favicon.png
@rocketgeek
rocketgeek / extract_html_atts.php
Created August 4, 2021 14:10
Extract "data-" attributes from WooCommerce HTML tags
<?php
// Extraction utility for getting attributes from HTML tag.
function extract_html_atts( $string, $prefix = "data-" ) {
$start = 0;
$end = 0;
while( strpos( $string, $prefix, $end ) ) {
$start = strpos( $string, $prefix, $start )+strlen( $prefix );
$end = strpos( $string, '"', $start )-1;