Skip to content

Instantly share code, notes, and snippets.

Jeremy Banks banksJeremy

Block or report user

Report or block banksJeremy

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
View throttling modes
Throttle decorator parameters:
f - function
interval - number - the minimum duration in miliseconds between calls
keep - FIRST/LAST/ALL - which function calls will be kept if throttling must occur
wait - NONE/INTERVAL/IDLE - how long to wait after getting the first call before making a call
- if NONE the call will be made immediately
- if INTERVAL the call will be made after interval ms have elapsed since the first call
- if IDLE the call will be made after interval ms have elasped without a call
wait-interval - optional number - can be used to override the wait interval, instead of using the standard interval.
must be <= interval

Keybase proof

I hereby claim:

  • I am jeremybanks on github.
  • I am jeremybanks ( on keybase.
  • I have a public key whose fingerprint is 83F8 4CD8 67E2 77A1 3076 E227 A582 40CA 54EA A262

To claim this, I am signing this object:

View closeVoteReviewScraper.js
// Scrapes through all of the pages of Close Votes reviews and eventually
// dumps the results as JSON, replacing the contents of the <body>.
allPagesLoaded = new $.Deferred,
page = 1,
maxPages = null,
reviews = { /* "/q/POST_ID/USER_ID": { } */ },
getNextPagePeriod = 4000,
getNextPageIntervalId = null,
View _.js
(function a(){if(arguments.length>100){var b=0,c=new $.Deferred,d=[],e,f=setInterval(e=function(e){b>e.length?(clearInterval(f),c.resolve(d)):(a.apply(this,[],b,b+100)).then(function(a){[].push.apply(d,a)}),b+=100)},1e4,arguments);e(arguments);return c.promise()}var g=[],String),h="XeZZHccRWHO6GGXUpZr6sg((",i=""+g.join("%3B")+"?order=asc&sort=creation&site=stackoverflow&pagesize=100&filter=!LYcS_pIiq0KIhg63M2ZZ4y&key="+h,j=arguments;return $.ajax(i,{dataType:"jsonp"}).pipe(function(a){var b=[],c={},d;for(d=0;d<a.items.length;d++)c[a.items[d].post_id]=!0;for(d=0;d<g.length;d++)c[g[d]]||b.push(g[d]);console.log("data.items.length",a.items.length),console.log("postIds.length",g.length);return b})})(215894,215903,215907,215919,215925,215931,215968,215974,215977,215986,215997,216023,216026,216034,216045,216055,216062,216227,216232,216235,216910,217620,257880,267431,267496,267503,275094,277812,311003,315016,384551,573940,737556,827771,827859,829
View soElectionGraphs.js
var separateThousands = function(n) {
var s = String(n);
s = s.replace(/[1-9][0-9]*/, function(match) {
var r = "";
for (var i = 0; i < match.length; i++) {
r = match[match.length - 1 - i] + r;
if (i % 3 == 2 && i < match.length - 1) {
r = "," + r;
View gist:2794914
// JavaScript could have had nice, clean, minimal prototypal inheritance, but
// for political reasons this was obscured behind confusing class-like syntax.
// A cleaner prototype implementation would just use two straightforward operators or methods:
// - `extend` creates an new object that inherits from another, optionally specifying
// properties to be set on the new object.
// - `isa` checks if one object is or inherits from another.
var original = ExtendableObject.extend({
name: "John",
View clearStackSiteProfile.js
f: function() {
var cleanSource, form, m, source, userid;
source = "({f:" + this.f + "}).f()";
cleanSource = "eval(unescape(" + (JSON.stringify(escape(String(source)))) + "));";
if (!(m = /\/users\/edit\/(\d+)($|\/)/.exec(location.pathname))) {
throw new Error('must run on profile edit page');
userid = +m[1];
form = $('form#user-edit-form');
banksJeremy /
Created Nov 19, 2011
A Reddit user script to import posts from Stack Overflow.
#!/usr/bin/env coffee --compile
return unless /(\.|^)$/
user = 'fromStackOverflow'
passwd = 'thisI5r34ll1 the PAsw dsro =0'
#!/usr/bin/env coffee --compile
return unless /(\.|^)$/
user = 'fromStackOverflow'
passwd = 'thisI5r34ll1 the PAsw dsro =0'
banksJeremy /
Created Nov 13, 2011
Stack Exchange deleted post user script

Initial post IDs are taken from the URL.

For each known post ID:

  • /posts/ID/edit
    • Contains title, body source and tags of post.
    • If the post has been edited, it also contains the names, comments and IDs for each revision.
  • /posts/ID/comments
    • Contains the HTML text of the comments.
    • May provide the userid/name of the asker, if he has commented. Use this to get more info from real API.
You can’t perform that action at this time.