text:
package archimulator.os.event;

import archimulator.os.Context;
import archimulator.os.ContextKilledEvent;

/**
 * Wait for process ID criterion.
 *
 * @author Min Cai
 */
public class WaitForProcessIdCriterion implements SystemEventCriterion {
    private int processId;
    private boolean hasProcessIdKilled;

    /**
     * Create a wait for process ID criterion.
     *
     * @param context   the context
     * @param processId the process ID
     */
    public WaitForProcessIdCriterion(Context context, int processId) {
        this.processId = processId;

        this.hasProcessIdKilled = false;

        if (this.processId == -1) {
            context.getBlockingEventDispatcher().addListener(ContextKilledEvent.class, event -> {
                hasProcessIdKilled = true;
            });
        }
    }

    public boolean needProcess(Context context) {
        return this.getProcessId() == -1 && this.hasProcessIdKilled || this.getProcessId() > 0 && context.getKernel().getContextFromProcessId(this.processId) == null;
    }

    /**
     * Get the process ID.
     *
     * @return the process ID
     */
    public int getProcessId() {
        return processId;
    }
}


text:
<?php

/**
 * Posts controller (scaffold)
 */

namespace Controllers;

use Slick\Mvc\Controller;

/**
 * Class Posts
 * @package Controllers
 */
class Posts extends Controller
{

    /**
     * @var bool Enables scaffolding
     */
    public $scaffold = true;
}

redpajama_set_name: RedPajamaGithub


text:
int
main()
{
	Board::initialize();

	// Initialize Usart Hal
	GpioOutputA2::connect(UsartHal2::Tx);
	GpioInputA3::connect(UsartHal2::Rx, Gpio::InputType::PullUp);
//	UsartHal2::initialize<Board::systemClock, 115200>(UsartHal2::Parity::Odd);
	UsartHal2::enableInterruptVector(true, 14);
	UsartHal2::enableInterrupt(UsartHal2::Interrupt::TxEmpty);
	UsartHal2::setTransmitterEnable(true);

	while (1)
	{
	}

	return 0;
}

// Interrupt Handler
extern "C" void
USART2_IRQHandler(void)
{
	UsartHal2::getInterruptFlags();
	if(UsartHal2::isTransmitRegisterEmpty()) {
		UsartHal2::write('A');
	}
}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <link rel="stylesheet" href="../css/footer.css" type="text/css">
    <title></title>

© 2017 Kaida Contemporary. All rights reserved.


text:
This example shows:

- How make your own form controls in separate modules (specifically shows inputs, textxareas, selects and )
- How nest many childs in a nice way into a form module
- How validate the data in the form
- How send your info to a server and how manage the response and errors

```
cd Fractal.js
npm run general forms
```

Run the example server with:

```
cd examples/forms
npm i
node server
```


text:
<?php

namespace ETAP\EmpruntBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use ETAP\EmpruntBundle\Entity\Profil;
use ETAP\EmpruntBundle\Form\ProfilType;

/**
 * Profil controller.
 *
 */
class ProfilController extends Controller
{
    /**
     * Lists all Profil entities.
     *
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        $entities = $em->getRepository('EmpruntBundle:Profil')->findAll();

        return $this->render('EmpruntBundle:Profil:index.html.twig', array(
            'entities' => $entities,
        ));
    }

    /**
     * Creates a new Profil entity.
     *
     */
    public function createAction(Request $request)
    {
        $entity  = new Profil();
        $form = $this->createForm(new ProfilType(), $entity);
        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

            return $this->redirect($this->generateUrl('profil_show', array('id' => $entity->getId())));
        }

        return $this->render('EmpruntBundle:Profil:new.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
        ));
    }

    /**
     * Displays a form to create a new Profil entity.
     *
     */
    public function newAction()
    {
        $entity = new Profil();
        $form   = $this->createForm(new ProfilType(), $entity);

        return $this->render('EmpruntBundle:Profil:new.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
        ));
    }

    /**
     * Finds and displays a Profil entity.
     *
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('EmpruntBundle:Profil')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Profil entity.');
        }

        $deleteForm = $this->createDeleteForm($id);

        return $this->render('EmpruntBundle:Profil:show.html.twig', array(
            'entity'      => $entity,
            'delete_form' => $deleteForm->createView(),        ));
    }

    /**
     * Displays a form to edit an existing Profil entity.
     *
     */
    public function editAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('EmpruntBundle:Profil')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Profil entity.');
        }

        $editForm = $this->createForm(new ProfilType(), $entity);
        $deleteForm = $this->createDeleteForm($id);

        return $this->render('EmpruntBundle:Profil:edit.html.twig', array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        ));
    }

    /**
     * Edits an existing Profil entity.
     *
     */
    public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('EmpruntBundle:Profil')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Profil entity.');
        }

        $deleteForm = $this->createDeleteForm($id);
        $editForm = $this->createForm(new ProfilType(), $entity);
        $editForm->bind($request);

        if ($editForm->isValid()) {
            $em->persist($entity);
            $em->flush();

            return $this->redirect($this->generateUrl('profil_edit', array('id' => $id)));
        }

        return $this->render('EmpruntBundle:Profil:edit.html.twig', array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        ));
    }

    /**
     * Deletes a Profil entity.
     *
     */
    public function deleteAction(Request $request, $id)
    {
        $form = $this->createDeleteForm($id);
        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $entity = $em->getRepository('EmpruntBundle:Profil')->find($id);

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Profil entity.');
            }

            $em->remove($entity);
            $em->flush();
        }

        return $this->redirect($this->generateUrl('profil'));
    }

    /**
     * Creates a form to delete a Profil entity by id.
     *
     * @param mixed $id The entity id
     *
     * @return Symfony\Component\Form\Form The form
     */
    private function createDeleteForm($id)
    {
        return $this->createFormBuilder(array('id' => $id))
            ->add('id', 'hidden')
            ->getForm()
        ;
    }
}


text:
var config      = require("../config/specs");
var helper      = require("./helper");
var extendWebdriverIO = require("./util/webdriverio-ext");

describe('maputnik', function() {

  before(async function(done) {
    await extendWebdriverIO();
    helper.startGeoserver(done);
  });

  after(function(done) {
    helper.stopGeoserver(done);
  });

  beforeEach(async function() {
    await browser.url(config.baseUrl+"?debug&style="+helper.getStyleUrl([
      "geojson:example",
      "raster:raster"
    ]));
    await browser.acceptAlert();
    await browser.execute(function() {
      localStorage.setItem("survey", true);
    });
    const elem = await $(".maputnik-toolbar-link");
    await elem.waitForExist();
    await browser.flushReactUpdates();
  });

  // -------- setup --------
  require("./util/coverage");
  // -----------------------

  // ---- All the tests ----
  require("./history");
  require("./layers");
  require("./map");
  require("./modals");
  require("./screenshots");
  require("./accessibility");
  require("./keyboard");
  // ------------------------

});


text:
import os

from django.utils import timezone

from jobs import presets
from utils.overpass import Overpass

"""
    Harness to run an Overpass Query outside of test context.
    Uses HDM/OSM Data Models to construct overpass query.
    From the project directory run:
    ./manage.py runscript overpass_benchmarks --settings=hot_exports.settings -v2
    Depends on django-extensions.
"""

def run(*script_args):
    url = 'http://localhost/interpreter'
    bbox = '6.25,-10.85,6.40,-10.62'  # monrovia
    lib_bbox = '4.15,-11.60,8.55,-7.36'
    path = '/home/ubuntu/www/hotosm/utils/tests'
    query = '(node(6.25,-10.85,6.40,-10.62);<;);out body;'
    parser = presets.PresetParser(preset=path + '/files/osm_presets.xml')
    kvps = parser.parse()
    filters = []
    for kvp in kvps:
        filter_tag = '{0}={1}'.format(kvp['key'], kvp['value'])
        filters.append(filter_tag)
    print filters

    print "=============="
    print "Querying Monrovia with OSM filters."
    print timezone.now()
    op = Overpass(
        bbox=bbox, stage_dir=path + '/files/',
        job_name='test', filters=filters
    )
    osm = op.run_query()
    print timezone.now()
    stat = os.stat(osm)
    size = stat.st_size / 1024 / 1024.00
    print 'Result file size: {0}'.format(size)

    filtered = op.filter()

    # check pbf conversion
    # pbf = OSMToPBF(osm=path + '/files/filter.osm', pbffile=path + '/files/filter.pbf', debug=True)
    # pbf.convert()

    """
    print "=============="
    print "Querying Monrovia without filters."
    print timezone.now()
    op = Overpass(osm=osm, bbox=bbox)
    op.run_query()
    print timezone.now()
    stat = os.stat(osm)
    size = stat.st_size / 1024 / 1024.00
    print 'Result file size: {0}'.format(size)

    print "=============="
    print "Querying Liberia with HDM filters."
    print timezone.now()
    op = Overpass(osm=osm, bbox=lib_bbox, tags=filters)
    op.run_query()
    print timezone.now()
    stat = os.stat(osm)
    size = stat.st_size / 1024 / 1024.00
    print 'Result file size: {0}'.format(size)

    print "=============="
    print "Querying Liberia without filters."
    print timezone.now()
    op = Overpass(osm=osm, bbox=lib_bbox)
    op.run_query()
    print timezone.now()
    stat = os.stat(osm)
    size = stat.st_size / 1024 / 1024.00
    print 'Result file size: {0}'.format(size)
    """


