text:
using System;
using System.Linq;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.TestHelpers.Entities;

namespace Umbraco.Tests.Services
{
    [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)]
    [TestFixture, RequiresSTA]
    public class MemberTypeServiceTests : BaseServiceTest
    {
        [SetUp]
        public override void Initialize()
        {
            base.Initialize();
        }

        [TearDown]
        public override void TearDown()
        {
            base.TearDown();
        }

        [Test]
        public void Member_Cannot_Edit_Property()
        {
            IMemberType memberType = MockedContentTypes.CreateSimpleMemberType();
            ServiceContext.MemberTypeService.Save(memberType);
            //re-get
            memberType = ServiceContext.MemberTypeService.Get(memberType.Id);
            foreach (var p in memberType.PropertyTypes)
            {
                Assert.IsFalse(memberType.MemberCanEditProperty(p.Alias));
            }
        }

        [Test]
        public void Member_Can_Edit_Property()
        {
            IMemberType memberType = MockedContentTypes.CreateSimpleMemberType();
            ServiceContext.MemberTypeService.Save(memberType);
            var prop = memberType.PropertyTypes.First().Alias;
            memberType.SetMemberCanEditProperty(prop, true);
            ServiceContext.MemberTypeService.Save(memberType);
            //re-get
            memberType = ServiceContext.MemberTypeService.Get(memberType.Id);
            foreach (var p in memberType.PropertyTypes.Where(x => x.Alias != prop))
            {
                Assert.IsFalse(memberType.MemberCanEditProperty(p.Alias));
            }
            Assert.IsTrue(memberType.MemberCanEditProperty(prop));
        }

        [Test]
        public void Member_Cannot_View_Property()
        {
            IMemberType memberType = MockedContentTypes.CreateSimpleMemberType();
            ServiceContext.MemberTypeService.Save(memberType);
            //re-get
            memberType = ServiceContext.MemberTypeService.Get(memberType.Id);
            foreach (var p in memberType.PropertyTypes)
            {
                Assert.IsFalse(memberType.MemberCanViewProperty(p.Alias));
            }
        }

        [Test]
        public void Member_Can_View_Property()
        {
            IMemberType memberType = MockedContentTypes.CreateSimpleMemberType();
            ServiceContext.MemberTypeService.Save(memberType);
            var prop = memberType.PropertyTypes.First().Alias;
            memberType.SetMemberCanViewProperty(prop, true);
            ServiceContext.MemberTypeService.Save(memberType);
            //re-get
            memberType = ServiceContext.MemberTypeService.Get(memberType.Id);
            foreach (var p in memberType.PropertyTypes.Where(x => x.Alias != prop))
            {
                Assert.IsFalse(memberType.MemberCanViewProperty(p.Alias));
            }
            Assert.IsTrue(memberType.MemberCanViewProperty(prop));
        }

        [Test]
        public void Deleting_PropertyType_Removes_The_Property_From_Member()
        {
            IMemberType memberType = MockedContentTypes.CreateSimpleMemberType();
            ServiceContext.MemberTypeService.Save(memberType);
            IMember member = MockedMember.CreateSimpleMember(memberType, "test", "test@test.com", "pass", "test");
            ServiceContext.MemberService.Save(member);
            var initProps = member.Properties.Count;
            var initPropTypes = member.PropertyTypes.Count();

            //remove a property (NOT ONE OF THE DEFAULTS)
            var standardProps = Constants.Conventions.Member.GetStandardPropertyTypeStubs();
            memberType.RemovePropertyType(memberType.PropertyTypes.First(x => standardProps.ContainsKey(x.Alias) == false).Alias);
            ServiceContext.MemberTypeService.Save(memberType);

            //re-load it from the db
            member = ServiceContext.MemberService.GetById(member.Id);

            Assert.AreEqual(initPropTypes - 1, member.PropertyTypes.Count());
            Assert.AreEqual(initProps - 1, member.Properties.Count);
        }

        [Test]
        public void Rebuild_Member_Xml_On_Alias_Change()
        {
            var contentType1 = MockedContentTypes.CreateSimpleMemberType("test1", "Test1");
            var contentType2 = MockedContentTypes.CreateSimpleMemberType("test2", "Test2");
            ServiceContext.MemberTypeService.Save(contentType1);
            ServiceContext.MemberTypeService.Save(contentType2);
            var contentItems1 = MockedMember.CreateSimpleMember(contentType1, 10).ToArray();
            contentItems1.ForEach(x => ServiceContext.MemberService.Save(x));
            var contentItems2 = MockedMember.CreateSimpleMember(contentType2, 5).ToArray();
            contentItems2.ForEach(x => ServiceContext.MemberService.Save(x));
            //only update the contentType1 alias which will force an xml rebuild for all content of that type
            contentType1.Alias = "newAlias";
            ServiceContext.MemberTypeService.Save(contentType1);

            foreach (var c in contentItems1)
            {
                var xml = DatabaseContext.Database.FirstOrDefault<ContentXmlDto>("WHERE nodeId = @Id", new { Id = c.Id });
                Assert.IsNotNull(xml);
                Assert.IsTrue(xml.Xml.StartsWith("<newAlias"));
            }
            foreach (var c in contentItems2)
            {
                var xml = DatabaseContext.Database.FirstOrDefault<ContentXmlDto>("WHERE nodeId = @Id", new { Id = c.Id });
                Assert.IsNotNull(xml);
                Assert.IsTrue(xml.Xml.StartsWith("<test2")); //should remain the same
            }
        }

        [Test]
        public void Rebuild_Member_Xml_On_Property_Removal()
        {
            var standardProps = Constants.Conventions.Member.GetStandardPropertyTypeStubs();

            var contentType1 = MockedContentTypes.CreateSimpleMemberType("test1", "Test1");
            ServiceContext.MemberTypeService.Save(contentType1);
            var contentItems1 = MockedMember.CreateSimpleMember(contentType1, 10).ToArray();
            contentItems1.ForEach(x => ServiceContext.MemberService.Save(x));

            var alias = contentType1.PropertyTypes.First(x => standardProps.ContainsKey(x.Alias) == false).Alias;
            var elementToMatch = "<" + alias + ">";

            foreach (var c in contentItems1)
            {
                var xml = DatabaseContext.Database.FirstOrDefault<ContentXmlDto>("WHERE nodeId = @Id", new { Id = c.Id });
                Assert.IsNotNull(xml);
                Assert.IsTrue(xml.Xml.Contains(elementToMatch)); //verify that it is there before we remove the property
            }

            //remove a property (NOT ONE OF THE DEFAULTS)
            contentType1.RemovePropertyType(alias);
            ServiceContext.MemberTypeService.Save(contentType1);

            var reQueried = ServiceContext.MemberTypeService.Get(contentType1.Id);
            var reContent = ServiceContext.MemberService.GetById(contentItems1.First().Id);

            foreach (var c in contentItems1)
            {
                var xml = DatabaseContext.Database.FirstOrDefault<ContentXmlDto>("WHERE nodeId = @Id", new { Id = c.Id });
                Assert.IsNotNull(xml);
                Assert.IsFalse(xml.Xml.Contains(elementToMatch)); //verify that it is no longer there
            }
        }

        [Test]
        public void Cannot_Save_MemberType_With_Empty_Name()
        {
            // Arrange
            IMemberType memberType = MockedContentTypes.CreateSimpleMemberType("memberTypeAlias", string.Empty);

            // Act & Assert
            Assert.Throws<ArgumentException>(() => ServiceContext.MemberTypeService.Save(memberType));
        }

        [Test]
        public void Empty_Description_Is_Always_Null_After_Saving_Member_Type()
        {
            var service = ServiceContext.MemberTypeService;
            var memberType = MockedContentTypes.CreateSimpleMemberType();
            memberType.Description = null;
            service.Save(memberType);

            var memberType2 = MockedContentTypes.CreateSimpleMemberType("memberType2", "Member Type 2");
            memberType2.Description = string.Empty;
            service.Save(memberType2);

            Assert.IsNull(memberType.Description);
            Assert.IsNull(memberType2.Description);
        }

        //[Test]
        //public void Can_Save_MemberType_Structure_And_Create_A_Member_Based_On_It()
        //{
        //    // Arrange
        //    var cs = ServiceContext.MemberService;
        //    var cts = ServiceContext.MemberTypeService;
        //    var dtdYesNo = ServiceContext.DataTypeService.GetDataTypeDefinitionById(-49);
        //    var ctBase = new MemberType(-1) { Name = "Base", Alias = "Base", Icon = "folder.gif", Thumbnail = "folder.png" };
        //    ctBase.AddPropertyType(new PropertyType(dtdYesNo)
        //        {
        //            Name = "Hide From Navigation",
        //            Alias = Constants.Conventions.Content.NaviHide
        //        }
        //        /*,"Navigation"*/);
        //    cts.Save(ctBase);

        //    var ctHomePage = new MemberType(ctBase)
        //        {
        //            Name = "Home Page",
        //            Alias = "HomePage",
        //            Icon = "settingDomain.gif",
        //            Thumbnail = "folder.png",
        //            AllowedAsRoot = true
        //        };
        //    ctHomePage.AddPropertyType(new PropertyType(dtdYesNo) { Name = "Some property", Alias = "someProperty" }
        //        /*,"Navigation"*/);
        //    cts.Save(ctHomePage);

        //    // Act
        //    var homeDoc = cs.CreateMember("Test", "test@test.com", "test", "HomePage");

        //    // Assert
        //    Assert.That(ctBase.HasIdentity, Is.True);
        //    Assert.That(ctHomePage.HasIdentity, Is.True);
        //    Assert.That(homeDoc.HasIdentity, Is.True);
        //    Assert.That(homeDoc.ContentTypeId, Is.EqualTo(ctHomePage.Id));
        //}

        //[Test]
        //public void Can_Create_And_Save_MemberType_Composition()
        //{
        //    /*
        //     * Global
        //     * - Components
        //     * - Category
        //     */
        //    var service = ServiceContext.ContentTypeService;
        //    var global = MockedContentTypes.CreateSimpleContentType("global", "Global");
        //    service.Save(global);

        //    var components = MockedContentTypes.CreateSimpleContentType("components", "Components", global);
        //    service.Save(components);

        //    var component = MockedContentTypes.CreateSimpleContentType("component", "Component", components);
        //    service.Save(component);

        //    var category = MockedContentTypes.CreateSimpleContentType("category", "Category", global);
        //    service.Save(category);

        //    var success = category.AddContentType(component);

        //    Assert.That(success, Is.False);
        //}

        //[Test]
        //public void Can_Remove_ContentType_Composition_From_ContentType()
        //{
        //    //Test for U4-2234
        //    var cts = ServiceContext.ContentTypeService;
        //    //Arrange
        //    var component = CreateComponent();
        //    cts.Save(component);
        //    var banner = CreateBannerComponent(component);
        //    cts.Save(banner);
        //    var site = CreateSite();
        //    cts.Save(site);
        //    var homepage = CreateHomepage(site);
        //    cts.Save(homepage);

        //    //Add banner to homepage
        //    var added = homepage.AddContentType(banner);
        //    cts.Save(homepage);

        //    //Assert composition
        //    var bannerExists = homepage.ContentTypeCompositionExists(banner.Alias);
        //    var bannerPropertyExists = homepage.CompositionPropertyTypes.Any(x => x.Alias.Equals("bannerName"));
        //    Assert.That(added, Is.True);
        //    Assert.That(bannerExists, Is.True);
        //    Assert.That(bannerPropertyExists, Is.True);
        //    Assert.That(homepage.CompositionPropertyTypes.Count(), Is.EqualTo(6));

        //    //Remove banner from homepage
        //    var removed = homepage.RemoveContentType(banner.Alias);
        //    cts.Save(homepage);

        //    //Assert composition
        //    var bannerStillExists = homepage.ContentTypeCompositionExists(banner.Alias);
        //    var bannerPropertyStillExists = homepage.CompositionPropertyTypes.Any(x => x.Alias.Equals("bannerName"));
        //    Assert.That(removed, Is.True);
        //    Assert.That(bannerStillExists, Is.False);
        //    Assert.That(bannerPropertyStillExists, Is.False);
        //    Assert.That(homepage.CompositionPropertyTypes.Count(), Is.EqualTo(4));
        //}

        //[Test]
        //public void Can_Copy_ContentType_By_Performing_Clone()
        //{
        //    // Arrange
        //    var service = ServiceContext.ContentTypeService;
        //    var metaContentType = MockedContentTypes.CreateMetaContentType();
        //    service.Save(metaContentType);

        //    var simpleContentType = MockedContentTypes.CreateSimpleContentType("category", "Category", metaContentType);
        //    service.Save(simpleContentType);
        //    var categoryId = simpleContentType.Id;

        //    // Act
        //    var sut = simpleContentType.Clone("newcategory");
        //    service.Save(sut);

        //    // Assert
        //    Assert.That(sut.HasIdentity, Is.True);

        //    var contentType = service.GetContentType(sut.Id);
        //    var category = service.GetContentType(categoryId);

        //    Assert.That(contentType.CompositionAliases().Any(x => x.Equals("meta")), Is.True);
        //    Assert.AreEqual(contentType.ParentId, category.ParentId);
        //    Assert.AreEqual(contentType.Level, category.Level);
        //    Assert.AreEqual(contentType.PropertyTypes.Count(), category.PropertyTypes.Count());
        //    Assert.AreNotEqual(contentType.Id, category.Id);
        //    Assert.AreNotEqual(contentType.Key, category.Key);
        //    Assert.AreNotEqual(contentType.Path, category.Path);
        //    Assert.AreNotEqual(contentType.SortOrder, category.SortOrder);
        //    Assert.AreNotEqual(contentType.PropertyTypes.First(x => x.Alias.Equals("title")).Id, category.PropertyTypes.First(x => x.Alias.Equals("title")).Id);
        //    Assert.AreNotEqual(contentType.PropertyGroups.First(x => x.Name.Equals("Content")).Id, category.PropertyGroups.First(x => x.Name.Equals("Content")).Id);

        //}

        //private ContentType CreateComponent()
        //{
        //    var component = new ContentType(-1)
        //        {
        //            Alias = "component",
        //            Name = "Component",
        //            Description = "ContentType used for Component grouping",
        //            Icon = ".sprTreeDoc3",
        //            Thumbnail = "doc.png",
        //            SortOrder = 1,
        //            CreatorId = 0,
        //            Trashed = false
        //        };

        //    var contentCollection = new PropertyTypeCollection();
        //    contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "componentGroup", Name = "Component Group", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 });
        //    component.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Component", SortOrder = 1 });

        //    return component;
        //}

        //private ContentType CreateBannerComponent(ContentType parent)
        //{
        //    var banner = new ContentType(parent)
        //        {
        //            Alias = "banner",
        //            Name = "Banner Component",
        //            Description = "ContentType used for Banner Component",
        //            Icon = ".sprTreeDoc3",
        //            Thumbnail = "doc.png",
        //            SortOrder = 1,
        //            CreatorId = 0,
        //            Trashed = false
        //        };

        //    var propertyType = new PropertyType(new Guid(), DataTypeDatabaseType.Ntext)
        //        {
        //            Alias = "bannerName",
        //            Name = "Banner Name",
        //            Description = "",
        //            HelpText = "",
        //            Mandatory = false,
        //            SortOrder = 2,
        //            DataTypeDefinitionId = -88
        //        };
        //    banner.AddPropertyType(propertyType, "Component");
        //    return banner;
        //}

        //private ContentType CreateSite()
        //{
        //    var site = new ContentType(-1)
        //        {
        //            Alias = "site",
        //            Name = "Site",
        //            Description = "ContentType used for Site inheritence",
        //            Icon = ".sprTreeDoc3",
        //            Thumbnail = "doc.png",
        //            SortOrder = 2,
        //            CreatorId = 0,
        //            Trashed = false
        //        };

        //    var contentCollection = new PropertyTypeCollection();
        //    contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "hostname", Name = "Hostname", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 });
        //    site.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Site Settings", SortOrder = 1 });

        //    return site;
        //}

        //private ContentType CreateHomepage(ContentType parent)
        //{
        //    var contentType = new ContentType(parent)
        //        {
        //            Alias = "homepage",
        //            Name = "Homepage",
        //            Description = "ContentType used for the Homepage",
        //            Icon = ".sprTreeDoc3",
        //            Thumbnail = "doc.png",
        //            SortOrder = 1,
        //            CreatorId = 0,
        //            Trashed = false
        //        };

        //    var contentCollection = new PropertyTypeCollection();
        //    contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "title", Name = "Title", Description = "", HelpText = "", Mandatory = false, SortOrder = 1, DataTypeDefinitionId = -88 });
        //    contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "bodyText", Name = "Body Text", Description = "", HelpText = "", Mandatory = false, SortOrder = 2, DataTypeDefinitionId = -87 });
        //    contentCollection.Add(new PropertyType(new Guid(), DataTypeDatabaseType.Ntext) { Alias = "author", Name = "Author", Description = "Name of the author", HelpText = "", Mandatory = false, SortOrder = 3, DataTypeDefinitionId = -88 });

        //    contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 });

        //    return contentType;
        //}

        //private IEnumerable<IContentType> CreateContentTypeHierarchy()
        //{
        //    //create the master type
        //    var masterContentType = MockedContentTypes.CreateSimpleContentType("masterContentType", "MasterContentType");
        //    masterContentType.Key = new Guid("C00CA18E-5A9D-483B-A371-EECE0D89B4AE");
        //    ServiceContext.ContentTypeService.Save(masterContentType);

        //    //add the one we just created
        //    var list = new List<IContentType> { masterContentType };

        //    for (var i = 0; i < 10; i++)
        //    {
        //        var contentType = MockedContentTypes.CreateSimpleContentType("childType" + i, "ChildType" + i,
        //                                                                     //make the last entry in the list, this one's parent
        //                                                                     list.Last());

        //        list.Add(contentType);
        //    }

        //    return list;
        //}
    }
}


text:
package db.dao

import com.vividsolutions.jts.geom.Geometry
import models._
import java.util.UUID

import com.trifectalabs.roadquality.v0.models.{Point, Segment, SegmentCreateForm}

import scala.concurrent.Future

trait MiniSegmentsDao {
  def getAll(): Future[Seq[MiniSegmentToSegment]]
  def getById(miniSegmentId: UUID): Future[MiniSegmentToSegment]
  def miniSegmentSplitsFromPoint(endPoint: Point, intermediatePoint: Point): Future[Option[MiniSegmentSplit]]
  def overlappingMiniSegmentsFromPolyline(polyline: String): Future[Seq[MiniSegmentToSegment]]
  def insert(miniSegmentToSegment: MiniSegmentToSegment): Future[MiniSegmentToSegment]
  def update(miniSegmentId: UUID, geometry: Geometry): Future[Unit]
}

redpajama_set_name: RedPajamaGithub


text:
package pl.tarko.software.finder.localization.model.jpa;

public enum LocalizationType {
    DEFAULT
}


text:
namespace gfx {
class ScrollOffset;
}

namespace cc {

class AnimationEvents;
class AnimationPlayer;
class AnimationRegistrar;
class AnimationTimeline;
class ElementAnimations;
class LayerAnimationController;
class LayerTreeHost;

enum class ThreadInstance { MAIN, IMPL };

typedef std::vector<scoped_refptr<AnimationTimeline>> AnimationTimelineList;

// An AnimationHost contains all the state required to play animations.
// Specifically, it owns all the AnimationTimelines objects.
// There is just one AnimationHost for LayerTreeHost on main renderer thread
// and just one AnimationHost for LayerTreeHostImpl on impl thread.
// We synchronize them during the commit process in a one-way data flow process
// (PushPropertiesTo).
// An AnimationHost talks to its correspondent LayerTreeHost via
// LayerTreeMutatorsClient interface.
// AnimationHost has it's own instance of AnimationRegistrar,
// we want to merge AnimationRegistrar into AnimationHost.
class CC_EXPORT AnimationHost {
 public:
  static scoped_ptr<AnimationHost> Create(ThreadInstance thread_instance);
  virtual ~AnimationHost();

  void AddAnimationTimeline(scoped_refptr<AnimationTimeline> timeline);
  void RemoveAnimationTimeline(scoped_refptr<AnimationTimeline> timeline);
  AnimationTimeline* GetTimelineById(int timeline_id) const;

  void ClearTimelines();

  void RegisterLayer(int layer_id, LayerTreeType tree_type);
  void UnregisterLayer(int layer_id, LayerTreeType tree_type);

  void RegisterPlayerForLayer(int layer_id, AnimationPlayer* player);
  void UnregisterPlayerForLayer(int layer_id, AnimationPlayer* player);

  ElementAnimations* GetElementAnimationsForLayerId(int layer_id) const;

  // TODO(loyso): Get rid of LayerAnimationController.
  LayerAnimationController* GetControllerForLayerId(int layer_id) const;

  // Parent LayerTreeHost or LayerTreeHostImpl.
  MutatorHostClient* mutator_host_client() { return mutator_host_client_; }
  const MutatorHostClient* mutator_host_client() const {
    return mutator_host_client_;
  }
  void SetMutatorHostClient(MutatorHostClient* client);

  void SetNeedsCommit();
  void SetNeedsRebuildPropertyTrees();

  void PushPropertiesTo(AnimationHost* host_impl);

  AnimationRegistrar* animation_registrar() const {
    return animation_registrar_.get();
  }

  void SetSupportsScrollAnimations(bool supports_scroll_animations);
  bool SupportsScrollAnimations() const;
  bool NeedsAnimateLayers() const;

  bool ActivateAnimations();
  bool AnimateLayers(base::TimeTicks monotonic_time);
  bool UpdateAnimationState(bool start_ready_animations,
                            AnimationEvents* events);

  scoped_ptr<AnimationEvents> CreateEvents();
  void SetAnimationEvents(scoped_ptr<AnimationEvents> events);

  bool ScrollOffsetAnimationWasInterrupted(int layer_id) const;

  bool IsAnimatingFilterProperty(int layer_id, LayerTreeType tree_type) const;
  bool IsAnimatingOpacityProperty(int layer_id, LayerTreeType tree_type) const;
  bool IsAnimatingTransformProperty(int layer_id,
                                    LayerTreeType tree_type) const;

  bool HasPotentiallyRunningFilterAnimation(int layer_id,
                                            LayerTreeType tree_type) const;
  bool HasPotentiallyRunningOpacityAnimation(int layer_id,
                                             LayerTreeType tree_type) const;
  bool HasPotentiallyRunningTransformAnimation(int layer_id,
                                               LayerTreeType tree_type) const;

  bool HasAnyAnimationTargetingProperty(
      int layer_id,
      Animation::TargetProperty property) const;

