text:
<!--

    Copyright (C) 2012-2019 the original author or authors.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <artifactId>ninja-test-utilities</artifactId>
    <packaging>jar</packaging>

    <parent>
        <groupId>org.ninjaframework</groupId>
        <artifactId>ninja</artifactId>
        <version>6.4.3-SNAPSHOT</version>
    </parent>

    <url>http://www.ninjaframework.org</url>

    <dependencies>

        <!-- ninja-core is needed so that correct dependencies are on classpath.  -->
        <!-- with ninja-standalone alone it is one level too deep and other dependencies -->
        <!-- get higher priority. -->
        <dependency>
            <groupId>org.ninjaframework</groupId>
            <artifactId>ninja-core</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.ninjaframework</groupId>
            <artifactId>ninja-standalone</artifactId>
            <scope>compile</scope>
        </dependency>

        <!-- Testing is mainly done by mockito: -->
        <!-- Order of hamcrest first then junit is important -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>java-hamcrest</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>compile</scope>
        </dependency>

        <!-- A very nice abstraction for making selenum tests: -->
        <dependency>
            <groupId>org.fluentlenium</groupId>
            <artifactId>fluentlenium-junit</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>htmlunit-driver</artifactId>
            <scope>compile</scope>
        </dependency>
        <!-- selenium uses jetty-client and has a version conflict with ours.
          We must declare these to force the version to ours or websockets will break -->
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-client</artifactId>
            <version>${jetty.version}</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty.websocket</groupId>
            <artifactId>websocket-client</artifactId>
            <version>${jetty.version}</version>
        </dependency>

        <!--HttpCient is used to mainly test low level Json Apis -->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.doctester</groupId>
            <artifactId>doctester-core</artifactId>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- devbliss doctester should be removed at some point
             - superseeded by docterster.org -->
        <dependency>
            <groupId>com.devbliss.doctest</groupId>
            <artifactId>doctest</artifactId>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <artifactId>freemarker</artifactId>
                    <groupId>org.freemarker</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>mockito-all</artifactId>
                    <groupId>org.mockito</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>junit-dep</artifactId>
                    <groupId>junit</groupId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.code.gson</groupId>
                    <artifactId>gson</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

redpajama_set_name: RedPajamaGithub


