Skip to content

Instantly share code, notes, and snippets.

View amenk's full-sized avatar

Alexander Menk amenk

View GitHub Profile
@amenk
amenk / Test.php
Created April 16, 2012 11:08
Test
Test
<?php
@amenk
amenk / gist:4032982
Created November 7, 2012 17:03
My current shell history histogram
git 3386 ############################################################
cd 1580 ############################
ssh 958 #################
ls 670 ############
vi 367 #######
sudo 352 #######
n98-magerun.phar 220 ####
cat 218 ####
php 170 ####
cmc 150 ###
@amenk
amenk / Mock.php
Last active December 14, 2015 00:09
Magento DB Adapter Mock which does not do anything
<?php
class AM_PHPUnit_Db_Adapter_Mock implements Varien_Db_Adapter_Interface
{
public function beginTransaction() {}
public function commit() {}
public function rollBack() {}
public function newTable($tableName = null, $schemaName = null) {}
public function createTable(Varien_Db_Ddl_Table $table) {}
public function dropTable($tableName, $schemaName = null) {}
@amenk
amenk / gist:5785387
Created June 14, 2013 21:21
Amazon LBB CSV cleaner
#!/bin/bash
# Call from a folder with downloaded CSV files from Amazon.de credit card banking
# clears "fake bookings" to not cause problems during import to Hibiscus
sed '/AMAZON.DE PUNKTE/d' * -i
sed '/AMAZON.DE GUTSCHEIN/d' * -i
@amenk
amenk / xdebug.ini
Created July 1, 2013 13:39
Xdebug links for PHPStorm Remote Call Plugin
; Output links compatible with the PHPStorm Remote Call plugin running on the host.
; source: https://github.com/computerminds/parrot/pull/20/files
xdebug.file_link_format="javascript:var rq = new XMLHttpRequest(); rq.open(\"GET\", \"http://localhost:8091?message=%f:%l\", true); rq.send(null);"
@amenk
amenk / gist:8296962
Created January 7, 2014 09:33
Reinstall purge debian package - usefull for provision scripts
PACKAGE=postfix
debconf-get-selections | grep $PACKAGE >> $PACKAGE.debconf
apt-get purge $PACKAGE
# later / on another machine
debconf-set-selections < `dirname $0`/$PACKAGE.debconf
apt-get install -y $PACKAGE
@amenk
amenk / gitlab.sh
Last active August 29, 2015 13:57 — forked from nachtsheim/gitlab.sh
aptitude install -y git curl python-dev python-pip redis-server ruby1.9.1-full rubygems1.9.1 libxml2 libxml2-dev libxslt-dev libpq-dev
aptitude install -y mysql-server libmysqlclient-dev
adduser --system --shell /bin/sh --gecos 'git version control' --group --disabled-password --home /home/git git
adduser --disabled-login --gecos 'gitlab system' gitlab
usermod -a -G git gitlab
su - gitlab
ssh-keygen -q -N '' -t rsa -f /home/gitlab/.ssh/id_rsa
aptitude install gitolite
cp /home/gitlab/.ssh/id_rsa.pub /home/git/gitlab.pub
su - git
@amenk
amenk / foo.php
Created April 23, 2014 09:22
Take a screenshot of a specific part (CSS selector) in Behat
<?php
/**
* @Then /^take a screenshot of "([^"]*)" and save "([^"]*)"$/
*/
public function takeAScreenshotOfAndSave($selector, $filename)
{
$this->saveScreenshot($filename, '/tmp');
$pos = $this->getSession()->evaluateScript('$$("' . $selector . '").first().getBoundingClientRect();');
@amenk
amenk / gist:aa98d11015c73090923d
Last active August 29, 2015 14:02
Clean media folder from repository
git clone repo-backup/ repo-min
cd repo-min/
# make sure you do not have other branches
git filter-branch --tree-filter 'rm -rf public/media/*' HEAD
git update-ref -d refs/original/refs/heads/master
git remote rm origin
git repack -ad
du -hs .git # 2.4 GB
git whatchanged # check that files are not there
git reflog expire --expire=now --all
@amenk
amenk / connected-bx-sliders.js
Created September 25, 2014 14:32
Connected BXSliders
// connected sliders
sliders = [];
$('.bxslider-detail').each(function() {
sliders[$(this).attr('data-id')] = $(this).bxSlider({
mode: 'horizontal',
speed: 1000,
slideWidth: 400,
auto: true,
pager: false,
infiniteLoop: true