  bool FilterIsAnimatingOnImplOnly(int layer_id) const;
  bool OpacityIsAnimatingOnImplOnly(int layer_id) const;
  bool TransformIsAnimatingOnImplOnly(int layer_id) const;

  bool HasFilterAnimationThatInflatesBounds(int layer_id) const;
  bool HasTransformAnimationThatInflatesBounds(int layer_id) const;
  bool HasAnimationThatInflatesBounds(int layer_id) const;

  bool FilterAnimationBoundsForBox(int layer_id,
                                   const gfx::BoxF& box,
                                   gfx::BoxF* bounds) const;
  bool TransformAnimationBoundsForBox(int layer_id,
                                      const gfx::BoxF& box,
                                      gfx::BoxF* bounds) const;

  bool HasOnlyTranslationTransforms(int layer_id,
                                    LayerTreeType tree_type) const;
  bool AnimationsPreserveAxisAlignment(int layer_id) const;

  bool MaximumTargetScale(int layer_id,
                          LayerTreeType tree_type,
                          float* max_scale) const;
  bool AnimationStartScale(int layer_id,
                           LayerTreeType tree_type,
                           float* start_scale) const;

  bool HasAnyAnimation(int layer_id) const;
  bool HasActiveAnimation(int layer_id) const;

  void ImplOnlyScrollAnimationCreate(int layer_id,
                                     const gfx::ScrollOffset& target_offset,
                                     const gfx::ScrollOffset& current_offset);
  bool ImplOnlyScrollAnimationUpdateTarget(
      int layer_id,
      const gfx::Vector2dF& scroll_delta,
      const gfx::ScrollOffset& max_scroll_offset,
      base::TimeTicks frame_monotonic_time);

  void ScrollAnimationAbort();

 private:
  explicit AnimationHost(ThreadInstance thread_instance);

  void PushTimelinesToImplThread(AnimationHost* host_impl) const;
  void RemoveTimelinesFromImplThread(AnimationHost* host_impl) const;
  void PushPropertiesToImplThread(AnimationHost* host_impl);

  void EraseTimelines(AnimationTimelineList::iterator begin,
                      AnimationTimelineList::iterator end);

  // TODO(loyso): For now AnimationPlayers share LayerAnimationController object
  // if they are attached to the same element(layer). Note that Element can
  // contain many Layers.
  typedef base::ScopedPtrHashMap<int, scoped_ptr<ElementAnimations>>
      LayerToElementAnimationsMap;
  LayerToElementAnimationsMap layer_to_element_animations_map_;

  AnimationTimelineList timelines_;
  scoped_ptr<AnimationRegistrar> animation_registrar_;
  MutatorHostClient* mutator_host_client_;

  class ScrollOffsetAnimations;
  scoped_ptr<ScrollOffsetAnimations> scroll_offset_animations_;

  const ThreadInstance thread_instance_;

  DISALLOW_COPY_AND_ASSIGN(AnimationHost);
};

}  // namespace cc

#endif  // CC_ANIMATION_ANIMATION_HOST_H_


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

    <title>File: COPYING [Versioning Sequel Plugin]</title>
    <meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
    <link href='.././rdoc-style.css' media='screen' rel='stylesheet' type='text/css' />

COPYING

          COPYING

          Last Update:
          Wed Feb 18 15:21:57 +0000 2009

            Copyright © 2007 Matthew Ford

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

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

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

      Hanna RDoc template
      hand-crafted by
      Mislav


text:
'use strict'

const assert = require('chai').assert
const uuid = require('uuid').v4
const error = require('../../src/reducers/error')

describe('error()', function() {

	it('should return initial state', function() {

		const state = undefined
		const action = {}
		const nextState = error(state, action)

		assert.strictEqual(nextState, null)

	})

	it('should return existing state', function() {

		const state = uuid()
		const action = {}
		const nextState = error(state, action)

		assert.strictEqual(nextState, state)

	})

})


text:
// Copyright (c) 2016-2017 Vadim Macagon
// MIT License, see LICENSE file for full terms.

import * as React from 'react';
import * as mobx from 'mobx';
import { Observable, Subject, Subscription } from '@reactivex/rxjs';
import { observer } from 'mobx-react';
import { IronFlexLayout } from '../styles';
import { stylable } from '../decorators';
import { PanelComponent } from './panel';
import { LayoutContainerModel } from './layout-container-model';
import { PanelModel } from './panel-model';
import { ContextComponent } from '../context';
import { SplitterModel } from './splitter-model';

export interface ILayoutComponentProps<T> extends React.Props<T> {
  resizable?: boolean;
  onSetRef?(id: string, ref: ILayoutComponent): void;
}

export interface ILayoutComponent {
  id: string;
  getClientSize(): { width: number; height: number };
}

/**
 * Container component that lays out its children vertically or horizontally using flex-box.
 *
 * The container's children must either be containers or panels, splitter elements will be
 * automatically injected between resizable children.
 */
@stylable
@observer
export class LayoutContainerComponent
       extends ContextComponent<
         LayoutContainerComponent.IProps, void, LayoutContainerComponent.IContext>
       implements ILayoutComponent {

  static contextTypes = {
    freeStyle: React.PropTypes.object.isRequired,
    renderChild: React.PropTypes.func.isRequired
  };

  private _styleId: string;
  private _className: string;
  private _element: HTMLDivElement;
  /** All child components that aren't splitters. */
  private _childComponents = new Map</*id:*/string, ILayoutComponent>();
  /**
   * Stream that will yield a `null` value whenever the size of the element bound to this model
   * may have changed. Elements that perform some computation based on their actual size should
   * rerun those computations whenever this stream yields a value to account for any change in size.
   */
  private _didResizeStream = new Subject<void>();
  private _didResizeStreamSub: Subscription;

  private _onSetRef = (ref: HTMLDivElement) => {
    this._element = ref;
    if (this.props.onSetRef) {
      this.props.onSetRef(this.id, this);
    }
  }

  private _onSetChildRef = (id: string, ref: ILayoutComponent) => {
    if (ref) {
      this._childComponents.set(id, ref);
    } else {
      this._childComponents.delete(id);
    }
  }

  get id(): string {
    return this.props.model.id;
  }

  getClientSize(): { width: number; height: number } {
    if (this._element) {
      return { width: this._element.clientWidth, height: this._element.clientHeight };
    } else {
      throw new Error('Reference to DOM element not set.')
    }
  }

  @mobx.action
  private _adjustElementSize = (id: string, delta: { width?: number; height?: number }): void => {
    const resizeeComponent = this._childComponents.get(id);
    const resizeeModel = this.props.model.items.find(item => item.id === id);
    if (resizeeComponent && resizeeModel && !(resizeeModel instanceof SplitterModel)) {
      const { width, height } = resizeeComponent.getClientSize();
      if (this.props.model.direction === 'horizontal') {
        resizeeModel.width = `${width + delta.width}px`;
      } else {
        resizeeModel.height = `${height + delta.height}px`;
      }
      this._didResizeStream.next(null);
    }
  }

  componentWillMount(): void {
    const { model } = this.props;
    this._styleId = this.context.freeStyle.registerStyle(Object.assign(
      {
        boxSizing: 'border-box',
        overflow: 'hidden'
      },
      model.direction === 'vertical' ? IronFlexLayout.vertical : IronFlexLayout.horizontal,
      {
        '> *': IronFlexLayout.flex.auto,
        '> .hydragon-vertical-splitter, .hydragon-horizontal-splitter': IronFlexLayout.flex.none
      }
    ));
    this._className = `hydragon-${model.direction}-container ${this._styleId}`;
  }

  componentDidMount(): void {
    if (this.props.parentDidResizeStream) {
      this._didResizeStreamSub = this.props.parentDidResizeStream.subscribe(this._didResizeStream);
    }
  }

  componentWillUnmount(): void {
    if (this._didResizeStreamSub) {
      this._didResizeStreamSub.unsubscribe();
    }
    this._didResizeStream = null;
  }

  render() {
    const { model } = this.props;
    const inlineStyle = {
      width: (model.width !== undefined) ? model.width : undefined,
      height: (model.height !== undefined) ? model.height : undefined,
      flex: (this.props.flexBasis !== undefined) ? `0 0 ${this.props.flexBasis}` : undefined
    };

    return (

{
        model.items.map(child => {
          let onSetRef = null;
          let flexBasis;
          if (!(child instanceof SplitterModel)) {
            onSetRef = this._onSetChildRef;
            flexBasis = (model.direction === 'vertical') ? child.height : child.width;
          }
          return this.context.renderChild(child, {
            key: child.id,
            onSetRef,
            parentDidResizeStream: this.props.parentDidResizeStream,
            flexBasis,
            adjustElementSize: this._adjustElementSize,
            onBeginSplitterResize: this.props.onBeginSplitterResize,
            onEndSplitterResize: this.props.onEndSplitterResize
          });
        })
      }

    );
  }
}

export namespace LayoutContainerComponent {
  export interface IProps extends ILayoutComponentProps<LayoutContainerComponent> {
    model: LayoutContainerModel;
    flexBasis?: string;
    /**
     * Stream that yields a `null` value whenever the browser window or the parent container is
     * resized.
     */
    parentDidResizeStream?: Observable<void>;
    onBeginSplitterResize(direction: 'vertical' | 'horizontal'): void;
    onEndSplitterResize(): void;
  }

  export interface IContext extends stylable.IContext {
    renderChild(model: any, props: any): React.ReactElement<any>;
  }
}


