text:
package route

import (
	"net/http"
	"testing"

	"github.com/stretchr/testify/assert"
)

type registeredHandler struct {
	val string
}

func (r registeredHandler) ServeHTTP(http.ResponseWriter, *http.Request)            {}
func (r registeredHandler) ServeErrorHTTP(http.ResponseWriter, *http.Request) error { return nil }

func register(lookup *treeLookup, route string) http.Handler {
	handler := registeredHandler{route}
	lookup.Add(route, handler)
	return handler
}

func registerRoutes(lookup *treeLookup, routes []string) map[string]http.Handler {
	handlers := map[string]http.Handler{}
	for _, route := range routes {
		handlers[route] = register(lookup, route)
	}
	return handlers
}

type lookupExpectation struct {
	requestPath     string
	expectedHandler http.Handler
	expectedParams  map[string]string
}

func checkExpectations(t *testing.T, lookup *treeLookup, expectations []lookupExpectation) {
	for _, expectation := range expectations {
		found, pars := lookup.Get(expectation.requestPath)

		assert.Equal(t, expectation.expectedHandler, found)
		assert.Equal(t, expectation.expectedParams, pars)
	}
}

func checkPanics(t *testing.T, testFunc func()) (recv interface{}) {
	defer func() {
		recv = recover()
		if recv == nil {
			t.Fatal("expected panic")
		}
	}()

	testFunc()
	return
}

func TestLookupRegisterRouteWithoutLeadingSlash(t *testing.T) {
	lookup := newLookup()

	checkPanics(t, func() {
		lookup.Add("file", registeredHandler{""})
	})
}

func TestLookupRegisterRouteWithTrailingSlash(t *testing.T) {
	lookup := newLookup()

	checkPanics(t, func() {
		lookup.Add("/file/", registeredHandler{""})
	})
}

func TestLookupRegisterGreedyParameterWithPathAfter(t *testing.T) {
	lookup := newLookup()

	checkPanics(t, func() {
		lookup.Add("/file/*path/cool", registeredHandler{""})
	})
}

func TestLookupRegisterGreedyParameterWithSameName(t *testing.T) {
	lookup := newLookup()

	lookup.Add("/file/*path", registeredHandler{"yay"})
	checkPanics(t, func() {
		lookup.Add("/file/*path", registeredHandler{""})
	})
}

func TestLookupRegisterNamedParameterWithDifferentNames(t *testing.T) {
	lookup := newLookup()

	lookup.Add("/file/:path", registeredHandler{"yay"})
	checkPanics(t, func() {
		lookup.Add("/file/:notpath", registeredHandler{""})
	})
}

func TestLookupRegisterNamedParameterWithEmptyName(t *testing.T) {
	lookup := newLookup()

	routes := []string{
		"/user/:",
		"/cmd/:/and",
		"/src/*",
	}
	for _, route := range routes {
		checkPanics(t, func() {
			register(lookup, route)
		})
	}
}

func TestLookupExactRoutes(t *testing.T) {
	lookup := newLookup()

	handlers := registerRoutes(lookup, []string{
		"/",
		"/a",
		"/a/b",
		"/a/b/c",
		"/a/d",
	})

	checkExpectations(t, lookup, []lookupExpectation{
		{"/", handlers["/"], map[string]string{}},
		{"/a", handlers["/a"], map[string]string{}},
		{"/a/b", handlers["/a/b"], map[string]string{}},
		{"/a/b/c", handlers["/a/b/c"], map[string]string{}},
		{"/a/d", handlers["/a/d"], map[string]string{}},
		{"/q", nil, map[string]string{}},

		// with trailing slash
		{"/a/", handlers["/a"], map[string]string{}},
		{"/a/b/", handlers["/a/b"], map[string]string{}},
		{"/a/b/c/", handlers["/a/b/c"], map[string]string{}},
		{"/a/d/", handlers["/a/d"], map[string]string{}},
		{"/q/", nil, map[string]string{}},
	})
}

func TestLookupParameter(t *testing.T) {
	lookup := newLookup()

	handlers := registerRoutes(lookup, []string{
		"/user/:name/create",
		"/user/:name",
		"/user/me",
	})

	expectations := []lookupExpectation{
		{"/user/me", handlers["/user/me"], map[string]string{}},                                  // exact match
		{"/user/john", handlers["/user/:name"], map[string]string{"name": "john"}},               // param match
		{"/user/john/create", handlers["/user/:name/create"], map[string]string{"name": "john"}}, // subpath match
		{"/user/me/create", handlers["/user/:name/create"], map[string]string{"name": "me"}},     // match deepest

		// with trailing slash
		{"/user/me/", handlers["/user/me"], map[string]string{}},                                  // exact match
		{"/user/john/", handlers["/user/:name"], map[string]string{"name": "john"}},               // param match
		{"/user/john/create/", handlers["/user/:name/create"], map[string]string{"name": "john"}}, // subpath match
		{"/user/me/create/", handlers["/user/:name/create"], map[string]string{"name": "me"}},     // match deepest
	}

	checkExpectations(t, lookup, expectations)
}

func TestLookupGreedyParameter(t *testing.T) {
	lookup := newLookup()

	handlers := registerRoutes(lookup, []string{
		"/file/this-exact-file",
		"/file/:dir/:file",
		"/file/:dir/*path",
	})

	expectations := []lookupExpectation{
		{"/file/this-exact-file", handlers["/file/this-exact-file"], map[string]string{}},                                 // exact matches
		{"/file/cool/thing.txt", handlers["/file/:dir/:file"], map[string]string{"dir": "cool", "file": "thing.txt"}},     // parameter match
		{"/file/cool/no/this.txt", handlers["/file/:dir/*path"], map[string]string{"dir": "cool", "path": "no/this.txt"}}, // greedy match
		{"/file/img", handlers["/file/:dir/*path"], map[string]string{"dir": "img", "path": ""}},                          // empty greedy match

		// with trailing slash
		{"/file/this-exact-file/", handlers["/file/this-exact-file"], map[string]string{}},                                 // exact matches
		{"/file/cool/thing.txt/", handlers["/file/:dir/:file"], map[string]string{"dir": "cool", "file": "thing.txt"}},     // parameter match
		{"/file/cool/no/this.txt/", handlers["/file/:dir/*path"], map[string]string{"dir": "cool", "path": "no/this.txt"}}, // greedy match
		{"/file/img/", handlers["/file/:dir/*path"], map[string]string{"dir": "img", "path": ""}},                          // empty greedy match
	}

	checkExpectations(t, lookup, expectations)
}

func TestLookupPriorities(t *testing.T) {
	lookup := newLookup()

	handlers := registerRoutes(lookup, []string{"/file/cool.txt", "/file/:name", "/file/*path"})

	expectations := []lookupExpectation{
		{"/file/cool.txt", handlers["/file/cool.txt"], map[string]string{}},
		{"/file/notcool.txt", handlers["/file/:name"], map[string]string{"name": "notcool.txt"}},
		{"/file/notcool.txt/yep", handlers["/file/*path"], map[string]string{"path": "notcool.txt/yep"}},
	}

	checkExpectations(t, lookup, expectations)
}

type route struct {
	method, path string
}

var (
	gplusAPI = []route{
		// People
		{"GET", "/people/:userId"},
		{"GET", "/people"},
		{"GET", "/activities/:activityId/people/:collection"},
		{"GET", "/people/:userId/people/:collection"},
		{"GET", "/people/:userId/openIdConnect"},

		// Activities
		{"GET", "/people/:userId/activities/:collection"},
		{"GET", "/activities/:activityId"},
		{"GET", "/activities"},

		// Comments
		{"GET", "/activities/:activityId/comments"},
		{"GET", "/comments/:commentId"},

		// Moments
		{"POST", "/people/:userId/moments/:collection"},
		{"GET", "/people/:userId/moments/:collection"},
		{"DELETE", "/moments/:id"},
	}

	parseAPI = []route{
		// Objects
		{"POST", "/1/classes/:className"},
		{"GET", "/1/classes/:className/:objectId"},
		{"PUT", "/1/classes/:className/:objectId"},
		{"GET", "/1/classes/:className"},
		{"DELETE", "/1/classes/:className/:objectId"},

		// Users
		{"POST", "/1/users"},
		{"GET", "/1/login"},
		{"GET", "/1/users/:objectId"},
		{"PUT", "/1/users/:objectId"},
		{"GET", "/1/users"},
		{"DELETE", "/1/users/:objectId"},
		{"POST", "/1/requestPasswordReset"},

		// Roles
		{"POST", "/1/roles"},
		{"GET", "/1/roles/:objectId"},
		{"PUT", "/1/roles/:objectId"},
		{"GET", "/1/roles"},
		{"DELETE", "/1/roles/:objectId"},

		// Files
		{"POST", "/1/files/:fileName"},

		// Analytics
		{"POST", "/1/events/:eventName"},

		// Push Notifications
		{"POST", "/1/push"},

		// Installations
		{"POST", "/1/installations"},
		{"GET", "/1/installations/:objectId"},
		{"PUT", "/1/installations/:objectId"},
		{"GET", "/1/installations"},
		{"DELETE", "/1/installations/:objectId"},

		// Cloud Functions
		{"POST", "/1/functions"},
	}
)

func Benchmark_GPlusStatic(b *testing.B) {
	benchRoute(b, gplusAPI, "/people")
}

func Benchmark_GPlusParam(b *testing.B) {
	benchRoute(b, gplusAPI, "/people/118051310819094153327")
}

func Benchmark_GPlus2Params(b *testing.B) {
	benchRoute(b, gplusAPI, "/people/118051310819094153327/activities/123456789")
}

func Benchmark_GPlusAll(b *testing.B) {
	benchRoutes(b, gplusAPI)
}

func Benchmark_ParseStatic(b *testing.B) {
	benchRoute(b, parseAPI, "/1/users")
}

func Benchmark_ParseParam(b *testing.B) {
	benchRoute(b, parseAPI, "/1/classes/go")
}

func Benchmark_Parse2Params(b *testing.B) {
	benchRoute(b, parseAPI, "/1/classes/go/123456789")
}

func Benchmark_ParseAll(b *testing.B) {
	benchRoutes(b, parseAPI)
}

func benchRoute(b *testing.B, routes []route, url string) {
	router := New()

	for _, route := range routes {
		router.Handle(route.path, registeredHandler{route.path})
	}

	r, _ := http.NewRequest("GET", url, nil)
	w := new(mockResponseWriter)

	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		router.ServeHTTP(w, r)
	}
}

func benchRoutes(b *testing.B, routes []route) {
	router := New()

	for _, route := range routes {
		router.Handle(route.path, registeredHandler{route.path})
	}

	w := new(mockResponseWriter)
	r, _ := http.NewRequest("GET", "/", nil)
	u := r.URL
	rq := u.RawQuery

	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		for _, route := range routes {
			r.Method = route.method
			r.RequestURI = route.path
			u.Path = route.path
			u.RawQuery = rq
			router.ServeHTTP(w, r)
		}
	}
}

type mockResponseWriter struct{}

func (m *mockResponseWriter) Header() (h http.Header) {
	return http.Header{}
}

func (m *mockResponseWriter) Write(p []byte) (n int, err error) {
	return len(p), nil
}

func (m *mockResponseWriter) WriteString(s string) (n int, err error) {
	return len(s), nil
}

func (m *mockResponseWriter) WriteHeader(int) {}


text:
module Google
  module Cloud
    module Language
      module V1beta2
        # ================================================================ #
        #
        # Represents the input to API methods.
        # @!attribute [rw] type
        #   @return [Google::Cloud::Language::V1beta2::Document::Type]
        #     Required. If the type is not set or is +TYPE_UNSPECIFIED+,
        #     returns an +INVALID_ARGUMENT+ error.
        # @!attribute [rw] content
        #   @return [String]
        #     The content of the input in string format.
        # @!attribute [rw] gcs_content_uri
        #   @return [String]
        #     The Google Cloud Storage URI where the file content is located.
        #     This URI must be of the form: gs://bucket_name/object_name. For more
        #     details, see https://cloud.google.com/storage/docs/reference-uris.
        #     NOTE: Cloud Storage object versioning is not supported.
        # @!attribute [rw] language
        #   @return [String]
        #     The language of the document (if not specified, the language is
        #     automatically detected). Both ISO and BCP-47 language codes are
        #     accepted.<br>
        #     [Language Support](https://cloud.google.com/natural-language/docs/languages)
        #     lists currently supported languages for each API method.
        #     If the language (either specified by the caller or automatically detected)
        #     is not supported by the called API method, an +INVALID_ARGUMENT+ error
        #     is returned.
        class Document
          # The document types enum.
          module Type
            # The content type is not specified.
            TYPE_UNSPECIFIED = 0

            # Plain text
            PLAIN_TEXT = 1

            # HTML
            HTML = 2
          end
        end

        # Represents a sentence in the input document.
        # @!attribute [rw] text
        #   @return [Google::Cloud::Language::V1beta2::TextSpan]
        #     The sentence text.
        # @!attribute [rw] sentiment
        #   @return [Google::Cloud::Language::V1beta2::Sentiment]
        #     For calls to {AnalyzeSentiment} or if
        #     {Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_document_sentiment AnnotateTextRequest::Features#extract_document_sentiment} is set to
        #     true, this field will contain the sentiment for the sentence.
        class Sentence; end

        # Represents a phrase in the text that is a known entity, such as
        # a person, an organization, or location. The API associates information, such
        # as salience and mentions, with entities.
        # @!attribute [rw] name
        #   @return [String]
        #     The representative name for the entity.
        # @!attribute [rw] type
        #   @return [Google::Cloud::Language::V1beta2::Entity::Type]
        #     The entity type.
        # @!attribute [rw] metadata
        #   @return [Hash{String => String}]
        #     Metadata associated with the entity.
        #
        #     Currently, Wikipedia URLs and Knowledge Graph MIDs are provided, if
        #     available. The associated keys are "wikipedia_url" and "mid", respectively.
        # @!attribute [rw] salience
        #   @return [Float]
        #     The salience score associated with the entity in the [0, 1.0] range.
        #
        #     The salience score for an entity provides information about the
        #     importance or centrality of that entity to the entire document text.
        #     Scores closer to 0 are less salient, while scores closer to 1.0 are highly
        #     salient.
        # @!attribute [rw] mentions
        #   @return [Array<Google::Cloud::Language::V1beta2::EntityMention>]
        #     The mentions of this entity in the input document. The API currently
        #     supports proper noun mentions.
        # @!attribute [rw] sentiment
        #   @return [Google::Cloud::Language::V1beta2::Sentiment]
        #     For calls to {AnalyzeEntitySentiment} or if
        #     {Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_entity_sentiment AnnotateTextRequest::Features#extract_entity_sentiment} is set to
        #     true, this field will contain the aggregate sentiment expressed for this
        #     entity in the provided document.
        class Entity
          # The type of the entity.
          module Type
            # Unknown
            UNKNOWN = 0

            # Person
            PERSON = 1

            # Location
            LOCATION = 2

            # Organization
            ORGANIZATION = 3

            # Event
            EVENT = 4

            # Work of art
            WORK_OF_ART = 5

            # Consumer goods
            CONSUMER_GOOD = 6

            # Other types
            OTHER = 7
          end
        end

        # Represents the smallest syntactic building block of the text.
        # @!attribute [rw] text
        #   @return [Google::Cloud::Language::V1beta2::TextSpan]
        #     The token text.
        # @!attribute [rw] part_of_speech
        #   @return [Google::Cloud::Language::V1beta2::PartOfSpeech]
        #     Parts of speech tag for this token.
        # @!attribute [rw] dependency_edge
        #   @return [Google::Cloud::Language::V1beta2::DependencyEdge]
        #     Dependency tree parse for this token.
        # @!attribute [rw] lemma
        #   @return [String]
        #     [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
        class Token; end

        # Represents the feeling associated with the entire text or entities in
        # the text.
        # @!attribute [rw] magnitude
        #   @return [Float]
        #     A non-negative number in the [0, +inf) range, which represents
        #     the absolute magnitude of sentiment regardless of score (positive or
        #     negative).
        # @!attribute [rw] score
        #   @return [Float]
        #     Sentiment score between -1.0 (negative sentiment) and 1.0
        #     (positive sentiment).
        class Sentiment; end

        # Represents part of speech information for a token.
        # @!attribute [rw] tag
        #   @return [Google::Cloud::Language::V1beta2::PartOfSpeech::Tag]
        #     The part of speech tag.
        # @!attribute [rw] aspect
        #   @return [Google::Cloud::Language::V1beta2::PartOfSpeech::Aspect]
        #     The grammatical aspect.
        # @!attribute [rw] case
        #   @return [Google::Cloud::Language::V1beta2::PartOfSpeech::Case]
        #     The grammatical case.
        # @!attribute [rw] form
        #   @return [Google::Cloud::Language::V1beta2::PartOfSpeech::Form]
        #     The grammatical form.
        # @!attribute [rw] gender
        #   @return [Google::Cloud::Language::V1beta2::PartOfSpeech::Gender]
        #     The grammatical gender.
        # @!attribute [rw] mood
        #   @return [Google::Cloud::Language::V1beta2::PartOfSpeech::Mood]
        #     The grammatical mood.
        # @!attribute [rw] number
        #   @return [Google::Cloud::Language::V1beta2::PartOfSpeech::Number]
        #     The grammatical number.
        # @!attribute [rw] person
        #   @return [Google::Cloud::Language::V1beta2::PartOfSpeech::Person]
        #     The grammatical person.
        # @!attribute [rw] proper
        #   @return [Google::Cloud::Language::V1beta2::PartOfSpeech::Proper]
        #     The grammatical properness.
        # @!attribute [rw] reciprocity
        #   @return [Google::Cloud::Language::V1beta2::PartOfSpeech::Reciprocity]
        #     The grammatical reciprocity.
        # @!attribute [rw] tense
        #   @return [Google::Cloud::Language::V1beta2::PartOfSpeech::Tense]
        #     The grammatical tense.
        # @!attribute [rw] voice
        #   @return [Google::Cloud::Language::V1beta2::PartOfSpeech::Voice]
        #     The grammatical voice.
        class PartOfSpeech
          # The part of speech tags enum.
          module Tag
            # Unknown
            UNKNOWN = 0

            # Adjective
            ADJ = 1

            # Adposition (preposition and postposition)
            ADP = 2

            # Adverb
            ADV = 3

            # Conjunction
            CONJ = 4

            # Determiner
            DET = 5

            # Noun (common and proper)
            NOUN = 6

            # Cardinal number
            NUM = 7

            # Pronoun
            PRON = 8

            # Particle or other function word
            PRT = 9

            # Punctuation
            PUNCT = 10

            # Verb (all tenses and modes)
            VERB = 11

            # Other: foreign words, typos, abbreviations
            X = 12

            # Affix
            AFFIX = 13
          end

          # The characteristic of a verb that expresses time flow during an event.
          module Aspect
            # Aspect is not applicable in the analyzed language or is not predicted.
            ASPECT_UNKNOWN = 0

            # Perfective
            PERFECTIVE = 1

            # Imperfective
            IMPERFECTIVE = 2

            # Progressive
            PROGRESSIVE = 3
          end

          # The grammatical function performed by a noun or pronoun in a phrase,
          # clause, or sentence. In some languages, other parts of speech, such as
          # adjective and determiner, take case inflection in agreement with the noun.
          module Case
            # Case is not applicable in the analyzed language or is not predicted.
            CASE_UNKNOWN = 0

            # Accusative
            ACCUSATIVE = 1

            # Adverbial
            ADVERBIAL = 2

            # Complementive
            COMPLEMENTIVE = 3

            # Dative
            DATIVE = 4

            # Genitive
            GENITIVE = 5

            # Instrumental
            INSTRUMENTAL = 6

            # Locative
            LOCATIVE = 7

            # Nominative
            NOMINATIVE = 8

            # Oblique
            OBLIQUE = 9

            # Partitive
            PARTITIVE = 10

            # Prepositional
            PREPOSITIONAL = 11

            # Reflexive
            REFLEXIVE_CASE = 12

            # Relative
            RELATIVE_CASE = 13

            # Vocative
            VOCATIVE = 14
          end

          # Depending on the language, Form can be categorizing different forms of
          # verbs, adjectives, adverbs, etc. For example, categorizing inflected
          # endings of verbs and adjectives or distinguishing between short and long
          # forms of adjectives and participles
          module Form
            # Form is not applicable in the analyzed language or is not predicted.
            FORM_UNKNOWN = 0

            # Adnomial
            ADNOMIAL = 1

            # Auxiliary
            AUXILIARY = 2

            # Complementizer
            COMPLEMENTIZER = 3

            # Final ending
            FINAL_ENDING = 4

            # Gerund
            GERUND = 5

            # Realis
            REALIS = 6

            # Irrealis
            IRREALIS = 7

            # Short form
            SHORT = 8

            # Long form
            LONG = 9

            # Order form
            ORDER = 10

            # Specific form
            SPECIFIC = 11
          end

          # Gender classes of nouns reflected in the behaviour of associated words.
          module Gender
            # Gender is not applicable in the analyzed language or is not predicted.
            GENDER_UNKNOWN = 0

            # Feminine
            FEMININE = 1

            # Masculine
            MASCULINE = 2

            # Neuter
            NEUTER = 3
          end

          # The grammatical feature of verbs, used for showing modality and attitude.
          module Mood
            # Mood is not applicable in the analyzed language or is not predicted.
            MOOD_UNKNOWN = 0

            # Conditional
            CONDITIONAL_MOOD = 1

            # Imperative
            IMPERATIVE = 2

            # Indicative
            INDICATIVE = 3

            # Interrogative
            INTERROGATIVE = 4

            # Jussive
            JUSSIVE = 5

            # Subjunctive
            SUBJUNCTIVE = 6
          end

          # Count distinctions.
          module Number
            # Number is not applicable in the analyzed language or is not predicted.
            NUMBER_UNKNOWN = 0

            # Singular
            SINGULAR = 1

            # Plural
            PLURAL = 2

            # Dual
            DUAL = 3
          end

          # The distinction between the speaker, second person, third person, etc.
          module Person
            # Person is not applicable in the analyzed language or is not predicted.
            PERSON_UNKNOWN = 0

            # First
            FIRST = 1

            # Second
            SECOND = 2

            # Third
            THIRD = 3

            # Reflexive
            REFLEXIVE_PERSON = 4
          end

          # This category shows if the token is part of a proper name.
          module Proper
            # Proper is not applicable in the analyzed language or is not predicted.
            PROPER_UNKNOWN = 0

            # Proper
            PROPER = 1

            # Not proper
            NOT_PROPER = 2
          end

          # Reciprocal features of a pronoun.
          module Reciprocity
            # Reciprocity is not applicable in the analyzed language or is not
            # predicted.
            RECIPROCITY_UNKNOWN = 0

            # Reciprocal
            RECIPROCAL = 1

            # Non-reciprocal
            NON_RECIPROCAL = 2
          end

          # Time reference.
          module Tense
            # Tense is not applicable in the analyzed language or is not predicted.
            TENSE_UNKNOWN = 0

            # Conditional
            CONDITIONAL_TENSE = 1

            # Future
            FUTURE = 2

            # Past
            PAST = 3

            # Present
            PRESENT = 4

            # Imperfect
            IMPERFECT = 5

            # Pluperfect
            PLUPERFECT = 6
          end

          # The relationship between the action that a verb expresses and the
          # participants identified by its arguments.
          module Voice
            # Voice is not applicable in the analyzed language or is not predicted.
            VOICE_UNKNOWN = 0

            # Active
            ACTIVE = 1

            # Causative
            CAUSATIVE = 2

            # Passive
            PASSIVE = 3
          end
        end

        # Represents dependency parse tree information for a token.
        # @!attribute [rw] head_token_index
        #   @return [Integer]
        #     Represents the head of this token in the dependency tree.
        #     This is the index of the token which has an arc going to this token.
        #     The index is the position of the token in the array of tokens returned
        #     by the API method. If this token is a root token, then the
        #     +head_token_index+ is its own index.
        # @!attribute [rw] label
        #   @return [Google::Cloud::Language::V1beta2::DependencyEdge::Label]
        #     The parse label for the token.
        class DependencyEdge
          # The parse label enum for the token.
          module Label
            # Unknown
            UNKNOWN = 0

            # Abbreviation modifier
            ABBREV = 1

            # Adjectival complement
            ACOMP = 2

            # Adverbial clause modifier
            ADVCL = 3

            # Adverbial modifier
            ADVMOD = 4

            # Adjectival modifier of an NP
            AMOD = 5

            # Appositional modifier of an NP
            APPOS = 6

            # Attribute dependent of a copular verb
            ATTR = 7

            # Auxiliary (non-main) verb
            AUX = 8

            # Passive auxiliary
            AUXPASS = 9

            # Coordinating conjunction
            CC = 10

            # Clausal complement of a verb or adjective
            CCOMP = 11

            # Conjunct
            CONJ = 12

            # Clausal subject
            CSUBJ = 13

            # Clausal passive subject
            CSUBJPASS = 14

            # Dependency (unable to determine)
            DEP = 15

            # Determiner
            DET = 16

            # Discourse
            DISCOURSE = 17

            # Direct object
            DOBJ = 18

            # Expletive
            EXPL = 19

            # Goes with (part of a word in a text not well edited)
            GOESWITH = 20

            # Indirect object
            IOBJ = 21

            # Marker (word introducing a subordinate clause)
            MARK = 22

            # Multi-word expression
            MWE = 23

            # Multi-word verbal expression
            MWV = 24

            # Negation modifier
            NEG = 25

            # Noun compound modifier
            NN = 26

            # Noun phrase used as an adverbial modifier
            NPADVMOD = 27

            # Nominal subject
            NSUBJ = 28

            # Passive nominal subject
            NSUBJPASS = 29

            # Numeric modifier of a noun
            NUM = 30

            # Element of compound number
            NUMBER = 31

            # Punctuation mark
            P = 32

            # Parataxis relation
            PARATAXIS = 33

            # Participial modifier
            PARTMOD = 34

            # The complement of a preposition is a clause
            PCOMP = 35

            # Object of a preposition
            POBJ = 36

            # Possession modifier
            POSS = 37

            # Postverbal negative particle
            POSTNEG = 38

            # Predicate complement
            PRECOMP = 39

            # Preconjunt
            PRECONJ = 40

            # Predeterminer
            PREDET = 41

            # Prefix
            PREF = 42

            # Prepositional modifier
            PREP = 43

            # The relationship between a verb and verbal morpheme
            PRONL = 44

            # Particle
            PRT = 45

            # Associative or possessive marker
            PS = 46

            # Quantifier phrase modifier
            QUANTMOD = 47

            # Relative clause modifier
            RCMOD = 48

            # Complementizer in relative clause
            RCMODREL = 49

            # Ellipsis without a preceding predicate
            RDROP = 50

            # Referent
            REF = 51

            # Remnant
            REMNANT = 52

            # Reparandum
            REPARANDUM = 53

            # Root
            ROOT = 54

            # Suffix specifying a unit of number
            SNUM = 55

            # Suffix
            SUFF = 56

            # Temporal modifier
            TMOD = 57

            # Topic marker
            TOPIC = 58

            # Clause headed by an infinite form of the verb that modifies a noun
            VMOD = 59

            # Vocative
            VOCATIVE = 60

            # Open clausal complement
            XCOMP = 61

            # Name suffix
            SUFFIX = 62

            # Name title
            TITLE = 63

            # Adverbial phrase modifier
            ADVPHMOD = 64

            # Causative auxiliary
            AUXCAUS = 65

            # Helper auxiliary
            AUXVV = 66

            # Rentaishi (Prenominal modifier)
            DTMOD = 67

            # Foreign words
            FOREIGN = 68

            # Keyword
            KW = 69

            # List for chains of comparable items
            LIST = 70

            # Nominalized clause
            NOMC = 71

            # Nominalized clausal subject
            NOMCSUBJ = 72

            # Nominalized clausal passive
            NOMCSUBJPASS = 73

            # Compound of numeric modifier
            NUMC = 74

            # Copula
            COP = 75

            # Dislocated relation (for fronted/topicalized elements)
            DISLOCATED = 76
          end
        end

        # Represents a mention for an entity in the text. Currently, proper noun
        # mentions are supported.
        # @!attribute [rw] text
        #   @return [Google::Cloud::Language::V1beta2::TextSpan]
        #     The mention text.
        # @!attribute [rw] type
        #   @return [Google::Cloud::Language::V1beta2::EntityMention::Type]
        #     The type of the entity mention.
        # @!attribute [rw] sentiment
        #   @return [Google::Cloud::Language::V1beta2::Sentiment]
        #     For calls to {AnalyzeEntitySentiment} or if
        #     {Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_entity_sentiment AnnotateTextRequest::Features#extract_entity_sentiment} is set to
        #     true, this field will contain the sentiment expressed for this mention of
        #     the entity in the provided document.
        class EntityMention
          # The supported types of mentions.
          module Type
            # Unknown
            TYPE_UNKNOWN = 0

            # Proper name
            PROPER = 1

            # Common noun (or noun compound)
            COMMON = 2
          end
        end

        # Represents an output piece of text.
        # @!attribute [rw] content
        #   @return [String]
        #     The content of the output text.
        # @!attribute [rw] begin_offset
        #   @return [Integer]
        #     The API calculates the beginning offset of the content in the original
        #     document according to the {Google::Cloud::Language::V1beta2::EncodingType EncodingType} specified in the API request.
        class TextSpan; end

        # Represents a category returned from the text classifier.
        # @!attribute [rw] name
        #   @return [String]
        #     The name of the category representing the document.
        # @!attribute [rw] confidence
        #   @return [Float]
        #     The classifier's confidence of the category. Number represents how certain
        #     the classifier is that this category represents the given text.
        class ClassificationCategory; end

        # The sentiment analysis request message.
        # @!attribute [rw] document
        #   @return [Google::Cloud::Language::V1beta2::Document]
        #     Input document.
        # @!attribute [rw] encoding_type
        #   @return [Google::Cloud::Language::V1beta2::EncodingType]
        #     The encoding type used by the API to calculate sentence offsets for the
        #     sentence sentiment.
        class AnalyzeSentimentRequest; end

        # The sentiment analysis response message.
        # @!attribute [rw] document_sentiment
        #   @return [Google::Cloud::Language::V1beta2::Sentiment]
        #     The overall sentiment of the input document.
        # @!attribute [rw] language
        #   @return [String]
        #     The language of the text, which will be the same as the language specified
        #     in the request or, if not specified, the automatically-detected language.
        #     See {Google::Cloud::Language::V1beta2::Document#language Document#language} field for more details.
        # @!attribute [rw] sentences
        #   @return [Array<Google::Cloud::Language::V1beta2::Sentence>]
        #     The sentiment for all the sentences in the document.
        class AnalyzeSentimentResponse; end

        # The entity-level sentiment analysis request message.
        # @!attribute [rw] document
        #   @return [Google::Cloud::Language::V1beta2::Document]
        #     Input document.
        # @!attribute [rw] encoding_type
        #   @return [Google::Cloud::Language::V1beta2::EncodingType]
        #     The encoding type used by the API to calculate offsets.
        class AnalyzeEntitySentimentRequest; end

        # The entity-level sentiment analysis response message.
        # @!attribute [rw] entities
        #   @return [Array<Google::Cloud::Language::V1beta2::Entity>]
        #     The recognized entities in the input document with associated sentiments.
        # @!attribute [rw] language
        #   @return [String]
        #     The language of the text, which will be the same as the language specified
        #     in the request or, if not specified, the automatically-detected language.
        #     See {Google::Cloud::Language::V1beta2::Document#language Document#language} field for more details.
        class AnalyzeEntitySentimentResponse; end

        # The entity analysis request message.
        # @!attribute [rw] document
        #   @return [Google::Cloud::Language::V1beta2::Document]
        #     Input document.
        # @!attribute [rw] encoding_type
        #   @return [Google::Cloud::Language::V1beta2::EncodingType]
        #     The encoding type used by the API to calculate offsets.
        class AnalyzeEntitiesRequest; end

        # The entity analysis response message.
        # @!attribute [rw] entities
        #   @return [Array<Google::Cloud::Language::V1beta2::Entity>]
        #     The recognized entities in the input document.
        # @!attribute [rw] language
        #   @return [String]
        #     The language of the text, which will be the same as the language specified
        #     in the request or, if not specified, the automatically-detected language.
        #     See {Google::Cloud::Language::V1beta2::Document#language Document#language} field for more details.
        class AnalyzeEntitiesResponse; end

        # The syntax analysis request message.
        # @!attribute [rw] document
        #   @return [Google::Cloud::Language::V1beta2::Document]
        #     Input document.
        # @!attribute [rw] encoding_type
        #   @return [Google::Cloud::Language::V1beta2::EncodingType]
        #     The encoding type used by the API to calculate offsets.
        class AnalyzeSyntaxRequest; end

        # The syntax analysis response message.
        # @!attribute [rw] sentences
        #   @return [Array<Google::Cloud::Language::V1beta2::Sentence>]
        #     Sentences in the input document.
        # @!attribute [rw] tokens
        #   @return [Array<Google::Cloud::Language::V1beta2::Token>]
        #     Tokens, along with their syntactic information, in the input document.
        # @!attribute [rw] language
        #   @return [String]
        #     The language of the text, which will be the same as the language specified
        #     in the request or, if not specified, the automatically-detected language.
        #     See {Google::Cloud::Language::V1beta2::Document#language Document#language} field for more details.
        class AnalyzeSyntaxResponse; end

        # The document classification request message.
        # @!attribute [rw] document
        #   @return [Google::Cloud::Language::V1beta2::Document]
        #     Input document.
        class ClassifyTextRequest; end

        # The document classification response message.
        # @!attribute [rw] categories
        #   @return [Array<Google::Cloud::Language::V1beta2::ClassificationCategory>]
        #     Categories representing the input document.
        class ClassifyTextResponse; end

        # The request message for the text annotation API, which can perform multiple
        # analysis types (sentiment, entities, and syntax) in one call.
        # @!attribute [rw] document
        #   @return [Google::Cloud::Language::V1beta2::Document]
        #     Input document.
        # @!attribute [rw] features
        #   @return [Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features]
        #     The enabled features.
        # @!attribute [rw] encoding_type
        #   @return [Google::Cloud::Language::V1beta2::EncodingType]
        #     The encoding type used by the API to calculate offsets.
        class AnnotateTextRequest
          # All available features for sentiment, syntax, and semantic analysis.
          # Setting each one to true will enable that specific analysis for the input.
          # @!attribute [rw] extract_syntax
          #   @return [true, false]
          #     Extract syntax information.
          # @!attribute [rw] extract_entities
          #   @return [true, false]
          #     Extract entities.
          # @!attribute [rw] extract_document_sentiment
          #   @return [true, false]
          #     Extract document-level sentiment.
          # @!attribute [rw] extract_entity_sentiment
          #   @return [true, false]
          #     Extract entities and their associated sentiment.
          # @!attribute [rw] classify_text
          #   @return [true, false]
          #     Classify the full document into categories.
          class Features; end
        end

        # The text annotations response message.
        # @!attribute [rw] sentences
        #   @return [Array<Google::Cloud::Language::V1beta2::Sentence>]
        #     Sentences in the input document. Populated if the user enables
        #     {Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_syntax AnnotateTextRequest::Features#extract_syntax}.
        # @!attribute [rw] tokens
        #   @return [Array<Google::Cloud::Language::V1beta2::Token>]
        #     Tokens, along with their syntactic information, in the input document.
        #     Populated if the user enables
        #     {Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_syntax AnnotateTextRequest::Features#extract_syntax}.
        # @!attribute [rw] entities
        #   @return [Array<Google::Cloud::Language::V1beta2::Entity>]
        #     Entities, along with their semantic information, in the input document.
        #     Populated if the user enables
        #     {Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_entities AnnotateTextRequest::Features#extract_entities}.
        # @!attribute [rw] document_sentiment
        #   @return [Google::Cloud::Language::V1beta2::Sentiment]
        #     The overall sentiment for the document. Populated if the user enables
        #     {Google::Cloud::Language::V1beta2::AnnotateTextRequest::Features#extract_document_sentiment AnnotateTextRequest::Features#extract_document_sentiment}.
        # @!attribute [rw] language
        #   @return [String]
        #     The language of the text, which will be the same as the language specified
        #     in the request or, if not specified, the automatically-detected language.
        #     See {Google::Cloud::Language::V1beta2::Document#language Document#language} field for more details.
        # @!attribute [rw] categories
        #   @return [Array<Google::Cloud::Language::V1beta2::ClassificationCategory>]
        #     Categories identified in the input document.
        class AnnotateTextResponse; end

        # Represents the text encoding that the caller uses to process the output.
        # Providing an +EncodingType+ is recommended because the API provides the
        # beginning offsets for various outputs, such as tokens and mentions, and
        # languages that natively use different text encodings may access offsets
        # differently.
        module EncodingType
          # If +EncodingType+ is not specified, encoding-dependent information (such as
          # +begin_offset+) will be set at +-1+.
          NONE = 0

          # Encoding-dependent information (such as +begin_offset+) is calculated based
          # on the UTF-8 encoding of the input. C++ and Go are examples of languages
          # that use this encoding natively.
          UTF8 = 1

          # Encoding-dependent information (such as +begin_offset+) is calculated based
          # on the UTF-16 encoding of the input. Java and Javascript are examples of
          # languages that use this encoding natively.
          UTF16 = 2

          # Encoding-dependent information (such as +begin_offset+) is calculated based
          # on the UTF-32 encoding of the input. Python is an example of a language
          # that uses this encoding natively.
          UTF32 = 3
        end
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text: CKEDITOR.plugins.setLang("widget","pt-br",{move:"Click e arraste para mover"});


text:
package com.aexxel.superproperty.core.converter;

import com.aexxel.superproperty.core.ValueConverter;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 */
public final class EnumConverter<T extends Enum<T>> implements ValueConverter<T> {

   private static final Logger LOGGER = Logger.getLogger(EnumConverter.class.getName());
   private final Class<T> valueClass;

   /**
    */
   @SuppressWarnings("unchecked")
   public EnumConverter(final Class<T> aValueClass) {
      if (aValueClass.getEnclosingClass() == null) {
         this.valueClass = aValueClass;
      } else if (Enum.class.isAssignableFrom(aValueClass.getEnclosingClass())) {
         this.valueClass = (Class<T>) aValueClass.getEnclosingClass();
      } else {
         this.valueClass = aValueClass;
      }
   }

   /**
    * {@inheritDoc}
    */
   public T convert(final String value) {
      if (value == null) {
         return null;
      }
      final T result = Enum.valueOf(this.valueClass, value);
      if (LOGGER.isLoggable(Level.FINEST)) {
         LOGGER.finest("Enum value found for " + this.valueClass + " is " + result);
      }
      return result;
   }

   /**
    * {@inheritDoc}
    */
   public Class<T> getValueClass() {
      return this.valueClass;
   }

   /**
    */
   public String toString() {
      return "EnumConverter{" +
            "valueClass=" +
            ((this.valueClass.getEnclosingClass() == null) ?
                  this.valueClass :
                  this.valueClass.getEnclosingClass()) +
            '}';
   }
}


