Skip to content

Instantly share code, notes, and snippets.

@michaelklapper
michaelklapper / gist:5900227
Created July 1, 2013 11:59
SSH-Tunnel: Setup your SSH Client to forward the port to your machine:
ssh -R 9000:127.0.0.1:9000 user@yourserver.tdl
@michaelklapper
michaelklapper / MigrateCommand.php
Created June 2, 2013 11:43
Get all classes that inherit from class xy
$classes = array_filter(get_declared_classes(), function($class){
return get_parent_class($class) === 'Morphodo\Environment\Settings\Handler\AbstractHandler';
});
@michaelklapper
michaelklapper / Set up a mirror for TYPO3 CMS.sh
Last active December 17, 2015 22:49
Create a mirror including some notes about how to manage custom branches additionally.
git clone --mirror git://git.typo3.org/Packages/TYPO3.CMS.git
git remote add github git@github.com:michaelklapper/TYPO3.CMS.git
git push git@github.com:michaelklapper/TYPO3.CMS.git
git remote update
git push git@github.com:michaelklapper/TYPO3.CMS.git
git checkout -b morphodo/TYPO3_4-7/4-7-12 TYPO3_4-7-12
// add changes
git push origin morphodo/TYPO3_4-7/4-7-12

stopBefore.js

2min screencast

Examples

stopBefore(document, 'getElementById')
stopBefore('document.getElementById') // the same as the previous
stopBefore(Element.prototype, 'removeChild')
@michaelklapper
michaelklapper / renameFileAndContent.sh
Created April 16, 2013 18:07
- Replace all occurence of "production" with "staging" within the files mathing the patter "deployment_bosch-intranet_production*" - Rename the file from *production* into *staging*
for file in $(ls deployment_bosch-intranet_production*); do
sed -i 's/production/staging/g' ${file};
mv ${file} ${file/production/staging};
done
@michaelklapper
michaelklapper / .htaccess
Created April 14, 2013 10:31
404 optimization - and stop processing rewrites if one of those files are requested.
# Don't do any further rewrite for following file types (404 optimization)
RewriteRule \.(css|js|png|jpg|jpeg|gif|ico|ttf|otf|svg|eot|woff|avi|mov|mp4|wmf|pdf|doc|docx|xls|xlsx)$ - [NC,L]
@michaelklapper
michaelklapper / .htaccess
Last active December 16, 2015 05:09
Browser language detection ==================== This is a simple rewrite to detect Browser language and redirect to a root page depending on the language setting.
## If the user has a browser with german language
## and visits the root page
## than redirect to the german default startpage: http://www.HOST.com/de/produkte.html
RewriteCond %{HTTP:Accept-Language} ^de.*$ [NC]
RewriteRule ^$ http://%{HTTP_HOST}/de/produkte.html [L,R=302]
## If the user has a browser with a non german language
## and visits the root page
## than redirect to the english default startpage: http://www.HOST.com/en/products.html
RewriteCond %{HTTP:Accept-Language} !^de.*$ [NC]
@michaelklapper
michaelklapper / gist:5318154
Created April 5, 2013 10:06
Simulate REST-API call via curl
curl -i -X POST -H 'Content-Type: application/json' -d '{"product": "123,124", "docId": "1", "description": "test description", "file": {"data": "VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==", "filename": "filename.txt"}, "contentType": "TD_BA", "lifecycleProduct": "asdasf", "name": "test", "language": "0", "title": "test title", "author": "author name", "modified": "1364375700", "externalProduct": "1"}' www.domain.de/index.php?id=1634
##################################################
# Background Images
#
lib.misc.background {
page = FILES
page {
references {
wget http://xdebug.org/files/xdebug-2.2.1.tgz
tar -xzvf xdebug-2.2.1.tgz
cd xdebug-2.2.1
phpize
./configure --enable-xdebug
sudo make
sudo make install
sudo service apache2 restart