__ __ __ __
)( )( )( )(
(__)(__)(__)(__)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Clutter Disappearifier | |
// @namespace abrad45 | |
// @description removes ads and navigation from around the comics | |
// @include http://www.mspaintadventures.com/* | |
// @include http://mspaintadventures.com/* | |
// @require https://code.jquery.com/jquery-2.2.3.min.js | |
// @require https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.1.1/js.cookie.js | |
// @version 2.1 | |
// @grant none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Homeunstuck | |
// @namespace abrad45 | |
// @description adds homestuck navigation and pages remaining | |
// @include http://www.mspaintadventures.com/* | |
// @include http://mspaintadventures.com/* | |
// @require https://code.jquery.com/jquery-2.2.3.min.js | |
// @require https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.1.1/js.cookie.js | |
// @version 2.0 | |
// @grant none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Inspired by a recent interview question I received and this lovely article: | |
// https://medium.com/humans-create-software/a-dirt-simple-introduction-to-higher-order-functions-in-javascript-b33bf9e19056 | |
// The question was, assume there's a function `isDictionaryWord()` which | |
// returns true or false if a string is a word in a given language, convert | |
// a string of digits into an array, where each item in the array is a possible | |
// word that could have been typed using that string of digits as input. | |
var letters = [ | |
[], // 0 and 1 have no associated letters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fibonacci(num) { | |
var fib = []; | |
fib[0] = 0; | |
fib[1] = 1; | |
for (var i = 2; i < num; i++) { | |
fib.push(fib[i-2] + fib[i-1]); | |
} | |
return fib; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arr_a = ['a', 'b', 'c', 'd']; //=> get it? arr_a? array? | |
arr_b = [1, 2, 3]; | |
function combine_arrays(a, b) { | |
var a_len = a.length; | |
var b_len = b.length; | |
var ret = []; | |
for (var i = 0; i < Math.min(a_len, b_len); i++) { | |
// Push returns the new length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; | |
function sum_for(arr) { | |
var ret = 0; | |
for (var i in arr) { | |
ret += arr[i]; | |
} | |
return ret; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am abrad45 on github. | |
* I am alexbradley (https://keybase.io/alexbradley) on keybase. | |
* I have a public key whose fingerprint is RETU RN T HIS. PGP. GET_ FING ERPR INT( ); | |
} | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Every Word Will Be Capitalized | |
String.prototype.toTitleCase = function () { | |
return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); | |
} | |
// LoOkS ReAlLy aNnOyInG | |
String.prototype.toAlternatingCase = function () { | |
tmp = this.toLowerCase(); (this[0] == this[0].toLowerCase() ? i = 1 : i = 0); for(i; i < tmp.length; i = i+2) { tmp = tmp.substr(0,i) + tmp[i].toUpperCase() + tmp.substr(i+1); } return tmp; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Multiples of 3 and 5 | |
// http://projecteuler.net/problem=1 | |
/* | |
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. | |
Find the sum of all the multiples of 3 or 5 below 1000. | |
*/ | |
NewerOlder