Skip to content

Instantly share code, notes, and snippets.

View rieckpil's full-sized avatar
🏝️
Working remotely

Philip Riecks rieckpil

🏝️
Working remotely
View GitHub Profile
@rieckpil
rieckpil / HelloWorld.java
Created September 2, 2017 19:20
MyFirstGist
public class HelloWorld{
public static void main(String[] args) {
System.out.println("Hello from my first gist");
}
}
@rieckpil
rieckpil / kafka.sh
Created September 2, 2017 19:23
Useful kafka commands
./kafka-console-producer.sh --topic topicName --broker-list localhost:9092
./kafka-topics.sh --create --replication-factor 1 --partitions 1 --zookeeper localhost:2181 --topic topicName
./kafka-topics.sh --describe --zookeeper localhost:2181
./zookeeper-server-start.sh ../conf/zookeeper.properties
@rieckpil
rieckpil / di.sh
Created December 9, 2017 10:10
Dependency Injection for 5 year olds
#/bin/bash
echo "
When you go and get things out of the refrigerator for yourself, you can cause problems. You might leave the door open,
you might get something Mommy or Daddy doesn't want you to have. You might even be looking for something we don't even have
or which has expired.
What you should be doing is stating a need, "I need something to drink with lunch", and then we will make sure you have
something when you sit down to eat.
@rieckpil
rieckpil / commands.sh
Last active August 19, 2018 18:52
Postgres Cheatsheet
# Postgres database as docker container
docker run -p 5432:5432 --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
# creating a table with auto increment primary key prior to PostgreSQL 10
CREATE TABLE category (
ID SERIAL PRIMARY KEY,
DESCRIPTION VARCHAR(255)
);
# creating auto increment primary key since PostgresSQL 10
@rieckpil
rieckpil / ToXHTML.java
Created April 8, 2018 08:52
Transfer .html to .xhtml with java
public class ToXHTML {
/**
* <dependency>
* <groupId>net.sf.jtidy</groupId>
* <artifactId>jtidy</artifactId>
* <version>r938</version>
* </dependency>
*/
@rieckpil
rieckpil / WpClient.java
Created October 3, 2019 18:02
WP API get all posts
@ApplicationScoped
public class WpClient {
public void getListOfBlogPosts(@Observes @Initialized(ApplicationScoped.class) Object object) {
Client client = ClientBuilder.newBuilder().build();
WebTarget webTarget = client.target("https://rieckpil.de/wp-json/wp/v2/posts");
JsonArray result = webTarget
.queryParam("per_page", 100)
@rieckpil
rieckpil / application.yml
Created April 15, 2020 17:16
Debugging Hibernate - Settings for Spring application
spring:
jpa:
show-sql: false
hibernate:
ddl-auto: none
properties:
hibernate.generate_statistics: true
logging:
level:
@rieckpil
rieckpil / sendowl.js
Created December 30, 2020 20:37
Trigger Cart Abandonment when Email is pre-filled on SendOwl's Checkout Page
<script>
Page.checkoutCallback = function () {
var email = document.getElementById("order_buyer_email").value;
if (email) {
$("#order_buyer_email").blur();
}
}
</script>
@rieckpil
rieckpil / rieckpil.css
Last active October 14, 2021 18:52
Custom Crayon Theme (Inspired by the IntelliJ IDEA Light Theme)
.crayon-theme-rieckpil {
border-width: 0px !important;
border-color: #999 !important;
border-style: solid !important;
text-shadow: none !important;
background: #fdfdfd !important;
}
.crayon-theme-rieckpil-inline {
border-width: 1px !important;
border-color: #ddd !important;
@rieckpil
rieckpil / idea-live-template-examples.md
Last active April 30, 2022 15:33
Intellij IDEA Live Template Examples

Live Template Examples for Testing Java Applications

Create new Live Templates within your IDEA's Preferences -> Editor -> Live Templates

mockMvcGET: Peform a MockMvc HTTP GET request.

org.springframework.test.web.servlet.MvcResult result = this.mockMvc
  .perform(org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get($url$)
  .header(org.springframework.http.HttpHeaders.ACCEPT, org.springframework.http.MediaType.APPLICATION_JSON))