Skip to content

Instantly share code, notes, and snippets.

View anthonyringoet's full-sized avatar

Anthony R anthonyringoet

View GitHub Profile
// TODO: remove spaces and newlines
javascript:(function(){
s=document.createElement('script');
s.type='text/javascript';
s.src='http://example.com/bookmarklet.js';
document.body.appendChild(s);
})();
// TODO: bookmarklet code needs to be in an anchor tag
// <a href="javascript:(function(){s=document.createElement('script');s.type='text/javascript';s.src='http://example.com/bookmarklet.js';document.body.appendChild(s);})();">My Bookmarklet</a>
@anthonyringoet
anthonyringoet / vrtAds.js
Created June 8, 2012 07:14
bookmarklet: remove bullshit ads from vrt websites
var vrtAds = (function ( document, undefined) {
var results = document.querySelectorAll('#leaderboard, #skyscraper, .block-canvas_doormat_advertising, #adh_textlink_wrapper');
for (var i = 0; i < results.length; i++) {
//console.log(results[i].style.display);
results[i].style.display = 'none';
}
}(document));
// paste the following in a bookmarklet
// javascript:var%20vrtAds%20=%20(function%20(%20document,%20undefined)%20{var%20results%20=%20document.querySelectorAll(%27#leaderboard,%20#skyscraper,%20.block-canvas_doormat_advertising,%20#adh_textlink_wrapper%27);for%20(var%20i%20=%200;%20i%20<%20results.length;%20i++)%20{console.log(results[i].style.display);results[i].style.display%20=%20%27none%27;}}(document));
@anthonyringoet
anthonyringoet / template.php
Created June 14, 2012 10:49
Make image style links not focusable (fe. when there are other read more links already available)
<?php
/*
* Implements hook_preprocess_image_formatter() to add tabindex to teaser img links
*/
function theme_preprocess_image_formatter(&$vars) {
if ($vars['image_style'] == "yourimagestyle") {
if(!empty($vars['path'])) {
$vars['path']['options']["attributes"]["tabindex"] = -1;
}
@anthonyringoet
anthonyringoet / gist:3415038
Created August 21, 2012 12:29 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@anthonyringoet
anthonyringoet / mod.js
Created August 24, 2012 08:04
module pattern snippet
var mod = (function (window, document, $, undefined) {
var my = {},
privateVar = 'bazinga';
my.init = function () {
// ...
}
return my;
})(window, document, jQuery);
@anthonyringoet
anthonyringoet / gist:3550997
Created August 31, 2012 09:55
git make local branch track remote branch
git branch --set-upstream master origin/master
@anthonyringoet
anthonyringoet / gist:3712312
Created September 13, 2012 06:24
Make CRLF warnings go away
$ rm .git/index
$ git reset --hard HEAD
@anthonyringoet
anthonyringoet / gist:3754944
Created September 20, 2012 09:40
load assets from production
# try to load from live site
# place in local files folder
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) http://i.am.production.url/to-files/$1
</IfModule>
@anthonyringoet
anthonyringoet / template.php
Created September 21, 2012 10:29
drupal - remove div.panel-separator crap
function theme_panels_default_style_render_region($vars) {
$output = '';
$output .= implode('', $vars['panes']);
return $output;
}
@anthonyringoet
anthonyringoet / .extra
Created September 28, 2012 12:06
personal .extra for use with .dotfiles
# folder aliases
alias home="cd ~"
alias p="cd ~/gitprojects"
alias dropbox="cd ~/Dropbox"
alias sites="cd ~/Sites"
alias desk="cd ~/Desktop"
alias logs="subl /Applications/MAMP/logs"
alias hosts="subl ~/Desktop/.alias/_vhosts"
# app aliases