Skip to content

Instantly share code, notes, and snippets.

View cbergau's full-sized avatar

Christian Bergau cbergau

  • Arvato eCommerce
  • Hannover (Germany)
View GitHub Profile
@cbergau
cbergau / Windows GCLOUD Container Engine kubectl Problem
Created November 27, 2016 00:38
gcloud_windows_kubectl_auth_fix.md
After:
gcloud container clusters get-credentials cluster-1 --zone europe-west1-b --project xyz
kubectl proxy
I got the error message:
error: google: could not find default credentials.
Fix:
#!/usr/bin/env bash
docker run --rm \
-v $(pwd):/var/www/html \
-e IDE_PHPUNIT_PHPUNIT_INCLUDE="/var/www/html/vendor/phpunit" \
-e PHP_IDE_CONFIG="serverName=my.local" \
-e XDEBUG_CONFIG="remote_host=192.168.178.22" \
cbergau/clean_architecture_shop_symfony3client \
php ./vendor/bin/phpunit -c tests/ tests/
# Volumes:
# - /vagrant:/var/www/html Source code of the checkout
# - /home/vagrant:/home/vagrant Helper scripts of PHPStorm
# Environment Variables:
# - IDE_PHPUNIT_PHPUNIT_INCLUDE PHPStorm has a helper script that searches for PHPUnit. It's located under
# /home/vagrant/.phpstorm_helpers/phpunit.php if you need any more information
# - PHP_IDE_CONFIG PHPStorm maps it to the server configuration
# - XDEBUG_CONFIG XDebug configuration
@cbergau
cbergau / my_first_swift_script.swift
Created March 9, 2016 14:17
my_first_swift_script.swift
import UIKit
class LoginResponse {
var code: Int = 0
var user: UserDto
init(code: Int, userDto: UserDto) {
self.code = code
self.user = userDto
}
@cbergau
cbergau / gist:ed6036dd9b19cc5bd9d3
Last active August 29, 2015 14:16
Composer SSL Fix

This is a fix that worked for me when having this error:

[Composer\Downloader\TransportException]                                                                                       
  The "https://getcomposer.org/version" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:  
  error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed                                              
  Failed to enable crypto                                                                                                        
  failed to open stream: operation failed  

Download CRT file

# Initialize virtual machine with https://vagrantcloud.com/hashicorp/precise64
vagrant init hashicorp/precise64
# Create virtual machine and start it
vagrant up
# Connect (ssh auth with key file)
vagrant ssh -- -l vagrant
# Download Chef Server
@cbergau
cbergau / rule_engine_clean_arch.php
Created September 2, 2014 08:46
Rule Engine Clean Architecture
<?php
class ChangeLogisticPartnerInteractor
{
/** @var ChangeLogisticPartnerValidator */
private $changeLogisticPartnerValidator;
public function execute($changeToId)
{
// High level Policy
@cbergau
cbergau / clover.xml
Created June 13, 2014 20:27
clover.xml
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1402691128">
<project timestamp="1402691128">
<package name="Bws\Entity">
<file name="/Applications/XAMPP/xamppfiles/htdocs/shop/src/Bws/Entity/Article.php">
<class name="Article" namespace="Bws\Entity">
<metrics methods="12" coveredmethods="12" conditionals="0" coveredconditionals="0" statements="18" coveredstatements="18" elements="30" coveredelements="30"/>
</class>
<line num="47" type="method" name="setEan" crap="1" count="25"/>
<line num="49" type="stmt" count="25"/>
@cbergau
cbergau / junit.xml
Created June 13, 2014 20:26
junit.xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="Bws Library" tests="30" assertions="78" failures="0" errors="0" time="0.027137">
<testsuite name="Bws\Entity\ArticleTest" file="/Applications/XAMPP/xamppfiles/htdocs/shop/tests/Bws/Entity/ArticleTest.php" namespace="Bws\Entity" fullPackage="Bws.Entity" tests="2" assertions="2" failures="0" errors="0" time="0.003171">
<testcase name="testGetSetEan" class="Bws\Entity\ArticleTest" file="/Applications/XAMPP/xamppfiles/htdocs/shop/tests/Bws/Entity/ArticleTest.php" line="17" assertions="1" time="0.002627"/>
<testcase name="testGetSetDescription" class="Bws\Entity\ArticleTest" file="/Applications/XAMPP/xamppfiles/htdocs/shop/tests/Bws/Entity/ArticleTest.php" line="23" assertions="1" time="0.000544"/>
</testsuite>
<testsuite name="Bws\Interactor\AddToBasketTest" file="/Applications/XAMPP/xamppfiles/htdocs/shop/tests/Bws/Interactor/AddToBasketTest.php" namespace="Bws\Interactor" fullPackage="Bws.Interactor" tests="6" asserti
@cbergau
cbergau / sass_mixin.scss
Created May 18, 2014 18:20
SASS Mixin Example
@mixin border-radius($radius) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
-ms-border-radius: $radius;
border-radius: $radius;
}
@mixin border-shadow($horizontal, $vertical, $blur, $spread, $color) {
-webkit-box-shadow: $horizontal $vertical $blur $spread $color;
box-shadow: $horizontal $vertical $blur $spread $color;