text:
<?php

/* CriveroPruebaBundle:Usuarios:perfil.html.twig */
class __TwigTemplate_3f935735e9bd369e3170933ac654f6889f65889fa1765ca1bfef8d1124fc473e extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        // line 1
        $this->parent = $this->loadTemplate("CriveroPruebaBundle::main.html.twig", "CriveroPruebaBundle:Usuarios:perfil.html.twig", 1);
        $this->blocks = array(
            'title' => array($this, 'block_title'),
            'contenido' => array($this, 'block_contenido'),
        );
    }

    protected function doGetParent(array $context)
    {
        return "CriveroPruebaBundle::main.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }

    // line 3
    public function block_title($context, array $blocks = array())
    {
        echo " Perfil ";
    }

    // line 4
    public function block_contenido($context, array $blocks = array())
    {
        // line 5
        echo "    ";
        echo twig_include($this->env, $context, "CriveroPruebaBundle:Default:messages/success2.html.twig");
        echo "

                            env, $this->env->getExtension('Symfony\Bundle\TwigBundle\Extension\AssetsExtension')->getAssetUrl(("images/" . $this->getAttribute((isset($context["usuario"]) ? $context["usuario"] : $this->getContext($context, "usuario")), "imagen", array()))), "html", null, true);
        echo "\" class=\"img-circle\" style=\"width:60px;\" />

Perfil

                            env, $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getPath("crivero_prueba_editarUsuario", array("id" => $this->getAttribute((isset($context["usuario"]) ? $context["usuario"] : $this->getContext($context, "usuario")), "id", array()))), "html", null, true);
        echo "\" class=\"btn btn-default active\">Editar

Nombre

";
        // line 28
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["usuario"]) ? $context["usuario"] : $this->getContext($context, "usuario")), "nombre", array()), "html", null, true);
        echo "

Fecha nacimiento

";
        // line 29
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["usuario"]) ? $context["usuario"] : $this->getContext($context, "usuario")), "fNacimiento", array()), "html", null, true);
        echo "

E-mail

";
        // line 30
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["usuario"]) ? $context["usuario"] : $this->getContext($context, "usuario")), "email", array()), "html", null, true);
        echo "

Teléfono

";
        // line 31
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["usuario"]) ? $context["usuario"] : $this->getContext($context, "usuario")), "telefono", array()), "html", null, true);
        echo "

Rol

";
        // line 32
        echo twig_escape_filter($this->env, twig_capitalize_string_filter($this->env, (isset($context["rol"]) ? $context["rol"] : $this->getContext($context, "rol"))), "html", null, true);
        echo "

Nombre de usuario

";
        // line 35
        echo twig_escape_filter($this->env, $this->getAttribute((isset($context["usuario"]) ? $context["usuario"] : $this->getContext($context, "usuario")), "username", array()), "html", null, true);
        echo "

Registro

";
        // line 36
        echo twig_escape_filter($this->env, twig_date_format_filter($this->env, $this->getAttribute((isset($context["usuario"]) ? $context["usuario"] : $this->getContext($context, "usuario")), "registro", array()), "d/m/Y"), "html", null, true);
        echo "

                            ";
        // line 37
        if (($this->getAttribute((isset($context["usuario"]) ? $context["usuario"] : $this->getContext($context, "usuario")), "tipo", array()) == 1)) {
            // line 38
            echo "

                                    <form class=\"btn-group-vertical\" action=\"";
            // line 40
            echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getPath("crivero_prueba_mensajearDirector");
            echo "\" method=\"post\">
                                        <button type=\"submit\" style=\"margin-bottom: 0\" class=\"btn btn-primary\">Mensaje a director</button>
                                        <input type=\"hidden\" class=\"btn\">
                                    </form>
                                    <form class=\"btn-group-vertical\" action=\"";
            // line 44
            echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getPath("crivero_prueba_nuevo");
            echo "\" method=\"post\">
                                        <input type=\"hidden\" class=\"btn\">
                                        <button type=\"submit\" style=\"margin-bottom: 0\" class=\"btn btn-info\">Publicar evento</button>
                                        <input type=\"hidden\" class=\"btn\">
                                    </form>
                                    <form class=\"btn-group-vertical\" action=\"";
            // line 49
            echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getPath("crivero_prueba_nuevo");
            echo "\" method=\"post\">
                                        <input type=\"hidden\" class=\"btn\">
                                        <button type=\"submit\" style=\"margin-bottom: 0\" class=\"btn btn-warning\">Cambiar horario</button>
                                        <input type=\"hidden\" class=\"btn\">
                                    </form>
                                    <form class=\"btn-group-vertical\" action=\"";
            // line 54
            echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getPath("crivero_prueba_logout");
            echo "\" method=\"post\">
                                        <input type=\"hidden\" class=\"btn\">
                                        <button type=\"submit\" class=\"btn btn-danger\">Salir de sesión</button>
                                    </form>

                            ";
        }
        // line 61
        echo "

";
    }

    public function getTemplateName()
    {
        return "CriveroPruebaBundle:Usuarios:perfil.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  140 => 61,  130 => 54,  122 => 49,  114 => 44,  107 => 40,  103 => 38,  101 => 37,  97 => 36,  93 => 35,  87 => 32,  83 => 31,  79 => 30,  75 => 29,  71 => 28,  58 => 18,  49 => 12,  38 => 5,  35 => 4,  29 => 3,  11 => 1,);
    }

    /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */
    public function getSource()
    {
        @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);

        return $this->getSourceContext()->getCode();
    }

    public function getSourceContext()
    {
        return new Twig_Source("{% extends 'CriveroPruebaBundle::main.html.twig' %}

{% block title %} Perfil {% endblock %}
{% block contenido %}
    {{ include('CriveroPruebaBundle:Default:messages/success2.html.twig') }}

Perfil

                            Editar

Nombre

{{usuario.nombre}}

Fecha nacimiento

{{usuario.fNacimiento}}

E-mail

{{usuario.email}}

Teléfono

{{usuario.telefono}}

Rol

{{ rol|capitalize }}

Nombre de usuario

{{usuario.username}}

Registro

{{usuario.registro|date('d/m/Y')}}

                            {% if usuario.tipo == 1 %}

                                    <form class=\"btn-group-vertical\" action=\"{{ path('crivero_prueba_mensajearDirector') }}\" method=\"post\">
                                        <button type=\"submit\" style=\"margin-bottom: 0\" class=\"btn btn-primary\">Mensaje a director</button>
                                        <input type=\"hidden\" class=\"btn\">
                                    </form>
                                    <form class=\"btn-group-vertical\" action=\"{{ path('crivero_prueba_nuevo') }}\" method=\"post\">
                                        <input type=\"hidden\" class=\"btn\">
                                        <button type=\"submit\" style=\"margin-bottom: 0\" class=\"btn btn-info\">Publicar evento</button>
                                        <input type=\"hidden\" class=\"btn\">
                                    </form>
                                    <form class=\"btn-group-vertical\" action=\"{{ path('crivero_prueba_nuevo') }}\" method=\"post\">
                                        <input type=\"hidden\" class=\"btn\">
                                        <button type=\"submit\" style=\"margin-bottom: 0\" class=\"btn btn-warning\">Cambiar horario</button>
                                        <input type=\"hidden\" class=\"btn\">
                                    </form>
                                    <form class=\"btn-group-vertical\" action=\"{{ path('crivero_prueba_logout') }}\" method=\"post\">
                                        <input type=\"hidden\" class=\"btn\">
                                        <button type=\"submit\" class=\"btn btn-danger\">Salir de sesión</button>
                                    </form>

                            {% endif %}

{% endblock %}
", "CriveroPruebaBundle:Usuarios:perfil.html.twig", "C:\\xampp\\htdocs\\Prueba\\src\\Crivero\\PruebaBundle/Resources/views/Usuarios/perfil.html.twig");
    }
}


text:
package mmlib4j;

import ij.ImagePlus;
import ij.plugin.filter.PlugInFilter;
import ij.process.ByteProcessor;
import ij.process.ColorProcessor;
import ij.process.ImageProcessor;
import mmlib4j.imagej.utils.ImageJAdapter;
import mmlib4j.imagej.utils.ImageUtils;
import mmlib4j.images.ColorImage;
import mmlib4j.images.GrayScaleImage;
import mmlib4j.representation.tree.tos.BuilderTreeOfShapeByUnionFindParallel;

/**
 * MMLib4J - Mathematical Morphology Library for Java
 * @author Wonder Alexandre Luz Alves
 *
 * Graphic User Interface by ImageJ
 */
public class ToS_Interpolation  implements PlugInFilter {

