Skip to content

Instantly share code, notes, and snippets.

View richardhj's full-sized avatar

Richard Henkenjohann richardhj

  • Potsdam, Germany
View GitHub Profile
@richardhj
richardhj / deploy.php
Created October 30, 2019 12:07
Deployer (Contao deployment) with scp instead of rsync
<?php
namespace Deployer;
$recipes = [
'common',
'symfony',
'terminal42/deployer-recipes/recipe/contao',
'terminal42/deployer-recipes/recipe/database',
@richardhj
richardhj / pre-commit
Created December 13, 2017 22:10
Hook for a git repository to add the current database dump to each commit
#!/bin/sh
#
# Creates a database dump right before committing and adds it to
# the commit. The database dump is splitted in two sql files, to
# the schema and data of the database.
#
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
@richardhj
richardhj / event_listeners.php
Last active November 29, 2017 10:59
Event Listeners MetaModels Contao Frontend Editing Permission Owner
<?php
use ContaoCommunityAlliance\DcGeneral\Event\PreEditModelEvent;
use ContaoCommunityAlliance\DcGeneral\Event\PrePersistModelEvent;
// Copy-replace following vars:
// 'mm_employee'
// 'owner'
return [
@richardhj
richardhj / jQuery.modal-editing.js
Created October 22, 2017 14:52
jQuery modal editing
/* ModalEditing, (c) 2016-2017 Richard Henkenjohann */
(function ($) {
$.fn.modalEditing = function (options) {
options = $.extend({
/**
* The container
*
* @var null|string The selector, e.g. #id or .class
*/
<?php
class DropboxWebhook
{
/**
* Handle the dropbox webhook request
*/
public function handle()
{
global $container;
<?php
/**
* Exemplified DCA for a merging a fileTree and fileUpload field in Contao Open Source CMS
* * Files can be via selected in the field "attachments"
* * Files can be uploaded in the field "attachments_upload". They will be merged to "attachments"
*
* @author Richard Henkenjohann <richardhenkenjohann@googlemail.com>
*/
$table = MyModuleModel::getTable();
<?php
/**
* Exemplified DCA config for a password field for Contao Open Source CMS
* The password will be
* * saved encrypted in the database ('encrypt'=>true),
* * invisibe when typing in the input ('hideInput'=>true) and
* * not readable in the html source code after it was saved initially (load_ and save_callback).
*
* @author Richard Henkenjohann <richardhenkenjohann@googlemail.com>
*/
@richardhj
richardhj / install.php
Last active June 9, 2016 06:34
Extract the contao zip archive with this script.
<?php
/**
* PHP version 5
*
* Extracts the Contao archive (downloaded from contao.org) and redirects to the install tool.
*
* Usage:
* * Upload this file and the Contao archive in the desired folder
* * Run this script