Skip to content

Instantly share code, notes, and snippets.

View bummzack's full-sized avatar

Roman Schmid bummzack

View GitHub Profile
@bummzack
bummzack / SearchPage.php
Last active September 13, 2016 08:01
SilverStripe search page using Google Search (paid)
<?php
/**
* SearchPage page type.
* @author bummzack
*/
class SearchPage extends Page
{
private static $icon = 'mysite/images/icons/search.png';
private static $description = 'Search page';
{
"SASS_SRC" : "./themes/mytheme/dev-sass",
"CSS_DIR" : "./themes/mytheme/css",
"PROXY_URL" : "localhost/mysite",
"JS_SRC" : "./themes/mytheme/dev-javascript",
"JS_DST" : "./themes/mytheme/javascript",
"JS_FILES" : [
"node_modules/picturefill/dist/picturefill.js",
"node_modules/jquery/dist/jquery.js",
"./themes/mytheme/dev-javascript/init.js"
@bummzack
bummzack / FixedImagickBackend.php
Created November 10, 2016 22:36
Image magick SilverStripe
<?php
/**
* Add missing "crop" method to ImagickBackend, so that it works with the focuspoint module
*/
if(class_exists('Imagick')) {
class FixedImagickBackend extends ImagickBackend
{
public function crop($top, $left, $width, $height)
{
@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.
<?php
/**
*
*/
class OrderActionsFormExtension extends Extension
{
private static $allowed_actions = array(
'copyOrderToCart'
);
@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 / package.json
Last active March 8, 2017 15:02
Minimalistic Webpack 2.x config
{
"name": "meetup",
"version": "1.0.0",
"description": "Webpack React Setup for SilverStripe Projects",
"main": "index.js",
"author": "Roman Schmid",
"license": "MIT",
"scripts": {
"build": "webpack --bail"
},
@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" >
@bummzack
bummzack / readme.md
Created June 2, 2017 08:05
Responsive Media added via TinyMCE in SilverStripe. Using jQuery

Responsive Media added via TinyMCE in SilverStripe. Using jQuery

In SilverStripe you can add Videos within the TinyMCE Editor by using the "Insert Media" Button. In the "From the Web" tab, you can paste a URL of a resource, such as a Video hosted on Vimeo, YouTube or other video portals.

Screenshot of the insert Media dialog

Videos inserted this way have a fixed size though and don't integrate nicely into responsive layouts. With some JavaScript and CSS you can progressively enhance your videos to become responsive.

@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}>