Skip to content

Instantly share code, notes, and snippets.

View tpiekarski's full-sized avatar
⌨️

Thomas Piekarski tpiekarski

⌨️
View GitHub Profile
@lucadegasperi
lucadegasperi / ProjectController.php
Created April 19, 2014 08:51
Controller Cleanup + Interface
<?php
class ProjectController extends BaseController implements ProjectCreatorDelegate
{
public function store()
{
$creator = new ProjectCreator($this);
return $creator->create(Input::all());
}
@SchumacherFM
SchumacherFM / realurl_conf.php
Created July 24, 2012 19:28
Multidomain with RealURL #TYPO3
<?php
/*
assuming the following folder structure:
typo3conf/
|
L ext/
L domainconfig/
|
L domain-global.inc.php
L domain-de.inc.php
@becw
becw / example.install.php
Last active March 26, 2019 06:53
Enable/revert a feature in a Drupal update hook #drupal7
/**
* EXAMPLE FEATURE UPDATE
* Enable and revert the my_new_feature_name feature.
*/
function example_update_7001() {
// An array of new or changed features; the array keys are feature names,
// values are an array of exportable types as seen in a feature's .info file:
// features[field][] = node-page-body
$features = array(
'my_new_feature_name' => array('field', 'variable'),
@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 / 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 / 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 / Log.java
Created March 6, 2020 21:07
A mock for Log while running tests for Android
package android.util;
import java.util.Locale;
import static java.lang.System.out;
@SuppressWarnings("UnusedReturnValue")
public class Log {
private static final int DEFAULT_RETURN_VALUE = 0;
@tpiekarski
tpiekarski / tobii-stream-sdk.pri
Created August 25, 2018 07:44
Integration of Tobii Stream SDK into Qt Build Process
# Integration of Tobii Stream SDK into Qt Build Process
#
# Reference:
# http://doc.qt.io/qt-5/qmake-variable-reference.html#includepath
# http://doc.qt.io/qt-5/qmake-variable-reference.html#libs
# http://doc.qt.io/qt-5/qmake-test-function-reference.html#equals-variablename-value
# http://doc.qt.io/qt-5/qmake-language.html#replacing-values
#
# Environment Variable containing the path to Tobii Stream SDK
@tpiekarski
tpiekarski / mounting-iso-images.sh
Created March 23, 2020 10:18
Mounting ISO Images
# Example how to mount an ISO image file
sudo mount -o loop <image.iso> <directory>
@pascalduez
pascalduez / demo.module
Created December 24, 2011 15:02
Drupal 7 — Basic Ajax form submit (Ajax framework)
<?php
/**
* @file
* Demo module, Basic Ajax form submit (Ajax framework).
*/
/**
* Implements hook_menu().
*/