Skip to content

Instantly share code, notes, and snippets.

View alfredbez's full-sized avatar
👨‍💻

Alfred Bez alfredbez

👨‍💻
View GitHub Profile
@alfredbez
alfredbez / Intercept.php
Last active December 6, 2022 13:06
Testing stdout output with PHPUnit
<?php
class Intercept extends \php_user_filter
{
public static $cache = '';
public function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
self::$cache .= $bucket->data;
$consumed += $bucket->datalen;
@alfredbez
alfredbez / dump-oxid-database.sh
Created June 15, 2020 12:06
Dumps a oxid database without the views
# Replace DBUSER & DBNAME before running this
mysqldump \
-uDBUSER \
-p \
DBNAME \
--lock-tables=false \
$(mysql \
-uDBUSER \
-p \
DBNAME \
@alfredbez
alfredbez / Readme.md
Last active May 28, 2020 13:26
OXID error: Table 'oxid.oxv_oxshops_0' doesn't exist

Problem

This error is logged in oxideshop.log:

Base table or view not found: 1146 Table 'oxid.oxv_oxshops_0' doesn't exist at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:42, Doctrine\\DBAL\\Driver\\PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'oxid.oxv_oxshops_0' doesn't exist at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:80, PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'oxid.oxv_oxshops_0' doesn't exist at /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:75)
[stacktrace]
#0 /var/www/html/vendor/oxid-esales/oxideshop-ce/source/Core/Database/Adapter/Doctrine/Database.php(601): OxidEsales\\EshopCommunity\\Core\\Database\\Adapter\\Doctrine\\Database->convertException(Object(Doctrine\\DBAL\\Exception\\TableNotFoundException))
#1 /var/www/html/vendor/oxid-esales/oxideshop-ee/Core/Model/BaseModel.php(660): OxidEsales\\EshopC
@alfredbez
alfredbez / copy-OXIDthemeOptions.sql
Last active April 18, 2020 16:33
Kopiert Theme-Einstellungen von Azure Theme zu eigenem Theme (Oxid-Kochbuch)
SET @sourceTheme='theme:azure';
SET @targetTheme='theme:kochbuch';
INSERT INTO oxconfig (OXID, OXSHOPID, OXMODULE, OXVARNAME, OXVARTYPE, OXVARVALUE )
(SELECT UUID(), OXSHOPID, @targetTheme, OXVARNAME, OXVARTYPE, OXVARVALUE FROM oxconfig WHERE OXMODULE = @sourceTheme);
INSERT INTO oxconfigdisplay (OXID, OXCFGMODULE, OXCFGVARNAME, OXGROUPING, OXVARCONSTRAINT, OXPOS)
(SELECT UUID(), @targetTheme,OXCFGVARNAME, OXGROUPING, OXVARCONSTRAINT, OXPOS FROM oxconfigdisplay WHERE OXCFGMODULE = @sourceTheme);

using multiple Arrays in gulp.src

var gulp = require('gulp');

gulp.task('build', function() {
    var srcFiles = ['file1.js', 'file2.js'],
        otherSrcFiles = ['file3.js', 'file4.js'];
    gulp.src(srcFiles.concat(otherSrcFiles));
});
@alfredbez
alfredbez / README.md
Last active November 23, 2016 17:32 — forked from Im0rtality/README.md
PHP CLI Debugging in Vagrant using Xdebug and PHPStorm

In host:

  1. Go to PHPStorm Settings > Project settings > PHP > Servers
  2. Add server with following parameters:
    • Name: vagrant (same as serverName= in debug script)
    • Host, port: set vagrant box IP and port
    • Debugger: Xdebug
    • [v] Use path mappings
    • Map your project root in host to relative dir in guest
  • Hit OK

Keybase proof

I hereby claim:

  • I am alfredbez on github.
  • I am alfredbez (https://keybase.io/alfredbez) on keybase.
  • I have a public key whose fingerprint is B99D 5003 3459 26BD 13DB 91E0 10F9 D95A 4DDB 2313

To claim this, I am signing this object:

@alfredbez
alfredbez / text-shadow.css
Created December 17, 2013 07:51
doppelter Schatteneffekt für Texte
h3 a {
text-decoration: none;
color: #000;
text-shadow: 0.15rem 0.15rem 0 #fbfbfb,0.35rem 0.35rem 0 #dadada;
border: none;
}
var geocoder;
var map;
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(-34.397, 150.644);
var mapOptions = {
zoom: 8,
center: latlng
}
@alfredbez
alfredbez / optimize_image.php
Last active December 25, 2015 20:59
Optimize Image with php
<?php
function image_optimize ($source_url, $destination_url, $quality) {
$info = getimagesize($source_url);
if ($info['mime'] == 'image/jpeg') $image = imagecreatefromjpeg($source_url);
elseif ($info['mime'] == 'image/png') $image = imagecreatefrompng($source_url);
else return 'error: only jpeg and png are supported';
// Enable interlancing