This file contains 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 Restaurant | |
attr_reader :name, :city | |
def initialize(name, city) | |
@name, @city = name, city | |
end | |
def welcome | |
return "Welcome to #{@name}" | |
end | |
end |
This file contains 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 Restaurant | |
attr_reader :name, :city | |
def initialize(name, city) | |
@name, @city = name, city | |
end | |
def welcome | |
return "Welcome to #{@name}" | |
end |
This file contains 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 Restaurant | |
attr_reader :name, :city, :chief | |
def initialize(name, city, chief_first_name, chief_last_name, chief_exp) | |
@name, @city = name, city | |
@chief = Chief.new(chief_first_name, chief_last_name, chief_exp, self) | |
end | |
def welcome | |
return "Welcome to #{@name}" | |
end |
This file contains 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 'gosu' | |
require_relative 'player' | |
require_relative 'star' | |
class GameWindow < Gosu::Window | |
def initialize | |
super 640, 480 | |
self.caption = "Gosu Tutorial Game" | |
@background_image = Gosu::Image.new("media/space.png", :tileable => true) | |
@player = Player.new |
This file contains 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 Player | |
attr_reader :score | |
def initialize | |
@image = Gosu::Image.new("media/xwing.png") | |
@x = @y = @vel_x = @vel_y = @angle = 0.0 | |
@score = 0 | |
end | |
def warp(x, y) | |
@x, @y = x, y |
This file contains 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 Star | |
attr_reader :x, :y | |
def initialize(animation) | |
@animation = animation | |
@color = Gosu::Color.new(0xff_000000) | |
@color.red = rand(256 - 40) + 40 | |
@color.green = rand(256 - 40) + 40 | |
@color.blue = rand(256 - 40) + 40 | |
@x = rand * 640 |
This file contains 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
<% flat = data.flats[owner_name] %> | |
<div class="banner" style="background: linear-gradient(-225deg, rgba(0,101,168,0.6) 0%, rgba(0,36,61,0.6) 50%), url(<%= image_path(flat.picture) %>);height:30vh;background-position:center;"> | |
</div> | |
<div id="wrapper-flat"> | |
<div class="container"> | |
<div class="row"> | |
<div class="col-xs-12 col-sm-6 col-sm-offset-1"> | |
<div id="user-profile"> | |
<div id="user-profile-avatar" class="text-center"> | |
<%= image_tag flat.avatar, class: "img-circle" %> |
This file contains 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
#wrapper-flat { | |
padding: 50px 0; | |
} | |
#user-profile { | |
display: flex; | |
align-items: center; | |
margin-top: 50px; | |
} | |
#user-profile-avatar img { | |
width: 100px; |
This file contains 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 "game" | |
class GameController < ApplicationController | |
def game | |
@grid = generate_grid(9) | |
@start_time = Time.now | |
if session[:counter] | |
session[:counter] += 1 | |
else | |
session[:counter] = 1 |
This file contains 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
<h1>Welcome to the longuest word!</h1> | |
<h2><%= @grid.join(" ") %></h2> | |
<form action="score"> | |
<input type="text" name="guess" placeholder="What's your best shot?"> | |
<input type="hidden" value=<%= @grid.join("") %> name="grid"> | |
<input type="hidden" value="<%= @start_time %>" name="start_time"> | |
<input type="submit" value="send"> | |
</form> |