Skip to content

Instantly share code, notes, and snippets.

Avatar

Fotis Evangelou fevangelou

View GitHub Profile
@fevangelou
fevangelou / install_nano_v4.0_on_mac.sh
Created Mar 24, 2019
Install Nano Editor v4.0 (with syntax highlighting) on the Mac
View install_nano_v4.0_on_mac.sh
#!/bin/bash
# Install Nano Editor (https://www.nano-editor.org) with syntax highlighting on the Mac
# Version 4.0 ("Thy Rope of Sands") released March 24th 2019
cd ~/
wget https://www.nano-editor.org/dist/v4/nano-4.0.tar.gz
tar -xvf nano-4.0.tar.gz
mv nano-4.0 .nano
cd .nano/
@fevangelou
fevangelou / index.desktop_or_mobile.php
Created Dec 18, 2018
Code to utilize different sub-templates for desktop and mobile in Joomla. Usage: Add right after the opening <html> tag
View index.desktop_or_mobile.php
// Desktop to Mobile redirect and vise-versa
// Usage: Add right after the opening <html> tag
// For the desktop template:
<!-- Browser detect and redirect -->
<script type="text/javascript">
(function() {
// Get URL query strings
function getQS(v) {
@fevangelou
fevangelou / timestamp_for_joomla_css_js.php
Last active Nov 4, 2018
Enforce a timestamp on all CSS/JS files attached in a Joomla template
View timestamp_for_joomla_css_js.php
<?php
defined('_JEXEC') or die;
/* --- Add this at the very top of index.php (but right below the "defined..." line) to control the timestamp --- */
// Set a timestamp for CSS/JS files
if (isset($_GET['nocache'])) {
// Timestamp for testing
// When ?nocache is appended in a URL, enforce a timestamp of up to the current second
// so the CSS and JS files are re-fetched by the browser, even behind a CDN
@fevangelou
fevangelou / check_frontpage.php
Created Aug 30, 2018
Frontpage check in Joomla
View check_frontpage.php
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
// Frontpage Check
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($menu->getActive() == $menu->getDefault()) {
$isFrontpage = true;
@fevangelou
fevangelou / get_plugin_params.php
Last active Aug 30, 2018
How to access Joomla plugin parameters anywhere in Joomla
View get_plugin_params.php
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
// === How to access Joomla plugin parameters anywhere in Joomla ===
// Get plugin with name 'plugin_name' of type 'plugin_type' (e.g. "content")
$plugin = JPluginHelper::getPlugin('plugin_type', 'plugin_name');
@fevangelou
fevangelou / memcached_installer_for_cpanel.sh
Last active Apr 24, 2019
Memcached (service & related PHP modules) installation on cPanel/WHM servers
View memcached_installer_for_cpanel.sh
#!/bin/bash
# Memcached (service & related PHP modules) installation on cPanel/WHM servers
#
# by Fotis Evangelou (Engintron)
#
# Updated: May 2018
#
# USAGE:
# Upload this file at the root (/) folder of your cPanel/WHM server (on CentOS 7)
View annoying.js
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*
View generate.php
<?php
echo "Downloading...\n";
copy("http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip","/tmp/GeoIPCountryCSV.zip");
$f=fopen('zip:///tmp/GeoIPCountryCSV.zip#GeoIPCountryWhois.csv','r');
echo "Generating";
$data=NULL;
View CSS Only Playground.markdown

CSS Only Playground

Sidenav, Carousel, Accordion, Modal and Tooltips without the need of JavaScript (progressively enhanceable).

A Pen by ekrof on CodePen.

License.

@fevangelou
fevangelou / gleym.com.txt
Created Apr 22, 2016
Email reminders via @gleym.com
View gleym.com.txt
Send an email to 1d@gleym.com to receive a reminder in one day, you'll get an echo of your original email.
Legend: d=day, h=hour, w=week, m=month
Examples:
2d@gleym.com=2 days
1h@gleym.com=1 hour
4d1h@gleym.com=4 days and 1hour
72h@gleym.com=72 hours