This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo pip install awscli --ignore-installed six |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install PHP Code Sniffer and related modules | |
TMP_PATH=/tmp/ | |
BIN_PATH=/usr/local/bin/ | |
cd $TMP_PATH | |
# PHPCS | |
# PHP Code Sniffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Execution time check for: (list/each,foreach) vs (array_walk, array_map, array_reduce, array_filter) | |
* @docs to read | |
* http://www.giorgiosironi.com/2010/02/stop-writing-foreach-cycles.html | |
* http://www.pastie.org/829318 | |
* http://php.net/manual/en/function.array-walk.php#112722 | |
* http://zaemis.blogspot.com/2013/06/building-array-with-arrayreduce.html | |
* (!) http://stackoverflow.com/questions/2473989/list-of-big-o-for-php-functions/2484455#2484455 | |
* http://www.faieta.net/wp/performance-implications-of-closures-in-php/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete Orphaned Post Meta | |
# Selects all postmeta where the post_id does not exist | |
SELECT * FROM wp_postmeta WHERE post_id NOT IN (SELECT DISTINCT ID FROM wp_posts) AND meta_id BETWEEN 1 AND 500000; | |
# Use an offset to avoid super massive queries! | |
# Make sure to offset the META_ID ( not the post_ID ) or you'll delete good data | |
# Set 1 | |
DELETE FROM wp_postmeta WHERE post_id NOT IN (SELECT DISTINCT ID FROM wp_posts) AND meta_id BETWEEN 1 AND 500000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |