Skip to content

Instantly share code, notes, and snippets.

@LasseRafn
LasseRafn / site.conf
Created August 18, 2015 21:28
Example Laravel Nginx config to avoid 404-images to be loaded by routes.
...
location ~* \.(gif|jpg|jpeg|ico|png|svg)$ {
# Do jack shit.
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
<?php
# Insert code here

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

<?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