text:
extern "C" {
#endif

#include <features.h>

#define __NEED_socklen_t
#define __NEED_sa_family_t
#define __NEED_size_t
#define __NEED_ssize_t
#define __NEED_uid_t
#define __NEED_pid_t
#define __NEED_gid_t
#define __NEED_struct_iovec

#include <bits/alltypes.h>

#include <bits/socket.h>

#ifdef _GNU_SOURCE
struct ucred
{
	pid_t pid;
	uid_t uid;
	gid_t gid;
};

struct mmsghdr
{
	struct msghdr msg_hdr;
	unsigned int  msg_len;
};

struct timespec;

int sendmmsg (int, struct mmsghdr *, unsigned int, unsigned int);
int recvmmsg (int, struct mmsghdr *, unsigned int, unsigned int, struct timespec *);
#endif

struct linger
{
	int l_onoff;
	int l_linger;
};

#define SHUT_RD 0
#define SHUT_WR 1
#define SHUT_RDWR 2

#ifndef SOCK_STREAM
#define SOCK_STREAM    1
#define SOCK_DGRAM     2
#endif

#define SOCK_RAW       3
#define SOCK_RDM       4
#define SOCK_SEQPACKET 5
#define SOCK_DCCP      6
#define SOCK_PACKET    10

#ifndef SOCK_CLOEXEC
#define SOCK_CLOEXEC   02000000
#define SOCK_NONBLOCK  04000
#endif

#define PF_UNSPEC       0
#define PF_LOCAL        1
#define PF_UNIX         PF_LOCAL
#define PF_FILE         PF_LOCAL
#define PF_INET         2
#define PF_AX25         3
#define PF_IPX          4
#define PF_APPLETALK    5
#define PF_NETROM       6
#define PF_BRIDGE       7
#define PF_ATMPVC       8
#define PF_X25          9
#define PF_INET6        10
#define PF_ROSE         11
#define PF_DECnet       12
#define PF_NETBEUI      13
#define PF_SECURITY     14
#define PF_KEY          15
#define PF_NETLINK      16
#define PF_ROUTE        PF_NETLINK
#define PF_PACKET       17
#define PF_ASH          18
#define PF_ECONET       19
#define PF_ATMSVC       20
#define PF_RDS          21
#define PF_SNA          22
#define PF_IRDA         23
#define PF_PPPOX        24
#define PF_WANPIPE      25
#define PF_LLC          26
#define PF_IB           27
#define PF_CAN          29
#define PF_TIPC         30
#define PF_BLUETOOTH    31
#define PF_IUCV         32
#define PF_RXRPC        33
#define PF_ISDN         34
#define PF_PHONET       35
#define PF_IEEE802154   36
#define PF_CAIF         37
#define PF_ALG          38
#define PF_NFC          39
#define PF_VSOCK        40
#define PF_MAX          41

#define AF_UNSPEC       PF_UNSPEC
#define AF_LOCAL        PF_LOCAL
#define AF_UNIX         AF_LOCAL
#define AF_FILE         AF_LOCAL
#define AF_INET         PF_INET
#define AF_AX25         PF_AX25
#define AF_IPX          PF_IPX
#define AF_APPLETALK    PF_APPLETALK
#define AF_NETROM       PF_NETROM
#define AF_BRIDGE       PF_BRIDGE
#define AF_ATMPVC       PF_ATMPVC
#define AF_X25          PF_X25
#define AF_INET6        PF_INET6
#define AF_ROSE         PF_ROSE
#define AF_DECnet       PF_DECnet
#define AF_NETBEUI      PF_NETBEUI
#define AF_SECURITY     PF_SECURITY
#define AF_KEY          PF_KEY
#define AF_NETLINK      PF_NETLINK
#define AF_ROUTE        PF_ROUTE
#define AF_PACKET       PF_PACKET
#define AF_ASH          PF_ASH
#define AF_ECONET       PF_ECONET
#define AF_ATMSVC       PF_ATMSVC
#define AF_RDS          PF_RDS
#define AF_SNA          PF_SNA
#define AF_IRDA         PF_IRDA
#define AF_PPPOX        PF_PPPOX
#define AF_WANPIPE      PF_WANPIPE
#define AF_LLC          PF_LLC
#define AF_IB           PF_IB
#define AF_CAN          PF_CAN
#define AF_TIPC         PF_TIPC
#define AF_BLUETOOTH    PF_BLUETOOTH
#define AF_IUCV         PF_IUCV
#define AF_RXRPC        PF_RXRPC
#define AF_ISDN         PF_ISDN
#define AF_PHONET       PF_PHONET
#define AF_IEEE802154   PF_IEEE802154
#define AF_CAIF         PF_CAIF
#define AF_ALG          PF_ALG
#define AF_NFC          PF_NFC
#define AF_VSOCK        PF_VSOCK
#define AF_MAX          PF_MAX

#ifndef SO_DEBUG
#define SO_DEBUG        1
#define SO_REUSEADDR    2
#define SO_TYPE         3
#define SO_ERROR        4
#define SO_DONTROUTE    5
#define SO_BROADCAST    6
#define SO_SNDBUF       7
#define SO_RCVBUF       8
#define SO_KEEPALIVE    9
#define SO_OOBINLINE    10
#define SO_NO_CHECK     11
#define SO_PRIORITY     12
#define SO_LINGER       13
#define SO_BSDCOMPAT    14
#define SO_REUSEPORT    15
#define SO_PASSCRED     16
#define SO_PEERCRED     17
#define SO_RCVLOWAT     18
#define SO_SNDLOWAT     19
#define SO_RCVTIMEO     20
#define SO_SNDTIMEO     21
#define SO_SNDBUFFORCE  32
#define SO_RCVBUFFORCE  33
#endif

#define SO_SECURITY_AUTHENTICATION              22
#define SO_SECURITY_ENCRYPTION_TRANSPORT        23
#define SO_SECURITY_ENCRYPTION_NETWORK          24

#define SO_BINDTODEVICE 25

#define SO_ATTACH_FILTER        26
#define SO_DETACH_FILTER        27
#define SO_GET_FILTER           SO_ATTACH_FILTER

#define SO_PEERNAME             28
#define SO_TIMESTAMP            29
#define SCM_TIMESTAMP           SO_TIMESTAMP

#define SO_ACCEPTCONN           30
#define SO_PEERSEC              31
#define SO_PASSSEC              34
#define SO_TIMESTAMPNS          35
#define SCM_TIMESTAMPNS         SO_TIMESTAMPNS
#define SO_MARK                 36
#define SO_TIMESTAMPING         37
#define SCM_TIMESTAMPING        SO_TIMESTAMPING
#define SO_PROTOCOL             38
#define SO_DOMAIN               39
#define SO_RXQ_OVFL             40
#define SO_WIFI_STATUS          41
#define SCM_WIFI_STATUS         SO_WIFI_STATUS
#define SO_PEEK_OFF             42
#define SO_NOFCS                43
#define SO_LOCK_FILTER          44
#define SO_SELECT_ERR_QUEUE     45
#define SO_BUSY_POLL            46
#define SO_MAX_PACING_RATE      47
#define SO_BPF_EXTENSIONS       48
#define SO_INCOMING_CPU         49
#define SO_ATTACH_BPF           50
#define SO_DETACH_BPF           SO_DETACH_FILTER

#ifndef SOL_SOCKET
#define SOL_SOCKET      1
#endif

#define SOL_IP          0
#define SOL_IPV6        41
#define SOL_ICMPV6      58

#define SOL_RAW         255
#define SOL_DECNET      261
#define SOL_X25         262
#define SOL_PACKET      263
#define SOL_ATM         264
#define SOL_AAL         265
#define SOL_IRDA        266

#define SOMAXCONN       128

#define MSG_OOB       0x0001
#define MSG_PEEK      0x0002
#define MSG_DONTROUTE 0x0004
#define MSG_CTRUNC    0x0008
#define MSG_PROXY     0x0010
#define MSG_TRUNC     0x0020
#define MSG_DONTWAIT  0x0040
#define MSG_EOR       0x0080
#define MSG_WAITALL   0x0100
#define MSG_FIN       0x0200
#define MSG_SYN       0x0400
#define MSG_CONFIRM   0x0800
#define MSG_RST       0x1000
#define MSG_ERRQUEUE  0x2000
#define MSG_NOSIGNAL  0x4000
#define MSG_MORE      0x8000
#define MSG_WAITFORONE 0x10000
#define MSG_CMSG_CLOEXEC 0x40000000

#define __CMSG_LEN(cmsg) (((cmsg)->cmsg_len + sizeof(long) - 1) & ~(long)(sizeof(long) - 1))
#define __CMSG_NEXT(cmsg) ((unsigned char *)(cmsg) + __CMSG_LEN(cmsg))
#define __MHDR_END(mhdr) ((unsigned char *)(mhdr)->msg_control + (mhdr)->msg_controllen)

#define CMSG_DATA(cmsg) ((unsigned char *) (((struct cmsghdr *)(cmsg)) + 1))
#define CMSG_NXTHDR(mhdr, cmsg) ((cmsg)->cmsg_len < sizeof (struct cmsghdr) ? (struct cmsghdr *)0 : \
        (__CMSG_NEXT(cmsg) + sizeof (struct cmsghdr) >= __MHDR_END(mhdr) ? (struct cmsghdr *)0 : \
        ((struct cmsghdr *)__CMSG_NEXT(cmsg))))
#define CMSG_FIRSTHDR(mhdr) ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)

#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1))
#define CMSG_SPACE(len) (CMSG_ALIGN (len) + CMSG_ALIGN (sizeof (struct cmsghdr)))
#define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))

#define SCM_RIGHTS      0x01
#define SCM_CREDENTIALS 0x02

struct sockaddr
{
	sa_family_t sa_family;
	char sa_data[14];
};

struct sockaddr_storage
{
	sa_family_t ss_family;
	unsigned long __ss_align;
	char __ss_padding[128-2*sizeof(unsigned long)];
};

int socket (int, int, int);
int socketpair (int, int, int, int [2]);

int shutdown (int, int);

int bind (int, const struct sockaddr *, socklen_t);
int connect (int, const struct sockaddr *, socklen_t);
int listen (int, int);
int accept (int, struct sockaddr *__restrict, socklen_t *__restrict);
int accept4(int, struct sockaddr *__restrict, socklen_t *__restrict, int);

int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
int getpeername (int, struct sockaddr *__restrict, socklen_t *__restrict);

ssize_t send (int, const void *, size_t, int);
ssize_t recv (int, void *, size_t, int);
ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
ssize_t recvfrom (int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict);
ssize_t sendmsg (int, const struct msghdr *, int);
ssize_t recvmsg (int, struct msghdr *, int);

int getsockopt (int, int, int, void *__restrict, socklen_t *__restrict);
int setsockopt (int, int, int, const void *, socklen_t);

int sockatmark (int);

#ifdef __cplusplus
}
#endif
#endif


