Skip to content

Instantly share code, notes, and snippets.

View GeoffCrittenden's full-sized avatar

Geoff Crittenden GeoffCrittenden

View GitHub Profile
{
"basics": {
"name": "Geoff Crittenden",
"label": "Software Engineer",
"image": "",
"email": "geoffcritt@gmail.com",
"phone": "(312) 485-6300",
"url": "https://geoffcrittenden.com",
"summary": "Experienced Lead Software Engineer, Decorated Combat Aviator, & Proven Leader",
"location": {
# inspired by Matt Parker's Frog Problem video
# https://www.youtube.com/watch?v=ZLTyX4zL2Fc
module Froggie
class << self
def calculate_average_jumps(n_frogs = 10_000, n_spots = 10)
total_jumps = 0.0
n_frogs.times { total_jumps += Frog.new(n_spots).jump! }
total_jumps / n_frogs
end
@GeoffCrittenden
GeoffCrittenden / dinosaur_names.rb
Last active September 14, 2019 14:24
Fake dinosaur names
# gem install faker
# more on faker: https://github.com/stympy/faker
require 'faker'
def fake_word
Faker::Lorem.word.capitalize
end
def dinosaur_suffix
%w[saurus opteryx ceratops mimus iraptor opod odon yonyx].sample
@GeoffCrittenden
GeoffCrittenden / PE_1.rb
Created March 26, 2014 19:45
Project Euler - Problem #1 Solution
sum = (1..999).select { |x| x % 3 == 0 || x % 5 == 0 }.inject(:+)
@GeoffCrittenden
GeoffCrittenden / index.html
Created October 2, 2013 22:43 — 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>
@GeoffCrittenden
GeoffCrittenden / zoo.js
Last active December 24, 2015 04:28 — forked from dbc-challenges/zoo.js
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
function Animal() {
this.name = "Kangaroo";
};
Animal.prototype.identify = function() {
return "I am a Human with 2 legs.";
@GeoffCrittenden
GeoffCrittenden / form-validator.js
Created September 27, 2013 14:04 — forked from ksolo/form-validator.js
Form Validation
// shorthand for $(document).ready();
$(function(){
//Your code...
var regexEmail = /.+@.+\..{2,}/
var regexPassLength = /.{8,}/
var regexPassCap = /[A-Z]+/
var regexPassNum = /\d+/
$('form').on('submit', function(e) {
e.preventDefault();
var email = regexEmail.exec(this[0].value);
@GeoffCrittenden
GeoffCrittenden / index.html
Last active December 24, 2015 00:10 — 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>
@GeoffCrittenden
GeoffCrittenden / Ruby_Warrior_Level_7.rb
Created July 31, 2013 22:54
Level 7 of Ruby Warrior (https://www.bloc.io/ruby-warrior#/warriors/26290/levels/7). This one was pretty straightforward to figure out.
class Player
def initialize
@health = 20
@wall = 0
end
def play_turn(warrior)
if warrior.feel.wall? then warrior.pivot!
else
@GeoffCrittenden
GeoffCrittenden / Ruby_Warrior_Level_6.rb
Last active December 20, 2015 11:39
I'm running through Ruby Warrior, and I'm at Level 6 (https://www.bloc.io/ruby-warrior/#/warriors/26290/levels/6). I've completed the level, but I need to clean up the code. I'm not sure exactly what the problem is. This code doesn't stop and rest in one spot until health == 20. It keeps walking around while resting. The code 'as is' is successf…
class Player
def initialize
@health = 20
@wall = 0
end
def play_turn(warrior)
if @health >= warrior.health
if warrior.feel.enemy? then warrior.attack!