Skip to content

Instantly share code, notes, and snippets.

DB="your_database_name"
USER="your_db_user"
PASS="your_db_pass"
HOST="database_hostname"
(
echo 'ALTER DATABASE `'"$DB"'` CHARACTER SET utf8 COLLATE utf8_general_ci;'
mysql -p $PASS -u $USER -h $HOST "$DB" -e "SHOW TABLES" --batch --skip-column-names \
| xargs -I{} echo 'ALTER TABLE `'{}'` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;'
) \
| mysql -p $PASS -u $USER -h $HOST "$DB"
@dannygsmith
dannygsmith / convert.php
Created April 21, 2019 02:24 — forked from WPEtopher/convert.php
A script for converting MySQL databases to UTF8 (tables and columns).
/*
Plugin Name: Convert WP Database to UTF-8
Plugin URI: http://topher.wpengine.com/
Description: Converts the WordPress database (both tables and columns) to UTF-8 character set.
Version: 1.1.0
Author: Topher Hota (@WPEtopher), Yihui Xie
Author URI: http://yihui.name
*/
/*
@dannygsmith
dannygsmith / SecureSessionHandler.php
Created March 3, 2018 02:48 — forked from eddmann/SecureSessionHandler.php
Secure session handler implementation.
<?php
class SecureSessionHandler extends SessionHandler {
protected $key, $name, $cookie;
public function __construct($key, $name = 'MY_SESSION', $cookie = [])
{
$this->key = $key;
$this->name = $name;
@dannygsmith
dannygsmith / Fragment
Created December 28, 2017 03:05
Setting up a Mac for development
# Homebrew and Cask
Install the XCode command line tools by running `xcode-select --install` in the terminal.
Install Homebrew by following the instructions on the [homebrew website](http://brew.sh).
Install Cask by following the instructions on the [cask website](https://caskroom.github.io).
# Applications
@dannygsmith
dannygsmith / _verify-repair-permissions-disk.md
Created December 11, 2017 23:57 — forked from bzerangue/_verify-repair-permissions-disk.md
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /

@dannygsmith
dannygsmith / wp-mailhog.php
Created November 29, 2017 18:53 — forked from bishless/wp-mailhog.php
Configure WordPress on Valet to use MailHog
<?php
/**
* @link
* @since 1.0.0
* @package TODO
*
* @wordpress-plugin
* Plugin Name: Use MailHog
* Description: Configure WordPress on Valet to use MailHog
* Version: 1.0.0
@dannygsmith
dannygsmith / genesis-site-title.php
Created October 11, 2017 04:05 — forked from cdils/genesis-site-title.php
Filter the Genesis SEO Title to output with a custom class.
// Filter the title with a custom function
add_filter('genesis_seo_title', 'wap_site_title' );
// Add additional custom style to site header
function wap_site_title( $title ) {
// Change $custom_title text as you wish
$custom_title = '<span class="custom-title">WA</span>Estate';
// Don't change the rest of this on down
<?php
/**
* Creates a link for email and then hide email address from Spam Bots in HTML using a shortcode.
* [email]hello@email.com[/email]
*
* @param array $atts Shortcode attributes. Not used.
* @param string $content The shortcode content. Should be an email address.
*
* @return string The obfuscated email address.
@dannygsmith
dannygsmith / php_upgrade_to_71.sh
Created August 30, 2017 16:33 — forked from pixeline/php_upgrade_to_71.sh
Update Mac Os X's php version to php 7.1 using homebrew. Includes curl and mcrypt
# 1. Install brew --> http://brew.sh/
# 2. run the following commands in your Terminal
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install --with-openssl curl
brew install --with-homebrew-curl --with-apache php71
brew install php71-mcrypt php71-imagick
# 3. Follow these instructions to make Apache and php-cli use the newer php executable and make the change persist after reboot.
brew info php71
@dannygsmith
dannygsmith / php-openssl.md
Created August 30, 2017 03:32 — forked from ryanscherler/php-openssl.md
Use Homebrew PHP with OpenSSL instead of SecureTransport