text:
define(['exports', 'Game', 'Grid'], function (exports, _Game, _Grid) {
	'use strict';

	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

	var _Game2 = _interopRequireDefault(_Game);

	var _Grid2 = _interopRequireDefault(_Grid);

	//import KEYS from 'Keys';

	window.config = {
		debug: 0,
		postprocess: 1,
		mode: 'VR',
		animate: {
			player: 1,
			piece: 1,
			level: 1
		},
		levelsUrl: 'data/levels.json'
	};
	window.BG_COLOR = 13421772;
	window.mode = !!navigator.getVRDevices && config.mode == 'VR' ? 'VR' : 'obsolete';

	var clock = new THREE.Clock();

	var container, stats, gui;

	var camera, renderer, composer;

	var vrEffect;
	var vrControls;

	var scene = new THREE.Scene();
	window.scene = scene;

	var topCamera;

	var target = new THREE.Vector3(0, 0, 0);

	Math.deg2rad = Math.PI / 180;
	Math.deg2rad_h = Math.deg2rad / 2;

	var isMouseDown = false;
	var onMouseDownTheta;
	var onMouseDownPhi;
	var onMouseDownPosition = new THREE.Vector2();

	var radious = 8000,
	    theta = 45,
	    onMouseDownTheta = 45,
	    phi = 60,
	    onMouseDownPhi = 60;

	var SCREEN_WIDTH = window.innerWidth,
	    SCREEN_HEIGHT = window.innerHeight;

	$(_init);

	function _init() {
		getData();
	}

	function init() {
		container = document.createElement('div');
		document.body.appendChild(container);

		camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 10000);
		setCameraPosition();

		topCamera = new THREE.OrthographicCamera(window.innerWidth / -4, // Left
		window.innerWidth / 4, // Right
		window.innerHeight / 4, // Top
		window.innerHeight / -4, // Bottom
		-5000, // Near
		10000); // Far -- enough to see the skybox
		topCamera.up = new THREE.Vector3(0, 0, -1);
		topCamera.lookAt(new THREE.Vector3(0, -1, 0));

		scene.add(topCamera);

		setupLights();

		scene.fog = new THREE.FogExp2(BG_COLOR, 0.0002);

		setupRendering();

		if (config.debug) {
			var axes = new THREE.AxisHelper(30);
			scene.add(axes);
		}

		if (config.debug || 1) {
			stats = new Stats();
			container.appendChild(stats.domElement);
		}

		if (config.postprocess && mode != 'VR') setupPostprocessing();

		if (config.debug) {
			gui = new dat.GUI({ autoPlace: false });

			var customContainer = document.getElementById('dat-gui-container');
			if (customContainer) customContainer.appendChild(gui.domElement);

			var Actions = function Actions() {
				this.postprocess = function () {
					config.postprocess = !config.postprocess;
				};
			};

			var actions = new Actions();

			var f1 = gui.addFolder('postprocessing');
			f1.add(actions, 'postprocess');
			f1.open();
		}

		$(document).on('keydown', function (ev) {
			if (ev.keyCode === 13) {
				// enter
				startGame();
			}
		});

		$(document).on('click', '#start', startGame);

		animate();

		window.game = new _Game2['default']();

		$(window).on('resize', _.throttle(onWindowResize, 1000 / 10));
	}

	function setupLights() {
		var ambientLight = new THREE.AmbientLight(4210752);
		scene.add(ambientLight);

		var dl = new THREE.DirectionalLight(16777215);
		dl.position.x = 1000;
		dl.position.y = 1000;
		dl.position.z = 750;

		dl.castShadow = true;
		dl.shadowDarkness = 0.2;

		dl.shadowCameraLeft = -450;
		dl.shadowCameraRight = 450;
		dl.shadowCameraTop = 600;
		dl.shadowCameraBottom = -256;

		dl.shadowMapHeight = dl.shadowMapWidth = 1024;

		if (config.debug) dl.shadowCameraVisible = true;

		scene.add(dl);

		var directionalLight = new THREE.DirectionalLight(8421504);
		directionalLight.position.x = -1;
		directionalLight.position.y = 1;
		directionalLight.position.z = -0.75;
		directionalLight.position.normalize();

		scene.add(directionalLight);
	}

	function setupRendering() {
		renderer = new THREE.WebGLRenderer({
			antialias: true });

		renderer.shadowMapEnabled = true;
		renderer.shadowMapSoft = true;
		renderer.shadowMapWidth = 2048;
		renderer.shadowMapHeight = 2048;
		renderer.shadowMapType = THREE.PCFSoftShadowMap;

		renderer.setClearColor(BG_COLOR, 0);
		//renderer.setClearColor( 0x000000, 0 );

		renderer.setSize(window.innerWidth, window.innerHeight);

		container.appendChild(renderer.domElement);

		function VREffectLoaded(error) {
			if (error) {}
		}

		if (mode == 'VR') {
			vrEffect = new THREE.VREffect(renderer, VREffectLoaded);
			vrControls = new THREE.VRControls(camera);
		}
	}

	function setupPostprocessing() {
		composer = new THREE.EffectComposer(renderer);
		var rp = new THREE.RenderPass(scene, camera);

		composer.addPass(rp);

		var effectFXAA = new THREE.ShaderPass(THREE.FXAAShader);
		var width = window.innerWidth;
		var height = window.innerHeight;
		effectFXAA.uniforms['resolution'].value.set(1 / width, 1 / height);
		composer.addPass(effectFXAA);

		var vignettePass = new THREE.ShaderPass(THREE.VignetteShader);
		vignettePass.uniforms['darkness'].value = 0.9;
		vignettePass.uniforms['offset'].value = 0.5;
		vignettePass.renderToScreen = true;

		composer.addPass(vignettePass);
	}

	function animate() {
		requestAnimationFrame(animate);

		var dt = clock.getDelta();

		update(dt);
		render(dt);
	}

	function update(dt) {
		TWEEN.update();

		if (stats) stats.update();
	}

	function render(dt) {
		if (mode === 'VR') {
			var vrState = vrControls.getVRState();
			var s = 1000;

			// TODO: clean this up: 1) put in update, 2) do like vr-tmpl
			var cPos = { x: 0, y: 700, z: 700 };
			var vrPos = vrState ? vrState.hmd.position : [0, 0, 0];
			var pos = vrPos;
			pos[0] = vrPos[0] * s + cPos.x;
			pos[1] = vrPos[1] * s + cPos.y;
			pos[2] = vrPos[2] * s + cPos.z;

			camera.position.fromArray(pos);

			vrControls.update();
			vrEffect.render(scene, camera);
		} else {
			camera.lookAt(target);
			config.postprocess ? composer.render() : renderer.render(scene, camera);
		}
	}

	function getData() {

		$.getJSON(config.levelsUrl, function (data) {
			window.levelData = data;
			init();
		});
	}

	function startGame() {
		if (mode == 'VR') {
			vrEffect.setFullScreen(true);
		}

		$(document).off('keydown');
		//$('#menu').fadeOut();

		$('#menu').removeClass('active').addClass('scale-out');

		$('#menu').hide();

		var deltaT = 1400;

		//zoom in
		var at = { r: radious };
		var target = { r: 1600 };
		var zoomT = new TWEEN.Tween(at).to(target, deltaT).easing(TWEEN.Easing.Cubic.Out).onUpdate(function () {
			radious = this.r;
			setCameraPosition();
		}).onComplete(function () {
			game.startLevel(0);
			setupEvents();
		}).delay(600);

		zoomT.start();
	}

	function setCameraPosition() {
		var a = Math.deg2rad_h;

		if (mode == 'VR') {
			camera.position.set(0, 700, 700);
		} else {
			camera.position.x = radious * Math.sin(theta * a) * Math.cos(phi * a);
			camera.position.y = radious * Math.sin(phi * a);
			camera.position.z = radious * Math.cos(theta * a) * Math.cos(phi * a);
		}
	}

	function setupEvents() {
		key('r', function () {
			game.resetLevel();
		});

		key('n', function () {
			game.gotoNextLevel(true);
		});

		key('z', function () {
			vrEffect && vrControls._vrInput.zeroSensor();
		});

		key('d', function () {
			config.debug = !config.debug;
		});

		var pPos = game.player;
		/*
  NOTE: could wrap in for potential desired behavior
  key('left,a, down,s, right,d, up,w', function(){
  	if (key.isPressed('left') || key.isPressed('a')) {
  		pPos.move(Grid.DIRS.LEFT);
  	} else if (key.isPressed('down') || key.isPressed('s')) {
  		pPos.move(Grid.DIRS.DOWN);
  	} else if (key.isPressed('right') || key.isPressed('d')) {
  		pPos.move(Grid.DIRS.RIGHT);
  	} else if (key.isPressed('up') || key.isPressed('w')) {
  		pPos.move(Grid.DIRS.UP);
  	}
  });
  	*/
		key('left, a', function () {
			pPos.move(_Grid2['default'].DIRS.LEFT);
		});
		key('down, s', function () {
			pPos.move(_Grid2['default'].DIRS.DOWN);
		});
		key('right, d', function () {
			pPos.move(_Grid2['default'].DIRS.RIGHT);
		});
		key('up, w', function () {
			pPos.move(_Grid2['default'].DIRS.UP);
		});

		$('#restart-level').on('click', function () {
			game.resetLevel();
		});
		$('#random-level').on('click', function () {
			game.randomLevel(10);
		});
		$('#next-level').on('click', function () {
			game.gotoNextLevel(true);
		});

		if (mode !== 'VR') {
			$(document).on('mousemove', onDocumentMouseMove);
			$(document).on('mousedown', onDocumentMouseDown);
			$(document).on('mouseup', onDocumentMouseUp);

			document.addEventListener('mousewheel', onDocumentMouseWheel, false);
			//$(document).on('mousewheel', onDocumentMouseWheel); // might need plugin to x-handle
		}
	}

	function onWindowResize(event) {
		renderer.setSize(window.innerWidth, window.innerHeight);

		camera.aspect = window.innerWidth / window.innerHeight;
		camera.updateProjectionMatrix();

		//composer.reset();
		if (mode !== 'VR') setupPostprocessing();
	}

	function onDocumentMouseDown(event) {
		event.preventDefault();

		isMouseDown = true;

		onMouseDownTheta = theta;
		onMouseDownPhi = phi;
		onMouseDownPosition.x = event.clientX;
		onMouseDownPosition.y = event.clientY;
	}

	function onDocumentMouseMove(event) {
		event.preventDefault();

		if (isMouseDown) {
			theta = -((event.clientX - onMouseDownPosition.x) * 0.5) + onMouseDownTheta;
			phi = (event.clientY - onMouseDownPosition.y) * 0.5 + onMouseDownPhi;
			phi = Math.min(180, Math.max(0, phi));

			var a = Math.deg2rad_h;

			setCameraPosition();
			camera.updateMatrix();
		}
	}

	function onDocumentMouseUp(event) {
		event.preventDefault();

		isMouseDown = false;

		onMouseDownPosition.x = event.clientX - onMouseDownPosition.x;
		onMouseDownPosition.y = event.clientY - onMouseDownPosition.y;
	}

	function onDocumentMouseWheel(event) {
		var MAX_ZOOM = 8000,
		    MIN_ZOOM = 1000;

		radious -= event.wheelDeltaY;

		radious = Math.min(Math.max(radious, MIN_ZOOM), MAX_ZOOM);

		setCameraPosition();
		camera.updateMatrix();

		render();
	}
});

//fullScreenButton.innerHTML = error;
//fullScreenButton.classList.add('error');


text:
const img_paste = require('../lib/img-paste');

describe("img_paste", function () {
    let activationPromise, workspaceElement, _ref;
    _ref = [];
    workspaceElement = _ref[0];
    activationPromise = _ref[1];

    beforeEach(function () {
        workspaceElement = atom.views.getView(atom.workspace);
        return activationPromise = atom.packages.activatePackage('img_paste');
    });
    return describe("when the img_paste:toggle event is triggered", function () {
        it("hides and shows the modal panel", function () {
            expect(workspaceElement.querySelector('.img_paste')).not.toExist();
            atom.commands.dispatch(workspaceElement, 'img_paste:toggle');
            waitsForPromise(function () {
                return activationPromise;
            });
            return runs(function () {
                let img_pasteElement, img_pastePanel;
                expect(workspaceElement.querySelector('.img_paste')).toExist();
                img_pasteElement = workspaceElement.querySelector('.img_paste');
                expect(img_pasteElement).toExist();
                img_pastePanel = atom.workspace.panelForItem(img_pasteElement);
                expect(img_pastePanel.isVisible()).toBe(true);
                atom.commands.dispatch(workspaceElement, 'img_paste:toggle');
                return expect(img_pastePanel.isVisible()).toBe(false);
            });
        });
        return it("hides and shows the view", function () {
            jasmine.attachToDOM(workspaceElement);
            expect(workspaceElement.querySelector('.img_paste')).not.toExist();
            atom.commands.dispatch(workspaceElement, 'img_paste:toggle');
            waitsForPromise(function () {
                return activationPromise;
            });
            return runs(function () {
                let img_pasteElement;
                img_pasteElement = workspaceElement.querySelector('.img_paste');
                expect(img_pasteElement).toBeVisible();
                atom.commands.dispatch(workspaceElement, 'img_paste:toggle');
                return expect(img_pasteElement).not.toBeVisible();
            });
        });
    });
});


text:
package com.amazonaws.services.cognitoidp.model;

import javax.annotation.Generated;

/**
 * <p>
 * This exception is thrown when Amazon Cognito encounters a group that already exists in the user pool.
 * </p>
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GroupExistsException extends com.amazonaws.services.cognitoidp.model.AWSCognitoIdentityProviderException {
    private static final long serialVersionUID = 1L;

    /**
     * Constructs a new GroupExistsException with the specified error message.
     *
     * @param message
     *        Describes the error encountered.
     */
    public GroupExistsException(String message) {
        super(message);
    }

}


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
                                                                                * FileComponent
                                                                                * @author Van Carney <carney.van@gmail.com>
                                                                                *
                                                                                */

