text:
namespace Graphs.Algorithms
{
    using System;
    using System.Collections.Generic;
    using Contracts;
    using Graphs.Components.Contracts;
    using Graphs.Algorithms.Delegates;
    using Graphs.Algorithms.Common;

    public sealed class BFS<T> : AlgorithmCore<T>, ITraverse<T>
        where T : IComparable
    {
        public BFS()
        {
        }

        public void Traverse(INode<T> startNode, TraverseManipulation<T> manipulation)
        {
            Queue<INode<T>> queue = new Queue<INode<T>>();
            bool breakLoop = false;

            queue.Enqueue(startNode);

            while (queue.Count > 0)
            {
                INode<T> currentNode = queue.Dequeue();

                if (!currentNode.IsVisited)
                {
                    manipulation(currentNode, ref breakLoop);

                    if (breakLoop)
                    {
                        break;
                    }

                    currentNode.IsVisited = true;

                    foreach (IEdge<T> edge in currentNode.AdjacentEdges)
                    {
                        queue.Enqueue(edge.Node);
                    }
                }
            }

            this.UnvisitAllNodes();
        }
    }
}


text:
package org.baswell.routes;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Route metadata for all route methods within the class.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface Routes
{
  /**
   *

   * The base matching URI paths. If provided these values will be prepended to all {@link Route#value()} paths. Multiple
   * values can be specified here here so that a routes class supports multiple root urls.
   *

   */
  String[] value() default {};

  /**
   *

   * If provided this value will be prepended to all forward paths returned by routes of the annotated class.
   *

   *
   * @see org.baswell.routes.RoutesConfiguration#rootForwardPath
   */
  String forwardPath() default "";

  /**
   *

   * The default type of media all routes in this class know how to serve. Overridden by {@link Route#respondsToMediaRequests()}.
   *

   */
  MediaType[] defaultRespondsToMedia() default {};

  /**
   *

   * Should public methods be candidates for HTTP routes if they aren't annotated with {@link org.baswell.routes.Route}?
   * If true only unannotated, public methods of the immediate class will be used. Public, unannotated methods of extended
   * classes will not be candidates (ex. {@link java.lang.Object#equals(Object)}. If this attribute is not explicitly set
   * then the {@link org.baswell.routes.RoutesConfiguration#routeUnannotatedPublicMethods}  will be used.
   *

   *
   *

   * This should be used as a single value. Only the first value in the array will be used.
   *

   *
   * @see org.baswell.routes.RoutesConfiguration#routeUnannotatedPublicMethods
   */
  boolean[] routeUnannotatedPublicMethods() default {};

  /**
   *

   * Default content type returned for routes in this class. This can be overridden in {@link Route#contentType()}, or by
   * explicitly calling {@link javax.servlet.http.HttpServletResponse#setContentType(String)} in the route method.
   *

   */
  String defaultContentType() default "";

  /**
   *
   *

   * If true by default strings returned from routes of this annotated class are sent back as the content. If false by default
   * returned strings are interpreted as file paths that the request is forwarded to. This can be overridden in
   * {@link Route#returnedStringIsContent()}.
   *

   *
   *

   * This should be used as a single value. Only the first value in the array will be used.
   *

   *
   * @see org.baswell.routes.RoutesConfiguration#defaultReturnedStringIsContent
   * @see org.baswell.routes.Route#returnedStringIsContent()
   */
  boolean[] defaultReturnedStringIsContent() default {};

  /**
   *

   * Tags to apply to all routes within the annotated class. If a route method defines its own tags, they will be added to
   * the tags defined here. Tags defined here will be added to any tags defined explicitly in {@link org.baswell.routes.Route#tags()}.
   *

   *
   * @see BeforeRoute#exceptTags()
   * @see BeforeRoute#onlyTags()
   * @see AfterRoute#exceptTags()
   * @see AfterRoute#onlyTags()
   */
  String[] tags() default {};

}

redpajama_set_name: RedPajamaGithub


text:
import { ElementRef, Inject, Injectable } from '@angular/core';

import { Window } from '../../core/types/types';

@Injectable()
export class NgxSidebarService {
  private swipeStatus  = {
    start : 0,
    dragged: false
  };
  constructor(@Inject('Window') private window: Window) {}
  // Return true if mobile, false if desktop
  screenType(screenSize: number, isMobile: boolean): boolean {
    if (screenSize <= 1100 && !isMobile) {
      return true;
    } else if (screenSize >= 1100 && isMobile) {
      return false;
    }
    return isMobile;
  }
  // Get the current screen size
  screenSize(): number {
    return window.screen.width;
  }
  // Swipe event listener
  swipe(position: string, event: any, sidebarRef: ElementRef, backdropRef: ElementRef): boolean {
    switch (event.type) {
      // Drag element with mouse
      case 'mousemove':
        if (event.buttons === 1) {
          this.swipeStatus.dragged = true;
          this.doDrag(sidebarRef, position, event.x);
        }
        return true;
      // Drop element with mouse
      case 'mouseup':
        if (this.swipeStatus.start > 0 && this.swipeStatus.dragged) {
          return this.doDrop(sidebarRef, backdropRef, position);
        }
        return true;
      // Click sidebar
      case 'click':
        if (this.swipeStatus.dragged) {
          this.swipeStatus.dragged = false;
          return true;
        }
        return false;
      // Drag element touch
      case 'touchmove':
        this.doDrag(sidebarRef, position, event.changedTouches[0].clientX);
        return true;
      // Drop element touch
      case 'touchend':
        return this.doDrop(sidebarRef, backdropRef, position);
      default:
        return true;
    }
  }
  // Drag sidebar
  doDrag(sidebarRef: ElementRef, position: string, movement: number): void {
    sidebarRef.nativeElement.style.transition = 'none';
    sidebarRef.nativeElement.style.transform =
      `translateX(${this.doTranslate(position, movement)}px)`;
  }
  // Drop sidebar
  doDrop(sidebarRef: ElementRef, backdropRef: ElementRef, position: string): boolean {
    this.swipeStatus.start = 0;
    sidebarRef.nativeElement.style.removeProperty('transition');
    sidebarRef.nativeElement.style.removeProperty('transform');
    backdropRef.nativeElement.style.removeProperty('opacity');

    const sidebarAxis = sidebarRef.nativeElement.getBoundingClientRect().x < 0 ?
    sidebarRef.nativeElement.getBoundingClientRect().x * -1 :
    sidebarRef.nativeElement.getBoundingClientRect().x;
    if (position === 'left') {
      if ((sidebarAxis * 100) /
        sidebarRef.nativeElement.getBoundingClientRect().width >= 55) {
          return false;
      }
    } else {
      const desplaced = backdropRef.nativeElement.getBoundingClientRect().width - sidebarAxis;
      const sideWidth = sidebarRef.nativeElement.getBoundingClientRect().width;
      if ((((desplaced * 100) / sideWidth - 100) ) < -55) {
        return false;
      }
    }
    return true;
  }
  // Apply translation when swipe
  doTranslate(position: string, movement: number): number {
    if (!this.swipeStatus.start ||
        position === 'left' && movement > this.swipeStatus.start ||
        position !== 'left' && movement < this.swipeStatus.start) {
          this.swipeStatus.start = movement;
    } else {
      this.swipeStatus.start = this.swipeStatus.start;
    }
    if (position === 'left') {
      return -(this.swipeStatus.start - movement) <= -1 ? -(this.swipeStatus.start - movement) : 0;
    } else {
      return (movement - this.swipeStatus.start) >= 0 ? movement - this.swipeStatus.start : 0;
    }
  }
}


text:
/**
 * An accessory file for the Lua script debugger module that defines the
 * textEditor object.
 *
 * @author Chris Johnson (LabJack Corp, 2013)
 *
**/

function textEditor() {
    var editor;
    var htmlID = '';
    var editorTheme = '';
    var editorMode = '';
    var curHeight = -1;
    var session;
    var editorType = 'basic';

    var editorContents = '';

    this.destroy = function() {
        self.editor.destroy();
    };
    var editorTypes = ['luaEditor','console', 'basic'];

    function override(object, prop, replacer) {
        var old = object[prop]; object[prop] = replacer(old);
    }
    function getZoom(element) {
       if (!element) return 1;
       return window.getComputedStyle(element).zoom * getZoom(element.parentElement);
    }

    this.setupEditor = function(id, theme, mode, type) {
        self.htmlID = id;
        self.editorTheme = theme;
        self.editorMode = mode;
        self.editorType = type;

        // Initialize the aceEditor instance
        var isValidType = false;
        if(type) {
            isValidType = editorTypes.indexOf(type) >= 0;
        }
        if(!isValidType) {
            type = 'basic';
        }

        try{
            if(type === 'luaEditor') {
                // ace.require('ace/ext/language_tools'); // In hows of enabling autocompletion
            }

            self.editor = ace.edit(id, {
                mode: mode,

            });
            self.editor.setTheme(theme);
            self.session = self.editor.getSession();
            self.session.setMode(mode);

            if(type === 'luaEditor') {
                self.editor.setOptions({
                    enableBasicAutocompletion: true,
                    enableSnippets: true,
                    // enableLiveAutocompletion: true
                });
                // self.editor.setOptions({'showInvisibles':true});
            } else if(type === 'console') {
                self.editor.renderer.setShowGutter(false);
            }

            // Monkeypatch ace editor "zoom" functionality:
            // https://github.com/ajaxorg/ace/issues/2475#issuecomment-364266978
            override(self.editor.renderer, "screenToTextCoordinates", function(old) {
                return function(x, y) {
                    var zoom = getZoom(this.container);
                    return old.call(this, x/zoom, y/zoom);
                };
            });
        } catch(err) {
            console.error('Error initializing ace editor',err);
        }

        /*
        Cool Options:
        1. Enabling the display of all invisible characters:
        self.editor.setOptions({'showInvisibles':true});

         */
    };
    this.setHeight = function(newHeight) {
        var curLineNum = self.session.getLength();
        var isCursorVisible = self.editor.isRowVisible(curLineNum - 1);

        if(newHeight != self.curHeight) {
            if (typeof(newHeight) === 'number') {
                $('#'+self.htmlID).height(newHeight.toString() + 'px');
            } else if (typeof(newHeight) === 'string') {
                $('#'+self.htmlID).height(newHeight + 'px');
            }
        }
        try{
            self.editor.resize(true);
        } catch(err) {
            console.error('Error Resizing ace editor',err);
            alert('Error resizing ace editor');
        }

        if(isCursorVisible && self.editorType === 'console') {
            self.editor.scrollToLine(curLineNum);
        }
    };
    this.getHeight = function() {
        if(self.curHeight == -1) {
            self.curHeight = $('#'+self.htmlID).height();
        }
        return self.curHeight;
    };

    this.getLength = function() {
        return self.editor.session.doc.getLength();
    };
    this.getValue = function() {
        return self.editor.session.doc.getValue();
    };
    this.setValue = function(data) {
        return self.editor.session.doc.setValue(data);
    };

    /*
     * Function for adding text to editor window.
     */
    this.appendText = function(textData) {
        var curLineNum = self.getLength();
        self.insert({
            row: curLineNum,
            column:0
        }, textData);
    };

    this.clear = function() {
        self.setValue('');
    };

    this.scrollToEnd = function() {
        var curLineNum = self.getLength();
        self.editor.scrollToLine(curLineNum);
    };

    this.insert = function(options, data) {
        try {
            // Get visibility information for where cursor currently is.
            var curLineNum = self.getLength();

            var isCursorVisible = self.editor.isRowVisible(curLineNum-3);

            self.editor.session.doc.insert(options, data);

            if(isCursorVisible) {
                // Adjust scroll to ensure line is visible still.
                self.editor.scrollToLine(curLineNum);
            } else {
                // Update the size of the scroll bar b/c it isn't automatically re-rendered.
                self.editor.renderer.$updateCachedSize();
            }

            /* Other options for updating zoom location for ace 1.4.x
            self.debuggingLog.editor.scrollToRow(self.debuggingLog.editor.selection.lead.row);

            // Option from ace editor source.
            editor.selection.moveToPosition(cursor);
            editor.renderer.scrollCursorIntoView();
            */
        } catch(err) {
            console.warn('Error inserting text', err);
        }
    };

    /*
     * Checking for linter errors (built in w/ ace text editor).
     */
    this.errorsExist = function() {
        return self.session.$annotations.length > 0;
    };
    this.getLinterErrors = function() {
        var errors = [];
        self.session.$annotations.forEach(function(annotation) {
            if(annotation.type === 'error') {
                errors.push('Check line (' + (annotation.row+1).toString() + '). ' + annotation.text);
            }
        });
        return errors;
    };

    /*
     * Checking for LJ library errors.
     */
    this.functionReqs = [{
        'strs': ['MB.writeName','MB.readName'],
        'minVersions': [{
            'dtn': 'T4',
            'fw': 1.0023
        }, {
            'dtn': 'T7',
            'fw': 1.0282
        }],
        'urlPageTitle': 'LabJack Lua Library and find the section "Modbus Name Functions"',
        'urlRef': 'http://labjack.com/support/datasheets/t-series/scripting/labjack-library#name-functions',
    }, {
        'strs': ['I2C.config','I2C.writeRead', 'I2C.read', 'I2C.write', 'I2C.search'],
        'minVersions': [{
            'dtn': 'T4',
            'fw': 1.0000
        }, {
            'dtn': 'T7',
            'fw': 1.0225
        }],
        'urlRef': 'https://labjack.com/support/datasheets/t-series/scripting/I2C-Library',
    }];
    this.checkScriptFWCompatibility = function(device) {
        var dtn = device.savedAttributes.deviceTypeName;
        var fwVer = device.savedAttributes.FIRMWARE_VERSION;
        var source = self.getValue();
        source = JSON.parse(JSON.stringify(source));
        var isError = false;
        var line = -1;
        var errorMessage = '';
        var i = 0;
        self.functionReqs.some(function(functionReq) {
            var strsToCheck = [];
            var reqObj = null;

            functionReq.minVersions.some(function(req) {
                if(req.dtn == dtn && fwVer < req.fw) {
                    strsToCheck = functionReq.strs;
                    reqObj = req;
                    return;
                }
            });

            if(strsToCheck.length > 0) {
                isError = strsToCheck.some(function(strToCheck) {
                    return source.split('\n').some(function(splitLine, i) {
                        var err = splitLine.indexOf(strToCheck) >= 0;
                        if(err) {
                            line = i+1;
                            errorMessage = 'Error: The function "'+strToCheck+'" on line '+line.toString()+' requires firmware version: ' + reqObj.fw.toFixed(4) + ' or greater.\n';

                            if(typeof(functionReq.urlPageTitle) == 'string' && typeof(functionReq.urlPageTitle) == 'string') {
                                errorMessage += 'For more information about this error go to the website page: \n';
                                errorMessage += functionReq.urlPageTitle + ':\n';
                                errorMessage += functionReq.urlRef;
                            }
                            return true;
                        }
                    })
                });
            }
        });
        return {
            isError: isError,
            message: errorMessage
        };
    }

    var self = this;
}


text:
function intent({DOM, id, componentClass}) {
  return {
    validate$: DOM.select(`.${id} .${componentClass}_validateButton`)
      .events(`click`).map(() => true).startWith(false),
  };
}

export default intent;


text:
package org.topcat.store.web.product;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springside.modules.web.Servlets;
import org.topcat.store.entity.Catalog;
import org.topcat.store.entity.Picture;
import org.topcat.store.entity.Product;
import org.topcat.store.service.CatalogService;
import org.topcat.store.service.PictureService;
import org.topcat.store.service.ProductService;

/**
 * @author topcat
 *
 */
@Controller
@RequestMapping(value = "/product")
public class ProductController {

	private CatalogService catalogService;
	private ProductService productService;
	private PictureService pictureService;

	@RequestMapping(value = "/catalog", method = RequestMethod.GET)
	public String listCatalog(
			@RequestParam(value = "page", defaultValue = "1") int pageNumber,
			@RequestParam(value = "page.size", defaultValue = "20") int pageSize,
			@RequestParam(value = "sortType", defaultValue = "auto") String sortType,
			Model model, ServletRequest request) {
		Map<String, Object> searchParams = Servlets.getParametersStartingWith(
				request, "catalog_");
		Page<Catalog> catalogs = catalogService.getAllCatalog(searchParams,
				pageNumber, pageSize, sortType);
		model.addAttribute("catalogs", catalogs);
		model.addAttribute("sortType", sortType);
		// 将搜索条件编码成字符串,用于排序,分页的URL
		model.addAttribute("searchParams", Servlets
				.encodeParameterStringWithPrefix(searchParams, "catalog_"));
		return "product/catalogList";
	}

	@RequestMapping(value = "/catalog/create", method = RequestMethod.GET)
	public String newCatalog() {
		return "product/catalogForm";
	}

	@RequestMapping(value = "/catalog/{id}", method = RequestMethod.GET)
	public String getCatalog(@PathVariable Long id, Model model) {
		Catalog catalog = catalogService.getCatalog(id);
		model.addAttribute("catalog", catalog);
		return "product/catalogForm";
	}

	@RequestMapping(value = "/catalog", method = RequestMethod.POST)
	public String createCatalog(Catalog catalog, Model model) {
		catalogService.save(catalog);
		model.addAttribute("success", true);
		model.addAttribute("message", "保存成功!");
		return "product/catalogForm";
	}

	@RequestMapping(value = "/catalog", method = RequestMethod.PUT)
	public String updateCatalog(Catalog catalog, Model model) {
		Catalog catalog2 = catalogService.getCatalog(catalog.getId());
		catalog2.setName(catalog.getName());
		catalog2.setCode(catalog.getCode());
		model.addAttribute("success", true);
		model.addAttribute("message", "保存成功!");
		return "product/catalogForm";
	}

	@RequestMapping(method = RequestMethod.GET)
	public String listProduct(
			@RequestParam(value = "page", defaultValue = "1") int pageNumber,
			@RequestParam(value = "page.size", defaultValue = "20") int pageSize,
			@RequestParam(value = "sortType", defaultValue = "auto") String sortType,
			Model model, ServletRequest request) {
		Map<String, Object> searchParams = Servlets.getParametersStartingWith(
				request, "product_");
		Page<Product> products = productService.getAllProduct(searchParams,
				pageNumber, pageSize, sortType);
		model.addAttribute("products", products);
		model.addAttribute("sortType", sortType);
		// 将搜索条件编码成字符串,用于排序,分页的URL
		model.addAttribute("searchParams", Servlets
				.encodeParameterStringWithPrefix(searchParams, "product_"));
		return "product/productList";
	}

	@RequestMapping(value = "/create", method = RequestMethod.GET)
	public String newProduct(Model model) {
		model.addAttribute("catalogs", catalogService.getAllCatalog());
		return "product/productForm";
	}

	@RequestMapping(method = RequestMethod.POST)
	public String createProduct(Product product,
			@RequestParam(value = "file", required = false) MultipartFile file,
			Model model, HttpServletRequest request) throws IllegalStateException, IOException {
		if (!file.isEmpty()) {
			String path = request.getSession().getServletContext()
					.getRealPath("static")
					+ "/upload";
			String fileName = file.getOriginalFilename();
			System.out.println(path);
			File targetFile = new File(path, fileName);
			if (!targetFile.exists()) {
				targetFile.mkdirs();
			}

			// 保存
			file.transferTo(targetFile);

			Picture picture = new Picture();
			picture.setPicName(fileName);
			picture.setUrl("static/upload/"+fileName);
			pictureService.save(picture);
			ArrayList<Picture> list = new ArrayList<Picture>();
			list.add(picture);
			product.setPictures(list);
		}
		productService.save(product);
		model.addAttribute("success", true);
		model.addAttribute("message", "保存成功!");
		model.addAttribute("catalogs", catalogService.getAllCatalog());
		return "product/productForm";
	}

	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
	public String getProduct(@PathVariable Long id, Model model) {
		Product product = productService.getProduct(id);
		model.addAttribute("product", product);
		model.addAttribute("catalogs", catalogService.getAllCatalog());
		return "product/productForm";
	}

	@Autowired
	public void setCatalogService(CatalogService catalogService) {
		this.catalogService = catalogService;
	}

	@Autowired
	public void setProductService(ProductService productService) {
		this.productService = productService;
	}

	@Autowired
	public void setPictureService(PictureService pictureService) {
		this.pictureService = pictureService;
	}

}


text:
'use strict';

/**
 * Dispatch a request to the server using whichever adapter
 * is supported by the current environment.
 *
 * @param {object} config The config that is to be used for the request
 * @returns {Promise} The Promise to be fulfilled
 */
module.exports = function dispatchRequest(config) {
  return new Promise(function (resolve, reject) {
    try {
      // For browsers use XHR adapter
      if (typeof window !== 'undefined') {
        require('../adapters/xhr')(resolve, reject, config);
      }
      // For node use HTTP adapter
      else if (typeof process !== 'undefined') {
        require('../adapters/http')(resolve, reject, config);
      }
    } catch (e) {
      reject(e);
    }
  });
};


text:
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
    <title>OnlyFixPartialEventData Property</title>
    <xml>
    </xml>
    <link rel="stylesheet" type="text/css" href="MSDN.css" />

            log4net SDK Documentation - Microsoft .NET Framework 4.0

MemoryAppender.OnlyFixPartialEventData Property

          NOTE: This property is now obsolete.

        Use Fix property

 Gets or sets a value indicating whether only part of the logging event data should be fixed.

        [Visual Basic]