	public void run(ImageProcessor ip) {
		ImageUtils.initMMorph4J();

		if(ip instanceof ByteProcessor){
			GrayScaleImage img = ImageJAdapter.toGrayScaleImage( (ByteProcessor) ip);

			Object obj[] = BuilderTreeOfShapeByUnionFindParallel.getImageInterpolate(img);
			short interpolation0[] = (short[]) obj[0];
			short interpolation1[] = (short[]) obj[1];

			int interpWidth = (img.getWidth()*4-3);
	        int interpHeight = (img.getHeight()*4-3);

	        ByteProcessor imgOut0 = new ByteProcessor(interpWidth, interpHeight);
	        ByteProcessor imgOut1 = new ByteProcessor(interpWidth, interpHeight);

			for(int i=0; i < interpolation0.length; i++){
				//imgOut.setPixel(i, (interpolation0[i] + interpolation1[i]) / 2);
				imgOut0.set(i,  (interpolation0[i] & 0xFF));
				imgOut1.set(i,  (interpolation1[i] & 0xFF));
			}

			ImagePlus imgPlus0 = new ImagePlus("interpolation - max", imgOut0);
			imgPlus0.show("image interpolation - max");
			ImagePlus imgPlus1 = new ImagePlus("interpolation - min", imgOut1);
			imgPlus1.show("image interpolation - min");
		}
		else if (ip instanceof ColorProcessor){
			ColorImage img = ImageJAdapter.toColorImage( (ColorProcessor) ip);

			int interpWidth = (img.getWidth()*4-3);
	        int interpHeight = (img.getHeight()*4-3);

	        GrayScaleImage imgR = img.getRed();
	        GrayScaleImage imgG = img.getGreen();
	        GrayScaleImage imgB = img.getBlue();

	        ColorProcessor imgOut0 = new ColorProcessor(interpWidth, interpHeight);
	        ColorProcessor imgOut1 = new ColorProcessor(interpWidth, interpHeight);

	        Object objR[] = BuilderTreeOfShapeByUnionFindParallel.getImageInterpolate(imgR);
			short interpolation0R[] = (short[]) objR[0];
			short interpolation1R[] = (short[]) objR[1];

			Object objG[] = BuilderTreeOfShapeByUnionFindParallel.getImageInterpolate(imgG);
			short interpolation0G[] = (short[]) objG[0];
			short interpolation1G[] = (short[]) objG[1];

			Object objB[] = BuilderTreeOfShapeByUnionFindParallel.getImageInterpolate(imgB);
			short interpolation0B[] = (short[]) objB[0];
			short interpolation1B[] = (short[]) objB[1];

	        for(int i=0; i < interpolation0R.length; i++){

	        	int valor0 = ((0 & 0xFF) << 24) |
	    					((interpolation0R[i] & 0xFF) << 16) |
	    					((interpolation0G[i] & 0xFF) << 8)  |
	    					((interpolation0B[i] & 0xFF) << 0);

	        	imgOut0.set(i, valor0);

	        	int valor1 = ((0 & 0xFF) << 24) |
    					((interpolation1R[i] & 0xFF) << 16) |
    					((interpolation1G[i] & 0xFF) << 8)  |
    					((interpolation1B[i] & 0xFF) << 0);
	        	imgOut1.set(i, valor1);

			}

			ImagePlus imgPlus0 = new ImagePlus("interpolation - max", imgOut0);
			imgPlus0.show("image interpolation - max");
			ImagePlus imgPlus1 = new ImagePlus("interpolation - min", imgOut1);
			imgPlus1.show("image interpolation - min");
		}
	}

	boolean showDialog() {
		return true;
	}

	public int setup(String arg, ImagePlus imp) {

		if (imp!=null && !showDialog()) return DONE;
		return DOES_8G | DOES_RGB;
	}

	public static void main(String args[]){
		ImagePlus plus = ImageUtils.openGrayScale();
		ToS_Interpolation plugin = new ToS_Interpolation();
		plugin.setup(null, plus);
		plugin.run(plus.getProcessor());

	}

}

redpajama_set_name: RedPajamaGithub


text:
package org.jboss.weld.tests.builtinBeans;

import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import java.io.Serializable;

@SessionScoped
public class FieldInjectionPointConsumer implements Serializable {

    @Inject
    Dog dogField;

    public void ping() {
    }

}


text:
<?php

namespace Amadeus\Client\RequestOptions\Air\SellFromRecommendation;

use Amadeus\Client\LoadParamsFromArray;

/**
 * Itinerary
 *
 * @package Amadeus\Client\RequestOptions\Air\SellFromRecommendation
 * @author dieter <dermikagh@gmail.com>
 */
class Itinerary extends LoadParamsFromArray
{
    /**
     * Departure location
     *
     * @var string
     */
    public $from;

    /**
     * Arrival location
     *
     * @var string
     */
    public $to;

    /**
     * Flight segments
     *
     * @var Segment[]
     */
    public $segments = [];
}


text:
<component name="ProjectDictionaryState">
  <dictionary name="trevor">
    <words>
      <w>endian</w>
    </words>
  </dictionary>
</component>


text:
test:
	go test -race ./...

serve:
	cd website && hugo serve

.PHONY: test serve


text:
'use strict';

var Marionette = require('backbone.marionette');

var AboutView = Marionette.ItemView.extend({
    className: 'help-view',
    template: require('./help.html'),
    viewOptions: ['radio'],

    initialize: function(options) {
        this.mergeOptions(options, this.viewOptions);
        this.radio.ui.trigger('tile:update', 'Instructions');
    }

});

module.exports = AboutView;


text:
RSpec.describe Muffin::Execution do
  context "with a simple form" do
    class ExecutionForm < Muffin::Base
      attr_reader :performed

      def perform
        @performed = true
      end
    end

    it "calls perform on call" do
      form = ExecutionForm.new
      expect(form.performed).to be_falsy
      form.call
      expect(form.performed).to eq true
    end
  end

  context "with validation" do
    class ValidatedExecutionForm < Muffin::Base
      attr_reader :performed
      attribute :name

      validates :name, presence: true

      def perform
        @performed = true
      end
    end

    it "performes after validation" do
      form = ValidatedExecutionForm.new
      expect(form.call).to be_falsy
      expect(form.performed).to be_falsy
      form.name = "Klaus"
      expect(form.call).to eq true
      expect(form.performed).to eq true
    end

    it "raises on call!" do
      expect { ValidatedExecutionForm.new.call! }.to raise_error(ActiveModel::ValidationError)
    end

    it "calls perform on call!" do
      form = ValidatedExecutionForm.new params: { name: "Klaus" }
      form.call!
      expect(form.performed).to eq true
    end
  end

  context "without a perform block" do
    class NoPerformForm < Muffin::Base
      attribute :name
      validates :name, presence: true
    end

    it "returns true on call if valid" do
      expect(NoPerformForm.new(params: { name: "Klaus" }).call).to be true
    end

    it "returns false on call if invalid" do
      expect(NoPerformForm.new.call).to be false
    end

    it "raises if invalid" do
      expect { NoPerformForm.new.call! }.to raise_error(ActiveModel::ValidationError)
    end
  end
end


text:
<?php
/**
 *   @file control/install.php
 *   @brief help installing SubjectsPlus
 *   @description This file will help a user walk through basic steps to setup
 * 	 SubjectsPlus
 *
 *   @author dgonzalez
 *   @date Jan 2013
 *   @todo
 */

use SubjectsPlus\Control\Config;
use SubjectsPlus\Control\Installer;
use SubjectsPlus\Control\Querier;

//set varirables needed in header
$subcat = "install";
$page_title = "Installation";
$sessionCheck = 'no';
$no_header = "yes";
$installCheck = 'no';
$updateCheck = 'no';

include("includes/header.php");

//logo only header
displayLogoOnlyHeader();

//find what step we are in
$lintStep = ( isset( $_GET['step'] ) ? (int) $_GET['step'] : 0 );

