Skip to content

Instantly share code, notes, and snippets.

@jaredstander
jaredstander / md5_phrase_find.rb
Last active June 16, 2016 18:35
This is a thing I am doing to try and solve this backend developer puzzle.
require 'digest'
# To check the hash results of finalist phrases against the valid one.
# Anagram: "poultry outwits ants"
# Principe letters are a,i,l,n,o,p,r,s,t,u,w,y
# Invalid letters are b,c,d,e,f,g,h,j,k,q,v,x,z
# The MD5 hash of the secret phrase is "4624d200580677270a54ccff86b9610e"
def build_word(base_word_arry, available_letters_arry)
if available_letters_arry.include?(base_word_arry[0])
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<style type="text/css">
body{margin:0%;font-family:Sans-Serif;font-size:small;width:auto;}
h1.header{text-align:center;}
p.center{text-align:center;}
div.lrgContainer{border:0;padding:0;width:100%;}
div.lftContainer{border-top:0;border-left:0;border-right:1;border-bottom:0px;border-style:solid;width:30%;float:left;padding:0%;margin-left:20%}
div.rhtContainer{border-top:0;border-left:1;border-right:0;border-bottom:0px;border-style:solid;width:25%;margin-left:50%;padding-left:5%;}
div.header{width:50%;margin-left:25%;}

Capybara

save_and_open_page

Matchers

have_button(locator)
<!doctype html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script src="main.js"></script>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="row">
@jaredstander
jaredstander / index.html
Created July 21, 2013 10:03 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
#################
# Original Code #
#################
# class Car
# @@WHEELS = 4
# def initialize(args)
# @color = args[:color]
# @wheels = @@WHEELS
# end
class Car
@@WHEELS = 4
def initialize(args)
@color = args[:color]
@wheels = @@WHEELS
end
def drive
@status = :driving
end
def brake
def is_fibonacci?(i)
if i.to_s.length <= 10
check_one = Math.sqrt(5 * i**2 + 4)
check_two = Math.sqrt(5 * i**2 - 4)
if check_one == check_one.truncate || check_two == check_two.truncate
return true
else
return false
end
@jaredstander
jaredstander / rpn_finished.rb
Last active December 18, 2015 15:28
This is the finished Class.
# http://en.wikipedia.org/wiki/Reverse_Polish_notation
# calc.evaluate('1 2 +') # => 3
# calc.evaluate('2 5 *') # => 10
# calc.evaluate('50 20 -') # => 30
# The general rule is that 'A B op' is the same as 'A op B'
# i.e., 5 4 - is 5 - 4.
# I WILL USE THIS AS MY SAMPLE calc.evaluate('70 10 4 + 5 * -') # => 0
def mode(array)
# Another doosey. I swear these math-related functions are going to kill me.
# My kingdom for a variable.
# Here, let's set up a variable to keep track of the most frequently occurring values.
# And in addition, we'll create an empty array we can store our answer in later.
highest_count = 1
count_array = []
# All this loop right here does is see what the highest occurrence of any value in the array is.