Overridable Public Property OnlyFixPartialEventData As Boolean

        [C#]

public virtual bool OnlyFixPartialEventData {get; set;}

Property Value

            true if the appender should only fix part of the logging event data, otherwise false. The default is false.

Remarks

 Setting this property to true will cause only part of the event data to be fixed and stored in the appender, hereby improving performance.

 See FixVolatileData for more information.

See Also

MemoryAppender Class | log4net.Appender Namespace
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e" viewastext="true" style="display: none;"><param name="Keyword" value="OnlyFixPartialEventData property"></param><param name="Keyword" value="OnlyFixPartialEventData property, MemoryAppender class"></param><param name="Keyword" value="MemoryAppender.OnlyFixPartialEventData property"></param></object>

Copyright 2004-2011 The Apache Software Foundation.


text:
* {
    /* Создать плавающий элемент (по умолчанию none) */
    float: none;
    float: left;
    float: right;

    /* Запретить обтекание элемента плавающими элементами (по умолчанию none) */
    clear: none;
    clear: left;
    clear: right;
    clear: both;

    /* Способ отображения элемента */
    display: block;
    display: inline;
    display: inline-block;
    display: none;

    /* Видимость элемента (по умолчанию visible) */
    visibility: visible;
    visibility: hidden;
}


text:
<?php

if (getenv('CIRCLE_WORKING_DIRECTORY')) {
    putenv('CI_PROJECT_DIR=' . getenv('CIRCLE_WORKING_DIRECTORY'));
}

chdir(getenv('CI_PROJECT_DIR'));

$base_path = __DIR__ . '/../../';

/**
 * Install correct version of laravel.
 * Install db driver dependencies.
 */
if (preg_match(
    '/^php\-(?<php_version>[0-9\.]+)\-(?<webserver>[a-z]+)$/',
    getenv('CIRCLE_JOB'),
    $m
)) {
    putenv("BUILD_WEBSERVER={$m['webserver']}");
    putenv("BUILD_PHP_VERSION={$m['php_version']}");
    $connection = getenv('DB_CONNECTION');

    echo <<<EOM

Found advanced CI configuration from CIRCLE_JOB environment variable:
    - Webserver: {$m['webserver']}
    - PHP: {$m['php_version']}
    - Db driver: {$connection}

EOM;

    foreach ([
            // Marks installation finished
            "$base_path/vendor/laravel/laravel/tenancy.json",
            "$base_path/vendor/laravel/laravel/config/tenancy.php",
            "$base_path/vendor/laravel/laravel/config/webserver.php",
     ] as $file) {
        if (file_exists($file)) {
            echo "Unlinked $file\n";
            @unlink($file);
        }
    }
}


text:
/** @file  AssbinLoader.cpp
 *  @brief Implementation of the .assbin importer class
 *
 *  see assbin_chunks.h
 */

#ifndef ASSIMP_BUILD_NO_ASSBIN_IMPORTER

// internal headers
#include "AssbinLoader.h"
#include "assbin_chunks.h"
#include "MemoryIOWrapper.h"
#include "../include/assimp/mesh.h"
#include "../include/assimp/anim.h"
#include "../include/assimp/scene.h"
#include <boost/static_assert.hpp>

#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
#	include <zlib.h>
#else
#	include "../contrib/zlib/zlib.h"
#endif

using namespace Assimp;

static const aiImporterDesc desc = {
	".assbin Importer",
	"Gargaj / Conspiracy",
	"",
	"",
	aiImporterFlags_SupportBinaryFlavour | aiImporterFlags_SupportCompressedFlavour,
	0,
	0,
	0,
	0,
	"assbin"
};

const aiImporterDesc* AssbinImporter::GetInfo() const
{
	return &desc;
}

bool AssbinImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool /*checkSig*/ ) const
{
	IOStream * in = pIOHandler->Open(pFile);
	if (!in)
		return false;

	char s[32];
	in->Read( s, sizeof(char), 32 );

	pIOHandler->Close(in);

	return strncmp( s, "ASSIMP.binary-dump.", 19 ) == 0;
}

template <typename T>
T Read(IOStream * stream)
{
	T t;
	stream->Read( &t, sizeof(T), 1 );
	return t;
}

template <>
aiVector3D Read<aiVector3D>(IOStream * stream)
{
	aiVector3D v;
	v.x = Read<float>(stream);
	v.y = Read<float>(stream);
	v.z = Read<float>(stream);
	return v;
}

template <>
aiColor4D Read<aiColor4D>(IOStream * stream)
{
	aiColor4D c;
	c.r = Read<float>(stream);
	c.g = Read<float>(stream);
	c.b = Read<float>(stream);
	c.a = Read<float>(stream);
	return c;
}

template <>
aiQuaternion Read<aiQuaternion>(IOStream * stream)
{
	aiQuaternion v;
	v.w = Read<float>(stream);
	v.x = Read<float>(stream);
	v.y = Read<float>(stream);
	v.z = Read<float>(stream);
	return v;
}

template <>
aiString Read<aiString>(IOStream * stream)
{
	aiString s;
	stream->Read(&s.length,4,1);
	stream->Read(s.data,s.length,1);
	s.data[s.length] = 0;
	return s;
}

template <>
aiVertexWeight Read<aiVertexWeight>(IOStream * stream)
{
	aiVertexWeight w;
	w.mVertexId = Read<unsigned int>(stream);
	w.mWeight = Read<float>(stream);
	return w;
}

template <>
aiMatrix4x4 Read<aiMatrix4x4>(IOStream * stream)
{
	aiMatrix4x4 m;
	for (unsigned int i = 0; i < 4;++i) {
		for (unsigned int i2 = 0; i2 < 4;++i2) {
			m[i][i2] = Read<float>(stream);
		}
	}
	return m;
}

template <>
aiVectorKey Read<aiVectorKey>(IOStream * stream)
{
	aiVectorKey v;
	v.mTime = Read<double>(stream);
	v.mValue = Read<aiVector3D>(stream);
	return v;
}

template <>
aiQuatKey Read<aiQuatKey>(IOStream * stream)
{
	aiQuatKey v;
	v.mTime = Read<double>(stream);
	v.mValue = Read<aiQuaternion>(stream);
	return v;
}

template <typename T>
void ReadArray(IOStream * stream, T * out, unsigned int size)
{
	for (unsigned int i=0; i<size; i++) out[i] = Read<T>(stream);
}

template <typename T> void ReadBounds( IOStream * stream, T* /*p*/, unsigned int n )
{
	// not sure what to do here, the data isn't really useful.
	stream->Seek( sizeof(T) * n, aiOrigin_CUR );
}

void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node )
{
	ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AINODE);
	/*uint32_t size =*/ Read<uint32_t>(stream);

	*node = new aiNode();

	(*node)->mName = Read<aiString>(stream);
	(*node)->mTransformation = Read<aiMatrix4x4>(stream);
	(*node)->mNumChildren = Read<unsigned int>(stream);
	(*node)->mNumMeshes = Read<unsigned int>(stream);

	if ((*node)->mNumMeshes)
	{
		(*node)->mMeshes = new unsigned int[(*node)->mNumMeshes];
		for (unsigned int i = 0; i < (*node)->mNumMeshes; ++i) {
			(*node)->mMeshes[i] = Read<unsigned int>(stream);
		}
	}

	if ((*node)->mNumChildren)
	{
		(*node)->mChildren = new aiNode*[(*node)->mNumChildren];
		for (unsigned int i = 0; i < (*node)->mNumChildren; ++i) {
			ReadBinaryNode( stream, &(*node)->mChildren[i] );
		}
	}

}

// -----------------------------------------------------------------------------------
void AssbinImporter::ReadBinaryBone( IOStream * stream, aiBone* b )
{
	ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AIBONE );
	/*uint32_t size =*/ Read<uint32_t>(stream);

	b->mName = Read<aiString>(stream);
	b->mNumWeights = Read<unsigned int>(stream);
	b->mOffsetMatrix = Read<aiMatrix4x4>(stream);

	// for the moment we write dumb min/max values for the bones, too.
	// maybe I'll add a better, hash-like solution later
	if (shortened)
	{
		ReadBounds(stream,b->mWeights,b->mNumWeights);
	} // else write as usual
	else
	{
		b->mWeights = new aiVertexWeight[b->mNumWeights];
		ReadArray<aiVertexWeight>(stream,b->mWeights,b->mNumWeights);
	}
}

void AssbinImporter::ReadBinaryMesh( IOStream * stream, aiMesh* mesh )
{
	ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AIMESH);
	/*uint32_t size =*/ Read<uint32_t>(stream);

	mesh->mPrimitiveTypes = Read<unsigned int>(stream);
	mesh->mNumVertices = Read<unsigned int>(stream);
	mesh->mNumFaces = Read<unsigned int>(stream);
	mesh->mNumBones = Read<unsigned int>(stream);
	mesh->mMaterialIndex = Read<unsigned int>(stream);

	// first of all, write bits for all existent vertex components
	unsigned int c = Read<unsigned int>(stream);

	if (c & ASSBIN_MESH_HAS_POSITIONS)
	{
		if (shortened) {
			ReadBounds(stream,mesh->mVertices,mesh->mNumVertices);
		} // else write as usual
		else
		{
			mesh->mVertices = new aiVector3D[mesh->mNumVertices];
			ReadArray<aiVector3D>(stream,mesh->mVertices,mesh->mNumVertices);
		}
	}
	if (c & ASSBIN_MESH_HAS_NORMALS)
	{
		if (shortened) {
			ReadBounds(stream,mesh->mNormals,mesh->mNumVertices);
		} // else write as usual
		else
		{
			mesh->mNormals = new aiVector3D[mesh->mNumVertices];
			ReadArray<aiVector3D>(stream,mesh->mNormals,mesh->mNumVertices);
		}
	}
	if (c & ASSBIN_MESH_HAS_TANGENTS_AND_BITANGENTS)
	{
		if (shortened) {
			ReadBounds(stream,mesh->mTangents,mesh->mNumVertices);
			ReadBounds(stream,mesh->mBitangents,mesh->mNumVertices);
		} // else write as usual
		else
		{
			mesh->mTangents = new aiVector3D[mesh->mNumVertices];
			ReadArray<aiVector3D>(stream,mesh->mTangents,mesh->mNumVertices);
			mesh->mBitangents = new aiVector3D[mesh->mNumVertices];
			ReadArray<aiVector3D>(stream,mesh->mBitangents,mesh->mNumVertices);
		}
	}
	for (unsigned int n = 0; n < AI_MAX_NUMBER_OF_COLOR_SETS;++n)
	{
		if (!(c & ASSBIN_MESH_HAS_COLOR(n)))
			break;

		if (shortened)
		{
			ReadBounds(stream,mesh->mColors[n],mesh->mNumVertices);
		} // else write as usual
		else
		{
			mesh->mColors[n] = new aiColor4D[mesh->mNumVertices];
			ReadArray<aiColor4D>(stream,mesh->mColors[n],mesh->mNumVertices);
		}
	}
	for (unsigned int n = 0; n < AI_MAX_NUMBER_OF_TEXTURECOORDS;++n)
	{
		if (!(c & ASSBIN_MESH_HAS_TEXCOORD(n)))
			break;

		// write number of UV components
		mesh->mNumUVComponents[n] = Read<unsigned int>(stream);

		if (shortened) {
			ReadBounds(stream,mesh->mTextureCoords[n],mesh->mNumVertices);
		} // else write as usual
		else
		{
			mesh->mTextureCoords[n] = new aiVector3D[mesh->mNumVertices];
			ReadArray<aiVector3D>(stream,mesh->mTextureCoords[n],mesh->mNumVertices);
		}
	}

	// write faces. There are no floating-point calculations involved
	// in these, so we can write a simple hash over the face data
	// to the dump file. We generate a single 32 Bit hash for 512 faces
	// using Assimp's standard hashing function.
	if (shortened) {
		Read<unsigned int>(stream);
	}
	else // else write as usual
	{
		// if there are less than 2^16 vertices, we can simply use 16 bit integers ...
		mesh->mFaces = new aiFace[mesh->mNumFaces];
		for (unsigned int i = 0; i < mesh->mNumFaces;++i) {
			aiFace& f = mesh->mFaces[i];

			BOOST_STATIC_ASSERT(AI_MAX_FACE_INDICES <= 0xffff);
			f.mNumIndices = Read<uint16_t>(stream);
			f.mIndices = new unsigned int[f.mNumIndices];

			for (unsigned int a = 0; a < f.mNumIndices;++a) {
				if (mesh->mNumVertices < (1u<<16))
				{
					f.mIndices[a] = Read<uint16_t>(stream);
				}
				else
				{
					f.mIndices[a] = Read<unsigned int>(stream);
				}
			}
		}
	}

	// write bones
	if (mesh->mNumBones) {
		mesh->mBones = new C_STRUCT aiBone*[mesh->mNumBones];
		for (unsigned int a = 0; a < mesh->mNumBones;++a) {
			mesh->mBones[a] = new aiBone();
			ReadBinaryBone(stream,mesh->mBones[a]);
		}
	}
}

