text:
title_no_charge = {
    "title_number": "TEST_AB1234567",
    "class_of_title":"Absolute",
    "tenure":"Leasehold",
    "edition_date":"10-31-2005",
    "last_application":"10-31-2005T13:23:21.1234+01:00",

    "extent": {
        "type": "Feature",
        "crs": {
            "type":"name",
            "properties":{
                "name":"urn:ogc:def:crs:EPSG:27700"
            }
        },
        "geometry":{
            "type":"Polygon",
            "coordinates":[
                [[530857.01,181500.00],
                 [530857.00,181500.00],
                 [530857.00,181500.00],
                 [530857.00,181500.00],
                 [530857.01,181500.00]]
            ]
        },
        "properties":{
        }
    },

    "proprietorship" :   {
        "template" : "PROPRIETOR(S):  *RP*",
        "full_text": "PROPRIETOR(S): Michael Jones of 8 Miller Way, Plymouth, Devon, PL6 8UQ",
        "fields" : {"proprietors":[{"name" : {"title" : "Mr", "full_name" : "Bob Test", "decoration" : ""}, "addresses" : [{"full_address": "8 Miller Way, Plymouth, Devon, PL6 8UQ", "house_no" : "8", "street_name" : "Miller Way", "town" : "Plymouth", "postal_county" : "Devon", "region_name" : "", "country" : "", "postcode":""}]},
                                   {"name" : {"title" : "Mrs", "full_name" : "Betty Tanker", "decoration" : ""}, "addresses" : [{"full_address": "8 Miller Way, Plymouth, Devon, PL6 8UQ", "house_no" : "8", "street_name" : "Miller Way", "town" : "Plymouth", "postal_county" : "Devon", "region_name" : "", "country" : "", "postcode":""}]}]},
        "deeds" : [],
        "notes" : []
    },

    "property_description" : {
        "template" : "The Freehold land shown edged with red on the plan of the above Title filed at the Registry and being *AD*",
        "full_text" : "The Freehold land shown edged with red on the plan of the above Title filed at the Registry and being 8 Miller Way, Plymouth, Devon, PL6 8UQ",
        "fields" : {"addresses" : [{"full_address": "8 Miller Way, Plymouth, Devon, PL6 8UQ", "house_no" : "8", "street_name" : "Miller Way", "town" : "Plymouth", "postal_county" : "Devon", "region_name" : "", "country" : "", "postcode":""}]},
        "deeds" : [],
        "notes" : []
    },

    "restrictive_covenants" : [{

                                   "template" : "By an Order of the Upper Tribunal (Lands Chamber) dated *DA* made pursuant to Section 84 of the Law of Property Act 1925 the restrictive covenants contained in the *DT**DE* dated *DD* referred to above were released. *N<¬NOTE: Copy Order filed>N*.",
                                   "full_text" : "By an Order of the Upper Tribunal (Lands Chamber) dated 14/06/2013 made pursuant to Section 84 of the Law of Property Act 1925 the restrictive covenants contained in the Conveyance dated 01.06.1996 referred to above were released. NOTE: Copy Order filed",
                                   "fields" : {"date" : ["14/06/2013"], "extent" : [""]},
                                   "deeds" : [{"type" : "Conveyance", "date" : "01.06.1996", "parties" : [{"title" : "Mr", "full_name" : "Michael Jones", "decoration" : ""},{"title" : "Mr", "full_name" : "Jeff Smith", "decoration" : ""}]}],
                                   "notes" : [{"text" : "Copy Order filed", "documents_referred" : "I"}]
                               }],

    "restrictions" : [{
                          "template" : "RESTRICTION: No disposition by the proprietor of the registered estate or in exercise of the power of sale or leasing in any registered charge (except an exempt disposal as defined by section 81(8) of the Housing Act 1988) is to be registered without the consent of - (a) in relation to a disposal of land in England by a private registered provider of social housing, the Regulator of Social Housing, (b) in relation to any other disposal of land in England, the Secretary of State, and (c) in relation to a disposal of land in Wales, the Welsh Ministers, to that disposition under *M<>M*.",
                          "full_text" : "RESTRICTION: No disposition by the proprietor of the registered estate or in exercise of the power of sale or leasing in any registered charge (except an exempt disposal as defined by section 81(8) of the Housing Act 1988) is to be registered without the consent of - (a) in relation to a disposal of land in England by a private registered provider of social housing, the Regulator of Social Housing, (b) in relation to any other disposal of land in England, the Secretary of State, and (c) in relation to a disposal of land in Wales, the Welsh Ministers, to that disposition under section 133 of that Act.",
                          "fields" : {"miscellaneous" : ["section 133 of that Act"]},
                          "deeds" : [],
                          "notes" : []
                      }],

    "bankruptcy" : [{
                        "template" : "BANKRUPTCY NOTICE entered under section 86(2) of the Land Registration Act 2002 in respect of a pending action, as the title of the proprietor of the registered estate appears to be affected by a petition in bankruptcy against *NM* presented in the *M<>M* Court (Court Reference Number *M<>M*) (Land Charges Reference Number PA*M<>M*).",
                        "full_text" : "BANKRUPTCY NOTICE entered under section 86(2) of the Land Registration Act 2002 in respect of a pending action, as the title of the proprietor of the registered estate appears to be affected by a petition in bankruptcy against James Lock presented in the Gloucester County Court (Court Reference Number 124578) (Land Charges Reference Number PA102).",
                        "fields" : {"name" : ["James Lock"], "miscellaneous" : ["Gloucester County",  "124578",  "102"]},
                        "deeds" : [],
                        "notes" : []
                    }],

    "easements" : [{
                       "template" : "The land *E<>E* is subject to the rights granted by a *DT**DE* dated *DD* made between *DP*. The said Deed also contains restrictive covenants by the grantor. *N<^NOTE: Copy in Certificate. Copy filed>N*.",
                       "full_text" : "The land tinted pink is subject to the rights granted by a Deed dated 03.03.1976 made between Mr Michael Jones and Mr Jeff Smith. The said Deed also contains restrictive covenants by the grantor. NOTE: Copy filed.",
                       "fields" : {"extent" : ["tinted pink", ""]},
                       "deeds" : [{"type" : "Deed", "date" : "03.03.1976", "parties" : [{"title" : "Mr", "full_name" : "Michael Jones", "decoration" : ""},{"title" : "Mr", "full_name" : "Jeff Smith", "decoration" : ""}]}],
                       "notes" : [{"text" : "Copy filed", "documents_referred" : "I"}]
                   }],

    "provisions" : [{
                        "template" : "A *DT**DE* dated *DD* made between *DP* contains the following provision:-*VT*",
                        "full_text" : "A Transfer of the land in this title dated 01.06.1996 made between Mr Michael Jones and Mr Jeff Smith contains the following provision:-The land has the benefit of a right of way along the passageway to the rear of the property, and also a right of way on foot only on to the open ground on the north west boundary of the land in this title",
                        "fields" : {"extent" : ["of the land in this title"], "verbatim_text" : ["The land has the benefit of a right of way along the passageway to the rear of the property, and also a right of way on foot only on to the open ground on the north west boundary of the land in this title"]},
                        "deeds" : [{"type" : "Transfer", "date" : "01.06.1996", "parties" : [{"title" : "Mr", "full_name" : "Michael Jones", "decoration" : ""},{"title" : "Mr", "full_name" : "Jeff Smith", "decoration" : ""}]}],
                        "notes" : []
                    }],

    "price_paid" : {
        "template" : "The price stated to have been paid on *DA* was *AM*.",
        "full_text" : "The price stated to have been paid on 15/11/2005 was 100,000.",
        "fields" : {"date" : ["15/11/2005"], "amount" : ["100,000"]},
        "deeds" : [],
        "notes" : []
    },

    "h_schedule" : {
        "template" : "Short particulars of the lease(s) (or under-lease(s)) under which the land is held: Date: *DD* Term: *TM* *OR*<RENT:>*OR* Parties *DP* *NN* ",
        "full_text" : "Short particulars of the lease(s) (or under-lease(s)) under which the land is held: Date: 22nd September 1998 Term: 999 years Parties: Mr Michael Jones and Mr Jeff Smith. Note: The lease also comprises other land.",
        "fields" : {},
        "deeds" : [{"type" : "Transfer", "date" : "01.06.1996", "term" : "999 years", "parties" : [{"title" : "Mr", "full_name" : "Michael Jones", "decoration" : ""},{"title" : "Mr", "full_name" : "Jeff Smith", "decoration" : ""}]}],
        "notes" : [{"text" : "The lease also comprises other land", "documents_referred" : ""}]
    },
    "other" : [],
    "charges" : []

}

