Skip to content

Instantly share code, notes, and snippets.

View mikecastrodemaria's full-sized avatar

Mike Castro Demaria mikecastrodemaria

  • Ultra Prod SAS / Supersonique Studio SARL
  • 85 Rue simiane, 06110 Le Cannet, France
View GitHub Profile
/**
* Buddyexpress Desk
*
* @package Bdesk
* @author Buddyexpress Core Team <admin@buddyexpress.net
* @copyright 2014 BUDDYEXPRESS NETWORKS.
* @license Buddyexpress Public License http://www.buddyexpress.net/Licences/bpl/
* @link http://labs.buddyexpress.net/bdesk.b
*/
find . -name \.AppleDouble -exec rm -rf {} \;
@mikecastrodemaria
mikecastrodemaria / gist:80dcb98e421b4ee1c4f0f55262576035
Created September 8, 2017 16:59
WP : transform images to base64 images
/*
charge img_src value buy your own image
needs to be used with a caching system
*/
$img_src = "img/sample.jpg";
$imgbinary = fread(fopen($img_src, "r"), filesize($img_src));
$img_str = base64_encode($imgbinary);
echo '<img src="data:image/jpeg;base64,'.$img_str.'" alt="Alt text" />';
@mikecastrodemaria
mikecastrodemaria / ICS.php
Created December 13, 2017 12:59 — forked from jakebellacera/ICS.php
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* ICS.php
* =======
* Use this class to create an .ics file.
*
* Usage
* -----
* Basic usage - generate ics file contents (see below for available properties):
@mikecastrodemaria
mikecastrodemaria / mod_rewrite_test.php
Created December 20, 2017 16:22
A simple test to know if you apache mod_rewrite is loaded
<?php
if(!function_exists('apache_get_modules') ){ phpinfo(); exit; }
$res = 'Module Unavailable';
if(in_array('mod_rewrite',apache_get_modules()))
$res = 'Module Available';
?>
<html>
<head>
<title>A mod_rewrite availability check !</title></head>
<body>
<?php
if(!file_exists($output)){
if (!mkdir($output, 0755, true)) {//0755
die('Failed to create folders...');
}
}
?>

Install php7 with pear

$ brew tap homebrew/dupes
$ brew tap homebrew/versions
$ brew tap homebrew/homebrew-php
$ brew install php70 --with-pear

Enable php7 with apache2

@mikecastrodemaria
mikecastrodemaria / Class file
Last active March 25, 2020 20:56 — forked from samatsav/Class file
Convert PHP arrays to XLS
<?php
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

PHP-CLI (PHP en ligne de commande) sur les hébergements mutualisés OVH

More complete info here http://cluster015.ovh.net/infos/ (thanks to @42antoine)

(cli)

/usr/local/php5.3/bin/php => PHP 5.3.29 (cli) (built: Nov 21 2017 08:55:07)
/usr/local/php5.4/bin/php => PHP 5.4.45 (cli) (built: Nov 21 2017 08:35:51)
/usr/local/php5.5/bin/php => PHP 5.5.38 (cli) (built: Nov 21 2017 08:46:45)
<?php
$args = array(
'label' => '', // Text in Label
'class' => '',
'style' => '',
'wrapper_class' => '',
'value' => '', // if empty, retrieved from post meta where id is the meta_key
'id' => '', // required
'name' => '', //name will set from id if empty