text:
package org.rbudzko.persistence

import java.util.UUID

import akka.actor.{ActorSystem, Props}
import akka.camel.CamelExtension
import com.fasterxml.jackson.annotation.{JsonIgnoreProperties, JsonProperty}
import org.apache.camel.Exchange
import org.apache.camel.builder.RouteBuilder
import org.apache.camel.model.dataformat.JsonLibrary

/**
 * Main class to setup actor system.
 */
object Main extends App {
  if (args.length != 4)
    throw new IllegalArgumentException("Expected 4 arguments: consumer key, consumer secret, token key and token secret.")

  val configuration = TwitterConfiguration(args(0), args(1), args(2), args(3))
  val system = ActorSystem()

  CamelExtension(system)
    .context
    .addRoutes(
      new RouteBuilder() {
        override def configure() {
          from("jetty:http://0.0.0.0:9000/aggregator")
            .id("twitter-searcher-" + UUID.randomUUID.toString)
            .onException(classOf[Exception])
            .handled(true)
            .transform(constant(AggregationResponse("Bad Request", "unknown")))
            .marshal().json(JsonLibrary.Jackson)
            .setHeader(Exchange.HTTP_RESPONSE_CODE, constant("400"))
            .end()
            .unmarshal().json(JsonLibrary.Jackson, classOf[AggregationRequest])
            .to("direct-vm://twitter-searcher")

          from("jetty:http://0.0.0.0:9000/viewer")
            .id("twitter-viewer-" + UUID.randomUUID.toString)
            .onException(classOf[Exception])
            .handled(true)
            .transform(constant(AggregationResponse("Bad Request", "unknown")))
            .marshal().json(JsonLibrary.Jackson)
            .setHeader(Exchange.HTTP_RESPONSE_CODE, constant("400"))
            .end()
            .unmarshal().json(JsonLibrary.Jackson, classOf[ViewerRequest])
            .to("direct-vm://twitter-searcher")
            .marshal().json(JsonLibrary.Jackson)
        }
      })

  system.actorOf(
    Props(classOf[TwitterSearcher], "direct-vm://twitter-searcher", configuration),
    "twitter-searcher")
}

@JsonIgnoreProperties(ignoreUnknown = true)
case class AggregationRequest(@JsonProperty("phrase") phrase: String) {
  val identifier: String = UUID.randomUUID.toString

  @JsonProperty("phrase")
  def getPhrase: String = phrase

  @JsonProperty("identifier")
  def getIdentifier: String = identifier
}

@JsonIgnoreProperties(ignoreUnknown = true)
case class ViewerRequest(@JsonProperty("phrase") name: String) {
  val identifier: String = UUID.randomUUID.toString

  @JsonProperty("name")
  def getName: String = name

  @JsonProperty("identifier")
  def getIdentifier: String = identifier
}

@JsonIgnoreProperties(ignoreUnknown = true)
case class AggregationResponse(@JsonProperty("description") description: String,
                               @JsonProperty("identifier") identifier: String) {
  @JsonProperty("description")
  def getDescription: String = description

  @JsonProperty("identifier")
  def getIdentifier: String = identifier
}

@JsonIgnoreProperties(ignoreUnknown = true)
case class ViewerResponse(@JsonProperty("phrase") name: String,
                          @JsonProperty("identifier") identifier: String,
                          @JsonProperty("retweets") retweets: Long,
                          @JsonProperty("favorites") favorites: Long) {

  @JsonProperty("name")
  def getName: String = name

  @JsonProperty("identifier")
  def getIdentifier: String = identifier

  @JsonProperty("retweets")
  def getRetweets: Long = retweets

  @JsonProperty("favorites")
  def getFavorites: Long = favorites
}


text:
package org.chocosolver.solver.variables;

import org.chocosolver.choco.checker.DomainBuilder;
import org.chocosolver.solver.Solver;
import org.chocosolver.solver.constraints.IntConstraintFactory;
import org.chocosolver.solver.constraints.LogicalConstraintFactory;
import org.chocosolver.solver.constraints.SatFactory;
import org.chocosolver.solver.constraints.nary.cnf.LogOp;
import org.chocosolver.solver.search.strategy.IntStrategyFactory;
import org.testng.Assert;
import org.testng.annotations.Test;

import java.util.Random;

/**
 * <br/>
 *
 * @author Charles Prud'homme
 * @since 23/08/11
 */
public class MaxViewTest {

    public void maxref(Solver solver, IntVar x, IntVar y, IntVar z) {
        BoolVar[] bs = VariableFactory.boolArray("b", 3, solver);
        LogicalConstraintFactory.ifThenElse(bs[0], IntConstraintFactory.arithm(z, "=", x), IntConstraintFactory.arithm(z, "!=", x));
        LogicalConstraintFactory.ifThenElse(bs[1], IntConstraintFactory.arithm(z, "=", y), IntConstraintFactory.arithm(z, "!=", y));
        LogicalConstraintFactory.ifThenElse(bs[2], IntConstraintFactory.arithm(x, ">=", y), IntConstraintFactory.arithm(x, "<", y));
        SatFactory.addClauses(LogOp.or(LogOp.and(bs[0], bs[2]),
                LogOp.and(bs[1], bs[2].not())), solver);
    }

    public void max(Solver solver, IntVar x, IntVar y, IntVar z) {
        solver.post(IntConstraintFactory.maximum(z, x, y));
    }

    @Test(groups = "10s")
    public void testMax1() {
        Random random = new Random();
        for (int seed = 1; seed < 9999; seed++) {
            random.setSeed(seed);
            int[][] domains = DomainBuilder.buildFullDomains(3, 1, 15);
            Solver ref = new Solver();
            {
                IntVar[] xs = new IntVar[3];
                xs[0] = VariableFactory.bounded("x", domains[0][0], domains[0][1], ref);
                xs[1] = VariableFactory.bounded("y", domains[1][0], domains[1][1], ref);
                xs[2] = VariableFactory.bounded("z", domains[2][0], domains[2][1], ref);
                maxref(ref, xs[0], xs[1], xs[2]);
//                SearchMonitorFactory.log(ref, true, true);
                ref.set(IntStrategyFactory.random_bound(xs, seed));
            }
            Solver solver = new Solver();
            {
                IntVar[] xs = new IntVar[3];
                xs[0] = VariableFactory.bounded("x", domains[0][0], domains[0][1], solver);
                xs[1] = VariableFactory.bounded("y", domains[1][0], domains[1][1], solver);
                xs[2] = VariableFactory.bounded("z", domains[1][0], domains[2][1], solver);
                max(solver, xs[0], xs[1], xs[2]);
//                SearchMonitorFactory.log(solver, true, true);
                solver.set(IntStrategyFactory.random_bound(xs, seed));
            }
            ref.findAllSolutions();
            solver.findAllSolutions();
            Assert.assertEquals(solver.getMeasures().getSolutionCount(), ref.getMeasures().getSolutionCount(), "SOLUTIONS (" + seed + ")");
            Assert.assertTrue(solver.getMeasures().getNodeCount() <= ref.getMeasures().getNodeCount(), "NODES (" + seed + ")");
        }
    }

