Skip to content

Instantly share code, notes, and snippets.

View stmllr's full-sized avatar
🏴‍☠️

Steffen Müller stmllr

🏴‍☠️
View GitHub Profile
@stmllr
stmllr / gist:4082423
Created November 15, 2012 23:41
Poll song name from remote service using jQuery
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.js"></script>
<div id="song">Loading song...</div>
$(document).ready(function() {
$.post(
'http://example.com/get/song',
function(data) {
if (data.song !== '') {
$('#song').text(data.song);
}
@stmllr
stmllr / DeprecationWriter.php
Created April 1, 2013 01:18
Prove of concept for a Deprecation LogWriter for TYPO3.
<?php
namespace TYPO3\CMS\Core\Log\Writer;
/***************************************************************
* Copyright notice
*
* (c) 2013 Steffen Müller (typo3@t3node.com)
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
@stmllr
stmllr / takeScreenshotAfterFailedStep.php
Last active December 16, 2015 11:49 — forked from fbrnc/gist:4550079
Take screenshot after a step failed in Behat/Mink using Selenium WebDriver
<?php
class FeatureContext extends MinkContext {
/**
* Take screenshot when step fails. Works only with Selenium2Driver.
* Screenshot is saved at [Date]/[Feature]/[Scenario]/[Step].jpg
*
* @AfterStep @javascript
*/
@stmllr
stmllr / Greylog2Writer.php
Created May 15, 2013 14:22
Experimental implementation of a greylog2 LogWriter for TYPO3 CMS >= 6.x
<?php
namespace T3node\Graylog2Writer\Log\Writer;
/***************************************************************
* Copyright notice
*
* (c) 2013 Steffen Müller <typo3@t3node.com>
*
* All rights reserved
*
@stmllr
stmllr / download.php
Last active February 17, 2023 06:41
PHP script to download a file from files/ directory. Warning: no authorization or security checks implemented.
<?php
// You need to create the files/ directory inside your document root to put your files.
if (substr($_SERVER['REQUEST_URI'], 0, 7) !== '/files/') {
die('not allowed');
}
$absolutePath = $_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI'];
<?php
/** Writing png image to file */
$filename = vfsStream::url('root/test.png');
// not testable with vfsStream
imagepng($image, $filename);
@stmllr
stmllr / Result
Last active August 29, 2015 14:17
Proof-of-concept: Using TYPO3.Fluid as view in Slim
$ php -S localhost:8000 index.php
$ curl http://localhost:8000/hello/world
<html>
<body>
<h1>Rendered with TYPO3.Fluid</h1>
Hello world
</body>
</html>
@stmllr
stmllr / Typo3RequestIdProcessor.php
Last active September 20, 2016 13:04
TYPO3 LogProcessor to add requestId to log records
namespace Monolog\Processor;
use TYPO3\CMS\Core\Core\Bootstrap;
/**
* Adds TYPO3 requestId to records
*/
class Typo3RequestIdProcessor
{
/**
@stmllr
stmllr / RemoveUnreferencedFilesMarkedAsMissing.php
Created October 24, 2016 10:52
TYPO3 scheduler task to delete rows from sys_file without 1) a corresponding file and 2) a reference in sys_file_reference
<?php
namespace My\Ext\Scheduler\Task;
/**
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
@stmllr
stmllr / circle.yml
Created December 26, 2016 23:38 — forked from undeadops/circle.yml
Terraform circleci.yml
dependencies:
cache_directories:
- terraform_0.6.16
pre:
- mkdir -p terraform_0.6.16
- wget -O terraform_0.6.16/terraform_0.6.16_linux_amd64.zip https://releases.hashicorp.com/terraform/0.6.16/terraform_0.6.16_linux_amd64.zip
- unzip terraform_0.6.16/terraform_0.6.16_linux_amd64.zip
test:
override: