Skip to content

Instantly share code, notes, and snippets.

View jcanfield's full-sized avatar
💭
If I do not respond quickly, try me on Twitter at @creativeboulder.

Joshua Canfield jcanfield

💭
If I do not respond quickly, try me on Twitter at @creativeboulder.
View GitHub Profile
@jcanfield
jcanfield / gist:4522839
Created January 13, 2013 07:33
htaccess Configuration for Wordpress (Developed for a client project and utilizes Caching, Correct Timezones, ETAG Configuration, Compression and Basic Rewrites.
# .htaccess for some-website.com
# By Joshua Canfield (Code Clarity)
# Features include Page Caching by FilesMatch, mod_expires & mod_header. Also uses old website 301 Redirections
# Sets Timezone to Mountain
SetEnv TZ America/Denver
# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0
@jcanfield
jcanfield / index.php5
Last active June 25, 2020 22:56
Wordpress Image Attachment Recipes > Post by DigWP.com which can be found at http://digwp.com/2009/08/awesome-image-attachment-recipes-for-wordpress/. > Even though this is an older post there are a few very simple Wordpress functions and methods utilizing Post Images with-in your code.
/*****
* Basic display of gallery attachments
* When displaying your images via the [gallery] shortcode, WordPress will display image-links for each image in the gallery. Each of these image-links points to the image-gallery page for that particular image. The image gallery is created by the image.php template if present in your theme files. Here is a basic way to display your gallery images from within the image-gallery loop:
*****/
<a href="<?php echo wp_get_attachment_url($post->ID); ?>"><?php echo wp_get_attachment_image($post->ID, 'medium'); ?></a>
/*****
* Display the URL of the latest image attachment
* Perhaps the most useful template tag for displaying image-attachment information is wp_get_attachment_url(). This function returns a full URI for an attachment file. If no attachment is found, a value of false is returned. Here are several ways to use this tag within the loop:
@jcanfield
jcanfield / viewsource.sh
Created February 22, 2013 20:17
View Remote Website source using Curl and Pygmentize (Command Line)
#!/bin/bash
# View Website source with syntax highlighting via Pygmentize
echo "Viewing Source for $1"
read -p "USAGE: viewsource http://www.website.com/ (Press Enter To Continue)"
curl -s "$1" | pygmentize -f terminal256 -l html -O style=monokai
exit
#Landscaping With Frontend Development Tools
An opinionated list of tools for frontend (i.e. html, js, css) desktop/laptop (i.e. does not include tablet or phone yet) web development
##Coding Tools
######Workflow/Builds/Assemblers
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
###############################################################################
# Copyright 2012 Jakub Jirutka. All rights reserved.
#
# "THE KOFOLA-WARE LICENSE" (Revision 1):
# Jakub Jirutka originally wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a Kofola in return. <jakub@jirutka.cz>
#
###############################################################################
@jcanfield
jcanfield / gist:5223958
Created March 22, 2013 19:19
mime.types for Apache2 Configuration Includes a huge list of Mime Types for your Web Server Configuration
# This file maps Internet media types to unique file extension(s).
# Although created for httpd, this file is used by many software systems
# and has been placed in the public domain for unlimited redisribution.
#
# The table below contains both registered and (common) unregistered types.
# A type that has no unique extension can be ignored -- they are listed
# here to guide configurations toward known types and to make it easier to
# identify "new" types. File extensions are also commonly used to indicate
# content languages and encodings, so choose them carefully.
#
@jcanfield
jcanfield / msie-vmwarefusion-osx.bash
Created April 3, 2013 02:56
Download the latest VMWare Fusion images from Modern.IE for Internet Explorer Testing. This bash script is primitive and simple. Anybody who would like to expand on this is more than welcome to.
#!/bin/bash
# Download all VMWare Fusion machines from Modern.IE Website to test your Website/Web Application in Microsoft Internet Explorer on Mac OSX. All VM's and other VM's for Windows and Linux and other Virtual Manager's such as VirtualBox can be found at http://modern.ie/
# Don't have cURL or want to learn more, visit http://curl.haxx.se/.. are you really a Developer? First part of that sentence comes from the MS site.
read -p "--> Downloading Internet Explorer 6-10 on Windows XP/7/8 Appliances for VMWare Fusion. Large downloads ahead. (Press Enter to continue)."
echo "--> Download Internet Explorer 6 on Microsoft Windows XP Appliance for VMWare Fusion."
curl --progress-bar -O "http://virtualization.modern.ie/vhd/IEKitV1_Final/VMWare_Fusion/IE6_XP/IE6.XP.For.MacVMware.sfx"
echo "--> Download Internet Explorer 8 on Microsoft Windows XP Appliance for VMWare Fusion."
@jcanfield
jcanfield / .htaccess
Created April 21, 2013 21:15
htaccess Boilerplate for Wordpress Sites. This is a combination of techniques that I have learned over the last few years as well as some snippets from the HTML5 Boilerplate. This ApacheConf file includes; proper UTF-8 encoding, ETag removal, Persistent connections, Proper www rewrite, website.com/login to wp-admin, 3 different GZIP compression …
# Apache Configuration file
# www.lighthouselutherie.com/.htaccess
# Use UTF-8 encoding for anything served as `text/html` or `text/plain`.
AddDefaultCharset utf-8
# Force UTF-8 for certain file formats.
<IfModule mod_mime.c>
AddCharset utf-8 .atom .css .js .json .rss .vtt .webapp .xml
</IfModule>
@jcanfield
jcanfield / wp-config.php
Created June 5, 2013 20:55
Wordpress Debugging enabled via wp-config.php.
@ini_set('display_errors',0); /* define('WP_DEBUG', false); */
define('WP_DEBUG', true); // Turn debugging ON
define('WP_DEBUG_DISPLAY', false); // Turn forced display OFF
define('WP_DEBUG_LOG', true);