//if installed already, display message and discontinue
if( isInstalled() )
{
	?>

<?php echo _( "Already Installed" ); ?>

<?php echo _( 'There appears to already be an installation of SubjectsPlus. To reinstall please clear old database tables first.' ) ?>

<?php echo _( 'Log In' ) ?>

	<?php
}else
{
	//options for configurations
	$lobjConfigOptions = array(
		"omit_user_columns" => array( _( "Columns To OMIT On User Form" ), _( "Tick the fields you would like to OMIT on the user form." ), "array", "right", "ticks", array( _( 'title' ),
		_( 'department' ), _( 'position_number' ), _( 'classification' ), _( 'priority' ), _( 'supervisor' ), _( 'tel' ), _( 'fax' ), _( 'intercom' ), _( 'room_number' ), _( 'user_type' ),
		_( 'personal_information' ), _( 'emergency_contact' ) ), _( "The 'User Form' controls who may access SubjectsPlus and what permissions they have.  Some fields are necessary for SubjectsPlus to work; these may be safely turned off if you don't want to capture or display this information." ) ),

		"require_user_columns" => array( _( "Columns To Require On User Form" ), _( "Tick the fields you would like to make required on the user form" ), "array", "right", "ticks",
		array( _( 'title' ), _( 'position_number' ), _( 'classification' ), _( 'priority' ), _( 'tel' ), _( 'fax' ), _( 'intercom' ), _( 'room_number' ), _( 'address' ), _( 'city' ),
		_( 'state' ), _( 'zip' ), _( 'home_phone' ), _( 'cell_phone' ), _( 'lat_long' ), _( 'emergency_contact' ) ), _( "These fields may be required, i.e., the form cannot be submitted until they are completed." ) ),

		"guide_types" => array( _( "Guide Types" ), _( "These are the different ways you may organize your guides." ), "array", "right", "large", "", _("You may add new types at any time.  If you change an existing type, you will need to update all items in subjects table by hand/SQL query.") ),

		"all_ctags" => array( _( "Record Tags" ), _( "These are the tags that a given record location can have associated with it." ), "array", "right", "textarea", "", _("Record tags are a way of slicing and dicing the total set of records.  If you add a new tag, you will need to add new code to deal with items with this tag.  Adding a tag by itself will do nothing except make that tag show up in some places.") ),

		"all_vtags" => array( _( "Video Tags" ), _( "These are the tags that a given video can have associated with it. These are used for the videos module." ), "array", "right", "large", "", "" ),

		"all_tbtags" => array( _( "Talkback" ), _( "These are the tags associated with TalkBack entries. The default is to email all talkbacks to administrator email. Edit only if you want to change that or add a branch." ),
		"aarray", "right", "large", "", _( "e.g. To make a main branch sending to admin email and branch1 branch sent to specified email -> 'main=,branch1=example@branch1.edu'" ) ),

		"use_disciplines" => array( _( "Use SerSol Provided Disciplines" ), _( "Include Serials Solutions disciplines integration." ), "boolean", "right", "small", "" ,
		_( "If you wish to include your SP guides in Serials Solutions' results--i.e., you have Summon--you need to use their disciplines." ) ),

		"BaseURL" => array( _( "Base URL of your SubjectsPlus Installation" ), _( "e.g. 'http://www.yoursite.edu/library/sp/.' Make sure to include the trailing slash! If changed, you will need to log back in." ), "string", "left", "large", "" ,"" ),

		"resource_name" => array( _( "Name of this Resource" ), _( "e.g. SubjectsPlus, Research Guides" ), "string", "left-bottom", "medium", "" ,"" ),

		"institution_name" => array( _( "Institution Name" ), _( "Name of your college/university/institution" ), "string", "left-bottom", "medium", "" ,"" ),

		"administrator" => array( _( "Name of Library Administrator" ), _( "Name for SubjectsPlus administrator" ), "string", "left-bottom", "medium", "" , _("This will appear in the footer of SP pages.") ),

		"administrator_email" => array( _( "Library Administrator Email Address" ), _( "Email address for SubjectsPlus administrator" ), "string", "left-bottom", "medium", "" , _("This will appear in footer, and also be used as default email for TalkBack submissions.") ),

		"email_key" => array( _( "Email Key" ), _( "Ending of campus email addresses, including @ sign" ), "string", "left-bottom", "medium", "" ,_( "This allows for simpler login." ) ),

		"tel_prefix" => array( _( "Telephone Prefix" ), _( "Prefix to prepend to telephone number for staff. Usually area code." ), "string", "left-bottom", "small", "" , _( "Allows you to put short (non-prefixed) version of phone number on pages where space is limited." ) ),

		"hname" => array( _( "MySQL Hostname" ), _( "This is the ip or url to your MySQL database." ), "string", "left", "medium", "" , _( "host help?" ) ),

		"uname" => array( _( "MySQL Username" ), _( "This is the username to your MySQL database." ), "string", "left", "medium", "" ,"" ),

		"pword" => array( _( "MySQL Password" ), _( "This is the password for your MySQL user." ), "string", "left", "medium", "" ,"" ),

	  	"db_port" => array( _( "MySQL Port" ), _( "This is the port your MySQL server uses. (Default: 3306)" ), "string", "left", "medium", "" ,"" ),

		"dbName_SPlus" => array( _( "MySQL SubjectsPlus Database" ), _( "Name of the SubjectsPlus database" ), "string", "left", "" , _( "database help?" ) ),

		"upload_whitelist" => array( _( "List of accepted uploads' file extentions" ), _( "This option contains the coma-separated list of accepted file extensions for file uploads via CKEditor." ), "array", "right", "large", "" , _("If a file isn't in this list, it should not be uploaded.  File uploads only occur via the admin backend, using CKEditor, but this is to stop a user from doing something, uh, foolish.") ),

		"proxyURL" => array( _( "Proxy URL" ), _( "String which should be prepended if you use a proxy server" ), "string", "right", "large", "" , _( "In the Records tab of SP, if you flag an item as 'restricted,' the proxy string will be prepended." ) ),

		"CKBasePath" => array( _( "Base Path for CKEditor" ), _( "Path to CKEditor files appended to base URL" ), "string", "left", "medium", "" , _( "CKEditor is used to generate the WYSIWYG data entry boxes.  It is bundled with SubjectsPlus under the sp/ root folder.  If you move CKEditor to another location, you will need to change this path." ) )
		);

	//new instance of config amd set path and options
	$lobjConfig = new Config();
	$lobjConfig->setConfigPath('includes/config.php');
	$lobjConfig->setConfigOptions( $lobjConfigOptions );

	//depending on step, display content
	switch( $lintStep )
	{
		case 0:
			//first setup config with site configurations
			$lobjConfig->displaySetupSiteConfigForm();
			break;
		case 1:
			//on POST and second step, write configuration and install
			if( isset( $_POST['submit_setup_site_config'] ) )
			{
				$lobjConfig->setNewConfigValues();
				if( !$lobjConfig->writeConfigFile() )
				{
					//error message
					$lobjConfig->displayMessage( _( "Something went wrong and could not save configurations." ) );
				}else
				{
					//include again if config variables have changed
					include_once('includes/config.php');

					//new installer instance and install and on success show complete page
					$lobjInstaller = new Installer();
					if( $lobjInstaller->install( ) )
					{

		        $administrator_email = $_POST['administrator_email'];

		        $db = new Querier;
		        $db->exec("UPDATE staff SET staff.email=". $db->quote($administrator_email) . " WHERE staff.staff_id = 1");

		        // create folder for this user (if it's not admin)
						$user_folder = explode("@",$administrator_email);

						if ($user_folder[0] != "admin") {
	      			$path = "../assets/users/_" . $user_folder[0];

	           	if(!@mkdir($path)) {
		  					//  $mkdirErrorArray = error_get_last();
		   					// throw new Exception('cant create directory ' .$mkdirErrorArray['message'], 1);

		    				//print _("Couldn't create directory in /assets/users/. Please check this folder's permissions. ");
		     				return;

	    				}  else  {
					      // And copy over the generic headshot image and headshot_large image
					      $nufile = $path . "/headshot.jpg";
					      $copier = copy("../assets/images/headshot.jpg", $nufile);
					      $copier = copy("../assets/images/headshot.jpg", $path . "/headshot_large.jpg");

					      // message
					      //print _("Thy Will Be Done.  Added.");
	    				}

						}

						$lobjInstaller->displayInstallationCompletePage();
						$_SESSION['firstInstall'] = 1;
					}
				}
			}
			break;
	}
}

include_once("includes/footer.php");


text:
package com.evolveum.midpoint.provisioning.impl;

import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertNotNull;

import java.io.File;
import java.util.Collection;

import javax.xml.namespace.QName;

import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.prism.Item;
import com.evolveum.midpoint.prism.PrismContainer;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.util.ResourceTypeUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;

/**
 * @author semancik
 *
 */
public class ProvisioningTestUtil {

    public static final File COMMON_TEST_DIR_FILE = new File("src/test/resources/common/");
    public static final File TEST_DIR_IMPL_FILE = new File("src/test/resources/impl/");

    public static final String RESOURCE_DUMMY_NS = "http://midpoint.evolveum.com/xml/ns/public/resource/instance/ef2bc95b-76e0-59e2-86d6-9999dddddddd";

    public static final String DOT_JPG_FILENAME = "src/test/resources/common/dot.jpg";

    public static final File USER_ADMIN_FILE = new File(COMMON_TEST_DIR_FILE, "admin.xml");

    public static final String CONNID_CONNECTOR_FACADE_CLASS_NAME = "org.identityconnectors.framework.api.ConnectorFacade";
    public static final String CONNID_UID_NAME = "__UID__";
    public static final String CONNID_NAME_NAME = "__NAME__";
    public static final String CONNID_DESCRIPTION_NAME = "__DESCRIPTION__";

    public static void checkRepoAccountShadow(PrismObject<ShadowType> repoShadow) {
        checkRepoShadow(repoShadow, ShadowKindType.ACCOUNT);
    }

    public static void checkRepoEntitlementShadow(PrismObject<ShadowType> repoShadow) {
        checkRepoShadow(repoShadow, ShadowKindType.ENTITLEMENT);
    }

    public static void checkRepoShadow(PrismObject<ShadowType> repoShadow, ShadowKindType kind) {
        checkRepoShadow(repoShadow, kind, 2);
    }

    public static void checkRepoShadow(PrismObject<ShadowType> repoShadow, ShadowKindType kind, Integer expectedNumberOfAttributes) {
        ShadowType repoShadowType = repoShadow.asObjectable();
        assertNotNull("No OID in repo shadow "+repoShadow, repoShadowType.getOid());
        assertNotNull("No name in repo shadow "+repoShadow, repoShadowType.getName());
        assertNotNull("No objectClass in repo shadow "+repoShadow, repoShadowType.getObjectClass());
        assertEquals("Wrong kind in repo shadow "+repoShadow, kind, repoShadowType.getKind());
        PrismContainer<Containerable> attributesContainer = repoShadow.findContainer(ShadowType.F_ATTRIBUTES);
        assertNotNull("No attributes in repo shadow "+repoShadow, attributesContainer);
        Collection<Item<?,?>> attributes = attributesContainer.getValue().getItems();
        assertFalse("Empty attributes in repo shadow "+repoShadow, attributes.isEmpty());
        if (expectedNumberOfAttributes != null) {
            assertEquals("Unexpected number of attributes in repo shadow "+repoShadow, (int)expectedNumberOfAttributes, attributes.size());
        }
    }

    public static QName getDefaultAccountObjectClass(ResourceType resourceType) {
        String namespace = ResourceTypeUtil.getResourceNamespace(resourceType);
        return new QName(namespace, SchemaConstants.ACCOUNT_OBJECT_CLASS_LOCAL_NAME);
    }

}


text:
package params

import (
	"fmt"
	"math/big"

	"github.com/ethereum/go-ethereum/common"
)

// Genesis hashes to enforce below configs on.
var (
	MainnetGenesisHash = common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3")
	TestnetGenesisHash = common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d")
	RinkebyGenesisHash = common.HexToHash("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177")
	GoerliGenesisHash  = common.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a")
)

