mirror of https://github.com/E-Almqvist/hsf
parent
e0c282726e
commit
83611981ca
@ -1 +1,31 @@ |
|||||||
#!/usr/bin/ruby -w |
#!/usr/bin/ruby -w |
||||||
|
|
||||||
|
DATA_FILE_PATH = "data/evil_data.csv" |
||||||
|
|
||||||
|
def get_db |
||||||
|
person_register = [] |
||||||
|
|
||||||
|
person_strings = File.readlines(DATA_FILE_PATH).map do |str| |
||||||
|
str.chomp.split(",")[1..-1] |
||||||
|
end |
||||||
|
# [1..-1] because first element is the index which I can get from the .each method (it |
||||||
|
# is not needed, therefore I remove it) |
||||||
|
|
||||||
|
person_strings.each do |person| |
||||||
|
person_register << { |
||||||
|
fname: person[0], # First name |
||||||
|
lname: person[1], # Last name |
||||||
|
email: person[2], # Email address |
||||||
|
age: person[3], # Age (0-100) |
||||||
|
ipv4: person[4], # IPv4 Address |
||||||
|
movie_title: person[5], # Movie title |
||||||
|
avatar_url: person[6], # Avatar image URL |
||||||
|
freq: person[7], # Frequency (visiting) |
||||||
|
role: person[8], # Role (job title/academic) |
||||||
|
gender: person[9] # Gender |
||||||
|
|
||||||
|
} |
||||||
|
end |
||||||
|
|
||||||
|
return person_register |
||||||
|
end |
||||||
|
@ -0,0 +1,16 @@ |
|||||||
|
doctype html |
||||||
|
html |
||||||
|
head |
||||||
|
title Evil Info Site |
||||||
|
meta charset="UTF-8" |
||||||
|
meta name="viewport" content="width=device-width, initial-scale=1.0" |
||||||
|
// meta name="keywords" content="template language" |
||||||
|
// meta name="author" content="author" |
||||||
|
link rel="icon" type="image/png" href="favicon.png" |
||||||
|
link rel="stylesheet" type="text/css" href="css/style.css" |
||||||
|
|
||||||
|
body |
||||||
|
h1 Evil Info Site |
||||||
|
h2 A person registry. No we don't care about GDPR. |
||||||
|
== yield |
||||||
|
|
@ -0,0 +1,7 @@ |
|||||||
|
- persondata.each do |data| |
||||||
|
article.person |
||||||
|
img.avatar src="#{data[:avatar_url]}" |
||||||
|
|
||||||
|
.info |
||||||
|
h1 #{data[:fname]} #{data[:lname]} |
||||||
|
label IPv4 Address: #{data[:ipv4]} |
Loading…
Reference in new issue