This file contains hidden or 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
function deDupeArrayOfObjects(arr) { | |
var tmpMap = {}; | |
arr.forEach(function(val) { | |
var uniquekey = ''; | |
for(var k in val) { | |
if(val.hasOwnProperty(k) && val[k]) { | |
uniquekey += val[k].toString(); | |
} | |
} | |
tmpMap[uniquekey] = val; |
This file contains hidden or 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 | |
/** | |
* Insert an attachment from a URL address. | |
* | |
* @param string $url The URL address. | |
* @param int|null $parent_post_id The parent post ID (Optional). | |
* @return int|false The attachment ID on success. False on failure. | |
*/ | |
function wp_insert_attachment_from_url( $url, $parent_post_id = null ) { |
This file contains hidden or 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
# Create directory for new site | |
cd ~/Sites | |
mkdir {query} | |
cd {query} | |
# Download latest version of WordPress | |
wp core download | |
# Setup wp-config file with WP_DEBUG enabled | |
wp core config --dbname={query} --dbuser=root --dbpass=root --dbprefix={query}wp_ --extra-php <<PHP |
This file contains hidden or 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
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
This file contains hidden or 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 pdfcrowd = { | |
splitTable: function(tableClass, printableHeight, breakClass) { | |
var tables = $("." + tableClass); | |
for(var i=0; i<tables.length; ++i) { | |
var splitIndices = [0]; | |
var table = $(tables[i]); | |
var thead = table.children("thead"); | |
var rows = table.children("tbody").children(); | |
var tableTop = table.offset().top; |