Skip to content

Instantly share code, notes, and snippets.

Avatar

Jens Wittmann – Gestaltung & Entwicklung jenswittmann

View GitHub Profile
@jenswittmann
jenswittmann / gist:6346133
Last active Dec 21, 2015
Looking for responsive embed Videos? Hier is the CSS only trick. You only have to remove width/height in the <iframe> tag. Thanks to www.andmag.se/2011/11/responsive-embeds
View gist:6346133
.embed {
position: relative;
overflow: hidden;
height: 0;
padding-bottom: 56.25%; /* 16/9 ratio */
padding-top: 30px; /* IE6 workaround*/
iframe {
position: absolute;
top: 0;
@jenswittmann
jenswittmann / gist:6346337
Created Aug 26, 2013
Um das Datum unter MODx Revolution korrekt auszugeben, musst du die folgende Einstellung unter "Systemeinstellungen" vornehmen, damit Umlaute korrekt dargestellt werden.
View gist:6346337
Locale locale de_DE.UTF-8
View gist:1104418adf3720b72c10
// CSS
#wrapper-app {
overflow: auto;
width: 100%;
height: 100%;
-webkit-overflow-scrolling: touch;
}
// HTML
...
View redactorReplace
<?php
$o = $input;
// replace inline css
$o = preg_replace('/(<[^>]+) style=".*"/iU', '$1', $o);
// remove paragraph around img and iframe
$o = preg_replace('/<p>\s*(<img.*>)\s*<\/p>/iU', '$1', $o);
$o = preg_replace('/<p>\s*(<iframe.*>\s*<\/iframe>)\s*<\/p>/iU', '$1', $o);
@jenswittmann
jenswittmann / secure-headers.php
Created Dec 4, 2016
MODX secure http headers
View secure-headers.php
header("X-Content-Type-Options: nosniff");
header("X-XSS-Protection: 1; mode=block");
header("X-Frame-Options: SAMEORIGIN");
header("Connection: keep-alive");
header("ETag: ");
header("Content-Security-Policy: base-uri https://nixlos.de; default-src https:; script-src https: 'unsafe-inline' 'unsafe-eval'; style-src https: 'unsafe-inline'; child-src https://nixlos.de");
@jenswittmann
jenswittmann / gist:8ebf882e956c89976fd4dfe2a32a7f37
Created Apr 4, 2017
SSH Kommandos zur Sicherung von MODX Evolution auf all-Inkl.com
View gist:8ebf882e956c89976fd4dfe2a32a7f37
find -type d -exec /bin/chmod 755 {} \;
find -type f -exec /bin/chmod 644 {} \;
find -type f -name "*.php*" -exec /bin/chmod 600 {} \;
@jenswittmann
jenswittmann / collections.imageplus.js
Created Jul 31, 2018
Custom MODX Collections renderer for Image+ with cropping
View collections.imageplus.js
collections.renderer.imageplus = function(value, metaData, record, rowIndex, colIndex, store) {
if (value != '' && value != null) {
var data = Ext.decode(value);
var url = MODx.config.connectors_url + 'system/phpthumb.php?imageplus=1';
var params = {};
params.src = 'upload/'+MODx.config['collections.renderer_image_path'] + data.sourceImg.src;
params.w = 100;
if (data.sourceImg.src.indexOf('.png') !== -1) {
params.f = 'png';
@jenswittmann
jenswittmann / collections.custom.js
Created Aug 1, 2018
MODX Collections update TV from grid
View collections.custom.js
collections.combo.TVNAME = function(config) {
config = config || {};
Ext.applyIf(config,{
store: new Ext.data.SimpleStore({
fields: ['v']
,data: [
['val1'],
['val2'],
['val3']
]
@jenswittmann
jenswittmann / gist:97bc2e295bac7d2619ed4505641bed52
Created Dec 26, 2018
Use MODX BabelLinks snippet for canonical Metatags
View gist:97bc2e295bac7d2619ed4505641bed52
# add snippet into <head>
[[BabelLinks?
&tpl=`babelCanonicalTag`
&showCurrent=`1` ]]
# create chunk with name babelCanonicalTag
<link rel="alternate" hreflang="[[+cultureKey]]" href="[[+url]]">
@jenswittmann
jenswittmann / fluid-base-rem
Last active Apr 14, 2020
Set font-size for <html> proportional for scalling everything with rem.
View fluid-base-rem
<!--
$basePxFor1rem = 16;
$baseDesignWidthFromAdobeXD = 1920;
$baseFontSize = 100 * $basePxFor1rem / $baseDesignWidthFromAdobeXD;
Result: .833333333333333vw;
-->
<style>
html {
font-size: .833333333333333vw;