var (
	// MainnetChainConfig is the chain parameters to run a node on the main network.
	MainnetChainConfig = &ChainConfig{
		ChainID:             big.NewInt(1),
		HomesteadBlock:      big.NewInt(1150000),
		DAOForkBlock:        big.NewInt(1920000),
		DAOForkSupport:      true,
		EIP150Block:         big.NewInt(2463000),
		EIP150Hash:          common.HexToHash("0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0"),
		EIP155Block:         big.NewInt(2675000),
		EIP158Block:         big.NewInt(2675000),
		ByzantiumBlock:      big.NewInt(4370000),
		ConstantinopleBlock: big.NewInt(7280000),
		PetersburgBlock:     big.NewInt(7280000),
		Ethash:              new(EthashConfig),
	}

	// MainnetTrustedCheckpoint contains the light client trusted checkpoint for the main network.
	MainnetTrustedCheckpoint = &TrustedCheckpoint{
		Name:         "mainnet",
		SectionIndex: 227,
		SectionHead:  common.HexToHash("0xa2e0b25d72c2fc6e35a7f853cdacb193b4b4f95c606accf7f8fa8415283582c7"),
		CHTRoot:      common.HexToHash("0xf69bdd4053b95b61a27b106a0e86103d791edd8574950dc96aa351ab9b9f1aa0"),
		BloomRoot:    common.HexToHash("0xec1b454d4c6322c78ccedf76ac922a8698c3cac4d98748a84af4995b7bd3d744"),
	}

	// TestnetChainConfig contains the chain parameters to run a node on the Ropsten test network.
	TestnetChainConfig = &ChainConfig{
		ChainID:             big.NewInt(3),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        nil,
		DAOForkSupport:      true,
		EIP150Block:         big.NewInt(0),
		EIP150Hash:          common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d"),
		EIP155Block:         big.NewInt(10),
		EIP158Block:         big.NewInt(10),
		ByzantiumBlock:      big.NewInt(1700000),
		ConstantinopleBlock: big.NewInt(4230000),
		PetersburgBlock:     big.NewInt(4939394),
		Ethash:              new(EthashConfig),
	}

	// TestnetTrustedCheckpoint contains the light client trusted checkpoint for the Ropsten test network.
	TestnetTrustedCheckpoint = &TrustedCheckpoint{
		Name:         "testnet",
		SectionIndex: 161,
		SectionHead:  common.HexToHash("0x5378afa734e1feafb34bcca1534c4d96952b754579b96a4afb23d5301ecececc"),
		CHTRoot:      common.HexToHash("0x1cf2b071e7443a62914362486b613ff30f60cea0d9c268ed8c545f876a3ee60c"),
		BloomRoot:    common.HexToHash("0x5ac25c84bd18a9cbe878d4609a80220f57f85037a112644532412ba0d498a31b"),
	}

	// RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network.
	RinkebyChainConfig = &ChainConfig{
		ChainID:             big.NewInt(4),
		HomesteadBlock:      big.NewInt(1),
		DAOForkBlock:        nil,
		DAOForkSupport:      true,
		EIP150Block:         big.NewInt(2),
		EIP150Hash:          common.HexToHash("0x9b095b36c15eaf13044373aef8ee0bd3a382a5abb92e402afa44b8249c3a90e9"),
		EIP155Block:         big.NewInt(3),
		EIP158Block:         big.NewInt(3),
		ByzantiumBlock:      big.NewInt(1035301),
		ConstantinopleBlock: big.NewInt(3660663),
		PetersburgBlock:     big.NewInt(4321234),
		Clique: &CliqueConfig{
			Period: 15,
			Epoch:  30000,
		},
	}

	// RinkebyTrustedCheckpoint contains the light client trusted checkpoint for the Rinkeby test network.
	RinkebyTrustedCheckpoint = &TrustedCheckpoint{
		Name:         "rinkeby",
		SectionIndex: 125,
		SectionHead:  common.HexToHash("0x8a738386f6bb34add15846f8f49c4c519a2f32519096e792b9f43bcb407c831c"),
		CHTRoot:      common.HexToHash("0xa1e5720a9bad4dce794f129e4ac6744398197b652868011486a6f89c8ec84a75"),
		BloomRoot:    common.HexToHash("0xa3048fe8b7e30f77f11bc755a88478363d7d3e71c2bdfe4e8ab9e269cd804ba2"),
	}

	// GoerliChainConfig contains the chain parameters to run a node on the Görli test network.
	GoerliChainConfig = &ChainConfig{
		ChainID:             big.NewInt(5),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        nil,
		DAOForkSupport:      true,
		EIP150Block:         big.NewInt(0),
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
		PetersburgBlock:     big.NewInt(0),
		Clique: &CliqueConfig{
			Period: 15,
			Epoch:  30000,
		},
	}

	// GoerliTrustedCheckpoint contains the light client trusted checkpoint for the Görli test network.
	GoerliTrustedCheckpoint = &TrustedCheckpoint{
		Name:         "goerli",
		SectionIndex: 9,
		SectionHead:  common.HexToHash("0x8e223d827391eee53b07cb8ee057dbfa11c93e0b45352188c783affd7840a921"),
		CHTRoot:      common.HexToHash("0xe0a817ac69b36c1e437c5b0cff9e764853f5115702b5f66d451b665d6afb7e78"),
		BloomRoot:    common.HexToHash("0x50d672aeb655b723284969c7c1201fb6ca003c23ed144bcb9f2d1b30e2971c1b"),
	}

	// AllEthashProtocolChanges contains every protocol change (EIPs) introduced
	// and accepted by the Ethereum core developers into the Ethash consensus.
	//
	// This configuration is intentionally not using keyed fields to force anyone
	// adding flags to the config to also have to set these fields.
	AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil}

	// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
	// and accepted by the Ethereum core developers into the Clique consensus.
	//
	// This configuration is intentionally not using keyed fields to force anyone
	// adding flags to the config to also have to set these fields.
	AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}}

	TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(EthashConfig), nil}
	TestRules       = TestChainConfig.Rules(new(big.Int))
)

// TrustedCheckpoint represents a set of post-processed trie roots (CHT and
// BloomTrie) associated with the appropriate section index and head hash. It is
// used to start light syncing from this checkpoint and avoid downloading the
// entire header chain while still being able to securely access old headers/logs.
type TrustedCheckpoint struct {
	Name         string      `json:"-"`
	SectionIndex uint64      `json:"sectionIndex"`
	SectionHead  common.Hash `json:"sectionHead"`
	CHTRoot      common.Hash `json:"chtRoot"`
	BloomRoot    common.Hash `json:"bloomRoot"`
}

// ChainConfig is the core config which determines the blockchain settings.
//
// ChainConfig is stored in the database on a per block basis. This means
// that any network, identified by its genesis block, can have its own
// set of configuration options.
type ChainConfig struct {
	ChainID *big.Int `json:"chainId"` // chainId identifies the current chain and is used for replay protection

	HomesteadBlock *big.Int `json:"homesteadBlock,omitempty"` // Homestead switch block (nil = no fork, 0 = already homestead)

	DAOForkBlock   *big.Int `json:"daoForkBlock,omitempty"`   // TheDAO hard-fork switch block (nil = no fork)
	DAOForkSupport bool     `json:"daoForkSupport,omitempty"` // Whether the nodes supports or opposes the DAO hard-fork

	// EIP150 implements the Gas price changes (https://github.com/ethereum/EIPs/issues/150)
	EIP150Block *big.Int    `json:"eip150Block,omitempty"` // EIP150 HF block (nil = no fork)
	EIP150Hash  common.Hash `json:"eip150Hash,omitempty"`  // EIP150 HF hash (needed for header only clients as only gas pricing changed)

	EIP155Block *big.Int `json:"eip155Block,omitempty"` // EIP155 HF block
	EIP158Block *big.Int `json:"eip158Block,omitempty"` // EIP158 HF block

	ByzantiumBlock      *big.Int `json:"byzantiumBlock,omitempty"`      // Byzantium switch block (nil = no fork, 0 = already on byzantium)
	ConstantinopleBlock *big.Int `json:"constantinopleBlock,omitempty"` // Constantinople switch block (nil = no fork, 0 = already activated)
	PetersburgBlock     *big.Int `json:"petersburgBlock,omitempty"`     // Petersburg switch block (nil = same as Constantinople)
	EWASMBlock          *big.Int `json:"ewasmBlock,omitempty"`          // EWASM switch block (nil = no fork, 0 = already activated)

	// Various consensus engines
	Ethash *EthashConfig `json:"ethash,omitempty"`
	Clique *CliqueConfig `json:"clique,omitempty"`
}

// EthashConfig is the consensus engine configs for proof-of-work based sealing.
type EthashConfig struct{}

// String implements the stringer interface, returning the consensus engine details.
func (c *EthashConfig) String() string {
	return "ethash"
}

// CliqueConfig is the consensus engine configs for proof-of-authority based sealing.
type CliqueConfig struct {
	Period uint64 `json:"period"` // Number of seconds between blocks to enforce
	Epoch  uint64 `json:"epoch"`  // Epoch length to reset votes and checkpoint
}

// String implements the stringer interface, returning the consensus engine details.
func (c *CliqueConfig) String() string {
	return "clique"
}

// String implements the fmt.Stringer interface.
func (c *ChainConfig) String() string {
	var engine interface{}
	switch {
	case c.Ethash != nil:
		engine = c.Ethash
	case c.Clique != nil:
		engine = c.Clique
	default:
		engine = "unknown"
	}
	return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v  ConstantinopleFix: %v Engine: %v}",
		c.ChainID,
		c.HomesteadBlock,
		c.DAOForkBlock,
		c.DAOForkSupport,
		c.EIP150Block,
		c.EIP155Block,
		c.EIP158Block,
		c.ByzantiumBlock,
		c.ConstantinopleBlock,
		c.PetersburgBlock,
		engine,
	)
}

// IsHomestead returns whether num is either equal to the homestead block or greater.
func (c *ChainConfig) IsHomestead(num *big.Int) bool {
	return isForked(c.HomesteadBlock, num)
}

// IsDAOFork returns whether num is either equal to the DAO fork block or greater.
func (c *ChainConfig) IsDAOFork(num *big.Int) bool {
	return isForked(c.DAOForkBlock, num)
}

// IsEIP150 returns whether num is either equal to the EIP150 fork block or greater.
func (c *ChainConfig) IsEIP150(num *big.Int) bool {
	return isForked(c.EIP150Block, num)
}

// IsEIP155 returns whether num is either equal to the EIP155 fork block or greater.
func (c *ChainConfig) IsEIP155(num *big.Int) bool {
	return isForked(c.EIP155Block, num)
}

// IsEIP158 returns whether num is either equal to the EIP158 fork block or greater.
func (c *ChainConfig) IsEIP158(num *big.Int) bool {
	return isForked(c.EIP158Block, num)
}

