Skip to content

Instantly share code, notes, and snippets.

View nelsonJM's full-sized avatar

Josh Nelson nelsonJM

View GitHub Profile
@nelsonJM
nelsonJM / test-snippet.html
Created September 18, 2012 12:05
HTML: Starting Template
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
@nelsonJM
nelsonJM / gist:3742789
Created September 18, 2012 12:11
CSS: Image Replacement
.ir {
border: 0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@nelsonJM
nelsonJM / gist:3949019
Created October 24, 2012 21:29
PHP: Find Server Root
<?= $_SERVER['DOCUMENT_ROOT']; ?>
@nelsonJM
nelsonJM / gist:3949039
Created October 24, 2012 21:31
PHP: Search and Replace
<?php
/**
*
* Safe Search and Replace on Database with Serialized Data v2.0.1
*
* This script is to solve the problem of doing database search and replace when
* developers have only gone and used the non-relational concept of serializing
* PHP arrays into single database columns. It will search for all matching
* data on the database and change it, even if it's within a serialized PHP
* array.
@nelsonJM
nelsonJM / gist:3949090
Created October 24, 2012 21:40
JS: GA Cookie Script
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write("<script src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'>" + "</sc" + "ript>");
</script>
<script type='text/javascript'>
var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
pageTracker._trackPageview();
//
@nelsonJM
nelsonJM / gist:3949187
Created October 24, 2012 21:58
WordPress: Template Path
define( 'TEMPPATH', get_bloginfo('stylesheet_directory'));
define( 'IMAGES', TEMPPATH. "/images");
@nelsonJM
nelsonJM / gist:3949267
Created October 24, 2012 22:12
Thesis-185: custom_functions stuff
function html5_doctype($content) {
return '<!DOCTYPE html>';
}
add_filter('thesis_doctype', 'html5_doctype');
/* Remove PROFILE attribute from HEAD tag */
function html5_profile_removal($content) {
return '';
}
@nelsonJM
nelsonJM / gist:3949270
Created October 24, 2012 22:12
WordPress: Breadcrumbs
function wordpress_breadcrumbs() {
$delimiter = '&gt;';
$name = 'Home'; //text for the 'Home' link
$currentBefore = '<span class="current">';
$currentAfter = '</span>';
if ( !is_home() && !is_front_page() || is_paged() ) {
echo '<div id="crumbs">';
@nelsonJM
nelsonJM / gist:3953868
Created October 25, 2012 16:32
Security: Password Protect Site
/* put this in your .htaccess file */
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /path/to/.htpasswd
AuthGroupFile /dev/null
require valid-user
/* put this in your .htpasswd file */
username1:encrypted password
username2:encrypted password
@nelsonJM
nelsonJM / gist:3954215
Created October 25, 2012 17:35
Compass: Ruby config starter
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/example-subdir"
css_dir = "/"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
sass_options = {:debug_info=>true}