Skip to content

Instantly share code, notes, and snippets.

Ryan Simmons ryan-ethode

View GitHub Profile
@ryan-ethode
ryan-ethode / default.php
Created Feb 9, 2018
Article Category Joomla Module hack to display list in clickable dropdown field rather than in an unordered list.
View default.php
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_category
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
View linux-cheat-sheet.md

Restart Apache (after making Apache config changes or PHP changes)

apachectl restart 
or:
/sbin/service httpd restart

Restart MariaDB (after making any sort of config change)

systemctl restart mariadb
@ryan-ethode
ryan-ethode / external-sites-new-tab.js
Created Jan 12, 2017
Automatically open all external website links in a new tab.
View external-sites-new-tab.js
$( document ).ready(function() {
$(".container a").each(function() {
var pageUrl = $(this).attr("href");
if(pageUrl == null) {
var pageUrl = "nothing";
}
if(pageUrl.indexOf("://") > 0 && pageUrl.indexOf("yourdomain.com") < 0) {
$(this).attr("target","_blank");
}
@ryan-ethode
ryan-ethode / url-replace.js
Last active Nov 10, 2016
URL Replacer: Used on a multi-site host to direct relative URLs from one host to another host.
View url-replace.js
$("a").each(function() {
if($(this).parents('.info').length) {
var href = $(this).prop('href');
var href = href.replace("https://somewebsite.com/", "https://someotherwebsite.com/");
$(this).prop('href', href);
$(this).attr('target','_blank');
}
});
@ryan-ethode
ryan-ethode / velocity-template-var-export.dot
Created Sep 29, 2016
A great little snippet to view all of the variables available to a velocity template
View velocity-template-var-export.dot
#foreach($key in $context.keys) <pre> $key</pre> #end
@ryan-ethode
ryan-ethode / print-div.html
Created Mar 3, 2016
A print button that only prints the contents of a specific div, rather than a whole page.
View print-div.html
<div id="print-contents">
<!-- Your content goes here. -->
</div>
<script>
printDivCSS = new String ('<link href="../css/main.css" rel="stylesheet" type="text/css">')
//The line referencing your CSS will keep your printed div formatting looking correct.
function printDiv(divId) {
window.frames["print_frame"].document.body.innerHTML=printDivCSS + document.getElementById(divId).innerHTML;
window.frames["print_frame"].window.focus();
@ryan-ethode
ryan-ethode / Parent Sibling Folder Navigation
Last active Nov 11, 2015
This Velocity grabs the parent folder of the page you are on and creates a menu based on other parent elements.
View Parent Sibling Folder Navigation
#set ($navPath = $VTLSERVLET_URI.substring(0, $VTLSERVLET_URI.indexOf('/',1)) + "/")
#set( $list = $navtool.getNav("$navPath"))
<ul>
#foreach($n in $list)
<li>
<a href='${n.href}'>${n.title}</a>
</li>
#end
</ul>
@ryan-ethode
ryan-ethode / dotcms-rss.dot
Last active Mar 3, 2016
This creates a DotCMS RSS feed based on a content structure.
View dotcms-rss.dot
#set ($query="+structureName:Blog +(conhost:48190c8c-42c4-46af-8d1a-0cd5db894797 conhost:SYSTEM_HOST), 10, modDate desc")
<xml version="1.0" encoding="UTF-8">
<rss version="2.0">
<channel>
<pubDate>1 Jan 2006 23:23:04 GMT</pubDate>
<title>Company Blog</title>
<description>Tips and Tricks</description>
<link>http://www.website.com/blog/</link>
<copyright>2006-2015 Company Name</copyright>
You can’t perform that action at this time.