Skip to content

Instantly share code, notes, and snippets.

View davist11's full-sized avatar
👨‍💻

Trevor Davis davist11

👨‍💻
View GitHub Profile
@davist11
davist11 / gist:2313484
Created April 5, 2012 19:36
Viget Blog Migration
Advance = Channel 12 = Category 124
Engage = Channel 17
Extend = Channel 4 = Category 126
FourLabs = Channel 24 = Category 127
Inspire = Channel 8 = Category 125
-- Move advance posts to inspire
UPDATE exp_channel_titles
SET channel_id = 8
<?php
public function profile_nearby_entries()
{
$entry_id = $this->EE->TMPL->fetch_param('entry_id', NULL);
$prev_url_title = '';
$next_url_title = '';
$tagdata = $this->EE->TMPL->tagdata;
if($entry_id) {
$query = $this->EE->db->select('channel_titles.entry_id, channel_titles.url_title')
@davist11
davist11 / gist:1597120
Created January 11, 2012 22:19
JS Pattern
(function (){
var _self = SITE.thing = {
init: function() {
},
anotherMethod: function() {
}
@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: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 / 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: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 / 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 / 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 / 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