Skip to content

Instantly share code, notes, and snippets.

View dmitryd's full-sized avatar

Dmitry Dulepov dmitryd

View GitHub Profile
@dmitryd
dmitryd / ContentButtonBarHook.php
Created August 17, 2020 14:42
Restore split button for TYPO3 v9 forms
<?php
namespace Vendor\Extension\Hook;
use TYPO3\CMS\Backend\Template\Components\ButtonBar;
use TYPO3\CMS\Backend\Template\Components\Buttons\InputButton;
use TYPO3\CMS\Backend\Template\Components\Buttons\LinkButton;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
@dmitryd
dmitryd / replace.sh
Created August 11, 2019 08:34
Replace git email in all subdirectories
#!/usr/bin/env bash
for f in `grep -Rl --include=config '[email protected]' .` ; do sed -i 's/[email protected]/[email protected]/' "$f" ; done
<?php
namespace Vendor\Extension\Storage;
use TYPO3\CMS\Extbase\Persistence\Generic\Qom\SourceInterface;
use TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser;
/**
* This class allows ordering by 'FIELD' SQL statement.
*
* @author Dmitry Dulepov <[email protected]>
@dmitryd
dmitryd / composer-toggle-swap.sh
Created December 14, 2018 09:06
Toggles swap for the composer on Linux
#/bin/bash
# Must be run as root!
# Source: https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors
if [ -f /var/swap.1 ] ; then
/sbin/swapoff /var/swap.1
rm /var/swap.1
echo "Swap is off"
else
@dmitryd
dmitryd / validate-yaml.txt
Last active February 8, 2022 10:15
Validate YAML file using Python one-liner
python -c 'import yaml,sys;yaml.safe_load(sys.stdin)' < file.yml
Needs "pip install pyyaml".
Source: https://liquidat.wordpress.com/2016/01/21/short-tip-verify-yaml-in-shell-via-python-one-liner/
@dmitryd
dmitryd / Dockerfile
Created June 27, 2017 07:41
Dockerfile for mkpasswd. This fixes a problem when no suitable mkpasswd is available on OS X that can do sha-512 method.
#
# In ~/.profile: alias "mkpasswd=docker run -i -t mkpasswd"
#
FROM debian:stretch
RUN apt-get update && apt-get install -y --no-install-recommends --no-install-suggests whois
CMD ["/usr/bin/mkpasswd", "-m", "sha-512"]
@dmitryd
dmitryd / FormConverterService.php
Last active July 12, 2016 15:36
Fix Powermail convertor for records with sys_language_uid>0 and l18n_parent=0
<?php
namespace DmitryDulepov\PowermailConversionFix\Xclass;
/***************************************************************
* Copyright notice
*
* (c) 2016 Dmity Dulepov <[email protected]>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
@dmitryd
dmitryd / renderImage.ts
Last active October 14, 2015 11:52
Render image reference from page properties with TypoScript (TYPO3 CMS)
ogimageNoSlide = FILES
ogimageNoSlide {
references {
table = pages
uid.data = page:uid
fieldName = ogimage
}
maxItems = 1
renderObj = TEXT
renderObj {
@dmitryd
dmitryd / set_enviroment_variable_per_dir_in_bash.sh
Last active October 12, 2015 16:31
This little shell function allows to set environment variables when you cd into that directory.
# Note: this is just a fragment that you should put in your ~/.bash_profile
# Tested on Mac only!
#
# If you want a more sophisticated and feature rich solution here are some pointers:
# - https://github.com/cxreg/smartcd
# - http://swapoff.org/ondir.html
function cd_ {
if [ -e .env_off ] ; then
. .env_off
@dmitryd
dmitryd / lj-selfie.html
Created September 18, 2015 08:55
LJ: Show a userpic of the current viewer to him in the comment
<lj-userpic remote="remote" />