text:
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class caja_model extends CI_Model
{
    const cargos = 'sr_cargos';
    const roles = 'sr_roles';
    const avatar = 'sr_avatar';
    const usuarios = 'sr_usuarios';
    const sys_sucursal = 'sys_sucursal';
    const sys_pais_departamento  = 'sys_pais_departamento';
    const sys_pais          = 'sys_pais';
    const sys_sucursal_int_usuarios = 'sys_sucursal_int_usuarios';
    const sys_nodo = 'sys_nodo';
    const sys_sucursal_nodo = 'sys_sucursal_nodo';
    const sys_productos = 'sys_productos';
    const sys_productos_sucursal = 'sys_productos_sucursal';
    const categorias = 'sys_categoria_producto';
    const sucursal_suarios = 'sys_sucursal_int_usuarios';
    const producto_detalle = 'sys_detalle_producto';
    const unidad_medida = 'sys_unidad_medida';
    const inventario_sucursal = 'sys_catalogo_inventario_sucursal';
    const catalogo_materiales = 'sys_catalogo_materiales';
    const unidades_equivalentes = 'sys_unidades_equivalentes';
    const sys_pedido = 'sys_pedido';
    const sys_pedido_detalle = 'sys_pedido_detalle';
    const sys_pedido_detalle_materia = 'sys_pedido_detalle_materia';
    const materiales_adicionales = 'sys_materiales_adicionales';
    const pedidos = 'sys_pedido';
    const sys_secuencia = 'sys_secuencia';
    const compras = 'sys_compras';
    const cuentaTabla = 'sys_cajacuentas';
    const cuenta_descuento = 'sys_cuenta_descuento';
    const cuenta_historial = 'sys_historial';
    const sys_cupon = 'sys_cupon';
    const comandas = 'sys_comandas';

    public function __construct()
    {
        parent::__construct();

    }

    public function save_compras($compra)
    {
        $dateNow = date("Y-m-d h:i:s");

        $categorias = array(
             'empresa'      => $compra['compradoA'],
             'descripcion'    => $compra['descripcionP'],
             'precio'    => $compra['precio'],
             'fechatiempo'    => $dateNow,
             'via'    => $compra['pagadoVia'],
             );

        $this->db->insert(self::compras,$categorias);
    }

    //---------------Modelos para despacho
    public function getPedidosDespachoBySucursal($id_sucursal)
    {
         $query = $this->db->query('SELECT sp.id_pedido, sp.secuencia_orden, sp.id_usuario, sp.id_mesero, sp.numero_mesa, sp.elaborado, sp.flag_cancelado, sp.flag_elaborado, sp.flag_despachado, sp.porcentaje_descuento, sp.total_descuento, sp.fechahora_pedido, sp.fecha_creado, pd.id_detalle, pd.id_producto, pd.precio_grabado, pd.precio_original,
          GROUP_CONCAT(DISTINCT pd.id_detalle,"_",p.nombre_producto,"_",pd.precio_grabado) AS name_producto,
          GROUP_CONCAT(DISTINCT pd.id_detalle,"_",p.nombre_producto) AS name_productos,
          u.nombres, u.apellidos, sp.id_sucursal,
          SUM(pd.precio_original) AS totalSin,
          SUM(pd.precio_grabado) AS totalCon,
          GROUP_CONCAT(DISTINCT si.categoria_impuesto,"_",si.monto_impuesto) AS monto_impuesto, pai.monto_impuesto AS impuesto_pais, GROUP_CONCAT(DISTINCT sh.fechahora,"::",sh.accion,"::",sh.nota) AS historial, IF(MAX(sh.valor) IS NULL, 0, MAX(sh.valor)) AS descuentos, sh.grupo
          FROM sys_pedido sp
          INNER JOIN sys_pedido_detalle pd ON pd.id_pedido = sp.id_pedido AND pd.estado !=5
          LEFT JOIN sys_cajacuentas cc ON cc.ID_pedido = sp.id_pedido
          INNER JOIN sys_productos p ON p.id_producto = pd.id_producto
          INNER JOIN sr_usuarios u ON u.id_usuario = sp.id_mesero
          INNER JOIN sys_sucursal s ON s.id_sucursal = sp.id_sucursal
          INNER JOIN sys_categoria_producto cp ON cp.id_categoria_producto = p.categoria_id
          INNER JOIN sys_pais_departamento pad ON pad.id_departamento = s.id_departamento
          INNER JOIN sys_pais_impuesto pai ON pai.id_pais = pad.id_pais
          LEFT JOIN sys_sucursal_impuesto si ON si.id_sucursal = s.id_sucursal
          LEFT JOIN sys_historial sh ON sh.ID_pedido = sp.id_pedido
              where  sp.flag_cancelado = 0 and  cc.flag_pagado is null
              and sp.id_sucursal = '.$id_sucursal.'  group by sp.id_pedido
                order by sp.flag_elaborado = 0, sp.id_pedido asc');
               //echo $this->db->queries[1];
              return $query->result();

    }

     public function getPedidosByDetalle($id_sucursal)
    {
         $query = $this->db->query('SELECT sp.id_pedido, sp.secuencia_orden, sp.id_usuario, sp.id_mesero, sp.numero_mesa, sp.elaborado, sp.flag_cancelado, sp.flag_elaborado, sp.flag_despachado, sp.porcentaje_descuento, sp.total_descuento, sp.fechahora_pedido, sp.fecha_creado, pd.id_detalle, pd.id_producto, pd.precio_grabado, pd.precio_original,
          GROUP_CONCAT(DISTINCT pd.id_detalle,"_",p.nombre_producto,"_",pd.precio_grabado) AS name_producto,
          GROUP_CONCAT(DISTINCT pd.id_detalle,"_",p.nombre_producto) AS name_productos,
          u.nombres, u.apellidos, sp.id_sucursal,
          SUM(pd.precio_original) AS totalSin,
          SUM(pd.precio_grabado) AS totalCon,
            GROUP_CONCAT(DISTINCT si.categoria_impuesto,"_",si.monto_impuesto) AS monto_impuesto, pai.monto_impuesto AS impuesto_pais, GROUP_CONCAT(DISTINCT sh.fechahora,"::",sh.accion,"::",sh.nota) AS historial, IF(MAX(sh.valor) IS NULL, 0, MAX(sh.valor)) AS descuentos, sh.grupo
          FROM sys_pedido sp
          inner join sys_pedido_detalle pd ON pd.id_pedido = sp.id_pedido and pd.estado !=5
          left join sys_cajacuentas cc ON cc.ID_pedido = sp.id_pedido
          inner join sys_productos p ON p.id_producto = pd.id_producto
          inner join sr_usuarios u ON u.id_usuario = sp.id_mesero
          inner join sys_sucursal s ON s.id_sucursal = sp.id_sucursal
          INNER JOIN sys_categoria_producto cp ON cp.id_categoria_producto = p.categoria_id
          INNER JOIN sys_pais_departamento pad ON pad.id_departamento = s.id_departamento
          INNER JOIN sys_pais_impuesto pai ON pai.id_pais = pad.id_pais
          LEFT join sys_sucursal_impuesto si ON si.id_sucursal = s.id_sucursal
          LEFT join sys_historial sh ON sh.ID_pedido = sp.id_pedido
          where  sp.elaborado = 0 and  cc.flag_pagado is null
          and sp.id_sucursal = '.$id_sucursal.'  group by sp.id_pedido
          order by sp.elaborado = 0 desc');
          // echo $this->db->queries[2];
          return $query->result();

    }

    //---------------Modelos para despacho
    public function get_lastPedidos($datosPedido)
    {
        $query = $this->db->query('Select count(sp.id_pedido) as "pedidoNum"
        from sys_pedido sp
        inner join sys_pedido_detalle pd ON pd.id_pedido = sp.id_pedido and pd.estado !=5
        left join sys_cajacuentas cc ON cc.ID_pedido = sp.id_pedido
        inner join sys_productos p ON p.id_producto = pd.id_producto
        inner join sr_usuarios u ON u.id_usuario = sp.id_mesero
        inner join sys_sucursal s ON s.id_sucursal = sp.id_sucursal
        left join sys_sucursal_impuesto si ON si.id_sucursal = s.id_sucursal
        left join sys_historial sh ON sh.ID_pedido = sp.id_pedido
        where  sp.flag_cancelado = 0 and sp.flag_despachado <> 1 and cc.flag_pagado is null and sp.id_pedido > '.$datosPedido['lastPedido'].'
        and sp.id_sucursal = '.$datosPedido['sucursalID'].'  group by sp.id_pedido
          order by sp.flag_elaborado = 0, sp.id_pedido asc');
       return $query->result();

    }

    //---------------Modelos para despacho
    public function get_lastPedidosNull($datosPedido)
    {
        $query = $this->db->query('Select count(sp.id_pedido) as "pedidoNum"
        from sys_pedido sp
        inner join sys_pedido_detalle pd ON pd.id_pedido = sp.id_pedido and pd.estado !=5
        left join sys_cajacuentas cc ON cc.ID_pedido = sp.id_pedido
        inner join sys_productos p ON p.id_producto = pd.id_producto
        inner join sr_usuarios u ON u.id_usuario = sp.id_mesero
        inner join sys_sucursal s ON s.id_sucursal = sp.id_sucursal
        left join sys_sucursal_impuesto si ON si.id_sucursal = s.id_sucursal
        left join sys_historial sh ON sh.ID_pedido = sp.id_pedido
        where  sp.flag_cancelado = 0 and sp.flag_despachado <> 1 and cc.flag_pagado is null
        and sp.id_sucursal = '.$datosPedido['sucursalID'].'  group by sp.id_pedido
          order by sp.flag_elaborado = 0, sp.id_pedido asc');
       return $query->result();

    }

     //---------------Modelos para despacho
    public function validaMesa($mesaNum, $sucursalID)
    {
        $query = $this->db->query('Select count(p.id_pedido) as hayMesa from sys_pedido p
          where p.numero_mesa = '.$mesaNum.' and p.id_sucursal = '.$sucursalID.' and p.flag_cancelado = 0');
       return $query->result_array();

    }

    public function getDatosSucursal($id_sucursal)
    {
         $query = $this->db->query('Select * from sys_sucursal s where s.id_sucursal ='.$id_sucursal);
         //echo $this->db->queries[0];
        return $query->result_array();

    }

    public function cerrar_cuenta($cuenta)
    {
        $datePagado = date("Y-m-d h:i:s");
        $dateAnulado = "0000-00-00 00:00:00";
        $categorias = array(
             'ID_pedido'      => $cuenta['idpedidounico'],
             'flag_pagado'    => 1,
             'flag_nopropina'    => 0,
             'flag_exento'    => 0,
             'flag_tiquetado'    => 0,
             'flag_anulado'      => 0,
             'metodo_pago'    => $cuenta['metodoPago'],
             'numero_tarjeta'    => $cuenta['numSend'],
             'total_neto'    => trim($cuenta['pagoNeto']),
             'total_iva'    => trim($cuenta['pagoIva']),
             'total_propina'    => trim($cuenta['pagoPropina']),
             'total_cobrado'    => trim($cuenta['pagoTotal']),
             'fechahora_pagado'      => $datePagado,
             'fechahora_anulado'    => $dateAnulado,
             );

        $this->db->insert(self::cuentaTabla,$categorias);

        $data = array(
            'flag_cancelado'   => 1,
        );
        $this->db->where('id_pedido', $cuenta['idpedidounico']);
        $this->db->update(self::pedidos,$data);

    }

    public function anular_cuenta_insert($cuenta)
    {
        $datePagado = "0000-00-00 00:00:00";
        $dateAnulado = date("Y-m-d h:i:s");
        $categorias = array(
             'ID_pedido'      => $cuenta['idpedidounico'],
             'flag_pagado'    => 0,
             'flag_nopropina'    => 0,
             'flag_exento'    => 0,
             'flag_tiquetado'    => 0,
             'flag_anulado'      => 1,
             'metodo_pago'    => 'anulada',
             'numero_tarjeta'    => '0000',
             'total_neto'    => trim($cuenta['pagoNeto']),
             'total_iva'    => trim($cuenta['pagoIva']),
             'total_propina'    => trim($cuenta['pagoPropina']),
             'total_cobrado'    => trim($cuenta['pagoTotal']),
             'fechahora_pagado'      => $datePagado,
             'fechahora_anulado'    => $dateAnulado,
             );

        $this->db->insert(self::cuentaTabla,$categorias);

    }

    public function anular_cuenta_update($cuenta)
    {
        $dateAnulado = date("Y-m-d H:i:s");
        $data = array(
            'flag_pagado'   => 0,
            'flag_anulado'   => 1,
            'fechahora_anulado' => $date
        );
        $this->db->where('ID_pedido', $cuenta['idpedidounico']);
        $this->db->update(self::cuentaTabla,$data);
    }

    public function getPedidoCuenta($id_pedido)
    {
         $query = $this->db->query('select count(*) as numPedidos from sys_cajacuentas c where c.ID_pedido  ='.$id_pedido);
        return $query->result_array();

    }

    public function addevento_historial($idPedido, $nota, $grupo, $accion, $valor)
    {
        $dateregistro = date("Y-m-d H:i:s");
        $categorias = array(
            'ID_pedido'      => $idPedido,
            'fechahora'    => $dateregistro,
            'nota'    => $nota,
            'grupo'    => $grupo,
            'accion'    => $accion,
            'valor'    => $valor,
             );

        $this->db->insert(self::cuenta_historial,$categorias);
    }

    public function separar_cuenta($separarCuenta)
    {
        //-------create nuevo pedido para la separacion de cuentas
        $query = $this->db->query('INSERT INTO sys_pedido
        SELECT "", secuencia_orden, id_sucursal, id_usuario, id_mesero, numero_mesa, elaborado, mostrado, flag_cancelado,flag_elaborado, flag_despachado, flag_pausa, prioridad, llevar_pedido, porcentaje_descuento, total_descuento, motivo_descuento,codigo_cupon, fechahora_pedido, fechahora_elaborado, fechahora_despachado, fecha_creado, cortado, estado
            FROM sys_pedido WHERE id_pedido='.$separarCuenta['idpedidounico']);

        $query2 = $this->db->query("SELECT max(p.id_pedido) as cuentaNueva FROM sys_pedido p");
        $nuevoID = $query2->result_array();

        foreach ($separarCuenta['myItems'] as $value)
        {
            $data = array(
            'id_pedido'   => $nuevoID[0]['cuentaNueva'],
            );
            $this->db->where('id_detalle', $value);
            $this->db->update(self::sys_pedido_detalle,$data);
        }

        return true;
    }

    public function cambiar_mesa($datosMesa)
    {
        //-------create nuevo pedido para la separacion de cuentas
        $query = $this->db->query('INSERT INTO sys_pedido
        SELECT "", secuencia_orden, id_sucursal, id_usuario, id_mesero, numero_mesa, elaborado, mostrado, flag_cancelado,flag_elaborado, flag_despachado, flag_pausa, prioridad, llevar_pedido, porcentaje_descuento, total_descuento, motivo_descuento,codigo_cupon, fechahora_pedido, fechahora_elaborado, fechahora_despachado, fecha_creado, cortado, estado
            FROM sys_pedido WHERE id_pedido='.$datosMesa['idpedidounico']);

        $query2 = $this->db->query("SELECT max(p.id_pedido) as cuentaNueva FROM sys_pedido p");
        $nuevoID = $query2->result_array();

        $updatedMesa = $this->caja_model->udpateMesa($datosMesa['numMesa'], $nuevoID[0]['cuentaNueva']);
        if ($updatedMesa)
        {
            foreach ($datosMesa['myItems'] as $value)
            {
                $data = array(
                'id_pedido'   => $nuevoID[0]['cuentaNueva'],
                );
                $this->db->where('id_detalle', $value);
                $this->db->update(self::sys_pedido_detalle,$data);
            }
        }
      return true;
    }

    public function udpateMesa($numMesa, $pedidoID)
    {

            $data = array(
            'numero_mesa'   => $numMesa,
            );
            $this->db->where('id_pedido', $pedidoID);
            $this->db->update(self::sys_pedido,$data);
        return true;
    }

    public function combinar_mesa($datosMesa)
    {

        foreach ($datosMesa['myItems'] as $value)
        {
            $data = array(
            'id_pedido'   => $datosMesa['idpedidounicoMesa'],
            );
            $this->db->where('id_detalle', $value);
            $this->db->update(self::sys_pedido_detalle,$data);
        }

        return true;
    }

    public function validaCupon($validaCupon)
    {
        $query = $this->db->query("SELECT count(sc.id_cupon) as validanum, sc.id_cupon, sc.estado_cupon, s.nombre_sucursal, sc.fecha_canjeado_cupon, cc.valor_categoria
          FROM sys_cupon sc
          inner join sys_cupon_categoria cc ON cc.id_cupon_categoria = sc.id_categoria
          left JOIN sys_sucursal s ON s.id_sucursal = sc.id_sucursal
          WHERE sc.codigo_cupon ='".$validaCupon['codigoCupon']."'");
        //echo $this->db->queries[0];
        return $query->result_array();

    }

    public function confirmar_cupon($id_cupon, $sucursalID)
    {
        $dateCanjeado = date("Y-m-d H:m:s");
        $data = array(
            'id_sucursal'   => $sucursalID,
            'estado_cupon'   => 1,
            'fecha_canjeado_cupon' => $dateCanjeado
        );
        $this->db->where('id_cupon', $id_cupon);
        $this->db->update(self::sys_cupon,$data);
    }

    public function eliminar_item($item)
    {
        $data = array(
            'estado'   => 5
        );
        $this->db->where('id_detalle', $item['idpedidounico']);
        $this->db->update(self::sys_pedido_detalle,$data);
    }

    public function data_tiquete($idPedido)
    {
          $query = $this->db->query("Select em.nombre_empresa, em.nombre_legal, em.telefono, p.numero_mesa, GROUP_CONCAT(pro.nombre_producto,'_',pd.precio_grabado) AS pedido, s.nombre_sucursal, s.direccion, pdep.nombre_departamento, SUM(pd.precio_grabado) as SubTotal, pa.moneda
          From sys_pedido p
          inner join sys_pedido_detalle pd ON pd.id_pedido =  p.id_pedido
          inner join sys_productos pro ON pro.id_producto = pd.id_producto
          inner join sys_sucursal s ON s.id_sucursal = p.id_sucursal
          inner join sys_pais_departamento pdep ON pdep.id_departamento = s.id_departamento
          inner join sys_pais pa ON pa.id_pais = pdep.id_pais
          join sr_empresa em
          WHERE p.id_pedido ='".$idPedido['idpedidounico']."'");
        //echo $this->db->queries[0];
        return $query->result_array();

    }

    public function add_comanda($data, $impreso, $fecha, $estacion)
    {
        $dateregistro = date("Y-m-d H:i:s");
        $categorias = array(
            'data'      => $data,
            'impreso'    => $impreso,
            'timestamp'    => $fecha,
            'estacion'    => $estacion,
             );

        $this->db->insert(self::comandas,$categorias);
    }
}


text:
This setup is largely based on jfrazelle's work [https://github.com/jfrazelle/dockerfiles](https://github.com/jfrazelle/dockerfiles) but specific to the nightmare that is the nvidia driver.

The way this works is that container nvidia driver has to match the host operating system (in my case, I'm running this on the 361 beta drivers).

Your mileage will greatly vary.


text:
/*
 * IIFE in es6
 * */
(function(code) {
  code(window.jQuery, window, document);
})(function($, window, document) {
  $(function() {

    // Add smoothscroll
    $('a').smoothScroll();

    // Add tooltiptser
    $('.tooltip').tooltipster({
      theme: 'tooltipster-kq',
    });

    // Add fastclick
    FastClick.attach(document.body);

    // Reference for the slider: http://codepen.io/jurbank/pen/AckDb?editors=0010

    // Slider for works
    var $worksSliderContainer = $('.works__slides');
    var $workSlides = $worksSliderContainer.find('.works__work');
    var $workBullets = $('.works__slides-nav__bullet');

    var workCurrent = 0;

    $workBullets.on('click',  function() {
      // Get the index of the bullet clicked
      var index = $workBullets.index($(this));

      // Update the current index
      workCurrent = index;

      // First, remove the active class on the workBullets then add the active
      // class on the current index
      $workBullets.removeClass('active');
      $workBullets.eq(workCurrent).addClass('active');

      // Show the slide of the current index
      $workSlides.removeClass('show active');
      $workSlides.eq(workCurrent).addClass('show');

      setTimeout(function() {
        $workSlides.eq(workCurrent).addClass('active');
      }, 10)
    });

    // Slider for testimonials
    var $testimonialsSlidesCont = $('.testimonials__slides');
    var $testimonialSlides = $testimonialsSlidesCont.find('.testimonials__testimonial');
    var $testimonialBullets = $('.testimonials__slides-nav__bullet');

    var testimonialCurrent = 0;

    $testimonialBullets.on('click',  function() {
      // Get the index of the bullet clicked
      var index = $testimonialBullets.index($(this));

      // Update the current index
      testimonialCurrent = index;

      // First, remove the active class on the testimonialBullets then add the active
      // class on the current index
      $testimonialBullets.removeClass('active');
      $testimonialBullets.eq(testimonialCurrent).addClass('active');

      // Show the slide of the current index
      $testimonialSlides.removeClass('show active');
      $testimonialSlides.eq(testimonialCurrent).addClass('show');

      setTimeout(function() {
        $testimonialSlides.eq(testimonialCurrent).addClass('active');
      }, 10)
    });

  }); // end of document.ready
});


text:
'''
Test NTriples serializer
'''

import logging
import functools

# Requires pytest-mock
import pytest
from amara3 import iri

from versa import I
from versa.driver.memory import newmodel
from versa.serial.ntriples import *
# from versa.util import jsondump, jsonload

NT_SPEC = I('http://www.w3.org/2001/sw/RDFCore/ntriples/')
DC_CREATOR = I('http://purl.org/dc/elements/1.1/creator')
DC_PUBLISHER = I('http://purl.org/dc/elements/1.1/publisher')
W3C = I('http://www.w3.org/')

@pytest.fixture
def ntrips_1():
    return '''\
<http://www.w3.org/2001/sw/RDFCore/ntriples/> <http://purl.org/dc/elements/1.1/creator> "Dave Beckett" .
<http://www.w3.org/2001/sw/RDFCore/ntriples/> <http://purl.org/dc/elements/1.1/creator> "Art Barstow" .
<http://www.w3.org/2001/sw/RDFCore/ntriples/> <http://purl.org/dc/elements/1.1/publisher> <http://www.w3.org/> .
'''

def test_parse1(ntrips_1):
    m = newmodel()
    parse(ntrips_1, m)
    assert len(m) == 3, repr(m)
    assert 'Dave Beckett' in [ t for (o, r, t, a) in m.match(NT_SPEC, DC_CREATOR)]
    assert 'Art Barstow' in [ t for (o, r, t, a) in m.match(NT_SPEC, DC_CREATOR)]
    assert W3C in [ t for (o, r, t, a) in m.match(NT_SPEC, DC_PUBLISHER)]


text:
snvdb
=====

Central repo for the snv database


text:
class IFX_Edit;

class CLST_Size {
 public:
  CLST_Size() : x(0.0f), y(0.0f) {}

  CLST_Size(FX_FLOAT other_x, FX_FLOAT other_y) {
    x = other_x;
    y = other_y;
  }

  void Default() {
    x = 0.0f;
    y = 0.0f;
  }

  FX_BOOL operator!=(const CLST_Size& size) const {
    return FXSYS_memcmp(this, &size, sizeof(CLST_Size)) != 0;
  }

  FX_FLOAT x, y;
};

class CLST_Rect : public CPDF_Rect {
 public:
  CLST_Rect() { left = top = right = bottom = 0.0f; }

  CLST_Rect(FX_FLOAT other_left,
            FX_FLOAT other_top,
            FX_FLOAT other_right,
            FX_FLOAT other_bottom) {
    left = other_left;
    top = other_top;
    right = other_right;
    bottom = other_bottom;
  }

  CLST_Rect(const CPDF_Rect& rect) {
    left = rect.left;
    top = rect.top;
    right = rect.right;
    bottom = rect.bottom;
  }

  ~CLST_Rect() {}

  void Default() { left = top = right = bottom = 0.0f; }

  const CLST_Rect operator=(const CPDF_Rect& rect) {
    left = rect.left;
    top = rect.top;
    right = rect.right;
    bottom = rect.bottom;

    return *this;
  }

  FX_BOOL operator==(const CLST_Rect& rect) const {
    return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) == 0;
  }

  FX_BOOL operator!=(const CLST_Rect& rect) const {
    return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) != 0;
  }

  FX_FLOAT Width() const { return right - left; }

  FX_FLOAT Height() const {
    if (top > bottom)
      return top - bottom;
    return bottom - top;
  }

  CPDF_Point LeftTop() const { return CPDF_Point(left, top); }

  CPDF_Point RightBottom() const { return CPDF_Point(right, bottom); }

  const CLST_Rect operator+=(const CPDF_Point& point) {
    left += point.x;
    right += point.x;
    top += point.y;
    bottom += point.y;

    return *this;
  }

  const CLST_Rect operator-=(const CPDF_Point& point) {
    left -= point.x;
    right -= point.x;
    top -= point.y;
    bottom -= point.y;

    return *this;
  }

  CLST_Rect operator+(const CPDF_Point& point) const {
    return CLST_Rect(left + point.x, top + point.y, right + point.x,
                     bottom + point.y);
  }

  CLST_Rect operator-(const CPDF_Point& point) const {
    return CLST_Rect(left - point.x, top - point.y, right - point.x,
                     bottom - point.y);
  }
};

class CFX_ListItem {
 public:
  CFX_ListItem();
  virtual ~CFX_ListItem();

  void SetFontMap(IFX_Edit_FontMap* pFontMap);
  IFX_Edit_Iterator* GetIterator() const;
  IFX_Edit* GetEdit() const;

 public:
  void SetRect(const CLST_Rect& rect);
  void SetSelect(FX_BOOL bSelected);
  void SetCaret(FX_BOOL bCaret);
  void SetText(const FX_WCHAR* text);
  void SetFontSize(FX_FLOAT fFontSize);
  CFX_WideString GetText() const;

  CLST_Rect GetRect() const;
  FX_BOOL IsSelected() const;
  FX_BOOL IsCaret() const;
  FX_FLOAT GetItemHeight() const;
  FX_WORD GetFirstChar() const;

 private:
  IFX_Edit* m_pEdit;
  FX_BOOL m_bSelected;
  FX_BOOL m_bCaret;
  CLST_Rect m_rcListItem;
};

class CFX_ListContainer {
 public:
  CFX_ListContainer()
      : m_rcPlate(0.0f, 0.0f, 0.0f, 0.0f),
        m_rcContent(0.0f, 0.0f, 0.0f, 0.0f) {}
  virtual ~CFX_ListContainer() {}
  virtual void SetPlateRect(const CPDF_Rect& rect) { m_rcPlate = rect; }
  CPDF_Rect GetPlateRect() const { return m_rcPlate; }
  void SetContentRect(const CLST_Rect& rect) { m_rcContent = rect; }
  CLST_Rect GetContentRect() const { return m_rcContent; }
  CPDF_Point GetBTPoint() const {
    return CPDF_Point(m_rcPlate.left, m_rcPlate.top);
  }
  CPDF_Point GetETPoint() const {
    return CPDF_Point(m_rcPlate.right, m_rcPlate.bottom);
  }

 public:
  CPDF_Point InnerToOuter(const CPDF_Point& point) const {
    return CPDF_Point(point.x + GetBTPoint().x, GetBTPoint().y - point.y);
  }
  CPDF_Point OuterToInner(const CPDF_Point& point) const {
    return CPDF_Point(point.x - GetBTPoint().x, GetBTPoint().y - point.y);
  }
  CPDF_Rect InnerToOuter(const CLST_Rect& rect) const {
    CPDF_Point ptLeftTop = InnerToOuter(CPDF_Point(rect.left, rect.top));
    CPDF_Point ptRightBottom =
        InnerToOuter(CPDF_Point(rect.right, rect.bottom));
    return CPDF_Rect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x,
                     ptLeftTop.y);
  }
  CLST_Rect OuterToInner(const CPDF_Rect& rect) const {
    CPDF_Point ptLeftTop = OuterToInner(CPDF_Point(rect.left, rect.top));
    CPDF_Point ptRightBottom =
        OuterToInner(CPDF_Point(rect.right, rect.bottom));
    return CLST_Rect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x,
                     ptRightBottom.y);
  }

 private:
  CPDF_Rect m_rcPlate;
  CLST_Rect m_rcContent;  // positive forever!
};

template <class TYPE>
class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE> {
 public:
  FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; }
  TYPE GetAt(int32_t nIndex) const {
    if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize())
      return CFX_ArrayTemplate<TYPE>::GetAt(nIndex);
    return NULL;
  }
  void RemoveAt(int32_t nIndex) {
    if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize())
      CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);
  }
};

class CFX_List : protected CFX_ListContainer, public IFX_List {
 public:
  CFX_List();
  virtual ~CFX_List();

 public:
  virtual void SetFontMap(IFX_Edit_FontMap* pFontMap);
  virtual void SetFontSize(FX_FLOAT fFontSize);

  virtual CPDF_Rect GetPlateRect() const;
  virtual CPDF_Rect GetContentRect() const;

  virtual FX_FLOAT GetFontSize() const;
  virtual IFX_Edit* GetItemEdit(int32_t nIndex) const;
  virtual int32_t GetCount() const;
  virtual FX_BOOL IsItemSelected(int32_t nIndex) const;
  virtual FX_FLOAT GetFirstHeight() const;

  virtual void SetMultipleSel(FX_BOOL bMultiple);
  virtual FX_BOOL IsMultipleSel() const;
  virtual FX_BOOL IsValid(int32_t nItemIndex) const;
  virtual int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const;

 protected:
  virtual void Empty();

  void AddItem(const FX_WCHAR* str);
  virtual void ReArrange(int32_t nItemIndex);

  virtual CPDF_Rect GetItemRect(int32_t nIndex) const;
  CFX_WideString GetItemText(int32_t nIndex) const;

  void SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected);
  void SetItemCaret(int32_t nItemIndex, FX_BOOL bCaret);

  virtual int32_t GetItemIndex(const CPDF_Point& point) const;
  int32_t GetFirstSelected() const;
  int32_t GetLastSelected() const;
  FX_WCHAR Toupper(FX_WCHAR c) const;

 private:
  CLST_ArrayTemplate<CFX_ListItem*> m_aListItems;
  FX_FLOAT m_fFontSize;
  IFX_Edit_FontMap* m_pFontMap;
  FX_BOOL m_bMultiple;
};

struct CPLST_Select_Item {
  CPLST_Select_Item(int32_t other_nItemIndex, int32_t other_nState) {
    nItemIndex = other_nItemIndex;
    nState = other_nState;
  }

  int32_t nItemIndex;
  int32_t nState;  // 0:normal select -1:to deselect 1: to select
};

class CPLST_Select {
 public:
  CPLST_Select();
  virtual ~CPLST_Select();

 public:
  void Add(int32_t nItemIndex);
  void Add(int32_t nBeginIndex, int32_t nEndIndex);
  void Sub(int32_t nItemIndex);
  void Sub(int32_t nBeginIndex, int32_t nEndIndex);
  FX_BOOL IsExist(int32_t nItemIndex) const;
  int32_t Find(int32_t nItemIndex) const;
  int32_t GetCount() const;
  int32_t GetItemIndex(int32_t nIndex) const;
  int32_t GetState(int32_t nIndex) const;
  void Done();
  void DeselectAll();

 private:
  CFX_ArrayTemplate<CPLST_Select_Item*> m_aItems;
};

class CFX_ListCtrl : public CFX_List {
 public:
  CFX_ListCtrl();
  ~CFX_ListCtrl() override;

  // CFX_List
  void SetNotify(IFX_List_Notify* pNotify) override;
  void OnMouseDown(const CPDF_Point& point,
                   FX_BOOL bShift,
                   FX_BOOL bCtrl) override;
  void OnMouseMove(const CPDF_Point& point,
                   FX_BOOL bShift,
                   FX_BOOL bCtrl) override;
  void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) override;
  void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) override;
  void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) override;
  void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) override;
  void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) override;
  void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) override;
  void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl) override;
  FX_BOOL OnChar(FX_WORD nChar, FX_BOOL bShift, FX_BOOL bCtrl) override;
  void SetPlateRect(const CPDF_Rect& rect) override;
  void SetScrollPos(const CPDF_Point& point) override;
  void ScrollToListItem(int32_t nItemIndex) override;
  CPDF_Rect GetItemRect(int32_t nIndex) const override;
  int32_t GetCaret() const override { return m_nCaretIndex; }
  int32_t GetSelect() const override { return m_nSelItem; }
  int32_t GetTopItem() const override;
  CPDF_Rect GetContentRect() const override;
  int32_t GetItemIndex(const CPDF_Point& point) const override;
  void AddString(const FX_WCHAR* string) override;
  void SetTopItem(int32_t nIndex) override;
  void Select(int32_t nItemIndex) override;
  void SetCaret(int32_t nItemIndex) override;
  void Empty() override;
  void Cancel() override;
  CFX_WideString GetText() const override;
  void ReArrange(int32_t nItemIndex) override;

  virtual CPDF_Point InToOut(const CPDF_Point& point) const;
  virtual CPDF_Point OutToIn(const CPDF_Point& point) const;
  virtual CPDF_Rect InToOut(const CPDF_Rect& rect) const;
  virtual CPDF_Rect OutToIn(const CPDF_Rect& rect) const;

 private:
  void SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected);
  void SetSingleSelect(int32_t nItemIndex);
  void InvalidateItem(int32_t nItemIndex);
  void SelectItems();
  FX_BOOL IsItemVisible(int32_t nItemIndex) const;
  void SetScrollInfo();
  void SetScrollPosY(FX_FLOAT fy);

 private:
  IFX_List_Notify* m_pNotify;
  FX_BOOL m_bNotifyFlag;
  CPDF_Point m_ptScrollPos;
  CPLST_Select m_aSelItems;  // for multiple
  int32_t m_nSelItem;        // for single
  int32_t m_nFootIndex;      // for multiple
  FX_BOOL m_bCtrlSel;        // for multiple
  int32_t m_nCaretIndex;     // for multiple
};

