Skip to content

Instantly share code, notes, and snippets.

View ericrasch's full-sized avatar

Eric Rasch ericrasch

View GitHub Profile

Setup OSX 10.9 with a Clean Install

After two years of tinkering my machine is a bit all over. With Mavericks I wanted to start fresh

1. Run Software Update

Make sure everything is up to date.

Software Update

@jdsteinbach
jdsteinbach / wp-template.md
Last active August 29, 2015 14:25
WP Template Patterns: `sprint()` & `printf()`

Documentation

If you're not familiar with these PHP functions, read this documentation: printf() / sprintf().

Benefits of s/printf()

Cleaner Validation

All template code requires validation: if a variable (or array key/value) doesn't exist or doesn't contain data, we don't want to print empty HTML. Writing "pure" PHP with s/printf() for markup makes validation logic easier to see and shorter to write.

<h1>
This is the primary heading and there should only be one of these per page
</h1>
<p>
A small paragraph to <em>emphasis</em> and show <strong>important</strong> bits.
</p>
<ul>
<li>This is a list item
</li>
<li>So is this - there could be more
@jimmynotjim
jimmynotjim / fb-comments.html
Created April 25, 2012 17:34
Adaptive sizing for FB comments plugin
<!-- New HTML5 FB Comments -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
@germanny
germanny / fn-post-custom-fields-infographic.php
Created October 3, 2012 14:21
Infographic standard form
<?php
$ig_post_custom_fields = array (
"infographic" => array(
"name" => "is_infographic",
"std" => "",
"title" => "Is this an infographic post?",
"description" => "If you check this box, we'll add a Pin It share option.",
"type" => "checkbox"),
"image_url" => array(
@jdsteinbach
jdsteinbach / betterBC.css
Last active December 9, 2015 21:28
Better BaseCamp Styles
* {
font-family: San Francisco Display, Texta, Avenir, Lucida Grande, sans-serif !important;
}
html {
background-color: #76fff7;
}
.container > .sheet {
background-color: #205D84 !important;
@jimmynotjim
jimmynotjim / state_array.php
Last active January 3, 2016 09:59
PHP Array of US States
<?php
$state_array = array(
array(
'state_name' => 'Alabama',
'state_abbr' => 'AL'
),
array(
'state_name' => 'Alaska',
'state_abbr' => 'AK'
// Handles js, sass, image optimisation/compilation and does very basic PHP linting and livereload
var gulp = require('gulp'),
minifycss = require('gulp-minify-css'),
notify = require('gulp-notify'),
cache = require('gulp-cache'),
sass = require('gulp-sass'),
uglify = require('gulp-uglify'),
gutil = require('gulp-util'),
refresh = require('gulp-livereload'),
lr = require('tiny-lr'),
@germanny
germanny / using-the-seo-plugin-to-the-max.md
Last active July 4, 2017 03:52
Google Plus stuff and PHP constants defined for Facebook Page ID, G+ Author Page, and Twitter Username from Yoast SEO plugin

Constants defined for Facebook Page ID, G+ Author Page, and Twitter Username

Using the Social fields in the SEO Plugin, we don't have to enter this data into the theme too:

/**
* Use Yoast SEO Plugin to create these constants
* http://wordpress.org/plugins/wordpress-seo/
* https://gist.github.com/germanny/6222479
*/
@ericrasch
ericrasch / robots.txt
Last active July 4, 2017 03:52
Robots.txt files for sites with WordPress.
User-agent: *
# Changing the /feed back to include the trailing slash since it otherwise blocks URLs like http://www.thesimpledollar.com/feeding-my-sweet-tooth-without-breaking-my-belly-or-breaking-the-bank/
Disallow: /feed/
Disallow: /cgi-bin
Disallow: /wp-admin
Disallow: /wp-content/cache
Disallow: /wp-includes
Disallow: /trackback
Disallow: /xmlrpc.php