title_no_easement = {
    "title_number": "TEST_AB1234567",
    "class_of_title":"Absolute",
    "tenure":"Leasehold",
    "edition_date":"10-31-2005",
    "last_application":"10-31-2005T13:23:21.1234+01:00",

    "extent": {
        "type": "Feature",
        "crs": {
            "type":"name",
            "properties":{
                "name":"urn:ogc:def:crs:EPSG:27700"
            }
        },
        "geometry":{
            "type":"Polygon",
            "coordinates":[
                [[530857.01,181500.00],
                 [530857.00,181500.00],
                 [530857.00,181500.00],
                 [530857.00,181500.00],
                 [530857.01,181500.00]]
            ]
        },
        "properties":{
        }
    },

    "proprietorship" :   {
        "template" : "PROPRIETOR(S):  *RP*",
        "full_text": "PROPRIETOR(S): Michael Jones of 8 Miller Way, Plymouth, Devon, PL6 8UQ",
        "fields" : {"proprietors":[{"name" : {"title" : "Mr", "full_name" : "Bob Test", "decoration" : ""}, "addresses" : [{"full_address": "8 Miller Way, Plymouth, Devon, PL6 8UQ", "house_no" : "8", "street_name" : "Miller Way", "town" : "Plymouth", "postal_county" : "Devon", "region_name" : "", "country" : "", "postcode":""}]},
                                   {"name" : {"title" : "Mrs", "full_name" : "Betty Tanker", "decoration" : ""}, "addresses" : [{"full_address": "8 Miller Way, Plymouth, Devon, PL6 8UQ", "house_no" : "8", "street_name" : "Miller Way", "town" : "Plymouth", "postal_county" : "Devon", "region_name" : "", "country" : "", "postcode":""}]}]},
        "deeds" : [],
        "notes" : []
    },

    "property_description" : {
        "template" : "The Freehold land shown edged with red on the plan of the above Title filed at the Registry and being *AD*",
        "full_text" : "The Freehold land shown edged with red on the plan of the above Title filed at the Registry and being 8 Miller Way, Plymouth, Devon, PL6 8UQ",
        "fields" : {"addresses" : [{"full_address": "8 Miller Way, Plymouth, Devon, PL6 8UQ", "house_no" : "8", "street_name" : "Miller Way", "town" : "Plymouth", "postal_county" : "Devon", "region_name" : "", "country" : "", "postcode":""}]},
        "deeds" : [],
        "notes" : []
    },

    "restrictive_covenants" : [{

                                   "template" : "By an Order of the Upper Tribunal (Lands Chamber) dated *DA* made pursuant to Section 84 of the Law of Property Act 1925 the restrictive covenants contained in the *DT**DE* dated *DD* referred to above were released. *N<¬NOTE: Copy Order filed>N*.",
                                   "full_text" : "By an Order of the Upper Tribunal (Lands Chamber) dated 14/06/2013 made pursuant to Section 84 of the Law of Property Act 1925 the restrictive covenants contained in the Conveyance dated 01.06.1996 referred to above were released. NOTE: Copy Order filed",
                                   "fields" : {"date" : ["14/06/2013"], "extent" : [""]},
                                   "deeds" : [{"type" : "Conveyance", "date" : "01.06.1996", "parties" : [{"title" : "Mr", "full_name" : "Michael Jones", "decoration" : ""},{"title" : "Mr", "full_name" : "Jeff Smith", "decoration" : ""}]}],
                                   "notes" : [{"text" : "Copy Order filed", "documents_referred" : "I"}]
                               }],

    "restrictions" : [{
                          "template" : "RESTRICTION: No disposition by the proprietor of the registered estate or in exercise of the power of sale or leasing in any registered charge (except an exempt disposal as defined by section 81(8) of the Housing Act 1988) is to be registered without the consent of - (a) in relation to a disposal of land in England by a private registered provider of social housing, the Regulator of Social Housing, (b) in relation to any other disposal of land in England, the Secretary of State, and (c) in relation to a disposal of land in Wales, the Welsh Ministers, to that disposition under *M<>M*.",
                          "full_text" : "RESTRICTION: No disposition by the proprietor of the registered estate or in exercise of the power of sale or leasing in any registered charge (except an exempt disposal as defined by section 81(8) of the Housing Act 1988) is to be registered without the consent of - (a) in relation to a disposal of land in England by a private registered provider of social housing, the Regulator of Social Housing, (b) in relation to any other disposal of land in England, the Secretary of State, and (c) in relation to a disposal of land in Wales, the Welsh Ministers, to that disposition under section 133 of that Act.",
                          "fields" : {"miscellaneous" : ["section 133 of that Act"]},
                          "deeds" : [],
                          "notes" : []
                      }],

    "bankruptcy" : [{
                        "template" : "BANKRUPTCY NOTICE entered under section 86(2) of the Land Registration Act 2002 in respect of a pending action, as the title of the proprietor of the registered estate appears to be affected by a petition in bankruptcy against *NM* presented in the *M<>M* Court (Court Reference Number *M<>M*) (Land Charges Reference Number PA*M<>M*).",
                        "full_text" : "BANKRUPTCY NOTICE entered under section 86(2) of the Land Registration Act 2002 in respect of a pending action, as the title of the proprietor of the registered estate appears to be affected by a petition in bankruptcy against James Lock presented in the Gloucester County Court (Court Reference Number 124578) (Land Charges Reference Number PA102).",
                        "fields" : {"name" : ["James Lock"], "miscellaneous" : ["Gloucester County",  "124578",  "102"]},
                        "deeds" : [],
                        "notes" : []
                    }],

    "easements" : [],

    "provisions" : [{
                        "template" : "A *DT**DE* dated *DD* made between *DP* contains the following provision:-*VT*",
                        "full_text" : "A Transfer of the land in this title dated 01.06.1996 made between Mr Michael Jones and Mr Jeff Smith contains the following provision:-The land has the benefit of a right of way along the passageway to the rear of the property, and also a right of way on foot only on to the open ground on the north west boundary of the land in this title",
                        "fields" : {"extent" : ["of the land in this title"], "verbatim_text" : ["The land has the benefit of a right of way along the passageway to the rear of the property, and also a right of way on foot only on to the open ground on the north west boundary of the land in this title"]},
                        "deeds" : [{"type" : "Transfer", "date" : "01.06.1996", "parties" : [{"title" : "Mr", "full_name" : "Michael Jones", "decoration" : ""},{"title" : "Mr", "full_name" : "Jeff Smith", "decoration" : ""}]}],
                        "notes" : []
                    }],

    "price_paid" : {
        "template" : "The price stated to have been paid on *DA* was *AM*.",
        "full_text" : "The price stated to have been paid on 15/11/2005 was £100,000.",
        "fields" : {"date" : ["15/11/2005"], "amount" : ["£100,000"]},
        "deeds" : [],
        "notes" : []
    },

    "h_schedule" : {
        "template" : "Short particulars of the lease(s) (or under-lease(s)) under which the land is held: Date: *DD* Term: *TM* *OR*<RENT:>*OR* Parties *DP* *NN* ",
        "full_text" : "Short particulars of the lease(s) (or under-lease(s)) under which the land is held: Date: 22nd September 1998 Term: 999 years Parties: Mr Michael Jones and Mr Jeff Smith. Note: The lease also comprises other land.",
        "fields" : {},
        "deeds" : [{"type" : "Transfer", "date" : "01.06.1996", "term" : "999 years", "parties" : [{"title" : "Mr", "full_name" : "Michael Jones", "decoration" : ""},{"title" : "Mr", "full_name" : "Jeff Smith", "decoration" : ""}]}],
        "notes" : [{"text" : "The lease also comprises other land", "documents_referred" : ""}]
    },
    "other" : [],
    "charges" : []

}

conveyancer_one_client = {
    "conveyancer_lrid": "214b78b1-20a0-4cdb-a0f3-111b5ba21d48",
    "title_number": "TEST1410429781566",
    "conveyancer_name": "Da Big Boss Company",
    "conveyancer_address": "123 High Street, Stoke, ST4 4AX",
    "clients": [
        {
            "lrid": "f55a02a0-057b-4a3f-9e34-ede5791a5874",
            "name": "Walter White",
            "address": "1 The house, The town, PL1 1AA",
            "DOB": "01-01-1960",
            "tel_no": "01752 123456",
            "email": "citizen@example.org"
        }
    ],
    "task": "sell"
}

conveyancer_two_clients = {
    "conveyancer_lrid": "214b78b1-20a0-4cdb-a0f3-111b5ba21d48",
    "title_number": "TEST1410429781566",
    "conveyancer_name": "Da Big Boss Company",
    "conveyancer_address": "123 High Street, Stoke, ST4 4AX",
    "clients": [
        {
            "lrid": "f55a02a0-057b-4a3f-9e34-ede5791a5874",
            "name": "Walter White",
            "address": "1 The house, The town, PL1 1AA",
            "DOB": "01-01-1960",
            "tel_no": "01752 123456",
            "email": "citizen@example.org"
        },
        {
            "lrid": "f55a02a0-057b-4a3f-9e34-ede5791a5874",
            "name": "Skyler White",
            "address": "1 The house, The town, PL1 1AA",
            "DOB": "04-06-1970",
            "tel_no": "01752 9999999",
            "email": "citizen2@example.org"
        }
    ],
    "task": "sell"
}

introductions_response = {
    "task": "sell",
    "conveyancer_address": "123 High Street, Stoke, ST4 4AX",
    "conveyancer_name": "Da Big Boss Company",
    "client_lrid": "f55a02a0-057b-4a3f-9e34-ede5791a5874",
    "title_number": "TEST1410429781566",
    "conveyancer_lrid": "214b78b1-20a0-4cdb-a0f3-111b5ba21d48"
}
import json
response_without_charge = json.dumps(title_no_charge)
response_without_easement = json.dumps(title_no_easement, encoding='utf-8')

response_relationship_one_client = json.dumps(conveyancer_one_client)
response_relationship_two_clients = json.dumps(conveyancer_two_clients)

response_intoduction_token_details = json.dumps(introductions_response)


text:
class NullUser < User

  def persisted?
    false
  end

  def initialize(name)
    super({ first_name: name, created_at: Time.now })
  end

  def presenter
    UserPresenter.new(self)
  end

  def gravatar_image
    super.gravatar_image({ default: true })
  end

end

redpajama_set_name: RedPajamaGithub


text:
cd ~/dev/atom-snazzy-clear-syntax/

# Until this is fixed, some commands won't be highlighted
# https://github.com/atom/language-shellscript/issues/59
ls -a | grep "package.json" | xargs cat

echo "pending" >> /dev/null


text:
set -x

if [[ -f ./proxy_setup.sh ]]; then
  . ./proxy_setup.sh
fi

BOOTSTRAP_IP="${1-10.0.100.3}"
USER="${2-root}"
ENVIRONMENT="${3-Test-Laptop}"

# load binary_server_url and binary_server_host (usually the bootstrap)
load_binary_server_info "$ENVIRONMENT"

# make sure we do not have a previous .chef directory in place to allow re-runs
if [[ -f .chef/knife.rb ]]; then
  sudo knife node delete `hostname -f` -y -k /etc/chef-server/admin.pem -u admin || true
  sudo knife client delete `hostname -f` -y -k /etc/chef-server/admin.pem -u admin || true
  mv .chef/ ".chef_found_$(date +"%m-%d-%Y %H:%M:%S")"
fi

mkdir .chef
cat << EOF > .chef/knife.rb
require 'rubygems'
require 'ohai'
o = Ohai::System.new
o.all_plugins

log_level                :info
node_name                o[:fqdn]
client_key               "$(pwd)/.chef/#{o[:fqdn]}.pem"
validation_client_name   'chef-validator'
validation_key           '/etc/chef-server/chef-validator.pem'
chef_server_url          'https://${BOOTSTRAP_IP}'
syntax_check_cache_path  '$(pwd)/.chef/syntax_check_cache'
cookbook_path '$(pwd)/cookbooks'

# Disable the Ohai password module which explodes on a Single-Sign-On-joined system
Ohai::Config[:disabled_plugins] = [ "passwd" ]
no_proxy_array = ["localhost", o[:ipaddress], o[:hostname], o[:fqdn], "${BOOTSTRAP_IP}", "${binary_server_host}"]
no_proxy_array.insert("*#{o[:domain]}") unless o[:domain].nil?
no_proxy_string = no_proxy_array.uniq * ","

ENV['http_proxy'] = "${http_proxy}"
ENV['https_proxy'] = "${https_proxy}"
ENV['no_proxy'] = no_proxy_string
http_proxy ENV['http_proxy']
https_proxy ENV['https_proxy']
no_proxy no_proxy_string
ENV['GIT_SSL_NO_VERIFY'] = 'true'
File.umask(0007)
EOF
cd cookbooks

