text:
Option Explicit On
Option Infer On
Option Strict On

#Region " --------------->> Imports "
Imports BCW.Etc.Enums.AddressModule
Imports BCW.Modules.PersonModule
Imports BCW.Data.DataAccess
Imports BCW.Etc.Enums.CommunicationModule
Imports BCW.Etc.Enums
Imports BCW.UI.Forms.UiEditors.Editors
Imports BCW.Foundation.Data.StatementBuilders.StatementBuildersMySql.Core
#End Region

Namespace Converter.vCardBuilder

	Public Class vCardEmployeeFactory

		Inherits vCardFactoryBase
		Implements IVCardFactory

#Region " --------------->> Enumerationen der Klasse "
#End Region

#Region " --------------->> Eigenschaften der Klasse "
		Private _person As Person
#End Region

#Region " --------------->> Konstruktor und Destruktor der Klasse "
#End Region  '{Konstruktor und Destruktor der Klasse}

#Region " --------------->> Zugriffsmethoden der Klasse "
		Public Sub New(ByVal connectionString As String, ByVal dataObject As Person)
			_person = dataObject
			_connectionString = connectionString
		End Sub
#End Region

#Region " --------------->> Ereignismethoden Methoden der Klasse "
#End Region

#Region " --------------->> Private Methoden der Klasse "
		Private Function GetTitle() As String
			Dim statement = String.Format("SELECT tele_v.GetFieldOfActivity({0})", _person.PersonId)
			Return DbResultMySql.Instance.ExecuteScalar(statement).ToString
		End Function

		Private Function GetAllowedCommunications() As List(Of Modules.CommunicationModule.Communication)

			Dim displayInInternet = BufferedValuesCommunication.DisplayInInternet.ToString
			Dim name = BufferedValuesCommunication.Name.ToString

			Return _person.Communications.Where(Function(c) _
			(c.BufferedValues.Item(displayInInternet).ToString = "Y") _
			OrElse (c.BufferedValues.Item(name).ToString.Contains("ienstlich")) _
			OrElse (c.BufferedValues.Item(name).ToString.Contains("urchwahl"))).ToList
		End Function

		Private Sub AddCommunication(ByVal card As vCard, ByVal c As Modules.CommunicationModule.Communication)

			Dim value = c.Value
			Dim name = c.Name

			Select Case c.CommunicationType
				Case CommunicationTypes.eMail
					AddMail(card, value)
				Case CommunicationTypes.Fax
					AddFax(card, name, value)
				Case CommunicationTypes.Messenger
					card.InstantMessengerAddress = value
				Case CommunicationTypes.Mobile
					AddMobile(card, value)
				Case CommunicationTypes.Phone
					AddPhone(card, name, value)
				Case CommunicationTypes.Url
					AddUrl(card, name, value)
			End Select
		End Sub

		Private Function GetAllowedAddresses() As List(Of Modules.AddressModule.Address)

			Dim displayInInternet = BufferedValuesAddress.DisplayInInternet.ToString
			Dim name = BufferedValuesAddress.Name.ToString

			Return _person.Addresses.Where(Function(a) _
			(a.BufferedValues.Item(displayInInternet).ToString = "Y") _
			OrElse (a.BufferedValues.Item(name).ToString.Contains("ienstlich"))).ToList
		End Function

		Private Sub AddAddress(ByVal card As vCard, ByVal a As BCW.Modules.AddressModule.Address)

			Dim adr = New vCardAddress
			adr.AddressType.Clear()

			Select Case True
				Case IsHome(a.Name)
					adr.AddressType.Add(vCardAddress.vCardAddressTypes.home)
				Case IsWork(a.Name)
					adr.AddressType.Add(vCardAddress.vCardAddressTypes.work)
			End Select

			If a.MailingAddress = YesNoOptions.Yes Then
				adr.AddressType.Add(vCardAddress.vCardAddressTypes.pref)
			End If

			adr.CountryName = a.Country
			adr.ExtendedAddress = a.StreetAdditional
			adr.Locality = a.City
			adr.PostalCode = a.Postcode
			adr.Region = a.FederalState
			adr.Street = a.Street.ToString
			card.Addresses.Add(adr)
		End Sub

		Private Function GetOrganizationDefaultStatement() As SelectBuilderMySql
			Dim sb = New SelectBuilderMySql
			sb.From.Add("tele_v.t_folders f")
			sb.From.Add("INNER JOIN tele_v.t_folder_items fi")
			sb.From.Add("ON f._rowid = fi.ParentFolderID")
			sb.Where.Add("(fi.Name = 'BCWRegister')")
			sb.Where.Add("AND (fi.ReferenceID = {0})", _person.PersonId)
			Return sb
		End Function

		Private Function GetNote() As String

			Dim sb = GetOrganizationDefaultStatement()
			sb.Select.Add("Comment")
			Dim comment = sb.ExecuteScalar(_connectionString).ToString.Replace(vbLf, vbCrLf)
			Return New Memo(comment).Text
		End Function

		Private Function GetOrganizationalName() As String
			Dim sb = GetOrganizationDefaultStatement()
			sb.Select.Add("datapool.GetAddressFieldByID(f.AnschriftenFID, 'FormatierteAnschrift')")
			Return sb.ExecuteScalar(_connectionString).ToString.Split(Chr(10))(0)
		End Function

		Private Function GetOrganizationalUnitNames() As String
			Dim sb = GetOrganizationDefaultStatement()
			sb.Select.Add("f.Name")
			Return sb.ExecuteScalar(_connectionString).ToString
		End Function
#End Region

#Region " --------------->> Öffentliche Methoden der Klasse "
		Public Function Create() As vCard Implements IVCardFactory.Create

			If _person Is Nothing Then Return Nothing

			Dim card = New vCard

			With _person
				card.FullName.FamilyName = .LastName
				card.FullName.GivenName = .FirstName
				card.FullName.HonorificPrefixes.Add(.FormOfAddress)
				card.CommonName = .ToString
				card.Photo.Image = .Photo
				card.Note = GetNote()
				card.Organization.OrganizationalName = GetOrganizationalName()
				card.Organization.OrganizationalUnitNames.Add(GetOrganizationalUnitNames)
				card.Title = GetTitle()
				GetAllowedCommunications.ForEach(Sub(c) AddCommunication(card, c))
				GetAllowedAddresses.ForEach(Sub(a) AddAddress(card, a))
			End With

			Return card
		End Function
#End Region

	End Class

End Namespace