void AssbinImporter::ReadBinaryMaterialProperty(IOStream * stream, aiMaterialProperty* prop)
{
	ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AIMATERIALPROPERTY);
	/*uint32_t size =*/ Read<uint32_t>(stream);

	prop->mKey = Read<aiString>(stream);
	prop->mSemantic = Read<unsigned int>(stream);
	prop->mIndex = Read<unsigned int>(stream);

	prop->mDataLength = Read<unsigned int>(stream);
	prop->mType = (aiPropertyTypeInfo)Read<unsigned int>(stream);
	prop->mData = new char [ prop->mDataLength ];
	stream->Read(prop->mData,1,prop->mDataLength);
}

// -----------------------------------------------------------------------------------
void AssbinImporter::ReadBinaryMaterial(IOStream * stream, aiMaterial* mat)
{
	ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AIMATERIAL);
	/*uint32_t size =*/ Read<uint32_t>(stream);

	mat->mNumAllocated = mat->mNumProperties = Read<unsigned int>(stream);
	if (mat->mNumProperties)
	{
		if (mat->mProperties)
		{
			delete[] mat->mProperties;
		}
		mat->mProperties = new aiMaterialProperty*[mat->mNumProperties];
		for (unsigned int i = 0; i < mat->mNumProperties;++i) {
			mat->mProperties[i] = new aiMaterialProperty();
			ReadBinaryMaterialProperty( stream, mat->mProperties[i]);
		}
	}
}

// -----------------------------------------------------------------------------------
void AssbinImporter::ReadBinaryNodeAnim(IOStream * stream, aiNodeAnim* nd)
{
	ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AINODEANIM);
	/*uint32_t size =*/ Read<uint32_t>(stream);

	nd->mNodeName = Read<aiString>(stream);
	nd->mNumPositionKeys = Read<unsigned int>(stream);
	nd->mNumRotationKeys = Read<unsigned int>(stream);
	nd->mNumScalingKeys = Read<unsigned int>(stream);
	nd->mPreState = (aiAnimBehaviour)Read<unsigned int>(stream);
	nd->mPostState = (aiAnimBehaviour)Read<unsigned int>(stream);

	if (nd->mNumPositionKeys) {
		if (shortened) {
			ReadBounds(stream,nd->mPositionKeys,nd->mNumPositionKeys);

		} // else write as usual
		else {
			nd->mPositionKeys = new aiVectorKey[nd->mNumPositionKeys];
			ReadArray<aiVectorKey>(stream,nd->mPositionKeys,nd->mNumPositionKeys);
		}
	}
	if (nd->mNumRotationKeys) {
		if (shortened) {
			ReadBounds(stream,nd->mRotationKeys,nd->mNumRotationKeys);

		} // else write as usual
		else
		{
			nd->mRotationKeys = new aiQuatKey[nd->mNumRotationKeys];
			ReadArray<aiQuatKey>(stream,nd->mRotationKeys,nd->mNumRotationKeys);
		}
	}
	if (nd->mNumScalingKeys) {
		if (shortened) {
			ReadBounds(stream,nd->mScalingKeys,nd->mNumScalingKeys);

		} // else write as usual
		else
		{
			nd->mScalingKeys = new aiVectorKey[nd->mNumScalingKeys];
			ReadArray<aiVectorKey>(stream,nd->mScalingKeys,nd->mNumScalingKeys);
		}
	}
}

// -----------------------------------------------------------------------------------
void AssbinImporter::ReadBinaryAnim( IOStream * stream, aiAnimation* anim )
{
	ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AIANIMATION);
	/*uint32_t size =*/ Read<uint32_t>(stream);

	anim->mName = Read<aiString> (stream);
	anim->mDuration = Read<double> (stream);
	anim->mTicksPerSecond = Read<double> (stream);
	anim->mNumChannels = Read<unsigned int>(stream);

	if (anim->mNumChannels)
	{
		anim->mChannels = new aiNodeAnim*[ anim->mNumChannels ];
		for (unsigned int a = 0; a < anim->mNumChannels;++a) {
			anim->mChannels[a] = new aiNodeAnim();
			ReadBinaryNodeAnim(stream,anim->mChannels[a]);
		}
	}
}

void AssbinImporter::ReadBinaryTexture(IOStream * stream, aiTexture* tex)
{
	ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AITEXTURE);
	/*uint32_t size =*/ Read<uint32_t>(stream);

	tex->mWidth = Read<unsigned int>(stream);
	tex->mHeight = Read<unsigned int>(stream);
	stream->Read( tex->achFormatHint, sizeof(char), 4 );

	if(!shortened) {
		if (!tex->mHeight) {
			tex->pcData = new aiTexel[ tex->mWidth ];
			stream->Read(tex->pcData,1,tex->mWidth);
		}
		else {
			tex->pcData = new aiTexel[ tex->mWidth*tex->mHeight ];
			stream->Read(tex->pcData,1,tex->mWidth*tex->mHeight*4);
		}
	}

}

// -----------------------------------------------------------------------------------
void AssbinImporter::ReadBinaryLight( IOStream * stream, aiLight* l )
{
	ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AILIGHT);
	/*uint32_t size =*/ Read<uint32_t>(stream);

	l->mName = Read<aiString>(stream);
	l->mType = (aiLightSourceType)Read<unsigned int>(stream);

	if (l->mType != aiLightSource_DIRECTIONAL) {
		l->mAttenuationConstant = Read<float>(stream);
		l->mAttenuationLinear = Read<float>(stream);
		l->mAttenuationQuadratic = Read<float>(stream);
	}

	l->mColorDiffuse = Read<aiColor3D>(stream);
	l->mColorSpecular = Read<aiColor3D>(stream);
	l->mColorAmbient = Read<aiColor3D>(stream);

	if (l->mType == aiLightSource_SPOT) {
		l->mAngleInnerCone = Read<float>(stream);
		l->mAngleOuterCone = Read<float>(stream);
	}

}

// -----------------------------------------------------------------------------------
void AssbinImporter::ReadBinaryCamera( IOStream * stream, aiCamera* cam )
{
	ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AICAMERA);
	/*uint32_t size =*/ Read<uint32_t>(stream);

	cam->mName = Read<aiString>(stream);
	cam->mPosition = Read<aiVector3D>(stream);
	cam->mLookAt = Read<aiVector3D>(stream);
	cam->mUp = Read<aiVector3D>(stream);
	cam->mHorizontalFOV = Read<float>(stream);
	cam->mClipPlaneNear = Read<float>(stream);
	cam->mClipPlaneFar = Read<float>(stream);
	cam->mAspect = Read<float>(stream);
}

void AssbinImporter::ReadBinaryScene( IOStream * stream, aiScene* scene )
{
	ai_assert( Read<uint32_t>(stream) == ASSBIN_CHUNK_AISCENE);
	/*uint32_t size =*/ Read<uint32_t>(stream);

	scene->mFlags         = Read<unsigned int>(stream);
	scene->mNumMeshes     = Read<unsigned int>(stream);
	scene->mNumMaterials  = Read<unsigned int>(stream);
	scene->mNumAnimations = Read<unsigned int>(stream);
	scene->mNumTextures   = Read<unsigned int>(stream);
	scene->mNumLights     = Read<unsigned int>(stream);
	scene->mNumCameras    = Read<unsigned int>(stream);

	// Read node graph
	scene->mRootNode = new aiNode[1];
	ReadBinaryNode( stream, &scene->mRootNode );

	// Read all meshes
	if (scene->mNumMeshes)
	{
		scene->mMeshes = new aiMesh*[scene->mNumMeshes];
		for (unsigned int i = 0; i < scene->mNumMeshes;++i) {
			scene->mMeshes[i] = new aiMesh();
			ReadBinaryMesh( stream,scene->mMeshes[i]);
		}
	}

	// Read materials
	if (scene->mNumMaterials)
	{
		scene->mMaterials = new aiMaterial*[scene->mNumMaterials];
		for (unsigned int i = 0; i< scene->mNumMaterials; ++i) {
			scene->mMaterials[i] = new aiMaterial();
			ReadBinaryMaterial(stream,scene->mMaterials[i]);
		}
	}

	// Read all animations
	if (scene->mNumAnimations)
	{
		scene->mAnimations = new aiAnimation*[scene->mNumAnimations];
		for (unsigned int i = 0; i < scene->mNumAnimations;++i) {
			scene->mAnimations[i] = new aiAnimation();
			ReadBinaryAnim(stream,scene->mAnimations[i]);
		}
	}

	// Read all textures
	if (scene->mNumTextures)
	{
		scene->mTextures = new aiTexture*[scene->mNumTextures];
		for (unsigned int i = 0; i < scene->mNumTextures;++i) {
			scene->mTextures[i] = new aiTexture();
			ReadBinaryTexture(stream,scene->mTextures[i]);
		}
	}

	// Read lights
	if (scene->mNumLights)
	{
		scene->mLights = new aiLight*[scene->mNumLights];
		for (unsigned int i = 0; i < scene->mNumLights;++i) {
			scene->mLights[i] = new aiLight();
			ReadBinaryLight(stream,scene->mLights[i]);
		}
	}

	// Read cameras
	if (scene->mNumCameras)
	{
		scene->mCameras = new aiCamera*[scene->mNumCameras];
		for (unsigned int i = 0; i < scene->mNumCameras;++i) {
			scene->mCameras[i] = new aiCamera();
			ReadBinaryCamera(stream,scene->mCameras[i]);
		}
	}

}

void AssbinImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler )
{
	IOStream * stream = pIOHandler->Open(pFile,"rb");
	if (!stream)
		return;

	stream->Seek( 44, aiOrigin_CUR ); // signature

	/*unsigned int versionMajor =*/ Read<unsigned int>(stream);
	/*unsigned int versionMinor =*/ Read<unsigned int>(stream);
	/*unsigned int versionRevision =*/ Read<unsigned int>(stream);
	/*unsigned int compileFlags =*/ Read<unsigned int>(stream);

	shortened = Read<uint16_t>(stream) > 0;
	compressed = Read<uint16_t>(stream) > 0;

	if (shortened)
		throw DeadlyImportError( "Shortened binaries are not supported!" );

	stream->Seek( 256, aiOrigin_CUR ); // original filename
	stream->Seek( 128, aiOrigin_CUR ); // options
	stream->Seek( 64, aiOrigin_CUR ); // padding

	if (compressed)
	{
		uLongf uncompressedSize = Read<uint32_t>(stream);
		uLongf compressedSize = stream->FileSize() - stream->Tell();

		unsigned char * compressedData = new unsigned char[ compressedSize ];
		stream->Read( compressedData, 1, compressedSize );

		unsigned char * uncompressedData = new unsigned char[ uncompressedSize ];

		uncompress( uncompressedData, &uncompressedSize, compressedData, compressedSize );

		MemoryIOStream io( uncompressedData, uncompressedSize );

		ReadBinaryScene(&io,pScene);

		delete[] uncompressedData;
		delete[] compressedData;
	}
	else
	{
		ReadBinaryScene(stream,pScene);
	}

	pIOHandler->Close(stream);
}

#endif // !! ASSIMP_BUILD_NO_ASSBIN_IMPORTER


text:
/* global describe, it */

const DifficultyFilterToggle = require('src/components/presentational/difficulty-filter-toggle')
const DifficultyFilterToggleList = require('src/components/presentational/difficulty-filter-toggle-list')
const React = require('react')
const assert = require('assert')
const enzyme = require('enzyme')

