Skip to content

Instantly share code, notes, and snippets.

@Xatenev
Xatenev / extbase_cache_clear.sql
Created November 6, 2014 08:54
Extbase - clear cache
TRUNCATE `cf_cache_hash`;
TRUNCATE `cf_cache_hash_tags`;
TRUNCATE `cf_cache_pages`;
TRUNCATE `cf_cache_pagesection`;
TRUNCATE `cf_cache_pagesection_tags`;
TRUNCATE `cf_cache_pages_tags`;
TRUNCATE `cf_cache_rootline`;
TRUNCATE `cf_extbase_datamapfactory_datamap`;
TRUNCATE `cf_extbase_datamapfactory_datamap_tags`;
TRUNCATE `cf_extbase_object`;
@Xatenev
Xatenev / LinkViewHelper.php
Created November 6, 2014 10:58
Link View Helper to create edit + new buttons in t3 backend module
<?php
namespace Vendor\Ext\ViewHelpers\Form;
use Vendor\Ext\ViewHelpers\Misc\RequestViewHelper;
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder;
/***************************************************************
* Copyright notice
*
* (c) 2014 Johannes Hertenstein
@Xatenev
Xatenev / Terminal
Created November 7, 2014 17:29
Symfony2 assets symlink
php app/console assets:install --symlink web
# Creates symlink instead of copying all assets.
@Xatenev
Xatenev / file.js
Created March 27, 2015 14:02
jQuery Query String
(function($) {
$.QueryString = (function(a) {
if (a == "") return {};
var b = {};
for (var i = 0; i < a.length; ++i)
{
var p=a[i].split('=');
if (p.length != 2) continue;
b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
}
@Xatenev
Xatenev / typo3.rb
Created March 27, 2015 14:03
TYPO3 Cache Clear Script
set :typo3_maindir, '/html/typo3/'
set :php_cli, '/usr/local/bin/php_cli'
task :typo3_flushcache do
queue %[echo "------> TYPO3: flushing cache"];
queue %[cd #{typo3_maindir} && rm -R typo3temp/*];
queue %[
cd #{typo3_maindir} && #{php_cli} -r '
$GLOBALS["TYPO3_CONF_VARS"] = require(dirname(__FILE__)."/typo3conf/LocalConfiguration.php");
$ac = dirname(__FILE__)."/typo3conf/AdditionalConfiguration.php";
if(file_exists($ac)){
@Xatenev
Xatenev / index.php
Created April 23, 2015 15:36
Array 1 holds keys which are allowed in Array 2.
foreach($articles->category->devices as $device) { // Iterate through all objects
foreach ($device as $key => $value) { // Iterate through all properties
if (!in_array($key, $allowedFields)) { // Find property in pre-defined array with the properties which are allowed for this object
unset($device->$key); // unset the properties which doesn't match the array
}
}
}
@Xatenev
Xatenev / whoincludedthisfile.php
Created May 13, 2015 14:46
WhoIncludedThisFile
function whoIncludedThisFile() {
$bt = debug_backtrace();
$includedMe = false;
while (count($bt) > 0) {
$set = array_shift($bt);
if (
array_key_exists('function', $set) === true &&
in_array($set['function'], array('require', 'require_once', 'include', 'include_once'))
){
$includedMe = array('file'=>$set['file'], 'line'=>$set['line']);
@Xatenev
Xatenev / index.php
Created July 15, 2015 12:53
Weird PHP stuff gg
$downloadFields = explode(',', $this->settings['download']['fields']);
$contactFields = explode(',', $this->settings['contact']['fields']);
$fields = array();
foreach($downloadFields as $field) {
$fields[] = array(
'field' => trim($field),
'type' => 'download'
);
}
foreach($contactFields as $field) {
$args = array(
'orderby' => 'title',
'order' => 'ASC',
);
$wp_query = new WP_Query($args); ?>
@Xatenev
Xatenev / example.txt
Created February 25, 2016 10:40
Example Problem
Input
Array1 = [1,2]
Array2 = [3,4]
Output
Array3 = [1,2,3,4]
Code
Array3 = Array1.concat(Array2);