Skip to content

Instantly share code, notes, and snippets.

View craigmichaelmartin's full-sized avatar

Craig Martin craigmichaelmartin

View GitHub Profile
@craigmichaelmartin
craigmichaelmartin / zombit_infection.py
Created June 29, 2015 00:58
Fun google foobar 2D array question
"""
Zombit infection
================
Dr. Boolean continues to perform diabolical studies on your fellow rabbit kin,
and not all of it is taking place in the lab. Reports say the mad doctor has his
eye on infecting a rabbit in a local village with a virus that transforms
rabbits into zombits (zombie-rabbits)!
Professor Boolean is confident in the virus's ability to spread, and he will
only infect a single rabbit. Unfortunately, you and your fellow resistance
agents have no idea which rabbit will be targeted. You've been asked to predict
@craigmichaelmartin
craigmichaelmartin / vanish_text.js
Created June 27, 2015 18:37
Vanishes the text content of elements with a certain class in some milliseconds.
// Vanishes the text content of elements with a certain class in some milliseconds
var vanishByClassName = (function() {
// Returns a random integer [min, max)
var getRandomInt = function(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
};
// Returns a string with a swapped out character
var replaceStringCharacter = function(string, index, character) {
@craigmichaelmartin
craigmichaelmartin / similiar_n_strings.js
Created June 27, 2015 14:14
Write a javascript function to take in a String, and output "n" similar looking strings.
/*
* Write a javascript function to take in a String,
* and output "n" similar looking strings.
*/
// Returns a number of similiar strings
// A similiar string: respects whitespace, capitalization, and type (number vs alpha)
var similarNStrings = (function() {
// Returns a random integer [min, max)
@craigmichaelmartin
craigmichaelmartin / any_z_integers_add_to_value.js
Created June 27, 2015 03:42
Any z number of integers in an array add to some value.
/*
* In javascript: Write a function that, given an array of integers (x),
* and an integer (y), returns true if any two of the integers in x add up to y.
* (Optional) Now, write a function that, given the above arguments and an
* additional integer (z), returns true if any z of the integers in x add up to y.
*/
/*
* Some notes on my solution:
* This approach is assuming ES6 support for tail recursion.