#endif  // FPDFSDK_INCLUDE_FXEDIT_FXET_LIST_H_


text:
/*	$NetBSD: gai_strerror.c,v 1.1.1.2 2013/04/06 15:57:51 christos Exp $	*/

/*
 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the project nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

/*
#include <sys/cdefs.h>

__FBSDID("$FreeBSD: /repoman/r/ncvs/src/lib/libc/net/gai_strerror.c,v 1.1 2005/04/06 12:45:51 ume Exp $");

*/

#ifdef WIN32

#include <ws2tcpip.h>

#else

#include <netdb.h>

#endif

/* Entries EAI_ADDRFAMILY (1) and EAI_NODATA (7) are obsoleted, but left */
/* for backward compatibility with userland code prior to 2553bis-02 */
static char *ai_errlist[] = {
	"Success",					/* 0 */
	"Address family for hostname not supported",	/* 1 */
	"Temporary failure in name resolution",		/* EAI_AGAIN */
	"Invalid value for ai_flags",			/* EAI_BADFLAGS */
	"Non-recoverable failure in name resolution",	/* EAI_FAIL */
	"ai_family not supported",			/* EAI_FAMILY */
	"Memory allocation failure", 			/* EAI_MEMORY */
	"No address associated with hostname",		/* 7 */
	"hostname nor servname provided, or not known",	/* EAI_NONAME */
	"servname not supported for ai_socktype",	/* EAI_SERVICE */
	"ai_socktype not supported", 			/* EAI_SOCKTYPE */
	"System error returned in errno", 		/* EAI_SYSTEM */
	"Invalid value for hints",			/* EAI_BADHINTS */
	"Resolved protocol is unknown"			/* EAI_PROTOCOL */
};

