Skip to content

Instantly share code, notes, and snippets.

From 0629f85aa04c1c2d4bde345f55fa3b0aa1e0d0db Mon Sep 17 00:00:00 2001
From: lerni <lukas@lerni.ch>
Date: Mon, 7 Nov 2016 20:59:29 +0100
Subject: [PATCH] fix italian language-file
---
lang/it.yml | 30 ++----------------------------
1 file changed, 2 insertions(+), 28 deletions(-)
diff --git a/lang/it.yml b/lang/it.yml
@lerni
lerni / config.yml
Last active November 16, 2016 13:55
workaround UploadField iframe incorrect height - https://github.com/silverstripe/silverstripe-framework/issues/2862
LeftAndMain:
extra_requirements_javascript:
- mysite/javascript/fixUploadField.js
@lerni
lerni / .gitignore
Last active January 22, 2020 22:21
deploy SilverStripe with PHP-Deployer per git-repo
# ignore everything...
/*
# ...but
# htaccess is ignored since we have a different versions for each stage see in /deploy
!/.gitignore
!/composer.json
!/composer.lock
!/.editorconfig
!/README.md
@lerni
lerni / FixedImagickBackend.php
Created June 14, 2017 15:25
SilverStripe Imagick high quality and low file size
<?php
// smart defaults for high quality and low file size
// https://github.com/nwtn/php-respimg/blob/master/src/Respimg.php#L235
// ---
// Only:
// classexists: 'Imagick'
// ---
// Image:
// backend: 'FixedImagickBackend'
// ImagickBackend:
// this script loads the YouTube iframe-api, gets all instances and adds enablejsapi & origin-URL to the src-URL
// after initiating the API it adds playing-mode & paused-mode to the iframes
if ($('[src^="https://www.youtube.com/"]').length) {
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
}
diff --git a/core/TempPath.php b/core/TempPath.php
index 88979ba..4f3a94c 100644
--- a/core/TempPath.php
+++ b/core/TempPath.php
@@ -11,8 +11,9 @@
function getTempFolder($base = null) {
$parent = getTempParentFolder($base);
- // The actual temp folder is a subfolder of getTempParentFolder(), named by username
- $subfolder = $parent . DIRECTORY_SEPARATOR . getTempFolderUsername();
@lerni
lerni / UniqueTextField
Last active February 22, 2018 12:14
UniqueTextField SilverStripe
<?php
class UniqueTextField extends TextField {
public function Type() {
return 'unique text';
}
protected $restrictedTable;
protected $restrictedField;
@lerni
lerni / gist:1a97635a97ca12a4ee78c10a95218382
Created July 12, 2018 08:02
Focuspoint in tandem with "object-fit" & "object-position"
<!-- FocusPoint can also be used in tandem with css-settings "object-fit" & "object-position". For example useful for a fullscreen-hero, when you don't know how the aspect-ratio of the viewport might look. The example below shows a portrait-, landscape, or 4:3 "square" image depending on the aspect-ratio it is shown. Even if the general rule is not to relay, which picture the browser might pick from the picture-element, it seems to work pretty well. Or in other words: pseudo media-queries in picture-element und css-media query match in praxis pretty well. -->
<picture>
<%-- 8:5 is like macbook pro display--%>
<source media="(min-width: 640px) and (min-aspect-ratio: 8/5)"
srcset="$SlideImage.FocusFillMax(640,400).URL 640w">
<%-- 5:8 is portrait --%>
<source media="(min-width: 400px) and (max-aspect-ratio: 5/8)"
srcset="$SlideImage.FocusFillMax(400,640).URL 720w">
<%-- 4:3 say desktop --%>
<source media="(min-width: 640px) and (min-aspect-ratio: 4/3)"
diff --git a/model/connect/MySQLDatabase.php b/model/connect/MySQLDatabase.php
index f0628e4..db011c4 100644
--- a/model/connect/MySQLDatabase.php
+++ b/model/connect/MySQLDatabase.php
@@ -42,7 +42,7 @@ class MySQLDatabase extends SS_Database {
$this->connector->connect($parameters);
// This is important!
- $this->setSQLMode('ANSI');
+ $this->setSQLMode('REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE');
diff --git a/view/Requirements.php b/view/Requirements.php
index a39d0e998..d7004b9a8 100644
--- a/view/Requirements.php
+++ b/view/Requirements.php
@@ -419,6 +419,13 @@ class Requirements implements Flushable {
return self::backend()->debug();
}
+ /**
+ * Output ld+json