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
@banksJeremy
banksJeremy / mtf.cs
Created Sep 5, 2011
playing with linq as I first try C#
View mtf.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
namespace mtf
{
class Squares : IEnumerable
{
@banksJeremy
banksJeremy / MECHANISM.md
Created Nov 13, 2011
Stack Exchange deleted post user script
View MECHANISM.md

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.
View fromStackOverflowToReddit.user.coffee
#!/usr/bin/env coffee --compile
return unless location.host.match /(\.|^)reddit.com$/
user = 'fromStackOverflow'
passwd = 'thisI5r34ll1 the PAsw dsro =0'
login
@banksJeremy
banksJeremy / fromStackOverflowToReddit.user.coffee
Created Nov 19, 2011
A Reddit user script to import posts from Stack Overflow.
View fromStackOverflowToReddit.user.coffee
#!/usr/bin/env coffee --compile
return unless location.host.match /(\.|^)reddit.com$/
user = 'fromStackOverflow'
passwd = 'thisI5r34ll1 the PAsw dsro =0'
login
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');
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 soElectionGraphs.js
(function(){
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 _.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,[].slice.call(e,b,b+100)).then(function(a){[].push.apply(d,a)}),b+=100)},1e4,arguments);e(arguments);return c.promise()}var g=[].map.call(arguments,String),h="XeZZHccRWHO6GGXUpZr6sg((",i="http://api.stackexchange.com/2.0/posts/"+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 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>.
var
allPagesLoaded = new $.Deferred,
page = 1,
maxPages = null,
reviews = { /* "/q/POST_ID/USER_ID": { } */ },
getNextPagePeriod = 4000,
getNextPageIntervalId = null,
View keybase.md

Keybase proof

I hereby claim:

  • I am jeremybanks on github.
  • I am jeremybanks (https://keybase.io/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:

You can’t perform that action at this time.