text:
<?php

namespace Tests\Unit\WindowsAzure\MediaServices\Models;
use WindowsAzure\MediaServices\Models\MediaProcessor;

/**
 * Represents access policy object used in media services
 *
 * @category  Microsoft
 * @package   WindowsAzure\MediaServices\Models
 * @author    Azure PHP SDK <azurephpsdk@microsoft.com>
 * @copyright Microsoft Corporation
 * @license   http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
 * @version   Release: 0.4.1_2015-03
 * @link      https://github.com/windowsazure/azure-sdk-for-php
 */

class MediaProcessorTest extends \PHPUnit_Framework_TestCase
{

    /**
     * @covers WindowsAzure\MediaServices\Models\MediaProcessor::createFromOptions
     * @covers WindowsAzure\MediaServices\Models\MediaProcessor::fromArray
     */
    public function testCreateFromOptions(){

        // Setup
        $options = array(
                'Id'                  => 'sfgsfg34',
                'Name'                => 'Some Name',
                'Description'         => 'Description of media processor',
                'Sku'                 => '456-123-789',
                'Vendor'              => 'Vendors name',
                'Version'             => '3.6.5',
        );

        // Test
        $mediaProc = MediaProcessor::createFromOptions($options);

        // Assert
        $this->assertEquals($options['Id'], $mediaProc->getId());
        $this->assertEquals($options['Name'], $mediaProc->getName());
        $this->assertEquals($options['Description'], $mediaProc->getDescription());
        $this->assertEquals($options['Sku'], $mediaProc->getSku());
        $this->assertEquals($options['Vendor'], $mediaProc->getVendor());
        $this->assertEquals($options['Version'], $mediaProc->getVersion());
    }

    /**
     * @covers WindowsAzure\MediaServices\Models\MediaProcessor::getId
     * @covers WindowsAzure\MediaServices\Models\MediaProcessor::__construct
     */
    public function testGetId(){

        // Setup
        $options = array(
                'Id'             => 'sfgsfg34',
        );
        $mediaProc = MediaProcessor::createFromOptions($options);

        // Test
        $result = $mediaProc->getId();

        // Assert
        $this->assertEquals($options['Id'], $result);
    }

    /**
     * @covers WindowsAzure\MediaServices\Models\MediaProcessor::getName
     */
    public function testGetName(){

        // Setup
        $options = array(
                'Name'           => 'Some Name',
        );
        $mediaProc = MediaProcessor::createFromOptions($options);

        // Test
        $result = $mediaProc->getName();

        // Assert
        $this->assertEquals($options['Name'], $result);
    }

    /**
     * @covers WindowsAzure\MediaServices\Models\MediaProcessor::getDescription
     */
    public function testGetDescription(){

        // Setup
        $options = array(
                'Description'          => 'Description of media processor'
        );
        $mediaProc = MediaProcessor::createFromOptions($options);

        // Test
        $result = $mediaProc->getDescription();

        // Assert
        $this->assertEquals($options['Description'], $result);
    }

    /**
     * @covers WindowsAzure\MediaServices\Models\MediaProcessor::getSku
     */
    public function testGetSku(){

        // Setup
        $options = array(
                'Sku'        => '123-456-789'
        );
        $mediaProc = MediaProcessor::createFromOptions($options);

        // Test
        $result = $mediaProc->getSku();

        // Assert
        $this->assertEquals($options['Sku'], $result);
    }

    /**
     * @covers WindowsAzure\MediaServices\Models\MediaProcessor::getVendor
     */
    public function testGetVendor(){

        // Setup
        $options = array(
                'Vendor'        => 'Vendors name'
        );
        $mediaProc = MediaProcessor::createFromOptions($options);

        // Test
        $result = $mediaProc->getVendor();

        // Assert
        $this->assertEquals($options['Vendor'], $result);
    }

    /**
     * @covers WindowsAzure\MediaServices\Models\MediaProcessor::getVersion
     */
    public function testGetVersion(){

        // Setup
        $options = array(
                'Version'        => '3.6.5'
        );
        $mediaProc = MediaProcessor::createFromOptions($options);

        // Test
        $result = $mediaProc->getVersion();

        // Assert
        $this->assertEquals($options['Version'], $result);
    }
}


text:
.styleSans27.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 27.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans11.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 11.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 10.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans28.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 28.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 9.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 12pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans251.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 251.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 6.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans3.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 3.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans14.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 14.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans55.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 55.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans56.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 56.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 8.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans1.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 1.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans57.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 57.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans60.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 60.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans587.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 587.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans30.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 30.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans16.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 16.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans19.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 19.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans20.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 20.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans53.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 53.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 5.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans137.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 137.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans96.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 96.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans221.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 221.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans193.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 193.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans93.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 93.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 7.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans153.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 153.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans37.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 37.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans84.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 84.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans79.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 79.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans108.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 108.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans2.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 2.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans15.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 15.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans62.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 62.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans12.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 12.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans13.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 13.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans518.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 518.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans68.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 68.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans50.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 50.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans18.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 18.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans149.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 149.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans40.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 40.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans75.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 75.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans1175.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 1175.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans680.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 680.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans743.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 743.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans178.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 178.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans225.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 225.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans547.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 547.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans195.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 195.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans469.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 469.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans415.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 415.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans329.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 329.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans382.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 382.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans379.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 379.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans196.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 196.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans237.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 237.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans300.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 300.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans344.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 344.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans546.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 546.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans140.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 140.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans324.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 324.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans246.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 246.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans419.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 419.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans451.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 451.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans151.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 151.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans467.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 467.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}

.styleSans440.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle> {
    font-family: Sans;
    font-size: 440.0pt;
    font-weight: normal;
    font-style: normal;
    text-align: 0;
    letter-spacing: 0pt;
    line-height: 0pt;
}


text:
# Chocolatey GHC Dev
#
# Licensed under the MIT License
#
# Copyright (C) 2016 Tamar Christina <tamar@zhox.com>

# Include the shared scripts
$thisScript = Split-Path -Parent $MyInvocation.MyCommand.Definition
. ($thisScript +  '.\chocolateyShared-Template.ps1')

if ($arch -eq 'x86') {
    $url           = 'http://repo.msys2.org/distrib/i686/msys2-base-i686-20180531.tar.xz'
    $checksum      = 'c985127122d32e90967d2348fc97e879cba602a9'
    $checksumType  = 'SHA1'
} else {
    $url           = 'http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20180531.tar.xz'
    $checksum      = '309f604a165179d50fbe4131cf87bd160769f974'
    $checksumType  = 'SHA1'
}

# Continue with package
Write-Host "Installing to '$packageDir'"
Install-ChocolateyZipPackage $packageName $url $packageDir `
  -checksum $checksum -checksumType $checksumType

# check if .tar.xz was only unzipped to tar file
# (shall work better with newer choco versions)
$tarFile = Join-Path $packageDir ($packageName + 'Install')
if (Test-Path $tarFile) {
    Get-ChocolateyUnzip $tarFile $msysRoot
    Remove-Item $tarFile
}

# Finally initialize and upgrade MSYS2 according to https://msys2.github.io
Write-Host "Initializing MSYS2..."

execute "Processing MSYS2 bash for first time use" `
        "exit"

execute "Appending profile with path information" `
        ('echo "export PATH=/mingw' + $osBitness + '/bin:\$PATH" >>~/.bash_profile')

execute "Setting default MSYSTEM" `
        ('echo "export MSYSTEM=' + ("MINGW" + $osBitness) + '" >>~/.bash_profile')

# Now perform commands to set up MSYS2 for GHC Developments
execute "Update pacman package DB" `
        "pacman -Syy"
# Workaround for a stupid msys2 cycle they introduced
execute "Removing catgets libcatgets" `
         "pacman --noconfirm -R catgets libcatgets"

execute "Updating system packages" `
        "pacman --noconfirm --needed -Sy bash pacman pacman-mirrors msys2-runtime"
rebase
execute "Upgrading full system" `
        "pacman --noconfirm -Su"

# It seems some parts of the system have to be update for others to be updateable. So just run this twice.
execute "Upgrading full system twice" `
        "pacman --noconfirm -Su"

rebase
execute "Installing GHC Build Dependencies" `
        "pacman --noconfirm -S --needed git tar binutils autoconf make libtool automake python python2 p7zip patch unzip mingw-w64-`$(uname -m)-gcc mingw-w64-`$(uname -m)-gdb mingw-w64-`$(uname -m)-python3-sphinx"