    @Test(groups = "10s")
    public void testMax2() {
        Random random = new Random();
        for (int seed = 169; seed < 9999; seed++) {
            random.setSeed(seed);
            int[][] domains = DomainBuilder.buildFullDomains(3, 1, 15, random, random.nextDouble(), random.nextBoolean());
            Solver ref = new Solver();
            {
                IntVar[] xs = new IntVar[3];
                xs[0] = VariableFactory.enumerated("x", domains[0], ref);
                xs[1] = VariableFactory.enumerated("y", domains[1], ref);
                xs[2] = VariableFactory.enumerated("z", domains[2], ref);
                maxref(ref, xs[0], xs[1], xs[2]);
//                SearchMonitorFactory.log(ref, true, true);
                ref.set(IntStrategyFactory.random_value(xs, seed));
            }
            Solver solver = new Solver();
            {
                IntVar[] xs = new IntVar[3];
                xs[0] = VariableFactory.enumerated("x", domains[0], solver);
                xs[1] = VariableFactory.enumerated("y", domains[1], solver);
                xs[2] = VariableFactory.enumerated("z", domains[2], solver);
                max(solver, xs[0], xs[1], xs[2]);
//                SearchMonitorFactory.log(solver, true, true);
                solver.set(IntStrategyFactory.random_value(xs, seed));
            }
            ref.findAllSolutions();
            solver.findAllSolutions();
            Assert.assertEquals(solver.getMeasures().getSolutionCount(), ref.getMeasures().getSolutionCount(), "SOLUTIONS (" + seed + ")");
            // BEWARE: MAX does not ensure AC, unlike reformulation; so nb of nodes can be different...
//            Assert.assertTrue(solver.getMeasures().getNodeCount() <= ref.getMeasures().getNodeCount(), "NODES (" + seed + "): "
//                    + solver.getMeasures().getNodeCount() + " vs. " + ref.getMeasures().getNodeCount());
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using Autofac;
using Moq;
using NUnit.Framework;
using Orchard.Caching;
using Orchard.ContentManagement;
using Orchard.ContentManagement.FieldStorage;
using Orchard.ContentManagement.FieldStorage.InfosetStorage;
using Orchard.ContentManagement.Handlers;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Services;
using Orchard.ContentManagement.Records;
using Orchard.Core.Settings.Metadata;
using Orchard.Data;
using Orchard.Environment;
using Orchard.Projections.Handlers;
using Orchard.Projections.Models;
using Orchard.Projections.Services;
using Orchard.Tests;
using Orchard.Tests.Stubs;
using Orchard.UI.PageClass;

namespace Orchard.Projections.Tests.Services {
    [TestFixture]
    public class FieldIndexServiceTests : DatabaseEnabledTestsBase {
        private IFieldIndexService _service;
        private IContentManager _contentManager;

        public override void Register(ContainerBuilder builder) {

            builder.RegisterType<StubWorkContextAccessor>().As<IWorkContextAccessor>();
            builder.RegisterType<FieldIndexPartHandler>().As<IContentHandler>();
            builder.RegisterType<OrchardServices>().As<IOrchardServices>();
            builder.RegisterType<DefaultContentManager>().As<IContentManager>();
            builder.RegisterType<FieldIndexService>().As<IFieldIndexService>();
            builder.RegisterType<ThingHandler>().As<IContentHandler>();
            builder.RegisterType<FieldIndexPartHandler>().As<IContentHandler>();
            builder.RegisterType<InfosetStorageProvider>().As<IFieldStorageProvider>();

            // ContentDefinitionManager
            builder.RegisterType<ContentDefinitionManager>().As<IContentDefinitionManager>();
            builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
            builder.RegisterInstance(new Mock<IPageClassBuilder>().Object);
            builder.RegisterType<DefaultContentDisplay>().As<IContentDisplay>();
            builder.RegisterType<StubCacheManager>().As<ICacheManager>();
            builder.RegisterType<Signals>().As<ISignals>();
            builder.RegisterType(typeof(SettingsFormatter)).As<ISettingsFormatter>();

            builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
        }

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

            _service = _container.Resolve<IFieldIndexService>();
            _contentManager = _container.Resolve<IContentManager>();
        }

        protected override IEnumerable<Type> DatabaseTypes {
            get {
                return new[] {
                    typeof(ContentItemRecord),
                    typeof(ContentItemVersionRecord),
                    typeof(ContentTypeRecord),

                    typeof(FieldIndexPartRecord),

                    typeof(StringFieldIndexRecord),
                    typeof(IntegerFieldIndexRecord),
                    typeof(DecimalFieldIndexRecord),
                    typeof(DoubleFieldIndexRecord)
                };
            }
        }

        [Test]
        public void StringValuesShouldBePersisted() {
            SaveObject<string>(null);
            SaveObject("");
            SaveObject("Bar");
        }

        [Test]
        public void IntegerValuesShouldBePersisted() {
            SaveObject<int?>(null);
            SaveObject(0);
            SaveObject(-42);
            SaveObject(42);
            SaveObject(long.MaxValue);
            SaveObject(long.MinValue);
        }

        [Test]
        public void DateTimeValuesShouldBePersisted() {
            SaveObject<DateTime?>(null);
            SaveObject(DateTime.MinValue);
            SaveObject(DateTime.MaxValue);
            SaveObject(DateTime.Now);
        }

        [Test]
        public void BooleanValuesShouldBePersisted() {
            SaveObject<bool?>(null);
            SaveObject(true);
            SaveObject(false);
        }

        [Test]
        public void DecimalValuesShouldBePersisted() {
            SaveObject<decimal?>(null);
            SaveObject(0m);
            SaveObject(-42m);
            SaveObject(42m);
            // SaveObject(decimal.MaxValue);
            // SaveObject(decimal.MinValue);
        }

        [Test, Ignore("SqlCe exception")]
        public void EdgeDecimalValuesShouldBePersisted() {
            SaveObject(decimal.MaxValue);
            SaveObject(decimal.MinValue);
        }

        [Test]
        public void DoubleValuesShouldBePersisted() {
            SaveObject<double?>(null);
            SaveObject(0D);
            SaveObject(-42D);
            SaveObject(42D);
            SaveObject(double.MaxValue);
            SaveObject(double.MinValue);
        }

        [Test]
        public void FloatValuesShouldBePersisted() {
            SaveObject<float?>(null);
            SaveObject(0F);
            SaveObject(-42F);
            SaveObject(42F);
            SaveObject(float.MaxValue);
            SaveObject(float.MinValue);
        }

        [Test]
        public void CharValuesShouldBePersisted() {
            SaveObject<char?>(null);
            SaveObject('a');
            SaveObject('ê');
        }

        private void SaveObject<T>(T fieldValue) {
            var thing = _contentManager.New("thing");
            _contentManager.Create(thing);

            _service.Set(thing.As<FieldIndexPart>(), "Foo", "Bar", "Baz", fieldValue, typeof(T));

            ClearSession();

            var thing2 = _contentManager.Get(thing.Id);
            var value = _service.Get<T>(thing2.As<FieldIndexPart>(), "Foo", "Bar", "Baz");

            Assert.That(value, Is.EqualTo(fieldValue));
        }

        public class ThingHandler : ContentHandler {
            public ThingHandler() {
                Filters.Add(new ActivatingFilter<Thing>("thing"));
                Filters.Add(new ActivatingFilter<FieldIndexPart>("thing"));
            }
        }

        public class Thing : ContentPart {
        }
    }
}


text:
Hello GitHub!!!

example!!!1


text:
script_full_path=`readlink -e "$0"`
script_name=`basename "$0"`

if [ $# -ne 2 ]
then
   echo "usage: $script_name msg_string file_path"
   exit 1
fi

msg_string="$1"
output_file="$2"

trap "echo -e \"$script_name:\t$$ terminated\"; rm -f $output_file; exit" SIGKILL SIGTERM SIGINT
trap "echo -e \"$script_name:\t$$ SIGUSR1\"" SIGUSR1

echo -e "$script_name:\twriting to file $output_file from pid $$"
while :
do
    echo "$msg_string" >> $output_file
done


text:
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">

<base th:href="@{/}" href="">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<title>立衡脊柱-后台管理登录</title>
<link rel="stylesheet" type="text/css" th:href="@{/lib/semantic/semantic.min.css}"
	href="../../static/lib/semantic/semantic.min.css" />
<link rel="stylesheet" type="text/css" th:href="@{/admin/css/admin.css}" href="../../static/admin/css/admin.css" />

			 用户登录

		<form th:action="@{/admin/signin}" action="" method="post">

错误信息

用户名密码错误

您已经退出登录

						<input type="text" id="username" name="username" placeholder="用户名" />

						 <input type="password" id="password" name="password" placeholder="密码" />

					<button type="submit" class="ui submit button">登录</button>

		</form>


text:
package com.service.handler;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.service.holder.RepoServiceType;
import com.service.oauth.OAuthClientManager;

public class RepoServiceFactory {

    private Context context;
    private OAuthClientManager requester;

    public RepoServiceFactory(@NonNull Context context, @Nullable OAuthClientManager clientManager) {
        this.context = context;
        this.requester = clientManager;
    }

    @Nullable
    public RepoServiceHandler create(@RepoServiceType int service){
        switch (service){
            case RepoServiceType.GITHUB:
                return new GitHubServiceHandler(context, requester);
            case RepoServiceType.BITBUCKET:
                return new BitBucketServiceHandler(context, requester);
        }
        return null;
    }
}


text:
<-Back

<ng-template ngIf="followUps >=1; else none">

          {{i.firstName}} {{i.lastName}}
          ({{i.program}} - {{i.requestDate}})

          {{i.request}}

        <button class="btn btn-primary">Follow-up</button>
        <button class="btn">Discard</button>

</ng-template>

<ng-template #none>

You have no new students to follow-up

Click the button to start a conversation.

      <button class="btn btn-primary"> Send a message</button>

</ng-template>


text:
"""This file contains a plugin for cron syslog entries."""

import pyparsing

from plaso.lib import errors
from plaso.parsers import syslog
from plaso.parsers.syslog_plugins import interface

class CronTaskRunEventData(syslog.SyslogLineEventData):
  """Cron task run event data.

  Attributes:
    command (str): command executed.
    last_written_time (dfdatetime.DateTimeValues): entry last written date and
        time.
    username (str): name of user the command was executed.
  """

  DATA_TYPE = 'syslog:cron:task_run'

  def __init__(self):
    """Initializes event data."""
    super(CronTaskRunEventData, self).__init__(data_type=self.DATA_TYPE)
    self.command = None
    self.last_written_time = None
    self.username = None

class CronSyslogPlugin(interface.SyslogPlugin):
  """A syslog plugin for parsing cron messages."""

  NAME = 'cron'
  DATA_FORMAT = 'Cron syslog line'

  REPORTER = 'CRON'

  _USERNAME = (
      pyparsing.Literal('(') +
      pyparsing.Word(pyparsing.alphanums).setResultsName('username') +
      pyparsing.Literal(')'))

  _COMMAND = (
      pyparsing.Literal('CMD') + pyparsing.Literal('(') +
      pyparsing.Combine(pyparsing.SkipTo(
          pyparsing.Literal(')') +
          pyparsing.StringEnd())).setResultsName('command') +
      pyparsing.Literal(')'))

  _TASK_RUN = _USERNAME + _COMMAND + pyparsing.StringEnd()

  MESSAGE_GRAMMARS = [('task_run', _TASK_RUN)]

  _SUPPORTED_KEYS = frozenset([key for key, _ in MESSAGE_GRAMMARS])

  def _ParseMessage(self, parser_mediator, key, date_time, tokens):
    """Parses a syslog body that matched one of defined grammars.

    Args:
      parser_mediator (ParserMediator): mediates interactions between parsers
          and other components, such as storage and dfVFS.
      key (str): name of the matching grammar.
      date_time (dfdatetime.DateTimeValues): date and time values.
      tokens (dict[str, str]): tokens derived from a syslog message based on
          the defined grammar.

    Raises:
      ParseError: when the structure type is unknown.
    """
    if key not in self._SUPPORTED_KEYS:
      raise errors.ParseError(
          'Unable to parse message, unknown structure: {0:s}'.format(key))

    event_data = CronTaskRunEventData()
    event_data.body = tokens.get('body', None)
    event_data.command = tokens.get('command', None)
    event_data.hostname = tokens.get('hostname', None)
    event_data.last_written_time = date_time
    event_data.pid = tokens.get('pid', None)
    event_data.reporter = tokens.get('reporter', None)
    event_data.severity = tokens.get('severity', None)
    event_data.username = tokens.get('username', None)

    parser_mediator.ProduceEventData(event_data)

syslog.SyslogParser.RegisterPlugin(CronSyslogPlugin)


text:
//https://github.com/thad/ExampleFindFirstResponder

#import <UIKit/UIKit.h>

@interface UIResponder (FirstResponder)
/**
 *  @brief  当前第一响应者
 *
 *  @return 当前第一响应者
 */
+ (id)currentFirstResponder;

@end


text:
import _typeof from "next/dist/compiled/@babel/runtime/helpers/typeof";
import assertThisInitialized from "./assertThisInitialized.js";
export default function _possibleConstructorReturn(self, call) {
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
    return call;
  } else if (call !== void 0) {
    throw new TypeError("Derived constructors may only return object or undefined");
  }

  return assertThisInitialized(self);
}


text:
<?php

class gridPdfGenerator {

	public $minOffsetTop = 10;
	public $minOffsetBottom = 10;
	public $minOffsetLeft = 10;
	public $minOffsetRight = 10;
	public $headerHeight = 7;
	public $rowHeight = 5;
	public $minColumnWidth = 13;
	public $pageNumberHeight = 10;
	public $fontSize = 8;
	public $dpi = 96;
	public $strip_tags = false;

	public $bgColor = 'D1E5FE';
	public $lineColor = 'A4BED4';
	public $headerTextColor = '000000';
	public $scaleOneColor = 'FFFFFF';
	public $scaleTwoColor = 'E3EFFF';
	public $gridTextColor = '000000';
	public $pageTextColor = '000000';
    public $filename = '';
	public $footerImgHeight = 50;
	public $headerImgHeight = 50;
	public $lang = Array('a_meta_charset' => 'UTF-8', 'a_meta_dir' => 'ltr', 'a_meta_language' => 'en', 'w_page' => 'Page');

	private $orientation = 'L';
	private $columns = Array();
	private $rows = Array();
	private $summaryWidth;
	private $profile;
	private $header = false;
	private $footer = false;
	private $headerFile;
	private $footerFile;
	private $pageHeader = false;
	private $pageFooter = false;
	private $coll_options = Array();
	private $hiddenCols = Array();

	// print grid
	public function printGrid($xml) {
		$this->headerParse($xml->head);
		$this->footerParse($xml->foot);
		$this->mainParse($xml);
		$this->collectionsParse($xml->coll_options);
		$this->rowsParse($xml->row);
		$this->printGridPdf();
	}

	// sets colors according profile
	private function setProfile() {
		switch ($this->profile) {
			case 'color':
				$this->bgColor = 'D1E5FE';
				$this->lineColor = 'A4BED4';
				$this->headerTextColor = '000000';
				$this->scaleOneColor = 'FFFFFF';
				$this->scaleTwoColor = 'E3EFFF';
				$this->gridTextColor = '000000';
				$this->pageTextColor = '000000';
				break;
			case 'gray':
				$this->bgColor = 'E3E3E3';
				$this->lineColor = 'B8B8B8';
				$this->headerTextColor = '000000';
				$this->scaleOneColor = 'FFFFFF';
				$this->scaleTwoColor = 'EDEDED';
				$this->gridTextColor = '000000';
				$this->pageTextColor = '000000';
				break;
			case 'bw':
				$this->bgColor = 'FFFFFF';
				$this->lineColor = '000000';
				$this->headerTextColor = '000000';
				$this->scaleOneColor = 'FFFFFF';
				$this->scaleTwoColor = 'FFFFFF';
				$this->gridTextColor = '000000';
				$this->pageTextColor = '000000';
				break;
		}
	}

	// parses main settings
	private function mainParse($xml) {
		$this->profile = (string) $xml->attributes()->profile;
		if ($xml->attributes()->header) {
			$this->header = (string) $xml->attributes()->header;
		}
		if ($xml->attributes()->footer) {
			$this->footer = (string) $xml->attributes()->footer;
		}
		if ($xml->attributes()->pageheader) {
			$this->pageHeader = (string) $xml->attributes()->pageheader;
		}
		if ($xml->attributes()->pagefooter) {
			$this->pageFooter = $xml->attributes()->pagefooter;
		}

		if (100/count($this->widths) < $this->minColumnWidth) {
			$this->orientation = 'L';
		}

		if ($xml->attributes()->orientation) {
			if ($xml->attributes()->orientation == 'landscape') {
				$this->orientation = 'L';
			} else {
				$this->orientation = 'P';
			}
		}
		$this->setProfile();
	}

	// parses grid header
	private function headerParse($header) {
		if (isset($header->column)) {
			$columnsRows = Array($header->column);
		} else {
			$columnsRows = $header->columns;
		}
		$i = 0;
		foreach ($columnsRows as $columns) {
			$summaryWidth = 0;
			$k = 0;

			foreach ($columns as $column) {
				$columnArr = Array();
				$columnArr['hidden'] = ($column->attributes()->hidden == 'true') ? true : false;
				if ($columnArr['hidden'] == true) {
					$this->hiddenCols[$k] = true;
					$k++;
					continue;
				}
				if ($this->strip_tags == true) {
					$columnArr['text'] = strip_tags(trim((string) $column));
				} else {
					$columnArr['text'] = trim((string) $column);
				}
				$columnArr['width'] = trim((string) $column->attributes()->width);
				$columnArr['type'] = trim((string) $column->attributes()->type);
				$columnArr['align'] = trim((string) $column->attributes()->align);
				$columnArr['colspan'] = trim((string) $column->attributes()->colspan);
				$columnArr['rowspan'] = trim((string) $column->attributes()->rowspan);
				$summaryWidth += $columnArr['width'];
				$this->columns[$i][] = $columnArr;
				if ($i == 0) {
					$widths[] = $columnArr['width'];
				}
				if ($columnArr['colspan'] != '') {
					$columnArr['width'] = 0;
				}
				$k++;
			}
			$this->columns[$i]['width'] = $summaryWidth;
			if ($i == 0) {
				$this->summaryWidth = $summaryWidth;
			}
			$i++;
		}

		for ($i = 0; $i < count($this->columns); $i++) {
			$offset = 0;
			for ($j = 0; $j < count($widths); $j++) {
				if ($this->columns[$i][$j]['colspan'] != '') {
					$w = $widths[$j];
					for ($k = 1; $k < $this->columns[$i][$j]['colspan']; $k++) {
						$w += $widths[$j + $k];
						$this->columns[$i][$j + $k]['width'] = 0;
					}
					$this->columns[$i][$j]['width'] = $w;
					$j += $this->columns[$i][$j]['colspan'] - 1;
				} else {
					$this->columns[$i][$j]['width'] = $widths[$j];
				}
			}
		}

		for ($i = 0; $i < count($this->columns); $i++) {
			for ($j = 0; $j < count($widths); $j++) {
				if ((isset($this->columns[$i][$j]))&&($this->columns[$i][$j]['rowspan'] != '')&&(!isset($this->columns[$i][$j]['rowspanPos']))) {
					for ($k = 1; $k < $this->columns[$i][$j]['rowspan']; $k++) {
						$this->columns[$i + $k][$j]['rowspanPos'] = $this->columns[$i][$j]['rowspan'] - $k;
						$this->columns[$i + $k][$j]['rowspan'] = $this->columns[$i][$j]['rowspan'];
					}
					$this->columns[$i][$j]['rowspanPos'] = 'top';
				}
			}
		}
		$this->widths = $widths;
	}

	// parses grid footer
	private function footerParse($footer) {
		if (isset($footer->columns)) {
			$this->footerColumns = Array();
			$columnsRows = $footer->columns;
			$i = 0;
			foreach ($columnsRows as $columns) {
				$summaryWidth = 0;
				$j = 0;
				foreach ($columns as $column) {
					$columnArr = Array();
					if ($this->strip_tags == true) {
						$columnArr['text'] = strip_tags(trim((string) $column));
					} else {
						$columnArr['text'] = trim((string) $column);
					}
					$columnArr['width'] = isset($this->columns[0][$j]['width']) ? $this->columns[0][$j]['width'] : 1;
					$columnArr['type'] = trim((string) $column->attributes()->type);
					$columnArr['align'] = trim((string) $column->attributes()->align);
					$columnArr['colspan'] = trim((string) $column->attributes()->colspan);
					$columnArr['rowspan'] = trim((string) $column->attributes()->rowspan);
					$summaryWidth += $columnArr['width'];
					$this->footerColumns[$i][] = $columnArr;
					if ($columnArr['colspan'] != '') {
						$columnArr['width'] = 0;
					}
					$j++;
				}
				$this->footerColumns[$i]['width'] = $summaryWidth;
				$i++;
			}

			for ($i = 0; $i < count($this->footerColumns); $i++) {
				$offset = 0;
				for ($j = 0; $j < count($this->widths); $j++) {
					if ($this->footerColumns[$i][$j]['colspan'] != '') {
						$w = $this->widths[$j];
						for ($k = 1; $k < $this->footerColumns[$i][$j]['colspan']; $k++) {
							$w += $this->widths[$j + $k];
							$this->footerColumns[$i][$j + $k]['width'] = 0;
						}
						$this->footerColumns[$i][$j]['width'] = $w;
						$j += $this->footerColumns[$i][$j]['colspan'] - 1;
					} else {
						$this->footerColumns[$i][$j]['width'] = $this->widths[$j];
					}
				}
			}

			for ($i = 0; $i < count($this->footerColumns); $i++) {
				for ($j = 0; $j < count($this->widths); $j++) {
					if (($this->footerColumns[$i][$j]['rowspan'] != '')&&(!isset($this->footerColumns[$i][$j]['rowspanPos']))) {
						for ($k = 1; $k < $this->footerColumns[$i][$j]['rowspan']; $k++) {
							$this->footerColumns[$i + $k][$j]['rowspanPos'] = $this->footerColumns[$i][$j]['rowspan'] - $k;
							$this->footerColumns[$i + $k][$j]['rowspan'] = $this->footerColumns[$i][$j]['rowspan'];
						}
						$this->footerColumns[$i][$j]['rowspanPos'] = 'top';
					}
				}
			}

		} else {
			$this->footerColumns = false;
		}
	}

	private function collectionsParse($coll_options) {
		for ($i = 0; $i < count($coll_options); $i++) {
			$index = (int) $coll_options[$i]->attributes()->for;
			$this->coll_options[$index] = Array();
			for ($j = 0; $j < count($coll_options[$i]->item); $j++) {
				$item = $coll_options[$i]->item[$j];
				$value = (string) $item->attributes()->value;
				$label = (string) $item->attributes()->label;
				$this->coll_options[$index][$value] = $label;
			}
		}
	}

	// parses rows
	private function rowsParse($rows) {
		$i = 0;
		foreach ($rows as $row) {
			$rowArr = Array();
			$cells = $row->cell;
			$k = 0;
			foreach ($cells as $cell) {
				if (isset($this->hiddenCols[$k])) {
					$k++;
					continue;
				}
				$cell_p = Array();
				if ($this->strip_tags == true) {
					if (isset($this->coll_options[$k][trim((string) $cell)]))
						$cell_p['text'] = strip_tags($this->coll_options[$k][trim((string) $cell)]);
					else
						$cell_p['text'] = strip_tags(trim((string) $cell));
				} else {
					if (isset($this->coll_options[$k][trim((string) $cell)]))
						$cell_p['text'] = $this->coll_options[$k][trim((string) $cell)];
					else
						$cell_p['text'] = trim((string) $cell);
				}
				if (isset($cell->attributes()->bgColor)) {
					$cell_p['bg'] = (string) $cell->attributes()->bgColor;
				} else {
					$color = ($i%2 == 0) ? $this->scaleOneColor : $this->scaleTwoColor;
					$cell_p['bg'] = $color;
				}
				if (isset($cell->attributes()->textColor)) {
					$cell_p['textColor'] = (string) $cell->attributes()->textColor;
				} else {
					$cell_p['textColor'] = $this->gridTextColor;
				}
				$cell_p['bold'] = (isset($cell->attributes()->bold) && $cell->attributes()->bold == 'bold') ? true : false;
				$cell_p['italic'] = (isset($cell->attributes()->italic) && $cell->attributes()->italic == 'italic') ? true : false;
				$cell_p['align'] = isset($cell->attributes()->align) ? $cell->attributes()->align : false;
				$rowArr[] = $cell_p;
				$k++;
			}
			$this->rows[] = $rowArr;
			$i++;
		}
	}

	// returns header image name
	private function headerImgInit() {
		if (file_exists('./header.png')) {
			$this->headerFile = './header.png';
			return true;
		}
		$this->header = false;
		$this->pageHeader = false;
		return false;
	}

	// returns footer image name
	private function footerImgInit() {
		if (file_exists('./footer.png')) {
			$this->footerFile = './footer.png';
			return true;
		}
		$this->footer = false;
		$this->pageFooter = false;
		return false;
	}

	public function printGridPdf() {
		if (($this->header)||($this->pageHeader)) {
			$this->headerImgInit();
		}
		if (($this->footer)||($this->pageFooter)) {
			$this->footerImgInit();
		}

		// initials PDF-wrapper

		$this->wrapper = new gridPdfWrapper($this->minOffsetTop, $this->minOffsetRight, $this->minOffsetBottom, $this->minOffsetLeft, $this->orientation, $this->fontSize, $this->dpi, $this->lang);

		// checking if document will have one page
		$pageHeight = $this->wrapper->getPageHeight() - $this->minOffsetTop - $this->minOffsetBottom;
		if (($this->header)||($this->pageHeader)) {
			$pageHeight -= $this->headerImgHeight;
		}
		if (($this->footer)||($this->pageFooter)) {
			$pageHeight -= $this->footerImgHeight;
		}
		$numRows = floor(($pageHeight - $this->headerHeight)/$this->rowHeight);
		// denies page numbers if dpcument have one page
		if ($numRows >= count($this->rows)) {
			$this->wrapper->setNoPages();
		}

		$rows = Array();
		$pageNumber = 1;
		$startRow = 0;
		// circle for printing all pages
		while ($startRow < count($this->rows)) {
			$numRows = $this->printGridPage($startRow, $pageNumber);
			$startRow += $numRows;
			if ($numRows == 0) $startRow++;
			$pageNumber++;
		}

		// outputs PDF in browser
		if(isset($this->reportType))
			$this->wrapper->pdfOut($this->reportType,$this->filename);
		else
			$this->wrapper->pdfOut('',$this->filename);
	}

	// prints one page
	private function printGridPage($startRow, $pageNumber) {
		// adds new page
		$this->wrapper->addPage();

		// calculates top offset
		if ((($this->header)&&($pageNumber == 1))||($this->pageHeader)) {
			$offsetTop = $this->headerImgHeight;
		} else {
			$offsetTop = 0;
		}

		// calculates bottom offset
		if ($this->pageFooter) {
			$offsetBottom = $this->footerImgHeight;
		} else {
			$offsetBottom = 0;
		}

		// calculates page height without top and bottom offsets
		$pageHeight = $this->wrapper->getPageHeight() - $offsetTop - $offsetBottom - $this->minOffsetTop - $this->minOffsetTop;
		// calculates rows number on current page
		$numRows = floor(($pageHeight - $this->headerHeight*count($this->columns) - $this->headerHeight*count($this->footerColumns))/$this->rowHeight);
		// check if it's last page
		$lastPage = ((count($this->rows) - $startRow) <= $numRows);

		// prints footer if needs
//		if (($this->footer)&&($lastPage)) {
//			$offsetBottom = $this->footerImgHeight;
//		}

		$offsetRight = $this->minOffsetRight;
		$offsetLeft = $this->minOffsetLeft;
		// sets page offsets
		$this->wrapper->setPageSize($offsetTop, $offsetRight, $offsetBottom, $offsetLeft);

		// prints grid header
		$this->wrapper->headerDraw($this->headerHeight, $this->columns, $this->summaryWidth, $this->headerTextColor, $this->bgColor, $this->lineColor);
		// prints grid footer
		$this->wrapper->footerDraw($this->headerHeight, $this->footerColumns);
		// prints grid values
		$rowsNum = $this->wrapper->gridDraw($this->rowHeight, $this->rows, $this->widths, $startRow, $numRows, $this->scaleOneColor, $this->scaleTwoColor, $this->profile);

		// prints footer if needs
		if (($this->pageFooter)||((count($this->rows) <= $startRow + $rowsNum)&&($this->footer))) {
			$this->wrapper->drawImgFooter($this->footerFile, $this->footerImgHeight);
		}

		// prints header if needs
		if ((($this->header)&&($pageNumber == 1))||($this->pageHeader)) {
			$this->wrapper->drawImgHeader($this->headerFile, $this->headerImgHeight);
		}
		// returns number of printed rows ;
		return $rowsNum;
	}
}

?>


text:
// - Import react components
import moment from 'moment/moment'
import _ from 'lodash'
import { Map } from 'immutable'

// - Import domain
import { Notification } from 'src/core/domain/notifications'

// - Import action types
import { NotificationActionType } from 'constants/notificationActionType'

import { NotificationState } from './NotificationState'
import { INotificationAction } from './INotificationAction'

/**
 * Notify actions
 * @param {object} state
 * @param {object} action
 */
export let notificationReducer = (state = Map(new NotificationState()), action: INotificationAction) => {
  let { payload } = action
  switch (action.type) {

    /* _____________ CRUD _____________ */
    case NotificationActionType.ADD_NOTIFY:
      return state

    case NotificationActionType.ADD_NOTIFY_LIST:
    return state
    .set('userNotifies', payload)
    .set('loaded', true)

    case NotificationActionType.SEEN_NOTIFY:
    return state
    .setIn(['userNotifies', payload, 'isSeen'], true)
    .set('loaded', true)

    case NotificationActionType.DELETE_NOTIFY:
    return state
    .deleteIn(['userNotifies', payload])

    case NotificationActionType.CLEAR_ALL_DATA_NOTIFY:
      return Map(new NotificationState())

    default:
      return state

  }

}


text:
@class IOSClass;
@class IOSObjectArray;
@class JavaMethodMetadata;

// A native implementation of java.lang.reflect.Method.  Its methods are
// limited to those that can be derived from an Objective-C Method instance,
// so instances can be created and released as needed.
@interface JavaLangReflectMethod : ExecutableMember {
  jboolean isStatic_;
}

+ (instancetype)methodWithMethodSignature:(NSMethodSignature *)methodSignature
                                 selector:(SEL)selector
                                    class:(IOSClass *)aClass
                                 isStatic:(jboolean)isStatic
                                 metadata:(JavaMethodMetadata *)metadata;

// iOS version of Method.getReturnType();
- (IOSClass *)getReturnType;

// Returns type.
- (id<JavaLangReflectType>)getGenericReturnType;

// iOS version of Method.invoke().
//
// @param object the instance to invoke this method on, or if null,
//     the class that implements this method.
// @return the result of this invocation; if a primitive type is returned,
//     it is wrapped in a Foundation wrapper class instance.
- (NSObject *)invokeWithId:(id)object
         withNSObjectArray:(IOSObjectArray *)arguments;

// Faster version of Method.invoke() for JNI code. This does not require
// boxing arguments or unboxing the result. Methods that return void must pass
// NULL as the result pointer.
- (void)jniInvokeWithId:(id)object
                   args:(const J2ObjcRawValue *)args
                 result:(J2ObjcRawValue *)result;

// Returns default value.
- (id)getDefaultValue;

@end

J2OBJC_EMPTY_STATIC_INIT(JavaLangReflectMethod)

J2OBJC_TYPE_LITERAL_HEADER(JavaLangReflectMethod)

#endif // _JavaLangReflectMethod_H_


text:
//-----------------------------------------------------------------------
// <copyright file="Program.cs" company="Auralia">
//     Copyright (C) 2013 Auralia
// </copyright>
//-----------------------------------------------------------------------

namespace Auralia.NationStates.NationManager
{
    using System;
    using System.Windows.Forms;

    /// <summary>
    /// Represents the main class of the application.
    /// </summary>
    public static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using MyStudent;
class ExtractMarks
{
    static void Main()
    {
        List<Student> students = ListOfStudents.GetListOfSudents();
        var studentsIn2006 =
            from student in students
            where student.FN.ToString().EndsWith("06")
            select new
            {
                Fullname = string.Format("{0} {1}", student.FirstName, student.LastName),
                Marks = student.Marks
            };

        foreach (var st in studentsIn2006)
        {
            Console.Write("\nName: {0}\n Marks: ",
                st.Fullname);
            foreach (var mark in st.Marks)
            {
                Console.Write(" ({0}) ", mark);
            }
        }

    }
}


text:
package ch.difty.scipamato.core.persistence;

import java.util.List;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import ch.difty.scipamato.common.persistence.DefinitionProviderService;
import ch.difty.scipamato.common.persistence.paging.PaginationContext;
import ch.difty.scipamato.core.entity.newsletter.NewsletterNewsletterTopic;
import ch.difty.scipamato.core.entity.newsletter.NewsletterTopic;
import ch.difty.scipamato.core.entity.newsletter.NewsletterTopicDefinition;
import ch.difty.scipamato.core.entity.newsletter.NewsletterTopicFilter;

/**
 * Service Interface as gateway to manage persisting {@link NewsletterTopic} instances.
 *
 * @author Urs Joss
 */
public interface NewsletterTopicService
    extends DefinitionProviderService<NewsletterTopicDefinition, NewsletterTopicFilter> {

    /**
     * Find the localized {@link NewsletterTopic}s
     *
     * @param languageCode
     *     the language code, e.g. 'en' or 'de'
     * @return a list of newsletterAssociation topics
     */
    @NotNull
    List<NewsletterTopic> findAll(@NotNull String languageCode);

    /**
     * Finds a page full of {@link NewsletterTopicDefinition} records matching the provided filter
     * and pagination context.
     *
     * @param filter
     *     the filter
     * @param paginationContext
     *     context defining paging and sorting
     * @return a page of entities of type {@code T} as list
     */
    @NotNull
    List<NewsletterTopicDefinition> findPageOfNewsletterTopicDefinitions(@Nullable NewsletterTopicFilter filter,
        @NotNull PaginationContext paginationContext);

    /**
     * Counts the number of {@link NewsletterTopicDefinition}s matching the specified filter.
     *
     * @param filter
     *     of type NewsletterTopicFilter
     * @return entity count
     */
    int countByFilter(@Nullable NewsletterTopicFilter filter);

    /**
     * Creates and returns an unpersisted instance of a NewsletterTopicDefinition
     * with translations in all relevant languages but no values.
     *
     * @return the unpersisted entity
     */
    @NotNull
    NewsletterTopicDefinition newUnpersistedNewsletterTopicDefinition();

    /**
     * Persist an unpersisted {@link NewsletterTopicDefinition} including its associated
     * NewsletterTopicTranslations to the database.
     *
     * @param entity
     *     - must not be null, id must be null
     * @return the persisted entity, including the generated id and default values - or
     *     {@code null} if it can't be added. Only the version field is populated out of
     *     all the audit fields.
     */
    @Nullable
    NewsletterTopicDefinition insert(@NotNull NewsletterTopicDefinition entity);

    /**
     * Update an already persisted {@link NewsletterTopicDefinition} including its associated
     * NewsletterTopicTranslations in the database. Any associated translation will be updated
     * if it exists in the database (id != null) or will be added if it is new (id == null).
     *
     * @param entity
     *     - must not be null, id must not be null.
     * @return the updated persisted entity, including the generated id and default values - or
     *     {@code null} if it can't be added. Only the version field is populated out of
     *     all the audit fields.
     */
    @Nullable
    NewsletterTopicDefinition update(@NotNull NewsletterTopicDefinition entity);

    /**
     * Persists the provided entity. Depending on the absence or presence of an ID, the
     * entity will be added to the database or updated.
     *
     * @param entity
     *     the {@link NewsletterTopicDefinition} to be persisted
     * @return the persisted entity.
     */
    @Nullable
    NewsletterTopicDefinition saveOrUpdate(@NotNull NewsletterTopicDefinition entity);

    /**
     * Remove the persisted entity with the provided id.
     *
     * @param id
     *     the database id - must not be null
     * @param version
     *     the record version - used for optimistic locking
     * @return the deleted entity
     * @throws OptimisticLockingException
     *     if the record version has increased in the mean time
     */
    @Nullable
    NewsletterTopicDefinition delete(int id, int version);

    /**
     * Fetches all newsletter topics associated with the current newsletter and places them
     * into an order - either as explicitly saved in db or sorted alphabetically by title.
     *
     * @param newsletterId
     *     the id of the newsletter
     * @return a sorted list of {@link NewsletterNewsletterTopic}s.
     */
    @NotNull
    List<NewsletterNewsletterTopic> getSortedNewsletterTopicsForNewsletter(int newsletterId);

    /**
     * Saves the sort order to the database for the newsletter with given id.
     *
     * @param newsletterId
     *     id of the newsletter to store the sorted topics for
     * @param topics
     *     a list of topics to store
     */
    void saveSortedNewsletterTopics(int newsletterId, @NotNull List<NewsletterNewsletterTopic> topics);

    /**
     * Removes newsletter topics from the sort list that were once defined for the newsletter but are not anymore.
     *
     * @param newsletterId
     *     the id of the newsletter to cleanse from obsolete topics
     */
    void removeObsoleteNewsletterTopicsFromSort(int newsletterId);
}


text:
<?php namespace Anomaly\PagesModule\Page\Form;

use Anomaly\PagesModule\Entry\Form\EntryFormBuilder;
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
use Anomaly\Streams\Platform\Ui\Form\Multiple\MultipleFormBuilder;

/**
 * Class PageEntryFormBuilder
 *
 * @link          http://pyrocms.com/
 * @author        PyroCMS, Inc. <support@pyrocms.com>
 * @author        Ryan Thompson <ryan@pyrocms.com>
 */
class PageEntryFormBuilder extends MultipleFormBuilder
{

    /**
     * The form buttons.
     *
     * @var array
     */
    protected $buttons = [
        'cancel',
        'view' => [
            'enabled' => 'edit',
            'target'  => '_blank',
            'href'    => 'admin/pages/view/{request.route.parameters.id}',
        ],
    ];

    /**
     * Fired after the entry form is saved.
     *
     * After the entry form is saved take the
     * entry and use it to populate the page
     * before it saves directly after.
     *
     * @param EntryFormBuilder $builder
     */
    public function onSavedEntry(EntryFormBuilder $builder)
    {
        /* @var FormBuilder $form */
        $form = $this->forms->get('page');

        $page = $form->getFormEntry();

        $entry = $builder->getFormEntry();

        $page->entry_id   = $entry->getId();
        $page->entry_type = get_class($entry);
    }

    /**
     * Get the contextual entry ID.
     *
     * @return int|mixed|null
     */
    public function getContextualId()
    {
        /* @var FormBuilder $form */
        $form = $this->forms->get('page');

        return $form->getContextualId();
    }
}


text:
layout: default
---

# Use Tab to autocomplete

When in the terminal, use the `Tab` key to autocomplete file and folder names.

## Example

If you have a folder called
Projects, you can do this:

```
$ cd Pro
```

hit the `Tab` key

```
$ cd Projects
```

Yay! \o/


text:
import * as React from "react";
import * as PropTypes from 'prop-types';
import {
    // Higher-order components
    mapProps, withProps, withPropsOnChange, withHandlers,
    defaultProps, renameProp, renameProps, flattenProp,
    withState, withReducer, branch, renderComponent,
    renderNothing, shouldUpdate, pure, onlyUpdateForKeys,
    onlyUpdateForPropTypes, withContext, getContext,
    lifecycle, toClass, toRenderProps, fromRenderProps, withStateHandlers,
    // Static property helpers
    setStatic, setPropTypes, setDisplayName,
    // Utilities
    compose, getDisplayName, wrapDisplayName, shallowEqual,
    isClassComponent, createEagerElement, createEagerFactory,
    createSink, componentFromProp, nest, hoistStatics,
    // Observable utilities
    componentFromStream, mapPropsStream, createEventHandler,
    createEventHandlerWithConfig,
    componentFromStreamWithConfig, mapPropsStreamWithConfig,
    setObservableConfig,
    StateHandler,
    StateHandlerMap,
} from "recompose";
import rxjsconfig from "recompose/rxjsObservableConfig";
import rxjs4config from "recompose/rxjs4ObservableConfig";
import mostConfig from "recompose/mostObservableConfig";
import xstreamConfig from "recompose/xstreamObservableConfig";
import baconConfig from "recompose/baconObservableConfig";
import kefirConfig from "recompose/kefirObservableConfig";

import mapPropsStandalone from "recompose/mapProps";
import withPropsStandalone from "recompose/withProps";
import withPropsOnChangeStandalone from "recompose/withPropsOnChange";
import withHandlersStandalone from "recompose/withHandlers";
import defaultPropsStandalone from "recompose/defaultProps";
import renamePropStandalone from "recompose/renameProp";
import renamePropsStandalone from "recompose/renameProps";
import flattenPropStandalone from "recompose/flattenProp";
import withStateStandalone from "recompose/withState";
import withStateHandlersStandalone from "recompose/withStateHandlers";
import withReducerStandalone from "recompose/withReducer";
import branchStandalone from "recompose/branch";
import renderComponentStandalone from "recompose/renderComponent";
import renderNothingStandalone from "recompose/renderNothing";
import shouldUpdateStandalone from "recompose/shouldUpdate";
import pureStandalone from "recompose/pure";
import onlyUpdateForKeysStandalone from "recompose/onlyUpdateForKeys";
import onlyUpdateForPropTypesStandalone from "recompose/onlyUpdateForPropTypes";
import withContextStandalone from "recompose/withContext";
import getContextStandalone from "recompose/getContext";
import lifecycleStandalone from "recompose/lifecycle";
import toClassStandalone from "recompose/toClass";
import toRenderPropsStandalone from "recompose/toRenderProps";
import fromRenderPropsStandalone from "recompose/fromRenderProps";
import setStaticStandalone from "recompose/setStatic";
import setPropTypesStandalone from "recompose/setPropTypes";
import setDisplayNameStandalone from "recompose/setDisplayName";
import composeStandalone from "recompose/compose";
import getDisplayNameStandalone from "recompose/getDisplayName";
import wrapDisplayNameStandalone from "recompose/wrapDisplayName";
import shallowEqualStandalone from "recompose/shallowEqual";
import isClassComponentStandalone from "recompose/isClassComponent";
import createSinkStandalone from "recompose/createSink";
import componentFromPropStandalone from "recompose/componentFromProp";
import nestStandalone from "recompose/nest";
import hoistStaticsStandalone from "recompose/hoistStatics";
import componentFromStreamStandalone, { componentFromStreamWithConfig as componentFromStreamWithConfigStandalone } from "recompose/componentFromStream";
import mapPropsStreamStandalone, { mapPropsStreamWithConfig as mapPropsStreamWithConfigStandalone } from "recompose/mapPropsStream";
import createEventHandlerStandalone, { createEventHandlerWithConfig as createEventHandlerWithConfigStandalone } from "recompose/createEventHandler";
import setObservableConfigStandalone from "recompose/setObservableConfig";

function testMapProps() {
    interface InnerProps {
        inn: number
        other: string
     }
    interface OutterProps { out: string }
    const InnerComponent = ({inn}: InnerProps) =>
{inn}
;

    const enhancer = mapProps((props: OutterProps) => ({ inn: 123 }));
    const Enhanced = enhancer(InnerComponent);
    const rendered = (
        <Enhanced
            other='foo'
            out='bar'
        />
    )
}

function testWithProps() {
    interface InnerProps { inn: number }
    interface OutterProps { out: number }
    const InnerComponent = ({inn}: InnerProps) =>
{inn}
;

    const enhancer = withProps((props: OutterProps) => ({ inn: props.out }));
    const Enhanced = enhancer(InnerComponent);
    const rendered = (
        <Enhanced out={123}/>
    )

    const enhancer2 = withProps({ inn: 123 });
    const Enhanced2 = enhancer2(InnerComponent);
    const Rendered2 = (
        <Enhanced2/>
    )
}

function testWithPropsOnChange() {
    interface InnerProps { inn: number }
    interface OutterProps { out: number }
    const InnerComponent = ({inn}: InnerProps) =>
{inn}
;

    const enhancer = withProps((props: OutterProps) => ({ inn: props.out }));
    const Enhanced = enhancer(InnerComponent);
    const rendered = (
        <Enhanced out={123}/>
    )

    const enhancer2 = withProps({ inn: 123 });
    const Enhanced2 = enhancer2(InnerComponent);
    const Rendered2 = (
        <Enhanced2/>
    )
}

function testWithHandlers() {
    interface OutterProps {
        out: number;
    }
    interface InnerProps {
        foo: string;
    }
    interface HandlerProps {
        onSubmit: React.MouseEventHandler<HTMLDivElement>;
        onChange: Function;
    }
    const InnerComponent: React.StatelessComponent<InnerProps & HandlerProps & OutterProps> = ({onChange, onSubmit, foo}) =>

{foo}
;

    const enhancer = withHandlers<OutterProps & InnerProps, HandlerProps>({
      onChange: (props) => (e: any) => {},
      onSubmit: (props) => (e: React.MouseEvent<any>) => {},
    });
    const Enhanced = enhancer(InnerComponent);
    const rendered = (
        <Enhanced
            foo="bar"
            out={42}
        />
    )

    const enhancer2 = withHandlers<OutterProps & InnerProps, HandlerProps>((props) => ({
      onChange: (props) => (e: any) => {},
      onSubmit: (props) => (e: React.MouseEvent<any>) => {},
    }));
    const Enhanced2 = enhancer2(InnerComponent);
    const rendered2 = (
        <Enhanced2
            foo="bar"
            out={42}
        />
    )

    const handlerNameTypecheckProof = withHandlers<OutterProps, HandlerProps>({ // $ExpectError
      onChange: () => () => {},
      notAKeyOnHandlerProps: () => () => {},
    });

    // The inner props should be fully inferrable
    const enhancer3 = withHandlers({
      onChange: (props: OutterProps) => (e: any) => {},
      onSubmit: (props: OutterProps) => (e: React.MouseEvent<any>) => {},
    });
    const Enhanced3 = enhancer3(({onChange, onSubmit, out}) =>

{out}
);
    const rendered3 = (
        <Enhanced3
            out={42}
        />
    )

    const enhancer4 = withHandlers((props: OutterProps) => ({
      onChange: (props) => (e: any) => {},
      onSubmit: (props) => (e: React.MouseEvent<any>) => {},
    }));
    const Enhanced4 = enhancer4(({onChange, onSubmit, out}) =>

{out}
);
    const rendered4 = (
        <Enhanced4
            out={42}
        />
    )
}

function testDefaultProps() {
    interface Props { a: string; b: number; c: number; }
    const innerComponent = ({a, b}: Props) =>
{a}, {b}
;

    const enhancer = defaultProps({ a: "answer", b: 42 });
    const Enhanced = enhancer(innerComponent);
    const rendered = (
        <Enhanced c={42} />
    )
}

function testRenameProp() {
    interface InnerProps { c: string; b: number; }
    interface OutterProps { a: string; b: number; }
    const innerComponent: React.StatelessComponent<InnerProps> = ({c, b}: InnerProps) =>
{c}, {b}
;

    const enhancer = renameProp("a", "c");
    const enhanced: React.ComponentClass<OutterProps> = enhancer(innerComponent);
}

function testRenameProps() {
    interface InnerProps { c: string; d: number; }
    interface OutterProps { a: string; b: number; }
    const innerComponent: React.StatelessComponent<InnerProps> = ({c, d}: InnerProps) =>
{c}, {d}
;

    const enhancer = renameProps({ a:"c", b: "d" });
    const enhanced: React.ComponentClass<OutterProps> = enhancer(innerComponent);
}

function testFlattenProp() {
    interface InnerProps { a: string; b: string; y: {c: string; d: number;} }
    interface OutterProps { x: {a: string; b: number;}; y: {c: string; d: number;} }
    const innerComponent: React.StatelessComponent<InnerProps> = (props: InnerProps) =>

;

    const enhancer = flattenProp("x");
    const enhanced: React.ComponentClass<OutterProps> = enhancer(innerComponent);
}

function testWithState() {
    interface InnerProps { count: number; setCount: (count: number) => number }
    interface OutterProps { title: string }
    const InnerComponent: React.StatelessComponent<InnerProps> = (props) =>

 props.setCount(0)}>
;

    // We can't infer types for TOutter with this form because
    // Typescript only allows all or nothing
    // when defining generics. You can't infer some and define other.
    // For TOutter to be defined as not "{}" we would have to define
    // all the generics.
    const enhancer = withState("count", "setCount", 0);
    const Enhanced = enhancer(InnerComponent);
    const rendered = (
        <Enhanced />
    );

    // Here we're able to infer TOutter since it's defined in the initial state
    // function and Typescript is able to infer it from there.
    const enhancer2 = withState("count", "setCount",
      (p: OutterProps) => p.title.length);
    const Enhanced2 = enhancer2(InnerComponent);
    const rendered2 = (
        <Enhanced2 title="foo" />
    );

    // We can also actually provide the generic necessary
    const enhancer3 = withState<OutterProps, number, "count", "setCount">("count", "setCount", 1);
    const Enhanced3 = enhancer3(props => {
        return
{props.count}
;
    });
    const rendered3 = (
        <Enhanced3 title="foo" />
    );
}

function testWithStateHandlers() {
    interface State { counter: number; }
    interface Updaters extends StateHandlerMap<State> {
      add: StateHandler<State>;
    }
    interface OutterProps { initialCounter: number, power: number }
    type InnerProps = State & Updaters & OutterProps;
    const InnerComponent: React.StatelessComponent<InnerProps> = (props) =>

{`Initial counter: ${props.initialCounter}`}

{`Counter: ${props.counter}`}

 props.add(2)}>

;

    const enhancer = withStateHandlers<State, Updaters, OutterProps>(
        (props: OutterProps) => ({ counter: props.initialCounter }),
        {
            add: (state, props) => n => ({ ...state, counter: state.counter + n ** props.power }),
        },
    );
    const Enhanced = enhancer(InnerComponent);
    const rendered = (
        <Enhanced initialCounter={4} power={2} />
    );

    const updateNameTypecheckProof = withStateHandlers<State, Updaters, OutterProps>(
        (props: OutterProps) => ({ counter: props.initialCounter }),
        { notAKeyOfUpdaters: (state, props) => n => ({ ...state, counter: state.counter + n ** props.power }), }, // $ExpectError
    );

    // The inner props should be fully inferrable
    const enhancer2 = withStateHandlers(
        (props: OutterProps) => ({ counter: props.initialCounter }),
        {
            add: (state, props) => n => ({ ...state, counter: state.counter + n ** props.power }),
        },
    );
    const Enhanced2 = enhancer((props) =>

{`Counts from: ${props.initialCounter}`}

{`Counter: ${props.counter}`}

 props.add(2)}>

);
    const rendered2 = (
        <Enhanced initialCounter={4} power={2} />
    );
}

