Skip to content

Instantly share code, notes, and snippets.

Avatar
🏝️
Working remotely

Philip Riecks rieckpil

🏝️
Working remotely
View GitHub Profile
@rieckpil
rieckpil / idea-live-template-examples.md
Last active Nov 19, 2021
Intellij IDEA Live Template Examples
View idea-live-template-examples.md

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))
@rieckpil
rieckpil / rieckpil.css
Last active Oct 14, 2021
Custom Crayon Theme (Inspired by the IntelliJ IDEA Light Theme)
View rieckpil.css
.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 / sendowl.js
Created Dec 30, 2020
Trigger Cart Abandonment when Email is pre-filled on SendOwl's Checkout Page
View sendowl.js
<script>
Page.checkoutCallback = function () {
var email = document.getElementById("order_buyer_email").value;
if (email) {
$("#order_buyer_email").blur();
}
}
</script>
@rieckpil
rieckpil / application.yml
Created Apr 15, 2020
Debugging Hibernate - Settings for Spring application
View application.yml
spring:
jpa:
show-sql: false
hibernate:
ddl-auto: none
properties:
hibernate.generate_statistics: true
logging:
level:
@rieckpil
rieckpil / WpClient.java
Created Oct 3, 2019
WP API get all posts
View WpClient.java
@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 / ToXHTML.java
Created Apr 8, 2018
Transfer .html to .xhtml with java
View ToXHTML.java
public class ToXHTML {
/**
* <dependency>
* <groupId>net.sf.jtidy</groupId>
* <artifactId>jtidy</artifactId>
* <version>r938</version>
* </dependency>
*/
@rieckpil
rieckpil / commands.sh
Last active Aug 19, 2018
Postgres Cheatsheet
View commands.sh
# 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 / di.sh
Created Dec 9, 2017
Dependency Injection for 5 year olds
View di.sh
#/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 / kafka.sh
Created Sep 2, 2017
Useful kafka commands
View kafka.sh
./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
View HelloWorld.java
public class HelloWorld{
public static void main(String[] args) {
System.out.println("Hello from my first gist");
}
}