// IsByzantium returns whether num is either equal to the Byzantium fork block or greater.
func (c *ChainConfig) IsByzantium(num *big.Int) bool {
	return isForked(c.ByzantiumBlock, num)
}

// IsConstantinople returns whether num is either equal to the Constantinople fork block or greater.
func (c *ChainConfig) IsConstantinople(num *big.Int) bool {
	return isForked(c.ConstantinopleBlock, num)
}

// IsPetersburg returns whether num is either
// - equal to or greater than the PetersburgBlock fork block,
// - OR is nil, and Constantinople is active
func (c *ChainConfig) IsPetersburg(num *big.Int) bool {
	return isForked(c.PetersburgBlock, num) || c.PetersburgBlock == nil && isForked(c.ConstantinopleBlock, num)
}

// IsEWASM returns whether num represents a block number after the EWASM fork
func (c *ChainConfig) IsEWASM(num *big.Int) bool {
	return isForked(c.EWASMBlock, num)
}

// GasTable returns the gas table corresponding to the current phase (homestead or homestead reprice).
//
// The returned GasTable's fields shouldn't, under any circumstances, be changed.
func (c *ChainConfig) GasTable(num *big.Int) GasTable {
	if num == nil {
		return GasTableHomestead
	}
	switch {
	case c.IsConstantinople(num):
		return GasTableConstantinople
	case c.IsEIP158(num):
		return GasTableEIP158
	case c.IsEIP150(num):
		return GasTableEIP150
	default:
		return GasTableHomestead
	}
}

// CheckCompatible checks whether scheduled fork transitions have been imported
// with a mismatching chain configuration.
func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64) *ConfigCompatError {
	bhead := new(big.Int).SetUint64(height)

	// Iterate checkCompatible to find the lowest conflict.
	var lasterr *ConfigCompatError
	for {
		err := c.checkCompatible(newcfg, bhead)
		if err == nil || (lasterr != nil && err.RewindTo == lasterr.RewindTo) {
			break
		}
		lasterr = err
		bhead.SetUint64(err.RewindTo)
	}
	return lasterr
}

func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *ConfigCompatError {
	if isForkIncompatible(c.HomesteadBlock, newcfg.HomesteadBlock, head) {
		return newCompatError("Homestead fork block", c.HomesteadBlock, newcfg.HomesteadBlock)
	}
	if isForkIncompatible(c.DAOForkBlock, newcfg.DAOForkBlock, head) {
		return newCompatError("DAO fork block", c.DAOForkBlock, newcfg.DAOForkBlock)
	}
	if c.IsDAOFork(head) && c.DAOForkSupport != newcfg.DAOForkSupport {
		return newCompatError("DAO fork support flag", c.DAOForkBlock, newcfg.DAOForkBlock)
	}
	if isForkIncompatible(c.EIP150Block, newcfg.EIP150Block, head) {
		return newCompatError("EIP150 fork block", c.EIP150Block, newcfg.EIP150Block)
	}
	if isForkIncompatible(c.EIP155Block, newcfg.EIP155Block, head) {
		return newCompatError("EIP155 fork block", c.EIP155Block, newcfg.EIP155Block)
	}
	if isForkIncompatible(c.EIP158Block, newcfg.EIP158Block, head) {
		return newCompatError("EIP158 fork block", c.EIP158Block, newcfg.EIP158Block)
	}
	if c.IsEIP158(head) && !configNumEqual(c.ChainID, newcfg.ChainID) {
		return newCompatError("EIP158 chain ID", c.EIP158Block, newcfg.EIP158Block)
	}
	if isForkIncompatible(c.ByzantiumBlock, newcfg.ByzantiumBlock, head) {
		return newCompatError("Byzantium fork block", c.ByzantiumBlock, newcfg.ByzantiumBlock)
	}
	if isForkIncompatible(c.ConstantinopleBlock, newcfg.ConstantinopleBlock, head) {
		return newCompatError("Constantinople fork block", c.ConstantinopleBlock, newcfg.ConstantinopleBlock)
	}
	if isForkIncompatible(c.PetersburgBlock, newcfg.PetersburgBlock, head) {
		return newCompatError("ConstantinopleFix fork block", c.PetersburgBlock, newcfg.PetersburgBlock)
	}
	if isForkIncompatible(c.EWASMBlock, newcfg.EWASMBlock, head) {
		return newCompatError("ewasm fork block", c.EWASMBlock, newcfg.EWASMBlock)
	}
	return nil
}

// isForkIncompatible returns true if a fork scheduled at s1 cannot be rescheduled to
// block s2 because head is already past the fork.
func isForkIncompatible(s1, s2, head *big.Int) bool {
	return (isForked(s1, head) || isForked(s2, head)) && !configNumEqual(s1, s2)
}

// isForked returns whether a fork scheduled at block s is active at the given head block.
func isForked(s, head *big.Int) bool {
	if s == nil || head == nil {
		return false
	}
	return s.Cmp(head) <= 0
}

func configNumEqual(x, y *big.Int) bool {
	if x == nil {
		return y == nil
	}
	if y == nil {
		return x == nil
	}
	return x.Cmp(y) == 0
}

// ConfigCompatError is raised if the locally-stored blockchain is initialised with a
// ChainConfig that would alter the past.
type ConfigCompatError struct {
	What string
	// block numbers of the stored and new configurations
	StoredConfig, NewConfig *big.Int
	// the block number to which the local chain must be rewound to correct the error
	RewindTo uint64
}

func newCompatError(what string, storedblock, newblock *big.Int) *ConfigCompatError {
	var rew *big.Int
	switch {
	case storedblock == nil:
		rew = newblock
	case newblock == nil || storedblock.Cmp(newblock) < 0:
		rew = storedblock
	default:
		rew = newblock
	}
	err := &ConfigCompatError{what, storedblock, newblock, 0}
	if rew != nil && rew.Sign() > 0 {
		err.RewindTo = rew.Uint64() - 1
	}
	return err
}

func (err *ConfigCompatError) Error() string {
	return fmt.Sprintf("mismatching %s in database (have %d, want %d, rewindto %d)", err.What, err.StoredConfig, err.NewConfig, err.RewindTo)
}

// Rules wraps ChainConfig and is merely syntactic sugar or can be used for functions
// that do not have or require information about the block.
//
// Rules is a one time interface meaning that it shouldn't be used in between transition
// phases.
type Rules struct {
	ChainID                                     *big.Int
	IsHomestead, IsEIP150, IsEIP155, IsEIP158   bool
	IsByzantium, IsConstantinople, IsPetersburg bool
}

// Rules ensures c's ChainID is not nil.
func (c *ChainConfig) Rules(num *big.Int) Rules {
	chainID := c.ChainID
	if chainID == nil {
		chainID = new(big.Int)
	}
	return Rules{
		ChainID:          new(big.Int).Set(chainID),
		IsHomestead:      c.IsHomestead(num),
		IsEIP150:         c.IsEIP150(num),
		IsEIP155:         c.IsEIP155(num),
		IsEIP158:         c.IsEIP158(num),
		IsByzantium:      c.IsByzantium(num),
		IsConstantinople: c.IsConstantinople(num),
		IsPetersburg:     c.IsPetersburg(num),
	}
}


text:
"""This module stores classes that make a finite element analysis mesh.
"""
from matplotlib.patches import Polygon  # needed for plotting elements
from . import geometry

