Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike Castro Demaria mikecastrodemaria

  • Ultra Prod SAS / Supersonique Studio SARL
  • 85 Rue simiane, 06110 Le Cannet, France
View GitHub Profile
View checkbox_input.php
<?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
View php-cli_ovh_mutu.md

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)
View install-php7-pear-mysql-php-codesniffer-homebrew.md

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 / test-doc-see-as-virus-by-clamav.txt
Last active Feb 28, 2018
A simple text file to be used as positive test for ClamAv virus scanner
View test-doc-see-as-virus-by-clamav.txt
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
View php_mkdir.php
<?php
if(!file_exists($output)){
if (!mkdir($output, 0755, true)) {//0755
die('Failed to create folders...');
}
}
?>
@mikecastrodemaria
mikecastrodemaria / mod_rewrite_test.php
Created Dec 20, 2017
A simple test to know if you apache mod_rewrite is loaded
View mod_rewrite_test.php
<?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>
@mikecastrodemaria
mikecastrodemaria / ICS.php
Created Dec 13, 2017 — forked from jakebellacera/ICS.php
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
View ICS.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 / Class file
Last active Mar 25, 2020 — forked from samatsav/Class file
Convert PHP arrays to XLS
View Class file
<?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
View gist:80dcb98e421b4ee1c4f0f55262576035
/*
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" />';