Skip to content

Instantly share code, notes, and snippets.

View webmozart's full-sized avatar

Bernhard Schussek webmozart

View GitHub Profile
@webmozart
webmozart / Xerox-WorkCentre-6605DN.ppd
Created May 1, 2021 16:56
A Linux driver (PPD) for Xerox WorkCentre 6605DN that actually works
*PPD-Adobe: "4.3"
*% Adobe Systems PostScript(R) Printer Description File
*% Copyright 2009-2010 Xerox Corporation.
*FileVersion: "1.0"
*FormatVersion: "4.3"
*LanguageEncoding: ISOLatin1
*LanguageVersion: English
@webmozart
webmozart / algorithm.js
Last active December 18, 2015 16:10
Puli JSON parsing algorithm
function get(path)
{
if ('undefined' != typeof cache[path]) {
return cache[path]
}
cache[path] = new Resource(getTarget(path))
return cache[path]
}
<?php
namespace ACC\MainBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
class DefaultController extends Controller
{
/**
* @Route("/", name="accmain_index")
* @Template()
{% extends '::base.html.twig' %}
{% set active_section = 'goods' %}
{% use 'bootstrap_3_layout.html.twig' %}
{% block body -%}
<div class="page-header">
<h1>Edit Good</h1>
</div>
{
'publish': function (gulp) {
gulp.src('res/public')
.pipe(gulp.dest('web'));
gulp.src('vendor/batman/blog/res/public')
.pipe(gulp.dest('web/blog'));
},
'watch': function (gulp, tasks) {
gulp.watch('res/public', tasks);
<?php
/*
* This file is part of the puli/gulp-plugin package.
*
* (c) Bernhard Schussek <bschussek@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
<?php
// Bootstrap loaders
$symfonyLoader = new Symfony\DI\YamlLoader();
$zendLoader = new Zend\DI\PhpLoader();
$pimpleLoader = new Pimple\PhpLoader();
// Load configuration of different packages
$list = new ServiceDefinitionList();
$list->merge($symfonyLoader->loadDefinitions('packageA/config/services.yml'));
class MoneyType extends AbstractType implements DataMapperInterface
{
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('amount', 'integer')
->add('currency', 'string')
->setDataMapper($this)
;
}
$form->add('field', 'choice', array(
'choices' => array(
'Yes' => true,
'No' => false,
'Maybe' => null,
),
));
// $list->getValues(): ['0', '1', '2']
// $list->getChoices(): [0 => true, 1 => false 2 => null]
@webmozart
webmozart / bootstrap.php
Created January 4, 2015 22:17
Puli bootstrap
use Puli\PuliFactory;
// Can be configured to use an auto-loadable location/class-name
// More info will be in the docs
require_once __DIR__.'/.puli/PuliFactory.php';
$factory = new PuliFactory();
$repo = $factory->createRepository();