Skip to content

Instantly share code, notes, and snippets.

@derhansen
derhansen / gist:c56ff4df72d6b83121bea99bd83271cd
Created March 9, 2019 06:39
TYPO3 - Extbase stream file from resourceStorage using streamFile PSR-7 Response
public function downloadAction()
{
$storage = $this->resourceFactory->getDefaultStorage();
$file = $storage->getFile('test.jpg');
$response = $storage->streamFile($file, true, 'test-filename.jpg');
$this->sendResponse($response);
exit();
}
protected function sendResponse($response)
@lounagen
lounagen / readme.md
Last active April 12, 2023 00:43 — forked from thomasdarimont/readme.md
Example for decoding a JWT Payload with your Shell (bash, zsh...)

Setup

Add this to your .profile, .bashrc, .zshrc...

BASE64_DECODER_PARAM="-d" # option -d for Linux base64 tool
echo AAAA | base64 -d > /dev/null 2>&1 || BASE64_DECODER_PARAM="-D" # option -D on MacOS

decode_base64_url() {
  local len=$((${#1} % 4))
  local result="$1"
 if [ $len -eq 2 ]; then result="$1"'=='
@spoonerWeb
spoonerWeb / GitLab CI Links
Created June 24, 2018 08:19
Summary of links regarding GitLab CI/CD configurations
@joeytwiddle
joeytwiddle / async-await-forEach-alternatives.md
Last active May 19, 2024 18:52
Do not use forEach with async-await

Do not use forEach with async-await

TLDR: Use for...of instead of forEach() in asynchronous code.

For legacy browsers, use for...i or [].reduce()

To execute the promises in parallel, use Promise.all([].map(...))

The problem

@scr4bble
scr4bble / readable-dates.php
Created February 6, 2018 19:30
Adminer plugin that replaces UNIX timestamps with human-readable dates.
<?php
/** This plugin replaces UNIX timestamps with human-readable dates in your local format.
* Mouse click on the date field reveals timestamp back.
*
* @link https://www.adminer.org/plugins/#use
* @author Anonymous
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
@hopeseekr
hopeseekr / docker_dedicated_filesystem.md
Created February 3, 2018 04:01
Putting Docker on its own pseudo filesystem

Docker on BTRFS is very buggy and can result in a fully-unusable system, in that it will completely butcher the underlying BTRFS filesystem in such a way that it uses far more disk space than it needs and can get into a state where it cannot even delete any image, requiring one to take drastic actions up to and including reformatting the entire affected BTRFS root file system.

According to the official Docker documentation:

btrfs requires a dedicated block storage device such as a physical disk. This block device must be formatted for Btrfs and mounted into /var/lib/docker/.

In my experience, you will still run into issues even if you use a dedicated partition. No, it seems it requires a standalone

@arharp
arharp / dnsmasq OS X.md
Last active May 15, 2023 07:49 — forked from ogrrd/dnsmasq OS X.md
Setup development URLs (e.g. mysite.test) with dnsmasq on Mac OS X

Setup development URLs (e.g. mysite.test) with dnsmasq on Mac OS X

Never touch your local /etc/hosts file in OS X again. Setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

@karlhillx
karlhillx / macos_high_sierra_apache_php_brew_2018.md
Last active March 13, 2024 02:42
macOS High Sierra Setup: Homebrew + Apache + PHP + MariaDB + SSL

macOS High Sierra Setup: Homebrew + Apache + PHP + MariaDB + SSL

Homebrew Installation

First let's install Homebrew.

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

@helhum
helhum / composer.json
Last active February 12, 2024 10:54
The (currently) ideal TYPO3 composer setup
{
"require": {
"typo3-console/composer-auto-setup": "^0.1",
"georgringer/news": "^6.1",
"helhum/typo3-secure-web": "^0.2.5",
"typo3/cms-introduction": "^3.0"
},
"extra": {
"typo3/cms": {
"cms-package-dir": "{$vendor-dir}/typo3/cms",
@tannerhodges
tannerhodges / slide.js
Last active February 24, 2020 10:34 — forked from ludder/slideDown.js
Vanilla JavaScript slideUp and slideDown functions
/**
* Slide an element down like jQuery's slideDown function using CSS3 transitions.
* @see https://gist.github.com/ludder/4226288
* @param {element} el
* @param {string} timing
* @return {void}
*/
function slideDown(el, timing) {
timing = timing || '300ms ease';