Skip to content

Instantly share code, notes, and snippets.

View mneuhaus's full-sized avatar

Marc Neuhaus mneuhaus

View GitHub Profile
@mneuhaus
mneuhaus / 0_reuse_code.js
Created October 2, 2013 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mneuhaus
mneuhaus / FooController.php
Created October 2, 2013 14:18
TYPO3 CMS Frontend Plugin
<?php
namespace Company\ExtensionName\Controller;
/***************************************************************
* Copyright notice
*
* (c) 2013 Marc Neuhaus <apocalip@gmail.com>, Famelo OHG
*
* All rights reserved
*
<f:for each="{results}" as="result">
{result.foo}
<f:else>No results found</f:else>
</f:for>
vs
<f:if condition="{results}">
<f:then>
No results found
<?php
namespace TYPO3\Expose\TypoScriptObjects;
/* *
* This script belongs to the TYPO3 Flow package "TYPO3.Expose". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License, either version 3 *
* of the License, or (at your option) any later version. *
* *
TYPO3:
TypoScript:
handleRenderingExceptions: throw
<?php
namespace TYPO3\Expose\ViewHelpers;
/* *
* This script belongs to the TYPO3 Flow package "TYPO3.Expose". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License, either version 3 *
* of the License, or (at your option) any later version. *
* *
@mneuhaus
mneuhaus / Idea.md
Created November 12, 2013 13:12
Database Data Versioning

Prolog

one issue that regularily occurs to me in a development project is how to keep in sync with the database. This is often no problem if you develop it yourself, alone. But if you're developing a project with more than one person the generally accepted best practice is to develop locally, commit changes and then deploy to the testing/staging/production. This is all and well with code of course. But keeping the database in sync is quite a hassle sometimes. Most systems provide at least schema-migrations or other means of analysing + patching the database. But what about the data itself? Currently there are 2-3 Scenarios that you could do:

  • develop locally and regularily dump the production database and import it locally
    • pro: fast project because everything is local and easily to develop
    • con: you regularily get out of sync and need to redo stuff manually or override the database
  • open up the production/staging database and let every local developer use that
  • pro: everyone uses the same dat
// farben
@white: #f2f2f2;
@regwhite: #ffffff;
@brown: #4c4238;
@darkbrown: #353029;
@beige: #b4a188;
@blue: #006cba;
// defaults
<article <?php post_class(); ?>>
<div class="row">
<div class="col-xs-3">
<?php
if (get_the_post_thumbnail()) {
echo get_the_post_thumbnail($post_id, 'news-thumbnail', array('class' => 'img-responsive'));
} else {
echo 'kein thumbnail vorhanden';
}
?>
@mneuhaus
mneuhaus / gist:8319106
Created January 8, 2014 16:01
Little function to safely concatenate some paths easily
<?php
function path() {
$paths = func_get_args();
$prefix = '';
$suffix = '';
if (substr(current($paths), 0, 1) == DIRECTORY_SEPARATOR) {
$prefix = DIRECTORY_SEPARATOR;
}