Skip to content

Instantly share code, notes, and snippets.

View ryandemmer's full-sized avatar

Ryan Demmer ryandemmer

View GitHub Profile
@ryandemmer
ryandemmer / editor.css
Created May 29, 2019 09:21
editor.css file with font size increases for improved readability
/* import your template stylesheet and any others as required */
@import url('template.css');
/* set the base font size and line height */
html {
font-size: 13px;
line-height: 18px
}
/* set the increased font size and line height for all elements */
$text = preg_replace('#(href|src)="([^:"]*)("|(?:(?:%20|\s|\+)[^"]*"))#', '$1="'/$2$3', $text);
@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>
@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 / 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 / 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
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 / 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 / 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 / plg_content_example.php
Last active January 20, 2017 09:32
OnContentBeforeSave example
<?php
class PlgContentExample extends JPlugin
{
public function onContentBeforeSave($context, $article, $isNew)
{
if ($context != 'com_content.form') {
return true;
}