Skip to content

Instantly share code, notes, and snippets.

View underdown's full-sized avatar

Ryan Underdown underdown

  • Classy Closets
  • Phoenix, AZ
View GitHub Profile
@underdown
underdown / gist:6213359
Last active December 20, 2015 23:29
rss feed reader
<?php
function getFeed($feed_url) {
$content = file_get_contents($feed_url);
$x = new SimpleXmlElement($content);
echo "<ul>";
$counter = 0;
@underdown
underdown / gist:6142584
Created August 2, 2013 19:15
responsive ad code from adsense
<style>
.responsive { width: 320px; height: 50px; }
@media(min-width: 500px) { .responsive { width: 468px; height: 60px; } }
@media(min-width: 800px) { .responsive { width: 728px; height: 90px; } }
</style>
<script async src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- responsive -->
<ins class="adsbygoogle responsive"
style="display:inline-block"
data-ad-client="ca-pub-3658299045266116"
init = function () {
var e, t, n;
typeof document.hidden != "undefined" ? (e = "hidden", n = "visibilitychange", t = "visibilityState") : typeof document.mozHidden != "undefined" ? (e = "mozHidden", n = "mozvisibilitychange", t = "mozVisibilityState") : typeof document.msHidden != "undefined" ? (e = "msHidden", n = "msvisibilitychange", t = "msVisibilityState") : typeof document.webkitHidden != "undefined" && (e = "webkitHidden", n = "webkitvisibilitychange", t = "webkitVisibilityState"), t && $(document).on(n, function (e) {
var n = "Come back! We miss you!";
document[t] === "visible" && typeof window.originalDocumentTitle != "undefined" && (document.title = window.originalDocumentTitle), document[t] === "hidden" && document.title !== n && (window.originalDocumentTitle = document.title, document.title = n)
}),
}
<script type="text/javascript">
google_ad_client = "ca-publisher-id";
width = document.documentElement.clientWidth;
google_ad_slot = "1234567890";
google_ad_width = 320;
google_ad_height = 50;
if (width > 500) {
google_ad_slot = "3456789012";
google_ad_width = 468;
google_ad_height = 60;
/* Whois Current Domain */
javascript:(function(){var domain=document.location.hostname;window.location.replace('http://whois.sc/'+domain);})();
/* Lookup backlinks on ahrefs */
javascript:(function() {var domain=document.location.hostname;
window.location.replace('https://ahrefs.com/site-explorer/overview/domain/'+domain);})();
/* get IMN optimization report */
var j = document.createElement("form");
@underdown
underdown / gist:4234250
Created December 7, 2012 16:06
Traffic Map Configuration
<?php
/************************************************************
Configuration Section
*************************************************************/
$username="email@domain.com";
$password="PASSWORD HERE";
$profile="12345678"; // See http://www.google.com/support/forum/p/Google%20Analytics/thread?tid=73f5507df43705db&hl=en -
$usaonly=1; //Set to filter out non-US information.
$hsize=640; //Horizontal Size
@underdown
underdown / gist:4218625
Created December 5, 2012 19:14
ppc phone track
<?php
if($_GET["gclid"]) {
/* We could switch on each of these if wanted */
$source= $_GET["utm_source"];
$term= $_GET["utm_term"];
$medium= $_GET["utm_medium"];
$campaign=$_GET["utm_campaign"];
$phone="1-888-555-1212"
@underdown
underdown / htaccess-template
Created October 23, 2012 18:04
Default htaccess
Options +FollowSymLinks
ServerSignature Off
IndexIgnore *
RewriteEngine on
RewriteRule (.*)php/$ /$1php [R=301,L]
RewriteCond %{HTTP_HOST} ^www.domain.com
@underdown
underdown / gist:3861198
Created October 9, 2012 20:23
Get Client IP Address
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else if (isset($_SERVER['REMOTE_ADDR'])) {
$ip_address = $_SERVER['REMOTE_ADDR'];
} else if (isset($_SERVER['HTTP_CLIENT_IP'])) {
$ip_address = $_SERVER['HTTP_CLIENT_IP'];
} else {
$ip_address = '';
}
@underdown
underdown / gist:3860141
Created October 9, 2012 17:16
Adwords - Simple split testing - redirect keeping auto-tagging in place for Analytics
<?php
/* bypass special offers for past visitors
must ad ?remark=x to ads' destination url */
if($_GET["remark"]) {
}else{
/* check to see if adwords sent visit */
if($_GET["gclid"]) {