var _path2 = require("path");

var _path3 = _interopRequireDefault(_path2);

var _wfUtils = require("wf-utils");

var utils = _interopRequireWildcard(_wfUtils);

var _FileConnector = require("./FileConnector");

var _FileConnector2 = _interopRequireDefault(_FileConnector);

var _schemaroller = require("schemaroller");

var _schemaroller2 = _interopRequireDefault(_schemaroller);

var _ds_configJsd = require("./ds_config.jsd.json");

var JSD = _interopRequireWildcard(_ds_configJsd);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var _SchemaRoller = (0, _schemaroller2.default)(),
    Schema = _SchemaRoller.Schema;

var __data = new WeakMap();
var __loaderRefs = new WeakMap();

var FileComponent = function () {
  /**
   *
   * @param fullFilePath
   * @param modelName
   */
  function FileComponent(config) {
    _classCallCheck(this, FileComponent);

    config = new Schema(JSD).set(config);
    if (typeof config === "string") {
      throw config;
    }
    var _name = config.get("name");
    var _path = config.get("path");
    var _file = config.get("file");
    var _ds = new _FileConnector2.default(_path, _name);
    __data.set(this, null);
    __loaderRefs.set(this, {
      path: _path,
      file: _file,
      filePath: _path3.default.join(_path, _name, _file),
      name: _name,
      ds: _ds
    });
  }

  _createClass(FileComponent, [{
    key: "exists",

    /**
     *
     * @param _path
     * @returns {*}
     */
    value: function exists(callback) {
      return this.container.connector.getFile(this.name, this.file, function (e, res) {
        callback(res !== null);
      });
    }

    /**
     *
     * @param cb
     * @returns {boolean}
     */

  }, {
    key: "load",
    value: function load(cb) {
      var _this = this;

      return this.container.read(this.file, "utf8", function (e, data) {
        _this.contents = data || null;
        cb(e, data);
      });
    }

    /**
     *
     * @param callback
     */

  }, {
    key: "unload",
    value: function unload(callback) {
      this.contents = null;
      callback();
    }

    /**
     *
     * @returns {*}
     */

  }, {
    key: "save",

    /**
     * Saves Loaded File
     * @param callback
     * @returns {*}
     */
    value: function save(callback) {
      if (this.path === null) {
        // sets error if path is null
        if (utils.exists(callback)) {
          callback("path was not defined", null);
        }
        return;
      }

      return this.container.write(this.file, this.contents, "utf8", callback);
    }

    /**
     * renames loaded file
     * @param newPath
     * @param callback
     * @returns {*}
     */

  }, {
    key: "rename",
    value: function rename(newPath, callback) {
      var _this2 = this;

      return this.container.rename(this.file, newPath, "utf8", function (e) {
        var _ = __loaderRefs.get(_this2);
        _.file = newPath;
        __loaderRefs.set(_this2, _);
        callback(e);
      });
    }

    /**
     * deletes Loaded File
     * @param callback
     * @returns {boolean}
     */

  }, {
    key: "destroy",
    value: function destroy(cb) {
      return this.container.remove(this.file, cb);
    }

    /**
     * returns raw contents of loaded file
     * @returns {*}
     */

  }, {
    key: "valueOf",
    value: function valueOf() {
      return this.contents || null;
    }

    /**
     * returns JSON-formatted contents of loaded file
     * @returns JSON
     */

  }, {
    key: "toJSON",
    value: function toJSON() {
      return JSON.parse(this.toString());
    }

    /**
     *
     * @param readable
     * @returns string representation of File
     */

  }, {
    key: "toString",
    value: function toString() {
      var readable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

      if (typeof this.valueOf() === "string") {
        return this.valueOf();
      }
      return JSON.stringify(this.valueOf(), this.replacer, readable ? 2 : undefined);
    }

    // - Loopback DS Methods

    /**
     *
     * @param cb
     */

  }, {
    key: "connect",
    value: function connect(cb) {
      var _this3 = this;

      this.load(function (e) {
        cb(e || _this3);
      });
    }

    /**
     *
     * @param cb
     */

  }, {
    key: "disconnect",
    value: function disconnect(cb) {
      this.unload(cb);
    }
  }, {
    key: "path",
    get: function get() {
      return __loaderRefs.get(this).path;
    }
  }, {
    key: "container",
    get: function get() {
      return __loaderRefs.get(this).ds;
    }
  }, {
    key: "name",
    get: function get() {
      return __loaderRefs.get(this).name;
    }
  }, {
    key: "filePath",
    get: function get() {
      return __loaderRefs.get(this).filePath;
    }
  }, {
    key: "file",
    get: function get() {
      return __loaderRefs.get(this).file;
    }
  }, {
    key: "contents",
    get: function get() {
      return __data.get(this);
    }

    /**
     *
     * @param value
     */
    ,
    set: function set(value) {
      __data.set(this, value);
    }
  }]);

  return FileComponent;
}();

exports.default = FileComponent;


text:
var game = new Phaser.Game(800,500, Phaser.AUTO, 'game_div', { preload: preload, create: create,update:update ,render:render});

var handle1 ;
var handle2;

var x ;
var y ;

function preload()
{
    game.load.image('background', 'assets/soccer-field.jpg');
    game.load.image('player', 'assets/player.png');
}

function create() {

    game.add.sprite(0, 0, 'background');

    handle1 = game.add.sprite(100, 200, 'player', 0);
    handle1.anchor.set(0.5,0.5);

    handle2 = game.add.sprite(400, 300, 'player', 0);
    handle2.anchor.set(0.5,0.5);

	game.physics.arcade.enable(handle1);
	game.physics.arcade.enable(handle2);

    line1 = new Phaser.Line(handle1.x, handle1.y, handle2.x, handle2.y);

	websocket = new WebSocket('ws://10.10.16.217:8090');
	websocket.onopen = function(evt) { onOpen(evt) };
	websocket.onclose = function(evt) { onClose(evt) };
	websocket.onmessage = function(evt) { onMessage(evt) };
	websocket.onerror = function(evt) { onError(evt) };
}

function onOpen(evt) { writeToScreen("CONNECTED"); }

function onClose(evt) { writeToScreen("DISCONNECTED"); }

function onMessage(evt) {

		var reader = new FileReader();
		reader.readAsText(evt.data);
		reader.onload = function(event){
			var obj = JSON.parse(reader.result);
			x = obj.x;
			y= obj.y;
			obj.now = new Date().toISOString();
			var generatedOn = new Date(obj.generatedOn);
			obj.delay = new Date().getTime() - generatedOn.getTime();
			console.log(JSON.stringify(obj));

		};
}

function onError(evt) { writeToScreen('ERROR: ' + evt.data); }

function doSend(message) { writeToScreen("SENT: " + message);  websocket.send(message); }

function writeToScreen(message) { console.log(message) }

function update() {

    line1.fromSprite(handle1, handle2, false);

}

function render() {

    game.debug.geom(line1);
    game.debug.lineInfo(line1, 32, 32);

    game.debug.text("Drag the handles", 32, 550);

	handle1.reset( x * 8,  y * 5) ;

	//console.log(handle1.body.x+" "+handle1.body.y);

}


text:
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <services>
        <service id="bacon_rd_station.api" class="Bacon\Bundle\RDStationBundle\Service\Api">
            <argument>%bacon_rd_station.api.private_token%</argument>
            <argument>%bacon_rd_station.api.token%</argument>
            <argument>%bacon_rd_station.api.base_url%</argument>
            <argument>%bacon_rd_station.api.version%</argument>
        </service>
    </services>

</container>


text:
package com.bafomdad.realfilingcabinet.gui;

import org.lwjgl.opengl.GL11;

import com.bafomdad.realfilingcabinet.RealFilingCabinet;

import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
import net.minecraft.util.ResourceLocation;

public class GuiContainerRFC extends GuiContainer {

	private static final ResourceLocation texture = new ResourceLocation(RealFilingCabinet.MOD_ID, "textures/gui/guicabinet.png");

	public GuiContainerRFC(Container cont) {

		super(cont);
		this.xSize = 176;
		this.ySize = 131;
	}

	@Override
	public void drawScreen(int mouseX, int mouseY, float partialTicks) {

		this.drawDefaultBackground();
		super.drawScreen(mouseX, mouseY, partialTicks);
		this.renderHoveredToolTip(mouseX, mouseY);
	}

	@Override
	protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {

		String s = "Filing Cabinet";
		fontRenderer.drawString(s, xSize / 2 - fontRenderer.getStringWidth(s) / 2, 6, 4210752);
	}

	@Override
	protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {

		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
		this.mc.renderEngine.bindTexture(texture);

		int k = (this.width - this.xSize) / 2;
		int l = (this.height - this.ySize) / 2;
		drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
	}
}


text:
layout: default
title: Affiliations
permalink: '/affiliations/'
---

Involvement and Kudos

Jonathan Gill is involved with or in full support of these fine institutions and endeavors:

I

love

Teaching

ABK The Alpha Beta Kappa Honors Society

Alpha Beta Kappa is the premier national honor society for America's private postsecondary schools, institutes, colleges, universities, and distance learning institutions - serving many institutions for the past 40 years. Alpha Beta Kappa places Chapters in institutions which have demonstrated high standards over a period of many years in the education and training of women and men in the numerous fields, trades and occupations essential to modern society. It is the mark of distinction for an institution to be awarded a Chapter of Alpha Beta Kappa. That fact that an individual is elected to membership in this honor society sets her or him apart as an exemplar of personal integrity and excellence.

California State Parks The California Department of Parks and Recreation

Parks are essential to the well-being of environments, economies and all people. California's state parks and the recreational programs supported by the California Department of Parks and Recreation and its divisions of Boating and Waterways, Off-Highway Motor Vehicle Recreation, and Office of Historic Preservation, are gateways to these benefits and to opportunities to connect with families, friends, and communities.

FWS.gov U.S. Fish & Wildlife Service

Our Mission is to Work with others to conserve, protect and enhance fish, wildlife and plants and their habitats for the continuing benefit of the American people. Our programs are among the oldest in the world dedicated to natural resource conservation. You can trace our history back to 1871 and the U.S. Commission on Fish and Fisheries in the Department of Commerce and the Division of Economic Ornithology and Mammalogy in the Department of Agriculture.

NRA National Rifle Association

While widely recognized today as a major political force and as America's foremost defender of Second Amendment rights, the NRA has, since its inception, been the premier firearms education organization in the world. But our successes would not be possible without the tireless efforts and countless hours of service our nearly five million members have given to champion Second Amendment rights and support NRA programs such as the National School Shield program and the NRA Foundation.

CWA California Waterfowl Association

California Waterfowl is a 501c3 organization whose mission is to sustain and grow California's waterfowl populations, wetlands and hunter-conservationist community. Their vision is a California with thriving waterfowl populations, vibrant wetland ecosystems and respected hunting communities.

CDA California Deer Association

California Deer is a non-profit, tax exempt wildlife conservation organization whose principle goal is to improve California deer herds and other wildlife; through direct financial support for habitat improvement and research projects. Seventy-five percent of the net profit from fund-raising events will go to projects all of which will be in California borders.


text: ./script/build/index.sh && ./script/build/ast.sh && ./script/build/autocomplete.sh


text:
package dev.gigaherz.enderthing.blocks;

