Skip to content

Instantly share code, notes, and snippets.

View bangpound's full-sized avatar

Benjamin Doherty bangpound

View GitHub Profile
diff --git a/file_entity.file_api.inc b/file_entity.file_api.inc
index 85309eb..15fa5fe 100644
--- a/file_entity.file_api.inc
+++ b/file_entity.file_api.inc
@@ -160,6 +160,14 @@ function file_build_content($file, $view_mode = 'full', $langcode = NULL) {
// Remove previously built content, if exists.
$file->content = array();
+ // Allow modules to change the view mode.
+ $context = array(
diff --git a/pdf_to_image.module b/pdf_to_image.module
index cfab8c9..d2d1432 100644
--- a/pdf_to_image.module
+++ b/pdf_to_image.module
@@ -59,7 +59,7 @@ function pdf_to_image_field_widget_settings_form($field, $instance) {
$options = array();
foreach ((array) $fields as $field) {
$field_info = field_info_field($field['field_name']);
- if ($field_info['type'] == 'image') {
+ if (in_array($field_info['type'], array('file', 'image'))) {

Keybase proof

I hereby claim:

  • I am bangpound on github.
  • I am bangpound (https://keybase.io/bangpound) on keybase.
  • I have a public key whose fingerprint is C68C FB81 00BA E5DC 374E 08BD F4F0 B829 1503 3055

To claim this, I am signing this object:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Untitled</title>
</head>
<body>
<script type="text/javascript" src="//www.google.com/trends/embed.js?hl=en-US&q=/m/03dvnq,+/m/0hn0l,+/m/0dp09y,+/m/0p6lz&gprop=images&cmpt=q&content=1&cid=GEO_MAP_3_1&export=5&w=500&h=530"></script>
</body>
</html>
@bangpound
bangpound / composer.json
Created June 3, 2014 00:27
Symfony 3 directory structure in composer.json of Symfony 2.5
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/", "SymfonyStandard": "app/" }
},
"require": {
"php": ">=5.3.3",
@bangpound
bangpound / gist:f3283c44bf234e118561
Created April 30, 2014 05:04
Run Drupal on Heroku

The filesystem in heroku is read-only and ephemeral! This is not the Drupal hosting platform of your dreams!

git clone --branch 7.x-pimple https://github.com/bangpound/drupal.git
cd drupal
heroku create
composer install
git add composer.lock
git commit -m "add composer.lock"
heroku addons:add heroku-postgresql
@bangpound
bangpound / gist:9563200
Created March 15, 2014 07:56
whois buberzionist.com
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
Domain Name: BUBERZIONIST.COM
Registrar: GODADDY.COM, LLC
Whois Server: whois.godaddy.com
@bangpound
bangpound / GlobalsApplication.php
Created December 31, 2013 18:08
Silex application concept which uses the PHP $GLOBALS array as the service container.
<?php
use Silex\Application;
class GlobalsApplication extends Application
{
public function __construct(array $values = array())
{
// Set up the Silex services.
parent::__construct($values);
<?php
namespace Bangpound\Bundle\DrupalBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
/**
// One way converter from E4X XML to JSON
// 1) turns <body><item>1</item><item>2</item></body> into
// body: {item: ["1", "2"]} so that lists are easier to work with
// 2) turns things like: <body a="a">whatever</body> into
// body: {_a: "a", _: "whatever"}
// however <body>whatever</body> becomes simply body: "whatever
// - attributes specified by ignored are ignored
function E4XtoJSON(xml, ignored) {
var r, children = xml.*, attributes = xml.@*, length = children.length();
if(length == 0) {