#Force reinstall in order to install ca-certificates with the updated pk11 tools
execute "Updating SSL root certificate authorities" `
        "pacman --noconfirm -S ca-certificates"

execute "Ensuring /mingw folder exists" `
        ('test -d /mingw' + $osBitness + ' || mkdir /mingw' + $osBitness)

execute "Installing bootstrapping GHC 8.2.2 version" `
        ('curl --stderr - -LO https://downloads.haskell.org/~ghc/8.2.2/ghc-8.2.2-' + $ghcArch + '-unknown-mingw32.tar.xz && tar -xJ -C /mingw' + $osBitness + ' --strip-components=1 -f ghc-8.2.2-' + $ghcArch + '-unknown-mingw32.tar.xz && rm -f ghc-8.2.2-' + $ghcArch + '-unknown-mingw32.tar.xz')

execute "Installing alex, happy and cabal" `
        ('mkdir -p /usr/local/bin && curl --stderr - -LO https://www.haskell.org/cabal/release/cabal-install-2.0.0.1/cabal-install-2.0.0.1-i386-unknown-mingw32.zip && unzip cabal-install-2.0.0.1-i386-unknown-mingw32.zip -d /usr/local/bin && rm -f cabal-install-2.0.0.1-i386-unknown-mingw32.zip && cabal update && cabal install -j --prefix=/usr/local alex happy')

execute "Re-installing HsColour" `
        'cabal install -j --prefix=/usr/local HsColour --reinstall'

# Create files to access msys
Write-Host "Creating msys2 wrapper..."
$cmd = "@echo off`r`npushd %~dp0`r`n$msysShell -mingw" + $osBitness
echo "$cmd" | Out-File -Encoding ascii (Join-Path $packageDir ($packageName + ".cmd"))

execute "Copying GHC gdb configuration..." `
        ('cp "' + (Join-Path $toolsDir ".gdbinit") + '" ~/.gdbinit')

# Install Arcanist
if ($useArc -eq $true) {
    Write-Host "Setting up Arcanist as requested."

    execute "Installing php" `
            'mkdir -p /usr/local/bin && curl --stderr - -LO http://windows.php.net/downloads/releases/archives/php-5.6.23-Win32-VC11-x86.zip && unzip php-5.6.23-Win32-VC11-x86.zip -d /usr/local/bin && rm -f php-5.6.23-Win32-VC11-x86.zip'

    execute "Cloning arcanist" `
            "git clone https://github.com/phacility/libphutil.git && git clone https://github.com/phacility/arcanist.git"

    execute "Adding arcanist to path information" `
            'echo "export PATH=$(pwd)/arcanist/bin:\$PATH" >>~/.bash_profile'

    execute "Copying PHP configuration..." `
            ('cp "' + (Join-Path $toolsDir "php.ini") + '" /usr/local/bin/php.ini')
}

# Get the GHC sources
if ($getSource -eq $true) {
    Write-Host "Getting a checkout of GHC for your coding pleasure..."

    execute "Fetching sources..." `
            "git clone --recursive git://git.haskell.org/ghc.git"

    # Configure Arcanist if it was installed
    if ($useArc -eq $true) {
        execute "Initializing arc..." `
                "cd ghc && arc set-config default https://phabricator.haskell.org/ && arc install-certificate"
    }
}

# Install SSHd
if ($useSsh -eq $true) {
    Write-Host "Setting up SSH as requested."

    execute "Installing SSHd dependencies" `
            "pacman --noconfirm -S --needed openssh cygrunsrv mingw-w64-x86_64-editrights"

    execute "Configuring SSHd..." `
        ('cp "' + (Join-Path $toolsDir "setup_sshd.sh") + '" ~/setup_sshd.sh && sh ~/setup_sshd.sh && rm ~/setup_sshd.sh')

    # Open firewall port
    Write-Host "Opening firewall for SSHd access"
    netsh advfirewall firewall add rule name='MSYS2 SSHd' dir=in action=allow protocol=TCP localport=$SSH_PORT
}

Write-Host "Preventing Chocolatey shims..."
# ignore shims for MSYS2 programs directly
$files = get-childitem $installDir -include *.exe, *.bat, *.com -recurse
$i = 0;

foreach ($file in $files) {
  #generate an ignore file
  New-Item "$file.ignore" -type file -force | Out-Null
  Write-Progress -activity "Processing executables" -status "Hiding: " -percentcomplete ($i++/$files.length) -currentOperation $file
}

Write-Host "Adding '$packageDir' to PATH..."
Install-ChocolateyPath $packageDir

Write-Output "***********************************************************************************************"
Write-Output "*"
Write-Output "*  ...And we're done!"
Write-Output "*"
Write-Output "*"
Write-Output ("*  You can run this by running '" + $packageName + ".cmd' after restarting powershell")
Write-Output "*  or by launching the batch file directly."
Write-Output "*"
Write-Output "*  For instructions on how to get the sources visit https://ghc.haskell.org/trac/ghc/wiki/Building/GettingTheSources"
Write-Output "*"
Write-Output "*  For information on how to fix bugs see https://ghc.haskell.org/trac/ghc/wiki/WorkingConventions/FixingBugs"
Write-Output "*"
Write-Output "*  And for general beginners information consult https://ghc.haskell.org/trac/ghc/wiki/Newcomers"
Write-Output "*"
Write-Output "*  If you want to submit back patches, you still have some work to do."
Write-Output "*  Please follow the guide at https://ghc.haskell.org/trac/ghc/wiki/Phabricator"
Write-Output "*"
if ($useArc -eq $false) {
    Write-Output "*  For this you do need PHP, PHP can be downloaded from http://windows.php.net/download#php-5.6"
    Write-Output "*  and need to be in your PATH for arc to find it."
    Write-Output "*"
} elseif ($getSource -eq $false) {
    Write-Output "*  arc has been installed. Once you check out the ghc code, perform the following commands to finish the install:"
    Write-Output "*  cd ~/code/ghc-head"
    Write-Output "*  arc install-certificate"
    Write-Output "*"
}
if ($useSsh -eq $true) {
    $hostname=hostname
    Write-Output ("*  SSH has been installed and configured to run on PORT " + $SSH_PORT + ".")
    Write-Output ("*  For reference. This computer is named " + $hostname + ".")
    Write-Output "*"
}
if ($getSource -eq $true) {
    Write-Output "*  A checkout of the GHC sources has been made in ~/ghc."
    Write-Output "*"
}

Write-Output "*  Hadrian has been installed and configured in ~/ghc."
Write-Output "*  This means you can now use shake to build GHC."
Write-Output "*  See https://github.com/snowleopard/hadrian for instructions."
Write-Output "*"

Write-Output "*  For other information visit https://ghc.haskell.org/trac/ghc/wiki/Building"
Write-Output "*"
Write-Output "*"
Write-Output "*  Happy Hacking!"
Write-Output "*"
Write-Output "***********************************************************************************************"
Write-Output "Waiting for chocolatey to finish..."


text:
function foo() {
  Math.random();
  new Function("");
}

foo();
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
foo();


text:
--TEST--
PHPC-923: Use zend_string_release() to free class names (__pclass)
--FILE--
<?php

require_once __DIR__ . '/../utils/basic.inc';

/* Register an autoloader that does nothing more than append the class name to
 * an array. This adds a reference to the zend_string in PHP 7, which exposes an
 * assert failure if the value is then freed with zend_string_free() instead of
 * zend_string_release(). */
$classes = [];

spl_autoload_register(function ($class) use (&$classes) {
    $classes[] = $class;
});

/* Note: An exception is not thrown if the __pclass field fails to denote a
 * valid class. Instead, it is left as-is and the general type map applies. */
var_dump(toPHP(fromJSON('{"x":{"__pclass":{"$binary":"TWlzc2luZ0NsYXNz","$type":"80"}}}')));

var_dump($classes);

?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(stdClass)#%d (%d) {
  ["x"]=>
  object(stdClass)#%d (%d) {
    ["__pclass"]=>
    object(MongoDB\BSON\Binary)#%d (%d) {
      ["data"]=>
      string(12) "MissingClass"
      ["type"]=>
      int(128)
    }
  }
}
array(1) {
  [0]=>
  string(12) "MissingClass"
}
===DONE===


text:
package com.odd.TangoUpsample;

//----------------------------------------------------------------------------------------
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Point;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.Display;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;
import android.widget.Toast;
import android.util.Log;

