Skip to content

Instantly share code, notes, and snippets.

@yahelc
yahelc / gist:1259897
Created October 3, 2011 18:48
ga integration stub
var _gaq = _gaq || [];
var optimizely = optimizely || [];
(function($) {
var oldonerror = window.onerror;
window.onerror = function(msg, url, line) {
if(oldonerror) {oldonerror(msg, url, line);}
_gaq.push(['_trackEvent', 'Error Log', msg, url + '_' + line]);
};
function getElem(href)
{
@yahelc
yahelc / a - how to install.txt
Created October 4, 2011 03:10
"Chosen" for Zendesk Client Selector (BSD only!)
In Chrome, no prep necessary.
In Firefox, be sure you've installed Greasemonkey.
To install: Click "Raw" on the top right of chosen-for-bsd-harvest.user.js -----↓
To get an updated version after installing:
You'll need to uninstall and re-install it from scratch.
Use at your own risk. Might break if Zendesk changes their markup.
@yahelc
yahelc / sv_performance.php
Created November 1, 2011 19:09 — forked from douglasback/sv_performance.php
Passes Query Count and Template Load Time in a GA Non-Interaction Event. Sent at window.onload to minimize latency.
{if member_group == '1'}
<script>
jQuery(window).load(function(){
_gaq.push(["_trackEvent", "EE Perf", location.pathname, "{total_queries} queries", parseInt({elapsed_time},10), true]);
});
</script>
{/if}
@yahelc
yahelc / gist:1390547
Created November 24, 2011 03:11
monaeltahawy tweet json
{
"place": null,
"in_reply_to_user_id": null,
"favorited": false,
"geo": null,
"coordinates": null,
"retweet_count": "100+",
"in_reply_to_screen_name": null,
"created_at": "Thu Nov 24 01:44:39 +0000 2011",
"retweeted": false,
@yahelc
yahelc / jQuery-sharedcount.js
Created December 1, 2011 04:09
SharedCount JSONP/CORS jQuery plugin - Cache friendly
jQuery.sharedCount = function(url, fn) {
url = encodeURIComponent(url || location.href);
var arg = {
url: "//" + (location.protocol == "https:" ? "sharedcount.appspot" : "api.sharedcount") + ".com/?url=" + url,
cache: true,
dataType: "json"
};
if ('withCredentials' in new XMLHttpRequest) {
arg.success = fn;
}
@yahelc
yahelc / gist:1418593
Created December 1, 2011 17:59
widget.js backup
(function(a,b){function O(a){for(var b=0;b<J.bundles.length;b++)for(var c in J.bundles[b])if(c!=a&&v(J.bundles[b][c],a)>-1)return c}function N(){a.using=m,a.provide=n,a.define=o,a.loadrunner=p;return M}function L(a){var b,c;for(var d=0,e;e=J.matchers[d];d++){var f=e[0],g=e[1];if(b=a.match(f))return g(a)}throw new Error(a+" was not recognised by loader")}function K(a,b){var c=[];for(var d=0,e;e=a[d];d++)typeof e=="string"&&(e=L(e)),u(e)&&(e=new C(K(e,b),b)),c.push(e);return c}function J(){var a=t(arguments),b,c;typeof a[a.length-1]=="function"&&(b=a.pop()),typeof a[a.length-1]=="boolean"&&(c=a.pop());var d=new B(K(a,c),c);b&&d.then(b);return d}function I(){var a=t(arguments),b=[],c,d;typeof a[0]=="string"&&(c=a.shift()),u(a[0])&&(b=a.shift()),d=a.shift();return E(c,function(a){function f(){var e=H(t(b),c),f;typeof d=="function"?f=d.apply(c,e):f=d,typeof f=="undefined"&&(f=c.exports),a(f)}var c=this,e=[];for(var g=0,h=b.length;g<h;g++){var i=b[g];v(["require","exports"],i)==-1&&e.push(G(i,c))}e.length>0?J.apply
if (window.BSDTracker) {
var type = (BSDTracker.signup) ? "signup" : (BSDTracker.contribution) ? "contribution" : false;
if (type) {
var tracker = BSDTracker[type];
var form = tracker.safeGet('formname', "");
var amount = tracker.safeGet('transaction_amt', 0);
_gaq.push(['_trackEvent', 'Completions', tracker.getModuleName(), form, Math.ceil(amount)]);
if (amount) {
var order_id = tracker.safeGet("contribution_key", "");
@yahelc
yahelc / gist:1446981
Created December 8, 2011 13:22
NewtBites engine
<?php $agencies = array("Access Board", "Administration for Native Americans", "Administration on Aging", "Administration on Developmental Disabilities", "Administrative Committee of the Federal Register", "Administrative Conference of the United States", "Administrative Office of the U.S. Courts", "Advisory Council on Historic Preservation", "African Development Foundation", "Agency for Healthcare Research and Quality", "Agency for International Development", "Agency for Toxic Substances and Disease Registry", "Agricultural Marketing Service", "Agricultural Research Service", "Agriculture Department", "Air and Radiation Hotline", "U.S. Air Force", "Alcohol and Tobacco Tax and Trade Bureau", "Alcohol, Tobacco, Firearms, and Explosives Bureau", "American Battle Monuments Commission", "AmeriCorps Recruiting", "AMTRAK Corporation", "Animal and Plant Health Inspection Service", "Appalachian Regional Commission", "Architect of the Capitol", "National Archives and Records Administration", "Arctic Research Commissio
@yahelc
yahelc / gist:1479100
Created December 14, 2011 23:30
gist embed testing
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.
@yahelc
yahelc / caveatPatchor.js
Created December 15, 2011 16:45
Sample caveatPatchor.js file for use in Propane 1.1.2 and above: Plus YouTube and MP3 Support
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.