Attack skill reference
Inventory
0
to not touch, 1
if you don't care about that slot:
Attack skill reference
Inventory
0
to not touch, 1
if you don't care about that slot:
<h1><%= @name_plural %></h1> | |
<%% @<%= @name_plural %>.each do |<%= @name_singular %>| %> | |
<li><a href="/<%= @name_plural %>/<%%= <%= @name_singular %>.id %>"><%%= <%= @name_singular %>.id %></a></li> | |
<ul> | |
<%%= @attributes.each do |attribute| %> | |
<li><%%= attribute %>: <%%= <%= @name_singular %> %>.<%%= attribute %></li> | |
<%% end %> | |
</ul> | |
<%% end %> | |
</ul> |
require 'sinatra' | |
# require and use controllers from within the `./controller` directory | |
controller_paths = Dir["./controllers/*.rb"].each { |file| require_relative file } | |
controllers = controller_paths.map { |controller_path| controller_path[/controllers\/(.*?)_controller/m, 1] } | |
controllers.each { |controller| use Object.const_get("#{controller.capitalize}Controller") } |
With what we did yesterday, we were saving everything in memory, so after the request response happens, everything is gone.
To save data from the user, we have different options. We can save the data just to a file. The problem with this is it bcomes slow, and becomes problmeatic, because, what if lots of users are opening the same file at the same file, and searching through a file can become quite slow.
With databases, you structure your data, you put it in a structured fashion. You can easily store and retrieve your data. There are two main database structures. One is called a relational database, and the other is called NoSQL. We may go over a NoSQL DB like MongoDB on a Saturday or something, but for the most part, we will be focusing on relational databases.
NoSQL databases use key values, documents, different ways to store data. Relational databases use a langauge called SQL, which is a language used to query, fetch, and store data in databases. The one we are going to
#Sinatra
Ruby Gems
There are over 72,000 gems. There's is probably a gem available for whatever it is you want to do. Let's try installing a gem called "snooby". In your terminal, try gem install snooby
.
If you are having difficulty with installing gems, try installing a ruby version management tool, such as RVM
1.) Find a gem that allows you to print something in IRB in color.
gem install colorize
General: | |
0 - Attack | |
1 - Kick | |
2 - Throw | |
3 - Unsummon | |
4 - Left Hand Throw | |
5 - Left Hand Swing | |
Amazon: | |
6 - Magic Arrow |
// 1.) Write a function `cigs()` that takes an argument `perHour`, and | |
// logs "You smoke (however many perHour) cigs per hour." | |
function cigs(perHour) { | |
first = "You smoke "; | |
middle = perHour; | |
last = " cigs per hour."; | |
msg = first + middle + last; | |
console.log(msg); | |
} |
Shippable has a nice blog post on CI/CD pipelines with Amazon EC2 Container Service and Amazon EC2 Container Registry.
Start out with the 'Getting Started' wizard, which told me to do the following:
1.) Retrieve the docker login
command
aws ecr get-login --region us-west-2
2.) Run the returned docker login
command
// log_example.go | |
package main | |
import ( | |
"fmt" | |
mypackage "github.com/ogryzek/log_practice/mypackage" | |
"log" | |
"net/http" | |
"os" | |
) |