Skip to content

Instantly share code, notes, and snippets.

@SvenJuergens
SvenJuergens / CropVariantUtility.php
Created July 18, 2023 14:01 — forked from derhansen/CropVariantUtility.php
TYPO3 CMS CropVariantUtility to manually calculate the default crop variant string for a given image
<?php
declare(strict_types=1);
namespace Derhansen\Typo3Dev\Utility;
use TYPO3\CMS\Core\Imaging\ImageManipulation\Area;
use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection;
use TYPO3\CMS\Core\Imaging\ImageManipulation\InvalidConfigurationException;
use TYPO3\CMS\Core\Resource\File;
@SvenJuergens
SvenJuergens / shortcuts.md
Created June 28, 2023 09:31 — forked from memphys/shortcuts.md
Bash Shortcuts For Maximum Productivity

source: http://www.skorks.com/2009/09/bash-shortcuts-for-maximum-productivity/

Command Editing Shortcuts

  • Ctrl + a – go to the start of the command line
  • Ctrl + e – go to the end of the command line
  • Ctrl + k – delete from cursor to the end of the command line
  • Ctrl + u – delete from cursor to the start of the command line
  • Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word)
  • Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
@SvenJuergens
SvenJuergens / pre-commit
Last active August 21, 2019 11:42 — forked from edgar/pre-commit
Git: Pre-commit git hook that prevents commits with undesired words, usually debugging statements #git #hook #pre-commit
# This script verifies if a list of "undesired" words are presented in the files you are intended to commit such console
# output, debugging information or keys/tokens/passwords
# Based on the git hook created by Mark Story
# http://mark-story.com/posts/view/using-git-commit-hooks-to-prevent-stupid-mistakes
# Instructions:
# Put this file into your .git/hooks folder and set as executable (chmod +x pre-commit)
@SvenJuergens
SvenJuergens / openssl_encrypt_decrypt.php
Created September 18, 2018 15:58 — forked from joashp/openssl_encrypt_decrypt.php
Simple PHP encrypt and decrypt using OpenSSL
<?php
/**
* simple method to encrypt or decrypt a plain text string
* initialization vector(IV) has to be the same when encrypting and decrypting
*
* @param string $action: can be 'encrypt' or 'decrypt'
* @param string $string: string to encrypt or decrypt
*
* @return string
*/
@SvenJuergens
SvenJuergens / lib.navSidebar.ts
Created August 28, 2018 15:19 — forked from julrich/lib.navSidebar.ts
Fully cached TYPO3 HMENU navigation example with expAll and 'active', 'current' states
#
# Main navigation in Sidebar
#
# General idea: Don't render & cache 'active' and 'current' states in 'expAll' menu, so it becomes cacheable
# over all pages. To regain 'active' and 'current' states, the result of the cached menu is parsed by
# 'stdWrap.replacement', utilizing specific information about the resulting menu item markup to insert them.
# Use COA to decouple the stdWrap ('lib.navSidebar.stdWrap.replacement') needed for RegExp replacement from
# the cached menu ('lib.navSidebar.10'). This way the complete menu can be generically cached without current
@SvenJuergens
SvenJuergens / git-change-commit-messages.md
Created August 24, 2018 13:36 — forked from nepsilon/git-change-commit-messages.md
How to change your commit messages in Git? — First published in fullweb.io issue #55

How to change your commit messages in Git?

At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.

@SvenJuergens
SvenJuergens / IncludeLibsWrapper.php
Created December 7, 2017 15:21 — forked from helhum/IncludeLibsWrapper.php
includeLibsWrapper for removed config.includeLibs functionality
<?php
namespace Helhum\IncludeLibsWrapper;
class IncludeLibsWrapper {
public function includeLibs($content, $conf) {
if (!empty($conf['includeLibs.'] && is_array($conf['includeLibs.']))) {
$GLOBALS['TSFE']->includeLibraries($conf['includeLibs.']);
}
}
@SvenJuergens
SvenJuergens / PhpStorm Keyboard Shortcuts.md
Created June 20, 2017 08:22 — forked from koomai/PhpStorm Keyboard Shortcuts.md
Frequently Used PhpStorm Keyboard Shortcuts

Note: Some of these shortcuts have been remapped for my own convenience (Preferences->Keymap). These are Mac shortcuts, just use the Windows/Linux equivalent of the Cmd/Option/Ctrl/Del keys.

####Search, Go to, Navigation ####

Cmd + P - Search file

Cmd + Shift + O - Search everywhere

(I swapped the above two recently because I use Cmd + P to search for files most of the time).

@SvenJuergens
SvenJuergens / InsertExample.php
Created June 20, 2017 08:21 — forked from einpraegsam/InsertExample.php
TYPO3 QueryBuilder example use
<?php
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Utility\GeneralUtility;
// insert into tt_content (header, crdate, pid) VALUES ("New content", 123456789, 123);
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_content');
$queryBuilder
->insert('tt_content')
->values([
'header' => 'New content',
@SvenJuergens
SvenJuergens / gist:d1338ef2e3be9341f7eddf0d3c24a1f0
Created April 12, 2017 12:53 — forked from nghuuphuoc/gist:8331575
chmod files to 644 and all folders to 755
$ find . -type d -print0 | xargs -0 chmod 0775
$ find . -type f -print0 | xargs -0 chmod 0664