Skip to content

Instantly share code, notes, and snippets.

@totakke
Last active December 24, 2015 08:59
Show Gist options
  • Save totakke/6773809 to your computer and use it in GitHub Desktop.
Save totakke/6773809 to your computer and use it in GitHub Desktop.
Sorts Clojure Cup apps by voting counts.
// Sort Clojure Cup 2014 apps by voting counts.
//
// Usage:
// Open `http://clojurecup.com/apps.html`.
// Input the address bar
// `javascript: var addScript=function(src){var script=document.createElement('script');script.src=src;script.type='text/javascript';document.querySelector('head').appendChild(script)};addScript('https://code.jquery.com/jquery-2.1.1.js');setTimeout(function(){addScript('https://rawgit.com/totakke/6773809/raw/********/sort-clojurecup-apps.js');},1000);" type="text/javascript"></script>');`.
(function() {
var countVotes = function(text) {
return parseInt(text.match(/\d/g).join(''));
};
$('div[data-reactid=".0.1.0.1"]').html(
$('div[data-reactid=".0.1.0.1"] > div').sort(function(a, b) {
return countVotes($(b).find('div.small').html()) - countVotes($(a).find('div.small').html());
})
);
})();
@totakke
Copy link
Author

totakke commented Oct 1, 2013

Usage:

  1. Open https://clojurecup.com/#/apps on Google Chrome.
  2. Input the address bar javascript: var addScript=function(src){var script=document.createElement('script');script.src=src;script.type='text/javascript';document.querySelector('head').appendChild(script)};addScript('https://code.jquery.com/jquery-2.1.1.js');setTimeout(function(){addScript('https://rawgit.com/totakke/6773809/raw/5911024f5b5bc80f1819d28b3e824ee6a0808d00/sort-clojurecup-apps.js');},1000);.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment