Skip to content

Instantly share code, notes, and snippets.

Avatar

Sangkon, Han sigmadream

View GitHub Profile
View 게시판-paging-snippet.md

// Service
public Page<Board> findBoardList(Pageable pageable) {
    pageable = PageRequest.of(pageable.getPageNumber() <= 0 ? 0 : pageable.getPageNumber() - 1, pageable.getPageSize());
    return boardRepository.findAll(pageable);
}

public Board findBoardByIdx(Long idx) {
    return boardRepository.findById(idx).orElse(new Board());
View 게시판-index-snippet.md
// java code
private BoardRepository boardRepository;

public BoardController(BoardRepository boardRepository) {
    this.boardRepository = boardRepository;
}

@GetMapping("/")
public String index(Model model) {
View thymeleaf-default-html.md
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">    
  <title>Index</title>
</head>
<body>
  <div class="container">
View AssertTest.java
import static org.assertj.core.api.Assertions.*;
public class AssertTest {
@Test
public void testAssertArrayEquals() {
byte[] expected = "trial".getBytes();
byte[] actual = "trial".getBytes();
assertThat(actual).as("failure - byte arrays not same").isEqualTo(expected);
}
@Test
public void testAssertEquals() {
@sigmadream
sigmadream / application.yml
Last active Mar 27, 2019
스프링 부트 설정
View application.yml
spring:
jpa:
hibernate:
ddl-auto: create-drop
show_sql: true
database: H2
h2:
console:
enabled: true
datasource:
View gist:82fd85b28193d26447b74f8aeca3d539
https://www.dropbox.com/s/acqixf0xwzh6pcc/%EC%9B%B9%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D_01.pptx?dl=0
View gist:a8062eccca00df2ea79f2f29e1b62543
https://www.dropbox.com/s/acqixf0xwzh6pcc/%EC%9B%B9%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%B0%8D_01.pptx?dl=0
View Model.md
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
from django.urls import reverse

class PublishedManager(models.Manager):
    def get_queryset(self):
        return super(PublishedManager, self).get_queryset().filter(status='published')
View parser.h
{-# OPTIONS_GHC -Wall #-}
import Control.Applicative
import Data.Char
newtype Parser a = P (String -> [(a, String)])
parse :: Parser a -> String -> [(a, String)]
parse (P p) inp = p inp
instance Functor Parser where
View httpd.yml
- name: Install Apache Web Server
hosts: '{{ vmname }}'
gather_facts: no
tasks:
- name: Ensure apache is at the latest version
yum: name=httpd state=latest
become: true
- name: Change permissions of /var/www/html
file: path=/var/www/html mode=0777
become: true