# allow versions on cookbooks via "cookbook version"
for cookbook in "apt 2.4.0" python build-essential ubuntu cron "chef-client 4.2.4" ntp yum logrotate yum-epel sysctl chef_handler 7-zip windows ark sudo ulimit pam ohai "poise 1.0.12" graphite_handler java maven; do
  if [[ ! -d ${cookbook% *} ]]; then
     # unless the proxy was defined this knife config will be the same as the one generated above
    knife cookbook site download $cookbook --config ../.chef/knife.rb
    tar zxf ${cookbook% *}*.tar.gz
    rm ${cookbook% *}*.tar.gz
  fi
done
[[ -d dpkg_autostart ]] || git clone https://github.com/hw-cookbooks/dpkg_autostart.git

[[ -d jmxtrans ]] || git clone https://github.com/jmxtrans/jmxtrans-cookbook.git jmxtrans
[[ -d cobblerd ]] || git clone https://github.com/cbaenziger/cobbler-cookbook.git cobblerd -b cobbler_profile


text:
'use strict';

const Audit = require('../../audits/critical-request-chains.js');
const assert = require('assert');
const CriticalRequestChains = {
  0: {
    request: {
      endTime: 1,
      responseReceivedTime: 5,
      startTime: 0,
      url: 'https://example.com/'
    },
    children: {
      1: {
        request: {
          endTime: 16,
          responseReceivedTime: 14,
          startTime: 11,
          url: 'https://example.com/b.js'
        },
        children: {
        }
      },
      2: {
        request: {
          endTime: 17,
          responseReceivedTime: 15,
          startTime: 12,
          url: 'https://example.com/c.js'
        },
        children: {}
      }
    }
  }
};

/* eslint-env mocha */
describe('Performance: critical-request-chains audit', () => {
  it('calculates the correct chain length', () => {
    const output = Audit.audit({CriticalRequestChains});
    assert.equal(output.value, 2);
  });
});


text:
package backup

import (
	"context"

	"github.com/spf13/cobra"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

	api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
	"github.com/vmware-tanzu/velero/pkg/client"
	"github.com/vmware-tanzu/velero/pkg/cmd"
	"github.com/vmware-tanzu/velero/pkg/cmd/util/output"
)

func NewGetCommand(f client.Factory, use string) *cobra.Command {
	var listOptions metav1.ListOptions

	c := &cobra.Command{
		Use:   use,
		Short: "Get backups",
		Run: func(c *cobra.Command, args []string) {
			err := output.ValidateFlags(c)
			cmd.CheckError(err)

			veleroClient, err := f.Client()
			cmd.CheckError(err)

			var backups *api.BackupList
			if len(args) > 0 {
				backups = new(api.BackupList)
				for _, name := range args {
					backup, err := veleroClient.VeleroV1().Backups(f.Namespace()).Get(context.TODO(), name, metav1.GetOptions{})
					cmd.CheckError(err)
					backups.Items = append(backups.Items, *backup)
				}
			} else {
				backups, err = veleroClient.VeleroV1().Backups(f.Namespace()).List(context.TODO(), listOptions)
				cmd.CheckError(err)
			}

			_, err = output.PrintWithFormat(c, backups)
			cmd.CheckError(err)
		},
	}

	c.Flags().StringVarP(&listOptions.LabelSelector, "selector", "l", listOptions.LabelSelector, "only show items matching this label selector")

	output.BindFlags(c.Flags())

	return c
}


text:
package ua.stqu.pft.addressbook.tests;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import ua.stqu.pft.addressbook.model.ContactData;
import ua.stqu.pft.addressbook.model.Contacts;
import ua.stqu.pft.addressbook.model.GroupData;
import ua.stqu.pft.addressbook.model.Groups;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;

/**
 * Created by sikretSSD on 12.04.2016.
 */
public class AddContactToGroupTests extends TestBase {
    @BeforeMethod
    public void ensurePreconditionsGroups(){
        if (app.db().groups().size() == 0){
            app.goTo().groupPage();
            app.group().create(new GroupData().withName("group1").withHeader("header1").withFooter("footer1"));
        }
        if (app.db().contacts().size() == 0){
            app.goTo().homePage();
            app.contact().create(new ContactData().withFirstname("Firstname").withLastname("Lastname")
                    .withEmail("lala@gmail.com").withHomePhone("111111"));
        }
    }

    @Test
    public void testAddContactToGroup(){
        Contacts contacts = app.db().contacts();
        ContactData selectedContact = contacts.iterator().next();
        Groups groups = app.db().groups();
        GroupData group = groups.iterator().next();
        GroupData validGroup = new GroupData().withId(group.getId()).withName("group " + group.getId());
        app.goTo().groupPage();
        app.group().modify(validGroup);
        app.goTo().homePage();
        app.contact().selectContactById(selectedContact.getId());
        app.contact().selectGroupForAdding(validGroup.getName());
        app.contact().addToGroup();
        app.goTo().homePage();
        group.withName("group " + group.getId());
        selectedContact.inGroup(group);
        ContactData dbContact = app.db().contacts().stream()
                .filter(c->c.getId() == selectedContact.getId()).findFirst().get();
        assertThat(app.contact().count(), equalTo(contacts.size()));
        assertThat(selectedContact.getGroups(), equalTo(dbContact.getGroups()));
    }
}


text:
<?php

namespace App\Service;

use Liip\ImagineBundle\Binary\BinaryInterface;
use Liip\ImagineBundle\Imagine\Cache\Resolver\FlysystemResolver;

/**
 * Class FlySystemStorage.
 *
 * Extend class for add cache.
 */
class MyFlySystemResolver extends FlysystemResolver
{
    private const CACHE_MAX_AGE = 2678400;

