Skip to content

Instantly share code, notes, and snippets.

@rudda
rudda / diasSemana.kt
Created July 1, 2023 21:50
Dias da Semana - Exemplo Operador OR Kotlin
package operadoresLogicos
/**
* Autor: Ruddá Beltrão
* Youtube: https://www.youtube.com/channel/UCJ2LUhU6lIvIi5xR8ARplcw
* Curso de Kotlin: https://youtu.be/D8g6H4Nx_C0
* Medium: https://ruddabeltrao.medium.com/
* LinkedIn: https://www.linkedin.com/in/ruddabeltrao/
*/
@rudda
rudda / operadores_aritmeticos.kt
Created May 6, 2023 20:44
Kotlin Operadores Aritmeticos
fun main() { // inicio de função
// Int, Double e Float
var a: Float = 2.toFloat()
var b: Float = 3f
var c: Int = 4
var d: Double = 5.toDouble()
var e: Float = 100.3f
var f = 15
var numero_aula: Int = 4 //global
val nome_professor: String = "Rudda"
const val nome_planeta_terra: String = "Terra"
fun main() { // inicio de função
/**
* Crie variaveis para salvar os seguintes dados de uma pessoa:
* 1. nome
* 2. sobrenome
@rudda
rudda / pdf.reader.py
Created February 5, 2023 04:01
Code Template Read PDF File from URL by Python
import requests
import io
from io import BytesIO
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
from pdfminer.pdfpage import PDFPage
def download_pdf(url):
response = requests.get(url)
@rudda
rudda / parser.py
Created November 29, 2022 15:29
python script : Read XML file and convert to JSON format
import xml.etree.ElementTree as ET
root = ET.parse('./values/strings.xml').getroot()
payload = { 'translations': {}}
for type_tag in root.findall('string'):
key = type_tag.get('name')
value = type_tag.text
payload['translations'][key] = str(value).replace("\"", "\\\"")
@rudda
rudda / mod4-execicio.ipynb
Last active April 15, 2021 19:24
mod4-execicio.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rudda
rudda / interface_sample_03.kt
Created December 2, 2020 21:49
Kotlin Interfaces
interface Fly {
val wings : Wings
fun fly() {
println("Im flying")
wings.move()
}
}
class Animal(var name: String): Fly {
override val wings: Wings = Wings(name)
@rudda
rudda / interface_sample_02.kt
Last active December 2, 2020 21:47
Kotlin Interface
interface Fly {
fun fly() {
print("Im flying")
}
}
class Animal: Fly {
fun SayHi() {
print("Hi")
}
@rudda
rudda / interface_sample_01.kt
Created December 2, 2020 21:13
Kotlin - Interfaces
interface Fly {
fun fly()
}
class Animal: Fly {
override
fun fly() {
print("Im flying")
}
}
import unittest
import calculator
class TestCalculator(unittest.TestCase):
#test add method
def test_add_whenAParamIsNotNumber_thenReturnError(self):
a, b= 'A', 2
self.assertRaises(TypeError, calculator.add, a, b)