function testWithReducer() {
    interface State { count: number }
    interface Action { type: string }
    interface InnerProps { title: string; count: number; dispatch: (a: Action) => void; }
    interface OutterProps { title: string; bar: number; }
    const InnerComponent: React.StatelessComponent<InnerProps> = (props) =>

 props.dispatch({type: "INCREMENT"})}>
;

    // Same issue here inferring TOutter as with the "withState" form.
    const enhancer = withReducer("count", "dispatch",
      (s: number, a: Action) => s + 1, 0);
    const Enhanced = enhancer(InnerComponent);
    const rendered = (
        <Enhanced title="foo"/>
    );

    // Here we successfully infer TOutter from the initial state function
    const enhancer2 = withReducer("count", "dispatch",
      (s: number, a: Action) => s + 1,
      (props: OutterProps) => props.title.length);
    const Enhanced2 = enhancer2(InnerComponent);
    const rendered2 = (
        <Enhanced2
            title="foo"
            bar={42}
        />
    );
}

function testBranch() {
    interface InnerProps { count: number; update: () => void; }
    interface OutterProps { toggled: boolean }

    const innerComponent: React.StatelessComponent<InnerProps> = (props: InnerProps) =>

 props.update()}>{props.count}
;
    const innerComponent2 = () =>
Hello
;

    const enhancer = branch(
      (props: OutterProps) => props.toggled,
      withState("count", "update", 0),
      withState("count", "update", 100)
    );
    const enhancer2 = branch(
      (props: OutterProps) => props.toggled,
      renderComponent(innerComponent),
    )
    const enhanced: React.ComponentClass<OutterProps> = enhancer(innerComponent);
    const enhanced2: React.ComponentClass<OutterProps> = enhancer2(innerComponent);
}

