Skip to content

Instantly share code, notes, and snippets.

View jeremybuff's full-sized avatar

Jeremy Buff jeremybuff

View GitHub Profile
@jeremybuff
jeremybuff / .htaccess
Last active August 29, 2015 14:19
Htaccess Hotlink Protection
# Hotlink Protection --------------------------------------------------------------------------------
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g?|png|svg)$ [NC]
RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?yourdomain\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !yahoo\. [NC]
RewriteCond %{REQUEST_URI} !^/hotlinking.png$
@jeremybuff
jeremybuff / FacebookCommentsPluginBlockingDetection.js
Last active August 29, 2015 14:05
How to detect the Facebook comments plugin, and display a warning if it is blocked by a browser extension.
var updateFacebookCmnts = function(){
//Give the FB Object a second to update the UI before we work our magic
setTimeout(function(){
//The fb_iframe_widget class is added to the .fb-comments element when the iframe loads
//if it is not there, we can safely assume the comments haven't loaded and can dispaly a warning.
if(!$('.fb-comments').hasClass('fb_iframe_widget') ){
//Custom warning message/html
var $insertedWarning = '<div id="comments-missing-warning" class="alert alert-danger"><i class="fa fa-exclamation-triangle"></i> Uh oh! Looks like you have the wonderful Disconnect.me, or other social media blocking, plugin installed. This is preventing you from commenting because I use Facebook comments. Whitelist this site to comment.</div>';
//Insert the aforementioned string before the .fb-comments element
@jeremybuff
jeremybuff / Koken Topics - Non-functional
Created April 9, 2013 02:12
Trying to load a topic within an essay and print out the album's images. Not working as currently coded.
<koken:topics>
<koken:loop>
<koken:load source="album" filter:id="album.id">
<koken:loop>
<koken: img />
</koken:loop>
</koken:load>
</koken:loop>
</koken:topics>