Skip to content

Instantly share code, notes, and snippets.

@zesda
zesda / cleanhtml.php
Created September 28, 2022 14:20 — forked from lyquix-owner/cleanhtml.php
PHP script to automatically clean dirty HTML. Removes unnecessary attributes (e.g. style, id, dir), replaces deprecated tags with valid ones (e.g. <b> to <strong>), and strips undesirable tags (e.g <font>). We have used this script to safely clean hundreds of blog posts that were littered with inline styling.
<?php
// List of tags to be replaced and their replacement
$replace_tags = [
'i' => 'em',
'b' => 'strong'
];
// List of tags to be stripped. Text and children tags will be preserved.
$remove_tags = [
04364d8713b22db2b0d9e8c01d794954cdb0e20f24bb45fe3a41f02c4cb3f09bc5cbed95f3e3aadbd9de743f43982641157574d7d04b1e0ef6a5772f3679efc474;garethweaver
@zesda
zesda / debug.md
Created June 19, 2017 08:55
Atom Beautify: Debug Help - 2017-06-19 09:55:00 BST
@zesda
zesda / flightplan.js
Created June 9, 2017 11:57 — forked from koenverburg/flightplan.js
deploy script for a laravel app
#!/usr/bin/env node
var plan = require('flightplan');
// configuration
plan.target('staging', [{
host: 'YOUR SERVER IP',
port: 22,
username: 'USER',
privateKey: '~/.ssh/id_rsa'
agent: process.env.SSH_AUTH_SOCK,
@zesda
zesda / .htaccess
Created May 24, 2016 07:12
Tsohost HTTPS Redirect
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://yourdomain.com/$1 [R=301,L]
@zesda
zesda / Placholder Style Mixin.scss
Last active December 17, 2015 13:39
Very simple Input Placeholder Mixin for SASS. Allow styling of an <input> placeholder. Support for: Webkit browsers, Mozilla Firefox 4 to 18, Mozilla Firefox 19+, IE 10+.
/**
* Usage example:
*
* input {
* @include placeholder {
* // styles
* }
* }
*/
@zesda
zesda / Stylesheet Media Query Breakpoints.js
Last active December 17, 2015 12:49
Dynamically fetches the media query stylesheet breakpoints from the DOM. Currently no support for multiple media ranges, i.e. media = "screen and (min-width:X) and (max-width:Y)"
var arr = new Array();
$('link[media]').each(function(i){
typeof($(this).attr('media').split('(')[1]) !== 'undefined'
? arr.push(new Array($(this).attr('media').split('(')[1].split(':')[0], $(this).attr('media').split('(')[1].split(':')[1].split('px')[0]))
: null ;
});
console.log(arr);
@zesda
zesda / Dynamic Zenbox snippet.js
Last active December 16, 2015 15:59
Dynamic Javascript snippet used to create the Zenbox (Live chat/Feedback tab) wherever it's desired. It's not perfect, but it works :)
var _body = document.getElementsByTagName('body') [0];
var zenbox = document.createElement('script');
zenbox.src = '//assets.zendesk.com/external/zenbox/v2.5/zenbox.js';
var style = document.createElement('style');
css = '@import url(//assets.zendesk.com/external/zenbox/v2.5/zenbox.css);';
style.type = 'text/css';
style.media = 'screen, projection';
if (style.styleSheet){