Skip to content

Instantly share code, notes, and snippets.

@timelf123
timelf123 / gist:3850703
Created October 8, 2012 04:20 — forked from underdown/gist:2474608
responsive ads
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3658299045266116";
/* top */
if ($(window).width()<728 ){
google_ad_slot = "4414183254";
google_ad_width = 320;
google_ad_height = 50;
}else{
google_ad_slot = "1020377061";
google_ad_width = 728;
@spivurno
spivurno / gw-format-money.php
Last active October 20, 2021 10:14
Gravity Wiz // Format Fields as Currency via jQuery
<?php
/**
* Format Fields as Currency via jQuery
* http://gravitywiz.com/format-field-as-currency/
*/
class GWFormatMoney {
/**
* Stores a copy of the original field values so once the money-formatted numbers have been cleaned for validation
* they can be restored after being validated.
@spivurno
spivurno / gw-gravity-forms-better-pre-submission-confirmation.php
Last active September 23, 2022 15:50
Gravity Wiz // Gravity Forms // Better Pre-submission Confirmation
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-better-pre-submission-confirmation.php
*/
/**
* Better Pre-submission Confirmation
* http://gravitywiz.com/2012/08/04/better-pre-submission-confirmation/
*/
@underdown
underdown / gist:3183328
Created July 26, 2012 17:26
Google Analytics - Adjusted Bounce Rate
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-1']);
_gaq.push(['_trackPageview']);
setTimeout("_gaq.push(['_trackEvent', '15_seconds', 'read'])",15000);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
@underdown
underdown / gist:2907596
Created June 10, 2012 22:58
Set Cookie On Like/unlike (FBML)
<script>
function SetCookie(cookieName,cookieValue,nDays) {
var today = new Date();
var expire = new Date();
if (nDays==null || nDays==0) nDays=1;
expire.setTime(today.getTime() + 3600000*24*nDays);
document.cookie = cookieName+"="+escape(cookieValue)
+ ";expires="+expire.toGMTString();
};
FB.Event.subscribe('edge.create', function(response) {
@underdown
underdown / gist:2474608
Created April 23, 2012 23:37
responsive ads
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3658299045266116";
/* top */
if ($(window).width()<728 ){
google_ad_slot = "4414183254";
google_ad_width = 320;
google_ad_height = 50;
}else{
google_ad_slot = "1020377061";
google_ad_width = 728;
@underdown
underdown / gist:1711750
Last active March 10, 2025 02:35
twilio - analytics call tracking
<?php
//http://www.vdgraaf.info/google-analytics-without-javascript.html
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
$var_utmac='UA-45XXXX-1'; //enter the new urchin code
$var_utmhn='domain.com'; //enter your domain
$var_utmn=rand(1000000000,9999999999);//random request number
$var_cookie=rand(10000000,99999999);//random cookie number
@underdown
underdown / gist:1367825
Created November 15, 2011 18:07
PHP Google Scraping Function
function findranking($domain, $keyword) {
usleep(400000*rand(0,16)); //set random interval between checks
$url="http://www.google.com/search?q=".urlencode($keyword)."&num=100";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER,1); // set to 0 to eliminate header info from response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
$header = array();
$header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";