Skip to content

Instantly share code, notes, and snippets.

View DarrylErentzen's full-sized avatar

Darryl Erentzen DarrylErentzen

View GitHub Profile
@yourivdlans
yourivdlans / pdfcrowd.js
Created November 14, 2011 12:55
pdfcrowd split table
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;
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#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/
@mattbanks
mattbanks / wp-setup.sh
Created March 14, 2014 18:01
Scaffold a new WordPress development site in Alfred, utilizing WP-CLI. Use this script to run as a Terminal Script. Customize for your theme needs, plugin needs, etc.
# 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
@m1r0
m1r0 / wp_insert_attachment_from_url.php
Last active April 11, 2024 12:33
WP: Insert attachment from URL
<?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 ) {
@a-r-d
a-r-d / dedupe-array-of-objects.js
Created December 8, 2015 15:21
Deduplicate an array of objects in javascript
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;