Skip to content

Instantly share code, notes, and snippets.

View dimitri-koenig's full-sized avatar

Dimitri König dimitri-koenig

View GitHub Profile
@dimitri-koenig
dimitri-koenig / gist:5584083
Created May 15, 2013 13:41
TYPO3: Order sys_template Records
SET @r=0;
UPDATE sys_template SET sorting = @r:= (@r+128) ORDER BY title ASC;
@dimitri-koenig
dimitri-koenig / count.js
Last active August 29, 2015 14:09 — forked from clouddueling/bookmarklet.js
Count AngularJS Watchers
(function() {
var root = $(document.getElementsByTagName('body'));
var watchers = [];
var f = function(element) {
if (element.data().hasOwnProperty('$scope')) {
angular.forEach(element.data().$scope.$$watchers, function(watcher) {
watchers.push(watcher);
});
}
angular.forEach(element.children(), function(childElement) {
@dimitri-koenig
dimitri-koenig / gist:589e70f3dcacd3b124fb
Created August 5, 2015 06:33
Easy copy your ssh public key to another server

ssh-copy-id takes your public key, connects to the remote server and inserts your key into the authorized_keys file.

$ brew install ssh-copy-id
$ ssh-copy-id user@host
@dimitri-koenig
dimitri-koenig / magento-nginx.conf
Created December 11, 2015 21:05 — forked from gwillem/magento-nginx.conf
Battle-tested Nginx configuration for Magento (source: www.hypernode.com)
# This is an annotated subset of the Nginx configuration from our Magento production platform @ www.hypernode.com
# See https://www.byte.nl/blog/magento-cacheleak-issue
user app;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
Stability ratings: 0-5
0 - Deprecated. This feature is known to be problematic, and changes are
planned. Do not rely on it. Use of the feature may cause warnings. Backwards
compatibility should not be expected.
1 - Experimental. This feature was introduced recently, and may change
or be removed in future versions. Please try it out and provide feedback.
If it addresses a use-case that is important to you, tell the node core team.

Your Vision

What is a vision?

Your vision answers the question "What do I want?" A clear vision help you communicate why you're here and what impact you're going to have.

Your vision should be aligned with the company vision, with your manager's V2MOM, and it should be personal. It should be an honest reflection of your own vision for your own work.

If you manage a team, it should be reflective of the purpose of the team and your collective impact.

You can use Codeception to test Javascript, like DOM manipulations and Ajax requests. Out of the box it can manipulate DOM elements but can't execute Javascript code, like most testing frameworks. But it gives you the option to use a WebDriver, to connect to a headless browser, and mimic a user browsing your website. It gives you some options: Selenium2, ZombieJS and, the easiest to configure, PhantomJS.

This article covers the installation and usage of PhantomJS, and assumes you are using Laravel Homestead, but it will work on any relatively new Debian based distro, like Ubuntu 14.04.

###Install PhantomJS

Just run those commands to install it:

sudo apt-get update
@dimitri-koenig
dimitri-koenig / Alert.vue
Created September 6, 2016 10:24 — forked from martinlindhe/Alert.vue
jasmine + karma for vue test
<style>
.Alert {
padding: 2em;
}
.Alert-Success {
border: 10px solid green;
}
.Alert-Error {
border: 10px solid red;
}
@dimitri-koenig
dimitri-koenig / backup.sh
Last active May 29, 2019 12:18
Backup mysql db both as a whole and with single tables
#!/bin/sh
BACKUP_BASE_DIR=/var/www/backups/db/
MYSQL_USER=""
MYSQL_PWD=""
MYSQL_DB=""
MYSQL_HOST="localhost"
TAR="$(which tar)"
@dimitri-koenig
dimitri-koenig / login.php
Created September 18, 2016 15:11
Behat Laravel Login As
<?php
function iAmLoggedIn()
{
// Destroy the previous session
if (Session::isStarted())
{
Session::regenerate(true);
}
else