text:
local protobuf = require "protobuf"
module('BseRegister_pb', package.seeall)

local BSEREGISTER = protobuf.Descriptor();
local BSEREGISTER_CODE_FIELD = protobuf.FieldDescriptor();
local BSEREGISTER_DESC_FIELD = protobuf.FieldDescriptor();

BSEREGISTER_CODE_FIELD.name = "code"
BSEREGISTER_CODE_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.BseRegister.code"
BSEREGISTER_CODE_FIELD.number = 1
BSEREGISTER_CODE_FIELD.index = 0
BSEREGISTER_CODE_FIELD.label = 1
BSEREGISTER_CODE_FIELD.has_default_value = false
BSEREGISTER_CODE_FIELD.default_value = 0
BSEREGISTER_CODE_FIELD.type = 5
BSEREGISTER_CODE_FIELD.cpp_type = 1

BSEREGISTER_DESC_FIELD.name = "desc"
BSEREGISTER_DESC_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.BseRegister.desc"
BSEREGISTER_DESC_FIELD.number = 2
BSEREGISTER_DESC_FIELD.index = 1
BSEREGISTER_DESC_FIELD.label = 1
BSEREGISTER_DESC_FIELD.has_default_value = false
BSEREGISTER_DESC_FIELD.default_value = ""
BSEREGISTER_DESC_FIELD.type = 9
BSEREGISTER_DESC_FIELD.cpp_type = 9

BSEREGISTER.name = "BseRegister"
BSEREGISTER.full_name = ".com.xinqihd.sns.gameserver.proto.BseRegister"
BSEREGISTER.nested_types = {}
BSEREGISTER.enum_types = {}
BSEREGISTER.fields = {BSEREGISTER_CODE_FIELD, BSEREGISTER_DESC_FIELD}
BSEREGISTER.is_extendable = false
BSEREGISTER.extensions = {}

BseRegister = protobuf.Message(BSEREGISTER)
_G.BSEREGISTER_PB_BSEREGISTER = BSEREGISTER


text:
package com.bounscale

import java.util.Date
import scala.util.parsing.json.{JSONObject, JSONArray}

class BaseWriter{
  val formatVersion = 0
  val bounscaleOpenUuid = "b74e646e-7e55-448f-814d-e36eedc44ea9"
  val bounscaleCloseUuid = "4a061908-db52-4224-ad4b-9850a47c7edf"

  def write(collectorInstances : List[BaseCollector]):String = {
    var data = List.empty[JSONObject]
    val currentDate = (new Date()).toString()
    val playVer = play.core.PlayVersion.current

    collectorInstances.foreach(collector => {
      data = data :+ JSONObject(Map("name" -> collector.getName(), "value" -> collector.getValue()))
    })

    val json = JSONObject(Map("format_ver" -> formatVersion, "datetime" -> currentDate, "data" -> JSONArray(data), "framework_ver" -> ("PlayFramework " + playVer)))
    val result_str = bounscaleOpenUuid + json.toString() + bounscaleCloseUuid
    output(result_str)
    return result_str
  }

  protected def output(str : String){}
}

redpajama_set_name: RedPajamaGithub


text:
module Tapp
  module Util
    module_function

    def report_called
      inner, outer = caller.partition {|line|
        line.include?('/lib/tapp')
      }

      method_quoted = inner.last.split(':in').last.strip

      puts "#{method_quoted} in #{outer.first}"
    end
  end
end


text:
<?php

namespace TournamentBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * Tournament
 *
 * @ORM\Table(name="tournament")
 * @ORM\Entity(repositoryClass="TournamentBundle\Repository\TournamentRepository")
 */
class Tournament
{
    const TYPE_INDOOR = 'indoor';
    const TYPE_OUTDOOR = 'outdoor';

    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="dateStart", type="date")
     */
    private $dateStart;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="dateEnd", type="date")
     */
    private $dateEnd;

    /**
     * @var string
     *
     * @ORM\Column(name="type", type="string")
     * @Assert\Type("string")
     * @Assert\NotBlank()
     */
    private $type;

    /**
     * @ORM\OneToMany(targetEntity="TournamentBundle\Entity\Peloton", mappedBy="tournament")
     */
    private $pelotons;

    /**
     * @ORM\ManyToOne(targetEntity="ArcheryBundle\Entity\Club", inversedBy="tournaments")
     * @ORM\JoinColumn(nullable=true)
     */
    private $organisateur;

    public static function getTypeList()
    {
        return [self::TYPE_INDOOR, self::TYPE_OUTDOOR];
    }

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->pelotons     = new \Doctrine\Common\Collections\ArrayCollection();
        $this->dateStart    = new \Datetime();
        $this->dateEnd      = new \Datetime();
        $this->type = 0;
    }

    /**
     * Get id
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set dateStart
     *
     * @param \DateTime $dateStart
     *
     * @return Tournament
     */
    public function setDateStart($dateStart)
    {
        $this->dateStart = $dateStart;

        return $this;
    }

    /**
     * Get dateStart
     *
     * @return \DateTime
     */
    public function getDateStart()
    {
        return $this->dateStart;
    }

    /**
     * Set dateEnd
     *
     * @param \DateTime $dateEnd
     *
     * @return Tournament
     */
    public function setDateEnd($dateEnd)
    {
        $this->dateEnd = $dateEnd;

        return $this;
    }

    /**
     * Get dateEnd
     *
     * @return \DateTime
     */
    public function getDateEnd()
    {
        return $this->dateEnd;
    }

    /**
     * Set type
     *
     * @param string $type
     *
     * @return Tournament
     */
    public function setType($type)
    {
        if (!in_array($type, self::getTypeList())) {
            throw new \InvalidArgumentException("Invalid type");
        }

        $this->type = array_search($type, self::getTypeList());

        return $this;
    }

    /**
     * Get type
     *
     * @return string
     */
    public function getType()
    {
        return self::getTypeList()[$this->type];
    }

    /**
     * Add peloton
     *
     * @param \TournamentBundle\Entity\Peloton $peloton
     *
     * @return Tournament
     */
    public function addPeloton(\TournamentBundle\Entity\Peloton $peloton)
    {
        $this->pelotons[] = $peloton;

        return $this;
    }

    /**
     * Remove peloton
     *
     * @param \TournamentBundle\Entity\Peloton $peloton
     */
    public function removePeloton(\TournamentBundle\Entity\Peloton $peloton)
    {
        $this->pelotons->removeElement($peloton);
    }

    /**
     * Get pelotons
     *
     * @return \Doctrine\Common\Collections\Collection
     */
    public function getPelotons()
    {
        return $this->pelotons;
    }

    /**
     * Set organisateur
     *
     * @param \ArcheryBundle\Entity\Club $organisateur
     *
     * @return Tournament
     */
    public function setOrganisateur(\ArcheryBundle\Entity\Club $organisateur = null)
    {
        $this->organisateur = $organisateur;

        return $this;
    }

    /**
     * Get organisateur
     *
     * @return \ArcheryBundle\Entity\Club
     */
    public function getOrganisateur()
    {
        return $this->organisateur;
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf8"/>

    <title>Dialog</title>

    <link rel="stylesheet" type="text/css" href="../../../../dist/joint.css" />
    <link rel="stylesheet" type="text/css" href="../dialog.css" />

    Open Yes/No Dialog

    Open Dialog with an embedded video

    Draggable Dialog

    Dialog with a diagram

    Dialog with buttons left and right

    Dialog with no title and no buttons

    Alert Dialog

    No Modal Dialog

Inlined dialogs


text:
<?php

namespace spec\Ekkinox\KataCatAndMouse\Model;

use Ekkinox\KataCatAndMouse\Exception\AnimalOutOfBoundsException;
use Ekkinox\KataCatAndMouse\Exception\DuplicateAnimalException;
use Ekkinox\KataCatAndMouse\Exception\NonFreePositionException;
use Ekkinox\KataCatAndMouse\Model\Cat;
use Ekkinox\KataCatAndMouse\Model\Map;
use Ekkinox\KataCatAndMouse\Model\Mouse;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;

/**
 * @package spec\Ekkinox\KataCatAndMouse\Model
 */
class MapSpec extends ObjectBehavior
{
    /**
     * @var int
     */
    private $length = 20;

    function let()
    {
        $this->beConstructedWith($this->length);
    }

    function it_is_initializable()
    {
        $this->shouldHaveType(Map::class);
    }

    function it_is_build_with_a_length()
    {
        $this->getLength()->shouldReturn(20);
    }

    function it_cannot_set_the_cat_out_of_bounds()
    {
        $cat = new Cat();
        $cat->setPosition(30);

        $this->shouldThrow(AnimalOutOfBoundsException::class)->during('setCat', [$cat]);
    }

    function it_can_set_the_cat_and_retrieve_it()
    {
        $cat = new Cat();
        $cat->setPosition(10);

        $this->setCat($cat)->shouldReturn($this);

        $this->getCat()->shouldReturn($cat);
    }

    function it_cannot_set_the_mouse_out_of_bounds()
    {
        $mouse = new Mouse();
        $mouse->setPosition(30);

        $this->shouldThrow(AnimalOutOfBoundsException::class)->during('setMouse', [$mouse]);
    }

    function it_can_set_the_mouse_and_retrieve_it()
    {
        $mouse = new Mouse();
        $mouse->setPosition(10);

        $this->setMouse($mouse)->shouldReturn($this);

        $this->getMouse()->shouldReturn($mouse);
    }

    function it_cannot_add_more_than_one_cat()
    {
        $cat = new Cat();
        $cat->setPosition(10);

        $cat2 = new Cat();
        $cat2->setPosition(11);

        $this->setCat($cat)->shouldReturn($this);
        $this->shouldThrow(DuplicateAnimalException::class)->during('setCat', [$cat2]);
    }

    function it_cannot_add_more_than_one_mouse()
    {
        $mouse = new Mouse();
        $mouse->setPosition(10);

        $mouse2 = new Mouse();
        $mouse2->setPosition(11);

        $this->setMouse($mouse)->shouldReturn($this);
        $this->shouldThrow(DuplicateAnimalException::class)->during('setMouse', [$mouse2]);
    }

    function it_cannot_have_the_cat_and_the_mouse_at_the_same_position()
    {
        $cat = new Cat();
        $cat->setPosition(10);

        $mouse = new Mouse();
        $mouse->setPosition(10);

        $this->setCat($cat)->shouldReturn($this);
        $this->shouldThrow(NonFreePositionException::class)->during('setMouse', [$mouse]);
    }
}


text:
package com.hotfixs.thinkinginjava.generics.erasure;

import static com.hotfixs.thinkinginjava.common.Print.print;

/**
 * @author Junwei Wang (i.junwei.wang@gmail.com)
 */

// 模板方法
abstract class GenericWithCreate<T> {
    final T element;

    GenericWithCreate() {
        element = create();
    }

    abstract T create();
}

class X {
}

class Creator extends GenericWithCreate<X> {

    @Override
    X create() {
        return new X();
    }

    void f() {
        print(element.getClass().getSimpleName());
    }
}

public class CreatorGeneric {
    public static void main(String[] args) {
        Creator c = new Creator();
        c.f();
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">

    <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
        <property name="securityManager" ref="securityManager"/>
        <property name="loginUrl" value="/auth/unlogin"/>
        <property name="unauthorizedUrl" value="/auth/unauthorized"/>
        <property name="filters">
            <util:map>
                <entry key="replayAttack" value-ref="replayAttackFilter"/>
                <entry key="statelessAuthc" value-ref="statelessAuthcFilter"/>
                <entry key="ssl" value-ref="sslFilter"/>
            </util:map>
        </property>
        <property name="filterChainDefinitionMap" value="#{filterChainDefinitionsLoader.loadDefinitions()}"
                />
        <!-- <property name="filterChainDefinitions">
              <value>
              /login.html=anon
              /index.html=anon
              /app/**=anon
              /assets/**=anon
              /js/**=anon
              /sys/user/pagination=authc,rest[sys:user:pagination]
              /sys/user/**=authc,rest[sys:user]
              /** = anon
              </value>
          </property> -->
    </bean>

    <bean id="filterChainDefinitionsLoader" class="com.edgar.core.shiro.FilterChainDefinitionsLoader">
        <property name="dataSource" ref="db1.dataSource"/>
    </bean>

    <!-- Subject工厂 -->
    <bean id="subjectFactory"
          class="com.edgar.core.auth.stateless.StatelessDefaultSubjectFactory" />

    <!-- 会话管理器 -->
    <bean id="sessionManager" class="org.apache.shiro.session.mgt.DefaultSessionManager">
        <property name="sessionValidationSchedulerEnabled" value="false" />
    </bean>

    <!-- 安全管理器 -->
    <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
        <!-- Single realm app. If you have multiple realms, use the 'realms' property
              instead. -->
        <property name="realms">
            <list>
                <ref bean="usernamePasswordRealm"/>
                <ref bean="statelessRealm"/>
            </list>
        </property>
        <property name="subjectDAO.sessionStorageEvaluator.sessionStorageEnabled"
                  value="false" />
        <property name="subjectFactory" ref="subjectFactory" />
        <property name="sessionManager" ref="sessionManager" />
        <property name="authenticator.authenticationStrategy">
            <bean class="org.apache.shiro.authc.pam.FirstSuccessfulStrategy"/>
        </property>
    </bean>

    <!--<bean id="authenticator" class="org.apache.shiro.authc.pam.ModularRealmAuthenticator">
        <property name="authenticationStrategy">
            <bean class="org.apache.shiro.authc.pam.FirstSuccessfulStrategy" />
        </property>
    </bean>-->

    <bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>

    <!--用户名密码Realm-->
    <bean id="usernamePasswordRealm" class="com.edgar.core.auth.password.UsernamePasswordRealm">
        <property name="credentialsMatcher" ref="passwordMatcher"/>
    </bean>

    <!--无状态Realm-->
    <bean id="statelessRealm"
          class="com.edgar.core.auth.stateless.StatelessRealm">
        <property name="cachingEnabled" value="false"/>
    </bean>

    <!-- 相当于调用SecurityUtils.setSecurityManager(securityManager) -->
    <bean
            class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="staticMethod"
                  value="org.apache.shiro.SecurityUtils.setSecurityManager" />
        <property name="arguments" ref="securityManager" />
    </bean>

    <!--无状态的filter-->
    <bean id="statelessAuthcFilter" class="com.edgar.core.auth.stateless.StatelessAuthcFilter"/>
    <!--重放攻击的filter-->
    <bean id="replayAttackFilter" class="com.edgar.core.auth.stateless.ReplayAttackFilter"/>
    <bean id="sslFilter" class="org.apache.shiro.web.filter.authz.SslFilter">
        <property name="port" value="${httpsPort}"/>
    </bean>

    <bean id="passwordMatcher"
          class="org.apache.shiro.authc.credential.HashedCredentialsMatcher">
        <!-- <property name="cacheManager" ref="cacheManager" /> -->
        <property name="hashAlgorithmName" value="MD5"/>
        <property name="hashIterations" value="1024"/>
        <property name="storedCredentialsHexEncoded" value="true"/>
    </bean>

</beans>