Skip to content

Instantly share code, notes, and snippets.

View davist11's full-sized avatar
👨‍💻

Trevor Davis davist11

👨‍💻
View GitHub Profile
@davist11
davist11 / pi.vl_client.php
Created July 28, 2012 04:50
Sample Plugin for DCEERs Presentation
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* ExpressionEngine - by EllisLab
*
* @package ExpressionEngine
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2003 - 2011, EllisLab, Inc.
* @license http://expressionengine.com/user_guide/license.html
* @link http://expressionengine.com
@davist11
davist11 / gist:3182116
Created July 26, 2012 13:48
SSH without Password
cat ~/.ssh/id_rsa.pub | ssh remote_user@remote_host 'cat >> .ssh/authorized_keys'
// Create some global variables so we can use snippets EVERYWHERE
$new_global_vars = array(
'gv_channel_disable_all' => 'disable="categories|category_fields|custom_fields|member_data|pagination|trackbacks"',
'gv_channel_disable_most' => 'disable="categories|category_fields|member_data|pagination|trackbacks"',
'gv_channel_disable_news' => 'disable=categories|category_fields|member_data|trackbacks"',
'gv_channel_disable_basic' => 'disable="member_data|pagination|trackbacks"',
'gv_channel_disable' => 'disable="member_data|trackbacks"',
'gv_date_format' => '%M %j, %Y'
);
@davist11
davist11 / gist:2917659
Created June 12, 2012 13:55
EE Plugin Conditional
{exp:my_plugin}
{!-- This conditional works --}
{if some_thing}
{some_thing}
{/if}
{!-- This one never works --}
{if other_things}
<ul>
{other_things}
@davist11
davist11 / gist:2843326
Created May 31, 2012 13:09
Viget Case Study
{exp:stash:set name="content"}
...
<section class="content-primary content">
<div class="wrapper">
{if work_carousel}
<section class="section-carousel section">
<div class="section-content shiny">
<ul class="grouping-carousel grouping">
@davist11
davist11 / gist:2702312
Created May 15, 2012 14:44
jQuery Plugin Pattern
/*
* 'Highly configurable' mutable plugin boilerplate
* Author: @markdalgleish
* Further changes, comments: @addyosmani
* Licensed under the MIT license
*/
// Note that with this pattern, as per Alex Sexton's, the plugin logic
// hasn't been nested in a jQuery plugin. Instead, we just use
// jQuery for its instantiation.
$cols: 12;
$gutter: 2%;
$one_col: (100% - ($gutter * ($cols - 1))) / $cols;
@mixin cols($num) {
width: ($one_col * $num) + ($gutter * ($num - 1));
}
@mixin sub_cols($num_child, $num_parent) {
$parent_size: ($one_col * $num_parent) + ($gutter * ($num_parent - 1));
@davist11
davist11 / gist:2421316
Created April 19, 2012 14:29
Work Index Template
{embed="_layouts/index"}
{preload_replace:channel="work"}
{exp:switchee variable="{segment_2}" parse="inward"}
{!-- Work listing --}
{case value=""}
{exp:stash:set_value name="title" value="Our Work | Viget"}
{exp:stash:set_value name="body_class" value="page-work page-primary page"}
{exp:stash:set_value name="body_page" value="work"}
@davist11
davist11 / 1 inspire.group index.html
Created April 19, 2012 01:17
Inspire Blog Templates
{embed="_layouts/blog"
blog_title="Inspire"
blog_slug="inspire"
blog_category_id="125"
blog_description="Design &amp; Interaction"
blog_description_more="our three hundred foot view. Primarily written by/for UX designers, visual designers, and front-end developers."
meta_description="Viget&rsquo;s Inspire blog: discussing all things design &amp; interaction including wireframing, typography, Photoshop tips and techniques, CSS, HTML5, and jQuery."
rss="{gv_inspire_feed}"
}
@davist11
davist11 / acc.viget.php
Created April 12, 2012 22:33
Viget.com Accessory
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* ExpressionEngine - by EllisLab
*
* @package ExpressionEngine
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2003 - 2011, EllisLab, Inc.
* @license http://expressionengine.com/user_guide/license.html
* @link http://expressionengine.com