Skip to content

Instantly share code, notes, and snippets.

View JoseSanchezMirandaRos's full-sized avatar

Jose Sanchez-Miranda Ros JoseSanchezMirandaRos

  • Paramount+
  • Burbank, CA
View GitHub Profile
@JoseSanchezMirandaRos
JoseSanchezMirandaRos / game.rb
Created February 2, 2016 03:15
Rock, Paper Scissors Game in Ruby
loop do #game loops to keep playing
options = ["rock", "paper", "scissors"]
computer_choice = options[rand(options.length)]
#puts "computer choice is: " + computer_choice
puts "What's your choice?"
user_input = gets.chomp.downcase
while !(user_input == "rock" || user_input == "paper" || user_input == "scissors")
puts "Invalid choice, enter Rock, Paper, or Scissors"
@JoseSanchezMirandaRos
JoseSanchezMirandaRos / pets.rb
Created January 26, 2016 18:22
Basic Rails Web App 3.5: Object-Oriented Programming II
class Pet
attr_reader :color, :breed, :age #To read these properties outside the class.
attr_accessor :name #to read and modify the name outside the class
def initialize (color, breed, age) #to create a new object instance.
@color = color
@breed = breed
@hungry = true
@age = age
end
@JoseSanchezMirandaRos
JoseSanchezMirandaRos / cat.rb
Created January 22, 2016 02:41
Submission for 3.4: Object-Oriented Programming I REVISION
class Cat
attr_reader :color, :breed
attr_accessor :name
def initialize (color, breed)
@color = color
@breed = breed
@hungry = true
end
@JoseSanchezMirandaRos
JoseSanchezMirandaRos / cat.rb
Created January 22, 2016 01:52
Basic Rails Web App 3.4: Object-Oriented Programming I
class Cat
attr_reader :color, :breed
attr_accessor :name
def initialize (color, breed)
@color = color
@breed = breed
@hungry = true
end
@JoseSanchezMirandaRos
JoseSanchezMirandaRos / fav_food.rb
Created January 21, 2016 17:39
Basic Rails Web App 3.3: Data structures
def fav_foods
food_array = []
3.times do
puts "Name a favorite food:"
food_array << gets.chomp
end
puts "Your favorite foods are #{food_array.join(", ")}"
food_array.each do |i|
puts "Ilike #{i} too!"
end
@JoseSanchezMirandaRos
JoseSanchezMirandaRos / program2.rb
Created January 21, 2016 00:52
Basic Rails Web App 3.2: Control flow in Ruby
def programming
puts "Do you like programming?"
answer = gets.chomp
if (answer.downcase == "yes")
puts "That's great!"
elsif (answer.downcase== "no")
puts "That's to bad"
else
puts "That's not a valid answer"
end
var current_number = "";
var first_number = "";
var second_number = "";
var result = "";
var operation;
$(".btn").on("click", function() {
var number_pressed = $(this).attr("data-key");
current_number += number_pressed;
@JoseSanchezMirandaRos
JoseSanchezMirandaRos / index.html
Created December 15, 2015 11:06
2.10: JavaScript & APIs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Main | Jose</title>
@JoseSanchezMirandaRos
JoseSanchezMirandaRos / index.html
Created December 15, 2015 09:51
ReSubmission for 2.7: Conditional statements
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Main | Jose</title>
@JoseSanchezMirandaRos
JoseSanchezMirandaRos / index.html
Created December 13, 2015 00:55
Revision form animation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Main | Jose</title>