This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bottles = 99 | |
| until bottles < 0 | |
| if bottles > 2 | |
| puts "#{bottles} bottles of beer on the wall, #{bottles} bottles of beer.\nTake one down, pass it around, #{bottles-1} bottles of beer on the wall." | |
| elsif bottles == 2 | |
| puts "#{bottles} bottles of beer on the wall, #{bottles} bottles of beer.\nTake one down, pass it around, #{bottles-1} bottle of beer on the wall." | |
| elsif bottles == 1 | |
| puts "#{bottles} bottle of beer on the wall, #{bottles} bottle of beer.\nTake one down, pass it around, #{bottles-1} bottles of beer on the wall." | |
| else bottles == 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| card_number = "342801633855673" | |
| credit_card = card_number.chars.map(&:to_i).reverse | |
| double_index = credit_card.select.with_index { |_,i| i.odd? } | |
| products = double_index.map {|num| num * 2 } | |
| doubled_sum = products.map {|digits| digits.to_s.split('')}.map{|pair| pair.reduce(0) {|sum, x| sum + x.to_i}}.reduce(:+) | |
| product_sum = credit_card.select.with_index { |_,i| i.even? }.reduce(:+) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'minitest/autorun' | |
| require 'minitest/pride' | |
| require_relative 'credit_card3' | |
| class CreditCardTest < Minitest::Test | |
| def setup | |
| @card_num = CreditCard.new | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| phrase = "This is my secret message." | |
| alpha_values = | |
| { | |
| "A"=>1, "B"=>2, "C"=>3, "D"=>4, | |
| "E"=>5, "F"=>6, "G"=>7, "H"=>8, | |
| "I"=>9, "J"=>10, "K"=>11, "L"=>12, | |
| "M"=>13, "N"=>14, "O"=>15, "P"=>16, | |
| "Q"=>17, "R"=>18, "S"=>19, "T"=>20, | |
| "U"=>21, "V"=>22, "W"=>23, "X"=>24, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Oven | |
| attr_reader :state | |
| def initialize | |
| @state = InactiveState.new | |
| end | |
| def temp_up | |
| @state = state.temp_up | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "auto_indent": true, | |
| "color_scheme": "Packages/Color Scheme - Default/Cobalt.tmTheme", | |
| "font_size": 10, | |
| "highlight_line": true, | |
| "highlight_modified_tabs": true, | |
| "margin": 2, | |
| "save_on_focus_lost": true, | |
| "smart_indent": true, | |
| "tab_size": 2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def self.create(task) | |
| database.transaction do | |
| database[:tasks].insert("title" => task[:title], "description" => task[:description]) | |
| end | |
| # require 'pry';binding.pry | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The Important Lessons in life | |
| 1. . Biography | |
| a) childhood | |
| b) career - Computer Science professor | |
| c) his impact on computer science education | |
| d) "The Last Lecture" -- his final words to his friends, family and colleagues | |
| 3. Valuable lessons |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The Marshmallow Challenge and Effective Software Design | |
| Review the design challenge experience | |
| The Task - build a structure with specific materials | |
| Teams of 4 | |
| Tallest structure with marshmallow on top | |
| B. The Experience | |
| Quick collaboration | |
| 2.“jocking for power” |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| I. Who we are | |
| A. Used to Success | |
| 1. A students | |
| 2. Little to no criticism in life | |
| 3. Smooth Sailing | |
| B. What happens when we do not meet our goals | |
| 1. Disappointment | |
| 2. Hurt | |
| 3. Low self esteem |
OlderNewer