Skip to content

Instantly share code, notes, and snippets.

View tylersticka's full-sized avatar

Tyler Sticka tylersticka

View GitHub Profile
@tylersticka
tylersticka / comments.php
Created January 6, 2012 01:06
Sample WP comments file
<?php if ( have_comments() || comments_open() ) : ?>
<section id="comments"<?php if ( ! comments_open() ) : ?> class="comments-closed"<?php endif; ?>>
<?php if ( have_comments() ) : ?>
<header class="visuallyhidden">
<h3>Responses</h3>
</header>
@tylersticka
tylersticka / comment.php
Created January 9, 2012 23:00
Sample WP comment callback function
<?php
function tsticka14_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
// I kind of cheat here by not doing anything for pingbacks
// and trackbacks, which means the amount of stuff that
// displays may differ from the comment count unless
// pingbacks and trackbacks are disabled in the admin.
switch ( $comment->comment_type ) :
case 'pingback' :
/*
* Variation of fitvids.js I wrote to behave the way I want to.
*/
(function($){
$.fitStuff = function (el, options) {
var base = this;
base.$el = $(el);
base.selectors = [
"iframe[src^='http://player.vimeo.com']",
/*
* Plugin for creating new windows in JS
*/
(function($){
$.newWindow = function (el, w, h) {
var base = this;
base.$el = $(el);
base.init = function () {
base.features = 'width=' + w + ',height=' + h + ',left=' + ((screen.width-w)/2) + ',top=' + ((screen.height-h)/2 - 110);
@tylersticka
tylersticka / gist:1773755
Created February 8, 2012 20:57
Terrible share drop-down example
// This... stores the current href. Pretty amazing.
var lastHREF = location.href;
// This is the dirtiest way to build the HTML of the share drop-down ever
function getShareHTML(url,title) {
var niceURL = escape(url);
var niceTitle = escape(title);
return '<li id="global-nav-share-facebook"><iframe src="http://www.facebook.com/plugins/like.php?href=' + niceURL + '&amp;layout=button_count&amp;show_faces=true&amp;width=90&amp;action=like&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:21px;" allowTransparency="true"></iframe></li>' +
'<li><a href="http://twitter.com/home?status=' + niceTitle + '+' + niceURL + '" target="_blank" id="global-nav-share-twitter">Twitter</a></li>' +
'<li><a href="mailto:?subject=' + niceTitle + '&amp;body=' + niceURL + '" id="global-nav-share-email">E-mail</a></li>' +
@tylersticka
tylersticka / gist:1994574
Created March 7, 2012 17:34
Extends Mustache's partial method to fetch from a known file path.
<?php
class Example extends Mustache {
protected function _getPartial($tag_name) {
$template_path = "./templates/partials/$tag_name.mustache";
if (file_exists($template_path)) {
$this->_partials[$tag_name] = file_get_contents($template_path);
}
return parent::_getPartial($tag_name);
@tylersticka
tylersticka / gist:2001635
Created March 8, 2012 15:53
Mustache layouts
<?php
include 'lib/Mustache/Mustache.php';
class view extends mustache {
public $sections = array();
public function __construct($layout, $page, $view) {
$this->renderPage($page);
@tylersticka
tylersticka / gist:2045067
Created March 15, 2012 16:21
Simpler IE fixes with conditional comments and LESS

Simpler IE fixes with conditional comments and LESS

This assumes that you're using conditional comments on the html tag to define classes for certain versions of IE. This technique was originally proposed by Paul Irish and refined in the HTML5 Boilerplate to something like this:

<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->

You can omit the "no-js" class if you aren't using Modernizr, and feel free to remove or tweak the conditional comments to suit the versions of IE that actua

@tylersticka
tylersticka / Terminal.sublime-settings
Created May 11, 2012 01:56
Sublime Text Terminal settings for Mintty
{
"terminal": "C:/cygwin/bin/mintty.exe",
// The first and third commands make sure your bin comes through
// The second one prevents a directory change to home
"parameters": ["/bin/env", "CHERE_INVOKING=1", "/bin/bash", "-l"]
}
@tylersticka
tylersticka / gist:2696100
Created May 14, 2012 19:46
My Sublime Text 2 preferences
{
"color_scheme": "Packages/User/Espresso Soda.tmTheme",
"theme": "Soda Light.sublime-theme",
"soda_classic_tabs": true,
"font_face": "Meslo LG S DZ",
"line_padding_top": 2,
"line_padding_bottom": 2
}