Skip to content

Instantly share code, notes, and snippets.

View jeffreynolte's full-sized avatar

Jeffrey Nolte jeffreynolte

View GitHub Profile
@jeffreynolte
jeffreynolte / nginx_forward.conf
Created August 15, 2012 16:51
Forward all www requests nginx
# forward all www requests
if ($host = www.domain.com) {
rewrite ^ http://domain.com$request_uri? permanent;
}
@jeffreynolte
jeffreynolte / wp-replace-urls
Created August 28, 2012 15:31
Replace all urls in WordPress Table
UPDATE wp_options SET option_value = replace(option_value, 'old_domain', 'new_domain') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'old_domain', 'new_domain');
UPDATE wp_posts SET post_content = replace(post_content, 'old_domain', 'new_domain');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'old_domain', 'new_domain');
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Your Website</title>
</head>
<body>
#This is a template .gitignore file for git-managed WordPress projects.
# Some points pulled from https://gist.github.com/jdbartlett/444295
# Ignore everything in the root except the "wp-content" directory.
/*
!/.gitignore
!/wp-content/
# Ignore everything in the "wp-content" directory, except the "plugins"
and "themes" directories.
@jeffreynolte
jeffreynolte / gform list placeholders
Created July 25, 2013 19:26
Add placeholders to all list elements in Gravity Forms.
$('.gfield_list_cell').each(function(){
var $this = $(this),
$tr = $('tr', $this.parent().parent().prev()),
i = $this.index();
$('input', $this).attr('placeholder', $('th:eq('+i+')', $tr).text());
});
<!DOCTYPE html>
<!--[if IE 8]> <html lang="sv-SE" class="no-js ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="sv-SE" class="no-js"> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<title>Breakpoint detection test</title>
<style type="text/css" media="screen">
@media screen and (min-width: 320px) {
#page:after {
content: 'smallest'; /* represent the current width-bracket */
@jeffreynolte
jeffreynolte / og:wp
Created April 25, 2014 01:10
Open Graph tags for use in WordPress themes
<meta property="og:title" content="<?php wp_title(); ?>" />
<meta property="og:site_name" content="<?php wp_title(); ?>" />
<meta property="og:url" content="<?php echo get_permalink( $post->ID ); ?>" />
<meta property="og:description" content="<?php bloginfo('description'); ?>" />
<meta property="og:image" content="<?php bloginfo('template_url'); ?>/images/Untitled-6-2.png" />
<meta property="og:type" content="website" />
@jeffreynolte
jeffreynolte / browser-detect.js
Created September 16, 2014 22:17
JS Browser Detection
var detectedUA = jQuery(document).browserDetection();
var is_explorer = navigator.userAgent.indexOf('MSIE') > -1;
var is_firefox = navigator.userAgent.indexOf('Firefox') > -1;
var is_Opera = navigator.userAgent.indexOf("Presto") > -1;
var is_chrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
var is_safari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor);
var is_windowsphone = /Windows Phone/.test(navigator.userAgent);
@jeffreynolte
jeffreynolte / main.less
Created January 19, 2015 01:46
responsive based on height / width
.slideshow{
max-width: 60vh;
max-height: 60vh;
border: 1px solid red;
position: relative;
margin: 0 auto;
display: block;
margin-top: 20vh;
}