Skip to content

Instantly share code, notes, and snippets.

View Codelaby's full-sized avatar

Codelaby Codelaby

View GitHub Profile
@Codelaby
Codelaby / ApiService.kt
Created April 26, 2023 14:08
Sample Retrofit Flow
interface APIService {
@GET
@Headers("Content-Type: application/xml")
suspend fun getGPXData(@Url url: String): Response<String>
}
@Codelaby
Codelaby / papper_scissors_spock.swift
Created May 2, 2023 15:41
Juego de papel tijeras spock en Swift
import Foundation
enum GameResult : String {
case player1 = "Player 1"
case player2 = "Player 2"
case tie = "Tie"
}
enum Move: String {
case rock = "🗿"
@Codelaby
Codelaby / listado-estaciones-completo-normalizado.csv
Last active May 8, 2023 12:11
Listado de estaciones de Renfe Normalizado para Supabase
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 4. in line 1.
code;stopName;latitud;longitude;address;postalCode;city;province;country;cercanias;feve
01003;ARAHAL;37,268141;-5,5484006;CALLE VIRGEN DE LOS DOLORES, S/N;41600;Arahal;Sevilla;España;FALSE;FALSE
01005;MARCHENA;37,3342501;-5,4254295;AVENIDA MAESTRO SANTOS RUANO, 8;41620;Marchena;Sevilla;España;FALSE;FALSE
01007;OSUNA;37,2337769;-5,1148398;AVENIDA ESTACION FERROCARRIL, S/N;41640;Osuna;Sevilla;España;FALSE;FALSE
01009;PEDRERA;37,2223527;-4,893696;CALLE MANUEL ARANDA, 3;41566;Pedrera;Sevilla;España;FALSE;FALSE
02002;PUENTE GENIL-HERRERA;37,3597116;-4,8221946;CARRETERA A-318 - KM. 9 - ENTRE LOS PUEBLOS DE PUENTE GENIL (CÓRDOBA) Y HERRERA (SEVILLA);14500;Puente Genil;Córdoba;España;FALSE;FALSE
02003;ANTEQUERA-SANTA ANA;37,0702806;-4,7190304;CARRETERA MA-5406 - ESTACION FERROCARRIL, S/N;29540;Antequera;Málaga;España;FALSE;FALSE
03001;MENGIBAR-ARTICHUELA;37,9778433;-3,8019294;CALLE CAMINO ESTACION FERROCARRIL, S/N;23620;Mengíbar;Jaén;España;FALSE;FALSE
03100;JAEN;37,7800495;-3,7908847;PLAZA DE JAEN POR LA PAZ, 1;2300
@Codelaby
Codelaby / quotes.csv
Last active May 16, 2023 15:40
Listado de citas populares
We can't make this file beautiful and searchable because it's too large.
id,quote,author,tags,likes
0,Be yourself; everyone else is already taken.,Oscar Wilde,attributed-no-source;be-yourself;honesty;inspirational;misattributed-oscar-wilde,149270
1,You've gotta dance like there's nobody watching,William W. Purkey,dance;heaven;hurt;inspirational;life;love;sing,118888
2,Be the change that you wish to see in the world.,Mahatma Gandhi,action;change;inspirational;philosophy;wish,106749
3,No one can make you feel inferior without your consent.,"Eleanor Roosevelt,",confidence;inspirational;wisdom,85854
4,Live as if you were to die tomorrow. Learn as if you were to live forever.,Mahatma Gandhi,carpe-diem;education;inspirational;learning,73033
5,Darkness cannot drive out darkness: only light can do that. Hate cannot drive out hate: only love can do that.,"Martin Luther King Jr.,",darkness;drive-out;hate;inspirational;light;love;peace,72616
6,"Without music, life would be a mistake.","Friedrich Nietzsche,",inspirational;music;philosophy,67297
7,We accept the love we think we deserve.,"Steph
@Codelaby
Codelaby / bm25.swift
Last active October 25, 2023 15:49
bm25 algoritm swift
import Foundation
struct Document: Hashable {
let id: String
let content: String
func hash(into hasher: inout Hasher) {
hasher.combine(id)
}
@Codelaby
Codelaby / other.swift
Last active June 24, 2023 16:25
Funciones swift Precio de la luz
import Foundation
struct PriceNet: Decodable {
let price_id: String
let tariff: String
let price: Double
let created_at: String
}
let json = """
@Codelaby
Codelaby / photoCard.swift
Last active June 27, 2023 12:42
Swift Samples
//
// PostionSampleView.swift
// Avatars
//
// Created by Codelaby on 25/6/23.
//
@Codelaby
Codelaby / Control_pagination.swfit
Last active June 28, 2023 09:57
Ejemplos de TabView en SwiftUI
//
// CarouselView.swift
// Avatars
//
// Created by Codelaby on 28/6/23.
//
/*
https://swiftuilibrary.com/components/paginated-carousel
https://github.com/manuelduarte077/CustomCarouselList
@Codelaby
Codelaby / HeaderStreached.swift
Last active June 29, 2023 18:00
Headers Scroll Swift
//
// TopImageHeader.swift
// Avatars
//
// Created by Codelaby on 28/6/23.
//
import SwiftUI
/*https://www.bilibili.com/video/BV1vV4y1k7LY/
@Codelaby
Codelaby / RowPriceView
Last active May 4, 2024 09:05
Combine styles Swifui
import SwiftUI
enum RowPriceStyle {
case plain
case bordered
case outlined
case twoColors
func isTextColored() -> Bool {
switch self {