describe('<DifficultyFilterToggleList />', () => {
  it('renders a `p` element', () => {
    const wrapper = enzyme.shallow(<DifficultyFilterToggleList />)
    assert.ok(wrapper.is('p'))
  })

  it('renders the correct number of filter components', () => {
    const wrapper = enzyme.shallow(<DifficultyFilterToggleList filters={['foo', 'bar']} />)
    assert.equal(wrapper.children().filterWhere(component => component.type() === DifficultyFilterToggle).length, 2)
  })

  it('renders the filter components with the proper React key', () => {
    const wrapper = enzyme.shallow(<DifficultyFilterToggleList filters={['foo bar']} />)
    assert.equal(wrapper.children().filterWhere(component => component.type() === DifficultyFilterToggle).at(0).key(), 'difficultyFilterToggle_FOO_BAR')
  })

  it('renders the filter components with the proper id', () => {
    const wrapper = enzyme.shallow(<DifficultyFilterToggleList filters={['foo bar']} />)
    assert.equal(wrapper.children().filterWhere(component => component.type() === DifficultyFilterToggle).at(0).prop('id'), 'difficultyFilterToggle_FOO_BAR')
  })

  it('renders the filter components with the proper content', () => {
    const wrapper = enzyme.shallow(<DifficultyFilterToggleList filters={['foo']} />)
    assert.equal(wrapper.children().filterWhere(component => component.type() === DifficultyFilterToggle).at(0).childAt(0).text(), 'foo')
  })
})


text:
<?php
/**
 * Created by PhpStorm.
 * User: chiny
 * Date: 2017-01-05
 * Time: 15:34
 */

namespace AppBundle\Exception;

class PurchaseNotFoundException extends RepositoryNotFoundExeption
{

}


text:
import React from 'react';
import FeatureLabel from './FeatureLabel';

export default function FeatureLabels({ dataset, layout, width, height, color = '#fff' }) {
  if (!dataset) {
    return null;
  }

  const children = [];

  const sideLength = layout.sideLength;
  // const margin = layout.margin;
  const columnNames = dataset.columnNames;

  layout.boxes.forEach(box => {
    // only for the L and B rows
    if (box.m === 0) {
      children.push(
        <FeatureLabel
          key={`${box.m}${box.n}l`}
          label={columnNames[box.n]}
          orient="left"
          textColor={color}
          x={box.x}
          y={box.y}
          offset={40}
          width={sideLength}
          height={sideLength}
        />
      );
    }

    if (box.n === 0) {
      children.push(
        <FeatureLabel
          key={`${box.m}${box.n}b`}
          label={columnNames[box.m]}
          orient="bottom"
          textColor={color}
          x={box.x}
          y={box.y}
          offset={20}
          width={sideLength}
          height={sideLength}
        />
      );
    }
  });

  return <g width={width} height={height}>{children}</g>;
}


text:
package com.ibm.watson.developer_cloud.visual_recognition.v1;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

import com.ibm.watson.developer_cloud.http.HttpMediaType;
import com.ibm.watson.developer_cloud.http.InputStreamRequestBody;
import com.ibm.watson.developer_cloud.http.RequestBuilder;
import com.ibm.watson.developer_cloud.service.WatsonService;
import com.ibm.watson.developer_cloud.util.GsonSingleton;
import com.ibm.watson.developer_cloud.util.Validate;
import com.ibm.watson.developer_cloud.visual_recognition.v1.model.LabelSet;
import com.ibm.watson.developer_cloud.visual_recognition.v1.model.VisualRecognitionImages;
import com.squareup.okhttp.MultipartBuilder;

/**
 * The Visual Recognition service analyzes images, enabling you to understand their content without
 * any accompanying descriptive text.
 *
 * @version v1
 * @see
 *      Visual Recognition
 */
public class VisualRecognition extends WatsonService {

  /** The Constant IMG_FILE (value is "imgFile") */
  public static final String IMG_FILE = "imgFile";

  /** The Constant LABELS_TO_CHECK (value is "labels_to_check"). */
  public static final String LABELS_TO_CHECK = "labels_to_check";
  /** The service endpoint. */
  private static final String URL =
      "https://gateway.watsonplatform.net/visual-recognition-beta/api";

  /**
   * Instantiates a new visual recognition.
   */
  public VisualRecognition() {
    super("visual_recognition");
    setEndPoint(URL);
  }

  /**
   * Gets the labels and label groups.
   *
   * @return the labels and label groups
   */
  public LabelSet getLabelSet() {
    return executeRequest(RequestBuilder.get("/v1/tag/labels").build(), LabelSet.class);
  }

  /**
   * Classifies the images against all the label groups and labels. The response includes a score
   * for a label if the score meets the minimum threshold of 0.5. If no score meets the threshold
   * for an image, no labels are returned.
   *
   * @param image the image file
   * @return the visual recognition images
   */
  public VisualRecognitionImages recognize(final File image) {
    return recognize(image, null);
  }

  /**
   * Classifies the images against the label groups and labels. The response includes a score for a
   * label if the score meets the minimum threshold of 0.5. If no score meets the threshold for an
   * image, no labels are returned.
   *
   * @param image the file image
   * @param labelSet the labels to classify against
   * @return the visual recognition images
   */
  public VisualRecognitionImages recognize(final File image, final LabelSet labelSet) {
    Validate.isTrue(image != null && image.exists(), "image cannot be null or not be found");
    InputStream stream = null;
    try {
      stream = new FileInputStream(image);
    } catch (FileNotFoundException e) {
    }
    return recognize(image.getName(), stream, labelSet);
  }

  public VisualRecognitionImages recognize(final String imageName, final InputStream image,
      final LabelSet labelSet) {
    if (image == null)
      throw new IllegalArgumentException("image cannot be null");

    final RequestBuilder requestBuilder = RequestBuilder.post("/v1/tag/recognize");

    final MultipartBuilder bodyBuilder = new MultipartBuilder().type(MultipartBuilder.FORM);
    bodyBuilder.addFormDataPart(IMG_FILE, imageName,
        InputStreamRequestBody.create(HttpMediaType.BINARY_FILE, image));

    if (labelSet != null)
      bodyBuilder.addFormDataPart(LABELS_TO_CHECK,
          GsonSingleton.getGsonWithoutPrettyPrinting().toJson(labelSet));

    requestBuilder.withBody(bodyBuilder.build());

    return executeRequest(requestBuilder.build(), VisualRecognitionImages.class);
  }
}


text:
import {
  AnnotationLayer,
  AnnotationData,
  AnnotationOpacity,
  AnnotationSourceType,
  AnnotationStyle,
  AnnotationType,
  FormulaAnnotationLayer,
  TimeseriesDataRecord,
  DataRecord,
} from '@superset-ui/core';
import {
  evalFormula,
  extractAnnotationLabels,
  formatAnnotationLabel,
  parseAnnotationOpacity,
} from '../../src/utils/annotation';

describe('formatAnnotationLabel', () => {
  it('should handle default cases properly', () => {
    expect(formatAnnotationLabel('name')).toEqual('name');
    expect(formatAnnotationLabel('name', 'title')).toEqual('name - title');
    expect(formatAnnotationLabel('name', 'title', ['description'])).toEqual(
      'name - title\n\ndescription',
    );
  });

  it('should handle missing cases properly', () => {
    expect(formatAnnotationLabel()).toEqual('');
    expect(formatAnnotationLabel(undefined, 'title')).toEqual('title');
    expect(formatAnnotationLabel('name', undefined, ['description'])).toEqual(
      'name\n\ndescription',
    );
    expect(
      formatAnnotationLabel(undefined, undefined, ['description']),
    ).toEqual('description');
  });

  it('should handle multiple descriptions properly', () => {
    expect(
      formatAnnotationLabel('name', 'title', [
        'description 1',
        'description 2',
      ]),
    ).toEqual('name - title\n\ndescription 1\ndescription 2');
    expect(
      formatAnnotationLabel(undefined, undefined, [
        'description 1',
        'description 2',
      ]),
    ).toEqual('description 1\ndescription 2');
  });
});

describe('extractForecastSeriesContext', () => {
  it('should extract the correct series name and type', () => {
    expect(parseAnnotationOpacity(AnnotationOpacity.Low)).toEqual(0.2);
    expect(parseAnnotationOpacity(AnnotationOpacity.Medium)).toEqual(0.5);
    expect(parseAnnotationOpacity(AnnotationOpacity.High)).toEqual(0.8);
    expect(parseAnnotationOpacity(AnnotationOpacity.Undefined)).toEqual(1);
    expect(parseAnnotationOpacity(undefined)).toEqual(1);
  });
});

describe('extractAnnotationLabels', () => {
  it('should extract all annotations that can be added to the legend', () => {
    const layers: AnnotationLayer[] = [
      {
        annotationType: AnnotationType.Formula,
        name: 'My Formula',
        show: true,
        style: AnnotationStyle.Solid,
        value: 'sin(x)',
        showLabel: true,
      },
      {
        annotationType: AnnotationType.Formula,
        name: 'My Hidden Formula',
        show: false,
        style: AnnotationStyle.Solid,
        value: 'sin(2x)',
        showLabel: true,
      },
      {
        annotationType: AnnotationType.Interval,
        name: 'My Interval',
        sourceType: AnnotationSourceType.Table,
        show: true,
        style: AnnotationStyle.Solid,
        value: 1,
        showLabel: true,
      },
      {
        annotationType: AnnotationType.Timeseries,
        name: 'My Line',
        show: true,
        style: AnnotationStyle.Dashed,
        sourceType: AnnotationSourceType.Line,
        value: 1,
        showLabel: true,
      },
      {
        annotationType: AnnotationType.Timeseries,
        name: 'My Hidden Line',
        show: false,
        style: AnnotationStyle.Dashed,
        sourceType: AnnotationSourceType.Line,
        value: 1,
        showLabel: true,
      },
    ];
    const results: AnnotationData = {
      'My Interval': {
        columns: ['col'],
        records: [{ col: 1 }],
      },
      'My Line': [
        { key: 'Line 1', values: [] },
        { key: 'Line 2', values: [] },
      ],
    };

    expect(extractAnnotationLabels(layers, results)).toEqual([
      'My Formula',
      'Line 1',
      'Line 2',
    ]);
  });
});

describe('evalFormula', () => {
  const layer: FormulaAnnotationLayer = {
    annotationType: AnnotationType.Formula,
    name: 'My Formula',
    show: true,
    style: AnnotationStyle.Solid,
    value: 'x+1',
    showLabel: true,
  };
  it('Should evaluate a regular formula', () => {
    const data: TimeseriesDataRecord[] = [
      { __timestamp: 0 },
      { __timestamp: 10 },
    ];

    expect(evalFormula(layer, data, '__timestamp', 'time')).toEqual([
      [0, 1],
      [10, 11],
    ]);
  });

  it('Should evaluate a formula containing redundant characters', () => {
    const data: TimeseriesDataRecord[] = [
      { __timestamp: 0 },
      { __timestamp: 10 },
    ];

    expect(
      evalFormula(
        { ...layer, value: 'y  = x* 2   -1' },
        data,
        '__timestamp',
        'time',
      ),
    ).toEqual([
      [0, -1],
      [10, 19],
    ]);
  });

  it('Should evaluate a formula if axis type is category', () => {
    const data: DataRecord[] = [{ gender: 'boy' }, { gender: 'girl' }];

    expect(
      evalFormula({ ...layer, value: 'y = 1000' }, data, 'gender', 'category'),
    ).toEqual([
      ['boy', 1000],
      ['girl', 1000],
    ]);
  });
});