function testRenderComponent() {
    interface InnerProps { count: number; update: () => void; }
    interface OutterProps { toggled: boolean }

    const innerComponent = () =>
Hello
;

    const enhancer = renderComponent(() => Nop!);
    const enhanced: React.ComponentClass<OutterProps> = enhancer(innerComponent);
}

function testWithObservableConfig() {
  let componentFromStreamMost = componentFromStreamWithConfig(mostConfig)
  componentFromStreamMost = componentFromStream

  let mapPropsStreamMost = mapPropsStreamWithConfig(mostConfig)
  mapPropsStreamMost = mapPropsStream

  let createEventHandlerMost = createEventHandlerWithConfig(mostConfig)
  let { handler: handler, stream: stream } = createEventHandler()
  createEventHandlerMost = createEventHandler
}

function testOnlyUpdateForKeys() {
    interface Props {
        foo: number;
        bar: string;
    }
    const component: React.StatelessComponent<Props> = (props) =>
{props.foo} {props.bar}

    onlyUpdateForKeys<Props>(['foo'])(component)
    // This should be a compile error
    // onlyUpdateForKeys<Props>(['fo'])(component)
}

function testLifecycle() {
    interface Props {
        foo: number;
        bar: string;
    }
    interface State {}
    interface Instance {
        instanceValue: number
    }
    const component: React.StatelessComponent<Props> = (props) =>
{props.foo} {props.bar}

    lifecycle<Props, State, Instance>({
        instanceValue: 1,
        componentDidMount() {
            this.instanceValue = 2
        }
    })(component)
}

