Skip to content

Instantly share code, notes, and snippets.

@KaySchneider
KaySchneider / phpTemplateXml.php
Created June 18, 2016 11:13
php_code_template
<?php
function test($geschlecht) {
$gender=$geschlecht;
$gExploded = explode(",", $gender);
return str_replace("Männer", "male", str_replace("Frauen", "female",str_replace("Unisex", "unisex", $gExploded[0])));
}
var_dump(test("Männer, Frauen"));
var_dump(test("Männer"));
@KaySchneider
KaySchneider / XmlTemplate.php
Last active June 18, 2016 11:26
Xml template
<!-- Basic Product Information -->
{G:ID}
{G:TITLE}
{G:LINK}
{G:DESCRIPTION}
{G:GOOGLE_PRODUCT_CATEGORY}
{G:PRODUCT_TYPE,[10]}
{G:IMAGE_LINK}
<g:condition>new</g:condition>
@KaySchneider
KaySchneider / registerServiceWorker.html
Created March 30, 2017 19:16
Simple demo, how to register an service worker. The registration process can be also done inside an javascript file.
<!DOCTYPE html>
<html>
<head>
<title>title</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>Hello, world</h1>
<script>
if ('serviceWorker' in navigator) {
var cacheName = 'notenrechnerjk829829328931';
var filesToCache = [
'/notenRechner/',
'/notenRechner/manifest.json',
'/notenRechner/index.html',
'/notenRechner/libs/material.min.js',
'/notenRechner/libs/material.min.css',
'/notenRechner/js/app.js',
'/notenRechner/styles/main.css',
@KaySchneider
KaySchneider / MagentoControllerPart.php
Created April 4, 2017 09:49
How to deactiavate a magento module programmatically
<?php
class MySuperController {
protected function _disableModule($moduleName) {
// Disable the module itself
$nodePath = "modules/$moduleName/active";
if (Mage::helper('core/data')->isModuleEnabled($moduleName)) {
Mage::getConfig()->setNode($nodePath, 'false', true);
}
@KaySchneider
KaySchneider / docker-compose.yml
Created October 16, 2017 17:34
This docker-compose can be used to run magento and a mysql database inside docker on an development machine ;-) And with some changes also in production.
version: '2'
services:
web:
image: meanbee/magento:5.6-apache
hostname: localdomain.dev
environment:
- DOCKER_FIX=true
- DEBUG=true
- VIRTUAL_HOST=http://localdomain.dev
- ENABLE_SENDMAIL=true
@KaySchneider
KaySchneider / addAdminUserMagento.sql
Created October 18, 2017 13:25
add a new magento admin user with mysql ;-)
LOCK TABLES `admin_role` WRITE , `admin_user` WRITE;
SET @SALT = "yourInstallationSalt";
SET @PASS = CONCAT(MD5(CONCAT( @SALT , "YOURPASSWORDSTRING") ), CONCAT(":", @SALT ));
SELECT @EXTRA := MAX(extra) FROM admin_user WHERE extra IS NOT NULL;
INSERT INTO `admin_user` (firstname,lastname,email,username,password,created,lognum,reload_acl_flag,is_active,extra,rp_token_created_at)
VALUES ('firstName','lastName','maik@example.com','username',@PASS,NOW(),0,0,1,@EXTRA,NOW());
INSERT INTO `admin_role` (parent_id,tree_level,sort_order,role_type,user_id,role_name)
@KaySchneider
KaySchneider / index.js
Last active December 26, 2018 16:29
Simple wrapper to run ghost as npm module. To run it inside the GAE flexible environment. And an example package.json for ghost as npm package
'use strict';
const ghost = require('ghost');
const port = process.env.PORT || 8080;
ghost().then(function (ghostServer) {
ghostServer.rootApp.listen(port);
});
@KaySchneider
KaySchneider / package.json
Created December 28, 2018 07:39
Package.json for ghost publishing plattform, install via npm package and not via ghost cli
{
"name": "ghostappengine",
"version": "1.0.0",
"description": "",
"main": "index.js",
"engines": {
"node": "6.x"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
#/etc/X11/xorg.conf
Section "Device"
Identifier "nvidia"
Driver "nvidia"
Option "NoLogo" "true"
Option "DPI" "96 x 96"
# Specify Nvidia PCI device
BusID "PCI:1:0:0"
# Make sure X starts also when no outputs are connected to the Nvidia chip
Option "AllowEmptyInitialConfiguration"