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
try { | |
throw 'some error'; | |
await db.destroy(); | |
} catch (error) { | |
// ... | |
} |
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
carteira = 100 | |
custo_da_aposta = 10 | |
valor_do_premio = 50 | |
while carteira >= custo_da_aposta | |
carteira = carteira - custo_da_aposta | |
# 1) Imprimir "Bem-vindo ao jockey, faça sua aposta!" | |
puts "Bem-vindo ao jockey, faça sua aposta!" |
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 calculate(first, second, operator) | |
if operator == "+" | |
result = first + second | |
elsif operator == "-" | |
result = first - second | |
elsif operator == "*" | |
result = first * second | |
elsif operator == "/" | |
result = first / second | |
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
$(document).ready(function() { | |
$("#images").on('click', ".image", function(event) { | |
$(this).toggleClass('img-circle'); | |
}); | |
$("#add").on("click", function geraImagem(event) { | |
event.preventDefault(); | |
var id = Math.floor(Math.random() * 11); | |
var url = "http://lorempixel.com/160/160/city/" + id; |
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 'csv' | |
require_relative '../models/customer' | |
class CustomerRepository | |
def initialize(csv_path) | |
@csv_path = csv_path | |
@customers = [] | |
load_csv if File.exist?(@csv_path) | |
@next_id = @customers.empty? ? 1 : @customers.last.id + 1 | |
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
require_relative "patients_repository" | |
require_relative "rooms_repository" | |
require_relative "room" | |
require 'csv' | |
rooms_repository = RoomsRepository.new("rooms.csv") | |
patient_repository = PatientsRepository.new("patients.csv", rooms_repository) | |
room = Room.new(capacity: 10) | |
rooms_repository.add(room) |
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 'open-uri' | |
require 'nokogiri' | |
def list_gifts(gifts_list) | |
gifts_list.each_with_index do |gift, index| | |
name = gift["name"] | |
bought = gift["bought"] | |
if bought | |
status = "[x]" |
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
class Building | |
attr_reader :address | |
def initialize(rooms, address, width, length) | |
@rooms = rooms | |
@address = address | |
@width = width | |
@length = length | |
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
class Restaurant | |
attr_reader :name | |
attr_accessor :tables | |
def initialize(name, tables, style) | |
@name = name | |
@tables = tables | |
@style = style | |
@clients = [] | |
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
global: | |
| each|... | |
| select|... | |
| | |
| prog.rb: | |
| | pares|nil | |
| | | |
| | |
| select: | |
| | array|[1, 2, 3, 4] |