Skip to content

Instantly share code, notes, and snippets.

View MaggieMoss's full-sized avatar

Maggie Moss MaggieMoss

View GitHub Profile
@MaggieMoss
MaggieMoss / html_example.html
Created November 9, 2017 01:39
My html code from today!
<h1> Copy and paste your html code here </h1>
# tonight we went over how to solve fizzbuzz
# see if you can try to improve our solution.
numbers = (1..100) # [1, 2, 3, 4, 5, 6 .. 100]
numbers.each do |number|
if number % 5 == 0 && number % 3 == 0
puts "FizzBuzz"
elsif number % 5 == 0
puts "Buzz"
elsif number % 3 == 0
@MaggieMoss
MaggieMoss / ruby-examples.rb
Created April 8, 2016 00:16
Ruby Example - Part Time
# STRINGS
# # we can use double quotes
puts "This is a string."
# # or we can use single quotes
puts 'This is a string with single quotes.'
# # adding two strings together
puts 'Hello, ' + "Maggie."
#INTEGER
#we can add them
@MaggieMoss
MaggieMoss / tic_tac_toe.rb
Last active August 29, 2015 14:20
A ruby command line version of tic tac toe
class Board
attr_reader :spaces, :name, :board_example, :num_to_words
attr_accessor :view
def initialize
@spaces = {
:one => EMPTY,
:two => EMPTY,
:three => EMPTY,
:four => EMPTY,
@MaggieMoss
MaggieMoss / ceasar_cypher.rb
Created May 10, 2015 19:17
Playing with the basic ceasar cipher
def create_ceasar_cipher(phrase, key)
letters = phrase.scan(/./)
new_phrase = []
letters.each do |letter|
num = letter.ord
num += key
new_letter = num.chr
new_phrase << new_letter
@MaggieMoss
MaggieMoss / pop_bottles.rb
Created May 10, 2015 00:29
Pop Bottle Recycler Solution
puts "How much do you want to spend on pop bottles?"
cost = gets.chomp.to_i
@invest = cost / 2
def bottle_pop(bottles, caps_recycled, empties_recycled, caps, empties)
@bottles = bottles
@caps_recycled_total = caps_recycled
@empties_recycled_total = empties_recycled
@caps = caps
@empties = empties
@MaggieMoss
MaggieMoss / gist:c22c6093de4f0ea86928
Created May 10, 2015 00:28
Answers to common programming problems
problem one
write three functions that compute the sum of the numbers in a given list
using a:
for loop
def sum(num1, num2, num3)
numbers = [num1, num2, num3]
total_sum = 0
for num in numbers
total_sum += num
@MaggieMoss
MaggieMoss / Players_Math_OOP.rb
Created January 12, 2015 02:23
Two Player Math problem solution - using ruby oop
class Players
attr_accessor :lives
attr_reader :player_name
def initialize (player_name)
@player_name = player_name
@lives = 3
end
def print_greeting
@MaggieMoss
MaggieMoss / 0_reuse_code.js
Last active August 29, 2015 14:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console