Skip to content

Instantly share code, notes, and snippets.

Bernhard Schussek webmozart

Block or report user

Report or block webmozart

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@webmozart
webmozart / algorithm.js
Last active Dec 18, 2015
Puli JSON parsing algorithm
View algorithm.js
function get(path)
{
if ('undefined' != typeof cache[path]) {
return cache[path]
}
cache[path] = new Resource(getTarget(path))
return cache[path]
}
View DefaultController.php
<?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()
View form-examples.html.twig
{% 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>
View gulp-puli.js
{
'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);
View GulpPlugin.php
<?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.
*/
View di-interop.php
<?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'));
View MoneyType.php
class MoneyType extends AbstractType implements DataMapperInterface
{
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('amount', 'integer')
->add('currency', 'string')
->setDataMapper($this)
;
}
View name-me.php
$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]
View bootstrap.php
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();
View less.php
<?php
$dspec = array(
0 => STDIN,
1 => STDOUT,
2 => STDERR,
);
$tempfile = tempnam(sys_get_temp_dir(), 'lesstest');
You can’t perform that action at this time.