#ifndef EAI_MAX
#define EAI_MAX (sizeof(ai_errlist)/sizeof(ai_errlist[0]))
#endif

/* on MingW, gai_strerror is available.
   We need to compile gai_strerrorA only for Cygwin
 */
#ifndef gai_strerror

char *
WSAAPI gai_strerrorA(int ecode)
{
	if (ecode >= 0 && ecode < EAI_MAX)
		return ai_errlist[ecode];
	return "Unknown error";
}

#endif /* gai_strerror */


text:
package hr.droidcon.conference.objects;

import android.content.Context;
import android.content.Intent;
import android.support.v4.content.LocalBroadcastManager;
import android.text.TextUtils;
import android.widget.Toast;
import hr.droidcon.conference.R;
import hr.droidcon.conference.timeline.Session;
import hr.droidcon.conference.utils.PreferenceManager;

import java.io.Serializable;
import java.util.regex.Pattern;

/**
 * Conference object, created by the CSV file
 *
 * @author Arnaud Camus
 */
public class Conference implements Serializable {

    private static final Pattern CONFERENCE_ID_PAT = Pattern.compile("[^a-zA-Z0-9]+");

    public static final String DEFAULT_SPEAKER_IMG =
            "http://droidcon.hr/sites/global.droidcon.cod.newthinking.net/files/2016_droidcon_banner_128x120_0.png";

