Skip to content

Instantly share code, notes, and snippets.

Avatar

Joe Campbell heyjoecampbell

View GitHub Profile
@heyjoecampbell
heyjoecampbell / Youtube Responsive Video and Play Button Placeholder CSS
Created Jan 9, 2018
Youtube Responsive Video and Play Button Placeholder CSS
View Youtube Responsive Video and Play Button Placeholder CSS
.video-container {
position: relative;
padding-bottom: 56.25%;
height: 0; overflow: hidden;
max-width: 100%;
margin: 2.5rem 0;
border: 1px solid #5b5b5b;
background: #eee;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAAAwCAMAAACffixXAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQwIDc5LjE2MDQ1MSwgMjAxNy8wNS8wNi0wMTowODoyMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChNYWNpbnRvc2gpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjQ2NTBGNjVFRUQxQzExRTd
@heyjoecampbell
heyjoecampbell / Remove .php File Extension and Force Trailing Slash (perfect for static Bootstrap websites)
Created Jan 5, 2018
Remove .php File Extension and Force Trailing Slash (perfect for static Bootstrap websites)
View Remove .php File Extension and Force Trailing Slash (perfect for static Bootstrap websites)
## Remove .php -and- Force Trailing Slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(([^/]+/)*[^./]+)/$ $1.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
@heyjoecampbell
heyjoecampbell / unset-scripts.php
Last active Nov 7, 2016
Unset Joomla! Scripts from Template
View unset-scripts.php
// Unset unwanted Scripts - by name
$unset_script = array('k2');
foreach($this->_scripts as $name=>$script)
{
foreach($unset_script as $script)
{
if (strpos($name,$script) !== false)
{
unset($this->_scripts[$name]);
View Pinterest AddThis Endpoint
<-- Replace sample data -->
<-- Append '&is_video=true' for video (YouTube & Vimeo) and audio pins (Soundcloud)
http://api.addthis.com/oexchange/0.8/forward/pinterest_share/offer?url=http://domain.com&title=Sample Title&screenshot=http://placehold.it/350x550&description=Sample Description&pubid=XYZ
@heyjoecampbell
heyjoecampbell / gist:a3181beec8116ccd4fee
Last active May 7, 2016
AddThis Non-JavaScript Social Share (@heyjoecampbell)
View gist:a3181beec8116ccd4fee
// Produce and size pop-up
<script>
function PopupCenter(pageURL, title,w,h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
</script>
<a rel="nofollow" href="javascript:void(0);" onclick="PopupCenter('http://api.addthis.com/oexchange/0.8/forward/facebook/offer?url=<?php echo $this->item->absoluteURL; ?>&amp;pubid=ra-XXXXXX', 'FacebookShare',650,400);" title="Facebook Share">Facebook</a>
@heyjoecampbell
heyjoecampbell / joomlak2-extrafields-meta
Last active Aug 29, 2015
Use Joomla K2 ExtraFields for Meta Data (Replace Single & Double Quotes with HTML Entity)
View joomlak2-extrafields-meta
// remove single and double quotes - place at top of item override file
<?php
$safe = array("&#39;", "&#34;");
$nonsafe = array("'", "\"");
?>
// code to generate meta data (change ExtrafieldAlias) - place after above code
<?php $doc->addCustomTag('<meta property="anything" content="'.str_replace($nonsafe, $safe, $this->item->extraFields->ExtrafieldAlias->value).'" />'); ?>