Skip to content

Instantly share code, notes, and snippets.

View bummzack's full-sized avatar

Roman Schmid bummzack

View GitHub Profile
@bummzack
bummzack / NavigationPrompt.jsx
Created June 28, 2017 19:33
A replacement component for the react-router `Prompt`.
import React from 'react';
import {withRouter} from 'react-router-dom';
import PropTypes from 'prop-types';
/**
* A replacement component for the react-router `Prompt`.
* Allows for more flexible dialogs.
*
* @example
* <NavigationPrompt when={this.props.isDirty}>
@bummzack
bummzack / FluentQueryPlugin.php
Last active August 19, 2021 13:13
Fluent query plugin for SilverStripe GraphQL
<?php
namespace Mutoco\GraphQL;
use SilverStripe\GraphQL\Schema\Field\ModelQuery;
use SilverStripe\GraphQL\Schema\Interfaces\ModelQueryPlugin;
use SilverStripe\GraphQL\Schema\Interfaces\SchemaUpdater;
use SilverStripe\GraphQL\Schema\Schema;
use SilverStripe\GraphQL\Schema\Type\Enum;
@bummzack
bummzack / deploy-stages.php
Last active April 26, 2021 22:06
Rsync Deployment setup à la bummzack
<?php
server('live', '{{LiveServer}}', 22)
->user('{{SshUser}}')
->forwardAgent() // You can use identity key, ssh config, or username/password to auth on the server.
->stage('live')
->env('deploy_path', '{{DeployDir}}'); // Define the base path to deploy your project to.
server('staging', '{{StagingServer}}', 22)
->user('{{SshUser}}')
->forwardAgent() // You can use identity key, ssh config, or username/password to auth on the server.
@bummzack
bummzack / index.html
Created March 8, 2017 15:21
Webpack using browser-sync and SASS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dummy</title>
<link rel="stylesheet" href="dist/css/styles.css"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
</head>
<body>
<div id="app" >
FROM brettt89/silverstripe-web:7.4-apache
RUN apt-get update && apt-get install -y \
libzip-dev zip unzip git nano
# Install additional extensions
RUN install-php-extensions imagick xdebug
RUN echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.client_port=9003" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
<?php
namespace MyProject\GraphQL;
use SilverStripe\GraphQL\Schema\Field\ModelQuery;
use SilverStripe\GraphQL\Schema\Interfaces\ModelQueryPlugin;
use SilverStripe\GraphQL\Schema\Interfaces\SchemaUpdater;
use SilverStripe\GraphQL\Schema\Schema;
use SilverStripe\GraphQL\Schema\Type\Enum;
@bummzack
bummzack / Shop_Checkout_Config.php
Last active September 18, 2019 16:04
Stripe Payments with Stripe Checkout (JS) and SilverStripe 4 + SilverShop
<?php
namespace Bummzack\Shop\Checkout;
use SilverShop\Checkout\CheckoutComponentConfig;
use SilverShop\Checkout\Component\Notes;
use SilverShop\Checkout\Component\Terms;
use SilverShop\Model\Order;
class Config extends CheckoutComponentConfig
@bummzack
bummzack / AddProductFormExtension.php
Created February 18, 2017 21:14
silvershop – User customisable OrderItem field
<?php
/**
* Extension to add custom field to AddProductForm and VariationForm
*/
class AddProductFormExtension extends Extension
{
public function updateAddProductForm()
{
// Add a new Textfield to the form-fields
@bummzack
bummzack / Markdown.php
Created November 6, 2018 20:40
Markdown textfield
<?php
namespace App\ORM;
use Exception;
use Psr\Container\NotFoundExceptionInterface;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\FieldType\DBVarchar;
class Markdown extends DBVarchar
@bummzack
bummzack / FluentCascadeDeleteExtension.php
Last active October 4, 2018 09:58
Properly remove records from localized table once deleted.
<?php
namespace Bummzack\Extensions;
use SilverStripe\Core\ClassInfo;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\Queries\SQLDelete;
use SilverStripe\Versioned\Versioned;