Skip to content

Instantly share code, notes, and snippets.

View abrad45's full-sized avatar
🤓
Checks over Stripes

Alexander Bradley abrad45

🤓
Checks over Stripes
View GitHub Profile
@abrad45
abrad45 / clutter-disappearifier.user.js
Last active April 19, 2016 03:29
Homestuck Clutter Disappearifier
// ==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
@abrad45
abrad45 / homeunstuck.user.js
Last active April 18, 2016 23:42
Homeunstuck
// ==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
@abrad45
abrad45 / t9.js
Last active March 8, 2019 13:40
T9 Possible Words List via Array.reduce();
// 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
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;
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
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;
### 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:
@abrad45
abrad45 / new_string_functions.js
Created June 25, 2013 01:14
Adds `.toTitleCase()`, `.toAlternatingCase()` and `.toInvertedCase()`
// 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;
}
@abrad45
abrad45 / cookbook.md
Created May 4, 2013 14:32
Full Potion Brewing Manual for http://candies.aniwey.net/

Welcome to the potions brewing manual for beginners!

(second edition)

 __  __  __  __
 )(  )(  )(  )(
(__)(__)(__)(__)
@abrad45
abrad45 / problem1.js
Last active December 16, 2015 20:29
Project Euler Solutions -- http://projecteuler.net/
// 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.
*/