Skip to content

Instantly share code, notes, and snippets.

View QuingKhaos's full-sized avatar

Em Karisch QuingKhaos

View GitHub Profile
@QuingKhaos
QuingKhaos / SyliusMigrations986.php
Last active August 29, 2015 13:57
Sylius migrations class for PR #986
<?php
/*
* Copyright (c) 2014 Patrik Karisch
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is furnished
<?php
namespace AppBundle\Form\Type;
use Sylius\Bundle\CartBundle\Form\Type\CartItemType as BaseCartItemType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
/**
* We extend the item form type a bit, to add a variant select field
@QuingKhaos
QuingKhaos / composer_package_version.rb
Last active August 29, 2015 14:24
Puppet facter to extract the installed version of a composer package
# Adapt the variable name "package_version", the path of composer and the composer package name to your needs
Facter.add("package_version") do
setcode do
Facter::Util::Resolution.exec('/bin/bash -c "cd /var/www/my_project && [[ -f composer.lock ]] && /usr/local/bin/composer show -i acme/package | grep versions | awk \'{print \\$4}\'"')
end
end
@QuingKhaos
QuingKhaos / menu.html.twig
Created August 21, 2015 19:31
w00t a complex menu :O!
{% extends 'knp_menu_base.html.twig' %}
{% set scopesTree = constant('Pixelart\\Extensions\\Baselayout\\Menu\\MainMenuBuilder::SCOPES_TREE') %}
{% set pagesTree = constant('Pixelart\\Extensions\\Baselayout\\Menu\\MainMenuBuilder::PAGES_TREE') %}
{% macro attributes(attributes) %}
{% for name, value in attributes %}
{%- if value is not none and value is not sameas(false) -%}
{{- ' %s="%s"'|format(name, value is sameas(true) ? name|e : value|e)|raw -}}
{%- endif -%}
@QuingKhaos
QuingKhaos / tt_content.php
Created October 19, 2015 12:54
Add a RTE field to tt_content
<?php
// typo3conf/ext/yourext/Configuration/TCA/Overrides/tt_content.php
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
$fields = [
'my_rte' => [
'label' => 'Mein RTE',
'config' => ['config' => [
'type' => 'text',
@QuingKhaos
QuingKhaos / 10-tmp-mounts.sh
Created December 19, 2015 16:41
Sulu temporary mounts
#!/usr/bin/env bash
make_tmp_mount () {
orig=/var/www/project/$1
shm=/run/shm/sulu/$1
mkdir -p ${orig}
mkdir -p ${shm}
chown -R www-data:www-data ${shm}
@QuingKhaos
QuingKhaos / keybase.md
Created July 2, 2016 09:01
keybase.io identity proof

Keybase proof

I hereby claim:

  • I am patkar on github.
  • I am patkar (https://keybase.io/patkar) on keybase.
  • I have a public key whose fingerprint is F2B5 ECFC B95D 5115 F872 3E8D C49A 210D B714 0BFE

To claim this, I am signing this object:

@QuingKhaos
QuingKhaos / Contract Killer 3.md
Last active July 5, 2016 08:49 — forked from schilke/Contract Killer 3.md
German translation of Andy Clarke's popular ‘killer contract’ for web professionals
@QuingKhaos
QuingKhaos / WebsiteController.php
Last active August 3, 2016 11:52
Resolving the parent and next sibling page of a Sulu content page
<?php
namespace Client\Bundle\WebsiteBundle\Controller;
use Sulu\Bundle\WebsiteBundle\Controller\WebsiteController as BaseWebsiteController;
use Sulu\Component\Content\Compat\Structure\PageBridge;
use Sulu\Component\Content\Compat\StructureInterface;
use Sulu\Component\Util\SortUtils;
use Symfony\Component\HttpFoundation\Response;
@QuingKhaos
QuingKhaos / _section.html
Last active November 2, 2016 11:30
Section template for https://github.com/slara/generator-reveal which allows multiple slides in one markdown file
<% if (!_.isString(slide) && !_.isArray(slide) && _.isObject(slide)) { %>
<section <%= _.map(slide.attr, function (val, attr) {return attr + '="' + val + '"'}).join(' ')%> <% if (_.isString(slide.filename)) { %>data-<% if (slide.filename.indexOf('.html') !== -1) { %>html<% } else { %>markdown<% }%>="slides/<%= slide.filename %>"<% } %>
<% } %><% if (_.isString(slide)) { %>
<section data-<% if (slide.indexOf('.html') !== -1) { %>html<% } else { %>markdown<% }%>="slides/<%= slide %>"
<% } %>
data-separator="^\n\n\n"
data-separator-vertical="^\n\n"
data-separator-notes="^Note:"
></section>