Skip to content

Instantly share code, notes, and snippets.

View nelsonJM's full-sized avatar

Josh Nelson nelsonJM

View GitHub Profile
@nelsonJM
nelsonJM / gist:4665371
Created January 29, 2013 16:05
jQuery: Shortcut for Document Ready
$(function() {
});
@nelsonJM
nelsonJM / gist:4665501
Created January 29, 2013 16:23
PHP: Include jQuery in WP
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
function my_jquery_enqueue() {
wp_deregister_script('jquery');
wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null);
wp_enqueue_script('jquery');
}
@nelsonJM
nelsonJM / gist:4665577
Created January 29, 2013 16:31
JS: Add js to child-theme
<script src="<?php get_stylesheet_directory(); ?>/js/my-scripts.js"></script>
@nelsonJM
nelsonJM / gist:4723784
Created February 6, 2013 16:29
CSS: IMG Thumb border
img.thumb {
display: block;
border: solid 4px #fff;
-webkit-box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
-ms-border-radius: 3px;
-o-border-radius: 3px;
@nelsonJM
nelsonJM / gist:4742634
Created February 8, 2013 22:55
CSS3: Clean Compass Button
.button-text {
font-family: HelveticaNeue;
font-size: 14px;
font-weight: bold;
color: #575757;
@include text-shadow(0 1px rgba(255,255,255,.7));
}
.button-text:active {
color: #f1f5f6;
@nelsonJM
nelsonJM / gist:4948654
Created February 13, 2013 21:49
jQuery: Validate code
<script src="javascripts/jquery-validation/dist/jquery.validate.js"></script>
<script>
// jQuery validate plugin
$(function(){
$("#quote-form").validate({
rules: {
name: "required",
email: {
required: true,
@nelsonJM
nelsonJM / gist:4948699
Created February 13, 2013 21:53
jQuery: Validity code snippet
//Validity plugin
<link rel="stylesheet" href="javascripts/validity/jquery.validity.css">
<script src="javascripts/validity/jquery.validity.js"></script>
<script>
(function($){
$("#quote-form").validity(function() {
$("#firstname").require("Please provide your full name");
@nelsonJM
nelsonJM / gist:4949144
Created February 13, 2013 22:54
HTACCESS: HTML5 bp gzip code
# ----------------------------------------------------------------------
# Gzip compression
# ----------------------------------------------------------------------
<IfModule mod_deflate.c>
# Force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
@nelsonJM
nelsonJM / gist:4949214
Created February 13, 2013 23:03
HTACCESS: HTML5 bp cache code
# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------
# These are pretty far-future expires headers.
# They assume you control versioning with filename-based cache busting
# Additionally, consider that outdated proxies may miscache
# www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
# If you don't use filenames to version, lower the CSS and JS to something like
@nelsonJM
nelsonJM / gist:5052576
Created February 27, 2013 22:47
jQuery: Thumbnail Nav
<style>
.product-gallery {
overflow: hidden;
position: relative;
height: 560px;
}
#featured-product li {
position: absolute;
top: 0;