function testSetStatic() {
    interface Props {
        foo: string;
    }

    let SfcResult: React.SFC<Props>;
    const SfcComp: React.SFC<Props> = (props) => (
{props.foo}
);

    let ClassResult: React.ComponentClass<Props, {}>;
    class ClassComp extends React.Component<Props> {
        render() {
            return (
{this.props.foo}
);
        }
    }

    const hoc1 = setStatic('bar', 'a string');
    const hoc2 = setStatic('bar', 5);
    const hoc3 = setStatic('bar', { a: 'b' });

    SfcResult = hoc1(SfcComp);
    SfcResult = hoc2(SfcComp);
    SfcResult = hoc3(SfcComp);
    SfcResult = hoc1(ClassComp); // $ExpectError

    ClassResult = hoc1(ClassComp);
    ClassResult = hoc2(ClassComp);
    ClassResult = hoc3(ClassComp);
    ClassResult = hoc1(SfcComp); // $ExpectError
}

function testSetPropTypes() {
    interface Props {
        foo: string;
    }
    const validationMap = {
        foo: PropTypes.string.isRequired
    }

    let SfcResult: React.SFC<Props>;
    const SfcComp: React.SFC<Props> = (props) => (
{props.foo}
);

    let ClassResult: React.ComponentClass<Props, {}>;
    class ClassComp extends React.Component<Props> {
        render() {
            return (
{this.props.foo}
);
        }
    }

    const hoc = setPropTypes(validationMap);

    SfcResult = hoc(SfcComp);
    SfcResult = hoc(ClassComp); // $ExpectError

    ClassResult = hoc(ClassComp);
    ClassResult = hoc(SfcComp); // $ExpectError

    SfcResult = setPropTypes({ bar: PropTypes.string })(SfcComp); // $ExpectError
}

