Skip to content

Instantly share code, notes, and snippets.

View ockham's full-sized avatar

Bernie Reiter ockham

View GitHub Profile
@ockham
ockham / ForbiddenPHPFunctionsCheck.php
Created December 10, 2014 21:22
ForbiddenPHPFunctionsCheck.php
<?php
/**
* Checks for the usage of forbidden PHP functions.
*/
class ForbiddenPHPFunctionsCheck extends CodeCheck {
protected static $forbidden_php_functions = array(
'popen',
'proc_open',
@ockham
ockham / gist:09845e12d48d0d7bc258
Created December 3, 2014 16:50
An example PhpParser\Node
[2] => PhpParser\Node\Expr\FuncCall Object
(
[subNodes:protected] => Array
(
[name] => PhpParser\Node\Name Object
(
[subNodes:protected] => Array
(
[parts] => Array
(
<?php
$CONFIG = array (
'passwordsalt' => 'a75f26f303939f273b6b7f60029b40',
'trusted_domains' =>
array (
0 => NULL,
),
'datadirectory' => '/home/bernie/src/owncloud/core/data',
'dbtype' => 'sqlite',
'version' => '7.8.0.0',
@ockham
ockham / gist:e0535a12792eed4f525e
Created August 27, 2014 09:23
php index.php output
<!DOCTYPE html>
<!--[if lt IE 7]><html class="ng-csp ie ie6 lte9 lte8 lte7" data-placeholder-focus="false"><![endif]-->
<!--[if IE 7]><html class="ng-csp ie ie7 lte9 lte8 lte7" data-placeholder-focus="false"><![endif]-->
<!--[if IE 8]><html class="ng-csp ie ie8 lte9 lte8" data-placeholder-focus="false"><![endif]-->
<!--[if IE 9]><html class="ng-csp ie ie9 lte9" data-placeholder-focus="false"><![endif]-->
<!--[if gt IE 9]><html class="ng-csp ie" data-placeholder-focus="false"><![endif]-->
<!--[if !IE]><!--><html class="ng-csp" data-placeholder-focus="false"><!--<![endif]-->
<head data-requesttoken="6327047a74188b3ea8d8">
<title>
diff --git a/gourmet/plugins/import_export/pdf_plugin/pdf_exporter.py b/gourmet/plugins/import_export/pdf_plugin/pdf_exporter.py
index e9fb2c1..f77cc7c 100644
--- a/gourmet/plugins/import_export/pdf_plugin/pdf_exporter.py
+++ b/gourmet/plugins/import_export/pdf_plugin/pdf_exporter.py
@@ -4,6 +4,8 @@ from reportlab.lib.units import inch,mm
import reportlab.platypus as platypus
import reportlab.lib.pagesizes as pagesizes
import reportlab.lib.styles as styles
+from reportlab.pdfbase import pdfmetrics
+from reportlab.pdfbase.ttfonts import TTFont
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE gourmetDoc>
<gourmetDoc>
<recipe id="2283">
<title>Peach Coffee Cake II</title>
<source>Cookin_Queen, HOMESCHOOLMUMMYX3, ALL RIGHTS RESERVED © 2012 Allrecipes.com Printed from Allrecipes.com 9/9/2012</source>
<link>http://allrecipes.com/Recipe-Tools/Print/Recipe.aspx?RecipeID=87959&amp;origin=detail&amp;&amp;Servings=16</link>
<preptime>20 minutes</preptime>
<cooktime>45 minutes</cooktime>
<yields>16 servings</yields>
@ockham
ockham / edit-link.patch
Created January 13, 2013 15:40
Patch to enable addition of an Edit post link to custom types as added by the Wordpress "My Content Management" plugin. (Tested with glossary terms.)
@ockham
ockham / numbers.patch
Created December 29, 2012 20:48
I've produced a patch that enables a `numbers` option to the [alphabet] shortcode which defaults to 'true', but when set to false, makes the shortcode result in displaying only letters, not numbers, i.e. ABCDEFGHIJKLMNOPQRSTUVWXYZ instead of 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ I've also simplified generation of numbers and letters by usage of r…
Gemeinsame Unterverzeichnisse: my-content-management/images und my-content-management-nums/images.
Gemeinsame Unterverzeichnisse: my-content-management/lang und my-content-management-nums/lang.
diff -u my-content-management/my-content-management.php my-content-management-nums/my-content-management.php
--- my-content-management/my-content-management.php 2012-10-27 20:27:18.000000000 +0200
+++ my-content-management-nums/my-content-management.php 2012-12-29 21:27:34.000000000 +0100
@@ -700,7 +700,7 @@
if ( $value == 'mcm_glossary' && function_exists('mcm_set_glossary') ) { $extension = "<h4>Glossary Extension</h4>
<p>".__('The glossary extension to My Content Management is enabled.','my-content-management')."</p>
<ul>
- <li><code>[alphabet]</code>: ".__('displays list of linked first characters represented in your Glossary. (Roman alphabet only.)','my-content-management')."</li>
<?php
/**
* Date Functions
*
* Display functions (template-tags) for use in WordPress templates.
*/
// Don't load directly
if ( !defined('ABSPATH') ) { die('-1'); }
@ockham
ockham / noenddate.patch
Created December 26, 2012 17:55
Patch against 2.0.10 to only display end time in The Events Calendar widget if end date is equal begin date. (German) example: 4. Februar 2013 19:00 – 22:00 instead of previously 4. Februar 2013 19:00 – 4. Februar 2013 22:00
--- the-events-calendar/public/template-tags/date.php 2012-12-26 13:57:11.000000000 +0100
+++ date.php 2012-12-26 18:32:36.000000000 +0100
@@ -57,7 +57,7 @@
* @todo support $postId for recurring events.
* @since 2.0
*/
- function tribe_get_end_date( $postId = null, $displayTime = 'true', $dateFormat = '' ) {
+ function tribe_get_end_date( $postId = null, $displayTime = 'true', $dateFormat = '', $displayDate = true ) {
$postId = TribeEvents::postIdHelper( $postId );
if (!$postId || ( function_exists('tribe_is_recurring_event') && tribe_is_recurring_event( $postId ) ) ) {