Skip to content

Instantly share code, notes, and snippets.

View paulouskunda's full-sized avatar
🤓
Trying new things

Paul Kunda paulouskunda

🤓
Trying new things
View GitHub Profile
@paulouskunda
paulouskunda / RecipeCard.kt
Created March 15, 2023 09:02
Screens for the App
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlinx-serialization'
}
// ...
dependencies {
implementation 'androidx.core:core-ktx:1.9.0'
import org.slf4j.Logger
import org.slf4j.LoggerFactory
class RecipeUtil {
inline fun <reified T> logger(): Logger {
return LoggerFactory.getLogger(T::class.java)
}
}
@paulouskunda
paulouskunda / RecipeService.kt
Created March 15, 2023 08:48
Recipe Service
import com.paul.data.Ingredients
import com.paul.data.Instructions
import com.paul.data.Recipe
import com.paul.data.Response
import com.paul.entity.IngredientsEntity
import com.paul.entity.InstructionsEntity
import com.paul.entity.RecipeEntity
import com.paul.repository.IngredientsRepository
import com.paul.repository.InstructionsRepository
import com.paul.repository.RecipeRepository
data class Recipe (
var recipeName: String?,
var recipeInstructions: String?,
var recipeImage: String?,
var ingredients: List<Ingredients>,
var instructions: List<Instructions>
)
class Ingredients (
var ingredientsDetails: String
import com.paul.entity.IngredientsEntity
import com.paul.entity.InstructionsEntity
import com.paul.entity.RecipeEntity
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.stereotype.Repository
@Repository
interface IngredientsRepository : JpaRepository<IngredientsEntity, Int> {
}
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonProperty
import com.paul.data.Ingredients
import org.hibernate.annotations.CreationTimestamp
import java.util.*
import javax.persistence.*
@Entity
package com.paul.config
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.ConstructorBinding
@ConfigurationProperties(prefix = "config")
@ConstructorBinding
data class ApplicationProperties(
val internalServerError: String,
@paulouskunda
paulouskunda / RecipeController.kt
Created March 13, 2023 20:21
RecipeController
package com.paul.controller
import com.paul.data.Recipe
import com.paul.service.RecipeService
import com.paul.util.RecipeUtil
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
@paulouskunda
paulouskunda / app.py
Created August 14, 2020 23:52
Running a flask app locally with MySQL install in Xampp (Lampp - Linux Users), this method works fine.
from flask import Flask, render_template, redirect, session, request, url_for
import pymysql
import secret
# Initialize the flask library
app = Flask(__name__)
# create secret key to use for sessions
app.secret_key = "JustMakeThisEndInWeirdLines123@#!IThinkThisIsFine"
# create a connection to the mysql (phpMyAdmin) server