class Element(object):
    """Makes a mesh element.

    Supports 4 noded quads, 8 noded quads, 3 noded tris, 6 noded tris.

    Args:
        enum (int): element id number
        ccxtype (str): ccx element type string, 4 characters long

            Description: element_shape + element_order + element_type

            - element_shape = 'quad' or 'tri'
                - 'quad' = quadrangle
                - 'tri' = triangle
            - element_order = '1' or '2'
                - '1' = corner nodes only (3 or 4 noded element)
                - '2' = corner nodes and midside nodes (6 or 8 noded element)
            - element_type = 'plstress' or 'plstrain' or 'axisym'
                - 'plstress' = plane stress
                - 'plstrain' = plane strain
                - 'axisym' = axisymmetric

            axisymmetric
                - 'CAX6' : 'tri2axisym'
                - 'CAX3' : 'tri1axisym'
                - 'CAX8' : 'quad2axisym'
                - 'CAX4' : 'quad1axisym'
            plane stress
                - 'CPS6' : 'tri2plstress'
                - 'CPS3' : 'tri1plstress'
                - 'CPS8' : 'quad2plstress'
                - 'CPS4' : 'quad1plstress'
            plane strain
                - 'CPE6' : 'tri2plstrain'
                - 'CPE3' : 'tri1plstrain'
                - 'CPE8' : 'quad2plstrain'
                - 'CPE4' : 'quad1plstrain'

        nlist (list): list of Node, the nodes that define the element

    Attributes:
        id (int): element id number
        ccxtype (str): ccx element type string, 4 characters long

            Description: element_shape + element_order + element_type

            - element_shape = 'quad' or 'tri'
                - 'quad' = quadrangle
                - 'tri' = triangle
            - element_order = '1' or '2'
                - '1' = corner nodes only (3 or 4 noded element)
                - '2' = corner nodes and midside nodes (6 or 8 noded element)
            - element_type = 'plstress' or 'plstrain' or 'axisym'
                - 'plstress' = plane stress
                - 'plstrain' = plane strain
                - 'axisym' = axisymmetric

            axisym
                - 'CAX6' : 'tri2axisym'
                - 'CAX3' : 'tri1axisym'
                - 'CAX8' : 'quad2axisym'
                - 'CAX4' : 'quad1axisym'
            plane stress
                - 'CPS6' : 'tri2plstress'
                - 'CPS3' : 'tri1plstress'
                - 'CPS8' : 'quad2plstress'
                - 'CPS4' : 'quad1plstress'
            plane strain
                - 'CPE6' : 'tri2plstrain'
                - 'CPE3' : 'tri1plstrain'
                - 'CPE8' : 'quad2plstrain'
                - 'CPE4' : 'quad1plstrain'

        node (dict): dictionary of nodes, keys are int >= 1
        face (dict): dictionary of faces, keys are int >= 1
        nodes (list): list of element nodes
        faces (list): list of element faces
        center (Point): the center point of the element
    """

    def __init__(self, enum, ccxtype, nlist):
        self.id = enum
        self.ccxtype = ccxtype
        self.node = {}
        self.face = {}

        # calculate the number of faces
        fnum = len(nlist)
        if fnum > 4:
            fnum = int(fnum/2)

        # store nodes
        for (ind, node) in enumerate(nlist):
            if ind >= fnum:
                node.set_order(2)
            node.add_element(self)
            self.node[ind+1] = node

        # store faces
        nodes = nlist[0:fnum]+[nlist[0]]
        for ind in range(fnum):
            node1 = nodes[ind]
            node2 = nodes[ind+1]
            face = Face(ind+1, node1, node2, self)
            if len(nlist) > fnum:
                # we have second order nodes
                face.set_nmid(self.node[ind+1+fnum])
            self.face[ind+1] = face

        # set the element center
        self.center = self.calc_center()

    def __hash__(self):
        """Returns the item's id as its hash."""
        return self.id

    @property
    def faces(self):
        """Returns list of element faces."""
        return self.face.values()

    @property
    def nodes(self):
        """Returns list of element nodes."""
        return self.node.values()

    def get_poly(self):
        """Returns a polygon of the element."""
        nodes = [node for node in self.nodes if node.order == 1]
        # make a list of [[ax, rad],[... ] for making the polygon
        xycoords = [[node.y, node.x] for node in nodes]
        polygon = Polygon(xycoords, closed=True)
        return polygon

    def label(self, ax):
        """Labels the element on the passed matplotlib axis."""
        ax.text(self.center.y, self.center.x, self.get_name(),
                ha='center', va='center')

    def calc_center(self):
        """Returns the element center as a Point."""
        pts = [node for node in self.nodes if node.order == 1]
        axials = [point.y for point in pts]
        radials = [point.x for point in pts]
        axial = sum(axials)/len(axials)
        radial = sum(radials)/len(radials)
        return geometry.Point(radial, axial)

    def get_tris(self):
        """Returns a list of triangles for plotting. Triangles are node ids.

        CCX elements are closed in a CCW direction relative to xy  normal
        CCX elements are closed in a CW direction relative to yx mine
        ---> I have to draw in a clockwise direction, otherwise get error
        Triangles are closed in a counter clockwise (CCW) direction to yx mine
        http://matplotlib.org/api/tri_api.html#matplotlib.tri.Triangulation
        """
        res = []
        numnodes = len(self.nodes)
        if numnodes == 3:
            # triangle, first order = 1 triangle
            res.append([self.node[1].id, self.node[3].id, self.node[2].id])
        elif numnodes == 4:
            # quad, first order = 2 triangles
            res.append([self.node[1].id, self.node[3].id, self.node[2].id])
            res.append([self.node[1].id, self.node[4].id, self.node[3].id])
        elif numnodes == 6:
            # tri, second order = 4 triangles
            res.append([self.node[1].id, self.node[6].id, self.node[4].id])
            res.append([self.node[4].id, self.node[5].id, self.node[2].id])
            res.append([self.node[6].id, self.node[3].id, self.node[5].id])
            res.append([self.node[6].id, self.node[5].id, self.node[4].id])
        elif numnodes == 8:
            # quad, second order = 6 triangles
            res.append([self.node[1].id, self.node[8].id, self.node[5].id])
            res.append([self.node[5].id, self.node[6].id, self.node[2].id])
            res.append([self.node[6].id, self.node[7].id, self.node[3].id])
            res.append([self.node[8].id, self.node[4].id, self.node[7].id])
            res.append([self.node[8].id, self.node[7].id, self.node[6].id])
            res.append([self.node[8].id, self.node[6].id, self.node[5].id])
        return res

    def get_area(self):
        """Returns the element area."""
        asum = 0.0
        for face in self.faces:
            node1 = face.nodes[0]
            node2 = face.nodes[1]
            asum += node2.y*node1.x - node2.x*node1.y
        asum = asum*0.5
        return asum

    def set_ccxtype(self, etype):
        """Sets the ccx element type given an etype string.

        Args:
            etype (string): element type string

                - 'plstress' = plane stress
                - 'plstrain' = plane strain
                - 'axisym' = axisymmetric
        """
        fnum = len(self.faces)
        shape = 'tri'
        if fnum == 4:
            shape = 'quad'
        order = '2'
        if len(self.nodes) == fnum:
            order = '1'
        estr = shape+order+etype

        # Calculix CCX elements
        # axisymmetric
        _ccx_elements = {}
        _ccx_elements['tri2axisym'] = 'CAX6'
        _ccx_elements['tri1axisym'] = 'CAX3'
        _ccx_elements['quad2axisym'] = 'CAX8'
        _ccx_elements['quad1axisym'] = 'CAX4'
        # plane stress
        _ccx_elements['tri2plstress'] = 'CPS6'
        _ccx_elements['tri1plstress'] = 'CPS3'
        _ccx_elements['quad2plstress'] = 'CPS8'
        _ccx_elements['quad1plstress'] = 'CPS4'
        # plane strain
        _ccx_elements['tri2plstrain'] = 'CPE6'
        _ccx_elements['tri1plstrain'] = 'CPE3'
        _ccx_elements['quad2plstrain'] = 'CPE8'
        _ccx_elements['quad1plstrain'] = 'CPE4'
        # set element ccxtype
        self.ccxtype = _ccx_elements[estr]

    def ccx(self):
        """Returns text string defining the element for a ccx input file."""
        nids = [str(n.id) for n in self.node.values()]
        val = str(self.id)+', '+', '.join(nids)
        return val

    def get_name(self):
        """Returns the element name based on id number."""
        name = 'E%i' % (self.id)
        return name

    def __str__(self):
        """Returns the element name."""
        nids = [str(node.id) for node in self.nodes]
        return '%s nodes: %s' % (self.get_name(), ','.join(nids))

class Face(object):
    """Makes an element face.

    Args:
        fnum (int): element face number
        node1 (Node): first node
        node2 (Node): second node
        element (Element): parent element

    Attributes:
        id (int): element face number
        nodes (list): list of nodes [node1, node2]
        nmid (Node or None): midside node, defaults to None
        element (Element): parent element
        ext (bool): stores if face is external
    """

    def __init__(self, fnum, node1, node2, element):
        self.id = fnum
        self.nmid = None
        self.ext = False
        self.element = element
        self.nodes = [node1, node2]
        for node in self.nodes:
            node.add_face(self)

    def __hash__(self):
        """Returns a hash = self.element.id*4, Lets us make sets of faces."""
        # we assume the largest number of faces is 4, face id is 1-4, need 0-3
        hval = self.element.id*4+(self.id-1)
        return hval

    def length(self):
        """Return the length of the face."""
        point0 = geometry.Point(self.nodes[0].x, self.nodes[0].y)
        point1 = geometry.Point(self.nodes[1].x, self.nodes[1].y)
        vect = point1 - point0
        return vect.length()

    def get_mnorm(self):
        """Returns a list: [midpoint, normal_vector]

        Returns:
            midpoint (Point): face midpoint
            norm_vect (Point): face normal vector, it is a unit vector
        """
        # return midpt, normal
        point0 = geometry.Point(self.nodes[0].x, self.nodes[0].y)
        point1 = geometry.Point(self.nodes[1].x, self.nodes[1].y)
        midpt = point0 + point1
        midpt = midpt*0.5
        norm_vect = point1 - point0
        norm_vect.rot_ccw_deg(90)
        norm_vect.make_unit()
        return [midpt, norm_vect]

    def set_ext(self):
        """Sets the ext boolean flag to True. Face is external."""
        self.ext = True

    def set_nmid(self, nmid):
        """Sets the face midside node, nmid.

        Args:
            nmid (Point): passed node to set as the face midside node
        """
        self.nmid = nmid
        nmid.add_face(self)
        self.nodes = [self.nodes[0], self.nmid, self.nodes[-1]]

    def __eq__(self, other):
        """Compare this face to other face. True if node lists equal.

        Args:
            other (Face): the other face we are comparing

        Returns:
            bool: True if face node lists are equal, False otherwise.
        """
        if self.nodes == other.nodes:
            return True
        else:
            return False

    def __str__(self):
        """Returns string listing object type, id number and nodes."""
        node1 = self.nodes[0].id
        node2 = self.nodes[1].id
        fid = self.id
        eid = self.element.id
        tup = (fid, eid, node1, node2)
        res = 'Face %i on element %i with nodes [%i,%i]' % tup
        return res