text:
package com.newput.domain;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import org.springframework.stereotype.Service;

@Service
public class Employee implements Serializable {

	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.id
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private Integer id;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.first_name
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private String firstName;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.last_name
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private String lastName;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.email
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private String email;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.dob
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private Date dob;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.doj
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private Date doj;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.address
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private String address;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.contact
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private String contact;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.gender
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private String gender;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.password
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private String password;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.status
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private Boolean status;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.password_verification
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private Boolean passwordVerification;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.role
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private String role;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.created
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private Long created;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.updated
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private Long updated;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.time_zone
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private BigDecimal timeZone;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.v_token
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private String vToken;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.p_token
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private String pToken;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database column employee.p_expire_at
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private Long pExpireAt;
	/**
	 * This field was generated by MyBatis Generator. This field corresponds to the database table employee
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.id
	 * @return  the value of employee.id
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.id
	 * @param id  the value for employee.id
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.first_name
	 * @return  the value of employee.first_name
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public String getFirstName() {
		return firstName;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.first_name
	 * @param firstName  the value for employee.first_name
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.last_name
	 * @return  the value of employee.last_name
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public String getLastName() {
		return lastName;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.last_name
	 * @param lastName  the value for employee.last_name
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.email
	 * @return  the value of employee.email
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.email
	 * @param email  the value for employee.email
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.dob
	 * @return  the value of employee.dob
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public Date getDob() {
		return dob;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.dob
	 * @param dob  the value for employee.dob
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setDob(Date dob) {
		this.dob = dob;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.doj
	 * @return  the value of employee.doj
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public Date getDoj() {
		return doj;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.doj
	 * @param doj  the value for employee.doj
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setDoj(Date doj) {
		this.doj = doj;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.address
	 * @return  the value of employee.address
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public String getAddress() {
		return address;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.address
	 * @param address  the value for employee.address
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setAddress(String address) {
		this.address = address;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.contact
	 * @return  the value of employee.contact
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public String getContact() {
		return contact;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.contact
	 * @param contact  the value for employee.contact
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setContact(String contact) {
		this.contact = contact;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.gender
	 * @return  the value of employee.gender
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public String getGender() {
		return gender;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.gender
	 * @param gender  the value for employee.gender
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setGender(String gender) {
		this.gender = gender;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.password
	 * @return  the value of employee.password
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.password
	 * @param password  the value for employee.password
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.status
	 * @return  the value of employee.status
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public Boolean getStatus() {
		return status;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.status
	 * @param status  the value for employee.status
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setStatus(Boolean status) {
		this.status = status;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.password_verification
	 * @return  the value of employee.password_verification
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public Boolean getPasswordVerification() {
		return passwordVerification;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.password_verification
	 * @param passwordVerification  the value for employee.password_verification
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setPasswordVerification(Boolean passwordVerification) {
		this.passwordVerification = passwordVerification;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.role
	 * @return  the value of employee.role
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public String getRole() {
		return role;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.role
	 * @param role  the value for employee.role
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setRole(String role) {
		this.role = role;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.created
	 * @return  the value of employee.created
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public Long getCreated() {
		return created;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.created
	 * @param created  the value for employee.created
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setCreated(Long created) {
		this.created = created;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.updated
	 * @return  the value of employee.updated
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public Long getUpdated() {
		return updated;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.updated
	 * @param updated  the value for employee.updated
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setUpdated(Long updated) {
		this.updated = updated;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.time_zone
	 * @return  the value of employee.time_zone
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public BigDecimal getTimeZone() {
		return timeZone;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.time_zone
	 * @param timeZone  the value for employee.time_zone
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setTimeZone(BigDecimal timeZone) {
		this.timeZone = timeZone;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.v_token
	 * @return  the value of employee.v_token
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public String getvToken() {
		return vToken;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.v_token
	 * @param vToken  the value for employee.v_token
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setvToken(String vToken) {
		this.vToken = vToken;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.p_token
	 * @return  the value of employee.p_token
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public String getpToken() {
		return pToken;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.p_token
	 * @param pToken  the value for employee.p_token
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setpToken(String pToken) {
		this.pToken = pToken;
	}

	/**
	 * This method was generated by MyBatis Generator. This method returns the value of the database column employee.p_expire_at
	 * @return  the value of employee.p_expire_at
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public Long getpExpireAt() {
		return pExpireAt;
	}

	/**
	 * This method was generated by MyBatis Generator. This method sets the value of the database column employee.p_expire_at
	 * @param pExpireAt  the value for employee.p_expire_at
	 * @mbggenerated  Mon Oct 12 13:12:27 IST 2015
	 */
	public void setpExpireAt(Long pExpireAt) {
		this.pExpireAt = pExpireAt;
	}
}


