Skip to content

Instantly share code, notes, and snippets.

View bangpound's full-sized avatar

Benjamin Doherty bangpound

View GitHub Profile
<?php
class TwigFormatServiceProvider implements \Pimple\ServiceProviderInterface
{
public function register(\Pimple\Container $pimple)
{
$pimple['twig.sandbox.allowed_tags'] = array();
$pimple['twig.sandbox.allowed_filters'] = array();
$pimple['twig.sandbox.allowed_methods'] = array();
$pimple['twig.sandbox.allowed_properties'] = array();
<?php
<<<CONFIG
packages:
- "guzzlehttp/guzzle: ~6.0"
- "symfony/dom-crawler: ~2.7"
- "symfony/css-selector: ~2.7"
- "symfony/console: ~2.7"
CONFIG;
<?php
<<<CONFIG
packages:
- "fabpot/goutte: ~3.1"
- "symfony/console: ~2.7"
- "symfony/yaml: ~2.7"
CONFIG;
use Goutte\Client;
@bangpound
bangpound / section7.1.md
Last active August 29, 2015 14:24
jekyll
@bangpound
bangpound / trace.md
Created July 24, 2015 18:48
Tracing private property values at runtime.
<?php
function init_trace($object)
{
    $r = new ReflectionObject($object);

    // Create array of object's property names.
    $properties = array_map(function (ReflectionProperty $property) {
        return $property->getName();
 }, $r-&gt;getProperties());
@bangpound
bangpound / ClosureCompilerPass.php
Created July 28, 2015 14:05
Symfony closure compiler pass
<?php
namespace DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class ClosureCompilerPass implements CompilerPassInterface
{
private $pass;
@bangpound
bangpound / tattoo.info
Created August 27, 2015 18:28
Drupal 7 tattoo module adds to `Drupal.settings` object the whole JSON representation of all viewed entities.
name = Tattoo
core = 7.x
dependencies[] = restws
@bangpound
bangpound / -
Created September 14, 2015 07:21
diff --git a/docroot/sites/all/themes/hickory/templates/page--node--event.tpl.php b/docroot/sites/all/themes/hickory/templates/page--node--event.tpl.php
index 7928fc8..f0f9d71 100644
--- a/docroot/sites/all/themes/hickory/templates/page--node--event.tpl.php
+++ b/docroot/sites/all/themes/hickory/templates/page--node--event.tpl.php
@@ -216,12 +216,12 @@
<a ng-if="eventBuyTixTxt" href="{{eventBuyTixLink}}" class="button register" ng-bind="eventBuyTixTxt"></a>
</section>
- <section ng-if="socialLinkFB || twitterLinkFB || googleLinkFB" class="share no-print">
+ <section class="share no-print">
name = Menu Entity
core = 7.x
description = Decorates menu link options with entity metadata.
@bangpound
bangpound / drupal8-permissions.patch
Last active November 23, 2015 20:03
Disables Drupal 8's security feature that removes write permission on sites/*, sites/*/settings.php, sites/*/settings.local.php, sites/*/services.yml. You should never deploy this code. It's only for local development environments.
diff --git a/docroot/core/modules/system/system.install b/docroot/core/modules/system/system.install
index c9e8175..3841e6e 100644
--- a/docroot/core/modules/system/system.install
+++ b/docroot/core/modules/system/system.install
@@ -365,12 +365,12 @@ function system_requirements($phase) {
else {
$site_path = DrupalKernel::findSitePath(Request::createFromGlobals());
}
- if (!drupal_verify_install_file($site_path, FILE_NOT_WRITABLE, 'dir')) {
+ if (!drupal_verify_install_file($site_path, FILE_WRITABLE, 'dir')) {