Skip to content

Instantly share code, notes, and snippets.

View tpennock-gist's full-sized avatar

Taylor Pennock (Code Snippets) tpennock-gist

View GitHub Profile
@tpennock-gist
tpennock-gist / is_blog.php
Created July 12, 2012 22:08 — forked from wesbos/is_blog.php
WordPress is_blog()
function is_blog () {
global $post;
$posttype = get_post_type($post );
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ;
}
Usage:
<?php if (is_blog()) { echo 'You are on a blog page'; } ?>
@tpennock-gist
tpennock-gist / appender.go
Created May 3, 2012 20:51 — forked from beatgammit/appender.go
UTOS - Introduction to Go
package main
import "fmt"
type Appender struct {
data []byte
}
func (a *Appender) Write(p []byte) (int, error) {
newArr := append(a.data, p...)
@tpennock-gist
tpennock-gist / gist:2039068
Created March 14, 2012 19:56 — forked from padolsey/gist:527683
JavaScript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}