Skip to content

Instantly share code, notes, and snippets.

View robbanl's full-sized avatar

Robert robbanl

  • Codepeak AB
  • Sweden
View GitHub Profile
@robbanl
robbanl / magento2.xml
Created May 14, 2020 07:36 — forked from philbirnie/magento2.xml
Magento 2 Code Styles for PHPStorm
<code_scheme name="Magento 2" version="173">
<PHPCodeStyleSettings>
<option name="ALIGN_KEY_VALUE_PAIRS" value="true" />
<option name="ALIGN_PHPDOC_PARAM_NAMES" value="true" />
<option name="ALIGN_PHPDOC_COMMENTS" value="true" />
<option name="ALIGN_ASSIGNMENTS" value="true" />
<option name="PHPDOC_BLANK_LINES_AROUND_PARAMETERS" value="true" />
<option name="PHPDOC_WRAP_LONG_LINES" value="true" />
<option name="LOWER_CASE_BOOLEAN_CONST" value="true" />
<option name="LOWER_CASE_NULL_CONST" value="true" />
@robbanl
robbanl / dex.sh
Last active April 6, 2018 06:17
Quick Docker Exec to bash
#!/bin/sh
# Feel free to create a bash alias to this file or place it in /usr/local/bin
#
# Usage: dex php to run "bash" in interactive mode on any container that contains php in it's name
CONTAINER="$(docker ps -f name=$1 | sed -n 2p)"
CONTAINER_NAME=`echo $CONTAINER | awk '{ print $NF }'`
# Make sure some argument is set
<?php
class Myentity {
/* ... */
/**
* @ORM\Column(name="created_at", type="datetime")
*/
private $createdAt;
@robbanl
robbanl / foo.php
Last active August 29, 2015 14:13
PHP bug with opendir-function
<?php
/**
* This is tested with PHP 5.3.10 (Ubuntu), 5.5.14 (OS X) 5.5.9 (Ubuntu).
* Instead of opendir-function you should use "DirectoryIterator" class.
*
* Save the file in /tmp/foo.php and create the following folders
*
* mkdir -p /tmp/1/2/3
* touch /tmp/1/2/3/first
<?php echo $this->getLayout()
->createBlock('cms/block')
->setBlockId('my_static_block_id')
->toHtml();
?>
@robbanl
robbanl / gist:1616491
Created January 15, 2012 17:18
Fix for problems with CodeIgniter and "facebook-ignited"
$url = parse_url($_SERVER['REQUEST_URI']);
if (isset($url['query'])) {
parse_str($url['query'], $params);
if (isset($params['session'])) {
$_GET['session'] = $params['session'];
$_REQUEST['session'] = $params['session'];
}
foreach ($params as $key => $value) {
$_GET[$key] = $value;
$_REQUEST[$key] = $value;
@robbanl
robbanl / TranslateMagentoModule.php
Created December 14, 2011 10:29
Get translatable strings for Magento modules
<?php
/**
* Get translatable strings for Magento modules
*
* Tested on Mac & Linux
*
* Usage:
*
* 1. Change the $path variable to where your module is located
* 2. php TranslateMagentoModule.php