text:
'use strict';

var grunt = require('grunt');

/*
 ======== A Handy Little Nodeunit Reference ========
 https://github.com/caolan/nodeunit

 Test methods:
 test.expect(numAssertions)
 test.done()
 Test assertions:
 test.ok(value, [message])
 test.equal(actual, expected, [message])
 test.notEqual(actual, expected, [message])
 test.deepEqual(actual, expected, [message])
 test.notDeepEqual(actual, expected, [message])
 test.strictEqual(actual, expected, [message])
 test.notStrictEqual(actual, expected, [message])
 test.throws(block, [error], [message])
 test.doesNotThrow(block, [error], [message])
 test.ifError(value)
 */

function fileExists( path, msg  ){
	return function( test ){
		var value = grunt.file.exists( path );
		test.equal( value, true, "The file '"+path+"'  should exist."  );
		test.done();
	};
}

exports.embedfont = {

	node: {
		node_convert_ttf_to_ttf: fileExists( "tmp/node/fonts/OpenSans/OpenSans-Light.ttf", "TTF fonts should have be generated from TTF source."),
		node_convert_ttf_to_woff: fileExists( "tmp/node/fonts/OpenSans/OpenSans-Light.woff", "WOFF fonts should have be generated from TTF source."),
		node_convert_ttf_to_eot: fileExists( "tmp/node/fonts/OpenSans/OpenSans-Light.eot", "EOT fonts should have be generated from TTF source."),
		node_convert_ttf_to_svg: fileExists( "tmp/node/fonts/OpenSans/OpenSans-Light.svg", "SVG fonts should have be generated from TTF source."),

		//TODO: find a way to support otf in node engine
		//node_convert_otf_to_ttf: fileExists( "tmp/node/fonts/Quicksand/Quicksand-Light.ttf", "TTF fonts should have be generated from OTF source."),
		//node_convert_otf_to_woff: fileExists( "tmp/node/fonts/Quicksand/Quicksand-Light.woff", "WOFF fonts should have be generated from OTF source."),
		//node_convert_otf_to_eot: fileExists( "tmp/node/fonts/Quicksand/Quicksand-Light.eot", "EOT fonts should have be generated from OTF source."),
		//node_convert_otf_to_svg: fileExists( "tmp/node/fonts/Quicksand/Quicksand-Light.svg", "SVG fonts should have be generated from OTF source."),

		less_generated: function( test ){
			var expected = grunt.file.read("test/fixtures/less/node-fonts.less");
			var actual = grunt.file.read("tmp/node/less/node-fonts.less");
			test.equal( actual, expected, "The generated LESS does not match the expected LESS.");
			test.done();
		},

		sass_generated: function( test ){
			var expected = grunt.file.read("test/fixtures/sass/sass-fonts.scss");
			var actual = grunt.file.read("tmp/sass/sass/sass-fonts.scss");
			test.equal( actual, expected, "The generated SASS does not match the expected SASS.");
			test.done();
		}

	},

	fontforge: {
		fontforge_convert_ttf_to_ttf: fileExists( "tmp/fontforge/fonts/OpenSans/OpenSans-Light.ttf", "TTF fonts should have be generated from TTF source."),
		fontforge_convert_ttf_to_woff: fileExists( "tmp/fontforge/fonts/OpenSans/OpenSans-Light.woff", "WOFF fonts should have be generated from TTF source."),
		fontforge_convert_ttf_to_eot: fileExists( "tmp/fontforge/fonts/OpenSans/OpenSans-Light.eot", "EOT fonts should have be generated from TTF source."),
		fontforge_convert_ttf_to_svg: fileExists( "tmp/fontforge/fonts/OpenSans/OpenSans-Light.svg", "SVG fonts should have be generated from TTF source."),

		fontforge_convert_otf_to_ttf: fileExists( "tmp/fontforge/fonts/Quicksand/Quicksand-Light.ttf", "TTF fonts should have be generated from OTF source."),
		fontforge_convert_otf_to_woff: fileExists( "tmp/fontforge/fonts/Quicksand/Quicksand-Light.woff", "WOFF fonts should have be generated from OTF source."),
		fontforge_convert_otf_to_eot: fileExists( "tmp/fontforge/fonts/Quicksand/Quicksand-Light.eot", "EOT fonts should have be generated from OTF source."),
		fontforge_convert_otf_to_svg: fileExists( "tmp/fontforge/fonts/Quicksand/Quicksand-Light.svg", "SVG fonts should have be generated from OTF source."),

		less_generated: function( test ){
			var expected = grunt.file.read("test/fixtures/less/fontforge-fonts.less");
			var actual = grunt.file.read("tmp/fontforge/less/fontforge-fonts.less");
			test.equal( actual, expected, "The generated LESS does not match the expected LESS.");
			test.done();
		},

		sass_generated: function( test ){
			var expected = grunt.file.read("test/fixtures/sass/sass-fonts.scss");
			var actual = grunt.file.read("tmp/sass/sass/sass-fonts.scss");
			test.equal( actual, expected, "The generated SASS does not match the expected SASS.");
			test.done();
		}

	},

	css: {
		css_generated: function( test ){
			var expected = grunt.file.read("test/fixtures/css/css-fonts.css");
			var actual = grunt.file.read("tmp/css/css/css-fonts.css");
			test.equal( actual, expected, "The generated CSS does not match the expected CSS.");
			test.done();
		}
	},

	less: {
		less_generated: function( test ){
			var expected = grunt.file.read("test/fixtures/less/less-fonts.less");
			var actual = grunt.file.read("tmp/less/less/less-fonts.less");
			test.equal( actual, expected, "The generated LESS does not match the expected LESS.");
			test.done();
		}
	},

	sass: {
		sass_generated: function( test ){
			var expected = grunt.file.read("test/fixtures/sass/sass-fonts.scss");
			var actual = grunt.file.read("tmp/sass/sass/sass-fonts.scss");
			test.equal( actual, expected, "The generated SASS does not match the expected SASS.");
			test.done();
		}
	}

};


text:
require './models/manager_service.rb'
require 'active_support'

