Skip to content

Instantly share code, notes, and snippets.

View marttp's full-sized avatar
🙇‍♂️
Let's improve equality of developer and make the world better together

Thanaphoom Babparn marttp

🙇‍♂️
Let's improve equality of developer and make the world better together
View GitHub Profile
@marttp
marttp / cfp-deploy.yml
Created August 19, 2024 02:15
workflow for deploying Leptos to Cloudflare Pages
name: Release to Cloudflare Page
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
pages: write
name: chinook
services:
postgres:
image: postgres:15.3-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: chinook_db
ports:
- "5432:5432"
@marttp
marttp / .env
Last active June 30, 2024 13:34
Custom logback.xml file for Spring Boot application and Environment variables for OpenTelemetry Agent
JAVA_TOOL_OPTIONS="-javaagent:build/agent/opentelemetry-javaagent.jar"
OTEL_SERVICE_NAME="gout"
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
OTEL_EXPORTER_OTLP_PROTOCOL="grpc"
OTEL_RESOURCE_ATTRIBUTES="service.name=gout,service.instance.id=gout,env=dev"
# Logs are disabled by default
OTEL_LOGS_EXPORTER="otlp"
OTEL_METRIC_EXPORT_INTERVAL=500
OTEL_BSP_SCHEDULE_DELAY=500
@marttp
marttp / ddl-table-arhanaroyy.sql
Last active June 23, 2024 11:14
Example of SQL for my youtube video about introduction to database crash course
CREATE TABLE IF NOT EXISTS category (
id SERIAL NOT NULL,
name VARCHAR(50) NOT NULL,
CONSTRAINT category_pkey PRIMARY KEY (id)
);
CREATE TABLE IF NOT EXISTS menu (
id SERIAL PRIMARY KEY,
category_id INT NOT NULL,
name VARCHAR(100) NOT NULL,
@marttp
marttp / example.js
Created August 31, 2023 11:45
Random target & obstacle for Group 5
const TARGET = 3;
const OBSTACLE = 2;
/**
*
* @param {Number} height : ความสูงของตาราง;
* @param {Number} width : ความกว้างของตาราง;
* @param {Number} ob : สิ่งกีดขวาง;
*/
function generateMap(height, width, ob) {
@marttp
marttp / CourseProgressReceiverWorker.kt
Created July 30, 2023 19:11
Interaction Service - Consumer example
package dev.tpcoder.interaction.domain.progression
import com.fasterxml.jackson.databind.ObjectMapper
import jakarta.annotation.PostConstruct
import jakarta.annotation.PreDestroy
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.stereotype.Service
import reactor.core.Disposable
import reactor.core.Disposables
@marttp
marttp / CourseController.kt
Created July 30, 2023 18:53
Content Delivery Service - Example
package dev.tpcoder.contentdelivery.domain.course
import com.fasterxml.jackson.databind.ObjectMapper
import dev.tpcoder.contentdelivery.configuration.properties.KafkaChannelProperties
import dev.tpcoder.contentdelivery.domain.course.model.Course
import dev.tpcoder.contentdelivery.domain.course.model.KafkaPayload
import dev.tpcoder.contentdelivery.domain.course.model.ProgressEvent
import dev.tpcoder.contentdelivery.domain.course.model.Section
import org.apache.kafka.clients.producer.ProducerRecord
import org.slf4j.LoggerFactory
package dev.tpcoder.medicalcheckup.appointment
import dev.tpcoder.medicalcheckup.appointment.dto.CheckupResultCreation
import dev.tpcoder.medicalcheckup.appointment.entity.CheckupResult
import org.springframework.web.bind.annotation.*
@RestController
@RequestMapping("/checkups")
class CheckupController(private val checkupResultService: CheckupResultService, private val appointmentService: AppointmentService) {
@marttp
marttp / AppointmentController.kt
Created June 3, 2023 11:25
Healthcare Appointment Example
@RestController
@RequestMapping("/appointments")
class AppointmentController(private val appointmentService: AppointmentService) {
private val logger = LoggerFactory.getLogger(AppointmentController::class.java)
// Appointment - For Patient
@PostMapping
fun createAppointment(@RequestBody payload: CreateAppointmentRequest): CreateAppointmentResponse {
val createdAppointment = appointmentService.createAppointment(payload)
@marttp
marttp / Subscription.kt
Created June 3, 2023 11:21
Newsletter subscription with JobRunr
package dev.tpcoder.medicalcheckup.newsletter
import dev.tpcoder.medicalcheckup.common.entity.Patient
import org.springframework.data.annotation.Id
import org.springframework.data.jdbc.core.mapping.AggregateReference
import org.springframework.data.relational.core.mapping.Table
@Table("subscriptions")
data class Subscription(
@Id val id: Long? = null,