Skip to content

Instantly share code, notes, and snippets.

View ramiresnas's full-sized avatar

Ramires Moreira ramiresnas

View GitHub Profile
func calcularImpostoDeRenda(rendaAnual: Double,
dependentes: Int,
despesasMedicas: Double) -> Double {
var imposto = 0.0
if rendaAnual <= 22847.76 {
imposto = 0
} else if rendaAnual <= 33919.80 {
imposto = (rendaAnual - 22847.76) * 0.075
} else if rendaAnual <= 45012.60 {
imposto = (11072.04 0.075) + ((rendaAnual - 33919.80) 0.15)
@ramiresnas
ramiresnas / .yaml
Last active July 12, 2023 15:45
Swagger example
openapi: 3.0.3
info:
title: Swagger Global Investment BFF - OpenAPI 3.0
description: |-
Descrição
version: 1.0.11
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
servers:
@ramiresnas
ramiresnas / teste.json
Created January 13, 2021 18:39
Meu json
{
"servidor_nome": "ROBERTA GUIMARAES MARTINS",
"servidor_siape": "3014014",
"servidor_cpf": "00959314067",
"servidor_sexo": "F",
"servidor_nome_mae": "ILVA MARIA GUIMARAES MARTINS",
"servidor_data_nascimento": "04/04/1984",
"servidor_pais": {
"data_chegada": "",
"id": "000",
@ramiresnas
ramiresnas / .java
Created May 2, 2019 23:29
SpringBoot Validation
@Entity
public class Customer {
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE)
private @Getter Integer id;
@NotNull
@Size(min=6, max=50)
@Valid
private @Getter String password;
@ramiresnas
ramiresnas / .swift
Created March 28, 2019 14:59
Máquina de estados
import GameplayKit
class JumpState : GKState {
override func isValidNextState(_ stateClass: AnyClass) -> Bool {
let isValid = stateClass is WalkState.Type
if !isValid {
print("você só pode entrar no estado de andar")
}
return isValid
@ramiresnas
ramiresnas / .swift
Created March 28, 2019 12:15
Usando entidades e componentes
mario.component(ofType: WalkComponent.self)?.move(to: .foward, velocity: 45)
mario.component(ofType: JumpComponent.self)?.jump(y: 30)
yoshi.component(ofType: WalkComponent.self)?.move(to: .back, velocity: 70)
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
guard let touch = touches.first else {
return
}
if let view = touch.view as? UIImageView {
selectedView = view
}
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
@ramiresnas
ramiresnas / .swift
Last active March 20, 2019 22:22
SpriteSheet é uma classe que ajuda a trabalhar com sprites sheets de forma simplificada usando Swift.
//
// SpriteSheet.swift
// MyGame
//
// Created by Ramires Moreira on 14/03/19.
// Copyright © 2019 Ramires Moreira. All rights reserved.
//
import SpriteKit
@ramiresnas
ramiresnas / .swift
Created February 26, 2019 13:18
Camera no Sprite kit
class GameScene: SKScene {
// declara um SKCameraNode como propriedade, porque se não ele é desalocado da memória após a instância
private let cameraNode = SKCameraNode()
override func didMove(to view: SKView) {
// associa a camera da cena
camera = cameraNode
}
@ramiresnas
ramiresnas / .swift
Created February 25, 2019 14:01
Comunicação com GameController
override func viewDidLoad() {
super.viewDidLoad()
let center = NotificationCenter.default
let notification: NSNotification.Name = Notification.Name.GCControllerDidConnect
let selector = #selector(didConnection)
center.addObserver(self, selector: selector, name: notification, object: nil)
}
@objc func didConnection(){