function testSetDisplayName() {
    interface Props {
        foo: string;
    }

    let SfcResult: React.SFC<Props>;
    const SfcComp: React.SFC<Props> = (props) => (
{props.foo}
);

    let ClassResult: React.ComponentClass<Props, {}>;
    class ClassComp extends React.Component<Props> {
        render() {
            return (
{this.props.foo}
);
        }
    }

    const hoc = setDisplayName('NewDisplayName');

    SfcResult = hoc(SfcComp);
    SfcResult = hoc(ClassComp); // $ExpectError

    ClassResult = hoc(ClassComp);
    ClassResult = hoc(SfcComp); // $ExpectError
}

function testToRenderProps() {
    interface OutterProps {
        foo: number;
    }

    interface InnerProps {
        fooPlusOne: number;
    }

    const enhance = withProps<InnerProps, OutterProps>(({ foo }) => ({ fooPlusOne: foo + 1 }));
    const Enhanced = toRenderProps<InnerProps, OutterProps>(enhance);

    return <Enhanced foo={1}>{({ fooPlusOne }) =>
{fooPlusOne}
}</Enhanced>;
}

function testFromRenderProps() {
    interface RenderProps {
        value: string;
    }

    interface InnerProps {
        renderValue: string;
    }

    interface OutterProps {
        outterValue: number;
    }

    interface ComponentProps {
        renderValue: string;
        outterValue: number;
    }

    interface RenderComponentProps {
        render: (renderProps: RenderProps) => React.ReactElement<any>;
    }

    class RenderPropComponent extends React.Component<RenderComponentProps> {
        render () {
            return this.props.render({ value: 'test' });
        }
    }

    const component: React.StatelessComponent<ComponentProps> = ({ outterValue, renderValue }) => (

{outterValue}{renderValue}

    );

    const Enhanced = fromRenderProps<InnerProps, OutterProps, RenderProps>(
        RenderPropComponent,
        ({ value }) => ({ renderValue: value }),
        'render'
    )(component);

    return <Enhanced outterValue={1} />;
}


text:
{% extends "shop/base.html" %}
{% load satchmo_order %}
{% load i18n %}

{% block navbar %}

{% trans "Home" %}

{% trans "Account" %}

{% trans "Order Tracking" %}

{% endblock %}

{% block content %}

{% trans "Order Tracking" %}

    {% order_tracking_details order "true" default_view_tax%}

{% endblock %}


text:
package com.hazelcast.security.permission;

public class CountDownLatchPermission extends InstancePermission {

    private static final int READ = 4;
    private static final int MODIFY = 8;
    private static final int ALL = CREATE | DESTROY | READ | MODIFY;

    public CountDownLatchPermission(String name, String... actions) {
        super(name, actions);
    }

    @Override
    protected int initMask(String[] actions) {
        int mask = NONE;
        for (String action : actions) {
            if (ActionConstants.ACTION_ALL.equals(action)) {
                return ALL;
            }

            if (ActionConstants.ACTION_CREATE.equals(action)) {
                mask |= CREATE;
            } else if (ActionConstants.ACTION_DESTROY.equals(action)) {
                mask |= DESTROY;
            } else if (ActionConstants.ACTION_READ.equals(action)) {
                mask |= READ;
            } else if (ActionConstants.ACTION_MODIFY.equals(action)) {
                mask |= MODIFY;
            }
        }
        return mask;
    }
}


text:
#include <stdint.h>

#include "zconf.h"
#include "zutil.h"
#include "deflate.h"

/*
 * crc32_sse42_simd_(): compute the crc32 of the buffer, where the buffer
 * length must be at least 64, and a multiple of 16.
 */
uint32_t ZLIB_INTERNAL crc32_sse42_simd_(
    const unsigned char *buf,
    z_size_t len,
    uint32_t crc);

/*
 * crc32_sse42_simd_ buffer size constraints: see the use in zlib/crc32.c
 * for computing the crc32 of an arbitrary length buffer.
 */
#define Z_CRC32_SSE42_MINIMUM_LENGTH 64
#define Z_CRC32_SSE42_CHUNKSIZE_MASK 15

/*
 * CRC32 checksums using ARMv8-a crypto instructions.
 */
uint32_t ZLIB_INTERNAL armv8_crc32_little(unsigned long crc,
                                          const unsigned char* buf,
                                          z_size_t len);

/*
 * Insert hash string.
 */
Pos ZLIB_INTERNAL insert_string_arm(deflate_state *const s, const Pos str);


text:
using System;
using NUnit.Framework;
using Moq;
using RockPaperScissors;
using System.Collections.Generic;

namespace Test
{
    [TestFixture]
    public class GameTests
    {
        Game sut;

        [OneTimeSetUp]
        public void SetupFixture()
        {
            sut = new Game();
        }
        [Test]
        public void GameObjectisinstantiatedCorrectly()
        {

            Assert.IsInstanceOf<Game>(sut);
        }

        [Test]
        public void SelectGameType_ComputerVsComputer()
        {
            sut.GameType=GameType.ComputerVsComputer;

            Assert.AreEqual(sut.GameType, GameType.ComputerVsComputer);
        }

        [Test]
        public void SelectGameType_PlayerVsComputer()
        {
            sut.GameType = GameType.PlayerVsComputer;

            Assert.AreEqual(sut.GameType, GameType.PlayerVsComputer);
        }
        [Test]
        public void SelectGameSeries_Single()
        {
            sut.GameSeries = GameSeries.Single;

            Assert.AreEqual(sut.GameSeries, GameSeries.Single);
        }
        [Test]
        public void SelectGameSeries_Multiple()
        {
            sut.GameSeries = GameSeries.Multiple;

            Assert.AreEqual(sut.GameSeries, GameSeries.Multiple);
        }
        [Test]
        public void ConfigurePlayers()
        {
            var mockPlayer1 = new Mock<Player>();
            var mockPlayer2 = new Mock<Player>();
            sut.GameSeries = GameSeries.Single;
            sut.GameType = GameType.ComputerVsComputer;

            var result =sut.ConfigurePlayers(mockPlayer1.Object, mockPlayer2.Object);

            Assert.AreEqual(result.Count, 2);
        }
        [Test]
        public void ConfigureComputerVsComputerPlayers1()
        {
            var mockPlayer1 = new Mock<Player>();
            var mockPlayer2 = new Mock<Player>();
            sut.GameSeries = GameSeries.Single;
            sut.GameType = GameType.ComputerVsComputer;

            var result = sut.ConfigurePlayers(mockPlayer1.Object, mockPlayer2.Object);

            Assert.AreEqual(result[0].Type, PlayerType.Computer);
        }
        [Test]
        public void ConfigureHumanVsComputerPlayers1()
        {
            var mockPlayer1 = new Mock<Player>();
            var mockPlayer2 = new Mock<Player>();
            mockPlayer1.SetupGet(p => p.Type).Returns(PlayerType.Human);
            sut.GameSeries = GameSeries.Single;
            sut.GameType = GameType.PlayerVsComputer;

            var result = sut.ConfigurePlayers(mockPlayer1.Object, mockPlayer2.Object);

            Assert.AreEqual(result[0].Type, PlayerType.Human);
        }
        [Test]
        public void ConfigureComputerVsComputerPlayers2()
        {
            var mockPlayer1 = new Mock<Player>();
            var mockPlayer2 = new Mock<Player>();
            sut.GameSeries = GameSeries.Single;
            sut.GameType = GameType.ComputerVsComputer;

            var result = sut.ConfigurePlayers(mockPlayer1.Object, mockPlayer2.Object);

            Assert.AreEqual(result[1].Type, PlayerType.Computer);
        }
        [Test]
        public void ConfigureHumanVsComputerPlayers2()
        {
            var mockPlayer1 = new Mock<Player>();
            var mockPlayer2 = new Mock<Player>();
            mockPlayer1.SetupGet(p => p.Type).Returns(PlayerType.Human);
            sut.GameSeries = GameSeries.Single;
            sut.GameType = GameType.PlayerVsComputer;

            var result = sut.ConfigurePlayers(mockPlayer1.Object, mockPlayer2.Object);

            Assert.AreNotEqual(result[1].Type, PlayerType.Human);
        }

        [OneTimeTearDown]
        public void TearDownfixture()
        {
            sut = null;
        }
    }
}


text:
<#
  .Synopsis
    Reset ONE passwords in O365 domain

  .Description
    This simple script use the Connect-NESo365.ps1 to connect to Office 365.
    And then resets password for one selected user in O365.

  .Notes
    Author: Ron Kjernell - ron@nestil.se
    Requires Connect-NESO365.ps1

    To run this you will also need the following:

    Microsoft Online Services Sign-in Assistant for IT-Professionals RTW
    http://go.microsoft.com/fwlink/?LinkID=286152

    And: http://go.microsoft.com/fwlink/p/?linkid=236297

    Read more aboute the MSOnline Module here: https://docs.microsoft.com/en-us/powershell/msonline/v1/azureactivedirectory?redirectedfrom=msdn

  .LINK
    http://www.nestil.se
    https://github.com/Nestil/
#>
[xml]$Users = Get-Content -Path C:\Repo\Generic-Scripts-Public\O365\XML\Userlist.xml
$Username = $Users.Users.Username
$Password = $Users.Users.Password
C:\Repo\Functions-Public\Connect-NESO365.ps1

foreach ($User in $Users)
{
    Set-MsolUserPassword -UserPrincipalName $Username -NewPassword $Password -ForceChangePassword $false
}

# Remove session when done.
Remove-PSSession -ComputerName outlook.office365.com


