Skip to content

Instantly share code, notes, and snippets.

@gerbz
gerbz / select_all.js
Created August 27, 2015 03:40
Select All for twitlistmanager.com
$(":checkbox").each(function() {
if(Number($(this).attr('id').substring(1)) % 10 == 0){
$(this).attr('checked', true);
}
});
@gerbz
gerbz / popup_center
Last active August 29, 2015 14:02
Popups a window to the center of the screen (even when you have multiple monitors)
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 / feedly_bookmarklet.js
Last active August 29, 2015 14:21
Feedly Bookmarklet (ignores comment feeds)
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 / convertForTumblr.js
Created August 29, 2012 15:19
Base64 image -> Tumblr url-encoded binary contents
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)
@gerbz
gerbz / ga_ecommerce_hack.js
Last active November 5, 2015 20:47
Google Analytics eCommerce Hack
/*
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'];

Keybase proof

I hereby claim:

  • I am gerbz on github.
  • I am gerbz (https://keybase.io/gerbz) on keybase.
  • I have a public key ASCRvqroViyR7GHw5D4rXGBui36I64BNFPbHvJ18-UZkYQo

To claim this, I am signing this object: