This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type LocalPagination<T> = { | |
elements: T[]; | |
totalPages: number; | |
}; | |
export const calcTotalPages = <T>(list: T[], itemsPerPage) => | |
Math.ceil(list.length / itemsPerPage); | |
export default <T>( | |
list: T[], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div id="app"> | |
<div id="nav"> | |
<router-link to="/">Home</router-link> | | |
<router-link v-for="(view, index) in getViews()" | |
:key="`route-link-${index}`" | |
:to="`/${view.toLowerCase()}`"> | |
{{ view }} | |
<span v-if="index !== getViews().length - 1"> | </span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val user0 = User() | |
val user1 = User(firsName = "Demys") | |
val user2 = User( | |
firsName = "Demys", lastName="Lima", email="demysdcl@gmailcom" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Run | |
fun generateNewVerificationToken(email: String, reset: Boolean): VerificationToken = | |
this.findByEmail(email).run { | |
verificationTokenRepository.save(findAndUpdateVerificationToken(this)) | |
} | |
//Let | |
fun generateNewVerificationToken(email: String, reset: Boolean): VerificationToken = | |
this.findByEmail(email).let { | |
verificationTokenRepository.save(this.findAndUpdateVerificationToken(it)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Java | |
public User registerUser(User user) { | |
user.setRoles(Arrays.asList(roleRepository.findByName("ROLE_USER").get())); | |
user.setEnabled(false); | |
user = create(user); | |
this.emailService.sendConfirmationHtmlEmail(user, null); | |
return user; | |
} | |
// Kotlin apply |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Java | |
public User updatePasswordUser(String password) { | |
user.setPassword(password) | |
return userRepository.save(user) | |
} | |
//Kotlin | |
fun updatePasswordUser(password: String) = userRepository | |
.save(user.copy(password = password) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
data class User( | |
@Id | |
@GeneratedValue | |
@Column(name ="user_id") | |
val id: Long? = null, | |
val firstName: String = "", | |
val lastName: String = "", | |
val email: String = "", | |
val password: String = "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<parent> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-parent</artifactId> | |
<version>2.1.3.RELEASE</version> | |
<relativePath/> <!-- lookup parent from repository --> | |
</parent> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | |
plugins { | |
id("org.springframework.boot") version "2.2.6.RELEASE" | |
id("io.spring.dependency-management") version "1.0.9.RELEASE" | |
kotlin("jvm") version "1.3.71" | |
kotlin("plugin.spring") version "1.3.71" | |
kotlin("plugin.jpa") version "1.3.71" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"import components": { | |
"scope": "javascript,typescript", | |
"prefix": "d-import", | |
"body": "import ${1:component} from './components/${1:component}.svelte'" | |
} | |
} |
NewerOlder