text:
cask 'chatty' do
  version '0.8.5.1'
  sha256 '8959f8395b4f8cf44aa606a57404ca8f8a70d9fbfd8f42962057cc105addc020'

  # github.com/chatty/chatty was verified as official when first introduced to the cask
  url "https://github.com/chatty/chatty/releases/download/v#{version}/Chatty_#{version}.zip"
  appcast 'https://github.com/chatty/chatty/releases.atom',
          checkpoint: 'a84090aab24aa2048d8f6098d3e227707ea8376ff77e21f61e7724904b3e6f19'
  name 'Chatty'
  homepage 'https://chatty.github.io/'

  suite 'Chatty'

  preflight do
    # There is no sub-folder in the ZIP; the root *is* the folder
    FileUtils.mv(staged_path.children, staged_path.join('Chatty').tap(&:mkpath))
  end

  zap delete: '~/.chatty'

  caveats do
    depends_on_java('7+')
  end
end


text:
(function ($) {
  jQuery.fn.sidebar = function() {
    var sidebar = this;
    var originalPosition = sidebar.css('right');
    var open = false;

    var boxAnimations;

    if (Modernizr.cssanimations) {
      boxAnimations = {
        open:  function() { sidebar.addClass('open'); },
        close: function() { sidebar.removeClass('open'); },
      }
    } else {
      boxAnimations = {
        open: function() {
          sidebar.animate({
            'right': '0px'
          }, 300);
        },
        close: function() {
          sidebar.stop(true).animate({
            'right': originalPosition
          }, 100);
        }
      }
    }

    $(window).scroll(function() {
      var distanceTop = $('#copyright').offset().top - $(window).height();

      if ($(window).scrollTop() > distanceTop) {
        if (!open) {
          open = true;
          boxAnimations.open();
        }
      } else {
        open = false;
        boxAnimations.close();
      }
    });

    sidebar.find('.close').click(function() {
      $(this).parent().remove();
    });
  }
})(jQuery);


text:
require 'serverspec'

set :backend, :exec

puts os

# 'sets hostname to "test"'
hostname_cmd = if os[:family] == 'freebsd'
                 'hostname -s'
               else
                 'hostname'
               end
describe command(hostname_cmd) do
  its(:stdout) { should eq("test\n") }
end

# 'sets FQDN to "test.example.com"'
describe command('hostname -f') do
  its(:stdout) { should eq("test.example.com\n") }
end

# 'sets dnsdomainname to "example.com"'
describe command('dnsdomainname'), if: os[:family] != 'freebsd' do
  its(:stdout) { should eq("example.com\n") }
end


text:
//=====================================================================
//
//File:      $RCSfile: GenericEditorUtil.java,v $
//Version:   $Revision: 1.9 $
//Modified:  $Date: 2013/01/10 23:21:31 $
//
//(c) Copyright 2004-2014 by Mentor Graphics Corp. All rights reserved.
//
//=====================================================================
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License.  You may obtain a copy
// of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   See the
// License for the specific language governing permissions and limitations under
// the License.
//=====================================================================

package org.xtuml.bp.test.common;

import java.util.Iterator;
import java.util.List;
import java.util.Vector;

import junit.framework.Assert;
import junit.framework.TestCase;

import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;

import org.xtuml.bp.core.ClassStateMachine_c;
import org.xtuml.bp.core.CorePlugin;
import org.xtuml.bp.core.DataTypePackage_c;
import org.xtuml.bp.core.Domain_c;
import org.xtuml.bp.core.ExternalEntityPackage_c;
import org.xtuml.bp.core.FunctionPackage_c;
import org.xtuml.bp.core.InstanceStateMachine_c;
import org.xtuml.bp.core.ModelClass_c;
import org.xtuml.bp.core.Subsystem_c;
import org.xtuml.bp.core.common.IPersistenceHierarchyMetaData;
import org.xtuml.bp.core.common.NonRootModelElement;
import org.xtuml.bp.core.common.PersistableModelComponent;
import org.xtuml.bp.core.common.PersistenceManager;
import org.xtuml.bp.core.ui.Selection;
import org.xtuml.bp.test.TestUtil;
import org.xtuml.bp.test.common.ExplorerUtil.GenericModelElementCriteria;
import org.xtuml.bp.ui.canvas.ModelSpecification_c;
import org.xtuml.bp.ui.canvas.Model_c;
import org.xtuml.bp.ui.canvas.Ooaofgraphics;
import org.xtuml.bp.ui.graphics.actions.OpenGraphicsEditor;
import org.xtuml.bp.ui.graphics.editor.GraphicalEditor;
import org.xtuml.bp.ui.graphics.editor.GraphicalEditorInput;
import org.xtuml.bp.ui.text.AbstractModelElementEditorInputFactory;
import org.xtuml.bp.ui.text.AbstractModelElementTextEditor;
import org.xtuml.bp.ui.text.activity.ActivityEditor;
import org.xtuml.bp.ui.text.activity.ActivityEditorInput;
import org.xtuml.bp.ui.text.activity.ActivityEditorInputFactory;
import org.xtuml.bp.ui.text.activity.ShowActivityAction;
import org.xtuml.bp.ui.text.description.DescriptionEditor;
import org.xtuml.bp.ui.text.description.DescriptionEditorInput;
import org.xtuml.bp.ui.text.description.DescriptionEditorInputFactory;
import org.xtuml.bp.ui.text.description.ShowDescriptionAction;

/**
 * @author araza
 *
 */
public class GenericEditorUtil {
    public final static int EDITOR_TYPE_NONE=-1;
	public final static int EDITOR_TYPE_DESC = 0;

	public final static int EDITOR_TYPE_ACTIVITY = 1;

	public final static int EDITOR_TYPE_CANVAS = 2;

    public static final String YES_BUTTON="&Yes";
    public static final String NO_BUTTON="&No";
    public static final String CANCEL_BUTTON="&Cancel";
    public static final String OK_BUTTON="OK";

	public static Object[] openEditorsForRename(NonRootModelElement rootME) {

		Vector openedEditors=new Vector();

		Object[] clsz=RenameMElementDependency.getRenameDependentElements(rootME.getClass());
		IPersistenceHierarchyMetaData metaData = PersistenceManager
		.getHierarchyMetaData();

		for (int i = 0; i < clsz.length; i++) {
			Class cls=	(Class)clsz[i];
			NonRootModelElement me=null;
			if(i==0)
			 me=rootME;
			else
            {
			 List children=metaData.getChildrenComponentRootModelElements(rootME,cls );
             if (children.size()>0)
                 me=(NonRootModelElement)children.get(0);
            }
		TestCase.assertNotNull("Dependent ME '"+cls.getName()+"' of '"+rootME.getClass().getName()+"' not found", me);

		Vector e=new Vector();
        List suppEditors=getSupportedEditors(me);

        for (Iterator iter = suppEditors.iterator(); iter.hasNext();) {
            int editorType = ((Integer)iter.next()).intValue();
            IEditorPart ed=openRandomEditor(me, editorType);
            TestCase.assertNotNull("Required editor could not opened: "+me+editorType, ed);
            e.add(ed);
		}

		openedEditors.addAll(e);
		}
		return openedEditors.toArray();
	}

	static public IEditorPart openRandomEditor(PersistableModelComponent component, int editorType) {
		return openRandomEditor(component, editorType, false);
	}

	static public IEditorPart openRandomEditor(PersistableModelComponent component, int editorType, boolean fromChildComponents) {
		GenericModelElementCriteria criteria = new GenericModelElementCriteria();
		criteria.init(editorType);

		TreeItem treeItem = null;

		if(fromChildComponents){
            //TODO this has some problem, hangs in infinite loop
			treeItem = ExplorerUtil.findChildComponentTreeItemInMEFor(component, criteria);
		}else{
			treeItem = ExplorerUtil.findTreeItemInMEFor(component, criteria);
		}

		if(treeItem==null)
		return null;
        TestCase.assertFalse("Model Elemenet '"+TestingUtilities.getName((NonRootModelElement)treeItem.getData())+"' is orphaned",((NonRootModelElement)treeItem.getData()).isOrphaned());
		IActionDelegate action = null;

		switch (editorType) {
		case EDITOR_TYPE_DESC:
			action = new ShowDescriptionAction();
			break;
		case EDITOR_TYPE_ACTIVITY:
			action = new ShowActivityAction();
			break;
		case EDITOR_TYPE_CANVAS:
			action = new OpenGraphicsEditor();
			break;
		}

		if(action != null){
			IStructuredSelection selection = new StructuredSelection(treeItem.getData());
			final IActionDelegate act = action;
			final Action a = new Action() {};
			Selection.getInstance().setSelection(selection);
			act.selectionChanged(a, selection);

			IWorkspaceRunnable r = new IWorkspaceRunnable() {
				public void run(IProgressMonitor monitor) throws CoreException {
					act.run(a);
				}
			};
			try {
				CorePlugin.getWorkspace().run(r, null);
                while(Display.getCurrent().readAndDispatch());
                IEditorPart editor= PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                .getActivePage().getActiveEditor();

                Assert.assertEquals("Required editor not opened",editorType,getEditorType(editor));
                return editor;
			} catch (CoreException e) {
				CorePlugin.logError("open editor problem", e);
			}
		}

		return null;
	}

	/**
	 * opens given type of editor for given ME, activates and returns existing
	 * editor if one already exists for same ME
	 *
	 * @param uut,
	 *            NonRootModelElement for which editor need to be opened
	 * @param editorType,
	 *            Type of editor to to be opened
	 */
	static public IEditorPart openRandomEditor(NonRootModelElement rootME, final int editorType) {
		TestCase.assertNotNull(rootME);

		IActionDelegate action = null;
		IStructuredSelection selection = null;

		switch (editorType) {
		case EDITOR_TYPE_DESC:
			List mes = findMEsWithText(rootME, DescriptionEditorInputFactory.PLACEHOLDER_EXTENSION);
			if(mes.size() > 0){
				selection = new StructuredSelection(mes.get(0));
				action = new ShowDescriptionAction();
			}
			break;
		case EDITOR_TYPE_ACTIVITY:
			mes = findMEsWithText(rootME, ActivityEditorInputFactory.PLACEHOLDER_EXTENSION);
			if(mes.size() > 0){
				selection = new StructuredSelection(mes.get(0));
				action = new ShowActivityAction();
			}
			break;
		case EDITOR_TYPE_CANVAS:
			NonRootModelElement me = rootME;//findMEWithModelInstance(rootME);
			if(me != null){
				selection = new StructuredSelection(me);
				action = new OpenGraphicsEditor();
			}
			break;
		}

		if(action != null){
			final IActionDelegate act = action;
			final Action a = new Action() {};
			Selection.getInstance().setSelection(selection);
			act.selectionChanged(a, selection);

			IWorkspaceRunnable r = new IWorkspaceRunnable() {
				public void run(IProgressMonitor monitor) throws CoreException {
					act.run(a);
				}
			};
			try {
				CorePlugin.getWorkspace().run(r, null);
                while(Display.getCurrent().readAndDispatch());
				IEditorPart editor= PlatformUI.getWorkbench().getActiveWorkbenchWindow()
				.getActivePage().getActiveEditor();

                Assert.assertEquals("Required editor not opened",editorType,getEditorType(editor));
                return editor;
			} catch (CoreException e) {
				CorePlugin.logError("open editor problem", e);
			}
		}

		return null;
	}

	static public IEditorPart findEditor(String title, boolean restoreEditor) {

		IWorkbenchWindow[] windows = PlatformUI.getWorkbench()
				.getWorkbenchWindows();
		for (int i = 0; i < windows.length; ++i) {
			IWorkbenchPage[] pages = windows[i].getPages();
			for (int j = 0; j < pages.length; ++j) {
				IEditorReference[] editors = pages[j].getEditorReferences();
				for (int k = 0; k < editors.length; ++k) {
					if (editors[k].getTitle().equals(title)) {
						return editors[k].getEditor(restoreEditor);
					}
				}
			}
		}
		return null;
	}

	static public boolean supportsEditor(NonRootModelElement element, int editorType){
		switch(editorType){
		case EDITOR_TYPE_CANVAS:
		    Ooaofgraphics modelRoot = Ooaofgraphics.getInstance(element.getModelRoot().getId());
            Model_c[] diagrams = Model_c.ModelInstances(modelRoot);
            for (int i = 0; i < diagrams.length; i++)
                if (diagrams[i].inSameComponent(element, diagrams[i]))
                    return true;
			break;
		case EDITOR_TYPE_DESC:
			AbstractModelElementEditorInputFactory factory = DescriptionEditorInputFactory.getDefaultInstance();
			return (factory.isSupported(element) && factory.getRequiredModelElement(element) != null);
		case EDITOR_TYPE_ACTIVITY:
			factory = ActivityEditorInputFactory.getDefaultInstance();
			return (factory.isSupported(element) && factory.getRequiredModelElement(element) != null);
		}
		return false;
	}

