Skip to content

Instantly share code, notes, and snippets.

@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
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@sebastianseilund
sebastianseilund / billy-api-v2-docs.md
Last active September 3, 2018 00:34
Simple documentation for the beta of API v2. We are working on getting our new real API docs online.
<?php
# Insert code here
@entropiae
entropiae / fix_git_sslread_9806.sh
Last active February 3, 2022 23:32
git: how to solve "SSLRead() return error -9806" in OSX using brew
$ brew remove git
$ brew remove curl
$ brew install openssl
$ brew install --with-openssl curl
$ brew install --with-brewed-curl --with-brewed-openssl git
@fideloper
fideloper / update_curl.sh
Last active January 11, 2024 15:23
Update curl on Ubuntu 14.04
#! /usr/bin/env bash
# Install any build dependencies needed for curl
sudo apt-get build-dep curl
# Get latest (as of Feb 25, 2016) libcurl
mkdir ~/curl
cd ~/curl
wget http://curl.haxx.se/download/curl-7.50.2.tar.bz2
tar -xvjf curl-7.50.2.tar.bz2
@rap2hpoutre
rap2hpoutre / circle.yml
Created May 19, 2016 09:22
Circle CI example for Laravel
machine:
timezone:
Europe/Paris
php:
version: 7.0.3
environment:
ENVIRONMENT: testing
DB_URL: 127.0.0.1
@iben12
iben12 / 1_Laravel_state-machine.md
Last active August 12, 2023 08:36
Laravel: State-machine on Eloquent Model

Implementing State Machine On Eloquent Model*

* Update (12.09.2017): I have improved the trait so that it can be used with objects other than Eloquent Models.

Some days ago I came across a task where I needed to implement managable state for an Eloquent model. This is a common task, actually there is a mathematical model called "Finite-state Machine". The concept is that the state machine (SM) "can be in exactly one of the finite number of states at any given time". Also changing from one state to another (called transition) depends on fulfilling the conditions defined by its configuration.

Practically this means you define each state that the SM can be in and the possible transitions. To define a transition you set the states on which the transition can be applied (initial conditions) and the only state in which the SM should be after the transition.

That's the theory, let's get to the work.