Skip to content

Instantly share code, notes, and snippets.

@jpgreth
jpgreth / ActionIfGrantedViewHelper.php
Created June 16, 2016 15:26 — forked from bwaidelich/ActionIfGrantedViewHelper.php
A simple Neos Flow ViewHelper that only renders an action link if the target action is granted by the currently authenticated account. Otherwise it will only render the link text
<?php
namespace Your\Package\ViewHelpers\Link;
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Aop\JoinPoint;
use TYPO3\Flow\Mvc\ActionRequest;
use TYPO3\Flow\Security\Authorization\Privilege\Method\MethodPrivilegeInterface;
use TYPO3\Flow\Security\Authorization\Privilege\Method\MethodPrivilegeSubject;
use TYPO3\Flow\Security\Authorization\PrivilegeManagerInterface;
use TYPO3\Fluid\ViewHelpers\Link\ActionViewHelper;
@jpgreth
jpgreth / index.html
Created January 28, 2016 13:23 — forked from anonymous/index.html
Bootstrap 3 responsive columns of same height Bootstrap 3 responsive columns of same height // source http://jsbin.com/valajojuha
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bootstrap 3 responsive columns of same height</title>
<meta name="description" content="Bootstrap 3 responsive columns of same height">
<!-- include bootstrap -->
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<style id="jsbin-css">
/* USAGE
@jpgreth
jpgreth / install_mysql.sh
Created October 27, 2015 16:47 — forked from rrosiek/install_mysql.sh
Vagrant provision script for php, Apache, MySQL, phpMyAdmin, Laravel, and javascript helpers. Outputs nearly everything to /dev/null since "quiet" on most commands is still noisy.
#! /usr/bin/env bash
# Variables
APPENV=local
DBHOST=localhost
DBNAME=dbname
DBUSER=dbuser
DBPASSWD=test123
echo -e "\n--- Mkay, installing now... ---\n"
@jpgreth
jpgreth / bootstrap3_print.css
Created October 7, 2015 15:24 — forked from donnierayjones/LICENSE
Render Bootstrap as "small" layout when printing
@media print {
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
float: left;
}
.col-sm-12 {
width: 100%;
}
.col-sm-11 {
width: 91.66666667%;
}
<?php
namespace NameOfVendor\NameOfExtension\ViewHelpers;
/***************************************************************
* Copyright notice
*
* (c) 2010 Franz Koch <typo3@elements-net.de>, Koch & Koch GbR
*
* All rights reserved
@jpgreth
jpgreth / Cropping Images Purely With CSS While Keeping It Responsive.markdown
Created July 8, 2015 08:45
Cropping Images Purely With CSS While Keeping It Responsive

Cropping Images Purely With CSS While Keeping It Responsive

Forked from Lars Miller's Pen Cropping Images Purely With CSS While Keeping It Responsive. Used loempixel for the Images.

Well, it's not really "cropping", but it's the same effect...

You need to first know the height and width of your image to calculate the desired output

We had the need to display a set of images in 3 different ways on a page. The images were all the same size, but we wanted to display them in 3 different heights. The below Pen is how we did it. Taking it a step further, I added these options:

<?php
namespace My\Package\Service;
use TYPO3\Flow\Annotations as Flow;
/**
* @Flow\Scope("singleton")
*/
class EmailService {
# Minecraft Overviewer dynamic config file for multiple Minecraft worlds
# managed by MSM (https://github.com/marcuswhybrow/minecraft-server-manager)
import os
# Define where to put the output here.
outputdir = "/storage/www/vhosts/minecraft.example.com"
# Add Javascript to map when rendering
from observer import JSObserver
def screenshotFilter(poi):
'''This looks for signs that have their first line in the 'Image:<id>' format, where <id> is an
id from an Imgur.com image.'''
if poi['id'] == 'Sign':
if poi['Text1'].startswith('Image:'):
poi['icon'] = "painting_icon.png"
image_html = "<style>.infoWindow img[src='{icon}'] {{display: none}}</style><a href='http://imgur.com/{id}'><img src='http://imgur.com/{id}s.jpg' /></a>".format(icon=poi['icon'], id=poi['Text1'][6:])
return "\n".join([image_html, poi['Text2'], poi['Text3'], poi['Text4']])
def playerFilter(poi):
# Minecraft Overviewer dynamic config file for multiple Minecraft worlds
# managed by MSM (https://github.com/marcuswhybrow/minecraft-server-manager)
import os
# Define where to put the output here.
outputdir = "/storage/www/vhosts/minecraft.example.com"
# Add Javascript to map when rendering
from observer import JSObserver