Skip to content

Instantly share code, notes, and snippets.

View rivancic's full-sized avatar
:shipit:
I'm shipping it

Renato Ivancic rivancic

:shipit:
I'm shipping it
View GitHub Profile
@rivancic
rivancic / build.gradle
Created June 11, 2022 17:20
Gradle Task Printing Content of a file
tasks.register("printBuild") { // Register task named printBuild
doLast { // What should be executed - action
// Open a file in BufferedReader
try (BufferedReader br = new BufferedReader(new FileReader(layout.buildDirectory.dir("resources/main/git.properties").get().getAsFile()))) {
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
}
@rivancic
rivancic / monitoring.js
Last active September 18, 2017 07:33
monitoring script - mark outdated jobs
/**
* This script is used on monitoring page to mark the job id which is older that one day.
*/
$(document).ready(function() { markOld();});
function markOld() {
console.log("Start listening on changes");
$(".container h1:first").css("color","red");
$(document).on("DOMSubtreeModified", ".container h1:first", function () {
console.log("items changed");
@rivancic
rivancic / template.md
Last active June 23, 2017 16:28
New task template

Expected behaviour

Actual behaviour

Steps to reproduce the behaviour

Solution

@rivancic
rivancic / html5.md
Created June 21, 2017 19:33
HTML 5

Button

There are 3 different types of buttons:

  • Submit (default)
  • Reset
  • Button

<button type="">

Please use type of button explicitly everywhere to avoid ambuiguity.

Enum

Iterate over an enum in Java .values()

You can call the values() method on your enum.

for (Direction dir : Direction.values()) {
 // do what you want
@rivancic
rivancic / linux.md
Last active June 22, 2017 15:51
Linux

Export variable

~/.bashrc

When you open any terminal window this file will be run. Therefore, if you wish to have a permanent environment variable in all of your terminal windows you have to add the following

~/.profile

Same as bashrc you have to put the mentioned command line at the end of this file to have your environment variable in the every log in of your OS.

Passing build arguments

Multiple: docker build -t image-name --build-arg ARG1=*** --build-arg ARG2=*** .

@rivancic
rivancic / respurces.md
Last active May 11, 2017 14:32
Spring Resources

Load resources recursively with pattern

PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
resolver.getResources("classpath*:some/package/name/**/*.xml");

Read Resource content to string

@rivancic
rivancic / Redis-Spring-Data.md
Last active December 11, 2017 14:18
Redis Springdata Docker

Redis

Springdata

Reference

<dependency>
  <groupId>org.springframework.boot</groupId>
 spring-boot-starter-data-redis