Skip to content

Instantly share code, notes, and snippets.

View jaguerra's full-sized avatar

Jose Antonio Guerra jaguerra

  • Madrid
View GitHub Profile
@jaguerra
jaguerra / check.sql
Created March 30, 2015 08:24
Check and migrate all HTML cObjects from the database while upgrading to TYPO3 CMS 6.2
SELECT sys_template.config, REPLACE(config, ' HTML', ' TEXT')
FROM `sys_template`
INNER JOIN pages ON pages.uid = sys_template.pid
WHERE `config` REGEXP BINARY 'HTML'
AND sys_template.deleted = 0 AND sys_template.pid >= '0'
AND pages.deleted = 0
git status --porcelain | awk '($1 ~ /\?\?/) {print "/" $2}' >> .gitignore
@jaguerra
jaguerra / Some_Controller.php
Created July 10, 2012 09:19
TYPO3 Extbase: Trying to set defaultPid for actions/controllers/plugins not in the current action
protected function setDestinationPidForAction($pid, $actionName, $controllerName = null, $extensionName = null){
if($extensionName === null){
$extensionName = $this->extensionName;
}
if($controllerName === null){
$controllerName = $this->request->getControllerName();
}
$pluginName = Tx_Extbase_Utility_Extension::getPluginNameByAction($extensionName, $controllerName, $actionName);
$frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, $extensionName, $pluginName);
@jaguerra
jaguerra / resize.sh
Created July 27, 2012 07:47
SH Resize JPG files with size > 1 Mb
#!/bin/bash
find . -name '*.jpg' -type f -size +1M -not -name '*backup*' | while read filename
do
if [ ! -e "$filename.backup.jpg" ]
then
echo "Backup of $filename.backup.jpg"
cp "$filename" "$filename.backup.jpg"
fi
echo "Limpiando datos de perfil $filename"
gm identify "$filename"
@jaguerra
jaguerra / MyCommandController.php
Last active October 15, 2015 08:25
Execute CLI extbase CommandController as an admin user
<?php
namespace My\MyExtension\Command;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class MyCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\CommandController {
/**
* Make _cli_lowlevel admin for this controller...
*/
@jaguerra
jaguerra / fix-double-encoding.sh
Last active December 10, 2015 10:18
Fix double encoded utf-8 in mysql
#!/bin/bash -e
DB_HOST="$1"
DB_USER="$2"
DB_PASSWORD="$3"
DB_NAME="$4"
mysqldump -h "$DB_HOST" -u "$DB_USER" -p"$DB_PASSWORD" --opt --quote-names \
--skip-set-charset --default-character-set=latin1 "$DB_NAME" > /tmp/temp.sql
@jaguerra
jaguerra / pre-commit
Created April 15, 2013 15:04
Git pre-commit hook to launch rake
#!/bin/bash
# Adapted from http://jimneath.org/2012/05/05/precompile-assets-using-a-git-hook.html
# source rvm and .rvmrc if present
[ -s "$HOME/.rvm/scripts/rvm" ] && . "$HOME/.rvm/scripts/rvm"
[ -s "$PWD/.rvmrc" ] && . "$PWD/.rvmrc"
# precompile assets if any have been updated
if git diff-index --name-only HEAD | egrep '^css/sass' >/dev/null ; then
@jaguerra
jaguerra / SomeRepository.php
Created May 7, 2013 15:45
RAW result query on Extbase
<?php
function findRaw(){
$localQuery = $this->createQuery();
$storagePageIds = $localQuery->getQuerySettings()->getStoragePageIds();
$querySettings = $localQuery->getQuerySettings();
$querySettings->setReturnRawQueryResult(TRUE);
$localQuery->setQuerySettings( $querySettings );
@jaguerra
jaguerra / pageTSConfig.ts
Created April 24, 2013 17:24
TYPO3 RTE htmlarea allow iframe, script and html5 data attributes
#
# Permitir iframe, embed, script en RTE
#
RTE.default.proc.allowTags := addToList(iframe,embed,script,object,param,a,ul,li,ol)
RTE.default.proc.allowTagsOutside := addToList(iframe,embed,script,object,param,a,ul,li,ol)
RTE.default.removeTagsAndContents := removeFromList(script,object,param,a,ul,li,ol)
RTE.default.proc.HTMLparser_db = 0
RTE.default.proc.entryHTMLparser_db = 0
RTE.default.proc.exitHTMLparser_db = 0
@jaguerra
jaguerra / css2scss.sh
Last active October 24, 2017 09:47
Many CSS 2 LESS (or SCSS)
#!/bin/bash
find . -name '*.css' -type f | while read fullfilename
do
filename=`basename $fullfilename`
extension="${filename##*.}"
filename="${filename%.*}"
echo "Converting $fullfilename"
sass-convert -T scss --indent t -C $fullfilename > sass/_$filename.scss
done