Skip to content

Instantly share code, notes, and snippets.

View davist11's full-sized avatar
👨‍💻

Trevor Davis davist11

👨‍💻
View GitHub Profile
@davist11
davist11 / jquery.tabs.js
Last active August 29, 2015 13:57
jQuery tabs
/**
* @name jQuery Tabs
* @author Trevor Davis
* @copyright (cc) Trevor Davis (http://www.viget.com)
*
* Licensed under the CC-GNU GPL (http://creativecommons.org/licenses/GPL/2.0/)
*/
;(function($, window, document, undefined) {
var Tabs = function(elem, options) {
@davist11
davist11 / pi.php
Last active August 29, 2015 13:57
in_array plugin method
<?php
public function in_array()
{
$haystack = $this->EE->TMPL->fetch_param('haystack', NULL);
$needle = $this->EE->TMPL->fetch_param('needle', NULL);
if ($haystack === NULL || $needle === NULL) {
return;
}
$('#nav-global a.control').click(function(e) {
var $link = $(this);
$link.addClass('no-outline');
if($link.hasClass('current')) {
$link.siblings('.global-sub').slideUp(350);
$link.removeClass('current');
} else {
if($('#nav-global > .nav > li > .current').length > 0) {
$('#nav-global > .nav > li > .current').removeClass('current');
$('#nav-global .global-sub').slideUp(350);
;(function($) {
// Equal height items
$.fn.equalHeight = function(options) {
var opts = $.extend({}, $.fn.equalHeight.defaults, options);
return this.each(function() {
var $this = $(this),
o = $.meta ? $.extend({}, opts, $this.data()) : opts,
maxHeight = 0;
@davist11
davist11 / jquery.equalHeight.js
Created July 20, 2010 20:33
Equal heights plugin
;(function($) {
// Equal height items
$.fn.equalHeight = function(options) {
var opts = $.extend({}, $.fn.equalHeight.defaults, options);
return this.each(function() {
var $this = $(this),
o = $.meta ? $.extend({}, opts, $this.data()) : opts,
maxHeight = 0;
var $settings = array();
var $settings_default = array(
'honeepot_field' => 'honeepot',
'honeepot_error' => 'Sorry, but we think you might be a robot.'
);
// Setup with the default settings
function settings()
{
$settings['honeepot_field'] = $this->settings_default['honeepot_field'];
@davist11
davist11 / mini-calendar.php
Created January 10, 2011 15:39
ExpressionEngine Mini Calendar
{preload_replace:channel="blog"}
{exp:channel:calendar channel="{channel}"
show_future_entries="no" display_by="day"}
<div class="content">
<h3>{date format="%F %Y"}</h3>
<ul class="nav-calendar">
<?php if('{date format="%Y"}' == '2007') : ?>
<?php if ('{date format="%n"}' > '1') : ?>
<li class="prev">
@davist11
davist11 / .bash_profile
Created January 31, 2011 18:30
.bash_profile
alias getpath='pwd | tr -d "\r\n" | pbcopy'
alias ls='ls -lah'
alias go='git checkout'
alias gitdel='git ls-files --deleted | xargs git rm'
source ~/scripts/git-completion.bash
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}