Skip to content

Instantly share code, notes, and snippets.

View tylersticka's full-sized avatar

Tyler Sticka tylersticka

View GitHub Profile
@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: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>' +
/*
* 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);
/*
* 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']",
@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' :
@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>