    /**
     * Stores the content of the given binary.
     *
     * @param BinaryInterface $binary The image binary to store
     * @param string          $path   The path where the original file is expected to be
     * @param string          $filter The name of the imagine filter in effect
     */
    public function store(BinaryInterface $binary, $path, $filter): void
    {
        $this->flysystem->put(
            $this->getFilePath($path, $filter),
            $binary->getContent(),
            [
                'CacheControl' => \sprintf('max-age=%s', self::CACHE_MAX_AGE),
                'visibility' => $this->visibility,
            ]
        );
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace WebApplication3.Pages.MyList
{
  public class IndexModel : PageModel
  {
    [BindProperty]
    public MyList DataList { get; set; }

    public async Task OnGetAsync()
    {
      DataList = await Csla.DataPortal.FetchAsync<MyList>();
    }

    public async Task<IActionResult> OnPostAsync()
    {
      foreach (var item in DataList.Where(r => r.Remove).ToList())
        DataList.Remove(item);
      DataList = await DataList.SaveAsync();
      return RedirectToPage("Index");
    }
  }
}


text:
package com.epam.itweek.boosenger.repository;

import java.util.List;

import com.epam.itweek.boosenger.domain.Message;

public interface MessageRepository {

    void createMessage(String username, Message message);

    List<Message> listMessages(String username);
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bull. Soc. bot. Fr. 36: clxxi (1891)

#### Original name
Ostracoblabe Bornet & Flahault

### Remarks
null


text:
package org.verletandroid.Graphics;

import android.graphics.Bitmap;

/**
 * Created with IntelliJ IDEA.
 * User: George
 * Date: 28.04.13
 * Time: 15:28
 * To change this template use File | Settings | File Templates.
 */
public class Pixmap implements IPixmap {
    Bitmap bitmap;
    PixmapFormat format;

    public Pixmap(Bitmap bitmap, PixmapFormat format) {
        this.bitmap = bitmap;
        this.format = format;
    }

    @Override
    public int getWidth() {
        return bitmap.getWidth();
    }

    @Override
    public int getHeight() {
        return bitmap.getHeight();
    }

    @Override
    public PixmapFormat getFormat() {
        return format;
    }

    @Override
    public void dispose() {
       bitmap.recycle();
    }
}


text:
<!doctype html>

    <title>Code coverage report for lib/core/http-client.js</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="../../prettify.css" />
    <link rel="stylesheet" href="../../base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

      all files / lib/core/ http-client.js

        100%
        Statements
        25/25

        83.33%
        Branches
        10/12

        100%
        Functions
        9/9

        100%
        Lines
        25/25

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
1×
1×

25×

25×
25×
19×
19×

19×
19×
19×

25×
6×
2×

25×
25×

1×

1×
1×
1×
1×

1×
1×
1×

1×

1×

"use strict";
const http = require("http");
const buffer_util_1 = require("./buffer-util");
class HTTPClient {
    post(host, port, path, data, callback) {
        let post_options = {
            agent: false,
            host: host,
            port: port,
            path: path,
            method: "POST",
            headers: {
                "Content-Type": "application/json",
                "Content-Length": Buffer.byteLength(data)
            }
        };
        let responseData = new Buffer("");
        let post_req = http.request(post_options, function (response) {
            response.on("data", function (chunk) {
                responseData = Buffer.concat([responseData, chunk]);
            });
            response.on("end", function () {
                Eif (callback !== undefined && callback !== null) {
                    callback(responseData, response.statusCode, true);
                }
            });
        });
        post_req.on("error", function (error) {
            if (callback !== undefined && callback !== null) {
                callback(buffer_util_1.BufferUtil.fromString(error.message), 0, false);
            }
        });
        post_req.write(data);
        post_req.end();
    }
    get(host, port, path, callback) {
        let options = {
            host: host,
            port: port,
            path: path,
            method: "GET"
        };
        let responseData = new Buffer("");
        let request = http.request(options, function (response) {
            response.on("data", function (chunk) {
                responseData = Buffer.concat([responseData, chunk]);
            });
            response.on("end", function () {
                Eif (callback !== undefined && callback !== null) {
                    callback(responseData, response.statusCode);
                }
            });
        });
        request.end();
    }
}
exports.HTTPClient = HTTPClient;
//# sourceMappingURL=http-client.js.map

  Code coverage
  generated by istanbul at Thu Oct 20 2016 20:44:00 GMT-0500 (PET)


text:
import {shallow} from "enzyme";
import Button from "react-native-button";
import {Image} from "react-native";

import Login from "views/login";
import TextInputLato from "components/text-input-lato";
import TextLato from "components/text-lato";

describe("`login` view", () => {

    const asteroid = {};

    it("renders an `Image`", () => {
        const login = shallow(<Login asteroid={asteroid} />);
        expect(login.find(Image)).to.have.length(1);
    });

    it("renders 2 `TextInputLato`", () => {
        const login = shallow(<Login asteroid={asteroid} />);
        expect(login.find(TextInputLato)).to.have.length(2);
    });

    it("renders a `Button` with correct children", () => {
        const login = shallow(<Login asteroid={asteroid} />);
        expect(login.find(Button)).to.have.length(1);
        expect(login.find(Button).find(TextLato).prop("children")).to.equal("ACCEDI");
    });

    it("call `onLogin` function when Button is pressed", () => {
        const onPressButtonSpy = sinon.spy();
        Login.prototype.onLogin = onPressButtonSpy;
        const login = shallow(<Login asteroid={asteroid} />);
        const button = login.find(Button);
        const instance = login.instance();
        button.simulate("press");
        expect(onPressButtonSpy).to.have.callCount(1);
        expect(onPressButtonSpy).to.have.calledOn(instance);
    });

    it("call `renderErrorLogin` function", () => {
        const renderErrorLoginSpy = sinon.spy();
        Login.prototype.renderErrorLogin = renderErrorLoginSpy;
        shallow(<Login asteroid={asteroid} />);
        expect(renderErrorLoginSpy).to.have.callCount(1);
    });

    describe("`TextInput` email field", () => {

        it("renders the correct placeholder", () => {
            const login = shallow(<Login asteroid={asteroid} />);
            const emailTextInput = login.find(TextInputLato).first();
            expect(emailTextInput.prop("placeholder")).to.equal("Email");
        });

        it("call the `onChangeText` function with correct parameter and on correct instance", () => {
            const onChangeTextSpy = sinon.spy();
            Login.prototype.onChangeText = onChangeTextSpy;
            const login = shallow(<Login asteroid={asteroid} />);
            const emailTextInput = login.find(TextInputLato).first();
            const instance = login.instance();
            emailTextInput.simulate("changeText", "inputText");
            expect(onChangeTextSpy).to.have.been.calledWithExactly("email", "inputText");
            expect(onChangeTextSpy).to.have.been.calledOn(instance);
        });

        it("renders the correct `value`", () => {
            const login = shallow(<Login asteroid={asteroid} />);
            login.setState({email: "email"});
            const emailTextInput = login.find(TextInputLato).first();
            expect(emailTextInput.prop("value")).to.equal("email");
        });

    });

    describe("`TextInput` password field", () => {

        it("renders the correct placeholder", () => {
            const login = shallow(<Login asteroid={asteroid} />);
            const passwordTextInput = login.find(TextInputLato).last();
            expect(passwordTextInput.prop("placeholder")).to.equal("Password");
        });

        it("call the `onChangeText` function with correct parameter and on correct instance", () => {
            const onChangeTextSpy = sinon.spy();
            Login.prototype.onChangeText = onChangeTextSpy;
            const login = shallow(<Login asteroid={asteroid} />);
            const passwordTextInput = login.find(TextInputLato).last();
            const instance = login.instance();
            passwordTextInput.simulate("changeText", "inputText");
            expect(onChangeTextSpy).to.have.been.calledWithExactly("password", "inputText");
            expect(onChangeTextSpy).to.have.been.calledOn(instance);
        });

        it("renders the correct `value`", () => {
            const login = shallow(<Login asteroid={asteroid} />);
            login.setState({password: "password"});
            expect(login.find(TextInputLato).last().prop("value")).to.equal("password");
        });

    });

    describe("`onLogin` function", () => {

        const onLogin = Login.prototype.onLogin;

        it("call `asteroid.login` function with correct credentials", () => {
            const login = sinon.stub().returns(Promise.resolve());
            const setLoginError = sinon.spy();
            const instance = {
                state: {
                    email: "email",
                    password: "password"
                },
                props: {
                    asteroid: {
                        login
                    }
                },
                setLoginError
            };
            onLogin.call(instance);
            expect(login).to.have.callCount(1);
            expect(login).to.have.been.calledWithExactly({
                sso: {
                    username: "email",
                    password: "password"
                }
            });
        });

        it("call `setLoginError` function with `null`", () => {
            const login = sinon.stub().returns(Promise.resolve());
            const setLoginError = sinon.spy();
            const instance = {
                state: {
                    email: "email",
                    password: "password"
                },
                props: {
                    asteroid: {
                        login
                    }
                },
                setLoginError
            };
            onLogin.call(instance);
            expect(setLoginError).to.have.callCount(1);
            expect(setLoginError).to.have.been.calledWithExactly(null);
        });

        it("call `setLoginError` function with an `error` if promise is rejected", () => {
            const login = sinon.stub().returns(Promise.reject(new Error("Login Error")));
            const setLoginError = sinon.spy();
            const instance = {
                state: {
                    email: "email",
                    password: "password"
                },
                props: {
                    asteroid: {
                        login
                    }
                },
                setLoginError
            };
            onLogin.call(instance);
            return login().catch(() => {
                expect(setLoginError).to.have.callCount(2);
                expect(setLoginError.secondCall).to.have.calledOn(instance);
                expect(setLoginError.secondCall).to.have.been.calledWithExactly(new Error("Login Error"));
            });
        });

    });

    describe("`setLoginError` function", () => {

        const setLoginError = Login.prototype.setLoginError;

        it("call `setState` function with correct parameter [CASE: args `null`]", () => {
            const setState = sinon.spy();
            const instance = {
                setState
            };
            setLoginError.call(instance, null);
            expect(setState).to.have.callCount(1);
            expect(setState).to.have.calledWithExactly({loginError: false});
        });

        it("call `setState` function with correct parameter [CASE: args Error]", () => {
            const setState = sinon.spy();
            const instance = {
                setState
            };
            setLoginError.call(instance, new Error("Login Error"));
            expect(setState).to.have.callCount(1);
            expect(setState).to.have.calledWithExactly({loginError: true});
        });

    });

    describe("`onChangeText` function", () => {

        const onChangeText = Login.prototype.onChangeText;

        it("call `setState` function with correct parameter", () => {
            const setState = sinon.spy();
            const instance = {
                setState
            };
            onChangeText.call(instance, "email", "email");
            expect(setState).to.have.callCount(1);
            expect(setState).to.have.calledWithExactly({email: "email"});
        });

    });

    describe("`renderErrorLogin` function", () => {

        const renderErrorLogin = Login.prototype.renderErrorLogin;

        it("should render a React element if `loginError` is true", () => {
            const instance = {
                state: {
                    loginError: true
                }
            };
            const ErrorLogin = renderErrorLogin.call(instance);
            expect(TestUtils.isElement(ErrorLogin)).to.equal(true);
        });

        it("should render a React element if `loginError` is false", () => {
            const instance = {
                state: {
                    loginError: false
                }
            };
            const ErrorLogin = renderErrorLogin.call(instance);
            expect(ErrorLogin).to.equal(null);
        });

    });

});


text:
require 'tmpdir'
require 'giffy/version'
require 'giffy/pipeline'
require 'giffy/processors/video_extraction_processor'
require 'giffy/processors/image_sequence_processor'
require 'giffy/processors/gif_generation_processor'


text:
// Copyright (c) 2018 Nikolay Zahariev <zahasoft.com>. Licensed under the MIT License.

namespace Zahasoft.Weblog.Domain
{
    using Microsoft.AspNet.Identity;
    using Microsoft.AspNet.Identity.EntityFramework;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.Security.Claims;
    using System.Threading.Tasks;
    using Textres;

    public class User : IdentityUser
    {
        public User()
        {
            Posts = new HashSet<Post>();
        }

        [Required(ErrorMessageResourceType = typeof(Text), ErrorMessageResourceName = "Required")]
        [Display(Name = "UserName", ResourceType = typeof(Text))]
        public override string UserName { get; set; }

        [Required(ErrorMessageResourceType = typeof(Text), ErrorMessageResourceName = "Required")]
        [EmailAddress(ErrorMessageResourceType = typeof(Text), ErrorMessageResourceName = "InvalidEmail")]
        [Display(Name = "Email", ResourceType = typeof(Text))]
        public override string Email { get; set; }

        [Required(ErrorMessageResourceType = typeof(Text), ErrorMessageResourceName = "Required")]
        [Display(Name = "FirstName", ResourceType = typeof(Text))]
        public string FirstName { get; set; }

        [Required(ErrorMessageResourceType = typeof(Text), ErrorMessageResourceName = "Required")]
        [Display(Name = "LastName", ResourceType = typeof(Text))]
        public string LastName { get; set; }

        [Required(ErrorMessageResourceType = typeof(Text), ErrorMessageResourceName = "Required")]
        [Display(Name = "RegisteredOn", ResourceType = typeof(Text))]
        public DateTime? RegisteredOn { get; set; }

        [Display(Name = "Posts", ResourceType = typeof(Text))]
        public virtual ICollection<Post> Posts { get; set; }

        public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<User> manager) => await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
    }
}


text:
package basichost

import (
	"context"
	"io"
	"net"
	"strconv"
	"sync"
	"time"

	inat "github.com/libp2p/go-libp2p/p2p/net/nat"

	"github.com/libp2p/go-libp2p-core/network"

	ma "github.com/multiformats/go-multiaddr"
)

// NATManager is a simple interface to manage NAT devices.
type NATManager interface {
	// NAT gets the NAT device managed by the NAT manager.
	NAT() *inat.NAT

	// Ready receives a notification when the NAT device is ready for use.
	Ready() <-chan struct{}

	io.Closer
}

// NewNATManager creates a NAT manager.
func NewNATManager(net network.Network) NATManager {
	return newNatManager(net)
}

// natManager takes care of adding + removing port mappings to the nat.
// Initialized with the host if it has a NATPortMap option enabled.
// natManager receives signals from the network, and check on nat mappings:
//  * natManager listens to the network and adds or closes port mappings
//    as the network signals Listen() or ListenClose().
//  * closing the natManager closes the nat and its mappings.
type natManager struct {
	net   network.Network
	natmu sync.RWMutex
	nat   *inat.NAT

	ready    chan struct{} // closed once the nat is ready to process port mappings
	syncFlag chan struct{}

	refCount  sync.WaitGroup
	ctxCancel context.CancelFunc
}

func newNatManager(net network.Network) *natManager {
	ctx, cancel := context.WithCancel(context.Background())
	nmgr := &natManager{
		net:       net,
		ready:     make(chan struct{}),
		syncFlag:  make(chan struct{}, 1),
		ctxCancel: cancel,
	}
	nmgr.refCount.Add(1)
	go nmgr.background(ctx)
	return nmgr
}

// Close closes the natManager, closing the underlying nat
// and unregistering from network events.
func (nmgr *natManager) Close() error {
	nmgr.ctxCancel()
	nmgr.refCount.Wait()
	return nil
}

// Ready returns a channel which will be closed when the NAT has been found
// and is ready to be used, or the search process is done.
func (nmgr *natManager) Ready() <-chan struct{} {
	return nmgr.ready
}

func (nmgr *natManager) background(ctx context.Context) {
	defer nmgr.refCount.Done()

	discoverCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
	defer cancel()
	natInstance, err := inat.DiscoverNAT(discoverCtx)
	if err != nil {
		log.Info("DiscoverNAT error:", err)
		close(nmgr.ready)
		return
	}

	nmgr.natmu.Lock()
	nmgr.nat = natInstance
	nmgr.natmu.Unlock()
	close(nmgr.ready)

	// sign natManager up for network notifications
	// we need to sign up here to avoid missing some notifs
	// before the NAT has been found.
	nmgr.net.Notify((*nmgrNetNotifiee)(nmgr))
	defer nmgr.net.StopNotify((*nmgrNetNotifiee)(nmgr))

	nmgr.doSync() // sync one first.
	for {
		select {
		case <-nmgr.syncFlag:
			nmgr.doSync() // sync when our listen addresses chnage.
		case <-ctx.Done():
			return
		}
	}
}

func (nmgr *natManager) sync() {
	select {
	case nmgr.syncFlag <- struct{}{}:
	default:
	}
}

// doSync syncs the current NAT mappings, removing any outdated mappings and adding any
// new mappings.
func (nmgr *natManager) doSync() {
	ports := map[string]map[int]bool{
		"tcp": {},
		"udp": {},
	}
	for _, maddr := range nmgr.net.ListenAddresses() {
		// Strip the IP
		maIP, rest := ma.SplitFirst(maddr)
		if maIP == nil || rest == nil {
			continue
		}

		switch maIP.Protocol().Code {
		case ma.P_IP6, ma.P_IP4:
		default:
			continue
		}

		// Only bother if we're listening on a
		// unicast/unspecified IP.
		ip := net.IP(maIP.RawValue())
		if !(ip.IsGlobalUnicast() || ip.IsUnspecified()) {
			continue
		}

		// Extract the port/protocol
		proto, _ := ma.SplitFirst(rest)
		if proto == nil {
			continue
		}

		var protocol string
		switch proto.Protocol().Code {
		case ma.P_TCP:
			protocol = "tcp"
		case ma.P_UDP:
			protocol = "udp"
		default:
			continue
		}

		port, err := strconv.ParseUint(proto.Value(), 10, 16)
		if err != nil {
			// bug in multiaddr
			panic(err)
		}
		ports[protocol][int(port)] = false
	}

	var wg sync.WaitGroup
	defer wg.Wait()

	// Close old mappings
	for _, m := range nmgr.nat.Mappings() {
		mappedPort := m.InternalPort()
		if _, ok := ports[m.Protocol()][mappedPort]; !ok {
			// No longer need this mapping.
			wg.Add(1)
			go func(m inat.Mapping) {
				defer wg.Done()
				m.Close()
			}(m)
		} else {
			// already mapped
			ports[m.Protocol()][mappedPort] = true
		}
	}

	// Create new mappings.
	for proto, pports := range ports {
		for port, mapped := range pports {
			if mapped {
				continue
			}
			wg.Add(1)
			go func(proto string, port int) {
				defer wg.Done()
				_, err := nmgr.nat.NewMapping(proto, port)
				if err != nil {
					log.Errorf("failed to port-map %s port %d: %s", proto, port, err)
				}
			}(proto, port)
		}
	}
}

// NAT returns the natManager's nat object. this may be nil, if
// (a) the search process is still ongoing, or (b) the search process
// found no nat. Clients must check whether the return value is nil.
func (nmgr *natManager) NAT() *inat.NAT {
	nmgr.natmu.Lock()
	defer nmgr.natmu.Unlock()
	return nmgr.nat
}

type nmgrNetNotifiee natManager

func (nn *nmgrNetNotifiee) natManager() *natManager {
	return (*natManager)(nn)
}

func (nn *nmgrNetNotifiee) Listen(n network.Network, addr ma.Multiaddr) {
	nn.natManager().sync()
}

func (nn *nmgrNetNotifiee) ListenClose(n network.Network, addr ma.Multiaddr) {
	nn.natManager().sync()
}

func (nn *nmgrNetNotifiee) Connected(network.Network, network.Conn)    {}
func (nn *nmgrNetNotifiee) Disconnected(network.Network, network.Conn) {}


text:
require 'rspec'
require 'peruse'
require 'parslet/rig/rspec'
require 'shared/dummy_client'

# Print ascii_tree when exception occurs
module Peruse
  class ParserWrapper < Parser
    def parse(query)
      begin
        super(query)
      rescue Parslet::ParseFailed => failure
        puts failure.cause.ascii_tree
      end
    end
  end
end

RSpec.configure do |config|
  config.before :all do

    # configure test instance of Peruse to use wrapper parser
    Peruse.configure do |c|
      c.parser = Peruse::ParserWrapper.new
      c.transformer = Peruse::Transformer.new
    end
  end
end


text:
<?php declare(strict_types = 1);

namespace Mikulas\Transpiler\Visitors;

use PhpParser\Node;
use PhpParser\NodeVisitorAbstract;

class ExpandMultiCatchHandler extends NodeVisitorAbstract
{

	/**
	 * @return Node[]
	 */
	public function leaveNode(Node $node)
	{
		if (! $node instanceof Node\Stmt\Catch_) {
			return NULL; // node stays as-is, not assignment
		}
		if (count($node->types) <= 1) {
			return NULL; // node stays as-is, not assignment
		}

		$nodes = [];
		foreach ($node->types as $type) {
			$catch = clone $node;
			$catch->types = [$type];
			$nodes[] = $catch;
		}
		return $nodes;
	}

}


text:
{% extends "base.html" %}

{% block content %}
<form action="" method="post">
	<input name=_csrf_token type=hidden value="{{ csrf_token() }}">
	<fieldset>

			Username

			<input type="text" class="text" id="username" name="username" />

			email

			<input type="text" class="text" id="email" name="email" />

			First Name

			<input type="text" class="text" id="name" name="name" />

			Last Name

			<input type="text" class="text" id="last_name" name="last_name" />

			Password

			<input type="password" class="password" id="password" name="password" />

			Repeat Password

			<input type="password" class="password" id="password2" name="password2" />

			<input type="submit" value="Submit">
			<input type="reset" value="Reset">

	</fieldset>
</form>
{% endblock %}


text:
"use strict";

import Vue from "vue";
import socket from "../socket";
import storage from "../localStorage";
import {router, switchToChannel, navigate} from "../router";
import store from "../store";
import parseIrcUri from "../helpers/parseIrcUri";

socket.on("init", function (data) {
	store.commit("networks", mergeNetworkData(data.networks));
	store.commit("isConnected", true);
	store.commit("currentUserVisibleError", null);

	if (data.token) {
		storage.set("token", data.token);
	}

	if (!store.state.appLoaded) {
		store.commit("appLoaded");

		socket.emit("setting:get");

		if (window.g_TheLoungeRemoveLoading) {
			window.g_TheLoungeRemoveLoading();
		}

		Vue.nextTick(() => {
			// If we handled query parameters like irc:// links or just general
			// connect parameters in public mode, then nothing to do here
			if (!handleQueryParams()) {
				// If we are on an unknown route or still on SignIn component
				// then we can open last known channel on server, or Connect window if none
				if (!router.currentRoute.name || router.currentRoute.name === "SignIn") {
					const channel = store.getters.findChannel(data.active);

					if (channel) {
						switchToChannel(channel.channel);
					} else if (store.state.networks.length > 0) {
						// Server is telling us to open a channel that does not exist
						// For example, it can be unset if you first open the page after server start
						switchToChannel(store.state.networks[0].channels[0]);
					} else {
						navigate("Connect");
					}
				}
			}
		});
	}
});

function mergeNetworkData(newNetworks) {
	const collapsedNetworks = new Set(JSON.parse(storage.get("thelounge.networks.collapsed")));

	for (let n = 0; n < newNetworks.length; n++) {
		const network = newNetworks[n];
		const currentNetwork = store.getters.findNetwork(network.uuid);

		// If this network is new, set some default variables and initalize channel variables
		if (!currentNetwork) {
			network.isJoinChannelShown = false;
			network.isCollapsed = collapsedNetworks.has(network.uuid);
			network.channels.forEach(store.getters.initChannel);

			continue;
		}

		// Merge received network object into existing network object on the client
		// so the object reference stays the same (e.g. for currentChannel state)
		for (const key in network) {
			if (!Object.prototype.hasOwnProperty.call(network, key)) {
				continue;
			}

			// Channels require extra care to be merged correctly
			if (key === "channels") {
				currentNetwork.channels = mergeChannelData(
					currentNetwork.channels,
					network.channels
				);
			} else {
				currentNetwork[key] = network[key];
			}
		}

		newNetworks[n] = currentNetwork;
	}

	return newNetworks;
}

function mergeChannelData(oldChannels, newChannels) {
	for (let c = 0; c < newChannels.length; c++) {
		const channel = newChannels[c];
		const currentChannel = oldChannels.find((chan) => chan.id === channel.id);

		// This is a new channel that was joined while client was disconnected, initialize it
		if (!currentChannel) {
			store.getters.initChannel(channel);

			continue;
		}

		// Merge received channel object into existing currentChannel
		// so the object references are exactly the same (e.g. in store.state.activeChannel)
		for (const key in channel) {
			if (!Object.prototype.hasOwnProperty.call(channel, key)) {
				continue;
			}

			// Server sends an empty users array, client requests it whenever needed
			if (key === "users") {
				if (channel.type === "channel") {
					if (
						store.state.activeChannel &&
						store.state.activeChannel.channel === currentChannel
					) {
						// For currently open channel, request the user list straight away
						socket.emit("names", {
							target: channel.id,
						});
					} else {
						// For all other channels, mark the user list as outdated
						// so an update will be requested whenever user switches to these channels
						currentChannel.usersOutdated = true;
					}
				}

				continue;
			}

			// Server sends total count of messages in memory, we compare it to amount of messages
			// on the client, and decide whether theres more messages to load from server
			if (key === "totalMessages") {
				currentChannel.moreHistoryAvailable =
					channel.totalMessages > currentChannel.messages.length;

				continue;
			}

			// Reconnection only sends new messages, so merge it on the client
			// Only concat if server sent us less than 100 messages so we don't introduce gaps
			if (key === "messages" && currentChannel.messages && channel.messages.length < 100) {
				currentChannel.messages = currentChannel.messages.concat(channel.messages);
			} else {
				currentChannel[key] = channel[key];
			}
		}

		newChannels[c] = currentChannel;
	}

	return newChannels;
}

function handleQueryParams() {
	if (!("URLSearchParams" in window)) {
		return false;
	}

	const params = new URLSearchParams(document.location.search);

	const cleanParams = () => {
		// Remove query parameters from url without reloading the page
		const cleanUri = window.location.origin + window.location.pathname + window.location.hash;
		window.history.replaceState({}, document.title, cleanUri);
	};

	if (params.has("uri")) {
		// Set default connection settings from IRC protocol links
		const uri = params.get("uri");
		const queryParams = parseIrcUri(uri);

		cleanParams();
		router.push({name: "Connect", query: queryParams});

		return true;
	} else if (document.body.classList.contains("public") && document.location.search) {
		// Set default connection settings from url params
		const queryParams = Object.fromEntries(params.entries());

		cleanParams();
		router.push({name: "Connect", query: queryParams});

		return true;
	}

	return false;
}


text:
<?php

/**
 * Database Adapter Interface
 *
 * @author Adro Rocker <alejandro.morelos@jarwebdev.com>
 * @package Adroframework
 * @subpackage Db
 **/

namespace Adroframework\Db\Adapter;

Interface AdapterInterface
{
    /**
     * Get configurtation to conect to DB
     */
    public function getConfigs();
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>recoin</groupId>
	<artifactId>crisis.net</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<dependencies>
		<dependency>
			<groupId>org.json</groupId>
			<artifactId>json</artifactId>
			<version>20150729</version>
		</dependency>
		<dependency>
			<groupId>com.googlecode.json-simple</groupId>
			<artifactId>json-simple</artifactId>
			<version>1.1</version>
		</dependency>
		<dependency>
			<groupId>commons-lang</groupId>
			<artifactId>commons-lang</artifactId>
			<version>2.6</version>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<artifactId>maven-assembly-plugin</artifactId>
				<configuration>
					<archive>
						<manifest>
							<mainClass>crisis.net.ToCsv</mainClass>
						</manifest>
					</archive>
					<descriptorRefs>
						<descriptorRef>jar-with-dependencies</descriptorRef>
					</descriptorRefs>
				</configuration>
			</plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.4</source>
          <target>1.4</target>
        </configuration>
      </plugin>

		</plugins>
	</build>
</project>


text:
<?php

namespace SumoCoders\FrameworkMultiUserBundle\Security;

class FormCredentials
{
    /** @var string */
    private $plainPassword;

    /** @var string */
    private $username;

    public function __construct(string $username, string $plainPassword)
    {
        $this->username = $username;
        $this->plainPassword = $plainPassword;
    }

    public function getUsername(): string
    {
        return $this->username;
    }

    public function getPlainPassword(): string
    {
        return $this->plainPassword;
    }
}


text:
package me.xdrop.jrand;

import me.xdrop.jrand.random.Rand;

import java.util.*;

public abstract class Generator<T> {

    private Rand randGen;

    public Generator() {
        this.randGen = new Rand();
    }

    public Rand random() {
        return this.randGen;
    }

    public abstract T gen();

    public String repeat(int times) {
        StringBuilder sb = new StringBuilder();
        while (times-- > 0) {
            sb.append(gen());
        }
        return sb.toString();
    }

    public String genString() {
        return gen().toString();
    }

    public List<T> genMany(int num) {
        List<T> many = new ArrayList<>();
        for (int n = 0; n < num; n++) {
            many.add(gen());
        }
        return many;
    }

    public List<T> genManyUnique(int num) {
        List<T> many = new LinkedList<>();
        Set<T> present = new HashSet<>();

        for (int n = 0; n < num; n++) {
            T gen;
            do {
                gen = gen();
            } while (present.contains(gen));
            many.add(gen);
            present.add(gen);
        }

        return many;
    }

    public Set<T> genManyAsSet(int num) {
        List<T> many = new LinkedList<>();
        for (int n = 0; n < num; n++) {
            many.add(gen());
        }
        return new HashSet<>(many);
    }

}


text:
using System.Reflection;

[assembly: AssemblyTitle("SDL DXA Test Module")]

// NOTE: Common Assembly Info is generated by the build in CommonAssemblyInfo.cs


text:
Vectors
=======

A vector is kind of an arrow pointing to a position. The length and direction
are also important though.
Otira currently only has 2-dimensional vectors (Vec2 class). These have an
x and y component.

Representation
--------------

A vector is represented in a format like this: (x;y) or (x|y).
This is in kartesian coordinates, that means x and y are axes.
Since we're programming we can also use NaN and Infinity.

Examples: (1.0;1.0), (-6.0|2.5), (NaN;-Infinity)

When referring to a vector, we usually use lowercase letters,
sometimes bold or italic.

In this document we use italic lowercase letters for vectors, regular lowercase
letters for regular numbers and *vx* or *vy* to refer to the compontents
x and y of the vector *v*.

Basic Math
----------

Like with regular numbers (called scalars) we can do math with
vectors. Here are the rules:
* *a* + *b* = (*ax* + *bx*;*ay* + *by*)
* *a* - *b* = (*ax* - *bx*;*ay* - *by*)
* *a* * *b* = (*ax* \* *bx*;*ay* \* *by*)
* *a* / *b* = (*ax* / *bx*;*ay* / *by*)

We can also use a scalar for b:
* *a* + b = (*ax* + b;*ay* + b)
* etc.

This is called scalar addition/subtraction and for multiplication
and division simply scaling.

Equality
--------

Two vectors are equal, if their direction and length are equal.
This is also the case, if their components are equal.

Length
------

The length (or magnitude or norm) of a vector *v* (written *||v||*) is equal to the square root of
the sum of squares of all components: *||v||* = sqrt(*vx* \* *vx* + *vy* \* *vy)

When comparing the length it is always faster to compare the square of the length.

Zero vector
-----------

A zero vector is a vector where x, y and thus the length are 0.

Unit vector
-----------

A unit vector is a vector with length = 1.

Normalization
-------------

Normalizing a vector means diving every component of the vector by its length.
This results in a unit vector.

Dot product
-----------

The dot product (or scalar product) of two vectors *a* and *b*, written as *a* dot *b* is
defined like this: *a* dot *b* = *ax* \* *bx* + *ay* \* *by*

This also happens to be equal to
_||a||_ \* *||b||* \* cos theta
where theta is the angle between the two vectors.
This means that we can calculate theta like this:
theta = acos(*a* dot *b* / *||a||* \* *||b||*)

So if *a* and *b* are orhtogonal, then theta is 90° and *a* dot *b* = 0

Also, if *a* and *b* are codirectional, then theta is 0° and *a* dot *b* = *||a||* \* *||b||*

The dot product is
1. Commutative: *a* dot *b* = *b* dot *a*
2. Distributive: *a* dot (*b* + *c*) = *a* dot *b* + *a* dot *c*

Cross product
-------------

The cross product (or vector product) of two 2-dimensional vectors *a* and *b*, written as *a* cross *b*
or more commonly *a* x *b* is defined like this: *a* x *b* = *ax* \* *by* - *ay* \* *by*


text:
ShaderProgram::ShaderProgram():
	m_linked(false),
	m_program(0),
	m_diffAttrib(""),
	m_vertAttrib(""),
	m_normAttrib(""),
	m_MVPAttrib(""),
	m_lightDir(""),
	m_lightColor(""),
	m_ambient(""),
	m_normMatrix(""),
	m_uvAttrib(""),
	m_samplerAttrib("")
{

}

ShaderProgram::~ShaderProgram(){

}

bool ShaderProgram::use() const{
	if(m_program == 0  || m_linked == false)
		return false;

	GLHelper::flushGLErrors();
	glUseProgram(m_program);
	GLenum error = glGetError();
	if(error != GL_NO_ERROR){
		std::string msg = "Could not use shader program: " + GLHelper::errorEnumToString(error);
		Logger &logger = *Logger::Instance();
		logger.writeToLog(msg);

		return false;
	}

	return true;
}

bool ShaderProgram::link(Shader &vertexShader, Shader &fragmentShader){
	if(vertexShader.isCompiled() == false || fragmentShader.isCompiled() == false)
	{
		std::cout<<"Shaders not compiled"<<std::endl;
		return false;
	}

	if(vertexShader.getType() != GL_VERTEX_SHADER || fragmentShader.getType() != GL_FRAGMENT_SHADER)
	{
		std::cout<<"Shader of wrong type"<<std::endl;
		return false;
	}

	GLHelper::flushGLErrors();

	GLuint program = glCreateProgram();
	if(program == 0)
		return false;

	glAttachShader(program, vertexShader.getID());
	GLenum error = glGetError();
	if(error != GL_NO_ERROR){
		std::string msg = "Error adding vertex Shader: ";

		msg = msg + GLHelper::errorEnumToString(error);

		Logger &logger = *Logger::Instance();
		logger.writeToLog(msg);
		return false;
	}

	glAttachShader(program, fragmentShader.getID());
	error = glGetError();
	if(error != GL_NO_ERROR){
		std::string msg = "Error adding fragment Shader: ";

		msg = msg + GLHelper::errorEnumToString(error);
		std::cout<<msg<<std::endl;
		Logger &logger = *Logger::Instance();
		logger.writeToLog(msg);
		return false;
	}

	glLinkProgram(program);
	error = glGetError();
	if(error != GL_NO_ERROR){
		std::string msg = "Error linking program: ";

		msg = msg + GLHelper::errorEnumToString(error);
		std::cout<<msg<<std::endl;
		Logger &logger = *Logger::Instance();
		logger.writeToLog(msg);

		glDetachShader(program, vertexShader.getID());
		glDetachShader(program, fragmentShader.getID());

		return false;
	}

	glDetachShader(program, vertexShader.getID());
	glDetachShader(program, fragmentShader.getID());

	GLint status;
	glGetProgramiv(program, GL_LINK_STATUS, &status);
	error = glGetError();
	if(error != GL_NO_ERROR){
		std::string msg = "Error getting link status: ";

		msg = msg + GLHelper::errorEnumToString(error);
		std::cout<<msg<<std::endl;
		Logger &logger = *Logger::Instance();
		logger.writeToLog(msg);

		return false;
	}

	if(status == GL_FALSE){
		GLint logLength;

		glGetProgramiv(program, GL_INFO_LOG_LENGTH, &logLength);

		GLchar *log = new GLchar[logLength + 1];

		glGetProgramInfoLog(program, logLength, NULL, log);
		log[logLength] = '\0';

		std::stringstream ss;
		ss<<"Failed to link program"<<std::endl<<log;
		std::cout<<ss.str()<<std::endl;
		Logger &logger = *Logger::Instance();
		logger.writeToLog(ss.str());

		delete[] log;

		glDeleteProgram(program);
		return false;
	}

	m_program = program;
	m_linked = true;

	return true;
}

bool ShaderProgram::isLinked() const{
	return m_linked;
}

bool ShaderProgram::release(){
	if(m_linked == false || m_program == 0)
		return false;

	GLHelper::flushGLErrors();

	glDeleteProgram(m_program);

	GLenum error = glGetError();
	if(error != GL_NO_ERROR){
		std::string msg = "Error deleting program: ";
		msg = msg + GLHelper::errorEnumToString(error);
		Logger &logger = *Logger::Instance();
		logger.writeToLog(msg);

		return false;
	}

	m_program = 0;
	m_linked = false;

	return true;
}

GLuint ShaderProgram::getID() const{
	return m_program;
}

void ShaderProgram::setDiffuseAttrib(std::string name){
	m_diffAttrib = name;
}

std::string ShaderProgram::getDiffuseAttrib() const{
	return m_diffAttrib;
}

void ShaderProgram::setVertAttrib(std::string name){
	m_vertAttrib = name;
}

std::string ShaderProgram::getVertAttrib() const{
	return m_vertAttrib;
}

void ShaderProgram::setNormAttrib(std::string name){
	m_normAttrib = name;
}

std::string ShaderProgram::getNormAttrib() const{
	return m_normAttrib;
}

void ShaderProgram::setMVPAttrib(std::string name){
	m_MVPAttrib = name;
}

std::string ShaderProgram::getMVPAttrib() const{
	return m_MVPAttrib;
}

void ShaderProgram::setLightAttribs(std::string dir, std::string color){
	m_lightDir = dir;
	m_lightColor = color;
}

std::string ShaderProgram::getLightDirAttrib() const{
	return m_lightDir;
}

std::string ShaderProgram::getLightColorAttrib() const{
	return m_lightColor;
}

void ShaderProgram::setAmbientAttrib(std::string name){
	m_ambient = name;
}

std::string ShaderProgram::getAmbientAttrib() const{
	return m_ambient;
}

void ShaderProgram::setNormMatrixAttrib(std::string name){
	m_normMatrix = name;
}

std::string ShaderProgram::getNormMatrixAttrib() const {
	return m_normMatrix;
}

void ShaderProgram::setUVAttrib(std::string name){
	m_uvAttrib = name;
}

std::string ShaderProgram::getUVAttrib() const{
	return m_uvAttrib;
}

void ShaderProgram::setSamplerAttrib(std::string name){
	m_samplerAttrib = name;
}

std::string ShaderProgram::getSamplerAttrib() const{
	return m_samplerAttrib;
}


text:
from examples.json_api import app

from rhino.test import TestClient

client = TestClient(app.wsgi)

def test_get():
    res = client.get('/')
    assert res.headers['Content-Type'] == 'application/json'
    assert res.body == '{"message": "hello, world!"}'

def test_put():
    res = client.put('/', '{"message": "hi"}', content_type='application/json')
    assert res.code == 200
    assert res.headers['Content-Type'] == 'application/json'
    assert res.body == '{"message": "hi"}'


text:
package com.fedevela.engine.swing;

/**
 * Created by fvelazquez on 11/04/14.
 */
import com.fedevela.asic.util.TypeCast;
import com.fedevela.engine.ConfigureEngine;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.text.ParseException;
import java.util.regex.Pattern;
import javax.swing.Action;
import javax.swing.InputVerifier;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.border.Border;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;

public class FieldUI extends javax.swing.JPanel {

    public enum CaseSensitive {

        NONE,
        UPPER,
        LOWER
    };
    private static final Integer _defaultWidth = 110;
    private static final Integer _defaultHeight = 20;
    private Border _borderDefault;
    private Boolean allowBlank;
    private Integer maxLength;
    private Integer minLength;
    private Boolean doubleTyping;
    private Long doccod;
    private String pattern;
    private Boolean focus = false;
    private FieldUI.CaseSensitive caseSensitive = FieldUI.CaseSensitive.NONE;
    private Pattern regexPattern;
    private Boolean doubleTypingEnter;
    //
    private ConfigureEngine _ce;
    private javax.swing.GroupLayout _layout;
    private javax.swing.JFormattedTextField _field;
    private javax.swing.JLabel _label;
    private Integer _width;
    private Integer _height;

    private void _initialize() {
        _ce = _ce == null ? new ConfigureEngine() : _ce;
        _width = _ce.getWidth() != null ? _ce.getWidth() : _defaultWidth;
        _height = _ce.getHeight() != null ? _ce.getHeight() : _defaultHeight;
        _ce.setWidth(_width);
        _ce.setHeight(_height);
        _layout = new javax.swing.GroupLayout(this);
        if (_ce != null && _ce.getLabel() != null) {
            _label = new javax.swing.JLabel(_ce.getLabel().getText());
            if (_ce.getLabel().getWidth() != null) {
                _width = _width.compareTo(_ce.getLabel().getWidth()) >= 0 ? _width : _ce.getLabel().getWidth();
            }
            if (_ce.getLabel().getHeight() != null) {
                _height = _height.compareTo(_ce.getLabel().getHeight()) >= 0 ? _height : _ce.getLabel().getHeight();
            } else {
                _height += _defaultHeight;
            }
        }
        _field = new javax.swing.JFormattedTextField();
        _field.setEnabled(!_ce.isDisabled());
        _borderDefault = _field.getBorder();
        /* Init */
        setPreferredSize(new java.awt.Dimension(_width, _height));
        /* Field init */
        _field.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                if (isDoubleTypingEnter() != null) {
                    if (!isDoubleTypingEnter()) {
                        checkValidate();
                    }
                } else {
                    checkValidate();
                }
                focus = true;
            }

            @Override
            public void focusLost(FocusEvent e) {
                focus = false;
            }
        });
        _field.addKeyListener(new java.awt.event.KeyAdapter() {
            @Override
            public void keyReleased(KeyEvent e) {
                //checkValidate();
                if (isDoubleTypingEnter() != null) {
                    if (!isDoubleTypingEnter()) {
                        checkValidate();
                    }
                } else {
                    checkValidate();
                }
            }

            @Override
            public void keyTyped(KeyEvent e) {
                switch (caseSensitive) {
                    case LOWER:
                        e.setKeyChar(Character.toLowerCase(e.getKeyChar()));
                        break;
                    case UPPER:
                        e.setKeyChar(Character.toUpperCase(e.getKeyChar()));
                        break;
                    default:
                        break;
                }
                Object value;
                try {
                    if (_field.getFormatter() != null) {
                        value = _field.getFormatter().stringToValue(_field.getText());
                    } else {
                        value = TypeCast.isBlank(_field.getText()) ? null : _field.getText();
                    }
                } catch (ParseException ex) {
                    setUserValid("Valor no válido.");
                    return;
                }
                if (maxLength != null && value != null && maxLength <= TypeCast.toString(value, "").length()) {
                    e.consume();
                }
            }
        });
        allowBlank = true;
        pattern = _ce != null ? _ce.getPattern() : null;

        /* Layout init */
        setLayout(_layout);
        if (_label != null) {
            _layout.setHorizontalGroup(
                    _layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(_field, javax.swing.GroupLayout.PREFERRED_SIZE, _ce.getWidth(), javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
            _layout.setVerticalGroup(
                    _layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(_layout.createSequentialGroup()
                                    .addComponent(_label)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(_field, javax.swing.GroupLayout.PREFERRED_SIZE, _ce.getHeight(), javax.swing.GroupLayout.PREFERRED_SIZE)));
        } else {
            _layout.setHorizontalGroup(
                    _layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(_field, javax.swing.GroupLayout.PREFERRED_SIZE, _ce.getWidth(), javax.swing.GroupLayout.PREFERRED_SIZE));
            _layout.setVerticalGroup(
                    _layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(_field, javax.swing.GroupLayout.PREFERRED_SIZE, _ce.getHeight(), javax.swing.GroupLayout.PREFERRED_SIZE));
        }
        setSize(getPreferredSize());
    }

    public FieldUI(ConfigureEngine _ce) {
        super();
        this._ce = _ce;
        _initialize();
    }

    public final void checkValidate() {
        Object value;
        try {
            if (_field.getFormatter() != null) {
                value = _field.getFormatter().stringToValue(_field.getText());
            } else {
                value = TypeCast.isBlank(_field.getText()) ? null : _field.getText();
            }
        } catch (ParseException ex) {
            setUserValid("Valor no válido.");
            return;
        }
        if (value == null && !allowBlank) {
            setUserValid("El valor del campo es requerido.");
            return;
        }
        if (minLength != null && value != null && minLength > TypeCast.toString(value, "").length()) {
            setUserValid("El tamaño mínimo del campo es " + minLength + ".");
            return;
        }
        if (maxLength != null && value != null && maxLength < TypeCast.toString(value, "").length()) {
            setUserValid("El tamaño máximo del campo es " + maxLength + ".");
            return;
        }
        setUserValid(null);
    }

    public void setFocusLostBehavior(int i) {
        _field.setFocusLostBehavior(i); //To change body of generated methods, choose Tools | Templates.
    }

    public int getFocusLostBehavior() {
        return _field.getFocusLostBehavior(); //To change body of generated methods, choose Tools | Templates.
    }

    public void setFormatterFactory(JFormattedTextField.AbstractFormatterFactory aff) {
        _field.setFormatterFactory(aff); //To change body of generated methods, choose Tools | Templates.
    }

    public JFormattedTextField.AbstractFormatterFactory getFormatterFactory() {
        return _field.getFormatterFactory(); //To change body of generated methods, choose Tools | Templates.
    }

    //    protected void setFormatter(JFormattedTextField.AbstractFormatter af) {
//        _field.setFormatter(af); //To change body of generated methods, choose Tools | Templates.
//    }
    public JFormattedTextField.AbstractFormatter getFormatter() {
        return _field.getFormatter(); //To change body of generated methods, choose Tools | Templates.
    }

    public void setValue(Object o) {
        _field.setValue(o); //To change body of generated methods, choose Tools | Templates.
    }

    public Object getValue() {
        return _field.getValue(); //To change body of generated methods, choose Tools | Templates.
    }

    public void commitEdit() throws ParseException {
        _field.commitEdit(); //To change body of generated methods, choose Tools | Templates.
    }

    public boolean isEditValid() {
        return _field.isEditValid(); //To change body of generated methods, choose Tools | Templates.
    }

    //    protected void invalidEdit() {
//        _field.invalidEdit(); //To change body of generated methods, choose Tools | Templates.
//    }
//    @Override
//    protected void processInputMethodEvent(InputMethodEvent ime) {
//        super.processInputMethodEvent(ime); //To change body of generated methods, choose Tools | Templates.
//    }
//
//    @Override
//    protected void processFocusEvent(FocusEvent fe) {
//        super.processFocusEvent(fe); //To change body of generated methods, choose Tools | Templates.
//    }
    public Action[] getActions() {
        return _field.getActions(); //To change body of generated methods, choose Tools | Templates.
    }

    //    @Override
//    public String getUIClassID() {
//        return super.getUIClassID(); //To change body of generated methods, choose Tools | Templates.
//    }
    public void setDocument(Document dcmnt) {
        _field.setDocument(dcmnt); //To change body of generated methods, choose Tools | Templates.
    }

    public Document getDocument() {
        return _field.getDocument(); //To change body of generated methods, choose Tools | Templates.
    }

    public String getText(int i, int i1) throws BadLocationException {
        return _field.getText(i, i1); //To change body of generated methods, choose Tools | Templates.
    }

    public void cut() {
        _field.cut(); //To change body of generated methods, choose Tools | Templates.
    }

    public void copy() {
        _field.copy(); //To change body of generated methods, choose Tools | Templates.
    }

    public void paste() {
        _field.paste(); //To change body of generated methods, choose Tools | Templates.
    }

    public void setText(String string) {
        _field.setText(string); //To change body of generated methods, choose Tools | Templates.
    }

    public String getText() {
        return _field.getText(); //To change body of generated methods, choose Tools | Templates.
    }

    public String getSelectedText() {
        return _field.getSelectedText(); //To change body of generated methods, choose Tools | Templates.
    }

    public boolean isEditable() {
        return _field.isEditable(); //To change body of generated methods, choose Tools | Templates.
    }

    public void setEditable(boolean bln) {
        _field.setEditable(bln); //To change body of generated methods, choose Tools | Templates.
    }

    public void selectAll() {
        _field.selectAll(); //To change body of generated methods, choose Tools | Templates.
    }

    public int getHorizontalAlignment() {
        return _field.getHorizontalAlignment(); //To change body of generated methods, choose Tools | Templates.
    }

    public void setHorizontalAlignment(int i) {
        _field.setHorizontalAlignment(i); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public synchronized void addKeyListener(KeyListener kl) {
        _field.addKeyListener(kl);
    }

    @Override
    public synchronized void addFocusListener(FocusListener fl) {
        _field.addFocusListener(fl);
    }

    @Override
    public void requestFocus() {
        _field.requestFocus(); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public boolean requestFocus(boolean bln) {
        return _field.requestFocus(bln); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public boolean requestFocusInWindow() {
        return _field.requestFocusInWindow(); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    protected boolean requestFocusInWindow(boolean bln) {
        return super.requestFocusInWindow(bln); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void setInputVerifier(InputVerifier iv) {
        _field.setInputVerifier(iv); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public InputVerifier getInputVerifier() {
        return _field.getInputVerifier(); //To change body of generated methods, choose Tools | Templates.
    }

    // ###################################################################################################
    public void setMaxLength(Integer maxLength) {
        this.maxLength = maxLength;
    }

    public Integer getMaxLength() {
        return maxLength;
    }

    public Integer getMinLength() {
        return minLength;
    }

    public void setMinLength(Integer minLength) {
        this.minLength = minLength;
    }

    public Boolean isAllowBlank() {
        return allowBlank;
    }

    public void setAllowBlank(Boolean allowBlank) {
        this.allowBlank = allowBlank;
    }

    public Boolean isDoubleTyping() {
        return doubleTyping;
    }

    public void setDoubleTyping(Boolean doubleTyping) {
        this.doubleTyping = doubleTyping;
    }

    public Boolean isUserValid() {
        return _borderDefault.equals(_field.getBorder());
    }

    public Long getDoccod() {
        return doccod;
    }

    public void setDoccod(Long doccod) {
        this.doccod = doccod;
    }

    public String getPattern() {
        return pattern;
    }

    public void setPattern(String pattern) {
        this.pattern = pattern;
    }

    public Boolean isFocus() {
        return focus;
    }

    public FieldUI.CaseSensitive getCaseSensitive() {
        return caseSensitive;
    }

    public void setCaseSensitive(FieldUI.CaseSensitive caseSensitive) {
        this.caseSensitive = caseSensitive;
    }

    public void setCaseSensitive(String caseSensitive) {
        try {
            this.caseSensitive = FieldUI.CaseSensitive.valueOf(caseSensitive);
        } catch (IllegalArgumentException ex) {
            this.caseSensitive = FieldUI.CaseSensitive.NONE;
        }
    }

    public Pattern getRegexPattern() {
        return regexPattern;
    }

    public void setRegexPattern(Pattern regexPattern) {
        this.regexPattern = regexPattern;
    }

    public void setRegexPattern(String regexPattern) {
        this.regexPattern = Pattern.compile(regexPattern);
    }

    public void setUserValid(String valid) {
        _field.setToolTipText(valid);
        _field.setBorder(TypeCast.isBlank(valid) ? _borderDefault : javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 0, 0), 2));
    }

    /**
     * @return the doubleTypingEnter
     */
    public Boolean isDoubleTypingEnter() {
        return doubleTypingEnter;
    }

    /**
     * @param doubleTypingEnter the doubleTypingEnter to set
     */
    public void setDoubleTypingEnter(Boolean doubleTypingEnter) {
        this.doubleTypingEnter = doubleTypingEnter;
    }

    /**
     * Este metodo es con la finalidad de asignar tooltip y border en su forma
     * inicial y que pueda ser llamado desde otros componentes
     */
    public void resetToolTipBorder() {
        _field.setToolTipText("");
        _field.setBorder(_borderDefault);

    }

    //    public Integer getLabelWidth() {
    //        return _label == null ? null : _label.getWidth();
    //    }
    //
    //    public String getLabelText() {
    //        return _label == null ? null : _label.getText();
    //    }
    public JLabel getLabel() {
        return _label;
    }

    public void setLabel(JLabel _label) {
        this._label = _label;
    }

    public void setLabel(String _label) {
        this._label = new javax.swing.JLabel(_label);
    }

    public ConfigureEngine getCe() {
        return _ce;
    }
}


text:
{{ define "title"}} {{ .Site.Title}} {{end}}
{{ define "header"}} {{ partial "header" .}} {{end}}
{{ define "main"}}

{{.Title}}

{{.Description}}

    Download View on Github

Version 1.0.0 from Abril 13, 2017.

    Zip-archive, includes all the source and site example files

    Kube  from imperavi is an awesome CSS & JS Framework and i designed this template for hugo with the same original philosophy !

Horizontal Rhythm

In Kube horizontal rhythm based on a 4px vertical grid is something that we are truly proud of.

Typography

We obsess over typography, and it shows throughout Kube.

Minimalism

We strongly believe in minimalism as a general concept as well as a practical approach to everyday life.

Mobile-first Design

Every element in kube is mobile-first and fully embraces latest and greatest tech.

Cross-browser

Kube works in all modern browsers, both desktop and mobile, including latest Chrome, Firefox, Safari, Opera, IE and Edge.

License

Kube licensed under MIT.

      Kube Framework is absolutely free for personal or commercial use.

{{ end }}
{{ define "footer"}} {{ partial "footer" .}} {{end}}


text:
package org.jboss.arquillian.warp.impl.client.execution;

import io.netty.handler.codec.http.HttpObject;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponse;

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

import org.jboss.arquillian.core.api.Event;
import org.jboss.arquillian.core.api.InstanceProducer;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.warp.Warp;
import org.jboss.arquillian.warp.exception.ClientWarpExecutionException;
import org.jboss.arquillian.warp.impl.client.event.FilterHttpRequest;
import org.jboss.arquillian.warp.impl.client.event.FilterHttpResponse;
import org.jboss.arquillian.warp.impl.client.event.TransformHttpResponse;
import org.jboss.arquillian.warp.impl.client.scope.WarpExecutionScoped;
import org.littleshoot.proxy.HttpFilters;
import org.littleshoot.proxy.HttpFiltersAdapter;
import org.littleshoot.proxy.HttpFiltersSourceAdapter;

public class DefaultHttpFiltersSource extends HttpFiltersSourceAdapter {

    private static final int MAX_BUFFER_SIZE_IN_BYTES = 5 * 1024 * 1024; // 5MB

    private Logger log = Logger.getLogger(Warp.class.getName());

    @Inject
    private Event<FilterHttpRequest> tryEnrichRequest;

    @Inject
    private Event<FilterHttpResponse> tryDeenrichResponse;

    @Inject @WarpExecutionScoped
    private InstanceProducer<HttpResponse> responseInstance;

    @Inject
    private Event<TransformHttpResponse> transformHttpResponse;

    @Override
    public HttpFilters filterRequest(final HttpRequest originalRequest) {

        return new HttpFiltersAdapter(originalRequest) {

            private HttpRequest request;

            @Override
            public HttpResponse requestPost(HttpObject httpObject) {

                final WarpContext context = WarpContextStore.get();

                if (httpObject instanceof HttpRequest) {
                    this.request = (HttpRequest) httpObject;
                }

                if (context == null) {
                    return null;
                }

                try {
                    final SynchronizationPoint synchronization = context.getSynchronization();

                    if (synchronization.isWaitingForRequests()) {

                        if (httpObject instanceof HttpRequest) {
                            tryEnrichRequest.fire(new FilterHttpRequest(new HttpRequestWrapper(this.request)));
                        }
                    }
                } catch (Exception originalException) {
                    ClientWarpExecutionException explainingException = new ClientWarpExecutionException(
                        "enriching request failed: " + originalException.getMessage(), originalException);
                    context.pushException(explainingException);
                }

                return null;
            }

            @Override
            public HttpObject responsePost(HttpObject httpObject) {

                try {
                    if (this.request instanceof HttpRequest && httpObject instanceof HttpResponse) {
                        HttpResponse response = (HttpResponse) httpObject;

                        tryDeenrichResponse.fire(new FilterHttpResponse(this.request, response));

                        TransformHttpResponse transformEvent = new TransformHttpResponse(request, response);
                        transformHttpResponse.fire(transformEvent);

                        return transformEvent.getResponse();
                    }
                } catch (Exception originalException) {
                    final WarpContext context = WarpContextStore.get();

                    if (context == null) {
                        log.log(Level.WARNING, originalException.getMessage(), originalException);
                        return httpObject;
                    }
                    ClientWarpExecutionException explainingException = new ClientWarpExecutionException(
                        "deenriching response failed: " + originalException.getMessage(), originalException);
                    context.pushException(explainingException);
                }

                return httpObject;
            }
        };
    }

    @Override
    public int getMaximumRequestBufferSizeInBytes() {
        return MAX_BUFFER_SIZE_IN_BYTES;
    }

    @Override
    public int getMaximumResponseBufferSizeInBytes() {
        return MAX_BUFFER_SIZE_IN_BYTES;
    }
}


text:
using osu.Framework.Bindables;
using osu.Game.Tournament.Models;

namespace osu.Game.Tournament.Screens
{
    public abstract class TournamentMatchScreen : TournamentScreen
    {
        protected readonly Bindable<TournamentMatch> CurrentMatch = new Bindable<TournamentMatch>();
        private WarningBox noMatchWarning;

        protected override void LoadComplete()
        {
            base.LoadComplete();

            CurrentMatch.BindTo(LadderInfo.CurrentMatch);
            CurrentMatch.BindValueChanged(CurrentMatchChanged, true);
        }

        protected virtual void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
        {
            if (match.NewValue == null)
            {
                AddInternal(noMatchWarning = new WarningBox("Choose a match first from the brackets screen"));
                return;
            }

            noMatchWarning?.Expire();
            noMatchWarning = null;
        }
    }
}