import com.mojang.blaze3d.vertex.PoseStack;
import dev.gigaherz.enderthing.Enderthing;
import dev.gigaherz.enderthing.KeyUtils;
import dev.gigaherz.enderthing.gui.Containers;
import dev.gigaherz.enderthing.util.ILongAccessor;
import net.minecraft.ChatFormatting;
import net.minecraft.Util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.ItemTransforms;
import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraft.nbt.Tag;
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
import net.minecraftforge.common.util.NonNullLazy;

import javax.annotation.Nullable;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;

public class EnderKeyChestBlockItem extends BlockItem implements KeyUtils.IBindableKeyHolder
{
    public EnderKeyChestBlockItem(Block block, Properties properties)
    {
        super(block, properties);
    }

    @Override
    public Optional<CompoundTag> findHolderTag(ItemStack stack)
    {
        CompoundTag tag = stack.getTag();
        if (tag == null) return Optional.empty();
        if (!tag.contains("BlockEntityTag", Tag.TAG_COMPOUND))
            return Optional.empty();
        return Optional.of(tag.getCompound("BlockEntityTag"));
    }

    @Override
    public CompoundTag getOrCreateHolderTag(ItemStack stack)
    {
        return stack.getOrCreateTagElement("BlockEntityTag");
    }

    @Override
    public void fillItemCategory(CreativeModeTab group, NonNullList<ItemStack> items)
    {
        if (allowedIn(group))
        {
            items.add(new ItemStack(this));
            items.add(KeyUtils.setPrivate(new ItemStack(this), true));
        }
        if (this.getItemCategory() != null && group == CreativeModeTab.TAB_SEARCH)
        {
            items.add(KeyUtils.setBound(KeyUtils.setPrivate(new ItemStack(this), true), Util.NIL_UUID));
        }
    }

    @OnlyIn(Dist.CLIENT)
    @Override
    public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List<Component> tooltip, TooltipFlag flagIn)
    {
        tooltip.add(Component.translatable("tooltip.enderthing.ender_key_chest.right_click").withStyle(ChatFormatting.ITALIC));

        Enderthing.Client.addStandardInformation(stack, tooltip);

        if (isBound(stack))
            tooltip.add(Component.translatable("tooltip.enderthing.ender_lock.bound", getBoundStr(stack)));

    }

    private void openPasscodeScreen(Player playerIn, ItemStack stack)
    {
        Containers.openPasscodeScreen((ServerPlayer) playerIn, new ILongAccessor()
        {
            @Override
            public long get()
            {
                return KeyUtils.getKey(stack);
            }

            @Override
            public void set(long value)
            {
                KeyUtils.setKey(stack, value);
            }
        }, stack.copy());
    }

    @Override
    public InteractionResultHolder<ItemStack> use(Level worldIn, Player playerIn, InteractionHand hand)
    {
        ItemStack stack = playerIn.getItemInHand(hand);

        long oldId = getKey(stack);

        if (oldId < 0)
        {
            if (!worldIn.isClientSide)
                openPasscodeScreen(playerIn, stack);
            return InteractionResultHolder.success(stack);
        }

        if (playerIn.isShiftKeyDown())
        {
            ItemStack oldStack = KeyUtils.getLock(oldId, isPrivate(stack));

            if (!playerIn.getInventory().add(oldStack))
            {
                playerIn.drop(oldStack, false);
            }

            if (stack.getCount() > 1)
            {
                ItemStack newStack = new ItemStack(Blocks.ENDER_CHEST);
                if (!playerIn.getInventory().add(newStack))
                {
                    playerIn.drop(newStack, false);
                }

                stack.grow(-1);
                return InteractionResultHolder.success(stack);
            }

            return InteractionResultHolder.success(new ItemStack(Blocks.ENDER_CHEST));
        }

        return super.use(worldIn, playerIn, hand);
    }

    @Override
    public void initializeClient(Consumer<IClientItemExtensions> consumer)
    {
        consumer.accept(new IClientItemExtensions()
        {
            static final NonNullLazy<BlockEntityWithoutLevelRenderer> renderer = NonNullLazy.of(() -> new BlockEntityWithoutLevelRenderer(Minecraft.getInstance().getBlockEntityRenderDispatcher(), Minecraft.getInstance().getEntityModels())
            {
                final EnderKeyChestBlockEntity defaultChest = new EnderKeyChestBlockEntity(BlockPos.ZERO, Enderthing.KEY_CHEST.get().defaultBlockState());

                @Override
                public void renderByItem(ItemStack itemStackIn, ItemTransforms.TransformType transformType, PoseStack matrixStackIn,
                                         MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn)
                {
                    EnderKeyChestRenderer.INSTANCE.renderFromItem(itemStackIn, defaultChest, transformType, matrixStackIn, bufferIn, combinedLightIn, combinedOverlayIn);
                }
            });

            @Override
            public BlockEntityWithoutLevelRenderer getCustomRenderer()
            {
                return renderer.get();
            }
        });
    }
}


text:
namespace {
const bool kAsyncCall = true;
const bool kSyncCall = false;
}  // namespace

namespace notifier {

// Class to catch events from the NotificationBitmapFetcher for testing.
class NotificationBitmapFetcherTestDelegate
    : public NotificationBitmapFetcherDelegate {
 public:
  explicit NotificationBitmapFetcherTestDelegate(bool async)
      : called_(false), success_(false), async_(async) {}

  virtual ~NotificationBitmapFetcherTestDelegate() {
    EXPECT_TRUE(called_);
  }

  // Method inherited from NotificationBitmapFetcherDelegate.
  virtual void OnFetchComplete(const GURL url,
                               const SkBitmap* bitmap) OVERRIDE {
    called_ = true;
    url_ = url;
    if (NULL != bitmap) {
      success_ = true;
      bitmap->deepCopyTo(&bitmap_, bitmap->getConfig());
    }
    // For async calls, we need to quit the message loop so the test can
    // continue.
    if (async_) {
      base::MessageLoop::current()->Quit();
    }
  }

  GURL url() const { return url_; }
  bool success() const { return success_; }
  const SkBitmap& bitmap() const { return bitmap_; }

 private:
  bool called_;
  GURL url_;
  bool success_;
  bool async_;
  SkBitmap bitmap_;

  DISALLOW_COPY_AND_ASSIGN(NotificationBitmapFetcherTestDelegate);
};

class NotificationBitmapFetcherBrowserTest : public InProcessBrowserTest {
 public:
  virtual void SetUp() OVERRIDE {
    url_fetcher_factory_.reset(new net::FakeURLFetcherFactory(NULL));
    InProcessBrowserTest::SetUp();
  }

 protected:
  scoped_ptr<net::FakeURLFetcherFactory> url_fetcher_factory_;
};

// WARNING:  These tests work with --single_process, but not
// --single-process.  The reason is that the sandbox does not get created
// for us by the test process if --single-process is used.

IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
                       StartTest) {
  GURL url("http://example.com/this-should-work");

  // Put some realistic looking bitmap data into the url_fetcher.
  SkBitmap image;

  // Put a real bitmap into "image".  2x2 bitmap of green 32 bit pixels.
  image.setConfig(SkBitmap::kARGB_8888_Config, 2, 2);
  image.allocPixels();
  image.eraseColor(SK_ColorGREEN);

  // Encode the bits as a PNG.
  std::vector<unsigned char> compressed;
  ASSERT_TRUE(gfx::PNGCodec::EncodeBGRASkBitmap(image, true, &compressed));

  // Copy the bits into the string, and put them into the FakeURLFetcher.
  std::string image_string(compressed.begin(), compressed.end());

  // Set up a delegate to wait for the callback.
  NotificationBitmapFetcherTestDelegate delegate(kAsyncCall);

  NotificationBitmapFetcher fetcher(url, &delegate);

  url_fetcher_factory_->SetFakeResponse(url.spec(), image_string, true);

  // We expect that the image decoder will get called and return
  // an image in a callback to OnImageDecoded().
  fetcher.Start(browser()->profile());

  // Blocks until test delegate is notified via a callback.
  content::RunMessageLoop();

  ASSERT_TRUE(delegate.success());

  // Make sure we get back the bitmap we expect.
  const SkBitmap& found_image = delegate.bitmap();
  EXPECT_TRUE(gfx::BitmapsAreEqual(image, found_image));
}

IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
                       OnImageDecodedTest) {
  GURL url("http://example.com/this-should-work-as-well");
  SkBitmap image;

  // Put a real bitmap into "image".  2x2 bitmap of green 16 bit pixels.
  image.setConfig(SkBitmap::kARGB_8888_Config, 2, 2);
  image.allocPixels();
  image.eraseColor(SK_ColorGREEN);

  NotificationBitmapFetcherTestDelegate delegate(kSyncCall);

  NotificationBitmapFetcher fetcher(url, &delegate);

  fetcher.OnImageDecoded(NULL, image);

  // Ensure image is marked as succeeded.
  EXPECT_TRUE(delegate.success());

  // Test that the image is what we expect.
  EXPECT_TRUE(gfx::BitmapsAreEqual(image, delegate.bitmap()));
}

IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
                       OnURLFetchFailureTest) {
  GURL url("http://example.com/this-should-be-fetch-failure");

  // We intentionally put no data into the bitmap to simulate a failure.

  // Set up a delegate to wait for the callback.
  NotificationBitmapFetcherTestDelegate delegate(kAsyncCall);

  NotificationBitmapFetcher fetcher(url, &delegate);

  url_fetcher_factory_->SetFakeResponse(url.spec(), std::string(), false);

  fetcher.Start(browser()->profile());

  // Blocks until test delegate is notified via a callback.
  content::RunMessageLoop();

  EXPECT_FALSE(delegate.success());
}

IN_PROC_BROWSER_TEST_F(NotificationBitmapFetcherBrowserTest,
                       HandleImageFailedTest) {
  GURL url("http://example.com/this-should-be-a-decode-failure");
  NotificationBitmapFetcherTestDelegate delegate(kAsyncCall);
  NotificationBitmapFetcher fetcher(url, &delegate);
  url_fetcher_factory_->SetFakeResponse(
      url.spec(), std::string("Not a real bitmap"), true);

  fetcher.Start(browser()->profile());

  // Blocks until test delegate is notified via a callback.
  content::RunMessageLoop();

  EXPECT_FALSE(delegate.success());
}

}  // namespace notifier


text:
package org.wso2.esb.integration.common.utils.clients.rabbitmqclient;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.GetResponse;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeoutException;

public class RabbitMQConsumerClient {

    private ConnectionFactory factory = null;
    private Connection connection = null;
    private Channel channel = null;
    private String routeKey;

    public RabbitMQConsumerClient(String host) {
        factory = new ConnectionFactory();
        factory.setHost(host);
    }

    public void declareAndConnect(String exchangeName, String routeKey) throws IOException {
        try {
            connection = factory.newConnection();
            channel = connection.createChannel();
        } catch (TimeoutException e) {
            e.printStackTrace();
        }

        this.routeKey = routeKey;

        try {
            //Throws an exception if the channel is not available.
            channel.exchangeDeclarePassive(exchangeName);
        } catch (IOException e) {
            //Channel is closed if exchange is not available. Therefore, create the channel here again.
            if (!channel.isOpen()) {
                channel = connection.createChannel();
            }
            channel.exchangeDeclare(exchangeName, "direct");
        }

        try {
            channel.queueDeclarePassive(routeKey);
        } catch (IOException e) {
            if (!channel.isOpen()) {
                channel = connection.createChannel();
            }
            channel.queueDeclare(routeKey, false, false, false, null);
        }

        channel.queueBind(routeKey, exchangeName, routeKey);
    }