	static protected boolean isOpen(IEditorPart part){
		IEditorReference[] editorRefs =  PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
        for (int i = 0; i < editorRefs.length; i++) {
			if(editorRefs[i].getEditor(false) == part){
				return true;
			}
		}
        return false;
	}

    static public boolean isEditorSupported(NonRootModelElement me, int editorTypeToTest)
    {
        List l=getSupportedEditors(me);
        if (l.contains(new Integer(editorTypeToTest)))
            return true;
        else
            return false;
    }
    static public List getSupportedEditors(NonRootModelElement me)
    {
        TestCase.assertNotNull(me);

        Vector editors= new Vector();

        AbstractModelElementEditorInputFactory factory = null;

            factory = ActivityEditorInputFactory.getDefaultInstance();
            if (factory.isSupported(me))
                editors.add( new Integer(EDITOR_TYPE_ACTIVITY));

            factory = DescriptionEditorInputFactory.getDefaultInstance();
            if (factory.isSupported(me))
                editors.add( new Integer(EDITOR_TYPE_DESC));

            if(isCanvasEditorSupported(me))
            editors.add( new Integer(EDITOR_TYPE_CANVAS));
        return editors;
    }

	protected static boolean isCanvasEditorSupported(NonRootModelElement me) {
        ModelSpecification_c[] modelSpecs = ModelSpecification_c.ModelSpecificationInstances(Ooaofgraphics.getDefaultInstance());
        for (int i = 0; i < modelSpecs.length; i++) {
          if (modelSpecs[i].getRepresents() == me.getClass())
              return true;
        }
        return false;
    }

	static List findMEsWithText(NonRootModelElement element, String type) {
		return findMEsWithText(element, null, 2, type);
	}

	static List findMEsWithText(NonRootModelElement element, List mes,
			int count, String type) {
		if (mes == null) {
			mes = new Vector();
		}

		AbstractModelElementEditorInputFactory factory = null;

		if (type.equals(ActivityEditorInputFactory.PLACEHOLDER_EXTENSION)) {
			factory = ActivityEditorInputFactory.getDefaultInstance();
		} else if (type
				.equals(DescriptionEditorInputFactory.PLACEHOLDER_EXTENSION)) {
			factory = DescriptionEditorInputFactory.getDefaultInstance();
		} else {
			throw new IllegalArgumentException("illegal type:" + type);
		}

		IPersistenceHierarchyMetaData metaData = PersistenceManager
				.getHierarchyMetaData();

		if (factory.isSupported(element)) {
			NonRootModelElement requiredME = factory
					.getRequiredModelElement(element);
			if (requiredME != null && !mes.contains(requiredME)) {
				mes.add(requiredME);
				if (count > 0 && (mes.size() >= count)) {
					return mes;
				}
			}
		}

		List children = metaData.getChildren(element, true);
		for (int i = 0; i < children.size(); i++) {
			findMEsWithText((NonRootModelElement) children.get(i), mes, count,
					type);
		}

		return mes;
	}

	static NonRootModelElement findMEWithModelInstance(
			NonRootModelElement element) {
		Ooaofgraphics modelRoot = Ooaofgraphics.getInstance(element.getModelRoot().getId());
		//TODO Does not work in restore case
		Model_c[] diagrams = Model_c.ModelInstances(modelRoot);
		for (int i = 0; i < diagrams.length; i++) {
			if (diagrams[i].inSameComponent(element, diagrams[i])) {
				return (NonRootModelElement) diagrams[i].getRepresents();
			}
		}
		return null;
	}

	static public void validateTextEditorContents(String title, String contents){
		IEditorPart editor = findEditor(title, false);
		TestCase.assertNotNull("Could not find editor with title:" + title, editor);
		TestCase.assertTrue("Editor not a text(activity/description) editor", (editor instanceof AbstractModelElementTextEditor));

		AbstractModelElementTextEditor textEditor = (AbstractModelElementTextEditor) editor;
		IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());

		TestCase.assertEquals("contents of editor didn't match", contents, document.get());
	}

	static public void validateActiveTextEditorContents(String title, String contents) {
		IEditorPart editor = PlatformUI.getWorkbench()
				.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
		TestCase.assertNotNull(editor);
		TestCase.assertEquals(title, editor.getTitle());
		if (editor instanceof AbstractModelElementTextEditor) {
			AbstractModelElementTextEditor textEditor = (AbstractModelElementTextEditor) editor;
			IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());

			TestCase.assertEquals("contents of editor didn't match", contents, document.get());
		}

	}

	public static void checkAllEditorClosed(Object[] openEditors) {

        for (int i = 0; i < openEditors.length; i++) {
			checkEditorClosed((IEditorPart)openEditors[i]);
		}

	}

	public static void checkEditorClosed(IEditorPart editor) {
		if(editor.getEditorInput()==null)
            return; // if it is closed it will be null
	    IEditorPart ed= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findEditor(editor.getEditorInput());
		if(ed!=null)
        TestCase.fail("editor not closed : " + ed.getTitle());

	}

	public static void checkAllEditorTitles(Object[] openEditors, String newName) {
		for (int i = 0; i < openEditors.length; i++) {
			checkEditorTitle((IEditorPart)openEditors[i],newName);
		}
	}

    public static void checkEditorTitle(IEditorPart editor,String newName) {
        NonRootModelElement me=null;
        if(editor instanceof DescriptionEditor)
        {
            DescriptionEditorInput dei=(DescriptionEditorInput)editor.getEditorInput();
            me=dei.getModelElement();
        }else if (editor instanceof ActivityEditor) {
            ActivityEditorInput aei = (ActivityEditorInput) editor.getEditorInput();
            me=aei.getModelElement();
        }else if (editor instanceof GraphicalEditor) {
            GraphicalEditorInput cei = (GraphicalEditorInput) editor.getEditorInput();
            me=(NonRootModelElement)cei.getInput().getRepresents();

        }
        String curTitle=editor.getTitle();
	    String expTitle=newName;
    	TestCase.assertEquals("editor title not updated ",expTitle,curTitle);

	}
    public static int getEditorType(IEditorPart editor)
    {
        if (editor instanceof GraphicalEditor){

            // TODO how to get ME represented by given editor
            return EDITOR_TYPE_CANVAS;
        }
            else if (editor instanceof DescriptionEditor)
                return EDITOR_TYPE_DESC;
                else if (editor instanceof ActivityEditor)
                    return EDITOR_TYPE_ACTIVITY;
                else
                    return EDITOR_TYPE_NONE;

    }
    /**
     * This method emulate button press behavior on active model dialog, this
     * method must be called before model dialog is displayed.
     * @param buttonToPress Text of button, use provided static constants
     * @param title title of the dialog, only to be more specific
     * @param afterHowMuchTime after how much time to invoke the operation, as
     * this method is called before invocation of dialog, this method will wait for
     * dialog display for <b>afterHowMuchTime</b> mili secs between successive
     * tries.
     */
    public static void DoDialog(final String buttonToPress,final String title, final int afterHowMuchTime) {

        final int maxRecursionDepth = 10;
        Display.getCurrent().asyncExec(
            new Runnable() {
                public void run() {
                    // wait to give the expected modal dialog time to get displayed
                    TestUtil.sleep(afterHowMuchTime);
                    for(int callNumber=0;callNumber<maxRecursionDepth;callNumber++)
                    {
                    // if the currently active shell is a dialog
                    Shell shell = getShell(title);
                    if (shell != null && shell.getData() instanceof Dialog) {
                            Dialog dialog=(Dialog)shell.getData();
                              if(doDialog( dialog,buttonToPress ))
                                  return;//button done successfully
                              else
                                  TestUtil.sleep(afterHowMuchTime); //wait for dialog to dispaly
                            }
                } //end for
            }//end run
            });

    }
    private static Shell getShell(String title){
        Shell[] shell = Display.getCurrent().getShells();
        for (int i = 0; i < shell.length; i++) {
            if(shell[i].getText().startsWith(title))
                return shell[i];
        }
        return null;
    }
    private static boolean doDialog(Dialog dialog,String buttonToPress)
    {
        Control bb = dialog.buttonBar;
        Button cb = findButton(bb.getParent(),buttonToPress);
        if(cb!=null){
        cb.notifyListeners(SWT.Selection, null);
        return true;
        }

        return false;
    }
    private static Button findButton(Composite parent,String buttonText) {
        Control [] child_set = parent.getChildren();
        for ( int i = 0; i < child_set.length; ++i )
        {
            if ( child_set[i] instanceof Button )
            {
                Button cc = (Button) child_set[i];
                String l = cc.getText();
                if ( l.equals(buttonText))
                {
                 return cc;
                }
            }
            else if ( child_set[i] instanceof Composite )
            {
                Button result = findButton((Composite)child_set[i],buttonText);
                if ( result != null )
                {
                   return result;
                }
            }
        }
        return null;
    }

    public static List getActivatedEditors(){
        List editorList = new Vector();

        IEditorReference[] editorRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
        for (int i = 0; i < editorRefs.length; i++) {
            IEditorPart editor = editorRefs[i].getEditor(false);
            if(editor != null){
                editorList.add(editor);
            }
        }

        return editorList;
    }

}


text:
package org.broadleafcommerce.common.web.payment.processor;

import org.broadleafcommerce.common.extension.AbstractExtensionHandler;
import org.broadleafcommerce.common.extension.ExtensionResultStatusType;
import org.broadleafcommerce.common.payment.dto.PaymentRequestDTO;
import org.broadleafcommerce.common.payment.dto.PaymentResponseDTO;
import org.broadleafcommerce.common.payment.service.PaymentGatewayConfiguration;
import org.broadleafcommerce.common.payment.service.PaymentGatewayTransparentRedirectService;
import org.broadleafcommerce.common.vendor.service.exception.PaymentException;

import java.util.Map;

/**
 *
An Abstract implementation of the TRCreditCardExtensionHandler.
 * PaymentGateway Handlers will just need to extend this class and implement
 * the declated abstract methods.

 *
 * @author Elbert Bautista (elbertbautista)
 */
public abstract class AbstractTRCreditCardExtensionHandler extends AbstractExtensionHandler
        implements TRCreditCardExtensionHandler {

    @Override
    public ExtensionResultStatusType setFormActionKey(StringBuilder key) {
        key.delete(0, key.length());
        key.append(getFormActionURLKey());
        return ExtensionResultStatusType.HANDLED;
    }

    @Override
    public ExtensionResultStatusType setFormHiddenParamsKey(StringBuilder key) {
        key.delete(0, key.length());
        key.append(getHiddenParamsKey());
        return ExtensionResultStatusType.HANDLED;
    }

    @Override
    public ExtensionResultStatusType createTransparentRedirectForm(
            Map<String, Map<String, String>> formParameters,
            PaymentRequestDTO requestDTO,
            Map<String, String> configurationSettings) throws PaymentException {

        if (formParameters != null && requestDTO != null &&  configurationSettings != null) {
            //Populate any additional configs on the RequestDTO
            for (String config:configurationSettings.keySet()){
                requestDTO.additionalField(config, configurationSettings.get(config));
            }

            PaymentResponseDTO responseDTO;
            if (getConfiguration().isPerformAuthorizeAndCapture()) {
                responseDTO = getTransparentRedirectService().createAuthorizeAndCaptureForm(requestDTO);
            } else {
                responseDTO = getTransparentRedirectService().createAuthorizeForm(requestDTO);
            }

            populateFormParameters(formParameters, responseDTO);

        }

        return ExtensionResultStatusType.HANDLED_CONTINUE;
    }

    public abstract String getFormActionURLKey();

    public abstract String getHiddenParamsKey();

    public abstract PaymentGatewayConfiguration getConfiguration();

    public abstract PaymentGatewayTransparentRedirectService getTransparentRedirectService();

    public abstract void populateFormParameters(Map<String, Map<String, String>> formParameters,
                                                PaymentResponseDTO responseDTO);

}