class Throttle < ManagerService

  LOG_MESSAGE = 'GtkApi::' + self.name

  class ThrottleNotCreatedError < StandardError; end
  class ThrottleNotSavedError < StandardError; end

  attr_accessor :available, :until

  def self.config(url:)
    method = LOG_MESSAGE + __method__.to_s
    raise ArgumentError.new('Throttle model can not be configured with nil or empty url') if (url.nil? || url.empty?)
    @@url = url
    GtkApi.logger.debug(method) {'entered with url='+url}
  end

  def self.open?(params)
    method = LOG_MESSAGE + __method__.to_s
    GtkApi.logger.debug(method) {"entered with params=#{params}"}
    throttle = self.find_by_user_uuid(params[:user_uuid])
    if throttle
      GtkApi.logger.debug(method) {"found throttle #{throttle}"}
      throttle.apply_policy(params)
    else
      up_until = GtkApi.defaults['throttle']['value'].to_i.send(GtkApi.defaults['throttle']['unit']).send('from_now')
      GtkApi.logger.debug(method) {"up_until: #{up_until}"}
      throttle = self.new(params.merge({avaiable: GtkApi.defaults['throttle']['max_value'].to_i, up_until: up_until}))
      if throttle
        GtkApi.logger.debug(method) {"created throttle #{throttle}"}
      else
        raise ThrottleNotCreatedError.new "Could not create throttle #{throttle}."
      end
    end
    if throttle.save
      true
    else
      raise ThrottleNotSavedError.new "Could not save throttle #{throttle}."
    end
    false # needed?
  end

  def self.find_by_user_uuid(user_uuid)
    method = LOG_MESSAGE + __method__.to_s
    GtkApi.logger.debug(method) {"entered with useruuid=#{user_uuid}"}

    # TODO: fetch from micro-service/db
    # self.new(params.merge({avaiable: GtkApi.defaults['throttle']['max_value'].to_i, up_until: up_until}))
  end

  def initialize(available:, up_until:)
    method = LOG_MESSAGE + __method__.to_s
    GtkApi.logger.debug(method) {"entered"}
    @available = available
    @until = up_until
  end

  def save
    method = LOG_MESSAGE + __method__.to_s
    GtkApi.logger.debug(method) {"entered"}
    self
  end

  private

  # TODO: turn this into a Strategy Design Pattern, with this being UserBasedPolicy (e.g.)
  def apply_policy(params)
    method = LOG_MESSAGE + __method__.to_s
    GtkApi.logger.debug(method) {"entered"}

    # if still on the current cycle...
    if Time.now < @until
      # ...number matters
      if @available > 0
        @available -= 1
        true
      else
        false
      end
    else # ...otherwise, reset
      @available = GtkApi.defaults['throttle']['max_value'].to_i
      @until = GtkApi.defaults['throttle']['value'].to_i.send(GtkApi.defaults['throttle']['unit']).send('from_now')
      true
    end
  end
end


text:
feature "Dasbboard Compoanies" do
  before do
    admin = FactoryGirl.create(:admin)
    signin(admin.email, admin.password)
  end

  # Scenario: Visitor can see any company
  #   Given I am a visitor
  #   When I visit a company
  #   Then I see it information
  scenario "admins can view list of companies" do
    FactoryGirl.create_list(:company, 10)
    visit dashboard_companies_path
    expect(page).to have_content Company.take.title
  end
end


text:
    ×

{{ 'SETTINGS' | translate }}

App version: {{appVersion}} - {{ 'RELEASE_NOTES' | translate }}

        Anime language match

                <input type="checkbox" ng-model="languageMatch" style="margin-top:0;">Display animes available only in my default language.

        API - Secure connection

                <input type="checkbox" ng-model="useSecureConnection" style="margin-top:0;">Use secure connection for TopAnimeStream API (https)

        Default language

            <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
                  English

            </button>

  English

  Français

  Español

    <button class="btn btn-default btn-sm pull-left" ng-click="cancel()">{{ 'CLOSE' | translate }}</button>
    <button class="btn btn-success btn-sm pull-right" ng-click="saveChanges()">  {{ 'SAVE_CHANGES' | translate }}</button>


text:
package com.android.tools.idea.rendering;

import com.android.ide.common.rendering.api.LayoutLog;
import com.google.common.primitives.Ints;
import com.google.common.primitives.Shorts;
import com.intellij.openapi.util.SystemInfo;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.org.objectweb.asm.ClassReader;
import org.jetbrains.org.objectweb.asm.ClassVisitor;
import org.jetbrains.org.objectweb.asm.ClassWriter;
import org.jetbrains.org.objectweb.asm.Label;
import org.jetbrains.org.objectweb.asm.MethodVisitor;
import org.jetbrains.org.objectweb.asm.Opcodes;
import org.jetbrains.org.objectweb.asm.Type;

import java.util.Collection;

/**
 * Rewrites classes from one class file version to another and replaces onDraw, onMeasure and onLayout for custom views.
 *

 * Note that it does not attempt to handle cases where class file constructs cannot
 * be represented in the target version. This is intended for uses such as for example
 * the Android R class, which is simple and can be converted to pretty much any class file
 * version, which makes it possible to load it in an IDE layout render execution context
 * even if it has been compiled for a later version.
 *

 * For custom views (classes that inherit from android.view.View or any widget in android.widget.*)
 * the onDraw, onMeasure and onLayout methods are replaced with methods that capture any exceptions thrown.
 * This way we avoid custom views breaking the rendering.
 */
public class ClassConverter {
  private static final String ORIGINAL_SUFFIX = "_Original";
  private static final String ERROR_METHOD_DESCRIPTION;

  static {
    String desc;
    try {
       desc = Type.getMethodDescriptor(LayoutLog.class.getMethod("error", String.class, String.class, Throwable.class, Object.class));
    }
    catch (NoSuchMethodException e) {
      desc = "";
      // We control the API, so the method should always exist.
      assert false;
    }
    ERROR_METHOD_DESCRIPTION = desc;
  }

  /**
   * Rewrites the given class to a version runnable on the current JDK
   */
  @NotNull
  public static byte[] rewriteClass(@NotNull byte[] classData) {
    int current = getCurrentClassVersion();
    return rewriteClass(classData, current, 0);
  }

  /**
   * Rewrites the given class to the given target class file version.
   */
  @NotNull
  public static byte[] rewriteClass(@NotNull byte[] classData, final int maxVersion, final int minVersion) {
    assert maxVersion >= minVersion;

    final ClassWriter classWriter = new ClassWriter(0);
    ClassVisitor classVisitor = new ClassVisitor(Opcodes.ASM5, classWriter) {
      private String myClassName;

      @Override
      public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
        myClassName = name;
        if (version > maxVersion) {
          version = maxVersion;
        }
        if (version < minVersion) {
          version = minVersion;
        }
        super.visit(version, access, name, signature, superName, interfaces);
      }

      /**
       * Creates a new method that calls an existing "name"_Original method and catches any exception the method might throw.
       * The exception is logged via the Bridge logger.
       *

       * Only void return type methods are currently supported.
       */
      private void wrapMethod(int access, String name, String desc, String signature, String[] exceptions) {
        assert Type.getReturnType(desc) == Type.VOID_TYPE : "Non void return methods are not supported";

        MethodVisitor mw = super.visitMethod(access, name, desc, signature, exceptions);

        Label tryStart = new Label();
        Label tryEnd = new Label();
        Label tryHandler = new Label();
        mw.visitTryCatchBlock(tryStart, tryEnd, tryHandler, "java/lang/Throwable");
        //try{
        mw.visitLabel(tryStart);
        mw.visitVarInsn(Opcodes.ALOAD, 0); // this
        // push all the parameters
        Type[] argumentTypes = Type.getMethodType(desc).getArgumentTypes();
        int nLocals = 1;
        for (Type argType : argumentTypes) {
          mw.visitVarInsn(argType.getOpcode(Opcodes.ILOAD), nLocals++);
        }
        mw.visitMethodInsn(Opcodes.INVOKEVIRTUAL, myClassName, name + ORIGINAL_SUFFIX, desc, false);
        mw.visitLabel(tryEnd);
        Label exit = new Label();
        mw.visitJumpInsn(Opcodes.GOTO, exit);
        //} catch(Throwable t) {
        mw.visitLabel(tryHandler);
        mw.visitFrame(Opcodes.F_SAME1, 0, null, 1, new Object[]{"java/lang/Throwable"});
        int throwableIndex = nLocals++;
        mw.visitVarInsn(Opcodes.ASTORE, throwableIndex);

        //  Bridge.getLog().warning()
        mw.visitMethodInsn(Opcodes.INVOKESTATIC, "com/android/layoutlib/bridge/Bridge", "getLog",
                           "()Lcom/android/ide/common/rendering/api/LayoutLog;", false);
        mw.visitLdcInsn(LayoutLog.TAG_BROKEN);
        mw.visitLdcInsn(name + " error");
        mw.visitVarInsn(Opcodes.ALOAD, throwableIndex);
        mw.visitInsn(Opcodes.ACONST_NULL);
        mw.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "com/android/ide/common/rendering/api/LayoutLog", "error", ERROR_METHOD_DESCRIPTION,
                           false);

        if ("onMeasure".equals(name)) {
          // For onMeasure we need to generate a call to setMeasureDimension to avoid an exception when no size is set
          mw.visitVarInsn(Opcodes.ALOAD, 0); // this
          mw.visitInsn(Opcodes.ICONST_0); // measuredWidth
          mw.visitInsn(Opcodes.ICONST_0); // measuredHeight
          mw.visitMethodInsn(Opcodes.INVOKEVIRTUAL, myClassName, "setMeasuredDimension", desc, false);
        }

        mw.visitLabel(exit);
        mw.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
        mw.visitInsn(Opcodes.RETURN);
        mw.visitMaxs(Math.max(argumentTypes.length + 1/*args + this*/, 5/*getLog + getLog parameters*/), nLocals);
      }

      @Override
      public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
        // We catch the exceptions from any onLayout, onMeasure or onDraw that match the signature from the View methods
        if (("onLayout".equals(name) && "(ZIIII)V".equals(desc) ||
             "onMeasure".equals(name) && "(II)V".equals(desc) ||
             "onDraw".equals(name) && "(Landroid/graphics/Canvas;)V".equals(desc)) &&
            ((access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED)) != 0)) {
          wrapMethod(access, name, desc, signature, exceptions);
          // Make the Original method private so that it does not end up calling the inherited method.
          int modifiedAccess = (access & ~Opcodes.ACC_PUBLIC & ~Opcodes.ACC_PROTECTED) | Opcodes.ACC_PRIVATE;
          return super.visitMethod(modifiedAccess, name + ORIGINAL_SUFFIX, desc, signature, exceptions);
        }

        return super.visitMethod(access, name, desc, signature, exceptions);
      }
    };
    ClassReader reader = new ClassReader(classData);
    reader.accept(classVisitor, 0);
    return classWriter.toByteArray();
  }

  /** Converts a JDK string like 1.6.0_65 to the corresponding class file version number, e.g. 50 */
  public static int jdkToClassVersion(@NotNull String version) { // e.g. 1.6.0_b52
    int dot = version.indexOf('.');
    if (dot != -1) {
      dot++;
      int end = version.length();
      for (int i = dot; i < end; i++) {
        if (!Character.isDigit(version.charAt(i))) {
          end = i;
          break;
        }
      }
      if (end > dot) {
        int major = Integer.valueOf(version.substring(dot, end));
        if (major > 0) {
          return major + 44; // 1.3 => 47, ... 1.6 => 50, 1.7 => 51, ...
        }
      }
    }

    return -1;
  }

  /** Converts a class file version number  JDK string like 1.6.0_65 to the corresponding class file version number, e.g. 50 */
  public static String classVersionToJdk(int version) {
    return "1." + Integer.toString(version - 44); // 47 => 1.3, 50 => 1.6, ...
  }

  /** Given a set of exceptions, return the highest known classfile version format */
  public static int findHighestMajorVersion(Collection<Throwable> list) {
    int result = 0;
    for (Throwable t : list) {
      if (t instanceof InconvertibleClassError) {
        InconvertibleClassError error = (InconvertibleClassError)t;
        result = Math.max(result, error.getMajor());
      }
    }

    return result;
  }

  /** Return the current JDK version number */
  public static String getCurrentJdkVersion() {
    String version = SystemInfo.JAVA_VERSION;
    int suffix = version.indexOf('_');
    if (suffix != -1) {
      version = version.substring(0, suffix);
    }

    return version;
  }

  /** Return the classfile version of the current JDK */
  public static int getCurrentClassVersion() {
    return jdkToClassVersion(SystemInfo.JAVA_VERSION);
  }

  /** Returns true if the given class file data represents a valid class */
  public static boolean isValidClassFile(@NotNull byte[] classData) {
    // See http://en.wikipedia.org/wiki/Java_class_file
    return classData.length >= 7 && getMagic(classData) == 0xCAFEBABE;
  }

  /** Returns the magic number of the given class file */
  public static int getMagic(@NotNull byte[] classData) {
    // See http://en.wikipedia.org/wiki/Java_class_file
    return Ints.fromBytes(classData[0], classData[1], classData[2], classData[3]);
  }

  /** Returns the major class file version */
  public static short getMajorVersion(byte[] classData) {
    // See http://en.wikipedia.org/wiki/Java_class_file
    return Shorts.fromBytes(classData[6], classData[7]);
  }

  /** Returns the minor class file version */
  public static short getMinorVersion(byte[] classData) {
    // See http://en.wikipedia.org/wiki/Java_class_file
    return Shorts.fromBytes(classData[4], classData[5]);
  }
}


text:
var express = require('express')
var router = express.Router()
var controllers = require('./controllers')
var passport = require('passport')
var huia_auth = require('./services/huia_auth')
var LocalStrategy = require('passport-local').Strategy
var multer  = require('multer')
var upload = multer({ dest: 'uploads/' })

passport.use(new LocalStrategy(
    function(username, password, done) {
        var user = huia_auth.auth(username, password, function(err, user) {
            return done(null, user)
        })
    }
))

passport.serializeUser(function(user, done) {
    done(null, user);
});

passport.deserializeUser(function(user, done) {
    done(null, user);
});

router.get('/login', controllers.login.get_login)
router.post('/login',
    passport.authenticate('local', {
        failureRedirect: '/login',
        successRedirect: '/photos'
    }),
    function(req, res) {
        res.redirect('/photos')
    })

//Home
router.get('/', controllers.instagram.get_index)

//Photos
router.get('/photos', authorize, upload.array('image'), controllers.photos.get_index)
router.post('/photos', authorize, upload.array('image'), controllers.photos.post_index)

//Instagram
router.get('/instagram/', controllers.instagram.get_index)
router.get('/instagram/subscribe', controllers.instagram.get_subscribe)
router.post('/instagram/subscribe', controllers.instagram.post_subscribe)
router.get('/instagram/photos', controllers.instagram.get_photos)
router.get('/instagram/maps', authorize, controllers.instagram.get_maps)
router.post('/instagram/maps', authorize, controllers.instagram.post_maps)
router.get('/instagram/subscriptions', authorize, controllers.instagram.get_subscriptions)
router.post('/instagram/subscriptions', authorize, controllers.instagram.post_subscriptions)
//router.put('/instagram/subscriptions', authorize, controllers.instagram.put_subscriptions)
//router.delete('/instagram/subscriptions', authorize, controllers.instagram.delete_subscriptions)

module.exports = router

function authorize(req, res, next) {
  if (req.isAuthenticated()) { return next(); }
  res.redirect('/login');
}


text:
var f = require('./formatters');
var SolidityType = require('./type');

/**
 * SolidityTypeAddress is a prootype that represents address type
 * It matches:
 * address
 * address[]
 * address[4]
 * address[][]
 * address[3][]
 * address[][6][], ...
 */
var SolidityTypeAddress = function () {
    this._inputFormatter = f.formatInputInt;
    this._outputFormatter = f.formatOutputAddress;
};

SolidityTypeAddress.prototype = new SolidityType({});
SolidityTypeAddress.prototype.constructor = SolidityTypeAddress;

SolidityTypeAddress.prototype.isType = function (name) {
    return !!name.match(/address(\[([0-9]*)\])?/);
};

SolidityTypeAddress.prototype.staticPartLength = function (name) {
    return 32 * this.staticArrayLength(name);
};

module.exports = SolidityTypeAddress;


text:
using System.IO;
using Serilog.Core;
using Serilog.Events;
using Serilog.Formatting;

namespace Serilog.Support
{
    public class TextWriterSink : ILogEventSink
    {
        readonly StringWriter output;
        readonly ITextFormatter formatter;

        public TextWriterSink(StringWriter output, ITextFormatter formatter)
        {
            this.output = output;
            this.formatter = formatter;
        }

        public void Emit(LogEvent logEvent)
        {
            formatter.Format(logEvent, output);
        }
    }
}


text:
package me.bazhenov.groovysh;

import jline.UnixTerminal;
import org.apache.sshd.server.Environment;

import static java.lang.Integer.parseInt;

/**
 * Overriding class for reading terminal width from SSH Environment
 */
public class SshTerminal extends UnixTerminal {

	private static final ThreadLocal<Environment> env = new ThreadLocal<Environment>();

	public SshTerminal() throws Exception {
		super();
	}

	@Override
	public int getWidth() {
		Environment environment = retrieveEnvironment();
		try {
			return parseInt(environment.getEnv().get("COLUMNS"));
		} catch (NumberFormatException e) {
			return DEFAULT_WIDTH;
		}
	}

	@Override
	public int getHeight() {
		Environment environment = retrieveEnvironment();
		try {
			return parseInt(environment.getEnv().get("LINES"));
		} catch (NumberFormatException e) {
			return DEFAULT_HEIGHT;
		}
	}

	private Environment retrieveEnvironment() {
		Environment environment = env.get();
		if (environment == null)
			throw new NullPointerException("Environement is not registered");
		return environment;
	}

	public static void registerEnvironment(Environment environment) {
		env.set(environment);
	}
}


text:
package main

import (
	"bytes"
	"fmt"
	"io"
	"os"
	"strings"
	"testing"

	"k8s.io/helm/pkg/getter"
	"k8s.io/helm/pkg/helm/helmpath"
	"k8s.io/helm/pkg/repo"
	"k8s.io/helm/pkg/repo/repotest"
)

func TestUpdateCmd(t *testing.T) {
	thome, err := tempHelmHome(t)
	if err != nil {
		t.Fatal(err)
	}

	cleanup := resetEnv()
	defer func() {
		os.RemoveAll(thome.String())
		cleanup()
	}()

	settings.Home = thome

	out := bytes.NewBuffer(nil)
	// Instead of using the HTTP updater, we provide our own for this test.
	// The TestUpdateCharts test verifies the HTTP behavior independently.
	updater := func(repos []*repo.ChartRepository, out io.Writer, hh helmpath.Home) {
		for _, re := range repos {
			fmt.Fprintln(out, re.Config.Name)
		}
	}
	uc := &repoUpdateCmd{
		update: updater,
		home:   helmpath.Home(thome),
		out:    out,
	}
	if err := uc.run(); err != nil {
		t.Fatal(err)
	}

	if got := out.String(); !strings.Contains(got, "charts") || !strings.Contains(got, "local") {
		t.Errorf("Expected 'charts' and 'local' (in any order) got %q", got)
	}
}

func TestUpdateCharts(t *testing.T) {
	ts, thome, err := repotest.NewTempServer("testdata/testserver/*.*")
	if err != nil {
		t.Fatal(err)
	}

	hh := helmpath.Home(thome)
	cleanup := resetEnv()
	defer func() {
		ts.Stop()
		os.RemoveAll(thome.String())
		cleanup()
	}()
	if err := ensureTestHome(hh, t); err != nil {
		t.Fatal(err)
	}

	settings.Home = thome

	r, err := repo.NewChartRepository(&repo.Entry{
		Name:  "charts",
		URL:   ts.URL(),
		Cache: hh.CacheIndex("charts"),
	}, getter.All(settings))
	if err != nil {
		t.Error(err)
	}

	b := bytes.NewBuffer(nil)
	updateCharts([]*repo.ChartRepository{r}, b, hh)

	got := b.String()
	if strings.Contains(got, "Unable to get an update") {
		t.Errorf("Failed to get a repo: %q", got)
	}
	if !strings.Contains(got, "Update Complete.") {
		t.Error("Update was not successful")
	}
}


text:
Sida med kommentarer

Detta är en enkel sida som visar hur kommentarer kan interagera med en page- eller frontcontroller.


text:
import json
from django.contrib.auth.models import User
from django.utils.translation import gettext as _

from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import login, authenticate, logout
from django.conf import settings
from django.template import loader

from protoLib.getStuff import getUserProfile, getUserLanguage
from protoExt.utils.utilsWeb import JsonError, JsonSuccess
# from protoExt.utils.utilsBase import getReadableError

