Skip to content

Instantly share code, notes, and snippets.

@sadortun
sadortun / magnific-popup-deep-linking.js
Created October 28, 2015 04:19
Deep Linking with Magnificent popup
<script type="text/javascript">
function loadGalleryDeepLink()
{
var prefix = "#gallery-";
var h = location.hash;
if (document.g_magnific_hash_loaded === undefined && h.indexOf(prefix) === 0)
@erighetto
erighetto / print_zpl.php
Last active June 16, 2022 16:06
Send raw ZPL to Zebra printer
<?php
error_reporting(E_ALL);
/* Get the port for the service. */
$port = "9100";
/* Get the IP address for the target host. */
$host = "172.17.144.89";
/* construct the label */
@mikeschinkel
mikeschinkel / class-custom-hooks.php
Last active June 17, 2021 04:42
Classes providing "hooks" (actions and filters) that work with WordPress or free-standing PHP-based apps.
<?php
class Custom_Hooks {
/**
* Adds a filter hook for an object
*
* Custom_Hooks::add_filter( 'filter_data', array( $this, 'filter_data' ) );
* Custom_Hooks::add_filter( 'filter_data', array( $this, 'filter_data' ), 11 );
* Custom_Hooks::add_filter( 'filter_data', 'special_func' );
* Custom_Hooks::add_filter( 'filter_data', 'special_func', 11 );
@dave1010
dave1010 / strip_word_html.php
Created November 12, 2010 13:14
Strip MS Word HTML. From php.net
<?php
function strip_word_html($text, $allowed_tags = '<b><i><sup><sub><em><strong><u><br>')
{
mb_regex_encoding('UTF-8');
//replace MS special characters first
$search = array('/&lsquo;/u', '/&rsquo;/u', '/&ldquo;/u', '/&rdquo;/u', '/&mdash;/u');
$replace = array('\'', '\'', '"', '"', '-');
$text = preg_replace($search, $replace, $text);
//make sure _all_ html entities are converted to the plain ascii equivalents - it appears
//in some MS headers, some html entities are encoded and some aren't