Mix.install([
{:mistral, "~> 0.3.0"},
{:anthropix, "~> 0.6"},
{:kino, "~> 0.15.0"},
])
This file contains hidden or 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
def hello(name = "world") | |
"Hello, #{name}!" | |
end |
This file contains hidden or 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
FROM ruby:2.6.5-alpine | |
RUN apk add --update --no-cache bash build-base nodejs sqlite-dev tzdata postgresql-dev yarn | |
RUN gem install bundler:2.1.4 | |
WORKDIR /usr/src/app | |
COPY package.json yarn.lock ./ | |
RUN yarn install --check-files |
This file contains hidden or 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
# Gem/Library to allow Ruby to interact with the DB | |
require 'sqlite3' | |
require 'byebug' | |
require_relative 'doctor' | |
# Create a DB connection | |
DB = SQLite3::Database.new("doctors.db") | |
#[[1, "John Smith", 39, "Anesthesiologist"], [2, "Emma Reale", 31, "Cardiologist"]] |
This file contains hidden or 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
DB = "connection to the DB" | |
def find_tracks_by_genre(genre_name) | |
query = <<SQL | |
SELECT tracks.name, tracks.composer | |
FROM tracks | |
JOIN playlist_tracks ON playlist_tracks.track_id = tracks.id | |
JOIN playlists ON playlist_tracks.playlist_id = playlists.id | |
WHERE playlists.name = '#{genre_name}'; | |
SQL |
This file contains hidden or 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
-- GIVE ALL THE PATIENT NAMES | |
SELECT first_name, last_name FROM patients; | |
-- GIVE ALL THE DOCTOR NAMES | |
SELECT first_name, last_name FROM doctors; | |
-- GIVE ME ALL YOU GOT ON PATIENTS | |
SELECT * FROM patients; | |
-- GIVE ME ALL THE PATIENTS AGED 21 |
This file contains hidden or 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_relative "task" | |
require_relative "task_repository" | |
require_relative "tasks_controller" | |
require_relative "router" | |
require "byebug" | |
# Create an instance of TaskRepository | |
task_repository = TaskRepository.new |
This file contains hidden or 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
# color, brand, speed | |
# Class names are in UpperCamelCase | |
# Open a class statement | |
class Car | |
attr_reader :brand, :license_plate # Creates GETTERS | |
# attr_writer :color # Creates SETTERS | |
attr_accessor :color # Creates GETTERS and SETTERS |
This file contains hidden or 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
# CEO - Chief Executive Officer | |
# ASAP - as soon as possible | |
# DIY - DO IT YOURSELF | |
def acronymize(sentence) | |
# sentence.upcase.split.map(&:chr).join |
This file contains hidden or 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
# Write a game where the player has to guess a | |
# random price between 1 and 100 chosen by the program. | |
# The program should keep asking until the player | |
# guesses the right price. | |
# When the guess is right, the program displays how | |
# many guesses it took the player to win. | |
# generate random price between 1 and 100 | |
# ask the player for a number (between 1 to 100) | |
# store attempt number |
NewerOlder