class Node(object):
    """Makes a mesh node.

    Args:
        node_num (int): node number
        x (float): x-coordinate
        y (float): y-coordinate
        z (float): z-coordinate

    Attributes:
        id (int): node number
        x (float): x-coordinate
        y (float): y-coordinate
        z (float): z-coordinate
        order (int): 1 or 2, 1 if it is a corner node, 2 if it is a midside node
        elements (set): a set of elements that contain this node
        faces (set): a set of faces that contain this node
    """

    def __init__(self, node_num, x, y, z):
        self.id = node_num
        self.x = x
        self.y = y
        self.z = z
        self.order = 1
        self.elements = set()
        self.faces = set()

    def set_order(self, order):
        """Sets the node order, must be 1 or 2.

        Args:
            order (int): node order, 1 is corner node, 2 is midside node
        """
        self.order = order

    def add_element(self, element):
        """Adds an element to this node's set of elements.

        Args:
            element (Element): element to add to set self.elements
        """
        self.elements.add(element)

    def add_face(self, face):
        """Adds a face to this node's set of faces.

        Args:
            face (Face): face to add to set self.faces
        """
        self.faces.add(face)

    def label(self, ax):
        """Labels the node on the passed Matplotlib axis."""
        ax.annotate(self.get_name(), (self.y, self.x))

    def __hash__(self):
        """Returns the node id as the hash."""
        return self.id

    def __eq__(self, other):
        """Returns boolean of id equality to other Node.

        Args:
            other (Node): the node to compare to this node.

        Returns:
            boolean: True if ids are equal, False if they are not
        """
        if isinstance(other, Node):
            return self.id == other.id
        else:
            return False

    def ccx(self):
        """Returns a string defining the node for a ccx inp file."""
        val = '%i, %f, %f, %f' % (self.id, self.x, self.y, self.z)
        return val

    def get_name(self):
        """Returns the string node name."""
        name = 'N%i' % (self.id)
        return name

    def __str__(self):
        """Returns string listing object type, id number and (x,y) coords."""
        val = 'Node, id %i, (x,y)=(%f,%f)' % (self.id, self.x, self.y)
        return val


text:
require 'test/unit'
require 'xrt/parser'

