Skip to content

Instantly share code, notes, and snippets.

@MrSnyder
MrSnyder / BootstrapGridifier.java
Created November 19, 2019 16:22
Bootstrap gridifier
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class BootstrapGridifier {
public static void main(String[] args) throws IOException {
@MrSnyder
MrSnyder / cheatsheet_spring_security.md
Last active February 4, 2020 16:06
Spring Security Cheatsheet

Spring Security Cheatsheet

HttpSecurity

	@Override
	protected void configure(HttpSecurity http) throws Exception {
	    http
	        .authorizeRequests()
 .antMatchers("/", "/images/**", "/styles.css", "/webjars/**").permitAll()
@MrSnyder
MrSnyder / cheatsheet_markdown.md
Last active February 5, 2020 16:08
Markdown Cheatsheet

Markdown Cheatsheet

Level 2

A level 2 section

Level 3

A level 3 section

@MrSnyder
MrSnyder / cheatsheet_thymeleaf.md
Created February 11, 2020 12:02
Thymeleaf Cheatsheet
@MrSnyder
MrSnyder / cheatsheet_livecoding.md
Last active July 8, 2020 10:25
Live Coding Cheatsheet

Live-Coding Cheatsheet

Image-Handling JPA+Upload

  • Explain ImageController
  • Move #loadImage from ImageController to BookController
  • Book entity: add LOB field
  • Insert example via LOAD_FILE
  • book/edit.html: Add input to form + change to multipart
  • Controller anpassen (loadImage)
@MrSnyder
MrSnyder / best_practices_java.md
Last active February 17, 2020 10:28
Java Coding Best Practices

Common Java naming rules

Casing variants

Example: Several individual words

  • Upper camel case: SeveralIndividualWords
  • Lower camel case: severalIndividualWords
  • Snake case: Several_individual_words

Classes / Interfaces

  • Examples
    • Book
  • ImageUploadController
@MrSnyder
MrSnyder / cheatsheet_jpa.md
Last active August 7, 2020 14:16
JPA Cheatsheet

JPA Cheatsheet

Minimal entity class mapping

Steps

  • Required: Annotate class with @Entity
  • Required: Define field with @Id annotation
  • NOTE: Prefer Lombok for automatic Getter/Setter generation.
@MrSnyder
MrSnyder / cheatsheet_data_modelling.md
Created February 19, 2020 12:04
Data Modelling cheatsheet

Data Modelling Cheatsheet

Identifying relations

A relation between two tables A and B where a foreign key of A is (part of) the primary key of B.

CREATE TABLE AuthoredBook (
  author_id INT NOT NULL,
 book_id INT NOT NULL,
@MrSnyder
MrSnyder / cheatsheet_android.md
Last active March 31, 2020 12:06
Android Cheatsheet
@MrSnyder
MrSnyder / cheatsheet_java.md
Last active August 20, 2020 08:59
Java Cheatsheet

Java Cheatsheet

Inner, anonymous classes and lambdas

import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;