Skip to content

Instantly share code, notes, and snippets.

@ptaferner
ptaferner / 0_reuse_code.js
Last active August 29, 2015 14:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ptaferner
ptaferner / .gitignore
Last active August 29, 2015 14:27 — forked from robflaherty/csv-to-json.php
Convert CSV to JSON
*.csv
*.json
@ptaferner
ptaferner / multiphp.md
Created August 19, 2015 07:25
Installing and using multiple php versions on Debian 8.

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 / force_remove.sh
Created November 21, 2015 10:03
Manually remove a brocken debian package
# 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 / AND_OR_NOT
Created November 27, 2015 08:13 — forked from oliverdoetsch/AND_OR_NOT
Blogger: Globally conditional data tags for all page types
#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 / conditional.xml
Last active November 27, 2015 10:52
In case you want non-XML-conform HTML markup based on a condition, use a construct like this:
<b:if cond='data:index in {2, 5}'>
&lt;/div&gt;
</b:if>
@ptaferner
ptaferner / pretty-data-cmd
Created November 30, 2015 14:38
CLI script for node modules
#!/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 / icon-install.md
Last active December 17, 2015 20:51
Create a desktop icon in Linux Mint
  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 / live_template.xml
Created January 16, 2016 10:00
Phpstorm: Generate pimcore translation
<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>