text:
(function($) {

    $('#input').autocomplete({
        source: function (request, response) {
            jQuery.get("plants/autocomplete", {
                term: request.term
            }, function (data) {

                autocomplete_results(data);

                return response(autocomplete_suggestions(data));
            });
        },
        appendTo: "#autocomplete_list",
        minLength: 2
    })
        .on( "autocompleteselect", function( evt, ui ) {
            jQuery.get("plants/autocomplete", {
                term: ui.item.value
            }, function (data) {
                autocomplete_results(data);
            });
        } )
    .on( "autocompletefocus", function( evt, ui ) {
        jQuery.get("plants/autocomplete", {
            term: ui.item.value
        }, function (data) {
            autocomplete_results(data);
        });
    } )
        .on( "autocompleteclose", function( evt, ui ) {
            jQuery.get("plants/autocomplete", {
                term: $("#input").val()
            }, function (data) {
                autocomplete_results(data);
            });
        } );

    function autocomplete_suggestions(data) {
        return $.map(data.phrases, function (item) {
            return {
                label: item,
                value: item
            };
        });
    }

    function autocomplete_results(data) {
        var $results = $("<ol/>");

        $.map(data.results, function (result) {
            $("<li/>").html(result).appendTo($results);
        });

        $('#results')
            .empty()
            .append($results);

    }
})(jQuery);


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

   <TextView
        android:id="@+id/text1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="txt1" >
    </TextView>
    <TextView
        android:id="@+id/text2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="txt2" >
    </TextView>
	<Button android:layout_width="fill_parent"
    	android:layout_height="wrap_content" android:id="@+id/btn1"
    	android:text="Close App" />
</LinearLayout>


text:
require File.expand_path('../../test_helper', __FILE__)

class UserPreferenceTest < ActiveSupport::TestCase
  fixtures :users, :user_preferences

  def test_create
    user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")
    user.login = "newuser"
    user.password, user.password_confirmation = "password", "password"
    assert user.save

    assert_kind_of UserPreference, user.pref
    assert_kind_of Hash, user.pref.others
    assert user.pref.save
  end

  def test_update
    user = User.find(1)
    assert_equal true, user.pref.hide_mail
    user.pref['preftest'] = 'value'
    assert user.pref.save

    user.reload
    assert_equal 'value', user.pref['preftest']
  end

  def test_others_hash
    user = User.new(:firstname => "new", :lastname => "user", :mail => "newuser@somenet.foo")
    user.login = "newuser"
    user.password, user.password_confirmation = "password", "password"
    assert user.save
    assert_nil user.preference
    up = UserPreference.new(:user => user)
    assert_kind_of Hash, up.others
    up.others = nil
    assert_nil up.others
    assert up.save
    assert_kind_of Hash, up.others
  end

  def test_others_should_be_blank_after_initialization
    pref = User.new.pref
    assert_equal({}, pref.others)
  end

  def test_reading_value_from_nil_others_hash
    up = UserPreference.new(:user => User.new)
    up.others = nil
    assert_nil up.others
    assert_nil up[:foo]
  end

  def test_writing_value_to_nil_others_hash
    up = UserPreference.new(:user => User.new)
    up.others = nil
    assert_nil up.others
    up[:foo] = 'bar'
    assert_equal 'bar', up[:foo]
  end
end


text:
@echo off
cls
"pawncc/builder.py" "./src/" "./Anticheat.inc"
copy "./Anticheat.inc" "./pawncc/include/"
pause


text:
package io.dropwizard.auth;

import java.security.Principal;

/**
 * An {@link Authorizer} that grants access for any principal in any role.
 *
 * @param <P> the type of the principal
 */
public class PermitAllAuthorizer<P extends Principal> implements Authorizer<P> {

    @Override
    public boolean authorize(P principal, String role) {
        return true;
    }
}


text:
package com.nagao.framework.data;

public class NormCodeConst {
	public final static String SUCCESS= "success";
	public final static String FAIL   = "fail";
	public final static String SYSTEM_ERROR ="system.error";
	public final static String SESSION_EXPIRATION ="session.expiration";
	public final static String VERIFY_CODE_ERROR = "verify.code.error";
	public final static String LOGIN_NAME_VERIFY = "user.name.verify";
	public final static String LOGIN_PASSWORD_VERIFY = "user.password.verify";
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>
	<groupId>com.inepex</groupId>
	<artifactId>IneFormShowCaseWithEjbs</artifactId>
	<packaging>war</packaging>
	<properties>
		<gwtVersion>2.3.0</gwtVersion>
		<slf4j.version>1.6.1</slf4j.version>
		<ineformVersion>1.0.16</ineformVersion>
		<inecoreVersion>0.9.4</inecoreVersion>
		<draftCompile>true</draftCompile>
		<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
	</properties>
	<version>${ineformVersion}</version>
	<name>IneFormShowCaseWithEjbs</name>
	<repositories>
		<repository>
			<id>maven.springframework.org.external</id>
 			<url>http://maven.springframework.org/external</url>
 			<name>SpringSource Maven Repository - External Releases</name>
 		</repository>
 		<repository>
			<id>inerepo</id>
 			<url>http://maven.inepex.com/repository/public/</url>
 			<name>inerepo</name>
 		</repository>
	</repositories>
	<dependencies>
		<!-- General dependencies for standard applications -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.8.2</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.inepex</groupId>
			<artifactId>ineform</artifactId>
			<version>${ineformVersion}</version>
		</dependency>
		<dependency>
			<groupId>com.inepex</groupId>
			<artifactId>ineform</artifactId>
			<version>${ineformVersion}</version>
			<type>test-jar</type>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.inepex</groupId>
			<artifactId>ineframe</artifactId>
			<version>${ineformVersion}</version>
			<type>test-jar</type>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.google.gwt</groupId>
			<artifactId>gwt-user</artifactId>
			<version>${gwtVersion}</version>
			<type>jar</type>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>postgresql</groupId>
			<artifactId>postgresql</artifactId>
			<version>8.4-702.jdbc4</version>
			<type>jar</type>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>javax.validation</groupId>
			<artifactId>validation-api</artifactId>
			<version>1.0.0.GA</version>
			<type>jar</type>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>javax.validation</groupId>
			<artifactId>validation-api</artifactId>
			<version>1.0.0.GA</version>
			<type>jar</type>
			<classifier>sources</classifier>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.inepex.core</groupId>
			<artifactId>inemodule</artifactId>
			<version>${inecoreVersion}</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>com.inepex.core</groupId>
			<artifactId>ineframemodule</artifactId>
			<version>${inecoreVersion}</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>com.inepex.core</groupId>
			<artifactId>inecommand</artifactId>
			<version>${inecoreVersion}</version>
			<scope>compile</scope>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>2.1.1</version>
				<!-- <configuration> <webXml>target/web.xml</webXml> </configuration> -->
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.1</version>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>2.2-beta-5</version>
				<configuration>
					<descriptorRefs>
						<descriptorRef>jar-with-dependencies</descriptorRef>
					</descriptorRefs>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-deploy-plugin</artifactId>
				<version>2.5</version>
			</plugin>
			<!-- IDE -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-eclipse-plugin</artifactId>
				<version>2.9</version>
				<!-- Note 2.8 does not work with AspectJ aspect path -->
				<configuration>
					<downloadSources>true</downloadSources>
					<downloadJavadocs>true</downloadJavadocs>
					<wtpversion>2.0</wtpversion>
					<additionalBuildcommands>
						<buildCommand>
							<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
						</buildCommand>
					</additionalBuildcommands>
					<additionalProjectnatures>
						<projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
					</additionalProjectnatures>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>gwt-maven-plugin</artifactId>
				<version>${gwtVersion}</version>
				<configuration>
					<logLevel>INFO</logLevel>
					<style>PRETTY</style>
					<draftCompile>${draftCompile}</draftCompile>
					<runTarget>/IneFormShowcaseWithEjbs.html</runTarget>
					<hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
					<modules>
<!-- 					keep the letter C in lowercase!!!!!!!! -->
						<module>${project.groupId}.example.ineForm.IneFormShowcaseWithEjbs</module>
					</modules>
					<copyWebapp>true</copyWebapp>
				</configuration>
				<executions>
					<execution>
						<id>gwtcompile</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>compile</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
		<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
	</build>
</project>


text:
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace ICSharpCode.WpfDesign.Designer.Controls
{
	/// <summary>
	/// A ComboBox wich is Nullable
	/// </summary>
	public class NullableComboBox : ComboBox
	{
		static NullableComboBox()
		{
			DefaultStyleKeyProperty.OverrideMetadata(typeof(NullableComboBox), new FrameworkPropertyMetadata(typeof(NullableComboBox)));
		}

		public override void OnApplyTemplate()
		{
			base.OnApplyTemplate();

			var btn = GetTemplateChild("PART_ClearButton") as Button;

			btn.Click += btn_Click;
		}

		void btn_Click(object sender, RoutedEventArgs e)
		{
			var clearButton = (Button)sender;
			var parent = VisualTreeHelper.GetParent(clearButton);

			while (!(parent is ComboBox))
			{
				parent = VisualTreeHelper.GetParent(parent);
			}

			var comboBox = (ComboBox)parent;
			comboBox.SelectedIndex = -1;
		}

		public bool IsNullable
		{
			get { return (bool)GetValue(IsNullableProperty); }
			set { SetValue(IsNullableProperty, value); }
		}

		public static readonly DependencyProperty IsNullableProperty =
			DependencyProperty.Register("IsNullable", typeof(bool), typeof(NullableComboBox), new PropertyMetadata(true));
	}
}


text:
PORTNAME=	totd
PORTVERSION=	1.1p4
CATEGORIES=	net
MASTER_SITES=	ftp://ftp.pasta.cs.uit.no/pub/Vermicelli/

MAINTAINER=	feico@pasta.cs.uit.no
HOMEPAGE=	http://www.vermicelli.cs.uit.no/ipv6/software.html

WRKSRC=         ${WRKDIR}/totd-1.1p4

GNU_CONFIGURE=	YES

post-install:
	${INSTALL_SCRIPT} ${FILESDIR}/totd.conf.sample ${PREFIX}/etc/totd.conf.sample

.include <bsd.port.mk>


text:
'''
env - wszystkie zmienne tego środowiska
funcs - funkcje
evaluate(a)

main to pozadefinicyjna, pozafunkcyjna aprzestrzeń
skanuj po funkcje, utwó©z maina, uruchom...
'''


text:
module ElmerFudd
  class Worker
    Message = Struct.new(:delivery_info, :properties, :payload, :route)
    Env = Struct.new(:channel, :logger, :worker_class)
    Route = Struct.new(:exchange_name, :routing_keys, :queue_name)

    class << self
      attr_writer :durable_queues
      def durable_queues; @durable_queues.nil? ? true : @durable_queues; end

      # When set to true, every handler will receive a separate channel
      attr_writer :single_channel
      def single_channel; @single_channel.nil? ? true : @single_channel; end
    end

    def self.handlers
      @handlers ||= []
    end

    def self.Route(queue_name, exchange_and_routing_keys = {"" => queue_name})
      exchange, routing_keys = exchange_and_routing_keys.first
      Route.new(exchange, routing_keys, queue_name)
    end

    def self.default_filters(*filters)
      @filters = filters
    end

    def self.handle_event(route, filters: [], handler: nil, &block)
      handlers << TopicHandler.new(route, handler || block, (@filters + filters + [DiscardReturnValueFilter]).uniq,
                                   durable: durable_queues)
    end

