Skip to content

Instantly share code, notes, and snippets.

View pshushereba's full-sized avatar

Patrick Shushereba pshushereba

  • Launch by NTT Data
  • Redlands, California
  • 11:56 (UTC -07:00)
  • X @cpppatrick
View GitHub Profile
@pshushereba
pshushereba / deck.rb
Created January 15, 2016 05:39
Attempt to solve the card deck problem
class Card
attr_accessor :rank, :suit
def initialize(rank, suit)
@rank = rank
@suit = suit
end
def output_card
puts "#{self.rank} of #{self.suit}"
@pshushereba
pshushereba / deck_final.rb
Created January 22, 2016 02:48
Completed deck.rb program for the Firehose Project
class Card
attr_accessor :rank, :suit
def initialize(rank, suit)
@rank = rank
@suit = suit
end
def output_card
puts "#{self.rank} of #{self.suit}"
class Image
def initialize(image)
@image = image
end
def output_image
@image.each { |row| puts row.join }
#puts blur(row_index, col_index)
#transform.each { |row_index, col_index| blur(row_index, col_index) }
class Image
def initialize(image)
@image = image
end
def output_image
@image.each { |row| puts row.join }
end
class Image
def initialize(image)
@image = image
end
#Iterate through @image input and identify which indices have a "1".
def identify
one_index = []
@pshushereba
pshushereba / linkedlist1
Created March 2, 2016 22:59
Setup for Linked List #1
class LinkedListNode
attr_accessor :value, :next_node
def initialize(value, next_node=nil)
@value = value
@next_node = next_node
end
def print_values(list_node)
if list_node
class LinkedListNode
attr_accessor :value, :next_node
def initialize(value, next_node=nil)
@value = value
@next_node = next_node
end
end
@pshushereba
pshushereba / distance.rb
Created March 30, 2016 21:54
Distance method for Chess Application
def distance(destination_row, destination_col)
if self.vertical?(destination_row, destination_col)
return (destination_row - current_row_index).abs
elsif self.horizontal?(destination_row, destination_col)
return (destination_col - current_column_index).abs
elsif self.diagonal?(destination_row, destination_col)
return (destination_col - current_column_index).abs
# destination_col - current_row_index
else
puts "Invalid Input"
require 'rails_helper'
RSpec.describe King, type: :model do
describe 'valid_move?' do
it 'should allow a vertical-up move' do
game = FactoryGirl.create(:game)
king = King.new(game: game, current_row_index: 5, current_column_index: 5)
expect(king.valid_move?(6,5)).to eq true
end
it 'should allow a vertical-down move' do
@pshushereba
pshushereba / gist:c4cb99654909710a7977f11288060c3c
Created April 26, 2019 16:11
4/25/19 - Box Model Lecture Notes
/* The Box Model */
.box {
background-color: aqua;
width: 400px;
/* TRBL */
padding: 75px;
/* padding-top: 10px;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 10px; */