Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Hi! We cleaned up your code for you! #26

Closed
wants to merge 1 commit into from

1 participant

@GunioRobot

Hi there!

This is WhitespaceBot from Gun.io. I'm an open-source robot that removes trailing white space in your code, and gives you a gitignore file if you didn't have one! I've only cleaned your most popular project, and I've added you to a list of users not to contact again, so you won't get any more pull requests from me unless you ask. If I'm misbehaving, please email my owner and tell him to turn me off!

== About Gun.io ==
Gun.io is a place for hackers to hire each other for small tasks. We offer no-hassle, winner-take-all freelance gigs, by hackers, for hackers. Got a bug you can't fix or a feature you want for your project? Post a gig and have somebody else sort it out for you. Oh, and it's free for open source! Sign up and get notified about new gigs you can work on!

== About WhitespaceBot==
WhitespaceBot is a simple open source robot which uses GitHub's API as a way of cleaning up open source projects! We've put up a paid bounty for whoever can add security fixing features to it.

@chromakode chromakode closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 21, 2011
  1. Remove whitespace [Gun.io WhitespaceBot]

    Gun.io Whitespace Robot authored
This page is out of date. Refresh to see the latest.
View
2  README.md
@@ -14,7 +14,7 @@ Credits
* Many thanks to [Rod McFarland](http://thrind.xamai.ca/) for his original [CLI2](http://code.google.com/p/wordpress-cli/). The JavaScript CLI implementation in cli.js is a heavily modified version of the CLI2 client-side logic. CLI2 is Copyright © [Rod McFarland](http://thrind.xamai.ca/), 2006, 2007, 2008.
-* The bundled version of [YUI Compressor](http://developer.yahoo.com/yui/compressor/) is Copyright © 2007-2009, [Yahoo! Inc](http://yahoo.com).
+* The bundled version of [YUI Compressor](http://developer.yahoo.com/yui/compressor/) is Copyright © 2007-2009, [Yahoo! Inc](http://yahoo.com).
License
View
16 build.py
@@ -9,7 +9,7 @@
import re
from itertools import chain
-"""Minifies JS and copies files to build/ directory"""
+"""Minifies JS and copies files to build/ directory"""
YUI = "tools/yuicompressor-2.4.2.jar"
MINIFY_RE = re.compile(r'<!--\s*MINIFY:\s*-->((?:<script.+</script>|\s)+)<!--\s*TO:\s*(.+)-->')
@@ -19,7 +19,7 @@ def touch_dir(path):
if not isdir(path):
print "Creating directory (%s)..." % path
mkdir(path)
-
+
def clean(build_dir):
if isdir(build_dir):
print "Removing existing directory (%s)." % build_dir
@@ -27,9 +27,9 @@ def clean(build_dir):
def build(src_dir, build_dir):
to_minify = {}
-
+
touch_dir(build_dir)
-
+
print "Writing index.html..."
index_data = open(join(src_dir, "index.html")).read()
def sub_minify(match):
@@ -42,7 +42,7 @@ def sub_minify(match):
return to_script
with open(join(build_dir, "index.html"), "w") as f:
f.write(MINIFY_RE.sub(sub_minify, index_data))
-
+
print "Minifying..."
for mini_name, mini_scripts in to_minify.iteritems():
mini_path = join(build_dir, mini_name)
@@ -55,7 +55,7 @@ def sub_minify(match):
subprocess.call(["java", "-jar", YUI, mini_script],
stdout=mini_file)
print "--> %s" % mini_path
-
+
print "Copying data files..."
minified_paths = set(chain(*to_minify.values()))
for filename in listdir(src_dir):
@@ -63,9 +63,9 @@ def sub_minify(match):
if not filepath == "src/index.html" and not filepath in minified_paths:
print " + %s" % filepath
copy(filepath, build_dir)
-
+
print "Build complete."
-
+
if __name__=="__main__":
if len(sys.argv) == 2 and sys.argv[1] == "clean":
clean("build")
View
72 src/cli.js
@@ -1,8 +1,8 @@
-/*
+/*
Client-side logic for Wordpress CLI theme
R. McFarland, 2006, 2007, 2008
http://thrind.xamai.ca/
-
+
jQuery rewrite and overhaul
Chromakode, 2010
http://www.chromakode.com/
@@ -57,14 +57,14 @@ var TerminalShell = {
cmd_list.append($('<li>').text(name));
});
terminal.print(cmd_list);
- },
+ },
clear: function(terminal) {
terminal.clear();
}
},
filters: [],
fallback: null,
-
+
lastCommand: null,
process: function(terminal, cmd) {
try {
@@ -99,9 +99,9 @@ var Terminal = {
_cursorBlinkTimeout: null,
spinnerIndex: 0,
_spinnerTimeout: null,
-
+
output: TerminalShell,
-
+
config: {
scrollStep: 20,
scrollSpeed: 100,
@@ -114,34 +114,34 @@ var Terminal = {
spinnerSpeed: 250,
typingSpeed: 50
},
-
+
sticky: {
keys: {
ctrl: false,
alt: false,
scroll: false
},
-
+
set: function(key, state) {
this.keys[key] = state;
$('#'+key+'-indicator').toggle(this.keys[key]);
},
-
+
toggle: function(key) {
this.set(key, !this.keys[key]);
},
-
+
reset: function(key) {
this.set(key, false);
},
-
+
resetAll: function(key) {
$.each(this.keys, $.proxy(function(name, value) {
this.reset(name);
}, this));
}
},
-
+
init: function() {
function ifActive(func) {
return function() {
@@ -150,20 +150,20 @@ var Terminal = {
}
};
}
-
+
$(document)
- .keypress($.proxy(ifActive(function(e) {
- if (e.which >= 32 && e.which <= 126) {
+ .keypress($.proxy(ifActive(function(e) {
+ if (e.which >= 32 && e.which <= 126) {
var character = String.fromCharCode(e.which);
var letter = character.toLowerCase();
} else {
return;
}
-
+
if ($.browser.opera && !(/[\w\s]/.test(character))) {
return; // sigh.
}
-
+
if (this.sticky.keys.ctrl) {
if (letter == 'w') {
this.deleteWord();
@@ -239,7 +239,7 @@ var Terminal = {
Terminal.sticky.resetAll();
}
});
-
+
$(window).resize(function(e) { $('#screen').scrollTop($('#screen').attr('scrollHeight')); });
this.setCursorState(true);
@@ -249,7 +249,7 @@ var Terminal = {
$('#screen').triggerHandler('cli-load');
});
},
-
+
setCursorState: function(state, fromTimeout) {
this.cursorBlinkState = state;
if (this.config.cursor_style == 'block') {
@@ -265,7 +265,7 @@ var Terminal = {
$('#cursor').css('textDecoration', 'none');
}
}
-
+
// (Re)schedule next blink.
if (!fromTimeout && this._cursorBlinkTimeout) {
window.clearTimeout(this._cursorBlinkTimeout);
@@ -275,7 +275,7 @@ var Terminal = {
this.setCursorState(!this.cursorBlinkState, true);
},this), this.config.cursor_blink_time);
},
-
+
updateInputDisplay: function() {
var left = '', underCursor = ' ', right = '';
@@ -304,17 +304,17 @@ var Terminal = {
$('#prompt').text(this.config.prompt);
return;
},
-
+
clearInputBuffer: function() {
this.buffer = '';
this.pos = 0;
this.updateInputDisplay();
},
-
+
clear: function() {
$('#display').html('');
},
-
+
addCharacter: function(character) {
var left = this.buffer.substr(0, this.pos);
var right = this.buffer.substr(this.pos, this.buffer.length - this.pos);
@@ -323,7 +323,7 @@ var Terminal = {
this.updateInputDisplay();
this.setCursorState(true);
},
-
+
deleteCharacter: function(forward) {
var offset = forward ? 1 : 0;
if (this.pos >= (1 - offset)) {
@@ -335,7 +335,7 @@ var Terminal = {
}
this.setCursorState(true);
},
-
+
deleteWord: function() {
if (this.pos > 0) {
var ncp = this.pos;
@@ -350,11 +350,11 @@ var Terminal = {
}
this.setCursorState(true);
},
-
+
moveCursor: function(val) {
this.setPos(this.pos + val);
},
-
+
setPos: function(pos) {
if ((pos >= 0) && (pos <= this.buffer.length)) {
this.pos = pos;
@@ -362,7 +362,7 @@ var Terminal = {
}
this.setCursorState(true);
},
-
+
moveHistory: function(val) {
var newpos = this.historyPos + val;
if ((newpos >= 0) && (newpos <= this.history.length)) {
@@ -378,7 +378,7 @@ var Terminal = {
}
this.setCursorState(true);
},
-
+
addHistory: function(cmd) {
this.historyPos = this.history.push(cmd);
},
@@ -390,7 +390,7 @@ var Terminal = {
jumpToTop: function() {
$('#screen').animate({scrollTop: 0}, this.config.scrollSpeed, 'linear');
},
-
+
scrollPage: function(num) {
$('#screen').animate({scrollTop: $('#screen').scrollTop() + num * ($('#screen').height() * .75)}, this.config.scrollSpeed, 'linear');
},
@@ -410,7 +410,7 @@ var Terminal = {
}
this.jumpToBottom();
},
-
+
processInputBuffer: function(cmd) {
this.print($('<p>').addClass('command').text(this.config.prompt + this.buffer));
var cmd = trim(this.buffer);
@@ -425,12 +425,12 @@ var Terminal = {
return false;
}
},
-
+
setPromptActive: function(active) {
this.promptActive = active;
$('#inputline').toggle(this.promptActive);
},
-
+
setWorking: function(working) {
if (working && !this._spinnerTimeout) {
$('#display .command:last-child').add('#bottomline').first().append($('#spinner'));
@@ -451,11 +451,11 @@ var Terminal = {
$('#screen').triggerHandler('cli-ready');
}
},
-
+
runCommand: function(text) {
var index = 0;
var mine = false;
-
+
this.promptActive = false;
var interval = window.setInterval($.proxy(function typeCharacter() {
if (index < text.length) {
View
22 src/jquery.hotkeys-0.7.9.js
@@ -11,23 +11,23 @@
*/
(function(jQuery){
-
+
jQuery.hotkeys = {
version: "0.8",
specialKeys: {
8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home",
- 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del",
+ 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del",
96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7",
- 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/",
- 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8",
+ 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/",
+ 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8",
120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta"
},
-
+
shiftNums: {
- "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&",
- "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<",
+ "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&",
+ "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<",
".": ">", "/": "?", "\\": "|"
}
};
@@ -37,17 +37,17 @@
if ( typeof handleObj.data !== "string" ) {
return;
}
-
+
var origHandler = handleObj.handler,
keys = handleObj.data.toLowerCase().split(" ");
-
+
handleObj.handler = function( event ) {
// Don't fire in text-accepting inputs that we didn't directly bind to
if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) ||
event.target.type === "text") ) {
return;
}
-
+
// Keypress represents characters, not special keys
var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ],
character = String.fromCharCode( event.which ).toLowerCase(),
@@ -61,7 +61,7 @@
if ( event.ctrlKey && special !== "ctrl" ) {
modif += "ctrl+";
}
-
+
// TODO: Need to make sure this works consistently across platforms
if ( event.metaKey && !event.ctrlKey && special !== "meta" ) {
modif += "meta+";
View
6 src/jquery.konami.js
@@ -16,19 +16,19 @@
});
return this;
};
-
+
$.fn.konami.params = {
'code' : [38, 38, 40, 40, 37, 39, 37, 39, 66, 65],
'step' : 0
};
-
+
$.fn.konami.checkCode = function( event, params, tgt ) {
if(event.keyCode == params.code[params.step]) {
params.step++;
} else {
params.step = 0;
}
-
+
if(params.step == params.code.length) {
tgt.trigger('konami');
params.step = 0;
View
42 src/xkcd_cli.js
@@ -19,7 +19,7 @@ var xkcd = {
last: null,
cache: {},
base: 'http://dynamic.xkcd.com/api-0/jsonp/comic/',
-
+
get: function(num, success, error) {
if (num == null) {
path = '';
@@ -29,7 +29,7 @@ var xkcd = {
error(false);
return false;
}
-
+
if (num in this.cache) {
this.last = this.cache[num];
success(this.cache[num]);
@@ -51,12 +51,12 @@ var xkcdDisplay = TerminalShell.commands['display'] = function(terminal, path) {
terminal.print($('<p>').addClass('error').text('display: unable to open image "'+path+'": No such file or directory.'));
terminal.setWorking(false);
}
-
+
if (path) {
path = String(path);
num = Number(path.match(/^\d+/));
filename = pathFilename(path);
-
+
if (num > xkcd.latest.num) {
terminal.print("Time travel mode not enabled.");
return;
@@ -64,7 +64,7 @@ var xkcdDisplay = TerminalShell.commands['display'] = function(terminal, path) {
} else {
num = xkcd.last.num;
}
-
+
terminal.setWorking(true);
xkcd.get(num, function(data) {
if (!filename || (filename == pathFilename(data.img))) {
@@ -73,13 +73,13 @@ var xkcdDisplay = TerminalShell.commands['display'] = function(terminal, path) {
.load(function() {
terminal.print($('<h3>').text(data.num+": "+data.title));
$(this).fadeIn();
-
+
var comic = $(this);
if (data.link) {
comic = $('<a>').attr('href', data.link).append($(this));
}
terminal.print(comic);
-
+
terminal.setWorking(false);
})
.attr({src:data.img, alt:data.title, title:data.alt})
@@ -163,7 +163,7 @@ TerminalShell.commands['shutdown'] = TerminalShell.commands['poweroff'] = functi
};
TerminalShell.commands['logout'] =
-TerminalShell.commands['exit'] =
+TerminalShell.commands['exit'] =
TerminalShell.commands['quit'] = function(terminal) {
terminal.print('Bye.');
$('#prompt, #cursor').hide();
@@ -294,7 +294,7 @@ TerminalShell.commands['rm'] = function(terminal, flags, path) {
TerminalShell.commands['cheat'] = function(terminal) {
terminal.print($('<a>').text('*** FREE SHIPPING ENABLED ***').attr('href', 'http://store.xkcd.com/'));
-};
+};
TerminalShell.commands['reddit'] = function(terminal, num) {
num = Number(num);
@@ -370,7 +370,7 @@ TerminalShell.commands['apt-get'] = function(terminal, subcmd) {
terminal.print(' /------\\/ ');
terminal.print(' / | || ');
terminal.print('* /\\---/\\ ');
- terminal.print(' ~~ ~~ ');
+ terminal.print(' ~~ ~~ ');
terminal.print('...."Have you mooed today?"...');
} else if (!subcmd) {
terminal.print('This APT has Super Cow Powers.');
@@ -436,12 +436,12 @@ Adventure = {
11:{description:'Bed. This is where you sleep.', exits:{north:10}},
666:{description:'You\'re dead!'}
},
-
+
status: {
alive: true,
lamp: false
},
-
+
goTo: function(terminal, id) {
Adventure.location = Adventure.rooms[id];
Adventure.look(terminal);
@@ -453,10 +453,10 @@ Adventure = {
Adventure.location = Adventure.rooms[0];
TerminalShell.commands['look'] = Adventure.look = function(terminal) {
- terminal.print(Adventure.location.description);
+ terminal.print(Adventure.location.description);
if (Adventure.location.exits) {
terminal.print();
-
+
var possibleDirections = [];
$.each(Adventure.location.exits, function(name, id) {
possibleDirections.push(name);
@@ -508,7 +508,7 @@ TerminalShell.commands['sleep'] = function(terminal, duration) {
// No peeking!
TerminalShell.commands['help'] = TerminalShell.commands['halp'] = function(terminal) {
terminal.print('That would be cheating!');
-};
+};
TerminalShell.fallback = function(terminal, cmd) {
oneliners = {
@@ -546,7 +546,7 @@ TerminalShell.fallback = function(terminal, cmd) {
};
oneliners['emacs'] = 'You should really use vim.';
oneliners['vi'] = oneliners['vim'] = 'You should really use emacs.';
-
+
cmd = cmd.toLowerCase();
if (!oneLiner(terminal, cmd, oneliners)) {
if (cmd == "asl" || cmd == "a/s/l") {
@@ -603,15 +603,15 @@ $(document).ready(function() {
}
}, noData);
});
-
+
$(document).konami(function(){
function shake(elems) {
elems.css('position', 'relative');
return window.setInterval(function() {
elems.css({top:getRandomInt(-3, 3), left:getRandomInt(-3, 3)});
- }, 100);
+ }, 100);
}
-
+
if (konamiCount == 0) {
$('#screen').css('text-transform', 'uppercase');
} else if (konamiCount == 1) {
@@ -623,14 +623,14 @@ $(document).ready(function() {
} else if (konamiCount == 4) {
$('#screen').css('background', 'url(/unixkcd/over9000.png) center no-repeat');
}
-
+
$('<div>')
.height('100%').width('100%')
.css({background:'white', position:'absolute', top:0, left:0})
.appendTo($('body'))
.show()
.fadeOut(1000);
-
+
if (Terminal.buffer.substring(Terminal.buffer.length-2) == 'ba') {
Terminal.buffer = Terminal.buffer.substring(0, Terminal.buffer.length-2);
Terminal.updateInputDisplay();
Something went wrong with that request. Please try again.