//----------------------------------------------------------------------------------------
public class TangoUpsampleActivity
	extends Activity
	implements View.OnClickListener
{
	private static final String		TAG = "TangoUpsample";

	private TangoUpsampleRenderer	renderer_;
    private GLSurfaceView			view_;
    private TextView				tangoPoseStatusText_;
    private String					appVersionString_;

    public static final String		EXTRA_KEY_PERMISSIONTYPE = "PERMISSIONTYPE";
    public static final String		EXTRA_VALUE_VIO = "MOTION_TRACKING_PERMISSION";
    public static final String		EXTRA_VALUE_VIOADF = "ADF_LOAD_SAVE_PERMISSION";

	//----------------------------------------------------------------------------------------
    @Override
    protected void onCreate(Bundle savedInstanceState)
	{
        super.onCreate(savedInstanceState);

        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

        Intent intent1 = new Intent();
        intent1.setAction("android.intent.action.REQUEST_TANGO_PERMISSION");
        intent1.putExtra(EXTRA_KEY_PERMISSIONTYPE, EXTRA_VALUE_VIO);
        startActivityForResult(intent1, 0);

        Intent intent2 = new Intent();
        intent2.setAction("android.intent.action.REQUEST_TANGO_PERMISSION");
        intent2.putExtra(EXTRA_KEY_PERMISSIONTYPE, EXTRA_VALUE_VIOADF);
        startActivityForResult(intent2, 0);

        setTitle(R.string.app_name);
		setContentView(R.layout.tango_upsample);

		// create the view and set the renderer...
        view_ = (GLSurfaceView)findViewById(R.id.surfaceview);
		view_.setEGLContextFactory(new TangoUpsampleRenderer.ContextFactory(3.0));
        renderer_ = new TangoUpsampleRenderer();
        renderer_.activity = TangoUpsampleActivity.this;
        renderer_.useAutoRecovery = true;
		renderer_.useDepthCamera = true;
		renderer_.useColorCamera = true;
        view_.setRenderer(renderer_);

        tangoPoseStatusText_ = (TextView)findViewById(R.id.debug_info);
		tangoPoseStatusText_.setTextColor(0xffff00ff);
		//tangoPoseStatusText_.setBackgroundColor(0xff000000);

        try {
            PackageInfo pInfo = this.getPackageManager().getPackageInfo(this.getPackageName(), 0);
            appVersionString_ = pInfo.versionName;
        } catch (NameNotFoundException e) {
            e.printStackTrace();
            appVersionString_ = " ";
        }

        findViewById(R.id.reset).setOnClickListener(this);
        findViewById(R.id.first).setOnClickListener(this);
        findViewById(R.id.third).setOnClickListener(this);
        findViewById(R.id.first_color).setOnClickListener(this);
        findViewById(R.id.first_fisheye).setOnClickListener(this);
        findViewById(R.id.first_pointcloud).setOnClickListener(this);

		startUIThread();
    }

	//----------------------------------------------------------------------------------------
	@Override
    protected void onDestroy()
	{
        super.onDestroy();
    }

	//----------------------------------------------------------------------------------------
    @Override
    protected void onResume()
	{
        super.onResume();
        view_.onResume(); // GLSurfaceView clients must pass this along.

		View decorView = getWindow().getDecorView();
		int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                      | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                      | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                      | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
                      | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
                      | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
		decorView.setSystemUiVisibility(uiOptions);
    }

	//----------------------------------------------------------------------------------------
    @Override
    protected void onPause()
	{
        super.onPause();

		view_.queueEvent(new Runnable() {
			@Override public void run() {
				renderer_.notifyPausing(); // notify renderer of pause for resource cleanup.
			}
		});

        view_.onPause(); // GLSurfaceView clients must pass this along.

		TangoUpsampleNative.disconnectService();
    }

	//----------------------------------------------------------------------------------------
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data)
	{
        if (requestCode == 0) {
            if (resultCode == RESULT_CANCELED) {
                Toast.makeText(this,
                "Motion Tracking Permission Needed!", Toast.LENGTH_SHORT).show();
                finish();
            }
        }
        if (requestCode == 1) {
            if (resultCode == RESULT_CANCELED) {
                Toast.makeText(this,
                "ADF Permission Needed!", Toast.LENGTH_SHORT).show();
                finish();
            }
        }
    }

	//----------------------------------------------------------------------------------------
	private void startUIThread() {
		new Thread(new Runnable() {
			@Override
			public void run() {
				while (true) {
					try {
						Thread.sleep(10);	// every 10ms

						runOnUiThread(new Runnable() {
							public void run() {
								boolean isLocalized = TangoUpsampleNative.getIsLocalized();
								if(isLocalized) {
									findViewById(R.id.reset).setVisibility(View.GONE);
								} else {
									findViewById(R.id.reset).setVisibility(View.VISIBLE);
								}
								tangoPoseStatusText_.setText(TangoUpsampleNative.getPoseString());
							}
						});

					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}
		}).start();
	}

	//----------------------------------------------------------------------------------------
    @Override
    public void onClick(View v)
	{
        switch (v.getId()) {
        case R.id.reset:
            TangoUpsampleNative.resetMotionTracking();
            break;
        case R.id.first:
            TangoUpsampleNative.setCamera(1);
            break;
        case R.id.third:
            TangoUpsampleNative.setCamera(0);
            break;
        case R.id.first_color:
            TangoUpsampleNative.setCamera(2);
            break;
        case R.id.first_fisheye:
            TangoUpsampleNative.setCamera(3);
            break;
        case R.id.first_pointcloud:
            TangoUpsampleNative.setCamera(4);
            break;
        }
    }

	//----------------------------------------------------------------------------------------
}

//----------------------------------------------------------------------------------------


text:
using System;
using System.Collections.Generic;

namespace Xamarin.Forms
{
	internal interface IResourceDictionary : IEnumerable<KeyValuePair<string, object>>
	{
		bool TryGetValue(string key, out object value);

		event EventHandler<ResourcesChangedEventArgs> ValuesChanged;
	}
}


text:
Welcome to university!

				Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur dignissimos dolorem inventore ipsum labore nihil nulla optio pariatur, perferendis repellendus suscipit ut vel voluptas. Assumenda eum labore nihil nulla temporibus.

				Login
				Register

Our news

							Lorem ipsum

22.10.2015

					Lorem ipsum dolor sit amet, consectetur adipisicing elit.
					Consectetur dignissimos dolorem inventore ipsum labore nihil nulla optio pariatur,
					perferendis repellendus suscipit ut vel voluptas. Assumenda eum labore nihil nulla temporibus...

				Read more

							Lorem ipsum

22.10.2015

					Lorem ipsum dolor sit amet, consectetur adipisicing elit.
					Consectetur dignissimos dolorem inventore ipsum labore nihil nulla optio pariatur,
					perferendis repellendus suscipit ut vel voluptas. Assumenda eum labore nihil nulla temporibus...

				Read more


text:
import React from 'react';
import { Icon, Menu } from 'antd';
import ItemWithMenu from '../item_with_menu';
import './style/index.less';
import { confirmDlg } from '../confirm_dialog/index';
import { DtoRecord } from '../../common/interfaces/dto_record';
import { StringUtil } from '../../utils/string_util';
import { RecordCategory } from '../../misc/record_category';
import { DtoCollection } from '../../common/interfaces/dto_collection';
import { newFolderName } from '../../misc/constants';
import { getDefaultRecord } from '../../state/collection';
import { ParameterType } from '../../misc/parameter_type';
import Msg from '../../locales';
import LocalesString from '../../locales/string';

interface CollectionItemProps {

    collection: DtoCollection;

    recordCount: number;

    readOnly: boolean;

    onNameChanged(name: string);

    deleteCollection();

    createRecord(record: DtoRecord);

    moveToCollection(record: DtoRecord, collectionId?: string);

    shareCollection(collectionId: string);

    editCommonSetting();

    editReqStrictSSL();

    editReqFollowRedirect();
}

interface CollectionItemState {

    isDragOver?: boolean;
}

const createDefaultFolder: (collectionId: string) => DtoRecord = (cid) => {
    return {
        id: StringUtil.generateUID(),
        name: newFolderName(),
        category: RecordCategory.folder,
        collectionId: cid,
        parameterType: ParameterType.ManyToMany
    };
};

class CollectionItem extends React.Component<CollectionItemProps, CollectionItemState> {

    private itemWithMenu: ItemWithMenu | null;

    constructor(props: CollectionItemProps) {
        super(props);
        this.state = {
            isDragOver: false
        };
    }

    public shouldComponentUpdate(nextProps: CollectionItemProps, nextState: CollectionItemState) {
        return this.props.collection.id !== nextProps.collection.id ||
            this.props.collection.name !== nextProps.collection.name ||
            this.props.collection.reqFollowRedirect !== nextProps.collection.reqFollowRedirect ||
            this.props.collection.reqStrictSSL !== nextProps.collection.reqStrictSSL ||
            this.props.recordCount !== nextProps.recordCount ||
            this.state.isDragOver !== nextState.isDragOver;
    }

    private getMenu = () => {
        const { reqFollowRedirect, reqStrictSSL } = this.props.collection;
        return (
            <Menu className="collection_item_menu" onClick={this.onClickMenu}>
                <Menu.Item key="edit">
                    <Icon type="edit" /> {Msg('Common.Rename')}
                </Menu.Item>
                <Menu.Item key="createFolder">
                    <Icon type="folder" /> {Msg('Collection.CreateFolder')}
                </Menu.Item>
                <Menu.Item key="createRecord">
                    <Icon type="file" /> {Msg('Collection.CreateRequest')}
                </Menu.Item>
                {/*<Menu.Item key="share">
                    <Icon type="share-alt" /> Share
                </Menu.Item>*/}
                <Menu.Item key="commonSetting">
                    <Icon type="code-o" /> {Msg('Collection.commonSetting')}
                </Menu.Item>
                <Menu.Item key="editReqStrictSSL">

                        <Icon type="safety" /> {Msg('Collection.RequestStrictSSL')}
                        {reqStrictSSL ? <Icon type="check" /> : ''}

                </Menu.Item>
                <Menu.Item key="editReqFollowRedirect">

                        <Icon type="fork" /> {Msg('Collection.RequestFollowRedirect')}
                        {reqFollowRedirect ? <Icon type="check" /> : ''}

                </Menu.Item>
                <Menu.Item key="delete">
                    <Icon type="delete" /> {Msg('Common.Delete')}
                </Menu.Item>
            </Menu>
        );
    }

    private onClickMenu = (e) => {
        this[e.key]();
    }

    delete = () => confirmDlg(LocalesString.get('Collection.DeleteCollection'), () => this.props.deleteCollection(), LocalesString.get('Collection.DeleteThisCollection'));

    share = () => this.props.shareCollection(this.props.collection.id);

    edit = () => {
        if (this.itemWithMenu) {
            this.itemWithMenu.edit();
        }
    }

    createFolder = () => this.props.createRecord(createDefaultFolder(this.props.collection.id));

    createRecord = () => this.props.createRecord({ ...getDefaultRecord(false), collectionId: this.props.collection.id, id: StringUtil.generateUID() });

    commonSetting = () => this.props.editCommonSetting();

    editReqStrictSSL = () => this.props.editReqStrictSSL();

    editReqFollowRedirect = () => this.props.editReqFollowRedirect();

    private checkTransferFlag = (e, flag) => {
        return e.dataTransfer.types.indexOf(flag) > -1;
    }

    private dragOver = (e) => {
        e.preventDefault();
        if (this.checkTransferFlag(e, 'record') || this.checkTransferFlag(e, 'folder')) {
            this.setState({ ...this.state, isDragOver: true });
        }
    }

    private dragLeave = () => {
        this.setState({ ...this.state, isDragOver: false });
    }

    private drop = (e) => {
        if (this.checkTransferFlag(e, 'record') || this.checkTransferFlag(e, 'folder')) {
            const data = e.dataTransfer.getData('folder') || e.dataTransfer.getData('record');
            const record = JSON.parse(data) as DtoRecord;
            if (record.collectionId !== this.props.collection.id || record.pid) {
                this.props.moveToCollection(record, this.props.collection.id);
            }
        }
        this.setState({ ...this.state, isDragOver: false });
    }

    public render() {
        const { onNameChanged, collection, recordCount, readOnly } = this.props;
        return (

                <ItemWithMenu
                    ref={ele => this.itemWithMenu = ele}
                    onNameChanged={onNameChanged}
                    icon={<Icon className="c-icon" type="wallet" />}
                    name={collection.name}
                    subName={
{Msg('Collection.Request', { count: recordCount })}
}
                    menu={this.getMenu()}
                    disableMenu={readOnly}
                />

        );
    }
}

export default CollectionItem;


text:
module HandleEnrollmentEvent
  # Transmit the X12 for the maintenance action
  class TransformAndEmitMaintenance
    include Interactor

    # Context requires:
    # - policy_details (HandleEnrollmentEvent::PolicyDetails)
    # - plan_details (HandleEnrollmentEvent::PlanDetails)
    # - amqp_connection (A connection to an amqp service)
    # - raw_event_xml (a string containing the raw event xml)
    def call
      action_xml = context.raw_event_xml
      edi_builder = EdiCodec::X12::BenefitEnrollment.new(action_xml)
      x12_xml = edi_builder.call.to_xml
      publish_to_bus(x12_xml)
    end

    def publish_to_bus(x12_payload)
      ::Amqp::ConfirmedPublisher.with_confirmed_channel(context.amqp_connection) do |chan|
         ex = chan.default_exchange
         ex.publish(x12_payload, :routing_key => "hbx.maintenance_messages", :headers => {
           "market" => context.primary_policy_action.policy_details.market,
           "file_name" => determine_file_name
         })
      end
    end

    def determine_file_name
      market_identifier = (context.policy_details.market == "shop") ? "S" : "I"
      carrier_identifier = context.plan_details.found_plan.carrier.abbrev.upcase
      "834_" + context.policy_details.transaction_id + "_" + carrier_identifier + "_C_M_" + market_identifier + "_1.xml"
    end
  end
end


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link href='http://fonts.googleapis.com/css?family=Roboto:400,900,300' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">

  <link rel="stylesheet" href="https://allelos.github.io/react-datepicker/dist/css/styles.css">

  <title>React Datepicker</title>

React Date Picker


text:
package org.quartz.jobs;

import org.quartz.core.Scheduler;
import org.quartz.core.TriggerFiredBundle;
import org.quartz.exceptions.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * The default JobFactory used by Quartz - simply calls newInstance() on the job class.
 *
 * @see JobFactory
 * @see PropertySettingJobFactory
 * @author jhouse
 */
public class SimpleJobFactory implements JobFactory {

  private final Logger log = LoggerFactory.getLogger(getClass());

  @Override
  public Job newJob(TriggerFiredBundle bundle, Scheduler Scheduler) throws SchedulerException {

    JobDetail jobDetail = bundle.getJobDetail();
    Class<? extends Job> jobClass = jobDetail.getJobClass();
    try {
      if (log.isDebugEnabled()) {
        log.debug("Producing instance of Job '" + jobDetail.getName() + "', class=" + jobClass.getName());
      }

      return jobClass.newInstance();
    } catch (Exception e) {
      SchedulerException se = new SchedulerException("Problem instantiating class '" + jobDetail.getJobClass().getName() + "'", e);
      throw se;
    }
  }

}


text:
package com.google.zxing.client.android.book;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

import com.google.zxing.client.android.R;

/**
 * 制作代表SBC结果的列表项
 *
 * @author lijian
 * @date 2017-9-3 下午10:06:54
 */
final class SearchBookContentsAdapter extends
		ArrayAdapter<SearchBookContentsResult> {

	/**
	 * 制作代表SBC结果的列表项
	 *
	 * @param context
	 * @param items
	 */
	SearchBookContentsAdapter(Context context,
			List<SearchBookContentsResult> items) {
		super(context, R.layout.search_book_contents_list_item, 0, items);
	}

	@Override
	public View getView(int position, View view, ViewGroup viewGroup) {
		SearchBookContentsListItem listItem;

		if (view == null) {
			LayoutInflater factory = LayoutInflater.from(getContext());
			listItem = (SearchBookContentsListItem) factory.inflate(
					R.layout.search_book_contents_list_item, viewGroup, false);
		} else {
			if (view instanceof SearchBookContentsListItem) {
				listItem = (SearchBookContentsListItem) view;
			} else {
				return view;
			}
		}

		SearchBookContentsResult result = getItem(position);
		listItem.set(result);
		return listItem;
	}
}


text:
__author__ = 'sandlbn'

from django import template
from datetime import datetime, timedelta
from time import mktime
from jsmin import jsmin

def timestamp_to_datetime(timestamp):
    """
    Converts string timestamp to datetime
    with json fix
    """
    if isinstance(timestamp, (str, unicode)):

        if len(timestamp) == 13:
            timestamp = int(timestamp) / 1000

        return datetime.fromtimestamp(timestamp)
    else:
        return ""

def datetime_to_timestamp(date):
    """
    Converts datetime to timestamp
    with json fix
    """
    if isinstance(date, datetime):

        # date += timedelta(hours=1)  # dirty hack to get polish time zone
        timestamp = mktime(date.timetuple())
        json_timestamp = int(timestamp) * 1000

        return '{0}'.format(json_timestamp)
    else:
        return ""

class MinifyJs(template.Node):

    def __init__(self, nodelist):
        self.nodelist = nodelist

    def render(self, context):
        return jsmin(self.nodelist.render(context))


text:
#include "precomp.hpp"
#include "opencv2/photo.hpp"
#include "opencv2/imgproc.hpp"
#include "hdr_common.hpp"

namespace cv
{

class TonemapImpl : public Tonemap
{
public:
    TonemapImpl(float _gamma) : name("Tonemap"), gamma(_gamma)
    {
    }

    void process(InputArray _src, OutputArray _dst)
    {
        Mat src = _src.getMat();
        CV_Assert(!src.empty());
        _dst.create(src.size(), CV_32FC3);
        Mat dst = _dst.getMat();

        double min, max;
        minMaxLoc(src, &min, &max);
        if(max - min > DBL_EPSILON) {
            dst = (src - min) / (max - min);
        } else {
            src.copyTo(dst);
        }

        pow(dst, 1.0f / gamma, dst);
    }

    float getGamma() const { return gamma; }
    void setGamma(float val) { gamma = val; }

    void write(FileStorage& fs) const
    {
        fs << "name" << name
           << "gamma" << gamma;
    }

    void read(const FileNode& fn)
    {
        FileNode n = fn["name"];
        CV_Assert(n.isString() && String(n) == name);
        gamma = fn["gamma"];
    }

protected:
    String name;
    float gamma;
};

Ptr<Tonemap> createTonemap(float gamma)
{
    return makePtr<TonemapImpl>(gamma);
}

class TonemapDragoImpl : public TonemapDrago
{
public:
    TonemapDragoImpl(float _gamma, float _saturation, float _bias) :
        name("TonemapDrago"),
        gamma(_gamma),
        saturation(_saturation),
        bias(_bias)
    {
    }

    void process(InputArray _src, OutputArray _dst)
    {
        Mat src = _src.getMat();
        CV_Assert(!src.empty());
        _dst.create(src.size(), CV_32FC3);
        Mat img = _dst.getMat();

        Ptr<Tonemap> linear = createTonemap(1.0f);
        linear->process(src, img);

        Mat gray_img;
        cvtColor(img, gray_img, COLOR_RGB2GRAY);
        Mat log_img;
        log(gray_img, log_img);
        float mean = expf(static_cast<float>(sum(log_img)[0]) / log_img.total());
        gray_img /= mean;
        log_img.release();

        double max;
        minMaxLoc(gray_img, NULL, &max);

        Mat map;
        log(gray_img + 1.0f, map);
        Mat div;
        pow(gray_img / static_cast<float>(max), logf(bias) / logf(0.5f), div);
        log(2.0f + 8.0f * div, div);
        map = map.mul(1.0f / div);
        div.release();

        mapLuminance(img, img, gray_img, map, saturation);

        linear->setGamma(gamma);
        linear->process(img, img);
    }

    float getGamma() const { return gamma; }
    void setGamma(float val) { gamma = val; }

    float getSaturation() const { return saturation; }
    void setSaturation(float val) { saturation = val; }

    float getBias() const { return bias; }
    void setBias(float val) { bias = val; }

    void write(FileStorage& fs) const
    {
        fs << "name" << name
           << "gamma" << gamma
           << "bias" << bias
           << "saturation" << saturation;
    }

    void read(const FileNode& fn)
    {
        FileNode n = fn["name"];
        CV_Assert(n.isString() && String(n) == name);
        gamma = fn["gamma"];
        bias = fn["bias"];
        saturation = fn["saturation"];
    }

protected:
    String name;
    float gamma, saturation, bias;
};

Ptr<TonemapDrago> createTonemapDrago(float gamma, float saturation, float bias)
{
    return makePtr<TonemapDragoImpl>(gamma, saturation, bias);
}

class TonemapDurandImpl : public TonemapDurand
{
public:
    TonemapDurandImpl(float _gamma, float _contrast, float _saturation, float _sigma_color, float _sigma_space) :
        name("TonemapDurand"),
        gamma(_gamma),
        contrast(_contrast),
        saturation(_saturation),
        sigma_color(_sigma_color),
        sigma_space(_sigma_space)
    {
    }

    void process(InputArray _src, OutputArray _dst)
    {
        Mat src = _src.getMat();
        CV_Assert(!src.empty());
        _dst.create(src.size(), CV_32FC3);
        Mat img = _dst.getMat();
        Ptr<Tonemap> linear = createTonemap(1.0f);
        linear->process(src, img);

        Mat gray_img;
        cvtColor(img, gray_img, COLOR_RGB2GRAY);
        Mat log_img;
        log(gray_img, log_img);
        Mat map_img;
        bilateralFilter(log_img, map_img, -1, sigma_color, sigma_space);

        double min, max;
        minMaxLoc(map_img, &min, &max);
        float scale = contrast / static_cast<float>(max - min);
        exp(map_img * (scale - 1.0f) + log_img, map_img);
        log_img.release();

        mapLuminance(img, img, gray_img, map_img, saturation);
        pow(img, 1.0f / gamma, img);
    }

    float getGamma() const { return gamma; }
    void setGamma(float val) { gamma = val; }

    float getSaturation() const { return saturation; }
    void setSaturation(float val) { saturation = val; }

    float getContrast() const { return contrast; }
    void setContrast(float val) { contrast = val; }

    float getSigmaColor() const { return sigma_color; }
    void setSigmaColor(float val) { sigma_color = val; }

    float getSigmaSpace() const { return sigma_space; }
    void setSigmaSpace(float val) { sigma_space = val; }

    void write(FileStorage& fs) const
    {
        fs << "name" << name
           << "gamma" << gamma
           << "contrast" << contrast
           << "sigma_color" << sigma_color
           << "sigma_space" << sigma_space
           << "saturation" << saturation;
    }

    void read(const FileNode& fn)
    {
        FileNode n = fn["name"];
        CV_Assert(n.isString() && String(n) == name);
        gamma = fn["gamma"];
        contrast = fn["contrast"];
        sigma_color = fn["sigma_color"];
        sigma_space = fn["sigma_space"];
        saturation = fn["saturation"];
    }

protected:
    String name;
    float gamma, contrast, saturation, sigma_color, sigma_space;
};

Ptr<TonemapDurand> createTonemapDurand(float gamma, float contrast, float saturation, float sigma_color, float sigma_space)
{
    return makePtr<TonemapDurandImpl>(gamma, contrast, saturation, sigma_color, sigma_space);
}

class TonemapReinhardImpl : public TonemapReinhard
{
public:
    TonemapReinhardImpl(float _gamma, float _intensity, float _light_adapt, float _color_adapt) :
        name("TonemapReinhard"),
        gamma(_gamma),
        intensity(_intensity),
        light_adapt(_light_adapt),
        color_adapt(_color_adapt)
    {
    }

    void process(InputArray _src, OutputArray _dst)
    {
        Mat src = _src.getMat();
        CV_Assert(!src.empty());
        _dst.create(src.size(), CV_32FC3);
        Mat img = _dst.getMat();
        Ptr<Tonemap> linear = createTonemap(1.0f);
        linear->process(src, img);

        Mat gray_img;
        cvtColor(img, gray_img, COLOR_RGB2GRAY);
        Mat log_img;
        log(gray_img, log_img);

        float log_mean = static_cast<float>(sum(log_img)[0] / log_img.total());
        double log_min, log_max;
        minMaxLoc(log_img, &log_min, &log_max);
        log_img.release();

        double key = static_cast<float>((log_max - log_mean) / (log_max - log_min));
        float map_key = 0.3f + 0.7f * pow(static_cast<float>(key), 1.4f);
        intensity = exp(-intensity);
        Scalar chan_mean = mean(img);
        float gray_mean = static_cast<float>(mean(gray_img)[0]);

        std::vector<Mat> channels(3);
        split(img, channels);

        for(int i = 0; i < 3; i++) {
            float global = color_adapt * static_cast<float>(chan_mean[i]) + (1.0f - color_adapt) * gray_mean;
            Mat adapt = color_adapt * channels[i] + (1.0f - color_adapt) * gray_img;
            adapt = light_adapt * adapt + (1.0f - light_adapt) * global;
            pow(intensity * adapt, map_key, adapt);
            channels[i] = channels[i].mul(1.0f / (adapt + channels[i]));
        }
        gray_img.release();
        merge(channels, img);

        linear->setGamma(gamma);
        linear->process(img, img);
    }

    float getGamma() const { return gamma; }
    void setGamma(float val) { gamma = val; }

    float getIntensity() const { return intensity; }
    void setIntensity(float val) { intensity = val; }

    float getLightAdaptation() const { return light_adapt; }
    void setLightAdaptation(float val) { light_adapt = val; }

    float getColorAdaptation() const { return color_adapt; }
    void setColorAdaptation(float val) { color_adapt = val; }

    void write(FileStorage& fs) const
    {
        fs << "name" << name
           << "gamma" << gamma
           << "intensity" << intensity
           << "light_adapt" << light_adapt
           << "color_adapt" << color_adapt;
    }

    void read(const FileNode& fn)
    {
        FileNode n = fn["name"];
        CV_Assert(n.isString() && String(n) == name);
        gamma = fn["gamma"];
        intensity = fn["intensity"];
        light_adapt = fn["light_adapt"];
        color_adapt = fn["color_adapt"];
    }

protected:
    String name;
    float gamma, intensity, light_adapt, color_adapt;
};

Ptr<TonemapReinhard> createTonemapReinhard(float gamma, float contrast, float sigma_color, float sigma_space)
{
    return makePtr<TonemapReinhardImpl>(gamma, contrast, sigma_color, sigma_space);
}

class TonemapMantiukImpl : public TonemapMantiuk
{
public:
    TonemapMantiukImpl(float _gamma, float _scale, float _saturation) :
        name("TonemapMantiuk"),
        gamma(_gamma),
        scale(_scale),
        saturation(_saturation)
    {
    }

    void process(InputArray _src, OutputArray _dst)
    {
        Mat src = _src.getMat();
        CV_Assert(!src.empty());
        _dst.create(src.size(), CV_32FC3);
        Mat img = _dst.getMat();
        Ptr<Tonemap> linear = createTonemap(1.0f);
        linear->process(src, img);

        Mat gray_img;
        cvtColor(img, gray_img, COLOR_RGB2GRAY);
        Mat log_img;
        log(gray_img, log_img);

        std::vector<Mat> x_contrast, y_contrast;
        getContrast(log_img, x_contrast, y_contrast);

        for(size_t i = 0; i < x_contrast.size(); i++) {
            mapContrast(x_contrast[i]);
            mapContrast(y_contrast[i]);
        }

        Mat right(src.size(), CV_32F);
        calculateSum(x_contrast, y_contrast, right);

        Mat p, r, product, x = log_img;
        calculateProduct(x, r);
        r = right - r;
        r.copyTo(p);

        const float target_error = 1e-3f;
        float target_norm = static_cast<float>(right.dot(right)) * powf(target_error, 2.0f);
        int max_iterations = 100;
        float rr = static_cast<float>(r.dot(r));

        for(int i = 0; i < max_iterations; i++)
        {
            calculateProduct(p, product);
            float alpha = rr / static_cast<float>(p.dot(product));

            r -= alpha * product;
            x += alpha * p;

            float new_rr = static_cast<float>(r.dot(r));
            p = r + (new_rr / rr) * p;
            rr = new_rr;

            if(rr < target_norm) {
                break;
            }
        }
        exp(x, x);
        mapLuminance(img, img, gray_img, x, saturation);

        linear = createTonemap(gamma);
        linear->process(img, img);
    }

    float getGamma() const { return gamma; }
    void setGamma(float val) { gamma = val; }

    float getScale() const { return scale; }
    void setScale(float val) { scale = val; }

    float getSaturation() const { return saturation; }
    void setSaturation(float val) { saturation = val; }

    void write(FileStorage& fs) const
    {
        fs << "name" << name
           << "gamma" << gamma
           << "scale" << scale
           << "saturation" << saturation;
    }

    void read(const FileNode& fn)
    {
        FileNode n = fn["name"];
        CV_Assert(n.isString() && String(n) == name);
        gamma = fn["gamma"];
        scale = fn["scale"];
        saturation = fn["saturation"];
    }

protected:
    String name;
    float gamma, scale, saturation;

    void signedPow(Mat src, float power, Mat& dst)
    {
        Mat sign = (src > 0);
        sign.convertTo(sign, CV_32F, 1.0f/255.0f);
        sign = sign * 2.0f - 1.0f;
        pow(abs(src), power, dst);
        dst = dst.mul(sign);
    }

    void mapContrast(Mat& contrast)
    {
        const float response_power = 0.4185f;
        signedPow(contrast, response_power, contrast);
        contrast *= scale;
        signedPow(contrast, 1.0f / response_power, contrast);
    }

    void getGradient(Mat src, Mat& dst, int pos)
    {
        dst = Mat::zeros(src.size(), CV_32F);
        Mat a, b;
        Mat grad = src.colRange(1, src.cols) - src.colRange(0, src.cols - 1);
        grad.copyTo(dst.colRange(pos, src.cols + pos - 1));
        if(pos == 1) {
            src.col(0).copyTo(dst.col(0));
        }
    }

    void getContrast(Mat src, std::vector<Mat>& x_contrast, std::vector<Mat>& y_contrast)
    {
        int levels = static_cast<int>(logf(static_cast<float>(min(src.rows, src.cols))) / logf(2.0f));
        x_contrast.resize(levels);
        y_contrast.resize(levels);

        Mat layer;
        src.copyTo(layer);
        for(int i = 0; i < levels; i++) {
            getGradient(layer, x_contrast[i], 0);
            getGradient(layer.t(), y_contrast[i], 0);
            resize(layer, layer, Size(layer.cols / 2, layer.rows / 2));
        }
    }

    void calculateSum(std::vector<Mat>& x_contrast, std::vector<Mat>& y_contrast, Mat& sum)
    {
        sum = Mat::zeros(x_contrast[x_contrast.size() - 1].size(), CV_32F);
        for(int i = (int)x_contrast.size() - 1; i >= 0; i--)
        {
            Mat grad_x, grad_y;
            getGradient(x_contrast[i], grad_x, 1);
            getGradient(y_contrast[i], grad_y, 1);
            resize(sum, sum, x_contrast[i].size());
            sum += grad_x + grad_y.t();
        }
    }

    void calculateProduct(Mat src, Mat& dst)
    {
        std::vector<Mat> x_contrast, y_contrast;
        getContrast(src, x_contrast, y_contrast);
        calculateSum(x_contrast, y_contrast, dst);
    }
};

Ptr<TonemapMantiuk> createTonemapMantiuk(float gamma, float scale, float saturation)
{
    return makePtr<TonemapMantiukImpl>(gamma, scale, saturation);
}

}


text:
var helpers = require("../helpers.e2e");
describe("Organisation view page", function() {

    beforeAll(function() {
        helpers.login();
    });
    afterAll(function() {
        helpers.logout();
    });

    it("should display all the fields of an organisation correctly", function() {
        element(by.linkText("Järjestöt")).click();
        element(by.linkText("Human rights org")).click();
        expect(element(by.binding("organisation.name")).getText()).
                toEqual("Human rights org");

        // TODO: Find out what"s wrong here:
//        expect(element(by.binding("organisation.representative.name")).
//                getText()).toEqual("Representative");
//        expect(element(by.binding("organisation.representative.email")).
//                getText()).toEqual("email@email.com");
//        expect(element(by.binding("organisation.representative.phone")).
//                getText()).toEqual("12345");

        expect(element(by.binding("organisation.exec_manager")).
                getText()).toEqual("Mrs Manager");
        expect(element(by.binding("organisation.communications_rep")).
                getText()).toEqual("John Doe");

        // TODO: Find out what"s wrong here:
//        expect(element(by.binding("organisation.address.street")).
//                getText()).toEqual("Samppalinnantie 20 C 22");
//        expect(element(by.binding("organisation.address.postal_code")).
//                getText()).toEqual("00780");
//        expect(element(by.binding("organisation.address.city")).
//                getText()).toEqual("Samppalinna");
//        expect(element(by.binding("organisation.address.country")).
//                getText()).toEqual("Suomi");

        expect(element(by.binding("organisation.tel")).
                getText()).toEqual("123445");
        expect(element(by.binding("organisation.email")).
                getText()).toEqual("email@org.com");
        expect(element(by.binding("organisation.website")).
                getText()).toEqual("www.org.com");
        expect(element(by.binding("organisation.bank_account.holder_name")).
                getText()).toEqual("Järjestö1");
        expect(element(by.binding("organisation.bank_account.iban")).
                getText()).toEqual("FI1234456789000");
        expect(element(by.binding("organisation.bank_account.swift")).
                getText()).toEqual("NDEAFIHH");
        expect(element(by.binding("organisation.bank_account.bank_contact_details")).
                getText()).toEqual("Nordea Helsinki");
        var repeater = element.all(by.repeater("project in orgProjects"));
        expect(repeater.count()).toEqual(7);
        expect(repeater.get(0).all(by.tagName("td")).get(0).getText()).
                toEqual("Elder rights");
        expect(repeater.get(1).all(by.tagName("td")).get(0).getText()).
                toEqual("Human rights");
        expect(repeater.get(2).all(by.tagName("td")).get(0).getText()).
                toEqual("Human rights 123");
        expect(repeater.get(3).all(by.tagName("td")).get(0).getText()).
                toEqual("Human rights now");
        expect(repeater.get(4).all(by.tagName("td")).get(0).getText()).
                toEqual("Minority rights");
        expect(repeater.get(5).all(by.tagName("td")).get(0).getText()).
                toEqual("Some rights");
        expect(repeater.get(6).all(by.tagName("td")).get(0).getText()).
                toEqual("Worklife rights");
        expect(element(by.binding("organisation.legal_status")).
                getText()).toEqual("hyväntekeväisyysjärjestö");
        expect(element(by.binding("organisation.description")).
                getText()).toEqual("järjestön historiaa...");
        expect(element(by.binding("organisation.int_links")).
                getText()).toEqual("link 1, link 2");
        expect(element(by.binding("organisation.other_funding_budget")).
                getText()).toEqual("some funders...");
        expect(element(by.binding("organisation.accounting_audit")).
                getText()).toEqual("All audits are OK.");
        expect(element(by.binding("organisation.background")).
                getText()).toEqual("");
        expect(element.all(by.repeater("update in organisation.updated")).count()).toEqual(0);
    });

    // Currently, the system doesn"t handle non-existent organisations properly.
    xit("should not attempt to display non-existing organisations", function() {
        browser.get("/organisations/56091a0525f75ebc0c486333");
        expect(element(by.id("error")).$("div").getText()).toEqual("Virhe - 404");
    });

    it("should redirect to login page if not logged in ", function () {
        helpers.logout();
        browser.get("/organisations/56091a0525f75ebc0c486338");
        expect(browser.getCurrentUrl()).toContain("/auth/login");
        helpers.login();
    });
});


text:
if [ -z $ELASTIC_CLUSTER ]; then
  export ELASTIC_CLUSTER=localhost
fi

sed -i "s/<ELASTIC-CLIENT>/$ELASTIC_CLUSTER/g" /opt/kibana/config/kibana.yml

/opt/kibana/bin/kibana


text:
package devenv

import (
	"github.com/sascha-andres/devenv/internal/os_helper"
	"github.com/spf13/viper"
	"path"
)

// StartShellForSubdirectory executes configured shell or default shell (sh) within a specified subdirectory
func (ev *EnvironmentConfiguration) StartShellForSubdirectory(subdirectory string) error {
	ev.prepareShell()
	commandName, arguments, err := ev.GetShell()
	if err != nil {
		return err
	}
	for _, val := range ev.ProcessConfiguration.ShellArguments {
		result, err := ev.applyVariables(val)
		if err != nil {
			return err
		}
		arguments = append(arguments, result)
	}
	env, err := ev.GetEnvironment()
	if err != nil {
		return err
	}
	command, err := os_helper.GetCommand(commandName, env, path.Join(viper.GetString("basepath"), ev.Name, subdirectory), arguments...)
	if err != nil {
		return err
	}
	_, err = os_helper.StartAndWait(command)
	if err != nil {
		return err
	}
	return nil
}


text:
require 'bel'
require 'pathname'
require 'tmpdir'

include BEL::Namespace

describe 'Loading BEL resources from a ResourceIndex object' do

  before(:all) do
    Dir[Pathname(Dir::tmpdir) + 'BEL_*'].each(&File.method(:delete))
    expect(Dir[Pathname(Dir::tmpdir) + 'BEL_*'].empty?).to eq(true)
  end

  describe ResourceIndex do

    it "loads resources from http urls" do
      URLS = [
        'http://resource.belframework.org/belframework/1.0/index.xml',
        'http://resource.belframework.org/belframework/20131211/index.xml'
      ]

      URLS.each do |url|
        index = ResourceIndex.new(url)
        expect(index.namespaces.size).to be > 0
        expect(index.annotations.size).to be > 0
      end
    end

    it "loads resources from local path" do
      local_path = "#{File.dirname(__FILE__)}/index.xml"
      expect(File.exist? local_path).to be_truthy

      index = ResourceIndex.new(local_path)
      expect(index.namespaces.size).to be > 0
      expect(index.annotations.size).to be > 0
    end

    it "loads resources from file urls" do
      local_path = "#{File.dirname(__FILE__)}/index.xml"
      expect(File.exist? local_path).to be_truthy
      local_uri = "file://#{local_path}"

      index = ResourceIndex.new(local_uri)
      expect(index.namespaces.size).to be > 0
      expect(index.annotations.size).to be > 0
    end

    it "can retrieve OpenBEL published resources" do
      ['1.0', '20131211'].each do |version|
        index = ResourceIndex.openbel_published_index(version)
        expect(index.namespaces.size).to be > 0
        expect(index.annotations.size).to be > 0
      end
    end

    it "fail if location is invalid" do
      expect {
        bogus_path = Pathname(Dir.tmpdir) + 'doesnotexist.foobar'
        ResourceIndex.openbel_published_index(bogus_path).namespaces
      }.to raise_error

      expect {
        ResourceIndex.openbel_published_index('FOO_BAR').namespaces
      }.to raise_error
    end
  end
end

# vim: ts=2 sw=2
# encoding: utf-8


text:
<!DOCTYPE html>

<meta charset="UTF-8">
<title>d2js</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link href="../jslib/bootstrap-3.3.4/css/bootstrap.css" rel="stylesheet" media="screen">

对象充当渲染器包含有 render(element, value,... )的对象均可注册在 d2js.Renderers 作为可访问的渲染器

			Name:

			Email:
					<renderer>
						element.innerHTML = '' + value +''
					</renderer>

			Phone:

			Gender:

renderObj函数与对象渲染器都可以代码设置于 element.renderObj,而不通过 attribute设置

			Name:

			Email:

			Phone:

createRenderer 接口支持 createRenderer(element) 函数的对象也可以充当 renderer,它将为每个 element 生成一个独立的渲染器对象

			Name:

			Email:

			Phone:


text:
package uk.co.optimisticpanda.pdfreport.imgman;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import uk.co.optimisticpanda.pdfreport.ImageTransformer;

public class FireImageTransformer implements ImageTransformer<FireData> {

	@Override
	public BufferedImage transform(FireData data, BufferedImage image) {
		Point2D.Double centre = getCentrePoint(image);
		Graphics2D g = image.createGraphics();
		int scale = 14;
		g.setColor(new Color(255, 255, 255, 255));

		List<Point2D.Double> arrowPoints = getArrowPoints(centre, scale);
		List<Point2D.Double> inlayPoints = getArrowInlay(arrowPoints, 5);

		g.setColor(Color.BLACK);
		g.fillPolygon(getPolygonFromPoints(rotate(arrowPoints, centre, 180)));
		g.setColor(Color.GREEN);
		g.fillPolygon(getPolygonFromPoints(rotate(inlayPoints, centre, 180)));

		Point2D.Double twin = new Point2D.Double(centre.getX(), (centre.getY() + (2 * (scale * 4))));
		Point2D twinPoint = rotate(centre, 180, twin);
		arrowPoints = getArrowPoints(twinPoint, scale);
		inlayPoints = getArrowInlay(arrowPoints, 5);

		g.setColor(Color.BLACK);
		g.fillPolygon(getPolygonFromPoints(rotate(arrowPoints, twinPoint, 0)));
		g.setColor(Color.RED);
		g.fillPolygon(getPolygonFromPoints(rotate(inlayPoints, twinPoint, 0)));

		return image;
	}

	private Point2D.Double getCentrePoint(BufferedImage image) {
		int x = image.getWidth() / 2;
		int y = image.getHeight() / 2;
		return new Point2D.Double(x, y);
	}

	private Polygon getPolygonFromPoints(List<Point2D> points) {
		int[] xs = points.stream().mapToInt(p -> (int) p.getX()).toArray();
		int[] ys = points.stream().mapToInt(p -> (int) p.getY()).toArray();
		return new Polygon(xs, ys, points.size());
	}

	private List<Point2D.Double> getArrowInlay(List<Point2D.Double> points, int modifier) {
		List<Point2D.Double> result = new ArrayList<>();
		for (int i = 0; i < points.size(); i++) {
			Point2D.Double point = points.get(i);
			if (i == 0) {
				result.add(new Point2D.Double(point.x - modifier, point.y + modifier));
			}
			if (i == 1) {
				result.add(new Point2D.Double(point.x - modifier, point.y + modifier));
			}
			if (i == 2) {
				result.add(new Point2D.Double(point.x - (2 * modifier), point.y + modifier));
			}
			if (i == 3) {
				result.add(new Point2D.Double(point.x, point.y -  modifier));
			}
			if (i == 4) {
				result.add(new Point2D.Double(point.x + (2 * modifier), point.y + modifier));
			}
			if (i == 5) {
				result.add(new Point2D.Double(point.x + modifier, point.y + modifier));
			}
			if (i == 6) {
				result.add(new Point2D.Double(point.x + modifier, point.y + modifier));
			}
		}
		return result;
	}

	private List<Point2D.Double> getArrowPoints(Point2D centre, double modifier) {
		return Arrays.asList(
				new Point2D.Double(centre.getX() + (modifier * 1), centre.getY() + (modifier * -4)),
				new Point2D.Double(centre.getX() + (modifier * 1), centre.getY() + (modifier * 2)),
				new Point2D.Double(centre.getX() + (modifier * 2), centre.getY() + (modifier * 2)),
				new Point2D.Double(centre.getX() + (modifier * 0), centre.getY() + (modifier * 4)),
				new Point2D.Double(centre.getX() + (modifier * -2), centre.getY() + (modifier * 2)),
				new Point2D.Double(centre.getX() + (modifier * -1), centre.getY() + (modifier * 2)),
				new Point2D.Double(centre.getX() + (modifier * -1), centre.getY() + (modifier * -4)));
	}

	private List<Point2D> rotate(List<Point2D.Double> points, Point2D centre, int degrees) {
		return points.stream().map(p -> rotate(centre, degrees, p)).collect(Collectors.toList());
	}

	private Point2D rotate(Point2D centre, int angle, Point2D.Double point) {
		Point2D result = new Point2D.Double();
	    AffineTransform rotation = new AffineTransform();
	    double angleInRadians = Math.toRadians(angle);
	    rotation.rotate(angleInRadians, centre.getX(), centre.getY());
	    return rotation.transform(point, result);
	}
}