Skip to content

Instantly share code, notes, and snippets.

@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 / .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 / 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

stopBefore.js

2min screencast

Examples

stopBefore(document, 'getElementById')
stopBefore('document.getElementById') // the same as the previous
stopBefore(Element.prototype, 'removeChild')
@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
@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 / 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 / add_solr_document.sh
Created July 2, 2013 13:45
Solr: Create new document with curl
curl http://localhost:8095/solr/test/update --data-binary '<add><doc><field name="id">1</field><field name="type">website</field><field name="appKey">indexer</field><field name="title">My product</field><field name="price_mz_f">49.99</field><field name="price_fr_f">43.99</field><field name="price_st_f">23.99</field></doc></add>' -H 'Content-type:text/xml; charset=utf-8'
@michaelklapper
michaelklapper / phpstorm_enable_debugging.sh
Created July 2, 2013 14:09
phpstorm enable command line debugging
export XDEBUG_CONFIG="idekey=PHPSTORM remote_port=9000"
export SERVER_NAME=sandbox