Skip to content

Instantly share code, notes, and snippets.

Avatar

Robert robbanl

  • Codepeak AB
  • Sweden
View GitHub Profile
@robbanl
robbanl / magento2.xml
Created May 14, 2020 — forked from philbirnie/magento2.xml
Magento 2 Code Styles for PHPStorm
View magento2.xml
<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 / TranslateMagentoModule.php
Created Dec 14, 2011
Get translatable strings for Magento modules
View TranslateMagentoModule.php
<?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
@robbanl
robbanl / dex.sh
Last active Apr 6, 2018
Quick Docker Exec to bash
View dex.sh
#!/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
View gist:6997630
<?php echo $this->getLayout()
->createBlock('cms/block')
->setBlockId('my_static_block_id')
->toHtml();
?>
@robbanl
robbanl / gist:1616491
Created Jan 15, 2012
Fix for problems with CodeIgniter and "facebook-ignited"
View gist:1616491
$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;
View gist:c5b6511e93d663c137ab
<?php
class Myentity {
/* ... */
/**
* @ORM\Column(name="created_at", type="datetime")
*/
private $createdAt;
@robbanl
robbanl / foo.php
Last active Aug 29, 2015
PHP bug with opendir-function
View foo.php
<?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