Skip to content

Instantly share code, notes, and snippets.

@predakanga
predakanga / gist:2376835
Created April 13, 2012 13:27
Echoprint setup and usage

Requirements

For libcodegen

  • Boost >= 1.35
  • zlib

Additional requirements for the codegen binary

@predakanga
predakanga / MemoryOutput.php
Created August 22, 2012 02:07
MemoryOutput
<?php
namespace Fusion\Framework\CronBundle\Command;
use Symfony\Component\Console\Output\Output;
/**
* MemoryOutput implements OutputInterface, writing to an internal buffer
*/
class MemoryOutput extends Output {
protected $backingStore = "";
@predakanga
predakanga / CommandRunCommand.php
Created August 27, 2012 10:51
Code for running commands
<?php
/**
* The actual command which is used to call other commands
*/
class CommandRunCommand extends ContainerAwareCommand
{
protected function configure()
{
$this->setName("cmd:run")
@predakanga
predakanga / gist:3487705
Created August 27, 2012 11:30
Calling command from controller
<?php
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
/**
* @Route("/test")
*/
<?php
namespace Acme\UserBundle\Form\Type;
use JMS\DiExtraBundle\Annotation\FormType;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Doctrine\ORM\EntityRepository;
class A(object):
def id(self):
return "Hello"
class B(object):
def id(self):
return "Hi"
dict1 = {}
dict2 = {}
@predakanga
predakanga / duff.c
Created February 17, 2013 08:50
Duff's device in C
send(to, from, count)
register short *to, *from;
register count;
{
register n = (count + 7) / 8;
switch(count % 8) {
case 0: do { *to = *from++;
case 7: *to = *from++;
case 6: *to = *from++;
case 5: *to = *from++;
@predakanga
predakanga / context_closure.patch
Created July 22, 2013 08:40
Twig context closure support
diff --git a/lib/twig/twig/lib/Twig/Template.php b/lib/twig/twig/lib/Twig/Template.php
index a001ca0..1f3c04b 100644
--- a/lib/twig/twig/lib/Twig/Template.php
+++ b/lib/twig/twig/lib/Twig/Template.php
@@ -337,7 +337,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
protected function getAttribute($object, $item, array $arguments = array(), $type = Twig_TemplateInterface::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false)
{
// array
- if (Twig_TemplateInterface::METHOD_CALL !== $type) {
+ if (!is_object($object)) {
{ "elements": [ { "type": "bar_3d", "values": [ 35.7, 45, 9.1, 1.5, 8.6 ], "colour": "#D5282A", "alpha": 1, "tip": "#val#%" }, { "type": "tags", "values": [ { "x": 0, "y": 35.7 }, { "x": 1, "y": 45 }, { "x": 2, "y": 9.1 }, { "x": 3, "y": 1.5 }, { "x": 4, "y": 8.6 } ], "font": "Verdana", "font-size": 10, "colour": "#000000", "align-x": "center", "text": "#y#%" } ], "title": { "text": "Send younger14, natt14, sugar14 , lilo14 eller babes14 til 2030 for \u00e5 stemme", "style": "{font-size: 15px; font-family: Times New Roman; font-weight: bold; color: #000000; text-align: center;}" }, "bg_colour": "#FFFFFF", "x_axis": { "3d": 5, "colour": "#021840", "grid-colour": "#FFFFFF", "labels": { "colour": "#000000", "labels": [ "Stemmer: 346", "Stemmer: 436", "Stemmer: 88", "Stemmer: 15", "Stemmer: 83" ] } }, "y_axis": { "colour": "#021840", "grid-colour": "#FFFFFF", "min": 0, "max": 50, "steps": 10, "labels": { "colour": "#FFFFFF", "text": "#val#%" } } }
@predakanga
predakanga / default.rb
Created August 5, 2014 08:16
Devbox cookbook's default recipe
#
# Cookbook Name:: devbox
# Recipe:: default
#
# Copyright 2013, Lachlan Pease
#
# All rights reserved - Do Not Redistribute
#
include_recipe 'nginx::commons_dir'