Skip to content

Instantly share code, notes, and snippets.

View brittanmcg's full-sized avatar
🙂
We'll get there

Brittan McGinnis brittanmcg

🙂
We'll get there
View GitHub Profile
@brittanmcg
brittanmcg / can't share
Created September 15, 2013 19:10
publickey description
OpenSSH_5.9p1, OpenSSL 0.9.8x 10 May 2012
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to github.com [192.30.252.131] port 22.
debug1: Connection established.
debug1: identity file /Users/brittmcginnis/.ssh/id_rsa type -1
debug1: identity file /Users/brittmcginnis/.ssh/id_rsa-cert type -1
debug1: identity file /Users/brittmcginnis/.ssh/id_dsa type -1
debug1: identity file /Users/brittmcginnis/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1+github5
def grab_ssn(string)
ssn = /\d{3}-\d{2}-\d{4}/.match(string).to_s
if string.include?(ssn)
return ssn
else
return nil
end
end
@brittanmcg
brittanmcg / Die
Created December 6, 2013 03:30
Implement a basic Die class which can be initialized with some number of sides. We can then roll the die, returning a random number. It should work like this: die = Die.new(6) die.sides # returns 6 die.roll # returns a random number between 1 and 6 If we pass Die.new a number less than 1, we should raise an ArgumentError. This is done using the …
class Die
def initialize(sides)
# code goes here
@sides = sides
if sides < 1
raise ArgumentError.new("Please input a number 1 or larger.")
end
end
def sides
@brittanmcg
brittanmcg / gist:7884072
Created December 10, 2013 01:01
The code from my 1.2 pairing with Zohar and Maria.
# Compare Fibonacci!
# At this point you should be good at refactoring your code to make it better,
# but do you feel comfortable determining "good" vs. "bad" code? In this exercise
# you will evaluate four different solutions to the same challenge and evaluate
# their clarity, effectiveness, and overall "good"ness.
# By the end of this challenge, you should be able to:
# 1) Confidently read other people's code and figure out how it works
# 2) Recognize good and not so good practices
# 3) Consider ways to improve solutions
@brittanmcg
brittanmcg / Credit Card class
Created December 13, 2013 02:42
Not quite sure why this will not raise an error when the number passed in is > or < 16.
class CreditCard
def initialize(nums)
@nums = nums
end
def check_card
raise ArgumentError unless @nums.length == 16
s1 = s2 = 0
@nums.to_s.reverse.chars.each_slice(2) do |odd, even|
s1 += odd.to_i
@brittanmcg
brittanmcg / Die class2
Last active December 31, 2015 09:09
This should return any random number or letter passed into the array. It does from what I can tell but it doesn't pass the specs.
class Die
def initialize(labels)
if labels.empty?
raise ArgumentError
end
@labels = labels
end
def sides
@labels.length
@brittanmcg
brittanmcg / 0.2.1-boggle_class_from_methods.rb
Last active January 1, 2016 12:09 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1 boggle class challenge
class BoggleBoard
def initialize
@dice_grid = [["b", "r", "a", "e"],
["i", "o", "d", "t"],
["e", "c", "l", "r"],
["t", "a", "k", "e"]]
end
def words(*coords)
@brittanmcg
brittanmcg / shopping.rb
Last active January 1, 2016 23:19
Shopping list app
class List
def initialize
@items = []
end
def add_item(*var)
var terah = {
name: "Terah",
age: 32,
height: 66,
weight: 130,
hairColor: "brown",
eyeColor: "brown"
}
@brittanmcg
brittanmcg / votes.js
Created February 3, 2014 20:18
This script goes through the votes object and it's nested object and counts the number of times that each candidate is voted for and then tallies them in a separate object. Then we need to somehow return a winner for each category.
/*
In this challenge you will work with the following JavaScript objects.
Do not alter these objects here.
*/
// I need to go through the votes object and look at each string which contains it's own object, then I need to go through
// each nested object and count how many times a canidites name comes up for each category in the votes count object and assign it
// to that object. We need to look at each property inside the nested objects and count how many times that value occurs.