Skip to content

Instantly share code, notes, and snippets.

View ryandemmer's full-sized avatar

Ryan Demmer ryandemmer

View GitHub Profile
@ryandemmer
ryandemmer / filesystem-hikashop.php
Last active January 31, 2017 14:37
Example JCE Filesystem Extension for HikaMarket
<?php
require_once(JPATH_SITE . '/components/com_jce/editor/extensions/filesystem/joomla.php');
class WFHikashopFileSystem extends WFJoomlaFileSystem {
private function getHikaMarketVendor() {
$hkm_init = defined('HIKAMARKET_COMPONENT');
if(!$hkm_init ) {
<?php
class PlgSystemWfHikashop extends JPlugin {
public function __construct(&$subject, $config) {
parent::__construct($subject, $config);
}
private function getHikaMarketVendor() {
$hkm_init = defined('HIKAMARKET_COMPONENT');
@ryandemmer
ryandemmer / sef.php
Last active April 14, 2017 11:30
System - SEF
<?php
/**
* @package Joomla.Plugin
* @subpackage System.sef
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
@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 / emoji.json
Created February 16, 2018 17:11
Emjoi JSON file
[
{"😀":"grinning_face"},
{"😁":"grinning_face_with_smiling_eyes"},
{"😂":"face_with_tears_of_joy"},
{"😃":"smiling_face_with_open_mouth"},
{"😄":"smiling_face_with_open_mouth_and_smiling_eyes"},
{"😅":"smiling_face_with_open_mouth_and_cold_sweat"},
{"😆":"smiling_face_with_open_mouth_and_tightly_closed_eyes"},
{"😇":"smiling_face_with_halo"},
{"😈":"smiling_face_with_horns"},
@ryandemmer
ryandemmer / editor.js
Created March 29, 2018 11:32
Replace editor content
tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.onInit.add(function () {
function updateContent(content) {
content = content.replace(/\b(jce)\b/gi, function(match, value) {
return value.toUpperCase();
});
content = content.replace(/\b(january)\b/gi, function(match, value) {
return '<strong>' + value + '</strong>';
});
@ryandemmer
ryandemmer / editor.js
Created April 6, 2018 10:50
Remove external links
tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.onPreInit.add(function () {
ed.parser.addAttributeFilter('href', function (nodes, name) {
var i = nodes.length,
node, value;
while (i--) {
node = nodes[i], value = node.attr('href');
@ryandemmer
ryandemmer / editor.js
Last active June 4, 2018 18:22
Create target on links when pasting
tinyMCE.onAddEditor.add(function(mgr, ed) {
ed.onPreInit.add(function() {
function updateTarget(elm, externalOnly) {
if (externalOnly && !/:\/\//.test(elm.getAttribute('href'))) {
return;
}
if (!elm.target) {
ed.dom.setAttrib(elm, 'target', '_blank');
}
@ryandemmer
ryandemmer / country_map.csv
Last active August 15, 2018 14:38
Country Code Map
code country region
AD Andorra EU
AE United Arab Emirates AS
AF Afghanistan AS
AG Antigua and Barbuda NA
AI Anguilla NA
AL Albania EU
AM Armenia AS
AN Netherlands Antilles NA
AO Angola AF
@ryandemmer
ryandemmer / columns.html
Last active September 14, 2018 19:18
Bootstrap 3 columns
<div class="container-fluid">
<!-- Stack the columns on mobile by making one full-width and the other half-width -->
<div class="row">
<div class="col-xs-12 col-md-8">.col-xs-12 .col-md-8</div>
<div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>
</div>
<!-- Columns start at 50% wide on mobile and bump up to 33.3% wide on desktop -->
<div class="row">
<div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div>