    public List<String> popAllMessages() throws IOException, InterruptedException {
        List<String> messages = new ArrayList<>();
        GetResponse response;

        while ((response = channel.basicGet(routeKey, true)) != null) {
            messages.add(new String(response.getBody()));
        }
        return messages;
    }

    public void disconnect() {
        try {
            channel.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (TimeoutException e) {
            e.printStackTrace();
        }
        try {
            connection.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


text:
package com.graphicsfuzz.generator.transformation.injection;

import com.graphicsfuzz.common.ast.decl.FunctionDefinition;
import com.graphicsfuzz.common.ast.stmt.BlockStmt;
import com.graphicsfuzz.common.ast.stmt.Stmt;
import com.graphicsfuzz.common.typing.Scope;

public class BlockInjectionPoint extends InjectionPoint {

  private BlockStmt blockStmt;
  private Stmt nextStmt; // null if there is no next statement

  public BlockInjectionPoint(BlockStmt blockStmt, Stmt nextStmt,
      FunctionDefinition enclosingFunction, boolean inLoop, boolean inSwitch, Scope scope) {
    super(enclosingFunction, inLoop, inSwitch, scope);
    this.blockStmt = blockStmt;
    this.nextStmt = nextStmt;
  }

  @Override
  public void inject(Stmt stmt) {
    if (nextStmt == null) {
      blockStmt.insertStmt(blockStmt.getNumStmts(), stmt);
    } else {
      blockStmt.insertBefore(nextStmt, stmt);
    }
  }

  @Override
  public Stmt getNextStmt() {
    assert hasNextStmt();
    return nextStmt;
  }

  @Override
  public boolean hasNextStmt() {
    return nextStmt != null;
  }

  @Override
  public void replaceNext(Stmt stmt) {
    assert hasNextStmt();
    for (int i = 0; i < blockStmt.getNumStmts(); i++) {
      if (blockStmt.getStmt(i) == nextStmt) {
        blockStmt.setStmt(i, stmt);
      }
    }
  }

}


text:
<?php

class Request
{

    /**
     * Default values stored
     * @method __construct
     */
    public function __construct()
    {
        $this->user = new User();
    }

    /**
     * Sends request to function and returns json
     * @method json
     * @return string converted json value
     */
    public function json(): ?string
    {
        if ($this->user->getCsrf() !== $this->post('csrf')) {
            return $this->convert('CSRF token is not valid');
        }

        if (!$this->user->isLoggedIn() && $this->post('action') !== 'login' && $this->post('action') !== 'install' && $this->post('action') !== 'update') {
            return $this->convert('You need to be logged in to perform this action.');
        }

        switch ($this->post('action')) {
            case 'login' :
                return $this->convert($this->user->login($this->post('password'), $this->post('code')));
                break;
            case 'install' :
                return $this->convert($this->user->install($this->post('password'), $this->post('email')));
                break;
            case 'notepad-settings' :
                return $this->convert($this->user->notepad($this->post('notepad')));
                break;
            case 'main-settings' :
                return $this->convert(
                    $this->user->settings(
                        $this->post('timezone'),
                        $this->post('theme'),
                        $this->post('adminurl'),
                        $this->post('filter'),
                        $this->post('dompart')
                    )
                );
                break;
            case 'email-alert-settings':
                return $this->convert($this->user->emailAlertSettings(
                    $this->post('mailon'),
                    $this->post('email'),
                    $this->post('emailfrom')
                ));
                break;
            case 'telegram-alert-settings':
                return $this->convert($this->user->telegramAlertSettings(
                    $this->post('telegramon'),
                    $this->post('telegram_bottoken'),
                    $this->post('telegram_chatid')
                ));
                break;
            case 'callback-alert-settings':
                return $this->convert($this->user->callbackAlertSettings(
                    $this->post('callbackon'),
                    $this->post('callback_url')
                ));
                break;
            case 'password-settings' :
                return $this->convert(
                    $this->user->password(
                        $this->post('password'),
                        $this->post('newpassword'),
                        $this->post('newpassword2')
                    )
                );
                break;
            case 'payload-settings' :
                return $this->convert($this->user->payload($this->post('customjs')));
                break;
            case 'twofactor-settings' :
                return $this->convert($this->user->twofactor($this->post('secret'), $this->post('code')));
                break;
            case 'archive-report' :
                return $this->convert($this->user->archiveReport($this->post('id')));
                break;
            case 'delete-report' :
                return $this->convert($this->user->deleteReport($this->post('id')));
                break;
            case 'share-report' :
                return $this->convert($this->user->shareReport($this->post('reportid'), $this->post('domain'), $this->post('email')));
                break;
            case 'killswitch' :
                return $this->convert($this->user->killSwitch($this->post('pass')));
                break;
            case 'delete-selected' :
                return $this->convert($this->user->deleteSelected($this->post('ids')));
                break;
            case 'archive-selected' :
                return $this->convert($this->user->archiveSelected($this->post('ids'), $this->post('archive')));
                break;
            case 'update' :
                return $this->convert($this->user->update());
                break;
            case 'collecting' :
                return $this->convert($this->user->collecting($this->post('select')));
                break;
            case 'statistics':
                return $this->user->statistics();
            case 'getchatid':
                return $this->convert($this->user->getChatId($this->post('bottoken')));
            case 'remove-domain':
                return $this->convert($this->user->removeDomain($this->post('type'), $this->post('id')));
            case 'blacklist-domains':
                return $this->convert($this->user->addDomain('blacklist', $this->post('blacklist-domain')));
            case 'whitelist-domains':
                return $this->convert($this->user->addDomain('whitelist', $this->post('whitelist-domain')));
            case 'extract-pages':
                return $this->convert($this->user->addDomain('page', $this->post('path')));
            default :
                return $this->convert('This action does not exists.');
                break;
        }
    }

    /**
     * Get value of post
     * @method post
     * @param string $key key
     * @return string value
     */
    private function post($key)
    {
        return $_POST[$key] ?? '';
    }

    /**
     * Convert a string or array to a JSON string
     * @method post
     * @param array|string $array array or string
     * @return string json value
     */
    private function convert($array): string
    {
        if (!is_array($array)) {
            return json_encode(['echo' => $array]);
        }

        $array['echo'] = $array['echo'] ?? false;
        $array['redirect'] = $array['redirect'] ?? false;
        return json_encode($array);
    }

}


text:
package com.intellij.aop.jam;

import javax.annotation.Nonnull;

import com.intellij.aop.AopBundle;
import com.intellij.aop.AopIntroduction;
import com.intellij.aop.IntroductionManipulator;
import com.intellij.aop.psi.AopPointcutExpressionFile;
import com.intellij.codeHighlighting.HighlightDisplayLevel;
import com.intellij.codeInspection.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.ReadonlyStatusHandler;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.psi.xml.XmlAttributeValue;
import com.intellij.psi.xml.XmlElement;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;

/**
 * @author peter
 */
public class DeclareParentsInspection extends XmlSuppressableInspectionTool {
  private static final Logger LOG = Logger.getInstance("#com.intellij.aop.jam.DeclareParentsInspection");
  public boolean isEnabledByDefault() {
    return true;
  }

  @Nonnull
  public HighlightDisplayLevel getDefaultLevel() {
    return HighlightDisplayLevel.ERROR;
  }

  @Nls
  @Nonnull
  public String getDisplayName() {
    return AopBundle.message("inspection.display.name.declareParents");
  }

  @NonNls
  @Nonnull
  public String getShortName() {
    return "DeclareParentsInspection";
  }

  @Nonnull
  public PsiElementVisitor buildVisitor(@Nonnull final ProblemsHolder holder, final boolean isOnTheFly) {
    return new PsiElementVisitor() {
      @Override public void visitElement(final PsiElement element) {
        if (element instanceof PsiLiteralExpression || element instanceof XmlAttributeValue) {
          final PsiFile file = InjectedLanguageUtil.findInjectedPsiNoCommit(element.getContainingFile(), element.getTextRange().getStartOffset() + 1);
          if (file instanceof AopPointcutExpressionFile) {
            final IntroductionManipulator manipulator = ((AopPointcutExpressionFile)file).getAopModel().getIntroductionManipulator();
            if (manipulator == null) return;
            final AopIntroduction introduction = manipulator.getIntroduction();
            if (introduction == null) return;

            final PsiClass intf = introduction.getImplementInterface().getValue();
            if (intf == null && introduction.getImplementInterface().getStringValue() != null || intf != null && !intf.isInterface()) {
              registerProblem(manipulator.getInterfaceElement(), AopBundle.message("error.interface.expected"), holder);
              return;
            }
            if (intf == null) return;

            final PsiClass defaultImpl = introduction.getDefaultImpl().getValue();
            if (defaultImpl == null) {
              if (!(element instanceof XmlElement) && !ContainerUtil.findAll(intf.getAllMethods(), new Condition<PsiMethod>() {
                public boolean value(final PsiMethod method) {
                  return method.hasModifierProperty(PsiModifier.ABSTRACT);
                }
              }).isEmpty()) {
                holder.registerProblem(manipulator.getCommonProblemElement(), AopBundle.message("error.default.implementation.class.should.be.specified"),
                                       new LocalQuickFix() {
                  @Nonnull
                  public String getName() {
                    return AopBundle.message("quickfix.name.define.attribute", manipulator.getDefaultImplAttributeName());
                  }

                  @Nonnull
                  public String getFamilyName() {
                    return getName();
                  }

                  public void applyFix(@Nonnull final Project project, @Nonnull final ProblemDescriptor descriptor) {
                    try {
                      if (ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(descriptor.getPsiElement().getContainingFile().getVirtualFile()).hasReadonlyFiles()) return;
                      manipulator.defineDefaultImpl(project, descriptor);
                    }
                    catch (IncorrectOperationException e) {
                      LOG.error(e);
                    }
                  }
                });

              }
              return;
            }
            if (defaultImpl.hasModifierProperty(PsiModifier.ABSTRACT) || !defaultImpl.isInheritor(intf, true)) {
              final PsiElement defaultImplElement = manipulator.getDefaultImplElement();
              assert defaultImplElement != null;
              registerProblem(defaultImplElement, AopBundle.message("error.non.abstract.class.implemention.0.expected", intf.getQualifiedName()), holder);
            }
          }
        }
      }
    };
  }

  private static void registerProblem(final PsiElement element, final String descriptionTemplate, final ProblemsHolder holder) {
    final int startOffset = element.getTextRange().getStartOffset();
    int quotes = element.getText().startsWith("\"") ? 1 : 0;
    final TextRange range = TextRange.from(quotes, Math.max(element.getTextLength() - 2 * quotes, 1));
    holder.registerProblem(holder.getManager().createProblemDescriptor(element, range,
                                                                       descriptionTemplate, ProblemHighlightType.GENERIC_ERROR_OR_WARNING));
  }

  @Nls
  @Nonnull
  public String getGroupDisplayName() {
    return AopBundle.message("inspection.group.display.name.aop");
  }
}


text:
from .tasks import send_message as send_message_task

def send_message(slug, receiver, arguments={}, attachments=None):
    send_message_task.delay(slug, receiver, arguments, attachments)

def send_mass_message(slug, receivers, arguments={}):
    # TODO Implement mass messages
    pass