    private String startDate;
    private String endDate;
    private String headline;
    private String speaker;
    private String speakerImageUrl;
    private String text;
    private String location;
    private String speakerUID;
    private String category;
    private boolean conflicting = false;

    public Conference(String[] fromCSV) {
        startDate = fromCSV[0];
        endDate = fromCSV[1];
        headline = fromCSV[2];
        speaker = fromCSV[3];
        speakerImageUrl = fromCSV[4];
        text = fromCSV[5];
        location = fromCSV[6];
    }

    public Conference(Session session, String imageURL) {
        startDate = session.getStartISO().get(0);
        endDate = session.getEndISO().get(0);
        headline = session.getTitle();
        // TODO: multiple speakers
        speaker = TextUtils.join(", ", session.getSpeakerNames());
        // TODO: take image from speakers
        speakerImageUrl = imageURL;
        text = session.getAbstractHTML();
        location = session.getRoom().get(0);

        if (session.getSpeakerUIDs().size() > 0) {
            speakerUID = session.getSpeakerUIDs().get(0);
        }

        Object sessionCategory = session.getCategory();
        category = sessionCategory instanceof String ? (String) sessionCategory : "";
    }

    public Conference () {}

    /**
     * Save the new favorite state of the conference.
     * @param ctx a valid context
     * @return true if the hr.droidcon.conference is favorite
     */
    public boolean toggleFavorite(Context ctx) {

        PreferenceManager prefManager =
                new PreferenceManager(ctx.getSharedPreferences("MyPref", Context.MODE_PRIVATE));

        boolean actual = prefManager.favorite(getHeadline())
                                    .getOr(false);

        prefManager.favorite(getHeadline())
                .put(!actual)
                .apply();

        Toast.makeText(
                ctx,
                actual
                        ? ctx.getString(R.string.remove_from_favorites)
                        : ctx.getString(R.string.add_to_favourites),
                Toast.LENGTH_SHORT
        ).show();

        setAttendingDataSetChangeBroadcast(ctx);
        return !actual;
    }

    private static void setAttendingDataSetChangeBroadcast(Context context) {
        Intent intent = new Intent("attending-data-set-changed");
        LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
    }

    //////////////////////////////////////
    //          GETTERS / SETTERS       //
    //////////////////////////////////////

    public boolean isConflicting() {
        return conflicting;
    }

    public void setConflicting(boolean conflicting) {
        this.conflicting = conflicting;
    }

    public boolean isFavorite(Context ctx) {
        PreferenceManager prefManager =
                new PreferenceManager(ctx.getSharedPreferences("MyPref", Context.MODE_PRIVATE));
        return prefManager.favorite(getHeadline())
                .getOr(false);
    }

    public String getStartDate() {
        return startDate;
    }

    public void setStartDate(String startDate) {
        this.startDate = startDate;
    }

    public String getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    public String getHeadline() {
        return headline;
    }

    public void setHeadline(String headline) {
        this.headline = headline;
    }

    public String getSpeaker() {
        return speaker;
    }

    public void setSpeaker(String speaker) {
        this.speaker = speaker;
    }

    public String getSpeakerImageUrl() {
        return speakerImageUrl.isEmpty()
                ? DEFAULT_SPEAKER_IMG
                : speakerImageUrl;
    }

