Skip to content

Instantly share code, notes, and snippets.

View tlaverdure's full-sized avatar

Thiery Laverdure tlaverdure

View GitHub Profile
@kapkaev
kapkaev / gist:4619127
Created January 24, 2013 09:30
MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. Resque
$ redis-cli
> config set stop-writes-on-bgsave-error no
<?php
class ColorPalette{
public $color;
public function __construct($color){
$this->color = $color;
}
public function color_mod($hex, $diff) {
$rgb = str_split(trim($hex, '# '), 2);
@johnmorris
johnmorris / gist:8135167
Created December 26, 2013 15:41
A simple database class using mysqli prepared statements in PHP.
<?php
if ( !class_exists( 'DB' ) ) {
class DB {
public function __construct($user, $password, $database, $host = 'localhost') {
$this->user = $user;
$this->password = $password;
$this->database = $database;
$this->host = $host;
}
protected function connect() {
@emaildano
emaildano / acf-yoast-add-on.php
Created January 31, 2014 02:51
Add ACFs to Yoast SEO page analysis.
function add_custom_content_to_analysis( $content ) {
global $post;
$custom = get_post_custom( $post->ID );
$custom_content = '';
foreach( $custom as $field )
{
$custom_content .= $field[0].' ';
}
return $content . ' ' . $custom_content;
}
@dol
dol / cert.php
Created July 24, 2017 13:11
Create CSR with subjectAlternativeName and check and copy them to a signed certificate
<?php
require_once __DIR__ . '/vendor/autoload.php';
use X509\CertificationRequest\CertificationRequest;
use X509\CertificationRequest\Attribute\ExtensionRequestValue;
use X509\Certificate\Extension\SubjectAlternativeNameExtension;
use X509\GeneralName\DNSName;
use CryptoUtil\PEM\PEM;
@mattstauffer
mattstauffer / info.md
Created July 6, 2020 15:21
Simple BASH Xdebug toggler

Written by Matt Stauffer

Note: This expects that you've enabled Xdebug in a specific file: /usr/local/php/X.x/conf.d/ext-xdebug.ini.

Installation

Add this function to your .zshrc or similar file.

Usage

On the command line, type xdebug and hit enter. This will toggle whether or not Xdebug is running.

Inspiration