Skip to content

Instantly share code, notes, and snippets.

View mneuhaus's full-sized avatar

Marc Neuhaus mneuhaus

View GitHub Profile
Even though it is done a lot (we have caught ourselves here) it is really bad practice to have "delete" links in an application.
Per definition crawlers (including search engines) are allowed to follow links and the only reason that this doesn't end up in loss of data, is because those delete links are usually behind a login.. but imagine a delete link on a wiki.
Following the notion of "safe requests" will us allow to do great optimizations in the future such as:
* Running persistence in "readonly" mode for GET
* Partly disable validation for GET
* No CSRF hassle
* *Smarter caching* of GET requests
TYPO3:
Flow:
persistence:
backendOptions:
host: %PAAS_HOST%
dbname: %PAAS_DB%
user: %PAAS_USER%
password: %PAAS_PASSWORD%
@mneuhaus
mneuhaus / helper.patch
Created June 11, 2013 11:35
the parent class gets currently attached even if the submenu isn't configured to be shown. This breaks the menu on ipads, because the links with the parent class get rewritten to the void(0) function.
--- a/helper.php
+++ b/helper.php
@@ -149,7 +149,7 @@
$item->classe .= ' deeper';
}
- if ($item->parent) {
+ if ($item->parent && $item->level != $end) {
if ($params->get('layout', 'default') != '_:flatlist' && $item->level != $end)
$item->classe .= ' parent';
-
name: 'Home'
uriPattern: ''
defaults:
'@package': 'Famelo.Brain'
'@controller': 'Standard'
'@action': 'index'
'@format': 'html'
appendExceedingArguments: true
-
requestFilter: 'isPackage("Package1.Features")'
options:
layoutRootPathPattern: resource://Famelo.ADU/Private/Layouts/
templatePathAndFilename: resource://Famelo.ADU/Private/Templates/Features/Index.html
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
window.onresize = function(){
var agent = navigator.userAgent;
var current_width = window.innerWidth;
var html = document.getElementsByTagName('html')[0];
if (agent.match(/Android.*Mobile|BlackBerry|iPhone|iPod|Opera Mini|IEMobile/i)) {
<?php
/**
* @Flow\Inject
* @var \TYPO3\Flow\Mvc\Routing\Router
*/
protected $router;
function getRoute($request) {
$this->router->route($request->getHttpRequest());
$route = $this->router->getLastMatchedRoute();
@mneuhaus
mneuhaus / Uploads.html
Created September 26, 2013 13:42
This is a little "hack" i used recently to render the default Uploads Content element using Fluid instead of TypoScript
<ul class="list-group">
<f:for each="{files}" as="file">
<li class="list-group-item">
<a href="{file.publicUrl}" >
<img src="typo3/gfx/fileicons/{file.extension}.gif" />
{file.name}
</a>
</li>
</f:for>
</ul>
@mneuhaus
mneuhaus / gist:6714516
Created September 26, 2013 13:51
don't you hate navigation the commandline by cd .. ? here are a few shorter aliases for jumping back:
alias ..='cd ../../'
alias ...='cd ../../../'
alias ....='cd ../../../../'
alias .....='cd ../../../../../'
alias ......='cd ../../../../../../'