    def self.handle_cast(route, filters: [], handler: nil, &block)
      handlers << DirectHandler.new(route, handler || block, (@filters + filters + [DiscardReturnValueFilter]).uniq,
                                    durable: durable_queues)
    end

    def self.handle_call(route, filters: [], handler: nil, &block)
      handlers << RpcHandler.new(route, handler || block, (@filters + filters).uniq,
                                 durable: false)
    end

    # Helper allowing to use any method taking hash as a handler
    # def example(text:, **_)
    #  puts text
    # end
    # # then in worker
    # handle_cast(...
    #             handler: payload_as_kwargs(method(:example)))
    # Thanks to usage of **_ in arguments list it will accept
    # any payload contaning 'text' key. Skipping **_ will require
    # listing all payload keys in argument list
    def self.payload_as_kwargs(handler, only: nil)
      lambda do |_env, message|
        symbolized_payload = message.payload.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
        symbolized_payload = symbolized_payload.select { |k,v| Array(only).include?(k) } if only
        handler.call(symbolized_payload)
      end
    end

    def initialize(connection, concurrency: 1, logger: Logger.new($stdout))
      @connection = connection
      @concurrency = concurrency
      @logger = logger
    end

    def start
      self.class.handlers.each do |handler|
        subscribe_handler(handler)
      end
    end

    private

    def subscribe_handler(handler)
      handler.queue(env).subscribe(manual_ack: true, block: false,
                                   on_cancellation: ->(*) { on_consumer_cancellation(handler) }
                                  ) do |delivery_info, properties, payload|
        message = Message.new(delivery_info, properties, payload, handler.route)
        begin
          handler.call(env, message)
          env.channel.acknowledge(message.delivery_info.delivery_tag)
        rescue Exception => e
          env.logger.fatal("Worker blocked: %s, %s:" % [e.class, e.message])
          e.backtrace.each { |l| env.logger.fatal(l) }
        end
      end
    end

    def on_consumer_cancellation(handler)
      unless self.class.durable_queues
        handler.ensure_that_queue_exists(env)
      end
    end

    def env
      self.class.single_channel ? @env ||= new_env : new_env
    end

    def new_env
      Env.new(new_channel, @logger, self.class)
    end

    def connection
      @connection.tap { |c| c.start unless c.connected? }
    end

    def new_channel
      connection.create_channel.tap do |channel|
        channel.recover_cancelled_consumers!
        channel.tap do |c|
          c.prefetch(@concurrency)
        end
      end
    end
  end
end


text:
package ec.org.alone.services;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.criteria.CriteriaQuery;

public abstract class Generic<T> {

	@PersistenceContext
	protected EntityManager em;

	private Class<T> tipoBean;

	@SuppressWarnings("unused")
	private Class<?> tipoServicio;

	// CONSTRUCTOR
	public Generic(Class<T> tipoBean, Class<?> tipoServicio) {
		this.tipoBean = tipoBean;
		this.tipoServicio = tipoServicio;
	}

	// METODOS
	public void insertar(T entidad) {
		em.persist(entidad);
	}

	public void actualizar(T entidad) {
		em.merge(entidad);
	}

	public void eliminar(T entidad) {
		em.remove(em.merge(entidad));
	}

	public void eliminar2(T entidad) {
		em.remove(entidad);
	}

	public T buscarPorId(Integer id) {
		return em.find(tipoBean, id);
	}

	public T buscarPorName(String id) {
		return em.find(tipoBean, id);
	}

	public T buscarPorId(Short id) {
		return em.find(tipoBean, id);
	}

	public void flushBase() {
		em.flush();
	}

	@SuppressWarnings({ "unchecked", "rawtypes" })
	public List<T> buscarTodos() {
		CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
		cq.select(cq.from(tipoBean));
		return em.createQuery(cq).getResultList();
	}

}


text:
<md-sidenav class="md-sidenav-left md-whiteframe-z2" md-component-id="left">
    <md-toolbar class="md-tall md-theme-indigo">

DWG Task Teams and Projects

    </md-toolbar>
    <md-content>

                <md-button ng-href="{{team.url}}">{{team.name}}</md-button>

    </md-content>

</md-sidenav>
<md-sidenav class="md-sidenav-right md-whiteframe-z2" md-component-id="right">
    <md-toolbar class="md-tall md-theme-indigo">

Get Involved

    </md-toolbar>
    <md-content>

if you would like to know more about the Data Working Group and Task Teams please email Stephen Keenan or David Lloyd
            or visit our GitHub site where you can follow the development of our APIs and follow our discussion"

                <md-button ng-href="{{get.url}}">

                    {{get.name}}</md-button>

    </md-content>
</md-sidenav>


text:
  Feliceto est
       un village
       localisé dans le département de Haute-Corse en Corse. On dénombrait 203 habitants en 2008.

Le nombre d'habitations, à Feliceto, se décomposait en 2011 en 44 appartements et 168 maisons soit
 un marché relativement équilibré.

Si vous pensez venir habiter à Feliceto, vous pourrez facilement trouver une maison à vendre.

À proximité de Feliceto sont positionnées géographiquement les villes de
Zilia à 3 km, 221 habitants,
Cateri à 4 km, 211 habitants,
Ville-di-Paraso localisée à 4 km, 174 habitants,
Aregno localisée à 5 km, 593 habitants,
Lavatoggio située à 5 km, 132 habitants,
Nessa localisée à 1 km, 102 habitants,
 entre autres. De plus, Feliceto est située à seulement quatorze km de Calvi.


text:
class Surface
{
public:
    Surface(/*what?*/);

    void setFont(RenderingFontInstance *font);

    void drawGlyphs(RenderingFontInstance *font, const LEGlyphID *glyphs, le_int32 count, const le_int32 *dx,
        le_int32 x, le_int32 y, le_int32 width, le_int32 height);
};


text:
package de.fluchtwege.movielist.viewmodel;

import android.databinding.ObservableField;
import android.databinding.ObservableInt;
import android.support.annotation.MenuRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.annotation.VisibleForTesting;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.OnScrollListener;
import android.support.v7.widget.Toolbar;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import de.fluchtwege.movielist.R;
import de.fluchtwege.movielist.model.Movie;
import de.fluchtwege.movielist.model.MovieQuery;
import de.fluchtwege.movielist.net.RequestsAPI;
import de.fluchtwege.movielist.ui.MovieAdapter;
import rx.Scheduler;
import rx.Subscriber;
import rx.subjects.BehaviorSubject;
import timber.log.Timber;

//All problems can be solved by another layer of indirection - david wheeler
//"...except for the problem of too many layers of indirection." - kevlin henney

public class MovieListViewModel {

	private static final int FIRST_PAGE = 0;

	@MenuRes public int menu = R.menu.menu_list;
	@StringRes public ObservableInt title = new ObservableInt(R.string.title_list);

	@NonNull public ObservableInt searchBarVisibility = new ObservableInt(EditText.GONE);
	@NonNull public ObservableField<RecyclerView.OnScrollListener> scrollListener = new ObservableField<>();
	@NonNull public ObservableField<Toolbar.OnMenuItemClickListener> menuItemClickListener = new ObservableField<>();
	@NonNull public ObservableField<OnEditorActionListener> editorAction = new ObservableField<>();
	@NonNull public ObservableField<TextWatcher> textWatcher = new ObservableField<>();

	@Nullable private BehaviorSubject<String> queryChangedSubject;
	@Nullable private RequestsAPI requestsAPI;
	@Nullable private Scheduler schedulerIO;
	@Nullable private Scheduler schedulerMain;
	@Nullable private String query;
	@Nullable public LinearLayoutManager manager;
	@Nullable public ObservableField<MovieAdapter> adapter = new ObservableField<>(new MovieAdapter());

	private int pagesLoaded = FIRST_PAGE;
	private boolean isLoadingMovies = false;

	public void setUpViewModel(LinearLayoutManager manager, @NonNull final Scheduler schedulerIO, @NonNull final Scheduler schedulerMain) {
		this.manager = manager;
		this.schedulerIO = schedulerIO;
		this.schedulerMain = schedulerMain;
		requestsAPI = new RequestsAPI();
		setUpUILogic();
		clearAndShowPopularMovies();
	}

	@VisibleForTesting
	public void setUpUILogic() {
		editorAction.set(new OnEditorActionListener() {

			@Override
			public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
				if (actionId == EditorInfo.IME_ACTION_DONE) {
					v.setText(new String());
					searchBarVisibility.set(EditText.GONE);
				}
				return false;
			}
		});

		menuItemClickListener.set(new Toolbar.OnMenuItemClickListener() {

			@Override
			public boolean onMenuItemClick(MenuItem item) {
				if (item.getItemId() == R.id.action_search) {
					registerQueryChangedSubject();
					searchBarVisibility.set(EditText.VISIBLE);
				}
				return false;
			}
		});

		scrollListener.set(new OnScrollListener() {

			@Override
			public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
				if (dy > 0) {
					if (!isLoadingMovies && hasReachedBottomOfList()) {
						Timber.d("onScroll Last Item -> getPopularMovies()");
						if (query != null) {
							query(query);
						} else {
							getPopularMovies();
						}

					}
				}
			}
		});

		textWatcher.set(new TextWatcher() {

			@Override
			public void beforeTextChanged(CharSequence s, int start, int count, int after) {
			}

			@Override
			public void onTextChanged(final CharSequence s, int start, int before, int count) {
				queryChangedSubject.onNext(s.toString().trim());
			}

			@Override
			public void afterTextChanged(Editable s) {
			}

		});

	}

	public void tearDownViewModel() {
		unregisterTextChangeSubject();
		manager = null;
		query = null;
		requestsAPI = null;
		adapter = null;
		schedulerIO = null;
		schedulerMain = null;
	}

	@VisibleForTesting
	public void clearAndShowPopularMovies() {
		unregisterTextChangeSubject();
		title.set(R.string.title_list);
		searchBarVisibility.set(EditText.GONE);
		pagesLoaded = FIRST_PAGE;
		adapter.get().clear();
		adapter.get().notifyDataChanges();
		query = null;
		getPopularMovies();
	}

	@VisibleForTesting
	public void getPopularMovies() {
		isLoadingMovies = true;
		requestsAPI.getPopularMovies(pagesLoaded)
				.subscribeOn(schedulerIO)
				.observeOn(schedulerMain)
				.subscribe(new Subscriber<List<Movie>>() {
					@Override
					public void onCompleted() {
					}

					@Override
					public void onError(Throwable e) {
						Timber.e("There was a problem loading the movies" + e);
						isLoadingMovies = false;
					}

					@Override
					public void onNext(List<Movie> movies) {
						onMoviesLoaded(movies);
					}
				});
	}

	@VisibleForTesting
	public void query(@NonNull final String query) {
		this.query = query;
		isLoadingMovies = true;
		requestsAPI.queryMovies(query, pagesLoaded)
				.subscribeOn(schedulerIO)
				.observeOn(schedulerMain)
				.debounce(1000, TimeUnit.MILLISECONDS)
				.subscribe(new Subscriber<List<MovieQuery>>() {
					@Override
					public void onCompleted() {
					}

					@Override
					public void onError(Throwable e) {
						Timber.e("There was a problem loading the movies" + e);
						isLoadingMovies = false;
					}

					@Override
					public void onNext(List<MovieQuery> movieQueries) {
						onMoviesLoaded(filterMoviesFromSearchResults(movieQueries));
					}
				});
	}

	private List<Movie> filterMoviesFromSearchResults(List<MovieQuery> movieQueries) {
		List<Movie> result = new ArrayList<>();
		for (MovieQuery movieQuery : movieQueries) {
			result.add(movieQuery.movie);
		}
		return result;
	}

	@VisibleForTesting
	public void onMoviesLoaded(final List<Movie> movies) {
		isLoadingMovies = false;
		pagesLoaded++;
		adapter.get().addMovies(movies);
		adapter.get().notifyDataChanges();
	}

	private void unregisterTextChangeSubject() {
		if (queryChangedSubject != null) {
			queryChangedSubject.unsubscribeOn(schedulerMain);
			queryChangedSubject = null;
		}
	}

	@VisibleForTesting
	public void registerQueryChangedSubject() {
		queryChangedSubject = BehaviorSubject.create();
		queryChangedSubject
				.subscribeOn(schedulerIO)
				.observeOn(schedulerMain)
				.debounce(500, TimeUnit.MILLISECONDS)
				.subscribe(new Subscriber<String>() {
					@Override
					public void onCompleted() {
						Timber.d("queryChangedSubject onCompleted");
					}

					@Override
					public void onError(Throwable e) {
						Timber.e(e, "queryChangedSubject onError " + e.getMessage());
					}

					@Override
					public void onNext(String query) {
						Timber.d("queryChangedSubject onNext : " + query);
						if (query != null && query.length() > 0) {
							adapter.get().clear();
							query(query);
						}
					}
				});
	}

	@VisibleForTesting
	public boolean hasReachedBottomOfList() {
		if (manager != null) {
			final int visibleItemCount = manager.getChildCount();
			final int totalItemCount = manager.getItemCount();
			final int pastVisiblesItems = manager.findFirstVisibleItemPosition();

			return (visibleItemCount + pastVisiblesItems) >= totalItemCount;
		}
		return false;
	}

	public boolean onBackPressed() {
		if (query != null || searchBarVisibility.get() == EditText.VISIBLE) {
			clearAndShowPopularMovies();
			return true;
		}
		return false;
	}
}


