Skip to content

Instantly share code, notes, and snippets.

gerbz

Block or report user

Report or block gerbz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gerbz
gerbz / ga_ecommerce_hack.js
Last active Nov 5, 2015
Google Analytics eCommerce Hack
View ga_ecommerce_hack.js
/*
Add as many of the company's products as you want to the transaction_product array
and then run this code in the console for any ecommerce site which has
Google Analytics eCommerce enabled via ga('require', 'ecommerce');
*/
var transaction_count = 10;
var transaction_min = 1;
var transaction_max = 100;
var transaction_amount = 0;
var transaction_product = ['Super Cool Thing!', 'The best product ever', 'Widget #4', 'Christmas sweater'];
@gerbz
gerbz / select_all.js
Created Aug 27, 2015
Select All for twitlistmanager.com
View select_all.js
$(":checkbox").each(function() {
if(Number($(this).attr('id').substring(1)) % 10 == 0){
$(this).attr('checked', true);
}
});
@gerbz
gerbz / feedly_bookmarklet.js
Last active Aug 29, 2015
Feedly Bookmarklet (ignores comment feeds)
View feedly_bookmarklet.js
javascript: void(el = document.getElementsByTagName('link'));
void(g = false);
for (i = 0; i < el.length; i++) {
if(r = el[i].getAttribute('rel')){
if (r.indexOf('alternate') != -1) {
if(t = el[i].getAttribute('type')){
if(t.indexOf('rss') != -1) {
if(h = el[i].getAttribute('href')){
@gerbz
gerbz / popup_center
Last active Aug 29, 2015
Popups a window to the center of the screen (even when you have multiple monitors)
View popup_center
function popup_center(url, title, w, h) {
// Fixes dual-screen position
var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
var left = ((width / 2) - (w / 2)) + dualScreenLeft;
var top = ((height / 2) - (h / 2)) + dualScreenTop;
@gerbz
gerbz / convertForTumblr.js
Created Aug 29, 2012
Base64 image -> Tumblr url-encoded binary contents
View convertForTumblr.js
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="
function base64_decode(input){
var output = new Array();
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
var orig_input = input;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
if (orig_input != input)
You can’t perform that action at this time.