Skip to content

Instantly share code, notes, and snippets.

@amurrell
amurrell / custom-post-hierarchy.php
Last active March 26, 2024 20:13
Allow wordpress posts to have hierarchy - figures out slugs
<?php
add_action('registered_post_type', 'make_posts_hierarchical', 99, 2);
/**
* Ensure posts post type is hierarchal and allows page attributes
*
* Initial Setup - Runs after each post type is registered
*/
function make_posts_hierarchical($post_type, $pto)
grep processor /proc/cpuinfo
@amurrell
amurrell / sed-collation-issue-fixes
Created August 19, 2017 00:25
Fix collation and character set error from old mysql
# Unknown collation: 'utf8mb4_unicode_520_ci'
sed -i'.bak' "s/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g;" file.sql
# COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'utf8mb4'
sed -i'.bak' "s/utf8_general_ci/utf8mb4_unicode_ci/g;" file.sql
@amurrell
amurrell / init-server.sh
Last active July 17, 2017 02:27
Bash Script for PHP-7.0, nginx, git, etc on Ubuntu 14.04 LTS Server
#!/bin/bash
# Run as root
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
apt-get update && \
apt-get install -y nano && \
@amurrell
amurrell / Alphabetized List
Last active May 23, 2017 19:16
Alphabetize list of items (cities)
var alphabetCities = {
init: function(regions, startLetter) {
this.addLetters(regions);
this.addLetterPicker(regions);
this.selectLetter(startLetter, regions)();
},
letters: [
'a', 'b', 'c', 'd', 'e',
'f', 'g', 'h', 'i', 'j',
@amurrell
amurrell / mysqldump create database max allowed packet
Created January 3, 2017 21:04
mysqldump with create database and max allowed packet switches
mysqldump -u user -ppassword database_name --max-allowed-packet=500M -B --add-drop-database > dump.sql
// ==UserScript==
// @name Pixlr Editor - Remove AD
// @namespace http://your.homepage/
// @version 0.1
// @description Remove div wrapper for the AD, remove body padding right
// @author You
// @match https://pixlr.com/editor/
// @grant none
// ==/UserScript==
// ==UserScript==
// @name remove ads - pixlr.com
// @namespace remove-ads
// @description remove adds on pixlr.com
// @include https://pixlr.com/editor/
// @version 1
// @grant none
// ==/UserScript==
$('.ad-wrap').remove();
@amurrell
amurrell / mysql-user-database
Last active April 20, 2016 00:46
MySQL - Create user and database!
mysql -u root -p
CREATE DATABASE database_name;
GRANT ALL PRIVILEGES ON database_name.* TO 'database_user'@'%' IDENTIFIED BY 'database_user_pass';
@amurrell
amurrell / installing-nodejs-from-binaries.md
Last active May 25, 2017 17:34
Installing nodejs from Linux Binaries