Skip to content

Instantly share code, notes, and snippets.

View tpiekarski's full-sized avatar
⌨️

Thomas Piekarski tpiekarski

⌨️
View GitHub Profile
@tpiekarski
tpiekarski / .gitignore
Created March 3, 2020 15:59
gitignore for Android Development
# Android (Studio) gitignore
#
# Sources:
# - iainconor, Android Studio .gitignore (https://gist.github.com/iainconnor/8605514)
# - github, gitignore (https://github.com/github/gitignore/blob/master/Android.gitignore)
#
# Built application files
*.aab
*.aar
@tpiekarski
tpiekarski / docker-creation-info-shorthand.sh
Created November 22, 2019 13:46
Shorthand for getting creation and start dates for running a Docker Container
# Shorthand for getting creation and start dates for running a Docker Container
docker inspect some-container | grep -E "(Created|Started)" | sed "s/\s//g"
@tpiekarski
tpiekarski / selenide-live-screenshots.java
Created November 21, 2019 13:09
Live Screenshots of Selenide/Selenium inside IDEA
// For taking live screenshots in Selenide/Selenium Tests inside IDEAs Debugger watch that expression:
Screenshots.takeScreenShotAsImage($("*"))
@tpiekarski
tpiekarski / java-spring-access-mvc-responses.java
Created November 7, 2019 09:30
Accessing Responses from Spring MVC in Unit Tests
package ...;
import ...;
@ExtendWith(SpringExtension.class)
@WebMvcTest(controllers = SomeMVCController.class, secure = false)
class SomeMVCUnitTests {
@Autowired
private MockMvc mvc;
@tpiekarski
tpiekarski / java-gradle-run-cucumber-by-tags.sh
Created August 22, 2019 12:21
Run Cucumber Scenarios selected by Tag with Gradle
// Within build.gradle
task cucumber(type: JavaExec) {
systemProperties = System.getProperties()
}
// At CLI
gradlew cucumber -Dcucumber.options='--tags "@SomeTag"'
@tpiekarski
tpiekarski / git-removing-branches.sh
Created July 26, 2019 14:33
Reminder for removing local and remote GIT Branches
git branch -d feature/to-be-removed && git push origin --delete feature/to-be-removed
@tpiekarski
tpiekarski / handy-console-debugging.js
Created July 8, 2019 15:00
Handy Console Debugging Snippets for JavaScript
console.log(`<context>: <name> (${Date.now()})`);
console.log("object-1: %o, object-2: %o, ..., object-n: %o", o1, o2, o3);
console.trace();
console.table(o1);
@tpiekarski
tpiekarski / express-exit-route.js
Created June 19, 2019 16:57
A HTTP-Route for exiting Node.js Server Process with Express
const express = require('express');
const app = express();
const port = 3000;
app.get('/exit', (req, res) => {
res.sendStatus(200);
res.on('finish', () => {
// Exiting process when the finish event was emited and the response was at least passed successfully to the operating system
// (for details see: https://nodejs.org/api/http.html#http_event_finish). Without that the HTTP status code 200 won't make it.
console.log(`Sent a 200, stoping to list for connections on ${port} and exiting process.`);
@tpiekarski
tpiekarski / simulating-argv.cpp
Created April 28, 2019 09:09
Simulating argv
std::vector<char*> simulated_argv;
simulated_argv.push_back((char*) "application_name");
simulated_argv.push_back((char*) "--something");
simulated_argv.push_back((char*) "42");
// to use the vector like the char* array use data() of vector
@tpiekarski
tpiekarski / qobject-and-templates.cpp
Created September 2, 2018 08:03
Messenger for Templates and Qt Objects Signal/Slots
#ifndef DATA_H
#define DATA_H
#include <QObject>
class DataMessenger : public QObject {
Q_OBJECT
public: