Skip to content

Instantly share code, notes, and snippets.

@ptaferner
ptaferner / live_template.xml
Created Jan 16, 2016
Phpstorm: Generate pimcore translation
View live_template.xml
<template name="trans" value="&lt;?= $this-&gt;t('$TXT$') ?&gt;" description="Generate pimcore translation" toReformat="true" toShortenFQNames="true">
<variable name="TXT" expression="clipboard()" defaultValue="" alwaysStopAt="true" />
<context>
<option name="HTML_TEXT" value="true" />
<option name="HTML" value="true" />
</context>
</template>
@ptaferner
ptaferner / icon-install.md
Last active Dec 17, 2015
Create a desktop icon in Linux Mint
View icon-install.md
  1. sudo vim /usr/share/applications/YOUR-APP.desktop

  2. copy paste the following lines

[Desktop Entry]

Encoding=UTF-8

Exec=/path/to/your/application

@ptaferner
ptaferner / pretty-data-cmd
Created Nov 30, 2015
CLI script for node modules
View pretty-data-cmd
#!/usr/bin/env node
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(data) {
var pd = require('pretty-data').pd;
var xml_min = pd.xmlmin(data,true);
process.stdout.write(xml_min);
});
@ptaferner
ptaferner / conditional.xml
Last active Nov 27, 2015
In case you want non-XML-conform HTML markup based on a condition, use a construct like this:
View conditional.xml
<b:if cond='data:index in {2, 5}'>
&lt;/div&gt;
</b:if>
@ptaferner
ptaferner / AND_OR_NOT
Created Nov 27, 2015 — forked from oliverdoetsch/AND_OR_NOT
Blogger: Globally conditional data tags for all page types
View AND_OR_NOT
#AND
<b:if cond='data:blog.pageType == "index"'>
<b:if cond='data:blog.searchQuery'>
<!--search_page AND index_page-->
</b:if>
</b:if>
#OR
@ptaferner
ptaferner / force_remove.sh
Created Nov 21, 2015
Manually remove a brocken debian package
View force_remove.sh
# Sometimes a package does not install correctly and cannot be uninstalled either.
# All conventional commands fail like this:
#
# The following packages will be REMOVED:
# slapd
# Need to get 0 B of archives. After unpacking 4162 kB will be freed.
# dpkg: error processing slapd (--remove):
# Package is in a very bad inconsistent state - you should
# reinstall it before attempting a removal.
# configured to not write apport reports
@ptaferner
ptaferner / multiphp.md
Created Aug 19, 2015
Installing and using multiple php versions on Debian 8.
View multiphp.md

phpfarm is a useful set of scripts which makes the installation and usage of multiple PHP versions easy and convenient. Basically, the instructions below follow the installation guidelines from the official git repository: https://github.com/cweiske/phpfarm.

  • Install necessary packages for build process.
sudo apt-get install build-essential libxml2 libxml2-dev libssl-dev 
libcurl4-openssl-dev pkg-config libcurl4-gnutls-dev libjpeg-dev 
libpng12-dev libmysqlclient-dev
@ptaferner
ptaferner / .gitignore
Last active Aug 29, 2015 — forked from robflaherty/csv-to-json.php
Convert CSV to JSON
View .gitignore
*.csv
*.json
@ptaferner
ptaferner / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console