Skip to content

Instantly share code, notes, and snippets.

View davist11's full-sized avatar
👨‍💻

Trevor Davis davist11

👨‍💻
View GitHub Profile
@davist11
davist11 / Ftp.php
Last active December 29, 2015 00:29
This is the error I'm getting: Fatal error: Class 'CI_FTP' not found in /Users/tdavis/Sites/lansinoh/third_party/vl_lansinoh/libraries/Ftp.php on line 3
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once(BASEPATH . 'libraries/Ftp.php');
class EE_FTP extends CI_FTP {
var $timeout = 90;
/**
* FTP Connect
<?php
public function modulo()
{
$numerator = $this->EE->TMPL->fetch_param('numerator', '1');
$denominator = $this->EE->TMPL->fetch_param('denominator', '1');
$denominator = ($denominator == 0) ? 1 : $denominator;
return $numerator % $denominator;
}
@davist11
davist11 / gist:6207045
Last active December 20, 2015 22:39 — forked from marcusneto/gist:6207008
<script src="assets/js/jrespond.js" type="text/javascript"></script>
<script type="text/javascript">
// call jRespond and add breakpoints
var jRes = jRespond([
{
label: 'handheld',
enter: 0,
exit: 600
},{
@davist11
davist11 / ext.php
Last active December 16, 2015 22:09
EE Entry previewing
<?php
public function sessions_end($session)
{
if ($session->userdata['can_access_cp'] === 'y') {
$new_global_vars['gv_can_preview'] = TRUE;
} else {
$new_global_vars['gv_can_preview'] = FALSE;
}
{embed="_layouts/blog"
blog_title="Extend"
blog_slug="extend"
blog_category_id="126"
blog_description="Code &amp; Technology"
blog_description_more="our thirty foot view. Primarily written by/for Ruby, iOS, and front-end developers."
meta_description="Viget&rsquo;s Extend blog: discussing all things code &amp; technology including build-out, ExpressionEngine, development, coding best practices, and Ruby on Rails."
rss="{gv_extend_feed}"
}
@davist11
davist11 / config.php
Last active December 13, 2015 18:18
ExpressionEngine: Don't show template debugging in AJAX requests
<?php
if(empty($_SERVER['HTTP_X_REQUESTED_WITH'])) {
$config['show_profiler'] = (ENV === 'local') ? 'y' : 'n';
$config['template_debugging'] = (ENV === 'local') ? 'y' : 'n';
}
<?php
public function clean_whitespace() {
$tagdata = $this->EE->TMPL->tagdata;
$tagdata = trim($tagdata);
$tagdata = preg_replace('/\s+/', ' ', $tagdata);
$tagdata = str_replace("\t", " ", $tagdata);
return $tagdata;
}
@davist11
davist11 / jquery.listSelect.js
Created December 18, 2012 22:06
jQuery List to Select
/**
* @name jQuery List to Select Plugin
* @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 ListSelect = function(elem, options) {
@davist11
davist11 / pl.plugin.php
Created November 27, 2012 21:36
Picturefill method from plugin
Output the picturefill HTML, so you don't have to repeat it all over the templates.
- Param: big_img, src for big image
- Param: small_img, src for small image
- Param: alt, alt attribute for image
- Param: media_query, media query to use, defaults to (min-width: 600px)
- Param: class, class for wrapper, defaults to hero
Example Usage:
{exp:vl:picturefill
big_img="{custom_field_name}"
Installing nokogiri (1.5.5) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/tdavis/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb
checking for libxml/parser.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options: