Skip to content

Instantly share code, notes, and snippets.

@isaacbatst
isaacbatst / destructuring.test.js
Created November 3, 2023 22:13
Tests if uses destructuring
const test = require('node:test')
const assert = require('assert')
// object
// description
// write a function that receives an object, destructure a property "name" and returns it
// destructure({ name: 'Zambs' }) // returns Zambs
// solution
function destructureObj({name}) {
@isaacbatst
isaacbatst / queries-2-3-ch33.sql
Last active October 22, 2023 13:04
Queries executadas na aula BE 2.3 da turma 33 da Trybe
-- Encontre o ator Johnny Cage
SELECT * FROM sakila.actor
WHERE first_name = 'JOHNNY' AND last_name = 'CAGE';
-- Encontre os filmes que podem ser alugados exatamente por 6 dias
SELECT title, rental_duration FROM sakila.film
WHERE rental_duration = 6
-- Encontre os filmes de classificação R que podem ser alugados exatamente por 6 dias
SELECT title, rental_duration, rating from SAKILA.FILM
'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('courses', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
varchar(32) Lorem ipsum dolor sit amet amet.
varchar(64) Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donecie
varchar(128) Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donecie
vestibulum massa. Nullam dignissim elementum molestie. Vehiculas
varchar(256) Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donecie
vestibulum massa. Nullam dignissim elementum molestie. Vehiculas
velit metus, sit amet tristique purus condimentum eleifend. Quis
CREATE DATABASE library;
USE library;
CREATE TABLE categories (
id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100) NOT NULL
);
CREATE TABLE clients (
id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
-- SELECT * FROM sakila.address;
-- Ver os endereços com nomes das cidades
-- SELECT a.address_id, a.address, c.city FROM sakila.address AS a
-- INNER JOIN sakila.city AS c
-- ON a.city_id = c.city_id
-- WHERE a.address_id = 8
-- Ver qual cidade tem mais endereços
-- SELECT COUNT(*), sakila.address.city_id, sakila.city.city FROM sakila.address
-- DB PIXAR
DROP SCHEMA IF EXISTS Pixar;
CREATE SCHEMA Pixar;
USE Pixar;
CREATE TABLE Movies (
id INTEGER auto_increment PRIMARY KEY NOT NULL,
title VARCHAR(30) NOT NULL,
director VARCHAR(30) NULL,
-- Cadastrar uma nova loja
-- Necessário criar um endereço
-- Endereço: Rua dos Alfeneiros, Little Whinging
-- INSERT INTO sakila.address (district, address, city_id, phone, location)
-- VALUES (
-- 'Little Whinging',
-- 'Rua dos Alfeneiros',
-- 26,
-- '12345678901234567890',
-- POINT(-48.9494566, -16.3333469)
-- Encontre o ator Johnny Cage
SELECT * FROM sakila.actor
WHERE first_name = 'JOHNNY' AND last_name = 'CAGE';
-- Encontre os filmes que podem ser alugados exatamente por 6 dias
SELECT * FROM sakila.film WHERE rental_duration = 6
-- Encontre os filmes de classificação R que podem ser alugados exatamente por 6 dias
SELECT * FROM sakila.film WHERE rental_duration = 6 AND rating = 'R'
import {describe, expect, it} from 'vitest';
describe('Character', () => {
it('should have strength, dexterity and intelligence', () => {
const isaac = new Character(5, 6, 7);
expect(isaac.strength).toBe(5);
expect(isaac.dexterity).toBe(6);
expect(isaac.intelligence).toBe(7);
})