    public void setSpeakerImageUrl(String speakerImageUrl) {
        this.speakerImageUrl = speakerImageUrl;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getSpeakerUID() {
        return speakerUID;
    }

    public void setSpeakerUID(String speakerUID) {
        this.speakerUID = speakerUID;
    }

    public boolean isSpeakerNullOrEmpty() {
        return speaker == null || speaker.isEmpty();
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getConferenceId() {
        return CONFERENCE_ID_PAT.matcher(headline).replaceAll("");
    }
}


text:
var tape = require("tape"),
    pathToRegExp = require("..");

tape("pathToRegExp(path: String[, params: Array[, end: Boolean]])", function(assert) {
    var regExp = pathToRegExp("/parent/parent_:parentId{[0-9]+}"),
        regExpParams = regExp.params,

        endRegExp = pathToRegExp("/parent/parent_:parentId{[0-9]+}/child/:id{[0-9]+}(.:format)", true),
        endRegExpParams = endRegExp.params;

    assert.equal(regExp.test("/parent/parent_1/child/1"), true);
    assert.equal(regExp.test("/parent/parent"), false);

    assert.deepEqual(regExpParams, [{
        name: "parentId",
        regexp: "[0-9]+",
        required: true
    }]);

    assert.equal(endRegExp.test("/parent/parent_1/child/1"), true);
    assert.equal(endRegExp.test("/parent/parent_1/child/1.json"), true);
    assert.equal(endRegExp.test("/parent/parent"), false);

    assert.deepEqual(endRegExpParams, [{
        name: "parentId",
        regexp: "[0-9]+",
        required: true
    }, {
        name: "id",
        regexp: "[0-9]+",
        required: true
    }, {
        name: "format",
        regexp: "[a-zA-Z0-9-_]+",
        required: false
    }]);

    assert.equal(
        pathToRegExp.format("/parent/parent_:parentId{[0-9]+}/child/:id{[0-9]+}(.:format)"),
        "/parent/parent_%s/child/%s"
    );

    assert.end();
});


text:
	<title>Frank Carson's panel show appearances</title>

	<link rel="stylesheet" media="all" href="../style.css" type="text/css"/>

Frank Carson's panel show appearances

Frank Carson (born 1926-11-06[ref]) has appeared in 1 episodes between 2008-2008.  Frank Carson on IMDB. Frank Carson on Wikipedia. Frank Carson on Chortle.

2008

2008-04-11 / Loose Women


text:
Branch | Build Status
--- | ---
master | [![Build Status](https://travis-ci.org/bolecki/lister.svg?branch=master)](https://travis-ci.org/bolecki/lister)
development | [![Build Status](https://travis-ci.org/bolecki/lister.svg?branch=development)](https://travis-ci.org/bolecki/lister)
experimental | [![Build Status](https://travis-ci.org/bolecki/lister.svg?branch=experimental)](https://travis-ci.org/bolecki/lister)

## Info
This is a self hosted application that is used to create and manage lists.  It uses Python, the Django web framework, and a relational database.  Openshift action hooks and a database example are also provided for easy deployment!

# Setup
Skip down to the openshift section if you would like to run the application from openshift.

## Clone and Generate Key
These steps will clone the repository and generate a new secret key.

```bash
# Clone the repo
git clone https://github.com/bolecki/lister.git

# Change directory into the repo
cd lister/

# Generate a secret key
python .openshift/action_hooks/gen_key.py

# Check to make sure key was generated
cat lister/lister/secrets.py
SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
```

## Install Requirements
This step will install the required dependencies.  It is recommended to run these steps and the application from a virtualenv.

```bash
pip install -e .
```

## Configuration
Make any necessary configuration changes within the lister/lister/settings.py file.  This is where installed apps, database configuration, etc are handled.

## Run the App
Once the database is configured and running, simply start the webserver!  This is currently for development use only.  Ultimately this should be served with a full webserver such as Apache or Nginx.

Change the listening ip and port as needed, ie 127.0.0.1:80.

```bash
# Change directory to the Django project
cd lister

# Run HTTPS server
nohup python manage.py runsslserver 0.0.0.0:8080 &
```

## Openshift
To run this application under openshift, simply create a new application with a Django cartridge.  Set the source code to this repository, "https://github.com/bolecki/lister.git", and optionally select scaling.  Add a Postgresql gear at any time with the default settings.py file to have the new database automatically detected!

# TODO
1. Instructions for Apache/Nginx configuration
2. Add more api endpoints
3. Add more list types
4. ~~Handle CSRF tokens~~
5. Add more test cases
6. ~~Add travis CI integration~~


text:
<component name="ArtifactManager">
  <artifact type="war" name="mvnbuilder:war">
    <output-path>$PROJECT_DIR$/mvnbuilder/target</output-path>
    <root id="archive" name="mvnbuilder.war">
      <element id="artifact" artifact-name="mvnbuilder:war exploded" />
    </root>
  </artifact>
</component>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Simple Voting — BallotBox v0.1 documentation</title>
    <link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />

    <link rel="top" title="BallotBox v0.1 documentation" href="../../../index.html" />
    <link rel="up" title="Voting Methods" href="../VOTINGMETHODS.html" />
    <link rel="next" title="Plurality Voting" href="plurality.html" />
    <link rel="prev" title="Voting Methods" href="../VOTINGMETHODS.html" />

Navigation

          index

          modules |

          next |

          previous |

BallotBox v0.1 documentation »

Voting Methods »

Simple Voting¶

Majority Rule¶

Simple majority rule voting is mostly useful for binary decisions. Below are
some examples involving just two choices:

>>> from ballotbox.ballot import BallotBox
>>> from ballotbox.singlewinner.simple import MajorityRuleVoting

>>> bb = BallotBox(method=MajorityRuleVoting)
>>> bb.batch_votes([("alice", 10000), ("bob", 5000)])
>>> bb.get_winner()
[(10000, 'alice')]

>>> bb = BallotBox(method=MajorityRuleVoting)
>>> bb.batch_votes([("bob", 5000), ("carol", 5001)])
>>> bb.get_winner()
[(5001, 'carol')]

This method breaks down with ties and is not guaranteed to work with more than
two choices:

>>> bb = BallotBox(method=MajorityRuleVoting)
>>> bb.batch_votes([("alice", 8000), ("carol", 8000)])
>>> bb.get_winner()
[]

No result is returned. Likewise for edge cases with more than two candidates:

>>> bb = BallotBox(method=MajorityRuleVoting)
>>> bb.batch_votes([("alice", 5000), ("bob", 4000), ("carol", 3000)])
>>> bb.get_winner()
[]

Table Of Contents

Simple Voting

Majority Rule

Previous topic

Voting Methods

Next topic

Plurality Voting

This Page

Show Source

Quick search

    <form class="search" action="../../../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

Navigation

          index

          modules |

          next |

          previous |

BallotBox v0.1 documentation »

Voting Methods »

        © Copyright 2011, Duncan McGreggor.
      Created using Sphinx 1.0.7.


text:
SOURCE="${BASH_SOURCE[0]}"
RDIR="$( dirname "$SOURCE" )"

ON_CENTOS(){
    CENTOS_RELEASE=$(rpm -qa \*-release | grep -Ei "oracle|redhat|centos" | cut -d"-" -f3)
    sudo rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-el-${CENTOS_RELEASE}.noarch.rpm
    sudo yum install puppet -y

    exit 0
}
ON_DEBIAN(){
    echo ""
    exit 0
}
ON_SUSE(){
    RELEASE=$(python -c "import platform;distname,version,id=platform.linux_distribution();print id")
    wget https://apt.puppetlabs.com/puppetlabs-release-${RELEASE}.deb
    sudo dpkg -i puppetlabs-release-pc1-wheezy.deb
    sudo apt-get update
    sudo apt-get install puppet-agent -y
    exit 0
}

 which yum && ON_CENTOS
 which zypper && ON_SUSE
 which apt-get && ON_DEBIAN


text:
<?php

namespace BoShurik\TelegramBotBundle\Authenticator;

use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Component\Security\Http\Authenticator\AbstractAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
use Symfony\Component\Security\Http\Util\TargetPathTrait;

class TelegramAuthenticator extends AbstractAuthenticator
{
    use TargetPathTrait;

    public function __construct(
        private TelegramLoginValidator $validator,
        private UserLoaderInterface $userLoader,
        private ?UserFactoryInterface $userFactory,
        private UrlGeneratorInterface $urlGenerator,
        private string $guardRoute,
        private string $defaultTargetRoute,
        private ?string $loginRoute = null
    ) {
    }

    public function supports(Request $request): ?bool
    {
        $route = $request->attributes->get('_route');

        return $route === $this->guardRoute;
    }

    public function authenticate(Request $request): Passport
    {
        $credentials = $request->query->all();

        $this->validator->validate($credentials);
        $user = $this->userLoader->loadByTelegramId($credentials['id']);

        if (!$user && $this->userFactory) {
            $user = $this->userFactory->createFromTelegram($credentials);
        }

        if (!$user) {
            throw new BadCredentialsException();
        }

        return new SelfValidatingPassport(new UserBadge($credentials['id'], function ($id) {
            return $this->userLoader->loadByTelegramId($id);
        }));
    }

    public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): ?Response
    {
        if ($targetPath = $this->getTargetPath($request->getSession(), $firewallName)) {
            return new RedirectResponse($targetPath);
        }

        return new RedirectResponse($this->urlGenerator->generate($this->defaultTargetRoute));
    }

    public function onAuthenticationFailure(Request $request, AuthenticationException $exception): ?Response
    {
        if ($this->loginRoute) {
            return new RedirectResponse($this->urlGenerator->generate($this->loginRoute));
        }

        return null;
    }
}


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0; maximum-scale=1.0; user-scalable=no;">
  <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
  <link rel="icon" href="/favicon.ico" type="image/x-icon">
  <title>JS Dictionary</title>
  <link rel="stylesheet" href="style.css">

JS Dictionary

This is a non profit project by @antonk52. Feel free to contribute on GitHub.

Identifier

Operator

Assignment Operator

Arithmetic Operator

Comparison Operator

Type Operator

Invocation Operator

Conditional (Ternary) Operator

Function

Function Keyword

Function Expression

Function Declaration

Parameter

Argument

Block Statement

Statement Body

Comment

Single Line Comment

Multi Line Comment

If Statement

Else Statement

Else If Statement

Condition

  <button class="clear-all hide">Clear All</button>

    var name = "John Doe";

    var someNumber = 14 * 25 - 8 + 10 / 2;

    var coolGuy = {
      name: "Eames",
      age: 24,
      hometown: "London",
      introduce: function() {
        return "My name is " + this.name + ", I am " + this.age + " years old and I am from " + this.hometown + ".";
      }
    };

    function john() {
      console.log("say hello");
    }

    john();

    var introduceMe = function(name, age) {
      if ( typeof name != "string" ) {
        return "entered name is not a string";
      } else if ( typeof age != "number" ) {
        return "entered age is not a number";
      } else if ( age < 0 ) {
        return "My name will be " + name + " and I am not born yet";
      } else if ( age < 1 ) {
        return "My mum calls me " + name + " and I am a new born baby";
      } else {
        return "yo, my name is " + name + " and I am " + age, age > 1 ? "years" : "year", "old";
      }
    };

    introduceMe( John, 24 );
    // entered name is not a string

    introduceMe( "Fred", "five" );
    /* "five" is not a number so the output will be
    entered age is not a number */


text:
public class Solution {
    public List<List<Integer>> pathSum(TreeNode root, int sum) {
        List<List<Integer>> validPaths = new ArrayList<List<Integer>> ();
        List<Integer> curPath = new ArrayList<Integer> ();

        pathSumRecur(root, sum, validPaths, curPath);

        return validPaths;
    }

    private void pathSumRecur(TreeNode root, int sum, List<List<Integer>> validPaths, List<Integer> curPath) {
        if (root == null) {
            return;
        }

        curPath.add(root.val);
        if (root.left == null && root.right == null && sum == root.val) {
            validPaths.add(new ArrayList<Integer>(curPath));  //make sure saving a copy, since the list will be changed
        } else {
            pathSumRecur(root.left, sum-root.val, validPaths, curPath);
            pathSumRecur(root.right, sum-root.val, validPaths, curPath);
        }
        curPath.remove(curPath.size()-1);
    }
}


text:
package br.github.gnomex.some_examples.lista_exercicios.geometry;

import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Point;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JLabel;

public class OvalDrawer extends JFrame {

	private JPanel contentPane;

	private Point onClick;
	private Point onRelease;

	private JLabel lblAreaResult;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					OvalDrawer frame = new OvalDrawer();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public OvalDrawer() {

		super("Draw a circle!");

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 588, 499);
		contentPane = new JPanel();

		contentPane.addMouseListener(new MouseAdapter() {
			@Override
			public void mousePressed(MouseEvent e) {
				onClick = e.getLocationOnScreen();
				repaint();
			}
			@Override
			public void mouseReleased(MouseEvent e) {
				onRelease = e.getLocationOnScreen();

				Integer distance = Geometry.getDistanceBetwenTwoPoints(onClick, onRelease);

				Float area = Geometry.circleArea(distance);

				lblAreaResult.setText(Float.toString(area));

				paintComponent(
						getGraphics(),
						new Double(onClick.getX() - distance).intValue(),
						new Double(onClick.getY() - distance).intValue(),
						new Double(distance + distance).intValue(),
						new Double(distance + distance).intValue()
					);

				clearClickFilds();
			}

		});
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);

		lblAreaResult = new JLabel("Circle Area");
		lblAreaResult.setBounds(12, 12, 558, 26);
		contentPane.add(lblAreaResult);
	}

	 public void paintComponent(Graphics g, int d, int e, int f, int h)	{
		 g.setColor(Color.RED);
		 g.drawOval (d,e,f,h);
	  }

	private void clearClickFilds()	{
		onClick.setLocation(0, 0);
		onRelease.setLocation(0, 0);
	}
}


text:
module CodeGen
  class Generator

    attr_reader :lines
    attr_reader :indents
    attr_accessor :indent_amount

    def initialize
      @lines = [""]
      @indents= [""]
      @indent_amount = 2
    end

    def to_s
      lines.join("\n")
    end

    def pop_indent
      indents.pop
    end

    def push_indent(amount=indent_amount)
      indents.push(indents.last + " " * amount)
    end

    def add(*strings)
      strings.each do |string|
        lines.last.concat(string)
      end
    end

    def line(*strings)
      lines.push(indents.last.dup)
      add(*strings)
    end

    def list(items, separator="", auto_lines:false, &block)
      return unless items.any?

      items = items.dup
      last_item = items.pop

      use_lines = items.any? && auto_lines
      use_lines && self.push_indent

      items.each do |item|
        use_lines && self.line
        block ? block.call(item) : add(item)
        add(separator)
      end
      use_lines && self.line
      block ? block.call(last_item) : add(last_item)

      use_lines && self.pop_indent
      use_lines && self.line
    end

  end
end


text:
#include <iostream>

#include "AISystemBT.h"
#include "Actor.h"
#include "Blackboard.h"
#include "BTBase.h"

AISystemBT::AISystemBT(BTBase* argBehaviorTreeData, class Blackboard* argBlackboard) :
AISystemBase(argBlackboard), BehaviorTreeData(argBehaviorTreeData), PendingTask(nullptr), MyBlackboard(argBlackboard)
{

}

AISystemBT::~AISystemBT()
{

}

void AISystemBT::UpdatePendingTask(BTTask* NewPendingTask)
{
	PendingTask = NewPendingTask;
}

void AISystemBT::Update()
{
	BehaviorTreeData->Update(this, MyBlackboard, Blackboard->SomeValueHasChanged() ? nullptr : PendingTask);
}


text:
package org.uiautomation.ios.server.command.uiautomation;

import org.json.JSONException;
import org.json.JSONObject;
import org.openqa.selenium.SessionNotCreatedException;
import org.openqa.selenium.remote.Response;
import org.uiautomation.ios.IOSCapabilities;
import org.uiautomation.ios.communication.WebDriverLikeRequest;
import org.uiautomation.ios.server.IOSServerManager;
import org.uiautomation.ios.server.ServerSideSession;
import org.uiautomation.ios.server.command.BaseNativeCommandHandler;

public class NewSessionNHandler extends BaseNativeCommandHandler {

  private ServerSideSession session;

  public NewSessionNHandler(IOSServerManager driver, WebDriverLikeRequest request) {
    super(driver, request);
  }

  public Response handle() throws Exception {
    try {
      GetCapabilitiesNHandler.reset();
      JSONObject payload = getRequest().getPayload();
      IOSCapabilities cap = new IOSCapabilities(payload.getJSONObject("desiredCapabilities"));
      session = getServer().createSession(cap);
      session.start();

      Response resp = new Response();
      resp.setSessionId(session.getSessionId());
      resp.setStatus(0);
      resp.setValue("");
      return resp;
    } catch (Exception e) {
      e.printStackTrace();
      if (session != null) {
        session.stop();
      }
      throw new SessionNotCreatedException(e.getMessage(), e);
    }
  }

  @Override
  public JSONObject configurationDescription() throws JSONException {
    return noConfigDefined();
  }
}


text:
<?php

namespace AssetManagerTest\Service;

use PHPUnit_Framework_TestCase;
use AssetManager\Resolver\ResolverInterface;
use AssetManager\Resolver\PrioritizedPathsResolver;
use AssetManager\Resolver\MimeResolverAwareInterface;
use AssetManager\Service\MimeResolver;

class PrioritizedPathsResolverTest extends PHPUnit_Framework_TestCase
{
    public function testConstructor()
    {
        $resolver = new PrioritizedPathsResolver();
        $this->assertEmpty($resolver->getPaths()->toArray());

        $resolver->addPaths(array(__DIR__));
        $this->assertEquals(array(__DIR__ . DIRECTORY_SEPARATOR), $resolver->getPaths()->toArray());
        $this->assertTrue($resolver instanceof MimeResolverAwareInterface);
        $this->assertTrue($resolver instanceof ResolverInterface);
    }

    public function testClearPaths()
    {
        $resolver = new PrioritizedPathsResolver();
        $resolver->addPath('someDir');

        $paths = $resolver->getPaths();

        $this->assertEquals('someDir' . DIRECTORY_SEPARATOR, $paths->top());

        $resolver->clearPaths();
        $this->assertEquals(array(), $resolver->getPaths()->toArray());
    }

    public function testSetPaths()
    {
        $resolver = new PrioritizedPathsResolver();
        $resolver->setPaths(array(
            array(
                'path' => 'dir3',
                'priority' => 750,
            ),
            array(
                'path' => 'dir2',
                'priority' => 1000,
            ),
            array(
                'path' => 'dir1',
                'priority' => 500,
            ),
        ));

        $this->assertTrue($resolver->getPaths()->hasPriority(1000));
        $this->assertTrue($resolver->getPaths()->hasPriority(500));

        $fetched = array();

        foreach ($resolver->getPaths() as $path) {
            $fetched[] = $path;
        }

        // order inverted because of how a stack is traversed
        $this->assertSame(
            array('dir2' . DIRECTORY_SEPARATOR, 'dir3' . DIRECTORY_SEPARATOR, 'dir1' . DIRECTORY_SEPARATOR),
            $fetched
        );

        $this->setExpectedException('AssetManager\Exception\InvalidArgumentException');
        $resolver->setPaths('invalid');
    }

    public function testAddPaths()
    {
        $resolver = new PrioritizedPathsResolver();
        $resolver->setPaths(array(
            array(
                'path' => 'dir3',
                'priority' => 750,
            ),
            array(
                'path' => 'dir2',
                'priority' => 1000,
            ),
            array(
                'path' => 'dir1',
                'priority' => 500,
            ),
        ));

        $resolver->addPaths(array(
            'dir4',
            array(
                'path' => 'dir5',
                'priority' => -5,
            )
        ));

        $fetched = array();

        foreach ($resolver->getPaths() as $path) {
            $fetched[] = $path;
        }

        // order inverted because of how a stack is traversed
        $this->assertSame(
            array(
                'dir2' . DIRECTORY_SEPARATOR,
                'dir3' . DIRECTORY_SEPARATOR,
                'dir1' . DIRECTORY_SEPARATOR,
                'dir4' . DIRECTORY_SEPARATOR,
                'dir5' . DIRECTORY_SEPARATOR,
            ),
            $fetched
        );
    }

    public function testAddPath()
    {
        $resolver = new PrioritizedPathsResolver();
        $resolver->setPaths(array(
            array(
                'path' => 'dir3',
                'priority' => 750,
            ),
            array(
                'path' => 'dir2',
                'priority' => 1000,
            ),
            array(
                'path' => 'dir1',
                'priority' => 500,
            ),
        ));

        $resolver->addPath('dir4');
        $resolver->addPath(array('path'=>'dir5', 'priority'=>-5));

        $fetched = array();

        foreach ($resolver->getPaths() as $path) {
            $fetched[] = $path;
        }

        // order inverted because of how a stack is traversed
        $this->assertSame(
            array(
                'dir2' . DIRECTORY_SEPARATOR,
                'dir3' . DIRECTORY_SEPARATOR,
                'dir1' . DIRECTORY_SEPARATOR,
                'dir4' . DIRECTORY_SEPARATOR,
                'dir5' . DIRECTORY_SEPARATOR,
            ),
            $fetched
        );
    }

    public function testSetPathsAllowsStringPaths()
    {
        $resolver = new PrioritizedPathsResolver();
        $resolver->setPaths(array('dir1', 'dir2', 'dir3'));

        $paths = $resolver->getPaths()->toArray();
        $this->assertCount(3, $paths);
        $this->assertContains('dir1' . DIRECTORY_SEPARATOR, $paths);
        $this->assertContains('dir2' . DIRECTORY_SEPARATOR, $paths);
        $this->assertContains('dir3' . DIRECTORY_SEPARATOR, $paths);

    }

    public function testWillValidateGivenPathArray()
    {
        $resolver = new PrioritizedPathsResolver();
        $this->setExpectedException('AssetManager\Exception\InvalidArgumentException');
        $resolver->addPath(array('invalid'));
    }

    public function testResolve()
    {
        $resolver = new PrioritizedPathsResolver;
        $resolver->setMimeResolver(new MimeResolver);
        $resolver->addPath(__DIR__);

        $this->assertEquals(file_get_contents(__FILE__), $resolver->resolve(basename(__FILE__))->dump());
        $this->assertNull($resolver->resolve('i-do-not-exist.php'));
    }

    public function testWillNotResolveDirectories()
    {
        $resolver = new PrioritizedPathsResolver();
        $resolver->addPath(__DIR__ . '/..');

        $this->assertNull($resolver->resolve(basename(__DIR__)));
    }

    public function testLfiProtection()
    {
        $resolver = new PrioritizedPathsResolver();
        $resolver->setMimeResolver(new MimeResolver);
        // should be on by default
        $this->assertTrue($resolver->isLfiProtectionOn());
        $resolver->addPath(__DIR__);

        $this->assertNull($resolver->resolve(
            '..' . DIRECTORY_SEPARATOR . basename(__DIR__) . DIRECTORY_SEPARATOR . basename(__FILE__)
        ));

        $resolver->setLfiProtection(false);

        $this->assertSame(
            file_get_contents(__FILE__),
            $resolver->resolve(
                '..' . DIRECTORY_SEPARATOR . basename(__DIR__) . DIRECTORY_SEPARATOR . basename(__FILE__)
            )->dump()
        );
    }

    public function testWillRefuseInvalidPath()
    {
        $resolver = new PrioritizedPathsResolver();
        $this->setExpectedException('AssetManager\Exception\InvalidArgumentException');
        $resolver->addPath(null);
    }
}


text:
import sys
import cv2
import numpy as np

IMAGE_WIDTH = 500

def resized_frame(frame):
    height, width = frame.shape[0: 2]
    desired_width = IMAGE_WIDTH
    desired_to_actual = float(desired_width) / width
    new_width = int(width * desired_to_actual)
    new_height = int(height * desired_to_actual)
    return cv2.resize(frame, (new_width, new_height))

class ShakyMotionDetector(object):

    X_PIXEL_RANGE = 4
    Y_PIXEL_RANGE = 2

    def __init__(self, file_to_read):
        self.file_to_read = file_to_read
        self.capture = cv2.VideoCapture(self.file_to_read)

        self.video_writer = None
        self.frames_per_sec = 25
        self.codec = cv2.VideoWriter_fourcc('M', 'J', 'P', 'G')

        self.frame_number = 0
        video_filename = (file_to_read.split("/")[-1]).split(".")[0]
        self.output_filename = "output_%s.avi" % video_filename

    def _generate_working_frames(self):
        while True:
            success, frame_from_video = self.capture.read()
            if not success:
                break
            frame_from_video = resized_frame(frame_from_video)
            yield frame_from_video

    def _generate_motion_detection_frames(self):
        previous_frame = None
        previous_previous_frame = None
        for frame in self._generate_working_frames():
            motion_detection_frame = None
            if previous_previous_frame is not None:
                motion_detection_frame = self._get_motion_detection_frame(previous_previous_frame, previous_frame, frame)
            previous_previous_frame = previous_frame
            previous_frame = frame
            if motion_detection_frame is not None:
                yield motion_detection_frame

    def _get_motion_detection_frame(self, previous_previous_frame, previous_frame, frame):
        d1 = cv2.absdiff(frame, previous_frame)
        d2 = cv2.absdiff(previous_frame, previous_previous_frame)
        motion_detection_frame = cv2.bitwise_xor(d1, d2)
        return motion_detection_frame

    def _remove_shakiness(self, frames):
        clean_frames = []
        min_previous_frame_count = 6
        max_previous_frame_count = 20
        for index, frame in enumerate(frames):
            print "Processing %s" % index
            previous_frames = frames[:index - min_previous_frame_count]
            previous_frames = previous_frames[index - max_previous_frame_count:]
            missing_frame_count = (max_previous_frame_count - min_previous_frame_count) - len(previous_frames)
            if missing_frame_count > 0:
                previous_frames = previous_frames + frames[-missing_frame_count:]
            # cumulative_motion = np.sum(previous_frames, axis=0)
            cumulative_motion = self._get_max_array(previous_frames)
            final_frame = frame.astype(int) - cumulative_motion.astype(int)
            final_frame[final_frame < 0] = 0
            clean_frames.append(final_frame.astype(np.uint8))
            print "Final sum: %s" % np.sum(final_frame)
        return clean_frames

    def _get_max_array(self, array_list):
        resultant_array = np.zeros(array_list[0].shape)
        for array in array_list:
            resultant_array = np.maximum(resultant_array, array)

        for y_offset in xrange(-self.Y_PIXEL_RANGE, self.Y_PIXEL_RANGE + 1):
            for x_offset in xrange(-self.X_PIXEL_RANGE, self.X_PIXEL_RANGE + 1):
                offset_array = np.roll(resultant_array, x_offset, axis=1)
                offset_array = np.roll(offset_array, y_offset, axis=0)
                resultant_array = np.maximum(resultant_array, offset_array)
        return resultant_array

    def create(self):
        all_frames = list(self._generate_motion_detection_frames())
        all_frames = self._remove_shakiness(all_frames)

        for motion_detection_frame in all_frames:
            height, width = motion_detection_frame.shape[0: 2]
            self.video_writer = self.video_writer or cv2.VideoWriter(self.output_filename, self.codec, self.frames_per_sec, (width, height))
            self.video_writer.write(motion_detection_frame)
            self.frame_number += 1
            print "Writing %s" % self.frame_number
        if self.video_writer is not None:
            self.video_writer.release()

if __name__ == "__main__":
    # file_to_read = sys.argv[1]
    file_to_read = "../sample_videos/Piano/VID_20161102_204909.mp4"
    ShakyMotionDetector(file_to_read).create()


text:
#include "mongoc/mongoc-prelude.h"

#ifndef MONGOC_CLIENT_POOL_PRIVATE_H
#define MONGOC_CLIENT_POOL_PRIVATE_H

#include <bson/bson.h>

#include "mongoc/mongoc-client-pool.h"
#include "mongoc/mongoc-topology-description.h"
#include "mongoc/mongoc-topology-private.h"

BSON_BEGIN_DECLS

/* for tests */
void
_mongoc_client_pool_set_stream_initiator (mongoc_client_pool_t *pool,
                                          mongoc_stream_initiator_t si,
                                          void *user_data);
size_t
mongoc_client_pool_get_size (mongoc_client_pool_t *pool);
size_t
mongoc_client_pool_num_pushed (mongoc_client_pool_t *pool);
mongoc_topology_t *
_mongoc_client_pool_get_topology (mongoc_client_pool_t *pool);

BSON_END_DECLS

#endif /* MONGOC_CLIENT_POOL_PRIVATE_H */