text:
<?xml version="1.0" encoding="UTF-8"?>
<jndiConfig xmlns="http://wsrf.globus.org/jndi/config">
    <service name="ResolutionService">
        <resource
            name="home"
            type="org.globus.resolution.impl.ResolutionHome">
            <resourceParams>
                <parameter>
                    <name>factory</name>
                    <value>org.globus.wsrf.jndi.BeanFactory</value>
                </parameter>
                <parameter>
                    <name>resolvedKeyQName</name>
                    <value>{http://foo.bar}resolvedServiceKey</value>
                </parameter>
                <parameter>
                    <name>address</name>
                    <value>http://localhost:8080/ServiceToResolve</value>
                </parameter>
            </resourceParams>
        </resource>
    </service>
</jndiConfig>

redpajama_set_name: RedPajamaGithub


text:
class CGnuPlotUnixFile {
 public:
  CGnuPlotUnixFile(const std::string &filename) {
    init(filename);
  }

  CGnuPlotUnixFile(CUnixFile *file) {
    init(file);
  }

  CGnuPlotUnixFile(FILE *fp) {
    init(fp);
  }

  CGnuPlotUnixFile() { }

 ~CGnuPlotUnixFile() {
    if (owner_)
      delete file_;
  }

  void init(const std::string &filename) {
    if (owner_)
      delete file_;

    file_  = new CUnixFile(filename);
    valid_ = file_->open();
    owner_ = true;
  }

  void init(CUnixFile *file) {
    if (owner_)
      delete file_;

    file_  = file;
    valid_ = true;
    owner_ = false;
  }

  void init(FILE *fp) {
    if (owner_)
      delete file_;

    file_  = new CUnixFile(fp);
    valid_ = true;
    owner_ = true;
  }

  CUnixFile *file() const { return file_; }

  bool isOwner() const { return owner_; }

  bool isValid() const { return valid_; }

 private:
  CUnixFile *file_  { 0 };
  bool       owner_ { false };
  bool       valid_ { false };
};

#endif


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraController : MonoBehaviour {

    public float moveSpeed = 5f;
    public float turnSpeed = 5f;

    private Vector3 rot = Vector3.zero;

	// Use this for initialization
	void Start () {

	}

	// Update is called once per frame
	void Update () {
        float strafeHorizontal = Input.GetAxis("Strafe Horizontal");
        float moveFwd = Input.GetAxis("Fwd/Back");
        float moveVertical = Input.GetAxis("Move Vertical");
        float turnHorizontal = Input.GetAxis("Turn Horizontal");
        float turnVertical = Input.GetAxis("Turn Vertical");

        this.transform.position += this.moveSpeed * moveFwd * (this.transform.rotation * Vector3.forward) * Time.deltaTime;
        this.transform.position += this.moveSpeed * strafeHorizontal * (this.transform.rotation * Vector3.right) * Time.deltaTime;
        this.transform.position += this.moveSpeed * moveVertical * (this.transform.rotation * Vector3.up) * Time.deltaTime;

        rot.y += this.turnSpeed * turnHorizontal * Time.deltaTime;
        rot.x -= this.turnSpeed * turnVertical * Time.deltaTime;

        this.transform.rotation = Quaternion.Euler(rot);

        if(Input.GetKeyDown(KeyCode.Space))
        {
            UnityEngine.VR.VRSettings.enabled = !UnityEngine.VR.VRSettings.enabled;
            Debug.Log("Changed VRSettings.enabled to: " + UnityEngine.VR.VRSettings.enabled);
        }

        if(Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
        }
    }
}


text:
package com.amazon.pay.request;

import com.amazon.pay.types.OrderReferenceStatus;
import com.amazon.pay.types.SortOrder;

import java.io.Serializable;
import java.util.EnumSet;
import javax.xml.datatype.XMLGregorianCalendar;

/**
 * Container for the parameters to the ListOrderReference operation.
 */
public class ListOrderReferenceRequest extends DelegateRequest<ListOrderReferenceRequest> implements Serializable {

    @Override
    protected ListOrderReferenceRequest getThis() {
        return this;
    }

    // required parameters
    private String queryId;
    private String queryIdType;

    // Optional parameters
    private XMLGregorianCalendar startTime;
    private XMLGregorianCalendar endTime;
    private SortOrder sortOrder;
    private Integer pageSize;
    private EnumSet<OrderReferenceStatus> orderReferenceStatusListFilter;

    /**
     *
     * @param queryId The Seller Order id for which OROs need to be found out.
     * @param queryIdType The queryIdType is 'SellerOrderId'.
     */
    public ListOrderReferenceRequest(String queryId, String queryIdType){
        this.queryId = queryId;
        this.queryIdType = queryIdType;
    }

    /**
     * Sets the creation start time
     * @param startTime The creation Start Time
     *
     * @return the Start Time
     */
    public ListOrderReferenceRequest setStartTime (XMLGregorianCalendar startTime){
        this.startTime = startTime;
        return this;
    }

    /**
     * Sets the creation end time
     * @param endTime The creation End Time
     *
     * @return the End Time
     */
    public ListOrderReferenceRequest setEndTime (XMLGregorianCalendar endTime){
        this.endTime = endTime;
        return this;
    }

    /**
     * Sets the manner in which the order reference IDs have to be sorted (ascending,descending).
     * @param sortOrder sort order of the order reference IDs
     *
     * @return the Sort Order
     */
    public ListOrderReferenceRequest setSortOrder (SortOrder sortOrder){
        this.sortOrder = sortOrder;
        return this;
    }

    /**
     * Sets the page size for listing order reference IDs
     * @param pageSize sets the page size to lists the order reference IDs
     *
     * @return the Page Size
     */
    public ListOrderReferenceRequest setPageSize (Integer pageSize){
        this.pageSize = pageSize;
        return this;
    }

    /**
     * Sets the filters to filter according to the status of an order (open, closed, canceled).
     * @param orderReferenceStatusListFilter sets the filter for the order status
     *
     * @return the OrderReference Filter
     */
    public ListOrderReferenceRequest setOrderReferenceStatusListFilter (EnumSet<OrderReferenceStatus> orderReferenceStatusListFilter){
        this.orderReferenceStatusListFilter = orderReferenceStatusListFilter;
        return this;
    }

    /**
     * Returns the query id
     *
     * @return queryId
     */
    public  String getQueryId() {
        return queryId;
    }

    /**
     * Returns the query id type
     *
     * @return queryIdType
     */
    public String getQueryIdType() {
        return queryIdType;
    }

    /**
     * Returns the creation start time
     *
     * @return return startTime
     */
    public XMLGregorianCalendar getStartTime() {
        return startTime;
    }

    /**
     * Returns the creation end time
     *
     * @return endTime
     */
    public XMLGregorianCalendar getEndTime() {
        return endTime;
    }

    /**
     * Returns the order in which the orders have to be sorted
     *
     * @return sortOrder
     */
    public SortOrder getSortOrder() {
        return sortOrder;
    }

    /**
     * Returns the page size
     *
     * @return pageSize
     */
    public Integer getPageSize() {
        return pageSize;
    }

    /**
     * Returns the order reference status filter
     *
     * @return orderReferenceStatusListFilter
     */
    public EnumSet<OrderReferenceStatus> getOrderReferenceStatusListFilter() {
        return orderReferenceStatusListFilter;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "ListOrderReferenceRequest{" + "queryId=" + queryId
                + ", queryIdType=" + queryIdType
                + ", startTime=" + startTime.toString()
                + ", endTime=" + endTime.toString()
                + ", sortOrder=" + sortOrder.toString()
                + ", pageSize=" + pageSize
                + ", orderReferenceStatusListFilter=" + orderReferenceStatusListFilter.toString() + '}';
    }

}


text:
<?php

namespace test\framework;

use function foo\func;
use suda\framework\Event;
use PHPUnit\Framework\TestCase;

class EventTest extends TestCase
{
    public function testProcess()
    {
        $event = new Event();
        $event->add('test', function ($value, & $data) {
            $data = true;
            return $value.' - processed';
        });
        $data = false;
        $value = 'test';
        try {
            $value = $event->process('test', $value, [&$data]);
            $this->assertEquals(true, $data);
            $this->assertEquals('test - processed', $value);
        } catch (\ReflectionException $e) {
        }
    }
}


text:
package com.db4o.internal.activation;

import com.db4o.internal.*;

/**
 * Transparent Activation strategy.
 *
 */
public class NonDescendingActivationDepth extends ActivationDepthImpl {

	public NonDescendingActivationDepth(ActivationMode mode) {
		super(mode);
	}

	public ActivationDepth descend(ClassMetadata metadata) {
		return this;
	}

	public boolean requiresActivation() {
		return false;
	}

}


text:
"""Test everything about packs reading and writing"""
from gitdb.test.lib import (
    TestBase,
    with_rw_directory,
    fixture_path
)

from gitdb.stream import DeltaApplyReader

from gitdb.pack import (
    PackEntity,
    PackIndexFile,
    PackFile
)

from gitdb.base import (
    OInfo,
    OStream,
)

from gitdb.fun import delta_types
from gitdb.exc import UnsupportedOperation
from gitdb.util import to_bin_sha

from nose import SkipTest

import os
import tempfile

#{ Utilities
def bin_sha_from_filename(filename):
    return to_bin_sha(os.path.splitext(os.path.basename(filename))[0][5:])
#} END utilities

class TestPack(TestBase):

    packindexfile_v1 = (fixture_path('packs/pack-c0438c19fb16422b6bbcce24387b3264416d485b.idx'), 1, 67)
    packindexfile_v2 = (fixture_path('packs/pack-11fdfa9e156ab73caae3b6da867192221f2089c2.idx'), 2, 30)
    packindexfile_v2_3_ascii = (fixture_path('packs/pack-a2bf8e71d8c18879e499335762dd95119d93d9f1.idx'), 2, 42)
    packfile_v2_1 = (fixture_path('packs/pack-c0438c19fb16422b6bbcce24387b3264416d485b.pack'), 2, packindexfile_v1[2])
    packfile_v2_2 = (fixture_path('packs/pack-11fdfa9e156ab73caae3b6da867192221f2089c2.pack'), 2, packindexfile_v2[2])
    packfile_v2_3_ascii = (
        fixture_path('packs/pack-a2bf8e71d8c18879e499335762dd95119d93d9f1.pack'), 2, packindexfile_v2_3_ascii[2])

    def _assert_index_file(self, index, version, size):
        assert index.packfile_checksum() != index.indexfile_checksum()
        assert len(index.packfile_checksum()) == 20
        assert len(index.indexfile_checksum()) == 20
        assert index.version() == version
        assert index.size() == size
        assert len(index.offsets()) == size

        # get all data of all objects
        for oidx in range(index.size()):
            sha = index.sha(oidx)
            assert oidx == index.sha_to_index(sha)

            entry = index.entry(oidx)
            assert len(entry) == 3

            assert entry[0] == index.offset(oidx)
            assert entry[1] == sha
            assert entry[2] == index.crc(oidx)

            # verify partial sha
            for l in (4, 8, 11, 17, 20):
                assert index.partial_sha_to_index(sha[:l], l * 2) == oidx

        # END for each object index in indexfile
        self.failUnlessRaises(ValueError, index.partial_sha_to_index, "\0", 2)

    def _assert_pack_file(self, pack, version, size):
        assert pack.version() == 2
        assert pack.size() == size
        assert len(pack.checksum()) == 20

        num_obj = 0
        for obj in pack.stream_iter():
            num_obj += 1
            info = pack.info(obj.pack_offset)
            stream = pack.stream(obj.pack_offset)

            assert info.pack_offset == stream.pack_offset
            assert info.type_id == stream.type_id
            assert hasattr(stream, 'read')

            # it should be possible to read from both streams
            assert obj.read() == stream.read()

            streams = pack.collect_streams(obj.pack_offset)
            assert streams

            # read the stream
            try:
                dstream = DeltaApplyReader.new(streams)
            except ValueError:
                # ignore these, old git versions use only ref deltas,
                # which we havent resolved ( as we are without an index )
                # Also ignore non-delta streams
                continue
            # END get deltastream

            # read all
            data = dstream.read()
            assert len(data) == dstream.size

            # test seek
            dstream.seek(0)
            assert dstream.read() == data

            # read chunks
            # NOTE: the current implementation is safe, it basically transfers
            # all calls to the underlying memory map

        # END for each object
        assert num_obj == size

    def test_pack_index(self):
        # check version 1 and 2
        for indexfile, version, size in (self.packindexfile_v1, self.packindexfile_v2):
            index = PackIndexFile(indexfile)
            self._assert_index_file(index, version, size)
        # END run tests

    def test_pack(self):
        # there is this special version 3, but apparently its like 2 ...
        for packfile, version, size in (self.packfile_v2_3_ascii, self.packfile_v2_1, self.packfile_v2_2):
            pack = PackFile(packfile)
            self._assert_pack_file(pack, version, size)
        # END for each pack to test

    @with_rw_directory
    def test_pack_entity(self, rw_dir):
        pack_objs = list()
        for packinfo, indexinfo in ((self.packfile_v2_1, self.packindexfile_v1),
                                    (self.packfile_v2_2, self.packindexfile_v2),
                                    (self.packfile_v2_3_ascii, self.packindexfile_v2_3_ascii)):
            packfile, version, size = packinfo
            indexfile, version, size = indexinfo
            entity = PackEntity(packfile)
            assert entity.pack().path() == packfile
            assert entity.index().path() == indexfile
            pack_objs.extend(entity.stream_iter())

            count = 0
            for info, stream in zip(entity.info_iter(), entity.stream_iter()):
                count += 1
                assert info.binsha == stream.binsha
                assert len(info.binsha) == 20
                assert info.type_id == stream.type_id
                assert info.size == stream.size

                # we return fully resolved items, which is implied by the sha centric access
                assert not info.type_id in delta_types

                # try all calls
                assert len(entity.collect_streams(info.binsha))
                oinfo = entity.info(info.binsha)
                assert isinstance(oinfo, OInfo)
                assert oinfo.binsha is not None
                ostream = entity.stream(info.binsha)
                assert isinstance(ostream, OStream)
                assert ostream.binsha is not None

                # verify the stream
                try:
                    assert entity.is_valid_stream(info.binsha, use_crc=True)
                except UnsupportedOperation:
                    pass
                # END ignore version issues
                assert entity.is_valid_stream(info.binsha, use_crc=False)
            # END for each info, stream tuple
            assert count == size

        # END for each entity

        # pack writing - write all packs into one
        # index path can be None
        pack_path1 = tempfile.mktemp('', "pack1", rw_dir)
        pack_path2 = tempfile.mktemp('', "pack2", rw_dir)
        index_path = tempfile.mktemp('', 'index', rw_dir)
        iteration = 0

        def rewind_streams():
            for obj in pack_objs:
                obj.stream.seek(0)
        # END utility
        for ppath, ipath, num_obj in zip((pack_path1, pack_path2),
                                         (index_path, None),
                                         (len(pack_objs), None)):
            iwrite = None
            if ipath:
                ifile = open(ipath, 'wb')
                iwrite = ifile.write
            # END handle ip

            # make sure we rewind the streams ... we work on the same objects over and over again
            if iteration > 0:
                rewind_streams()
            # END rewind streams
            iteration += 1

            with open(ppath, 'wb') as pfile:
                pack_sha, index_sha = PackEntity.write_pack(pack_objs, pfile.write, iwrite, object_count=num_obj)
            assert os.path.getsize(ppath) > 100

            # verify pack
            pf = PackFile(ppath)
            assert pf.size() == len(pack_objs)
            assert pf.version() == PackFile.pack_version_default
            assert pf.checksum() == pack_sha
            pf.close()

            # verify index
            if ipath is not None:
                ifile.close()
                assert os.path.getsize(ipath) > 100
                idx = PackIndexFile(ipath)
                assert idx.version() == PackIndexFile.index_version_default
                assert idx.packfile_checksum() == pack_sha
                assert idx.indexfile_checksum() == index_sha
                assert idx.size() == len(pack_objs)
                idx.close()
            # END verify files exist
        # END for each packpath, indexpath pair

        # verify the packs thoroughly
        rewind_streams()
        entity = PackEntity.create(pack_objs, rw_dir)
        count = 0
        for info in entity.info_iter():
            count += 1
            for use_crc in range(2):
                assert entity.is_valid_stream(info.binsha, use_crc)
            # END for each crc mode
        # END for each info
        assert count == len(pack_objs)
        entity.close()

    def test_pack_64(self):
        # TODO: hex-edit a pack helping us to verify that we can handle 64 byte offsets
        # of course without really needing such a huge pack
        raise SkipTest()


text:
<?php

defined( 'ABSPATH' ) or exit;

/**
 * @ignore
 */
function _mc4wp_admin_sidebar_support_notice() {
	?>

<?php echo esc_html__( 'Looking for help?', 'mailchimp-for-wp' ); ?>

<?php echo __( 'We have some resources available to help you in the right direction.', 'mailchimp-for-wp' ); ?>

<?php echo esc_html__( 'Knowledge Base', 'mailchimp-for-wp' ); ?>

<?php echo esc_html__( 'Frequently Asked Questions', 'mailchimp-for-wp' ); ?>

<?php echo sprintf( __( 'If your answer can not be found in the resources listed above, please use the support forums on WordPress.org.' ), 'https://wordpress.org/support/plugin/mailchimp-for-wp' ); ?>

<?php echo sprintf( __( 'Found a bug? Please open an issue on GitHub.' ), 'https://github.com/ibericode/mailchimp-for-wordpress/issues' ); ?>

	<?php
}

/**
 * @ignore
 */
function _mc4wp_admin_sidebar_other_plugins() {

    echo '
';
    echo '
' . __( 'Other plugins by ibericode', 'mailchimp-for-wp' ) . '
';

    echo '
';

    // Boxzilla
    echo '
';
    echo sprintf( 'Boxzilla Pop-ups
', 'https://boxzillaplugin.com/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=sidebar' );
    echo  __( 'Pop-ups or boxes that slide-in with a newsletter sign-up form. A sure-fire way to grow your email lists.', 'mailchimp-for-wp');
    echo '
';

    // HTML Forms
    echo '
';
    echo sprintf( 'HTML Forms
', 'https://www.htmlforms.io/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=sidebar' );
    echo  __( 'Super flexible forms using native HTML. Just like with MailChimp for WordPress forms but for other purposes, like a contact form.', 'mailchimp-for-wp' );
    echo '
';

    echo '
';
    echo '
';
}

add_action( 'mc4wp_admin_sidebar', '_mc4wp_admin_sidebar_other_plugins', 40 );
add_action( 'mc4wp_admin_sidebar', '_mc4wp_admin_sidebar_support_notice', 50 );

/**
 * Runs when the sidebar is outputted on MailChimp for WordPress settings pages.
 *
 * Please note that not all pages have a sidebar.
 *
 * @since 3.0
 */
do_action( 'mc4wp_admin_sidebar' );


text:
<?php

namespace Application\Sonata\MediaBundle\Entity;

use Sonata\MediaBundle\Entity\BaseGallery as BaseGallery;

/**
 * Gallery
 *
 * @author Stepanenko Stanislav <dsazztazz@gmail.com>
 */
class Gallery extends BaseGallery
{
    /**
     * @var integer $id
     */
    protected $id;

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


text:
require 'spec_helper'

describe Ajax::Helpers::UrlHelper do
  DOMAINS = %w[musicsocial.com.local altnet.com amusicstreamingservice.com stage.altnet.com rails1.creagency.com.au]

  describe "url_fragment" do
    it "should return the fragment" do
      Ajax.url_fragment('/Beyonce#abc').should == 'abc'
      Ajax.url_fragment('/Beyonce#/abc').should == '/abc'
      Ajax.url_fragment('/Beyonce#/abc').should == '/abc'
    end
  end

  describe "normalized_url_fragment" do
    it "should return the fragment" do
      Ajax.normalized_url_fragment('/Beyonce#abc').should == '/abc'
      Ajax.normalized_url_fragment('/Beyonce#/abc').should == '/abc'
      Ajax.normalized_url_fragment('/Beyonce#/abc').should == '/abc'
      Ajax.normalized_url_fragment('/Beyonce#!/abc').should == '/abc'
      Ajax.normalized_url_fragment('/Beyonce#!//abc').should == '/abc'
      Ajax.normalized_url_fragment('/Beyonce#!/?abc').should == '/?abc'
      Ajax.normalized_url_fragment('/Beyonce#/!/abc').should == '/!/abc'
    end
  end

  [[false, '/#/'], [true, '/#!/']].each do |crawlable, fragment|
    describe "when #{crawlable ? 'not' : ''} google crawlable" do
      before :all do
        @original ||= set_option(:crawlable => crawlable)
      end

      after :all do
        set_option(:crawlable => @original.first)
      end

      describe "hashed_url_from_traditional" do
        it "should handle a query string" do
          Ajax.hashed_url_from_traditional('/Beyonce?one=1').should == fragment + 'Beyonce?one=1'
        end

        it "should ignore the fragment" do
          Ajax.hashed_url_from_traditional('/Beyonce?one=1#fragment').should == fragment + 'Beyonce?one=1'
        end

        it "should handle no query string" do
          Ajax.hashed_url_from_traditional('/Beyonce').should == fragment + 'Beyonce'
        end

        it "should handle special characters" do
          Ajax.hashed_url_from_traditional('/beyoncé').should == fragment + 'beyonc%C3%A9'
          Ajax.hashed_url_from_traditional('/red hot').should == fragment + 'red%20hot'
        end

        DOMAINS.each do |domain|
          it "should work for domain #{domain}" do
            Ajax.hashed_url_from_traditional("http://#{domain}/playlists").should == "http://#{domain}#{fragment}playlists"
          end
        end
      end

      describe "hashed_url_from_fragment" do
        it "should strip double slashes" do
          Ajax.hashed_url_from_fragment('/Beyonce#/Akon').should == fragment + 'Akon'
          Ajax.hashed_url_from_fragment('/Beyonce#Akon').should == fragment + 'Akon'
        end

        it "should handle special characters" do
          Ajax.hashed_url_from_fragment('/#/beyoncé').should == fragment + 'beyonc%C3%A9'
          Ajax.hashed_url_from_fragment('/#/red hot').should == fragment + 'red%20hot'
        end

        it "should handle special characters" do
          Ajax.hashed_url_from_fragment('/#!/beyoncé').should == fragment + 'beyonc%C3%A9'
          Ajax.hashed_url_from_fragment('/#!/red hot').should == fragment + 'red%20hot'
        end

        it "should handle no fragment" do
          Ajax.hashed_url_from_fragment('/Beyonce').should == fragment
        end

        DOMAINS.each do |domain|
          it "should work for domain #{domain}" do
            Ajax.hashed_url_from_fragment("http://#{domain}").should == "http://#{domain}#{fragment}"
            Ajax.hashed_url_from_fragment("http://#{domain}/").should == "http://#{domain}#{fragment}"
            Ajax.hashed_url_from_fragment("http://#{domain}/Beyonce/#/playlists").should == "http://#{domain}#{fragment}playlists"
            Ajax.hashed_url_from_fragment("http://#{domain}/Beyonce/#!/playlists").should == "http://#{domain}#{fragment}playlists"
          end
        end
      end
    end
  end

  describe "url_is_root?" do
    it "should detect root urls" do
      Ajax.url_is_root?('/#/Beyonce?query2').should be(true)
      Ajax.url_is_root?('/#!/Beyonce?query2').should be(true)
      Ajax.url_is_root?('/').should be(true)
      Ajax.url_is_root?('/#/beyoncé'). should be(true)
      Ajax.url_is_root?('/#!/beyoncé'). should be(true)
    end

    it "should detect non-root urls" do
      Ajax.url_is_root?('/Beyonce').should be(false)
    end

    it "should support full URLs" do
      Ajax.is_hashed_url?('http://musicsocial.com.local/#/playlists').should be(true)
      Ajax.is_hashed_url?('http://musicsocial.com.local/#!/playlists').should be(true)
    end

    it "should support special characters" do
      Ajax.is_hashed_url?('http://musicsocial.com.local/#/beyoncé').should be(true)
      Ajax.is_hashed_url?('http://musicsocial.com.local/#!/beyoncé').should be(true)
    end
  end

  describe "is_hashed_url?" do
    it "should return false for fragments that don't start with /" do
      Ajax.is_hashed_url?('/Beyonce#Akon').should be(false)
      Ajax.is_hashed_url?('/Beyonce?query#Akon/').should be(false)
      Ajax.is_hashed_url?('/Beyonce?query%23').should be(false)
    end

    it "should return true if the fragment starts with /" do
      Ajax.is_hashed_url?('/Beyonce#/Akon').should be(true)
      Ajax.is_hashed_url?('/#/Akon').should be(true)
      Ajax.is_hashed_url?('/Beyonce?query%23/').should be(true) # KJV technically I don't think this behaviour is correct
    end

    it "should return true if the fragment starts with !" do
      Ajax.is_hashed_url?('/Beyonce#!Akon').should be(true)
      Ajax.is_hashed_url?('/#!/Akon').should be(true)
      Ajax.is_hashed_url?('/Beyonce?query%23!/').should be(true) # KJV technically I don't think this behaviour is correct
    end

    DOMAINS.each do |domain|
      it "should work for domain #{domain}" do
        Ajax.is_hashed_url?("http://#{domain}/#/playlists").should be(true)
        Ajax.is_hashed_url?("http://#{domain}/#!/playlists").should be(true)
        Ajax.is_hashed_url?("http://#{domain}/playlists").should be(false)
      end
    end
  end

  describe "traditional_url_from_fragment" do
    it "should handle slashes" do
      Ajax.traditional_url_from_fragment('/Beyonce#Akon').should == '/Akon'
      Ajax.traditional_url_from_fragment('/Beyonce#/Akon').should == '/Akon'
      Ajax.traditional_url_from_fragment('/Beyonce#/Akon/').should == '/Akon/'
    end

    it "should handle slashes with !" do
      Ajax.traditional_url_from_fragment('/Beyonce#!Akon').should == '/Akon'
      Ajax.traditional_url_from_fragment('/Beyonce#!/Akon').should == '/Akon'
      Ajax.traditional_url_from_fragment('/Beyonce#!/Akon/').should == '/Akon/'
    end

    it "should handle no fragment" do
      Ajax.traditional_url_from_fragment('/Beyonce#/beyoncé').should == '/beyonc%C3%A9'
      Ajax.traditional_url_from_fragment('/#/red hot').should == '/red%20hot'
    end

    it "should handle no fragment with !" do
      Ajax.traditional_url_from_fragment('/Beyonce#!/beyoncé').should == '/beyonc%C3%A9'
      Ajax.traditional_url_from_fragment('/#!/red hot').should == '/red%20hot'
    end

    it "should handle special characters" do
      Ajax.traditional_url_from_fragment('/Beyonce#/Akon').should == '/Akon'
      Ajax.traditional_url_from_fragment('/Beyonce#!/Akon').should == '/Akon'
    end

    DOMAINS.each do |domain|
      it "should work for domain #{domain}" do
        Ajax.traditional_url_from_fragment("http://#{domain}/Beyonce/#playlists").should == "http://#{domain}/playlists"
        Ajax.traditional_url_from_fragment("http://#{domain}/Beyonce/#/playlists").should == "http://#{domain}/playlists"

        Ajax.traditional_url_from_fragment("http://#{domain}/Beyonce/#!playlists").should == "http://#{domain}/playlists"
        Ajax.traditional_url_from_fragment("http://#{domain}/Beyonce/#!/playlists").should == "http://#{domain}/playlists"
      end
    end
  end
end


text:
#ifndef NETWORKCONNECTION_H
#define NETWORKCONNECTION_H

#include "NetworkEndPoint.h"

#include <memory>
#include <functional>

class NetworkManager;
class NetworkManagerConnection;
class Message;

/**
 * An instance gives access to a client-server connection.
 * The NetworkManager has getters to create NetworkConnection instances, once
 * one is successfully created you can use it like a remote server that you can
 * post messages to, get messages from (using setOnIncomingMessage()) and it will
 * automatically reconnect and resend messages on failures.
 *
 * The NetworkConnection is a very light-weight class for
 * easy access to a certain connection.  It is used as a value-class and as such it has
 * an isValid() method to allow checking if the connection it represents still exists.
 * For instance when the NetworkManager that owns all the connections is deleted, this
 * will return false.
 *
 * Callbacks are registered with one instance of a NetworkConnection, and when that
 * instance goes out of scope the callbacks will be destructed as well.
 * Simplest usage is thus something like this;
 * @code
class MyServiceHandler
{
public:
    MyServiceHandler(NetworkConnection && connection)
        : m_connection(std::move(connection))
    {
        m_connection.setOnConnected(std::bind(&MyServiceHandler::onConnected, this));
        m_connection.setOnDisconnected(std::bind(&MyServiceHandler::onDisconnected, this));
        m_connection.setOnIncomingMessage(std::bind(&MyServiceHandler::onIncomingMessage, this, std::placeholders::_1));
    }

private:
    void onConnected();
    void onDisconnected();
    void onIncomingMessage(const Message &message);

private:
    NetworkConnection m_connection;
};
    @endcode
*/
class NetworkConnection
{
public:
    /// create an invalid default connection object.
    NetworkConnection();
    /**
     * Create a NetworkConnection representing a certain connection-id.
     * This constructor can be used to create a connection from a Message by using
     * the Message::remote member as the \a id.
     */
    NetworkConnection(NetworkManager *parent, int id);
    /// called by the NetworkManager
    NetworkConnection(std::shared_ptr<NetworkManagerConnection> &parent, int id);
    NetworkConnection(NetworkConnection && other);
    ~NetworkConnection();

    /// returns true if we have an actual socket connection to the remote()
    bool isConnected() const;
    /// initiates a (re)connect
    void connect();
    void disconnect();
    /// Return the current remote we are connected to, or an empty one if we are not connected
    EndPoint endPoint() const;

    inline int connectionId() const {
        return m_id;
    }

    /// accepts an incoming connection
    void accept();

    enum MessagePriority {
        NormalPriority,
        HighPriority
    };

    /// send a message, automatically connecting if needed.
    void send(const Message &message, MessagePriority priority = NormalPriority);

    /// return true if this object can be operated on and represents a real connection
    bool isValid() const;

    /**
     * Clears the networkconnection and all related callbacks.
     * isValid() will return false after this is called.
     */
    void clear();

    NetworkConnection& operator=(NetworkConnection && other);

    /**
      * Sets a callback to be called every time we (re)connect at the socket level.
      * Notice that callbacks are owned by the connection object, the callback will be
      *  garbage collected when the instance of the NetworkConnection goes out of scope.
      * You can have only one callback per NetworkConnection instance, but you can have
      * many instances representing the same physical connection.
      */
    void setOnConnected(const std::function<void(const EndPoint&)> &callback);

    /**
      * Sets a callback to be called every time we have a disconnect.
      * Notice that callbacks are owned by the connection object, the callback will be
      *  garbage collected when the instance of the NetworkConnection goes out of scope.
      * You can have only one callback per NetworkConnection instance, but you can have
      * many instances representing the same physical connection.
      */
    void setOnDisconnected(const std::function<void(const EndPoint&)> &callback);

    /**
      * Sets a callback for incoming messages, one message per call.
      * Notice that callbacks are owned by the connection object, the callback will be
      *  garbage collected when the instance of the NetworkConnection goes out of scope.
      * You can have only one callback per NetworkConnection instance, but you can have
      * many instances representing the same physical connection.
      */
    void setOnIncomingMessage(const std::function<void(const Message&)> &callback);

    /**
     * Punish a node that misbehaves (for instance if it breaks your protocol).
     * A node that gathers a total of 1000 points is banned for 24 hours,
     * every hour 100 points are subtracted from a each node's punishment-score.
     */
    void punishPeer(int punishment);

    /**
      * Posts a task on the underlying strand for it to be executed serially.
      */
    void postOnStrand(const std::function<void()> &task);

private:
    NetworkConnection(const NetworkConnection&);
    NetworkConnection& operator=(NetworkConnection&);

    std::weak_ptr<NetworkManagerConnection> m_parent;
    int m_id;
    int m_callbacksId;
};

#endif


text:
/* global io */

var socket = io();


text:
package com.gmail.zahusek.tinyprotocolapi.api.title;

import org.bukkit.entity.Player;

import com.gmail.zahusek.tinyprotocolapi.TinyProtocol;
import com.gmail.zahusek.tinyprotocolapi.TinyProtocolAPI;
import com.gmail.zahusek.tinyprotocolapi.packet.PacketChat;
import com.gmail.zahusek.tinyprotocolapi.packet.PacketTitle;

import static com.gmail.zahusek.tinyprotocolapi.wrapper.WrapperEnum.TitleAction.*;

public abstract class TitleAPI
{

	static final TinyProtocol fb = TinyProtocolAPI.getTinyProtocol();

	public static void title(Player player, String title, int start, int stay, int end)
	{
    	if(player == null) throw new IllegalArgumentException("Player cannot be null !");
		PacketTitle a = new PacketTitle(start, stay, end);
		PacketTitle b = new PacketTitle(TITLE, title);
		fb.sendAbstractPacket(player, a, b);
	}

	public static void subtitle(Player player, String subtitle, int start, int stay, int end)
	{
    	if(player == null) throw new IllegalArgumentException("Player cannot be null !");
		PacketTitle a = new PacketTitle(start, stay, end);
		PacketTitle b = new PacketTitle(TITLE, "");
		PacketTitle c = new PacketTitle(SUBTITLE, subtitle);
		fb.sendAbstractPacket(player, a, b, c);
	}

	public static void subtitle(Player player, String subtitle)
	{   if(player == null) throw new IllegalArgumentException("Player cannot be null !");
		fb.sendAbstractPacket(player, new PacketTitle(SUBTITLE, subtitle));
	}

	public static void broadcast(Player player, String title, String subtitle, int start, int stay, int end)
	{
    	if(player == null) throw new IllegalArgumentException("Player cannot be null !");
		PacketTitle a = new PacketTitle(start, stay, end);
		PacketTitle b = new PacketTitle(TITLE, title);
		PacketTitle c = new PacketTitle(SUBTITLE, subtitle);
		fb.sendAbstractPacket(player, a, b, c);
	}

	public static void clear(Player player)
	{
		if(player == null) throw new IllegalArgumentException("Player cannot be null !");
		fb.sendAbstractPacket(player, new PacketTitle(CLEAR, ""));
	}

	public static void hotbar(Player player, String msg)
	{
		if(player == null) throw new IllegalArgumentException("Player cannot be null !");
		new PacketChat(msg, (byte) 2);
	}
}


text:
require 'bcrypt'
require 'securerandom'

class User < ActiveRecord::Base
  include BCrypt

  has_attached_file :photo
  has_many :meows_given, class_name: "Rating",
                         foreign_key: "reviewer_id",
                         inverse_of: :reviewer
  has_many :meows_received, class_name: "Rating",
                            foreign_key: "reviewee_id",
                            inverse_of: :reviewee

  has_and_belongs_to_many :ratings

  validates_attachment_content_type :photo, :content_type => /\Aimage/
  validates :username, :presence => true, :uniqueness => { :case_sensitive => false }
  validates :password, :presence => true

  # case-insensitive find_by_username
  def self.find_by_username(name)
    User.where("LOWER(username) = ?", name.downcase).first
  end

  def password
    password_hash = read_attribute(:password)
    return nil unless password_hash
    @password ||= Password.new(password_hash)
  end

  def password=(new_pass)
    if new_pass.blank?
      @password = nil
      write_attribute(:password, nil)
    else
      @password = Password.create(new_pass)
      write_attribute(:password, @password)
    end
  end

  def token
    read_attribute(:token) || generate_token
  end

  def generate_token
    write_attribute(:token, "#{id}#{SecureRandom.hex}")
  end

  def photo_url
    photo.try(:url)
  end

  def notifications(limit = 25)
    # Fetch the latest 25 ratings that user has given or received
    Rating.where("reviewee_id = ? or reviewer_id = ?", id, id).order(updated_at: :desc).limit(limit.to_i)
  end

  def beenz_received_from_user(user)
    meows_received.where(reviewer: user).try(:first).try(:beenz)
  end

  def beenz_given_to_user(user)
    meows_given.where(reviewee: user).try(:first).try(:beenz)
  end

  def give_beenz_to_user(beenz, user)
    rating = meows_given.where(reviewee: user).try(:first) || meows_given.build(reviewee: user)
    rating.beenz = beenz
    rating.save!
    user.calculate_beenz!
  end

  def days_since_creation
    (DateTime.now.to_i - created_at.to_i)/(60.0*60*24)
  end

  def score
    read_attribute(:score) || (calculate_beenz! && read_attribute(:score))
  end

  def weight
    read_attribute(:weight) || (calculate_beenz! && read_attribute(:weight))
  end

  def beenz
    # This gives us a weighted average that decays linearly over time
    # The less weight you have, the faster you'll decay.
    b = (score - days_since_creation*0.4)/weight

    return case
    when b > 4.75 then 5
    when b > 4.25 then 4.5
    when b > 3.75 then 4
    when b > 3.25 then 3.5
    when b > 2.75 then 3
    when b > 2.25 then 2.5
    when b > 1.75 then 2
    when b > 1.25 then 1.5
    else
      1
    end
  end

  def calculate_beenz!
    query = ActiveRecord::Base.connection.execute("
      select SUM(beenz * weight) as score, SUM(weight) as weight FROM ratings WHERE reviewee_id = #{id}
    ")
    update_attribute(:score, query[0]['score'].to_i)
    update_attribute(:weight, query[0]['weight'].to_i + 1)
  end
end


text:
package org.apache.reef.io.network.naming;

import org.apache.reef.io.network.naming.parameters.*;
import org.apache.reef.tang.formats.ConfigurationModule;
import org.apache.reef.tang.formats.ConfigurationModuleBuilder;
import org.apache.reef.tang.formats.OptionalParameter;
import org.apache.reef.tang.formats.RequiredParameter;
import org.apache.reef.wake.IdentifierFactory;

/**
 * Configuration Module Builder for NameResolver.
 */
public final class NameResolverConfiguration extends ConfigurationModuleBuilder {

  /**
   * The port used by name server.
   */
  public static final RequiredParameter<Integer> NAME_SERVICE_PORT = new RequiredParameter<>();
  /**
   * DNS hostname running the name service.
   */
  public static final RequiredParameter<String> NAME_SERVER_HOSTNAME = new RequiredParameter<>();

  /**
   * Identifier factory for NameClient.
   */
  public static final OptionalParameter<IdentifierFactory> IDENTIFIER_FACTORY = new OptionalParameter<>();

  /**
   * The timeout of caching lookup.
   */
  public static final OptionalParameter<Long> CACHE_TIMEOUT = new OptionalParameter<>();

  /**
   * The timeout of retrying connection.
   */
  public static final OptionalParameter<Integer> RETRY_TIMEOUT = new OptionalParameter<>();

  /**
   * The number of retrying connection.
   */
  public static final OptionalParameter<Integer> RETRY_COUNT = new OptionalParameter<>();

  public static final ConfigurationModule CONF = new NameResolverConfiguration()
      .bindNamedParameter(NameResolverNameServerPort.class, NAME_SERVICE_PORT)
      .bindNamedParameter(NameResolverNameServerAddr.class, NAME_SERVER_HOSTNAME)
      .bindNamedParameter(NameResolverIdentifierFactory.class, IDENTIFIER_FACTORY)
      .bindNamedParameter(NameResolverCacheTimeout.class, CACHE_TIMEOUT)
      .bindNamedParameter(NameResolverRetryTimeout.class, RETRY_TIMEOUT)
      .bindNamedParameter(NameResolverRetryCount.class, RETRY_COUNT)
      .build();
}


text:
In this section, you'll find answers on the following frequently asked questions:

* [How do I update my Apollo Universal Starter Kit project without forking the repository?](#how-do-i-update-my-apollo-universal-starter-kit-project-without-forking-the-repository)
* [How do I use a custom GraphQL backend?](#how-do-i-use-a-custom-graphql-back-end)
* [How do I use a different database?](#how-do-i-use-a-different-database-instead-of-sqlite)
* [How do I enable Facebook and Google OAuth?](#how-do-i-enable-facebook-and-google-oauth)
* [How do I set up environment variables for development?](#how-do-i-set-up-environment-variables-for-development)
* [How do I add support for a custom domain name in the local development environment?](#how-do-i-add-support-for-a-custom-domain-name-in-the-local-development-environment)
* [What extensions can I use when creating files in my project?](#what-extensions-can-i-use-when-creating-files-in-my-project)
* [How do I always keep my Apollo Starter Kit project up-to-date?](#how-do-i-always-keep-my-apollo-starter-kit-project-up-to-date)

## How do I update my Apollo Universal Starter Kit project without forking the repository?

Follow the steps below to create an Apollo Starter Kit project and updating the fork:

1. Initialize a new Git repository
2. Add the starter kit as a remote upstream repository:
3. Run the following command:

```bash
git merge upstream/stable
```

4. When you are in `master` branch of your project:

https://help.github.com/articles/syncing-a-fork/

Whenever you want to receive updates, first run:

```bash
git fetch upstream
```

Then run when you are in the master branch of your project:
```bash
git merge upstream/stable
```

## How do I use a custom GraphQL back end?

To set your custom GraphQL back end endpoint, set `BACKEND_API_URL` environment variable or change URL in `packages/server/build.config.js` for the `__API_URL__` property:

```javascript
__API_URL__: process.env.BACKEND_API_URL || 'https://my-custom-domain/graphql', // set the full URL to the external GraphQL API e.g. https://
```

We recommend that you still run the back-end code provided by the starter kit to use the server-side rendering (SSR).
You can also turn off SSR if you don't use the starter kit back end. Set the environmet variable `SSR` to `false` or edit root `build.config.js`:

## How do I disable Server Side Rendering?

To disable Server Side Rendering (SSR), change set environment variable `SSR` to `false` or edit root `build.config.js`

More information: [Server Side Rendering with Apollo Universal Starter Kit].

## How do I use a different database instead of SQLite?

You can almost all relational database management systems that use SQL and are supported by [Knex] such as PostgreSQL,
MySQL, MSSQL, MariaDB, SQLite3, and Oracle.

Apollo Universal Starter Kit is database-agnostic. You can any other databases if they support a JavaScript client
provided by Knex. This way you can create a simple connector and export it normally in place of the Knex connector.

Reference: [#525](https://github.com/sysgears/apollo-universal-starter-kit/issues/525)

## How do I enable Facebook and Google OAuth?

You can enable the social login functionality in the `config/user.js` file:

```javascript
export default {
  // other configurations are omitted
  auth: {
    facebook: {
          enabled: false, // set to true to enable login with Facebook
          clientID: process.env.FACEBOOK_CLIENTID,
          clientSecret: process.env.FACEBOOK_CLIENTSECRET,
          scope: ['email'],
          profileFields: ['id', 'emails', 'displayName']
    },
    github: {
      enabled: false, // set to true to enable login with GitHub
      clientID: process.env.GITHUB_CLIENTID,
      clientSecret: process.env.GITHUB_CLIENTSECRET,
      scope: ['user:email']
    },
    linkedin: {
      enabled: false, // set to true to enable login with LinkedIn
      clientID: process.env.LINKEDIN_CLIENTID,
      clientSecret: process.env.LINKEDIN_CLIENTSECRET,
      scope: ['r_emailaddress', 'r_basicprofile']
    },
    google: {
      enabled: false, // set to true to enable login with Google
      clientID: process.env.GOOGLE_CLIENTID,
      clientSecret: process.env.GOOGLE_CLIENTSECRET,
      scope: ['https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile']
    }
  }
};
```

## How do I add support for a custom domain name in the local development environment?

First, modify the host file in the following way:

`127.0.0.1 localhost.host`

Then, add this setting into `/packages/client/.sprinjs` file under `options` section

```
webpackConfig: {
  devServer: {
    public: 'localhost.host'
  }
}
```

## What extensions can I use when creating files in my project?

Apollo Universal Starter Kit suggests that you use the following extensions when creating your modules:

| Platform | Directory        | Possible extensions for application files |
| -------- | ---------------- | ----------------------------------------- |
| server   | packages/server/ | `.tsx`, `.jsx`, `.ts`, `.js`, `.json`     |
| web      | packages/client/ | `.tsx`, `.jsx`, `.ts`, `.js`, `.json`     |

When you develop a native mobile app, we also recommend that you follow the naming convention below:

| Platform | Directory        | Possible extensions for application files                             |
| -------- | ---------------- | --------------------------------------------------------------------- |
| native   | packages/mobile/ | `.native.tsx`, `.native.jsx`, `.native.ts`, `.native.js`, `.json`     |
| android  | packages/mobile/ | `.android.tsx`, `.android.jsx`, `.android.ts`, `.android.js`, `.json` |
| ios      | packages/mobile/ | `.ios.tsx`, `.ios.jsx`, `.ios.ts`, `.ios.js`, `.json`                 |

Notice that you should use the `.native.tsx` and similar extensions for files with the same logic for both Android and
iOS platforms. If the logic for these two platforms is different, use `.android.tsx` (and similar extensions) for
Android, and `.ios.tsx` for iOS.

For example, here's how the files may be called for the Storage module:

* `storage.tsx` for the web and server platforms
* `storage.native.tsx` for the mobile app for files with the same logic
* `storage.android.tsx` for the custom logic for the Android platform
* `storage.ios.tsx` for the custom logic for the iOS platform

Apollo Universal Starter Kit uses Webpack to build the code for all the platforms – server, web, Android, and iOS.
The starter kit uses the [`resolve.extensions`] Webpack property to understand which files should be used for generating
a specific platform bundle when there are several files with the same name but different extensions.

## How do I always keep my Apollo Starter Kit project up-to-date?

The best way for keeping your Apollo Universal Starter Kit project always up-to-date is to configure a remote repository
that points to the upstream of the original repository.

You can consult [Configuring a Remote for a Fork] documentation on GitHub. Using this feature, you can easily pull in
the latest changes made to this kit. For that, consult the [Syncing a Fork].

If you intend to make significant changes to existing modules, we suggest you copy and rename the modules, to limit the
amount of merge conflicts to a minimum.

[knex]: https://knexjs.org/
[`resolve.extensions`]: https://webpack.js.org/configuration/resolve/#resolve-extensions
[server side rendering with apollo universal starter kit]: /docs/Configuration.md#server-side-rendering
[configuring a remote for a fork]: https://help.github.com/articles/configuring-a-remote-for-a-fork/
[syncing a fork]: https://help.github.com/articles/syncing-a-fork/


text:
<?php

/**
 * @file
 * Contains \Drupal\text\Tests\Formatter\TextPlainUnitTest.
 */

namespace Drupal\text\Tests\Formatter;

use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Language\Language;
use Drupal\entity\Plugin\Core\Entity\EntityDisplay;
use Drupal\simpletest\DrupalUnitTestBase;

/**
 * Tests the text_plain field formatter.
 *
 * @todo Move assertion helper methods into DrupalUnitTestBase.
 * @todo Move field helper methods, $modules, and setUp() into a new
 *   FieldPluginUnitTestBase.
 */
class TextPlainUnitTest extends DrupalUnitTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = array('entity', 'field', 'field_sql_storage', 'text', 'entity_test', 'system');

  /**
   * Contains rendered content.
   *
   * @var string
   */
  protected $content;

  public static function getInfo() {
    return array(
      'name'  => 'Text field text_plain formatter',
      'description'  => "Test the creation of text fields.",
      'group' => 'Field types',
    );
  }

  function setUp() {
    parent::setUp();

    // Configure the theme system.
    $this->installConfig(array('system', 'field'));
    $this->installSchema('entity_test', 'entity_test');

    // @todo Add helper methods for all of the following.

    $this->entity_type = 'entity_test';
    if (!isset($this->bundle)) {
      $this->bundle = $this->entity_type;
    }

    $this->field_name = drupal_strtolower($this->randomName());
    $this->field_type = 'text_long';
    $this->field_settings = array();
    $this->instance_settings = array(
      'text_processing' => FALSE,
    );

    $this->formatter_type = 'text_plain';
    $this->formatter_settings = array();

    $this->field = entity_create('field_entity', array(
      'field_name' => $this->field_name,
      'type' => $this->field_type,
      'settings' => $this->field_settings,
    ));
    $this->field->save();

    $this->instance = entity_create('field_instance', array(
      'entity_type' => $this->entity_type,
      'bundle' => $this->bundle,
      'field_name' => $this->field_name,
      'label' => $this->randomName(),
      'settings' => $this->instance_settings,
    ));
    $this->instance->save();

    $this->view_mode = 'default';
    $this->display = entity_get_display($this->entity_type, $this->bundle, $this->view_mode)
      ->setComponent($this->field_name, array(
        'type' => $this->formatter_type,
        'settings' => $this->formatter_settings,
      ));
    $this->display->save();

    $this->langcode = Language::LANGCODE_NOT_SPECIFIED;
  }

  /**
   * Creates an entity of type $this->entity_type and bundle $this->bundle.
   *
   * @param array $values
   *   (optional) Additional values to pass to entity_create().
   *
   * @return \Drupal\Core\Entity\EntityInterface
   *   The created entity object.
   */
  protected function createEntity($values = array()) {
    $info = entity_get_info($this->entity_type);
    $bundle_key = $info['entity_keys']['bundle'];
    $entity = entity_create($this->entity_type, $values + array(
      $bundle_key => $this->bundle,
    ));
    return $entity;
  }

  /**
   * Renders fields of a given entity with a given display.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity object with attached fields to render.
   * @param \Drupal\entity\Plugin\Core\Entity\EntityDisplay $display
   *   The display to render the fields in.
   */
  protected function renderEntityFields(EntityInterface $entity, EntityDisplay $display) {
    $content = field_attach_view($entity, $display);
    $this->content = drupal_render($content);
    return $this->content;
  }

  /**
   * Formats an assertion message string.
   *
   * Unlike format_string(),
   * - all replacement tokens are exported via var_export() and sanitized for
   *   output, regardless of token type used (i.e., '@', '!', and '%' do not
   *   have any special meaning).
   * - Replacement token values containing newlines are automatically wrapped
   *   into a PRE element to aid in debugging test failures.
   *
   * @param string $message
   *   The assertion message string containing placeholders.
   * @param array $args
   *   An array of replacement token values to inject into $message.
   *
   * @return string
   *   The $message with exported replacement tokens, sanitized for HTML output.
   *
   * @see check_plain()
   * @see format_string()
   */
  protected function formatString($message, array $args) {
    array_walk($args, function (&$value) {
      // Export/dump the raw replacement token value.
      $value = var_export($value, TRUE);
      // Sanitize the value for output.
      $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
      // Wrap the value in a PRE element if it contains newlines.
      if (strpos($value, "\n")) {
        $value = '
' . $value . '
';
      }
    });
    return strtr($message, $args);
  }

  /**
   * Gets the plain-text version of $this->content.
   *
   * @param string $content
   *   A (HTML) string.
   *
   * @return string
   *   The $content with all HTML tags stripped and all HTML entities replaced
   *   with their actual characters.
   */
  protected function getPlainTextContent($content) {
    // Strip all HTML tags.
    $content = strip_tags($content);
    // Decode all HTML entities (e.g., ' ') into characters.
    $content = html_entity_decode($content, ENT_QUOTES, 'UTF-8');
    return $content;
  }

  /**
   * Asserts that a raw string appears in $this->content.
   *
   * @param string $value
   *   The raw string to look for.
   * @param string $message
   *   (optional) An assertion message. If omitted, a default message is used.
   *   Available placeholders:
   *   - @value: The $value.
   *   - @content: The current value of $this->content.
   * @param array $args
   *   (optional) Additional replacement token map to pass to formatString().
   *
   * @return bool
   *   TRUE on pass, FALSE on fail.
   */
  protected function assertRaw($value, $message = NULL, $args = array()) {
    if (!isset($message)) {
      $message = 'Raw string @value found in @content';
    }
    $args += array(
      '@value' => $value,
      '@content' => $this->content,
    );
    return $this->assert(strpos($this->content, $value) !== FALSE, $this->formatString($message, $args));
  }

  /**
   * Asserts that a raw string does not appear in $this->content.
   *
   * @param string $value
   *   The raw string to look for.
   * @param string $message
   *   (optional) An assertion message. If omitted, a default message is used.
   *   Available placeholders:
   *   - @value: The $value.
   *   - @content: The current value of $this->content.
   * @param array $args
   *   (optional) Additional replacement token map to pass to formatString().
   *
   * @return bool
   *   TRUE on pass, FALSE on fail.
   */
  protected function assertNoRaw($value, $message = NULL, $args = array()) {
    if (!isset($message)) {
      $message = 'Raw string @value not found in @content';
    }
    $args += array(
      '@value' => $value,
      '@content' => $this->content,
    );
    return $this->assert(strpos($this->content, $value) === FALSE, $this->formatString($message, $args));
  }

  /**
   * Asserts that a text string appears in the text-only version of $this->content.
   *
   * @param string $value
   *   The text string to look for.
   * @param string $message
   *   (optional) An assertion message. If omitted, a default message is used.
   *   Available placeholders:
   *   - @value: The $value.
   *   - @content: The current value of $this->content.
   * @param array $args
   *   (optional) Additional replacement token map to pass to formatString().
   *
   * @return bool
   *   TRUE on pass, FALSE on fail.
   */
  protected function assertText($value, $message = NULL, $args = array()) {
    if (!isset($message)) {
      $message = 'Text string @value found in @content';
    }
    $content = $this->getPlainTextContent($this->content);
    $args += array(
      '@value' => $value,
      '@content' => $content,
    );
    return $this->assert(strpos($content, $value) !== FALSE, $this->formatString($message, $args));
  }

  /**
   * Asserts that a text string does not appear in the text-only version of $this->content.
   *
   * @param string $value
   *   The text string to look for.
   * @param string $message
   *   (optional) An assertion message. If omitted, a default message is used.
   *   Available placeholders:
   *   - @value: The $value.
   *   - @content: The current value of $this->content.
   * @param array $args
   *   (optional) Additional replacement token map to pass to formatString().
   *
   * @return bool
   *   TRUE on pass, FALSE on fail.
   */
  protected function assertNoText($value, $message = NULL, $args = array()) {
    if (!isset($message)) {
      $message = 'Text string @value not found in @content';
    }
    $content = $this->getPlainTextContent($this->content);
    $args += array(
      '@value' => $value,
      '@content' => $content,
    );
    return $this->assert(strpos($content, $value) === FALSE, $this->formatString($message, $args));
  }

  /**
   * Tests text_plain formatter output.
   */
  function testPlainText() {
    $value = $this->randomString();
    $value .= "\n\n" . $this->randomString() . '';
    $value .= "\n\n" . $this->randomString();

    $entity = $this->createEntity(array());
    $entity->{$this->field_name}->value = $value;

    // Verify that all HTML is escaped and newlines are retained.
    $this->renderEntityFields($entity, $this->display);
    $this->assertText($value);
    $this->assertNoRaw($value);
    $this->assertRaw(nl2br(check_plain($value)));
  }

}


text:
[![CI Status](http://img.shields.io/travis/detroit-labs/DLVersion.svg?style=flat)](https://travis-ci.org/detroit-labs/DLVersion)
[![Version](https://img.shields.io/cocoapods/v/DLVersion.svg?style=flat)](http://cocoadocs.org/docsets/DLVersion)
[![License](https://img.shields.io/cocoapods/l/DLVersion.svg?style=flat)](http://cocoadocs.org/docsets/DLVersion)
[![Platform](https://img.shields.io/cocoapods/p/DLVersion.svg?style=flat)](http://cocoadocs.org/docsets/DLVersion)

DLVersions is a model for working with Cocoa and Cocoa Touch app versions.

## Usage

To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Installation

DLVersion is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```rb
pod "DLVersion"
```

## Author

Nate West, nwest@detroitlabs.com

## License

DLVersion is available under the MIT license. See the LICENSE file for more info.


text:
package adawg.minecraftbot

import com.kunii.mcbot.bots.CoreBot
import adawg.minecraftbot.behaviortree.gui.BehaviorTreeWindow
import adawg.minecraftbot.behaviortree.Node
import adawg.minecraftbot.behaviortree.InputState
import adawg.minecraftbot.behaviortree.behaviors.FollowPath

abstract class BTBot extends CoreBot {
  def mkRootNode: Node

  lazy val rootNode = mkRootNode
  lazy val gui = new BehaviorTreeWindow()
  var running: Boolean = false
  def inGameLoop(x: net.minecraft.client.Minecraft): Int = {

    val (status, controlInput) = rootNode.update2()
    InputState.sendInput(controlInput)
    0
  }

  def inGameRenderer(x: net.minecraft.client.gui.FontRenderer): Unit = {}
  def init(): Unit = {}
  def locksMinecraft(): Boolean = false

  import scala.swing.Swing
  def onStart(): Unit = {
    println("BTBot: Initializing behavior tree")
    Swing.onEDT {
      for (node <- rootNode) {
        println("adding guicomponent of " + node)
        gui.addComponent(node)
        gui.visible = true
      }
    }
    FollowPath.resetPathfinder()
  }
  def onStop(): Unit = {
    Swing.onEDT {gui.visible = false}
  }
}


text:
package com.intellij.lang.properties.editor;

import com.intellij.ide.structureView.newStructureView.StructureViewComponent;
import com.intellij.lang.properties.PropertiesBundle;
import com.intellij.lang.properties.structureView.GroupByWordPrefixes;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.util.ArrayUtilRt;
import com.intellij.util.ui.EmptyIcon;
import org.jetbrains.annotations.NotNull;

import java.util.LinkedHashSet;
import java.util.Set;

public class PropertiesGroupingStructureViewComponent extends StructureViewComponent {

  protected PropertiesGroupingStructureViewComponent(Project project,
                                                  FileEditor editor,
                                                  PropertiesGroupingStructureViewModel structureViewModel) {
    super(editor, structureViewModel, project, true);
  }

  @Override
  public void setActionActive(String name, boolean state) {
    if (GroupByWordPrefixes.ID.equals(name)) {
      ((PropertiesGroupingStructureViewModel)getTreeModel()).setGroupingActive(state);
    }
    super.setActionActive(name, state);
  }

  @Override
  protected void addGroupByActions(@NotNull DefaultActionGroup result) {
    super.addGroupByActions(result);
    result.add(new ChangeGroupSeparatorAction());
  }

  private class ChangeGroupSeparatorAction extends DefaultActionGroup {
    private final Set<String> myPredefinedSeparators = new LinkedHashSet<>();

    ChangeGroupSeparatorAction() {
      super(PropertiesBundle.message("group.by.title"), true);
      myPredefinedSeparators.add(".");
      myPredefinedSeparators.add("_");
      myPredefinedSeparators.add("/");
      myPredefinedSeparators.add(getCurrentSeparator());
      refillActionGroup();
    }

    @Override
    public @NotNull ActionUpdateThread getActionUpdateThread() {
      return ActionUpdateThread.BGT;
    }

    @Override
    public final void update(@NotNull AnActionEvent e) {
      String separator = getCurrentSeparator();
      Presentation presentation = e.getPresentation();
      presentation.setText(PropertiesBundle.message("group.by.0", separator), false);
      presentation.setIcon(EmptyIcon.ICON_16);
    }

    private @NlsSafe String getCurrentSeparator() {
      return ((PropertiesGroupingStructureViewModel)getTreeModel()).getSeparator();
    }

    private void refillActionGroup() {
      removeAll();
      for (final @NlsSafe String separator : myPredefinedSeparators) {
        if (separator.equals(getCurrentSeparator())) continue;
        AnAction action = new AnAction() {
          @Override
          public void actionPerformed(@NotNull AnActionEvent e) {
            ((PropertiesGroupingStructureViewModel)getTreeModel()).setSeparator(separator);
            setActionActive(GroupByWordPrefixes.ID, true);
            refillActionGroup();
            rebuild();
          }
        };
        action.getTemplatePresentation().setText(separator, false);
        add(action);
      }
      add(new SelectSeparatorAction());
    }

    private final class SelectSeparatorAction extends AnAction {

      SelectSeparatorAction() {
        super(PropertiesBundle.messagePointer("select.separator.action.with.empty.separator.name"));
      }

      @Override
      public void actionPerformed(@NotNull AnActionEvent e) {
        String[] strings = ArrayUtilRt.toStringArray(myPredefinedSeparators);
        String current = getCurrentSeparator();
        String separator = Messages.showEditableChooseDialog(PropertiesBundle.message("select.property.separator.dialog.text"),
                                                             PropertiesBundle.message("select.property.separator.dialog.title"),
                                                             Messages.getQuestionIcon(),
                                                             strings, current, null);
        if (separator == null) {
          return;
        }
        myPredefinedSeparators.add(separator);
        refillActionGroup();
      }
    }
  }
}


text:
init:
	sqlite3 hometic.db < scripts/init.sql


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Test.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Editing
{
    [UseExportProvider]
    public class SyntaxEditorTests
    {
        private Workspace _emptyWorkspace;

        private Workspace EmptyWorkspace
            => _emptyWorkspace ??= new AdhocWorkspace();

        private void VerifySyntax<TSyntax>(SyntaxNode node, string expectedText) where TSyntax : SyntaxNode
        {
            Assert.IsAssignableFrom<TSyntax>(node);
            var formatted = Formatter.Format(node, EmptyWorkspace);
            var actualText = formatted.ToFullString();
            Assert.Equal(expectedText, actualText);
        }

        private SyntaxEditor GetEditor(SyntaxNode root)
            => new SyntaxEditor(root, EmptyWorkspace.Services);

        [Fact]
        public void TestReplaceNode()
        {
            var code = @"
public class C
{
    public int X;
}";

            var cu = SyntaxFactory.ParseCompilationUnit(code);
            var cls = cu.Members[0];

            var editor = GetEditor(cu);
            var fieldX = editor.Generator.GetMembers(cls)[0];
            editor.ReplaceNode(fieldX, editor.Generator.FieldDeclaration("Y", editor.Generator.TypeExpression(SpecialType.System_String), Accessibility.Public));
            var newRoot = editor.GetChangedRoot();

            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public string Y;
}");
        }

        [Fact]
        public void TestRemoveNode()
        {
            var code = @"
public class C
{
    public int X;
}";

            var cu = SyntaxFactory.ParseCompilationUnit(code);
            var cls = cu.Members[0];

            var editor = GetEditor(cu);
            var fieldX = editor.Generator.GetMembers(cls)[0];
            editor.RemoveNode(fieldX);
            var newRoot = editor.GetChangedRoot();

            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
}");
        }

        [Fact]
        public void TestInsertAfter()
        {
            var code = @"
public class C
{
    public int X;
}";

            var cu = SyntaxFactory.ParseCompilationUnit(code);
            var cls = cu.Members[0];

            var editor = GetEditor(cu);
            var fieldX = editor.Generator.GetMembers(cls)[0];
            editor.InsertAfter(fieldX, editor.Generator.FieldDeclaration("Y", editor.Generator.TypeExpression(SpecialType.System_String), Accessibility.Public));
            var newRoot = editor.GetChangedRoot();

            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public int X;
    public string Y;
}");
        }

        [Fact]
        public void TestInsertBefore()
        {
            var code = @"
public class C
{
    public int X;
}";

            var cu = SyntaxFactory.ParseCompilationUnit(code);
            var cls = cu.Members[0];

            var editor = GetEditor(cu);
            var fieldX = editor.Generator.GetMembers(cls)[0];
            editor.InsertBefore(fieldX, editor.Generator.FieldDeclaration("Y", editor.Generator.TypeExpression(SpecialType.System_String), Accessibility.Public));
            var newRoot = editor.GetChangedRoot();

            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public string Y;
    public int X;
}");
        }

        [Fact]
        public void TestReplaceWithTracking()
        {
            // ReplaceNode overload #1
            TestReplaceWithTrackingCore((SyntaxNode node, SyntaxNode newNode, SyntaxEditor editor) =>
            {
                editor.ReplaceNode(node, newNode);
            });

            // ReplaceNode overload #2
            TestReplaceWithTrackingCore((SyntaxNode node, SyntaxNode newNode, SyntaxEditor editor) =>
            {
                editor.ReplaceNode(node, computeReplacement: (originalNode, generator) => newNode);
            });

            // ReplaceNode overload #3
            TestReplaceWithTrackingCore((SyntaxNode node, SyntaxNode newNode, SyntaxEditor editor) =>
            {
                editor.ReplaceNode(node,
                     computeReplacement: (originalNode, generator, argument) => newNode,
                     argument: (object)null);
            });
        }

        private void TestReplaceWithTrackingCore(Action<SyntaxNode, SyntaxNode, SyntaxEditor> replaceNodeWithTracking)
        {
            var code = @"
public class C
{
    public int X;
}";

            var cu = SyntaxFactory.ParseCompilationUnit(code);
            var cls = cu.Members[0];

            var editor = GetEditor(cu);
            var fieldX = editor.Generator.GetMembers(cls)[0];
            var newFieldY = editor.Generator.FieldDeclaration("Y", editor.Generator.TypeExpression(SpecialType.System_String), Accessibility.Public);
            replaceNodeWithTracking(fieldX, newFieldY, editor);

            var newRoot = editor.GetChangedRoot();
            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public string Y;
}");
            var newFieldYType = newFieldY.DescendantNodes().Single(n => n.ToString() == "string");
            var newType = editor.Generator.TypeExpression(SpecialType.System_Char);
            replaceNodeWithTracking(newFieldYType, newType, editor);

            newRoot = editor.GetChangedRoot();
            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public char Y;
}");

            editor.RemoveNode(newFieldY);

            newRoot = editor.GetChangedRoot();
            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
}");
        }

        [Fact]
        public void TestReplaceWithTracking_02()
        {
            var code = @"
public class C
{
    public int X;
    public string X2;
    public char X3;
}";

            var cu = SyntaxFactory.ParseCompilationUnit(code);

            var editor = GetEditor(cu);

            var cls = cu.Members[0];
            var fieldX = editor.Generator.GetMembers(cls)[0];
            var fieldX2 = editor.Generator.GetMembers(cls)[1];
            var fieldX3 = editor.Generator.GetMembers(cls)[2];

            var newFieldY = editor.Generator.FieldDeclaration("Y", editor.Generator.TypeExpression(SpecialType.System_String), Accessibility.Public);
            editor.ReplaceNode(fieldX, newFieldY);

            var newRoot = editor.GetChangedRoot();
            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public string Y;
    public string X2;
    public char X3;
}");
            var newFieldYType = newFieldY.DescendantNodes().Single(n => n.ToString() == "string");
            var newType = editor.Generator.TypeExpression(SpecialType.System_Char);
            editor.ReplaceNode(newFieldYType, newType);

            newRoot = editor.GetChangedRoot();
            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public char Y;
    public string X2;
    public char X3;
}");

            var newFieldY2 = editor.Generator.FieldDeclaration("Y2", editor.Generator.TypeExpression(SpecialType.System_Boolean), Accessibility.Private);
            editor.ReplaceNode(fieldX2, newFieldY2);

            newRoot = editor.GetChangedRoot();
            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public char Y;
    private bool Y2;
    public char X3;
}");

            var newFieldZ = editor.Generator.FieldDeclaration("Z", editor.Generator.TypeExpression(SpecialType.System_Boolean), Accessibility.Public);
            editor.ReplaceNode(newFieldY, newFieldZ);

            newRoot = editor.GetChangedRoot();
            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public bool Z;
    private bool Y2;
    public char X3;
}");

            var originalFieldX3Type = fieldX3.DescendantNodes().Single(n => n.ToString() == "char");
            newType = editor.Generator.TypeExpression(SpecialType.System_Boolean);
            editor.ReplaceNode(originalFieldX3Type, newType);

            newRoot = editor.GetChangedRoot();
            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public bool Z;
    private bool Y2;
    public bool X3;
}");

            editor.RemoveNode(newFieldY2);
            editor.RemoveNode(fieldX3);

            newRoot = editor.GetChangedRoot();
            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public bool Z;
}");
        }

        [Fact]
        public void TestInsertAfterWithTracking()
        {
            // InsertAfter overload #1
            TestInsertAfterWithTrackingCore((SyntaxNode node, SyntaxNode newNode, SyntaxEditor editor) =>
            {
                editor.InsertAfter(node, newNode);
            });

            // InsertAfter overload #2
            TestInsertAfterWithTrackingCore((SyntaxNode node, SyntaxNode newNode, SyntaxEditor editor) =>
            {
                editor.InsertAfter(node, new[] { newNode });
            });
        }

        private void TestInsertAfterWithTrackingCore(Action<SyntaxNode, SyntaxNode, SyntaxEditor> insertAfterWithTracking)
        {
            var code = @"
public class C
{
    public int X;
}";

            var cu = SyntaxFactory.ParseCompilationUnit(code);
            var cls = cu.Members[0];

            var editor = GetEditor(cu);
            var fieldX = editor.Generator.GetMembers(cls)[0];
            var newFieldY = editor.Generator.FieldDeclaration("Y", editor.Generator.TypeExpression(SpecialType.System_String), Accessibility.Public);
            insertAfterWithTracking(fieldX, newFieldY, editor);

            var newRoot = editor.GetChangedRoot();
            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public int X;
    public string Y;
}");

            var newFieldZ = editor.Generator.FieldDeclaration("Z", editor.Generator.TypeExpression(SpecialType.System_String), Accessibility.Public);
            editor.ReplaceNode(newFieldY, newFieldZ);

            newRoot = editor.GetChangedRoot();
            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public int X;
    public string Z;
}");
        }

        [Fact]
        public void TestInsertBeforeWithTracking()
        {
            // InsertBefore overload #1
            TestInsertBeforeWithTrackingCore((SyntaxNode node, SyntaxNode newNode, SyntaxEditor editor) =>
            {
                editor.InsertBefore(node, newNode);
            });

            // InsertBefore overload #2
            TestInsertBeforeWithTrackingCore((SyntaxNode node, SyntaxNode newNode, SyntaxEditor editor) =>
            {
                editor.InsertBefore(node, new[] { newNode });
            });
        }

        private void TestInsertBeforeWithTrackingCore(Action<SyntaxNode, SyntaxNode, SyntaxEditor> insertBeforeWithTracking)
        {
            var code = @"
public class C
{
    public int X;
}";

            var cu = SyntaxFactory.ParseCompilationUnit(code);
            var cls = cu.Members[0];

            var editor = GetEditor(cu);
            var fieldX = editor.Generator.GetMembers(cls)[0];
            var newFieldY = editor.Generator.FieldDeclaration("Y", editor.Generator.TypeExpression(SpecialType.System_String), Accessibility.Public);
            insertBeforeWithTracking(fieldX, newFieldY, editor);

            var newRoot = editor.GetChangedRoot();
            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public string Y;
    public int X;
}");

            var newFieldZ = editor.Generator.FieldDeclaration("Z", editor.Generator.TypeExpression(SpecialType.System_String), Accessibility.Public);
            editor.ReplaceNode(newFieldY, newFieldZ);

            newRoot = editor.GetChangedRoot();
            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public string Z;
    public int X;
}");
        }

        [Fact]
        public void TestTrackNode()
        {
            var code = @"
public class C
{
    public int X;
}";

            var cu = SyntaxFactory.ParseCompilationUnit(code);
            var cls = cu.Members[0];

            var editor = GetEditor(cu);
            var fieldX = editor.Generator.GetMembers(cls)[0];
            editor.TrackNode(fieldX);
            var newRoot = editor.GetChangedRoot();

            var currentFieldX = newRoot.GetCurrentNode(fieldX);
            Assert.NotNull(currentFieldX);
        }

        [Fact]
        public void TestMultipleEdits()
        {
            var code = @"
public class C
{
    public int X;
}";

            var cu = SyntaxFactory.ParseCompilationUnit(code);
            var cls = cu.Members[0];

            var editor = GetEditor(cu);
            var fieldX = editor.Generator.GetMembers(cls)[0];
            editor.InsertAfter(fieldX, editor.Generator.FieldDeclaration("Y", editor.Generator.TypeExpression(SpecialType.System_String), Accessibility.Public));
            editor.InsertBefore(fieldX, editor.Generator.FieldDeclaration("Z", editor.Generator.TypeExpression(SpecialType.System_Object), Accessibility.Public));
            editor.RemoveNode(fieldX);
            var newRoot = editor.GetChangedRoot();

            VerifySyntax<CompilationUnitSyntax>(
                newRoot,
                @"
public class C
{
    public object Z;
    public string Y;
}");
        }
    }
}


text:
//---------------------------------------------------------------------
// <copyright file="MetadataProviderEdmCollectionType.cs" company="Microsoft">
//      Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
// </copyright>
//---------------------------------------------------------------------

namespace Microsoft.OData.Service.Providers
{
    using System.Diagnostics;
    using Microsoft.OData.Edm;
    using Microsoft.OData.Edm.Library;

    /// <summary>
    /// Implementation of <see cref="IEdmCollectionType"/> based on a <see cref="ResourceType"/>.
    /// </summary>
    internal class MetadataProviderEdmCollectionType : EdmCollectionType, IResourceTypeBasedEdmType
    {
        /// <summary>
        /// Initializes a new instance of <see cref="MetadataProviderEdmCollectionType"/>.
        /// </summary>
        /// <param name="collectionResourceType">The collection resource type this edm collection type is being created for.</param>
        /// <param name="elementType">The element type of the collection.</param>
        public MetadataProviderEdmCollectionType(ResourceType collectionResourceType, IEdmTypeReference elementType)
            : base(elementType)
        {
            Debug.Assert(collectionResourceType != null, "collectionResourceType != null");
            Debug.Assert(collectionResourceType is CollectionResourceType || collectionResourceType is EntityCollectionResourceType, "resource type must represent a collection.");

            this.ResourceType = collectionResourceType;
        }

        /// <summary>
        /// The resource-type that this type was created from.
        /// </summary>
        public ResourceType ResourceType { get; private set; }
    }
}


text:
/**
 * @author Arnold Koh <arnold@kohded.com>
 * Developed: 3/18/2017
 * File: linked-list-test.js
 */

const expect = require('chai').expect;
const LinkedList = require('../../../data-structures/linked-lists/linked-list.js');

describe('LinkedList', () => {
  let linkedList;

  beforeEach(() => {
    linkedList = new LinkedList();
    linkedList.append(1);
    linkedList.append(2);
    linkedList.append(3);
  });

  describe('#add(element, index)', () => {
    it('should return true if element is added', () => {
      expect(linkedList.add(4, 1)).to.be.true;
    });
    it('should return undefined if element is undefined', () => {
      expect(linkedList.add(undefined, 1)).to.be.undefined;
    });
    it('should return undefined if index is undefined', () => {
      expect(linkedList.add(5, undefined)).to.be.undefined;
    });
    it('should return undefined if index is less than 0', () => {
      expect(linkedList.add(5, -1)).to.be.undefined;
    });
    it('should return undefined if index is greater than length', () => {
      expect(linkedList.add(5, 100)).to.be.undefined;
    });
  });

  describe('#append(element)', () => {
    it('should return true if element is appended', () => {
      expect(linkedList.append(4)).to.be.true;
    });
    it('should return undefined if element is undefined', () => {
      expect(linkedList.append()).to.be.undefined;
    });
  });

  describe('#indexOf(element)', () => {
    it('should return index of the element', () => {
      expect(linkedList.indexOf(1)).to.equal(0);
      expect(linkedList.indexOf(2)).to.equal(1);
      expect(linkedList.indexOf(3)).to.equal(2);
    });
    it('should return -1 if element is not found', () => {
      expect(linkedList.indexOf(4)).to.equal(-1);
    });
    it('should return -1 if element is undefined', () => {
      expect(linkedList.indexOf()).to.equal(-1);
    });
  });

  describe('#isEmpty()', () => {
    it('should return true if list is empty', () => {
      linkedList.remove(1);
      linkedList.remove(2);
      linkedList.remove(3);
      expect(linkedList.isEmpty()).to.be.true;
    });
    it('should return false if list is not empty', () => {
      expect(linkedList.isEmpty()).to.be.false;
    });
  });

  describe('#peek()', () => {
    it('should return head element', () => {
      expect(linkedList.peek()).to.equal(1);
    });
    it('should return undefined if head is undefined', () => {
      linkedList.remove(1);
      linkedList.remove(2);
      linkedList.remove(3);
      expect(linkedList.peek()).to.be.undefined;
    });
  });

  describe('#remove(element)', () => {
    it('should return element that is removed', () => {
      expect(linkedList.remove(2)).to.equal(2);
    });
    it('should return undefined if element is undefined', () => {
      expect(linkedList.remove()).to.be.undefined;
    });
  });

  describe('#removeAt(index)', () => {
    it('should return element that is removed', () => {
      expect(linkedList.removeAt(1)).to.equal(2);
    });
    it('should return undefined if index is undefined', () => {
      expect(linkedList.removeAt()).to.be.undefined;
    });
    it('should return undefined if index is less than 0', () => {
      expect(linkedList.removeAt(-1)).to.be.undefined;
    });
    it('should return undefined if index is greater than length', () => {
      expect(linkedList.removeAt(100)).to.be.undefined;
    });
  });

  describe('#size()', () => {
    it('should return size of list', () => {
      expect(linkedList.size()).to.equal(3);
    });
  });

  describe('#toString()', () => {
    it('should return list as a string', () => {
      expect(linkedList.toString()).to.equal('1, 2, 3');
    });
  });
});


text:
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        Toggle navigation

                    </button>

                        <img src="<?php echo URL_IMG?>/logo-salam.inc.png" width="130" height="73" alt="Logo Salam Inc." class="img-responsive">

Sign In


text:
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using AutoMapper;
using Microsoft.Azure.Commands.Network.Models;
using Microsoft.Azure.Commands.Tags.Model;
using Microsoft.Azure.Management.Network;
using System.Collections;
using System.Management.Automation;
using MNM = Microsoft.Azure.Management.Network.Models;

namespace Microsoft.Azure.Commands.Network
{
    [Cmdlet(VerbsCommon.New, "AzureRmPublicIpAddress"), OutputType(typeof(PSPublicIpAddress))]
    public class NewAzurePublicIpAddressCommand : PublicIpAddressBaseCmdlet
    {
        [Alias("ResourceName")]
        [Parameter(
            Mandatory = false,
            ValueFromPipelineByPropertyName = true,
            HelpMessage = "The resource name.")]
        [ValidateNotNullOrEmpty]
        public virtual string Name { get; set; }

        [Parameter(
            Mandatory = true,
            ValueFromPipelineByPropertyName = true,
            HelpMessage = "The resource group name.")]
        [ValidateNotNullOrEmpty]
        public virtual string ResourceGroupName { get; set; }

        [Parameter(
            Mandatory = false,
            ValueFromPipelineByPropertyName = true,
            HelpMessage = "The public IP address location.")]
        [ValidateNotNullOrEmpty]
        public string Location { get; set; }

        [Parameter(
            Mandatory = true,
            ValueFromPipelineByPropertyName = true,
            HelpMessage = "The public IP address allocation method.")]
        [ValidateNotNullOrEmpty]
        [ValidateSet(
            MNM.IPAllocationMethod.Dynamic,
            MNM.IPAllocationMethod.Static,
            IgnoreCase = true)]
        public string AllocationMethod { get; set; }

        [Parameter(
            Mandatory = false,
            ValueFromPipelineByPropertyName = true,
            HelpMessage = "The public IP address version.")]
        [ValidateNotNullOrEmpty]
        [ValidateSet(
            MNM.IPVersion.IPv4,
            MNM.IPVersion.IPv6,
            IgnoreCase = true)]
        public string IpAddressVersion { get; set; }

        [Parameter(
            Mandatory = false,
            ValueFromPipelineByPropertyName = true,
            HelpMessage = "The Domain Name label.")]
        public string DomainNameLabel { get; set; }

        [Parameter(
            Mandatory = false,
            ValueFromPipelineByPropertyName = true,
            HelpMessage = "The Reverse FQDN.")]
        public string ReverseFqdn { get; set; }

        [Parameter(
            Mandatory = false,
            ValueFromPipelineByPropertyName = true,
            HelpMessage = "IdleTimeoutInMinutes")]
        public int IdleTimeoutInMinutes { get; set; }

        [Parameter(
            Mandatory = false,
            ValueFromPipelineByPropertyName = true,
            HelpMessage = "An array of hashtables which represents resource tags.")]
        public Hashtable[] Tag { get; set; }

        [Parameter(
            Mandatory = false,
            HelpMessage = "Do not ask for confirmation if you want to overrite a resource")]
        public SwitchParameter Force { get; set; }

        public override void Execute()
        {

            base.Execute();
            WriteWarning("The output object type of this cmdlet will be modified in a future release. Also, the usability of Tag parameter in this cmdlet will be modified in a future release. This will impact creating, updating and appending tags for Azure resources. For more details about the change, please visit https://github.com/Azure/azure-powershell/issues/726#issuecomment-213545494");

            if (this.IsPublicIpAddressPresent(this.ResourceGroupName, this.Name))
            {
                ConfirmAction(
                    Force.IsPresent,
                    string.Format(Microsoft.Azure.Commands.Network.Properties.Resources.OverwritingResource, Name),
                    Microsoft.Azure.Commands.Network.Properties.Resources.OverwritingResourceMessage,
                    Name,
                    () => CreatePublicIpAddress());

                WriteObject(this.GetPublicIpAddress(this.ResourceGroupName, this.Name));
            }
            else
            {
                var publicIp = CreatePublicIpAddress();

                WriteObject(publicIp);
            }
        }

        private PSPublicIpAddress CreatePublicIpAddress()
        {
            var publicIp = new PSPublicIpAddress();
            publicIp.Name = this.Name;
            publicIp.Location = this.Location;
            publicIp.PublicIpAllocationMethod = this.AllocationMethod;
            publicIp.PublicIpAddressVersion = this.IpAddressVersion;

            if (this.IdleTimeoutInMinutes > 0)
            {
                publicIp.IdleTimeoutInMinutes = this.IdleTimeoutInMinutes;
            }

            if (!string.IsNullOrEmpty(this.DomainNameLabel))
            {
                publicIp.DnsSettings = new PSPublicIpAddressDnsSettings();
                publicIp.DnsSettings.DomainNameLabel = this.DomainNameLabel;
                publicIp.DnsSettings.ReverseFqdn = this.ReverseFqdn;
            }

            var publicIpModel = Mapper.Map<MNM.PublicIPAddress>(publicIp);

            publicIpModel.Tags = TagsConversionHelper.CreateTagDictionary(this.Tag, validate: true);

            this.PublicIpAddressClient.CreateOrUpdate(this.ResourceGroupName, this.Name, publicIpModel);

            var getPublicIp = this.GetPublicIpAddress(this.ResourceGroupName, this.Name);

            return getPublicIp;
        }
    }
}