text:
@implementation TYDP_NewVendorModel
+(BOOL)propertyIsOptional:(NSString *)propertyName {
    return YES;
}
@end


text:
<?php

class TestPluginComponentComponent extends Object {
	var $components = array('TestPlugin.TestPluginOtherComponent');
}


text:
$(function() {
  // $(document).foundation();

  var $sidebar = $('#sidebar');
  if ($sidebar.length) {
    var $docs = $('#docs');
    var $nav = $sidebar.find('nav');

    //
    // Setup sidebar navigation
    var traverse = new Traverse($nav, {
      threshold: 10,
      barOffset: $sidebar.position().top
    });

    $nav.on('update.traverse', function(event, element) {
      $nav.find('section').removeClass('expand');
      var $section = element.parents('section:first');
      if ($section.length) {
        $section.addClass('expand');
      }
    });

    //
    // Bind the drawer layout
    var $drawerLayout = $('.drawer-layout'),
      $drawer = $drawerLayout.find('.drawer'),
      closeDrawer = function() {
        $drawer.removeClass('slide-right slide-left');
        $drawer.find('.drawer-overlay').remove();
        $drawerLayout.removeClass('drawer-open drawer-slide-left-large drawer-slide-right-large');
        return false;
      };

    // Drawer open buttons
    $drawerLayout.find('[data-drawer-slide]').click(function(e) {
      var $this = $(this),
        direction = $this.data('drawer-slide');
      $drawerLayout.addClass('drawer-open');
      $drawer.addClass('slide-' + direction);

      var $overlay = $('')
      $drawer.append($overlay);
      $overlay.click(closeDrawer);

      return false;
    });

    // Drawer close buttons
    $drawerLayout.find('[data-drawer-close]').click(closeDrawer);
  }
});

/**
 * Creates a new instance of Traverse.
 * @class
 * @fires Traverse#init
 * @param {Object} element - jQuery object to add the trigger to.
 * @param {Object} options - Overrides to the default plugin settings.
 */
function Traverse(element, options) {
  this.$element = element;
  this.options  = $.extend({}, Traverse.defaults, this.$element.data(), options);

  this._init();
}

/**
 * Default settings for plugin
 */
Traverse.defaults = {
  /**
   * Amount of time, in ms, the animated scrolling should take between locations.
   * @option
   * @example 500
   */
  animationDuration: 500,
  /**
   * Animation style to use when scrolling between locations.
   * @option
   * @example 'ease-in-out'
   */
  animationEasing: 'linear',
  /**
   * Number of pixels to use as a marker for location changes.
   * @option
   * @example 50
   */
  threshold: 50,
  /**
   * Class applied to the active locations link on the traverse container.
   * @option
   * @example 'active'
   */
  activeClass: 'active',
  /**
   * Allows the script to manipulate the url of the current page, and if supported, alter the history.
   * @option
   * @example true
   */
  deepLinking: false,
  /**
   * Number of pixels to offset the scroll of the page on item click if using a sticky nav bar.
   * @option
   * @example 25
   */
  barOffset: 0
};

/**
 * Initializes the Traverse plugin and calls functions to get equalizer functioning on load.
 * @private
 */
Traverse.prototype._init = function() {
  var id = this.$element[0].id, // || Foundation.GetYoDigits(6, 'traverse'),
      _this = this;
  this.$targets = $('[data-traverse-target]');
  this.$links = this.$element.find('a');
  this.$element.attr({
    'data-resize': id,
    'data-scroll': id,
    'id': id
  });
  this.$active = $();
  this.scrollPos = parseInt(window.pageYOffset, 10);

  this._events();
};

/**
 * Calculates an array of pixel values that are the demarcation lines between locations on the page.
 * Can be invoked if new elements are added or the size of a location changes.
 * @function
 */
Traverse.prototype.calcPoints = function(){
  var _this = this,
      body = document.body,
      html = document.documentElement;

  this.points = [];
  this.winHeight = Math.round(Math.max(window.innerHeight, html.clientHeight));
  this.docHeight = Math.round(Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight));

  this.$targets.each(function(){
    var $tar = $(this),
        pt = $tar.offset().top; // Math.round($tar.offset().top - _this.options.threshold);
    $tar.targetPoint = pt;
    _this.points.push(pt);
  });
};

/**
 * Initializes events for Traverse.
 * @private
 */
Traverse.prototype._events = function() {
  var _this = this,
      $body = $('html, body'),
      opts = {
        duration: _this.options.animationDuration,
        easing:   _this.options.animationEasing
      };

  $(window).one('load', function(){
    _this.calcPoints();
    _this._updateActive();

    $(this).resize(function(e) {
      _this.reflow();
    }).scroll(function(e) {
      _this._updateActive();
    });
  })

  this.$element.on('click', 'a[href^="#"]', function(e) { //'click.zf.traverse'
      e.preventDefault();
      var arrival   = this.getAttribute('href').replace(".", "\\."),
          scrollPos = $(arrival).offset().top - _this.options.barOffset; // - _this.options.threshold / 2 - _this.options.barOffset;

      $body.stop(true).animate({
        scrollTop: scrollPos
      }, opts);
    });
};

/**
 * Calls necessary functions to update Traverse upon DOM change
 * @function
 */
Traverse.prototype.reflow = function(){
  this.calcPoints();
  this._updateActive();
};

/**
 * Updates the visibility of an active location link,
 * and updates the url hash for the page, if deepLinking enabled.
 * @private
 * @function
 * @fires Traverse#update
 */
 Traverse.prototype._updateActive = function(){
   var winPos = parseInt(window.pageYOffset, 10),
       curIdx;

   if(winPos + this.winHeight === this.docHeight){ curIdx = this.points.length - 1; }
   else if(winPos < this.points[0]){ curIdx = 0; }
   else{
     var isDown = this.scrollPos < winPos,
         _this = this,
         curVisible = this.points.filter(function(p, i){
           return isDown ?
             p <= (winPos + _this.options.barOffset + _this.options.threshold) :
             (p - (_this.options.barOffset + _this.options.threshold)) <= winPos;
            //   p <= (winPos - (offset - _this.options.threshold)) :
            //   (p - (-offset + _this.options.threshold)) <= winPos;
         });
     curIdx = curVisible.length ? curVisible.length - 1 : 0;
   }

   var $prev = this.$active;
   var $next = this.$links.eq(curIdx);
   this.$active.removeClass(this.options.activeClass);
   this.$active = $next.addClass(this.options.activeClass);

   if(this.options.deepLinking){
     var hash = this.$active[0].getAttribute('href');
     if(window.history.pushState){
       window.history.pushState(null, null, hash);
     }else{
       window.location.hash = hash;
     }
   }

   this.scrollPos = winPos;

   // Fire event if the active element was changed
   var changed = $prev[0] !== $next[0];
   if (changed) {
     this.$element.trigger('update.traverse', [this.$active]);
   }
 };


text:
:- expects_dialect(lps).

maxTime(10).

fluents leon_atrapado, liberar_leon, salvar_leon.

actions precavido, utilizar_dientes, correr.

events liberar, cortar_amarre,
       escapar_trampa.

initially leon_atrapado.
if leon_atrapado at T1
   then liberar from T1 to T2.
liberar from T1 to T2 if
      precavido from T1 to T2.
liberar terminates leon_atrapado.

liberar initiates liberar_leon.
if liberar_leon at T3
   then cortar_amarre from T3 to T4.
cortar_amarre from T3 to T4 if
      utilizar_dientes from T3 to T4.
cortar_amarre terminates liberar_leon.

cortar_amarre initiates salvar_leon.
if salvar_leon at T5
   then escapar_trampa from T5 to T6.
escapar_trampa from T5 to T6 if
      correr from T5 to T6.
escapar_trampa terminates salvar_leon.


text:
import sys
from groundcontrol import cli

def test_cli_server(mock_dynamo, mocker):
    sys.argv[1:] = ['server', '--debug']
    mocker.patch('sys.exit')
    mock = mocker.patch("groundcontrol.cli.app")
    cli.cli()
    assert mock.run.call_count == 1


text:
namespace content {

#if !defined(OS_IOS)
// A stubbed out WebKit platform support impl.
class UnitTestTestSuite::UnitTestWebKitPlatformSupport
    : public WebKit::WebKitPlatformSupport {
 public:
  UnitTestWebKitPlatformSupport() {}
  virtual ~UnitTestWebKitPlatformSupport() {}
  virtual void cryptographicallyRandomValues(unsigned char* buffer,
                                             size_t length) OVERRIDE {
    base::RandBytes(buffer, length);
  }
  virtual const unsigned char* getTraceCategoryEnabledFlag(
      const char* categoryName) {
    // Causes tracing macros to be disabled.
    static const unsigned char kEnabled = 0;
    return &kEnabled;
  }

  virtual WebKit::WebCompositorSupport* compositorSupport() {
    return &compositor_support_;
  }

 private:
  webkit::WebCompositorSupportImpl compositor_support_;
};
#endif  // !OS_IOS

UnitTestTestSuite::UnitTestTestSuite(base::TestSuite* test_suite)
    : test_suite_(test_suite) {
  DCHECK(test_suite);
#if !defined(OS_IOS)
  webkit_platform_support_.reset(new UnitTestWebKitPlatformSupport);
  WebKit::initialize(webkit_platform_support_.get());
#endif
}

UnitTestTestSuite::~UnitTestTestSuite() {
#if !defined(OS_IOS)
  WebKit::shutdown();
#endif
}

int UnitTestTestSuite::Run() {
  return test_suite_->Run();
}

}  // namespace content