class TestParser < Test::Unit::TestCase
  def setup
    @parser = XRT::Parser.new
  end

  def test_new_statement
    parser = XRT::Parser.new('')

    assert parser.new_statement('hi').kind_of? XRT::Statement::Text
    assert parser.new_statement(' ').kind_of? XRT::Statement::Whitespace
    assert parser.new_statement('[% foo %]').kind_of? XRT::Statement::Directive
    assert parser.new_statement('[% foo IF 1 %]').kind_of? XRT::Statement::Directive
    assert parser.new_statement('[% IF 1 %]').kind_of? XRT::Statement::ControlBlock
    assert parser.new_statement('<').kind_of? XRT::Statement::Tag
    assert parser.new_statement('>').kind_of? XRT::Statement::TagEnd
  end

  def test_document_empty
    parser = XRT::Parser.new('')
    doc = parser.document
    assert doc.kind_of? XRT::Statement::Document
    assert_equal [], doc.children
  end

  def test_document_text_directive
    parser = XRT::Parser.new('1[% 2 %]3')
    doc = parser.document
    assert doc.kind_of? XRT::Statement::Document
    assert_equal [
      XRT::Statement::Text.new('1'),
      XRT::Statement::Directive.new('[% 2 %]'),
      XRT::Statement::Text.new('3'),
    ], doc.children
  end

  def test_document_text_and_whitespace_directive
    parser = XRT::Parser.new("1 [% 2 %]\n3")
    doc = parser.document
    assert doc.kind_of? XRT::Statement::Document
    assert_equal [
      XRT::Statement::Text.new('1'),
      XRT::Statement::Whitespace.new(' '),
      XRT::Statement::Directive.new('[% 2 %]'),
      XRT::Statement::Whitespace.new("\n"),
      XRT::Statement::Text.new('3'),
    ], doc.children
  end

  def test_document_block
    parser = XRT::Parser.new('[% IF a %]1[% END %]')
    doc = parser.document
    assert doc.kind_of? XRT::Statement::Document
    if_block = XRT::Statement::ControlBlock.new('[% IF a %]')
    if_block << XRT::Statement::Text.new('1')
    if_block << XRT::Statement::End.new('[% END %]')
    assert_equal [
      if_block
    ], doc.children
  end

  def test_document_nested_block
    parser = XRT::Parser.new('[% IF a %][% IF b %]1[% END %][% END %]')
    doc = parser.document
    assert doc.kind_of? XRT::Statement::Document
    if_block1 = XRT::Statement::ControlBlock.new('[% IF a %]')
    if_block2 = XRT::Statement::ControlBlock.new('[% IF b %]')
    if_block2 << XRT::Statement::Text.new('1')
    if_block2 << XRT::Statement::End.new('[% END %]')
    if_block1 << if_block2
    if_block1 << XRT::Statement::End.new('[% END %]')
    assert_equal [
      if_block1
    ], doc.children
  end

  def test_document_tag
    parser = XRT::Parser.new('
a
')
    doc = parser.document
    assert doc.kind_of? XRT::Statement::Document

    tag_start = XRT::Statement::Tag.new '<'
    tag_start << XRT::Statement::Text.new('div')
    tag_start << XRT::Statement::TagEnd.new('>')

    text = XRT::Statement::Text.new('a')

    tag_close = XRT::Statement::Tag.new '<'
    tag_close << XRT::Statement::Text.new('/div')
    tag_close << XRT::Statement::TagEnd.new('>')

    tag_pair = XRT::Statement::TagPair.new(tag_start)
    tag_pair << text
    tag_pair << XRT::Statement::TagPairEnd.new(tag_close)
    assert_equal [
      tag_pair,
    ], doc.children
  end

  def test_void_element
    parser = XRT::Parser.new('a')
    doc = parser.document
    assert doc.kind_of? XRT::Statement::Document

    tag = XRT::Statement::Tag.new '<'
    tag << XRT::Statement::Text.new('img')
    tag << XRT::Statement::TagEnd.new('>')

    text = XRT::Statement::Text.new('a')

    assert_equal [
      tag,
      text
    ], doc.children
  end

  def test_block_in_raw_text_element
    parser = XRT::Parser.new('')
    doc = parser.document
    assert doc.kind_of? XRT::Statement::Document

    tag_start = XRT::Statement::Tag.new '<'
    tag_start << XRT::Statement::Text.new('script')
    tag_start << XRT::Statement::TagEnd.new('>')

    tag_close = XRT::Statement::Tag.new '<'
    tag_close << XRT::Statement::Text.new('/script')
    tag_close << XRT::Statement::TagEnd.new('>')

    if_block = XRT::Statement::ControlBlock.new('[% IF a %]')
    if_block << XRT::Statement::Text.new('1')
    if_block << XRT::Statement::End.new('[% END %]')

    directive = XRT::Statement::Directive.new('[% b %]')

    tag_pair = XRT::Statement::TagPair.new(tag_start)
    tag_pair << if_block
    tag_pair << directive
    tag_pair << XRT::Statement::TagPairEnd.new(tag_close)

    assert_equal [
      tag_pair,
    ], doc.children
  end

  def test_simple_raw_text_element
    parser = XRT::Parser.new('')
    doc = parser.document
    assert doc.kind_of? XRT::Statement::Document

    tag_start = XRT::Statement::Tag.new '<'
    tag_start << XRT::Statement::Text.new('script')
    tag_start << XRT::Statement::TagEnd.new('>')

    tag_close = XRT::Statement::Tag.new '<'
    tag_close << XRT::Statement::Text.new('/script')
    tag_close << XRT::Statement::TagEnd.new('>')

    tag_pair = XRT::Statement::TagPair.new(tag_start)
    tag_pair << XRT::Statement::Text.new('1')
    tag_pair << XRT::Statement::Text.new('<')
    tag_pair << XRT::Statement::Text.new('2')
    tag_pair << XRT::Statement::TagPairEnd.new(tag_close)

    assert_equal [
      tag_pair,
    ], doc.children
  end

  def test_raw_text_in_block_in_raw_text_element
    parser = XRT::Parser.new('')
    doc = parser.document
    assert doc.kind_of? XRT::Statement::Document

    tag_start = XRT::Statement::Tag.new '<'
    tag_start << XRT::Statement::Text.new('script')
    tag_start << XRT::Statement::TagEnd.new('>')

    tag_close = XRT::Statement::Tag.new '<'
    tag_close << XRT::Statement::Text.new('/script')
    tag_close << XRT::Statement::TagEnd.new('>')

    if_block = XRT::Statement::ControlBlock.new('[% IF a %]')
    if_block << XRT::Statement::Text.new('<')
    if_block << XRT::Statement::End.new('[% END %]')

    tag_pair = XRT::Statement::TagPair.new(tag_start)
    tag_pair << if_block
    tag_pair << XRT::Statement::TagPairEnd.new(tag_close)

    assert_equal [
      tag_pair,
    ], doc.children
  end

  def test_read_directive
    assert_equal '[% %]', @parser.read_directive('[% %]')
    assert_equal '[% [ ] %]', @parser.read_directive('[% [ ] %]')
    assert_nil @parser.read_directive('hi')
  end

  def test_read_text
    assert_equal '', @parser.read_text('')
    assert_equal 'hi', @parser.read_text('hi')
    assert_equal 'hi[', @parser.read_text('hi[')
    assert_equal 'hi', @parser.read_text('hi[%')
    assert_equal 'hi', @parser.read_text('hi<')
    assert_equal 'hi', @parser.read_text('hi>')
    assert_nil @parser.read_text('[% %]')
  end

  def test_read_tag_start
    assert_equal '<', @parser.read_tag_start('<')
    assert_equal '<', @parser.read_tag_start('
', @parser.read_tag_end('>')
    assert_equal '>', @parser.read_tag_end('>>')
    assert_nil @parser.read_tag_end('hi')
  end

  def test_split_whitespace
    assert_equal([], @parser.split_whitespace(""))
    assert_equal([" "], @parser.split_whitespace(" "))
    assert_equal(["\n"], @parser.split_whitespace("\n"))
    assert_equal(["hi"], @parser.split_whitespace("hi"))
    assert_equal(["hi there"], @parser.split_whitespace("hi there"))
    assert_equal([" ", "hi", " "], @parser.split_whitespace(" hi "))
    assert_equal([" \n", "hi", "\n "], @parser.split_whitespace(" \nhi\n "))
    assert_equal(["\n", "xxx", "\n"], @parser.split_whitespace("\nxxx\n"))
  end

  def test_tokens
    test_cases = [
      ['', ['<', 'html', '>']],
      ['a [% b %] c', ['a', ' ', '[% b %]', ' ', 'c']],
      ['[% a %] [% b %] [% c %]', ['[% a %]', ' ', '[% b %]', ' ', '[% c %]']],
      ['[% FOR k IN [1, 2, 3] %]', ['[% FOR k IN [1, 2, 3] %]']],
      [
        %q([% WRAPPER "wrapper.tt" WITH args = [1,2,3] %]

[% END %]),
        [
          %q([% WRAPPER "wrapper.tt" WITH args = [1,2,3] %]),
          *%w(

),
          %q([% END %]),
        ]
      ],
    ]

    test_cases.each{|test_case|
      input, expected = *test_case
      parser = XRT::Parser.new(input)
      assert_equal expected, parser.tokens
    }
  end
end


text:
export MALLOC_CONF="tcache:false"
if [ "x${enable_prof}" = "x1" ] ; then
  export MALLOC_CONF="${MALLOC_CONF},prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0,lg_prof_interval:0"
fi


text:
require "slack-notifier"
require "gemsurance"

require "gemsurance_slack/version"

module GemsuranceSlack
  class Engine < ::Rails::Engine
  end

  def self.check_and_notify
    abort "Error: environment variables SLACK_WEBHOOK_URL or SLACK_CHANNEL empty." unless initialize_slack_notifier

    @gems_infos = Gemsurance::Runner.new.run.gem_infos

    vulnerables_notification
    outdated_notification
  end

  private

  def self.initialize_slack_notifier
    webhook_url = ENV["SLACK_WEBHOOK_URL"]
    channel = ENV["SLACK_CHANNEL"]
    return false unless webhook_url && channel

    @notifier = Slack::Notifier.new webhook_url, :channel => channel
  end

  def self.vulnerables_notification
    vulnerables = @gems_infos.select(&:vulnerable?)
    return if vulnerables.empty?

    @notifier.ping "", :icon_emoji => ":rotating_light:", :username => "Gemsurance Alert", :attachments => [{
      :fallback => "#{project_name}, #{gems_count_string(vulnerables.count)} vulnerable.",
      :pretext => "#{project_name}, #{gems_count_string(vulnerables.count)} vulnerable.",
      :color => "danger",
      :fields => vulnerables.map do |gm|
        {
          :title => gm.name,
          :value => "Update v#{gm.current_version} to v#{gm.newest_version} (#{gm.vulnerabilities.map(&:title).join(", ")})",
          :short => false
        }
      end
    }]
  end

  def self.outdated_notification
    outdated = @gems_infos.select(&:outdated?)
    return if outdated.empty?

    @notifier.ping "", :icon_emoji => ":warning:", :username => "Gemsurance Warning", :attachments => [{
      :fallback => "#{project_name}, #{gems_count_string(outdated.count)} out of date.",
      :pretext => "#{project_name}, #{gems_count_string(outdated.count)} out of date.",
      :color => "warning",
      :fields => [{
        :title => outdated.map(&:name).join(", ")
      }]
    }]
  end

  def self.project_name
    ENV["SLACK_APP_NAME"] || ""
  end

  def self.gems_count_string(count)
    count == 1 ? "1 gem is" : "#{count} gems are"
  end
end


text:
/**
 *@Author: chad.ding
 *@Date: 2017-06-21 17:40:41
 */

import { GET_DOMAIN_LIST } from '../../consts/action';

export default function domainReducer(state = { domainList: [], fetched: false }, action) {
    switch (action.type) {
        case GET_DOMAIN_LIST:
            return Object.assign({}, state, { domainList: action.data });
        default:
            return state;
    }
};


text:
import datetime
import glob
import gzip
import os
import re
import traceback
from xml.dom import minidom
from abjad.tools import systemtools
try:
    from xml.etree import cElementTree as ElementTree
except ImportError:
    from xml.etree import ElementTree

class Bootstrapper(object):

    ### CLASS VARIABLES ###

    date_regex = re.compile('^(\d{4})-(\d{2})-(\d{2})$')
    date_no_dashes_regex = re.compile('^(\d{4})(\d{2})(\d{2})$')
    year_regex = re.compile('^\d\d\d\d$')
    is_test = False

    ### PUBLIC METHODS ###

    @staticmethod
    def get_xml_path(tag, test=False):
        data_directory = os.path.join(
            os.path.abspath(os.path.dirname(__file__)),
            '..',
            'data',
            )
        if Bootstrapper.is_test or test:
            glob_pattern = 'discogs_test_{}s.xml.gz'.format(tag)
        else:
            glob_pattern = 'discogs_2*_{}s.xml.gz'.format(tag)
        with systemtools.TemporaryDirectoryChange(data_directory):
            files = sorted(glob.glob(glob_pattern))
        return os.path.join(data_directory, files[-1])

    @staticmethod
    def clean_elements(elements):
        for element in elements:
            image_tags = element.findall('images')
            if image_tags:
                element.remove(*image_tags)
            #url_tags = element.findall('urls')
            #if url_tags:
            #    element.remove(*url_tags)
            yield element

    @staticmethod
    def parse_release_date(date_string):
        # empty string
        if not date_string:
            return None
        # yyyy-mm-dd
        match = Bootstrapper.date_regex.match(date_string)
        if match:
            year, month, day = match.groups()
            return Bootstrapper.validate_release_date(year, month, day)
        # yyyymmdd
        match = Bootstrapper.date_no_dashes_regex.match(date_string)
        if match:
            year, month, day = match.groups()
            return Bootstrapper.validate_release_date(year, month, day)
        # yyyy
        match = Bootstrapper.year_regex.match(date_string)
        if match:
            year, month, day = match.group(), '1', '1'
            return Bootstrapper.validate_release_date(year, month, day)
        # other: "?", "????", "None", "Unknown"
        return None

    @staticmethod
    def element_to_datetime(element):
        if element is None:
            return None
        date_string = element.text.strip()
        return Bootstrapper.parse_release_date(date_string)

    @staticmethod
    def element_to_integer(element):
        if element is not None:
            return int(element.text)
        return None

    @staticmethod
    def element_to_string(element):
        if element is not None:
            return element.text or None
        return None

    @staticmethod
    def element_to_strings(element):
        if element is not None and len(element):
            return [_.text for _ in element]
        return None

    @staticmethod
    def get_iterator(tag):
        file_path = Bootstrapper.get_xml_path(tag)
        file_pointer = gzip.GzipFile(file_path, 'r')
        iterator = Bootstrapper.iterparse(file_pointer, tag)
        iterator = Bootstrapper.clean_elements(iterator)
        return iterator

    @staticmethod
    def iterparse(source, tag):
        context = ElementTree.iterparse(
            source,
            events=('start', 'end',),
            )
        context = iter(context)
        _, root = next(context)
        depth = 0
        for event, element in context:
            if element.tag == tag:
                if event == 'start':
                    depth += 1
                else:
                    depth -= 1
                    if depth == 0:
                        yield element
                        root.clear()

    @staticmethod
    def prettify(element):
        string = ElementTree.tostring(element, 'utf-8')
        reparsed = minidom.parseString(string)
        return reparsed.toprettyxml(indent='    ')

    @staticmethod
    def validate_release_date(year, month, day):
        try:
            year = int(year)
            if month.isdigit():
                month = int(month)
            if month < 1:
                month = 1
            if day.isdigit():
                day = int(day)
            if day < 1:
                day = 1
            if 12 < month:
                day, month = month, day
            date = datetime.datetime(year, month, 1, 0, 0)
            day_offset = day - 1
            date = date + datetime.timedelta(days=day_offset)
        except ValueError:
            traceback.print_exc()
            print('BAD DATE:', year, month, day)
            date = None
        return date


text:
package tests.login;

import leap.lang.json.JSON;
import leap.oauth2.proxy.XForwardedResolver;
import org.junit.Test;
import tests.OAuth2TestBase;

import java.util.Map;

public class ProxyServerTest extends OAuth2TestBase {

    @Test
    public void testProxyRequest(){
        String json = client().request("/app1/proxy_server")
                .addHeader(XForwardedResolver.X_FORWARDED_FOR,"127.0.0.1")
                .addHeader(XForwardedResolver.X_FORWARDED_SERVER,"www.leap.com")
                .addHeader(XForwardedResolver.X_FORWARDED_HOST,"www.leap.org")
                .addHeader(XForwardedResolver.X_FORWARDED_PROTOCOL,"https")
                .get().getContent();
        Map<String, Object> map = JSON.decode(json);

        assertEquals("true",map.get("isProxy"));
        assertEquals("https://www.leap.org/app1",map.get("host"));
        assertEquals("www.leap.com",map.get("serverName"));
        assertEquals("https",map.get("protocol"));
        assertEquals("127.0.0.1",map.get("ip"));
    }

}


text:
var muting = (function () {

var exports = {};

var muted_topics = new Dict({fold_case: true});

exports.mute_topic = function (stream, topic) {
    var sub_dict = muted_topics.get(stream);
    if (!sub_dict) {
        sub_dict = new Dict({fold_case: true});
        muted_topics.set(stream, sub_dict);
    }
    sub_dict.set(topic, true);
};

exports.unmute_topic = function (stream, topic) {
    var sub_dict = muted_topics.get(stream);
    if (sub_dict) {
        sub_dict.del(topic);
    }
};

exports.is_topic_muted = function (stream, topic) {
    if (stream === undefined) {
        return false;
    }
    var sub_dict = muted_topics.get(stream);
    return sub_dict && sub_dict.get(topic);
};

exports.get_muted_topics = function () {
    var topics = [];
    muted_topics.each(function (sub_dict, stream) {
        _.each(sub_dict.keys(), function (topic) {
            topics.push([stream, topic]);
        });
    });
    return topics;
};

exports.set_muted_topics = function (tuples) {
    muted_topics = new Dict({fold_case: true});

    _.each(tuples, function (tuple) {
        var stream = tuple[0];
        var topic = tuple[1];

        exports.mute_topic(stream, topic);
    });
};

return exports;
}());
if (typeof module !== 'undefined') {
    module.exports = muting;
}