Skip to content

Instantly share code, notes, and snippets.

View ryandemmer's full-sized avatar

Ryan Demmer ryandemmer

View GitHub Profile
@ryandemmer
ryandemmer / support.pdf.js
Created August 8, 2012 11:53
JQuery PDF support detection
/*
* Check for PDF support
* Based on http://downloads.beninzambia.com/blog/acrobat_detection.js.txt
*/
$.support.pdf = (function() {
try {
// IE
if(!$.support.cssFloat) {
var control = null;
@ryandemmer
ryandemmer / gist:4634415
Created January 25, 2013 13:25
CSS3 Spinner
.spinner {
background : url(spinner.png) no-repeat center;
width :16px;
height :16px;
display :block;
-webkit-animation: spinner 1s infinite linear; /* Safari 4+ */
-moz-animation: spinner 1s infinite linear; /* Fx 5+ */
-o-animation: spinner 1s infinite linear; /* Opera 12+ */
animation: spinner 1s infinite linear; /* IE 10+ */
@ryandemmer
ryandemmer / gist:5185962
Last active December 15, 2015 02:19
Ninjaboard to EasyDiscuss converter Based on the Ninjaboard to Kunena converter from AmmoniteNetworks - https://github.com/AmmoniteNetworks/Ninjaboard-To-Kunena-Converter/blob/master/cli/ninjaboardToKunena.php
<?php
// Make sure we're being called from the command line, not a web interface
if (array_key_exists('REQUEST_METHOD', $_SERVER))
die();
// Set flag that this is a parent file.
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
@ryandemmer
ryandemmer / gist:13f2ca3a9835a79695ad
Created October 6, 2014 16:33
Move editor buttons
$editor = $this->_displayButtons($id, $buttons, $asset, $author);
$editor .= '<label for="' . $id . '" style="display:none;" aria-visible="false">' . $id . '_textarea</label><textarea id="' . $id . '" name="' . $name . '" cols="' . $col . '" rows="' . $row . '" style="width:' . $width . ';height:' . $height . ';" class="wfEditor mce_editable source" wrap="off">' . $content . '</textarea>';
@ryandemmer
ryandemmer / gist:477ccdf27f538dc29889
Created October 7, 2014 12:25
Convert braces to named entities
(function() {
tinyMCE.onAddEditor.add(function(mgr, ed) {
ed.onPostProcess.add(function(ed, o) {
o.content = o.content.replace(/\{/g, '&lcub;').replace(/\}/g, '&rcub;');
});
});
})();
@ryandemmer
ryandemmer / gist:13c742e547bc8cba6d51
Last active May 20, 2017 12:04
VIES VAT Validator
public function validateVAT($code, $vat) {
if ($code === "GR") {
$code = "EL";
}
try {
$client = @new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");
} catch (SoapFault $e) {
return -1;
}
@ryandemmer
ryandemmer / gist:3ebfae1f54fa81c6563b
Created February 19, 2015 13:30
Dynamically add TinyMCE editor
if (typeof tinymce !== "undefined") {
tinyMCE.execCommand('mceAddControl',false,'textarea_id');
}
@ryandemmer
ryandemmer / gist:46ff99c9e05cea2fea75
Last active August 29, 2015 14:17
Example WFCustomFileSystem extension
<?php
/**
* @package JCE
* @copyright Copyright (c) 2009-2015 Ryan Demmer. All rights reserved.
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
*/
@ryandemmer
ryandemmer / search-joomla.php
Created March 30, 2015 14:31
JCE 3.0 Search Plugin Example
<?php
/**
* @package JCE
* @copyright Copyright (c) 2009-2014 Ryan Demmer. All rights reserved.
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
@ryandemmer
ryandemmer / link-joomla.php
Created March 30, 2015 14:32
Joomla Link Plugin Example for JCE 3.0