def protoGetUserRights(request):
    """ return usr rights
    """

    # from http.client import ACCEPTED, UNAUTHORIZED
    ACCEPTED = 200
    UNAUTHORIZED = 401

    if request.method != 'POST':
        return JsonError( 'invalid message' )

    userName = request.POST['login']
    userPwd  = request.POST['password']

    errMsg = ''
    success = False
    language = None

    try:
        pUser = authenticate(username = userName, password = userPwd )
    except:
        pUser = None

    userInfo = { 'userName' : userName }

    if pUser is not None:
        if pUser.is_active:
            login(request, pUser)
            success = True
            userInfo[ 'isStaff' ] = pUser.is_staff
            userInfo[ 'isSuperUser' ] = pUser.is_superuser
            userInfo[ 'fullName' ] = pUser.get_full_name()

            # Si es login retorna la lengua del usuario
            userProfile = getUserProfile( pUser )
            language = getUserLanguage( userProfile.language or 'en' )

        else:
            # Return a 'disabled account' error message
            errMsg =  "Cet utilisateur est desactivé"

    else:
        # Return an 'invalid login' error message.
        errMsg =  "Mauvais utilisateur ou mot de passe"

    jsondict = {
        'success': success,
        'message': errMsg,
        'userInfo' : userInfo,
        'language' : language
    }

    # Encode json
    context = json.dumps( jsondict)
    return HttpResponse(context, content_type="application/json", status= ACCEPTED if success else UNAUTHORIZED )

def protoGetPasswordRecovery(request):

    if request.method != 'POST':
        return JsonError( 'invalid message' )

    errMsg =  "Mauvais utilisateur / email"

    if request.POST.get('email') and request.POST.get('login'):
        try:
            u = User.objects.get(email = request.POST['email'], username = request.POST['login'])
            if not u.is_active: return JsonError( 'Cet utilisateur est desactivé' )
            token = user_token(u)

            try:
                baseURI = 'http://' + settings.HOST_DOMAIN
            except: baseURI = request.get_host()
            baseURI += '/protoLib/'

            link = baseURI + 'resetpassword?a=%s&t=%s' % (u.pk, token)

            email_template_name = 'recovery/recovery_email.txt'
            body = loader.render_to_string(email_template_name).strip()
            message = _(body)
            message += ' %s\n\n%s : %s' % (link, _(u'Utilisateur'), request.POST['login'])
            message += ' \n\n%s' % (_(u'Si vous ne voulez pas réinitialiser votre mot de passe, il suffit d\'ignorer ce message et il va rester inchangé'))
            u.email_user( _('Nouveau mot de passe'), message)

        except Exception as e:
            return JsonError(_(errMsg))

    else:
        return JsonError( 'invalid message' )

    return JsonSuccess({ 'message': 'Ok' })

#     return HttpResponseRedirect('/')

def resetpassword(request):

    if request.method != 'GET':
        return JsonError( 'invalid message' )

#   link = '/protoExtReset'
    link = '/main'
    if request.GET.get('a') and request.GET.get('t'):
        user = User.objects.get(pk = request.GET['a'])
        token = user_token(user)
        if request.GET['t'] == token:
            newpass =  User.objects.make_random_password(length=8)
            user.set_password(newpass)
            user.save()
            message = _(u'Votre mot de passe a été réinitialisé ') +' : %s' % (newpass)
            message += ' \n\n%s : %s' % (_(u'Utilisateur'), user)
            user.email_user( _('Nouveau mot de passe'), message)

            return HttpResponseRedirect(link)
        else:
            return JsonError( token )

    return HttpResponseRedirect(link)

def changepassword(request):

    if request.method != 'POST':
        return JsonError( 'invalid message' )

    newpass1 = request.POST['newPassword1']
    newpass2 = request.POST['newPassword2']
    userName = request.POST['login']
    userPwd  = request.POST['current']

    errMsg =  "Mauvais utilisateur ou mot de passe"
    try:
        pUser = authenticate(username = userName, password = userPwd )
    except:
        return JsonError(_(errMsg))

    if pUser is None:
        return JsonError(_(errMsg))

    errMsg =  "Mauvais utilisateur ou mot de passe"

    if newpass1==newpass2:
        pUser.set_password(newpass1)
        pUser.save()
        if pUser.email:
            try:
                message = _(u'Votre mot de passe a été réinitialisé ') +' : %s' % (newpass1)
                message += ' \n\n%s : %s' % (_(u'Utilisateur'), pUser)
                pUser.email_user(_( 'Nouveau mot de passe'), message)
            except:
                pass
        return JsonSuccess({ 'message': 'Ok' })
    else:
        errMsg = 'Les mots de passe ne correspondent pas!'
    return JsonError(_(errMsg))

def user_token(user):
    import hashlib
    salt = user.email + settings.SECRET_KEY
    localHash = hashlib.md5( salt.encode('utf-8') ).hexdigest()
    return localHash

def protoLogout(request):

    logout(request)
    return JsonSuccess( { 'message': 'Ok' } )


text:
docker-modman
=============
[![GitHub tag](http://img.shields.io/github/tag/ffuenf/docker-modman.svg)][tag]
[![Build Status](https://img.shields.io/travis/ffuenf/docker-modman.svg)][travis]
[![Docker Pulls](https://img.shields.io/docker/pulls/ffuenf/modman.svg)][pulls]
[![Docker Stars](https://img.shields.io/docker/stars/ffuenf/modman.svg)][stars]
[![Docker Layers](https://badge.imagelayers.io/ffuenf/modman.svg)][layers]
[![PayPal Donate](https://img.shields.io/badge/paypal-donate-blue.svg)][paypal_donate]
[tag]: https://github.com/ffuenf/docker-modman/tags
[travis]: https://travis-ci.org/ffuenf/docker-modman
[pulls]: https://hub.docker.com/r/ffuenf/modman/
[stars]: https://hub.docker.com/r/ffuenf/modman/
[layers]: https://imagelayers.io/?images=ffuenf/modman:latest
[paypal_donate]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=J2PQS2WLT2Y8W&item_name=docker-modman%3a%20docker-modman&item_number=docker-modman&currency_code=EUR

This provides a copy of [modman](https://github.com/colinmollenhour/modman) to be used in a docker environment.

Usage
-----
The container requires an environment variable called `MAGE_ROOT_DIR` to be defined.
This container changes into this director before running the `modman` command.

The container also requires access to your Magento files.

Docker Compose
--------------
Assuming you have a data container called `data` which contains your files that you mount to `/var/www/html`, and your MySQL container is called `db` then your `docker-compose.yml` might look something like this:

    modman:
      image: ffuenf/modman
      environment:
        MAGE_ROOT_DIR: /var/www/html
      volumes_from:
        - data

This image can then be used to easily perform any `modman` command, for example:

    docker-compose run modman deploy-all

Development
-----------
1. Fork the repository from GitHub.
2. Clone your fork to your local machine:

        $ git clone git@github.com:USER/docker-modman.git

3. Create a git branch

        $ git checkout -b my_bug_fix

5. Make your changes/patches/fixes, committing appropriately
7. Push your changes to GitHub
8. Open a Pull Request

License and Author
------------------

- Author:: Achim Rosenhagen ()

The MIT License (MIT)

Copyright (c) 2015 ffuenf

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


text:
use crate::{
    ast::{Fragment, InlineFragment, VariableDefinition},
    parser::{SourcePosition, Spanning},
    validation::{ValidatorContext, Visitor},
    value::ScalarValue,
};
use std::fmt::Debug;

pub struct KnownTypeNames;

pub fn factory() -> KnownTypeNames {
    KnownTypeNames
}

impl<'a, S> Visitor<'a, S> for KnownTypeNames
where
    S: ScalarValue,
{
    fn enter_inline_fragment(
        &mut self,
        ctx: &mut ValidatorContext<'a, S>,
        fragment: &'a Spanning<InlineFragment<S>>,
    ) {
        if let Some(ref type_cond) = fragment.item.type_condition {
            validate_type(ctx, type_cond.item, &type_cond.start);
        }
    }

    fn enter_fragment_definition(
        &mut self,
        ctx: &mut ValidatorContext<'a, S>,
        fragment: &'a Spanning<Fragment<S>>,
    ) {
        let type_cond = &fragment.item.type_condition;
        validate_type(ctx, type_cond.item, &type_cond.start);
    }

    fn enter_variable_definition(
        &mut self,
        ctx: &mut ValidatorContext<'a, S>,
        &(_, ref var_def): &'a (Spanning<&'a str>, VariableDefinition<S>),
    ) {
        let type_name = var_def.var_type.item.innermost_name();
        validate_type(ctx, type_name, &var_def.var_type.start);
    }
}

fn validate_type<'a, S: Debug>(
    ctx: &mut ValidatorContext<'a, S>,
    type_name: &str,
    location: &SourcePosition,
) {
    if ctx.schema.type_by_name(type_name).is_none() {
        ctx.report_error(&error_message(type_name), &[*location]);
    }
}

fn error_message(type_name: &str) -> String {
    format!(r#"Unknown type "{}""#, type_name)
}

#[cfg(test)]
mod tests {
    use super::{error_message, factory};

    use crate::{
        parser::SourcePosition,
        validation::{expect_fails_rule, expect_passes_rule, RuleError},
        value::DefaultScalarValue,
    };

    #[test]
    fn known_type_names_are_valid() {
        expect_passes_rule::<_, _, DefaultScalarValue>(
            factory,
            r#"
          query Foo($var: String, $required: [String!]!) {
            user(id: 4) {
              pets { ... on Pet { name }, ...PetFields, ... { name } }
            }
          }
          fragment PetFields on Pet {
            name
          }
        "#,
        );
    }

    #[test]
    fn unknown_type_names_are_invalid() {
        expect_fails_rule::<_, _, DefaultScalarValue>(
            factory,
            r#"
          query Foo($var: JumbledUpLetters) {
            user(id: 4) {
              name
              pets { ... on Badger { name }, ...PetFields }
            }
          }
          fragment PetFields on Peettt {
            name
          }
        "#,
            &[
                RuleError::new(
                    &error_message("JumbledUpLetters"),
                    &[SourcePosition::new(27, 1, 26)],
                ),
                RuleError::new(&error_message("Badger"), &[SourcePosition::new(120, 4, 28)]),
                RuleError::new(&error_message("Peettt"), &[SourcePosition::new(210, 7, 32)]),
            ],
        );
    }
}