Skip to content

Instantly share code, notes, and snippets.

View davist11's full-sized avatar
👨‍💻

Trevor Davis davist11

👨‍💻
View GitHub Profile
@davist11
davist11 / pi.num_birthdays.php
Created August 31, 2011 15:08
EE PHP 5.3 Number of Birthdays Plugin
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$plugin_info = array(
'pi_name' => 'Number of Birthdays',
'pi_version' => '1.0',
'pi_author' => 'Trevor Davis',
'pi_author_url' => 'http://trevordavis.net',
'pi_description' => 'Determine the number of birthdays between now and some other date',
'pi_usage' => Num_birthdays::usage()
);
@davist11
davist11 / gist:1204569
Last active January 19, 2024 15:03
Campfire sounds
56k: "https://123.campfirenow.com/images/56k.gif"
bell: ":bell:"
bezos: ":laughing::thought_balloon:"
bueller: "anyone?"
butts: ":open_hands: :smoking:"
clowntown: "https://123.campfirenow.com/images/clowntown.gif"
cottoneyejoe: ":notes::hear_no_evil::notes:"
crickets: "hears crickets chirping"
dadgummit: "dad gummit!! :fishing_pole_and_fish:"
dangerzone: "https://123.campfirenow.com/images/dangerzone.png"
@davist11
davist11 / gist:1212329
Created September 12, 2011 20:37
Datagrab XML import
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item>
<author>Author Here</author>
<title>Title Here</title>
<date>08/16/2011 10:02:27 AM</date>
<summary><![CDATA[<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>]]></summary>
<body><![CDATA[<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaeca
@davist11
davist11 / comments.xml
Created September 12, 2011 20:43
EE 1.x Export
{exp:comment:entries weblog="blog" sort="asc" entry_id="{embed:entry_id}"}
<comment>
<comment_author>{name}</comment_author>
<comment_email>{email}</comment_email>
<comment_url>{url}</comment_url>
<comment_date>{comment_date format="%m/%d/%Y %h:%i:%s %A"}</comment_date>
<comment_text><![CDATA[{comment}]]></comment_text>
</comment>
{/exp:comment:entries}
@davist11
davist11 / member_export.xml
Created September 27, 2011 18:39
EE 1.x Member Export
<members>
{exp:query sql="SELECT * FROM exp_members"}
<member>
<username>{username}</username>
<screen_name>{screen_name}</screen_name>
<password type="sha1">{password}</password>
<email>{email}</email>
<member_id>{member_id}</member_id>
<group_id>{group_id}</group_id>
</member>
@davist11
davist11 / gist:1346058
Created November 7, 2011 20:26
jQuery Carousel
;(function($) {
$.fn.carousel = function(options) {
return this.each(function() {
var carousel = {};
carousel.opts = $.extend({}, $.fn.carousel.defaults, options);
carousel.init = function($base) {
var _this = this,
@davist11
davist11 / gist:1346064
Created November 7, 2011 20:27
jQuery Tabs
;(function($) {
$.fn.tabs = function(options) {
return this.each(function() {
var tabs = {};
tabs.init = function($base) {
var _this = this;
_this.$base = $base;
_this.$navTabs = _this.$base.find('.nav-tabs ul');
@davist11
davist11 / gist:1358761
Created November 11, 2011 18:24
Age Verification
$('#verification').bind('submit', function(e) {
var $this = $(this),
month = parseInt($('#month').val(), 10),
day = parseInt($('#day').val(), 10),
year = parseInt($('#year').val(), 10),
today = new Date(),
theirDate = new Date((year + 21), (month - 1), day);
if(isNaN(month) || isNaN(day) || isNaN(year)) {
$this.append('<div class="error">We need your age.</div>');
@davist11
davist11 / jquery.tabs.js
Created November 22, 2011 02:55
jQuery Plugin using Data Pattern
(function( $ ){
var methods = {
init: function(options) {
return this.each(function(){
var $this = $(this),
data = $this.data('tabs');
// If the plugin hasn't been initialized yet
@davist11
davist11 / gist:1597120
Created January 11, 2012 22:19
JS Pattern
(function (){
var _self = SITE.thing = {
init: function() {
},
anotherMethod: function() {
}