Skip to content

Instantly share code, notes, and snippets.

Avatar

Trevor Davis davist11

View GitHub Profile
@davist11
davist11 / Standard.json
Created Sep 23, 2020
Redactor Language Plugin
View Standard.json
{
"buttons": [
"html",
"formatting",
"bold",
"italic",
"unorderedlist",
"orderedlist",
"link",
"image",
@davist11
davist11 / external-links.js
Created May 5, 2017
target external links
View external-links.js
@davist11
davist11 / gist:2b3488fe9587be959a46
Created May 9, 2014
Generate video embed URL from YouTube or Vimeo
View gist:2b3488fe9587be959a46
<?php
public function getEmbedCode($url)
{
if (strpos($url, 'youtube') !== FALSE) {
$url_parts = parse_url($url);
parse_str($url_parts['query'], $segments);
return '//www.youtube.com/embed/' . $segments['v'];
} else if (strpos($url, 'vimeo') !== FALSE) {
View gist:9621117
var $body = $('body');
if (!$body.hasClass('whatever')) {
var header_wrap = $('#header-wrap');
var sticky_navigation_offset_top = header_wrap.offset().top;
var sticky_navigation = function() {
var scroll_top = $(window).scrollTop();
if (scroll_top > sticky_navigation_offset_top) {
@davist11
davist11 / pi.php
Last active Aug 29, 2015
in_array plugin method
View pi.php
<?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;
}
View jquery.tabs.js
/**
* @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) {
View pi.auto_link.php
View pi.auto_link.php
@davist11
davist11 / Ftp.php
Last active Dec 29, 2015
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
View Ftp.php
<?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
View modulo-plugin.php
<?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;
}