text:
Payment form

		<form id=payment>

			<fieldset>

				<legend>Your details</legend>

						Name

						<input id=name name=name type=text placeholder="First and last name" required autofocus>

						Email
						<input id=email name=email type=email placeholder="example@domain.com" required>

						Phone

						<input id=phone name=phone type=tel placeholder="Eg. +447500000000" required>

			</fieldset>

			<fieldset>

				<legend>Delivery address</legend>

						Address
						<textarea id=address name=address rows=5 required></textarea>

						Post code
						<input id=postcode name=postcode type=text required>

						Country
						<input id=country name=country type=text required>

			</fieldset>

			<fieldset>

				<legend>Card details</legend>

						<fieldset>

							<legend>Card type</legend>

									<input id=visa name=cardtype type=radio>
									VISA

									<input id=amex name=cardtype type=radio>
									AmEx

									<input id=mastercard name=cardtype type=radio>
									Mastercard

						</fieldset>

						Card number
						<input id=cardnumber name=cardnumber type=number required>

						Security code
						<input id=secure name=secure type=number required>

						Name on card
						<input id=namecard name=namecard type=text placeholder="Exact name as on the card" required>

			</fieldset>

			<fieldset>

				<button type=submit>Buy it!</button>

			</fieldset>

		</form>


text:
//go:build e2e
// +build e2e

package test

import (
	"context"
	"fmt"
	"testing"

	"github.com/tektoncd/pipeline/test/parse"

	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	knativetest "knative.dev/pkg/test"
	"knative.dev/pkg/test/helpers"
)

// TestEntrypointRunningStepsInOrder is an integration test that will
// verify attempt to the get the entrypoint of a container image
// that doesn't have a cmd defined. In addition to making sure the steps
// are executed in the order specified
func TestEntrypointRunningStepsInOrder(t *testing.T) {
	ctx := context.Background()
	ctx, cancel := context.WithCancel(ctx)
	defer cancel()
	c, namespace := setup(ctx, t)
	t.Parallel()

	knativetest.CleanupOnInterrupt(func() { tearDown(ctx, t, c, namespace) }, t.Logf)
	defer tearDown(ctx, t, c, namespace)

	epTaskRunName := helpers.ObjectNameForTest(t)

	t.Logf("Creating TaskRun in namespace %s", namespace)
	if _, err := c.V1beta1TaskRunClient.Create(ctx, parse.MustParseV1beta1TaskRun(t, fmt.Sprintf(`
metadata:
  name: %s
  namespace: %s
spec:
  taskSpec:
    steps:
    - image: busybox
      workingDir: /workspace
      script: 'sleep 3 && touch foo'
    - image: ubuntu
      workingDir: /workspace
      script: 'ls foo'
`, epTaskRunName, namespace)), metav1.CreateOptions{}); err != nil {
		t.Fatalf("Failed to create TaskRun: %s", err)
	}

	t.Logf("Waiting for TaskRun in namespace %s to finish successfully", namespace)
	if err := WaitForTaskRunState(ctx, c, epTaskRunName, TaskRunSucceed(epTaskRunName), "TaskRunSuccess"); err != nil {
		t.Errorf("Error waiting for TaskRun to finish successfully: %s", err)
	}

}

redpajama_set_name: RedPajamaGithub


text:
<?php

class Solr4Service_Core extends SolrService_Core {

	/**
	 * Replace underlying commit function to remove waitFlush in 4.0+, since it's been deprecated and 4.4 throws errors
	 * if you pass it
	 */
	public function commit($expungeDeletes = false, $waitFlush = null, $waitSearcher = true, $timeout = 3600) {
		if ($waitFlush) {
			user_error('waitFlush must be false when using Solr 4.0+' . E_USER_ERROR);
		}

		$expungeValue = $expungeDeletes ? 'true' : 'false';
		$searcherValue = $waitSearcher ? 'true' : 'false';

		$rawPost = '<commit expungeDeletes="' . $expungeValue . '" waitSearcher="' . $searcherValue . '" />';
		return $this->_sendRawPost($this->_updateUrl, $rawPost, $timeout);
	}
}

class Solr4Service extends SolrService {
	private static $core_class = 'Solr4Service_Core';
}


text:
@implementation CCSQLiteTest

+ (void) SQLiteTest {
    NSLog(@"SQLiteTest");

    NSString *path = nil;
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
    path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES)  lastObject];
#else
    path = NSTemporaryDirectory() ;
#endif

    path = [path stringByAppendingPathComponent:CCSQLiteTestDB];

    if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
        [[NSFileManager defaultManager] removeItemAtPath:path error: nil];
    }

    CCSQLite *SQLite = [CCSQLite databaseWithPath: path];

    if ([SQLite open]) {
        BOOL result = [SQLite executeUpdate: @"create table if not exists t_student (id integer primary key autoincrement, name text not NULL, age integer not NULL);"];
        if (result) {
            NSLog(@"create table t_student ok");
            NSLog(@"path : %@", path);
       }
    }

    [SQLite executeUpdate:@"insert into t_student (name, age) values (?, ?);", @"cc test 0", @0];
    [SQLite executeUpdate:@"insert into t_student (name, age) values (?, ?);", @"cc test 1", @1];
    [SQLite executeUpdateWithFormat:@"insert into t_student (name, age) values (%@, %i);", @"cc test 2", 2000];

//    [SQLite executeUpdate:@"delete from t_student where id = ?", @1];

    CCResultSet *resultSet = [SQLite executeQuery:@"select * from t_student;"];
    while ([resultSet next]) {
        int idNum = [resultSet intForColumn:@"id"];
        NSString *name = [resultSet objectForColumnName:@"name"];
        int age = [resultSet intForColumn:@"age"];

        NSLog(@"id = %d name = %@ age = %d", idNum, name, age);
    }

//    [SQLite executeUpdate:@"drop table if exists t_student;"];

    NSString *sql = @"create table bulktest1 (id integer primary key autoincrement, x text);"
    "create table bulktest2 (id integer primary key autoincrement, y text);"
    "create table bulktest3 (id integer primary key autoincrement, z text);"
    "insert into bulktest1 (x) values ('XXX');"
    "insert into bulktest2 (y) values ('YYY');"
    "insert into bulktest3 (z) values ('ZZZ');";

    BOOL success = [SQLite executeStatements:sql];

    if (success) {
        NSLog(@"success");
    }

    sql = @"select count(*) as count from bulktest1;"
    "select count(*) as count from bulktest2;"
    "select count(*) as count from bulktest3;";

    [SQLite executeStatements:sql withResultBlock:^int(NSDictionary *resultsDictionary) {
        NSInteger count = [resultsDictionary[@"count"] integerValue];
        NSLog(@"count = %ld", count);
        return 0;
    }];

    [SQLite close];

    [[CCKeyValue defaultKeyValueWithPath:path] setObject:@"CC china 1112" key:@"china key"];
    [[CCKeyValue defaultKeyValueWithPath:path] setObject:@"CCVV" key:@"CC"];

    id test = [[CCKeyValue defaultKeyValueWithPath:path] objectForKey:@"CC"];
    NSLog(@"test 1 : %@", test);

    [[CCKeyValue defaultKeyValueWithPath:path] setObject:@[@1, @2, @3] key:@"CA"];

    test = [[CCKeyValue defaultKeyValueWithPath:path] objectForKey:@"CA"];
    NSLog(@"test 2 : %@", test);

    CCSQLiteQueue *queue = [CCSQLiteQueue databaseQueueWithPath:path];

    __block NSInteger index = 3000;
    [queue inDatabase:^(CCSQLite *db) {
        while (index < 3100) {
            index++;
            [db executeUpdate:@"insert into t_student (name, age) values (?, ?);", [NSString stringWithFormat:@"cc test inDatabase %ld", index], @(index)];
        }

    }];

    [queue inTransaction:^(CCSQLite *db, BOOL *rollback) {
        NSLog(@"rollback NO");
        while (index < 3150) {
            index++;
            [db executeUpdate:@"insert into t_student (name, age) values (?, ?);", [NSString stringWithFormat:@"cc test inTransaction %ld", index], @(index)];
        }
    }];

    [queue inTransaction:^(CCSQLite *db, BOOL *rollback) {
        NSLog(@"rollback YES");
        while (index < 3200) {
            index++;
            [db executeUpdate:@"insert into t_student (name, age) values (?, ?);", [NSString stringWithFormat:@"cc test inTransaction %ld", index], @(index)];

            if (index == 3188) {
                *rollback = YES;
                return ;
            }
        }
    }];

    CCKeyValue *kv = [CCKeyValue defaultKeyValueWithPath:path];
    kv.valueType = CCKeyValueTypeJson;

    NSData * data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"CCJSON" ofType:@"json"]];

    [kv setObject:data key:@"jsonkey"];

    id CCJSON =  [kv objectForKey:@"jsonkey"];

    if ([CCJSON isKindOfClass:[NSArray class]]) {
        NSArray *list = CCJSON;

        [list enumerateObjectsUsingBlock:^(NSDictionary *d, NSUInteger idx, BOOL * _Nonnull stop) {
            NSLog(@"%@\n", d);
        }];
    }
}

@end


text:
using Surging.Core.CPlatform.Routing;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Linq;

namespace Surging.Core.CPlatform.Filters.Implementation
{
    public abstract class AuthorizationFilterAttribute : FilterAttribute,IAuthorizationFilter, IFilter
    {
        public virtual bool OnAuthorization(ServiceRouteContext context)
        {
            return context.Route.Address.Any(p => p.Token == context.InvokeMessage.Token || p.DisableAuth==true);
        }

        public void ExecuteAuthorizationFilterAsync(ServiceRouteContext serviceRouteContext, CancellationToken cancellationToken)
        {
            var result = OnAuthorization(serviceRouteContext);
            if (!result)
            {
                serviceRouteContext.ResultMessage.ExceptionMessage = "令牌验证失败.";
            }
        }
    }
}


text:
              <?php echo form_open('login/signup_check','id="signup_form"'); ?>

注册

            	   用户名
                <input type="text" id="signup_username" name="signup_username" />

                密码
                <input type="password" id="signup_password" name="signup_password" />

                确认密码
                <input type="password" id="confirm_password" name="confirm_password" />

                e-mail
                <input type="text" id="signup_email" name="signup_email" />

                <input type="submit" id="signup_submit" name="signup_submit" />
            </form>

<?php if (isset($error)) { ?>

        <?php  } ?>


text:
RBCascadeNode is an AST node for cascaded messages (e.g., "self print1 ; print2").

Instance Variables:
	messages	<SequenceableCollection of: RBMessageNode>	the messages
	semicolons	<SequenceableCollection of: Integer>	positions of the ; between messages


text:
angular.module('os.biospecimen.models.visitnameprinter', ['os.common.models'])
  .factory('VisitNamePrinter', function(osModel, $http, Alerts) {
    var VisitNamePrinter = osModel('visit-name-printer');

    VisitNamePrinter.printNames = function(detail) {
      return $http.post(VisitNamePrinter.url(), detail).then(
        function(resp) {
          Alerts.success("visits.names_print_job_created", {jobId: resp.data.id});
          return resp.data;
        }
      );
    };

    return VisitNamePrinter;
  });


text:
package graphview

import (
	"testing"
	"time"

	"github.com/gonum/graph"
	"github.com/gonum/graph/concrete"

	kapi "k8s.io/kubernetes/pkg/api"
	"k8s.io/kubernetes/pkg/api/unversioned"

	osgraph "github.com/openshift/origin/pkg/api/graph"
	osgraphtest "github.com/openshift/origin/pkg/api/graph/test"
	kubeedges "github.com/openshift/origin/pkg/api/kubegraph"
	kubegraph "github.com/openshift/origin/pkg/api/kubegraph/nodes"
	buildapi "github.com/openshift/origin/pkg/build/api"
	buildedges "github.com/openshift/origin/pkg/build/graph"
	buildgraph "github.com/openshift/origin/pkg/build/graph/nodes"
	deployapi "github.com/openshift/origin/pkg/deploy/api"
	deployedges "github.com/openshift/origin/pkg/deploy/graph"
	deploygraph "github.com/openshift/origin/pkg/deploy/graph/nodes"
)

func TestServiceGroup(t *testing.T) {
	g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/new-app.yaml")
	if err != nil {
		t.Fatalf("unexpected error: %v", err)
	}

	kubeedges.AddAllExposedPodTemplateSpecEdges(g)
	buildedges.AddAllInputOutputEdges(g)
	deployedges.AddAllTriggerEdges(g)

	coveredNodes := IntSet{}

	serviceGroups, coveredByServiceGroups := AllServiceGroups(g, coveredNodes)
	coveredNodes.Insert(coveredByServiceGroups.List()...)

	bareDCPipelines, coveredByDCs := AllDeploymentConfigPipelines(g, coveredNodes)
	coveredNodes.Insert(coveredByDCs.List()...)

	bareBCPipelines, coveredByBCs := AllImagePipelinesFromBuildConfig(g, coveredNodes)
	coveredNodes.Insert(coveredByBCs.List()...)

	if e, a := 1, len(serviceGroups); e != a {
		t.Errorf("expected %v, got %v", e, a)
	}
	if e, a := 0, len(bareDCPipelines); e != a {
		t.Errorf("expected %v, got %v", e, a)
	}
	if e, a := 0, len(bareBCPipelines); e != a {
		t.Errorf("expected %v, got %v", e, a)
	}

	if e, a := 1, len(serviceGroups[0].DeploymentConfigPipelines); e != a {
		t.Errorf("expected %v, got %v", e, a)
	}
	if e, a := 1, len(serviceGroups[0].DeploymentConfigPipelines[0].Images); e != a {
		t.Errorf("expected %v, got %v", e, a)
	}
}

func TestBareRCGroup(t *testing.T) {
	g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/bare-rc.yaml")
	if err != nil {
		t.Fatalf("unexpected error: %v", err)
	}

	kubeedges.AddAllExposedPodTemplateSpecEdges(g)
	kubeedges.AddAllExposedPodEdges(g)
	kubeedges.AddAllManagedByRCPodEdges(g)

	coveredNodes := IntSet{}

	serviceGroups, coveredByServiceGroups := AllServiceGroups(g, coveredNodes)
	coveredNodes.Insert(coveredByServiceGroups.List()...)

	bareRCs, coveredByRCs := AllReplicationControllers(g, coveredNodes)
	coveredNodes.Insert(coveredByRCs.List()...)

	if e, a := 1, len(serviceGroups); e != a {
		t.Errorf("expected %v, got %v", e, a)
	}
	if e, a := 1, len(bareRCs); e != a {
		t.Errorf("expected %v, got %v", e, a)
	}
}

func TestBareDCGroup(t *testing.T) {
	g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/bare-dc.yaml")
	if err != nil {
		t.Fatalf("unexpected error: %v", err)
	}

	kubeedges.AddAllExposedPodTemplateSpecEdges(g)
	buildedges.AddAllInputOutputEdges(g)
	deployedges.AddAllTriggerEdges(g)

	coveredNodes := IntSet{}

	serviceGroups, coveredByServiceGroups := AllServiceGroups(g, coveredNodes)
	coveredNodes.Insert(coveredByServiceGroups.List()...)

	bareDCPipelines, coveredByDCs := AllDeploymentConfigPipelines(g, coveredNodes)
	coveredNodes.Insert(coveredByDCs.List()...)

	bareBCPipelines, coveredByBCs := AllImagePipelinesFromBuildConfig(g, coveredNodes)
	coveredNodes.Insert(coveredByBCs.List()...)

	if e, a := 0, len(serviceGroups); e != a {
		t.Errorf("expected %v, got %v", e, a)
	}
	if e, a := 1, len(bareDCPipelines); e != a {
		t.Errorf("expected %v, got %v", e, a)
	}
	if e, a := 0, len(bareBCPipelines); e != a {
		t.Errorf("expected %v, got %v", e, a)
	}

	if e, a := 1, len(bareDCPipelines[0].Images); e != a {
		t.Errorf("expected %v, got %v", e, a)
	}
}

func TestBareBCGroup(t *testing.T) {
	g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/bare-bc.yaml")
	if err != nil {
		t.Fatalf("unexpected error: %v", err)
	}

	kubeedges.AddAllExposedPodTemplateSpecEdges(g)
	buildedges.AddAllInputOutputEdges(g)
	deployedges.AddAllTriggerEdges(g)

	coveredNodes := IntSet{}

	serviceGroups, coveredByServiceGroups := AllServiceGroups(g, coveredNodes)
	coveredNodes.Insert(coveredByServiceGroups.List()...)

	bareDCPipelines, coveredByDCs := AllDeploymentConfigPipelines(g, coveredNodes)
	coveredNodes.Insert(coveredByDCs.List()...)

	bareBCPipelines, coveredByBCs := AllImagePipelinesFromBuildConfig(g, coveredNodes)
	coveredNodes.Insert(coveredByBCs.List()...)

	if e, a := 0, len(serviceGroups); e != a {
		t.Errorf("expected %v, got %v", e, a)
	}
	if e, a := 0, len(bareDCPipelines); e != a {
		t.Errorf("expected %v, got %v", e, a)
	}
	if e, a := 1, len(bareBCPipelines); e != a {
		t.Errorf("expected %v, got %v", e, a)
	}
}

func TestGraph(t *testing.T) {
	g := osgraph.New()
	now := time.Now()
	builds := []buildapi.Build{
		{
			ObjectMeta: kapi.ObjectMeta{
				Name:              "build1-1-abc",
				Labels:            map[string]string{buildapi.BuildConfigLabelDeprecated: "build1"},
				CreationTimestamp: unversioned.NewTime(now.Add(-10 * time.Second)),
			},
			Status: buildapi.BuildStatus{
				Phase: buildapi.BuildPhaseFailed,
			},
		},
		{
			ObjectMeta: kapi.ObjectMeta{
				Name:              "build1-2-abc",
				Labels:            map[string]string{buildapi.BuildConfigLabelDeprecated: "build1"},
				CreationTimestamp: unversioned.NewTime(now.Add(-5 * time.Second)),
			},
			Status: buildapi.BuildStatus{
				Phase: buildapi.BuildPhaseComplete,
			},
		},
		{
			ObjectMeta: kapi.ObjectMeta{
				Name:              "build1-3-abc",
				Labels:            map[string]string{buildapi.BuildConfigLabelDeprecated: "build1"},
				CreationTimestamp: unversioned.NewTime(now.Add(-15 * time.Second)),
			},
			Status: buildapi.BuildStatus{
				Phase: buildapi.BuildPhasePending,
			},
		},
	}
	for i := range builds {
		buildgraph.EnsureBuildNode(g, &builds[i])
	}

	buildgraph.EnsureBuildConfigNode(g, &buildapi.BuildConfig{
		ObjectMeta: kapi.ObjectMeta{Namespace: "default", Name: "build1"},
		Spec: buildapi.BuildConfigSpec{
			Triggers: []buildapi.BuildTriggerPolicy{
				{
					ImageChange: &buildapi.ImageChangeTrigger{},
				},
			},
			BuildSpec: buildapi.BuildSpec{
				Strategy: buildapi.BuildStrategy{
					Type: buildapi.SourceBuildStrategyType,
					SourceStrategy: &buildapi.SourceBuildStrategy{
						From: kapi.ObjectReference{Kind: "ImageStreamTag", Name: "test:base-image"},
					},
				},
				Output: buildapi.BuildOutput{
					To: &kapi.ObjectReference{Kind: "ImageStreamTag", Name: "other:tag1"},
				},
			},
		},
	})
	bcTestNode := buildgraph.EnsureBuildConfigNode(g, &buildapi.BuildConfig{
		ObjectMeta: kapi.ObjectMeta{Namespace: "default", Name: "test"},
		Spec: buildapi.BuildConfigSpec{
			BuildSpec: buildapi.BuildSpec{
				Output: buildapi.BuildOutput{
					To: &kapi.ObjectReference{Kind: "ImageStreamTag", Name: "other:base-image"},
				},
			},
		},
	})
	buildgraph.EnsureBuildConfigNode(g, &buildapi.BuildConfig{
		ObjectMeta: kapi.ObjectMeta{Namespace: "default", Name: "build2"},
		Spec: buildapi.BuildConfigSpec{
			BuildSpec: buildapi.BuildSpec{
				Output: buildapi.BuildOutput{
					To: &kapi.ObjectReference{Kind: "DockerImage", Name: "mycustom/repo/image:tag2"},
				},
			},
		},
	})
	kubegraph.EnsureServiceNode(g, &kapi.Service{
		ObjectMeta: kapi.ObjectMeta{Namespace: "default", Name: "svc-is-ignored"},
		Spec: kapi.ServiceSpec{
			Selector: nil,
		},
	})
	kubegraph.EnsureServiceNode(g, &kapi.Service{
		ObjectMeta: kapi.ObjectMeta{Namespace: "default", Name: "svc1"},
		Spec: kapi.ServiceSpec{
			Selector: map[string]string{
				"deploymentconfig": "deploy1",
			},
		},
	})
	kubegraph.EnsureServiceNode(g, &kapi.Service{
		ObjectMeta: kapi.ObjectMeta{Namespace: "default", Name: "svc2"},
		Spec: kapi.ServiceSpec{
			Selector: map[string]string{
				"deploymentconfig": "deploy1",
				"env":              "prod",
			},
		},
	})
	deploygraph.EnsureDeploymentConfigNode(g, &deployapi.DeploymentConfig{
		ObjectMeta: kapi.ObjectMeta{Namespace: "other", Name: "deploy1"},
		Triggers: []deployapi.DeploymentTriggerPolicy{
			{
				ImageChangeParams: &deployapi.DeploymentTriggerImageChangeParams{
					From:           kapi.ObjectReference{Namespace: "default", Name: "other"},
					ContainerNames: []string{"1", "2"},
					Tag:            "tag1",
				},
			},
		},
		Template: deployapi.DeploymentTemplate{
			ControllerTemplate: kapi.ReplicationControllerSpec{
				Template: &kapi.PodTemplateSpec{
					ObjectMeta: kapi.ObjectMeta{
						Labels: map[string]string{
							"deploymentconfig": "deploy1",
							"env":              "prod",
						},
					},
					Spec: kapi.PodSpec{
						Containers: []kapi.Container{
							{
								Name:  "1",
								Image: "mycustom/repo/image",
							},
							{
								Name:  "2",
								Image: "mycustom/repo/image2",
							},
							{
								Name:  "3",
								Image: "mycustom/repo/image3",
							},
						},
					},
				},
			},
		},
	})
	deploygraph.EnsureDeploymentConfigNode(g, &deployapi.DeploymentConfig{
		ObjectMeta: kapi.ObjectMeta{Namespace: "default", Name: "deploy2"},
		Template: deployapi.DeploymentTemplate{
			ControllerTemplate: kapi.ReplicationControllerSpec{
				Template: &kapi.PodTemplateSpec{
					ObjectMeta: kapi.ObjectMeta{
						Labels: map[string]string{
							"deploymentconfig": "deploy2",
							"env":              "dev",
						},
					},
					Spec: kapi.PodSpec{
						Containers: []kapi.Container{
							{
								Name:  "1",
								Image: "someother/image:v1",
							},
						},
					},
				},
			},
		},
	})

	kubeedges.AddAllExposedPodTemplateSpecEdges(g)
	buildedges.AddAllInputOutputEdges(g)
	buildedges.AddAllBuildEdges(g)
	deployedges.AddAllTriggerEdges(g)
	deployedges.AddAllDeploymentEdges(g)

	t.Log(g)

	for _, edge := range g.Edges() {
		if g.EdgeKinds(edge).Has(osgraph.UnknownEdgeKind) {
			t.Errorf("edge reported unknown kind: %#v", edge)
		}
	}

	// imagestreamtag default/other:base-image
	istID := 0
	for _, node := range g.Nodes() {
		if g.Name(node) == "ImageStreamTag|default/other:base-image" {
			istID = node.ID()
			break
		}
	}

	edge := g.Edge(concrete.Node(bcTestNode.ID()), concrete.Node(istID))
	if edge == nil {
		t.Fatalf("failed to find edge between %d and %d", bcTestNode.ID(), istID)
	}
	if len(g.SubgraphWithNodes([]graph.Node{edge.From(), edge.To()}, osgraph.ExistingDirectEdge).Edges()) != 1 {
		t.Fatalf("expected one edge")
	}
	if len(g.SubgraphWithNodes([]graph.Node{edge.To(), edge.From()}, osgraph.ExistingDirectEdge).Edges()) != 1 {
		t.Fatalf("expected one edge")
	}

	if e := g.Edge(concrete.Node(bcTestNode.ID()), concrete.Node(istID)); e == nil {
		t.Errorf("expected edge for %d-%d", bcTestNode.ID(), istID)
	}

	coveredNodes := IntSet{}

	serviceGroups, coveredByServiceGroups := AllServiceGroups(g, coveredNodes)
	coveredNodes.Insert(coveredByServiceGroups.List()...)

	bareDCPipelines, coveredByDCs := AllDeploymentConfigPipelines(g, coveredNodes)
	coveredNodes.Insert(coveredByDCs.List()...)

	if len(bareDCPipelines) != 1 {
		t.Fatalf("unexpected pipelines: %#v", bareDCPipelines)
	}
	if len(coveredNodes) != 10 {
		t.Fatalf("unexpected covered nodes: %#v", coveredNodes)
	}

	for _, bareDCPipeline := range bareDCPipelines {
		t.Logf("from %s", bareDCPipeline.Deployment.Name)
		for _, path := range bareDCPipeline.Images {
			t.Logf("  %v", path)
		}
	}

	if len(serviceGroups) != 3 {
		t.Errorf("unexpected service groups: %#v", serviceGroups)
	}
	for _, serviceGroup := range serviceGroups {
		t.Logf("service %s", serviceGroup.Service.Name)
		indent := "  "

		for _, deployment := range serviceGroup.DeploymentConfigPipelines {
			t.Logf("%sdeployment %s", indent, deployment.Deployment.Name)
			for _, image := range deployment.Images {
				t.Logf("%s  image %s", indent, image.Image.ImageSpec())
				if image.Build != nil {
					if image.LastSuccessfulBuild != nil {
						t.Logf("%s    built at %s", indent, image.LastSuccessfulBuild.Build.CreationTimestamp)
					} else if image.LastUnsuccessfulBuild != nil {
						t.Logf("%s    build %v at %s", indent, image.LastUnsuccessfulBuild.Build.Status, image.LastUnsuccessfulBuild.Build.CreationTimestamp)
					}
					for _, b := range image.ActiveBuilds {
						t.Logf("%s    build %s %v", indent, b.Build.Name, b.Build.Status)
					}
				}
			}
		}
	}
}


text:
/*global angular, describe, it, jasmine, expect, beforeEach, inject */
'use strict';

describe('Testing ngEmphasis Directive', function () {

    var
        $compile,
        $scope,
        $httpBackend,
        ngEmphasisConfig;

    beforeEach(module('ng-emphasis'));

    beforeEach(inject(function(_$compile_, _$rootScope_, _ngEmphasisConfig_) {
        $compile = _$compile_;
        $scope = _$rootScope_;
        ngEmphasisConfig = _ngEmphasisConfig_;
    }));

    describe('Testing ngEmphasis Functionality', function() {

        it('should highlight the text found in scope given search terms found in scope', function() {
            $scope.text = 'Here is some text';
            $scope.search = 'some is';

            var template = $compile('
{{ text }}
')($scope);
            $scope.$digest();
            var html = template.html();

            expect(html).toEqual('Here is some text');
        });
        it('should highlight the text found in scope given search terms passed by string', function() {
            $scope.text = 'Here is some text';

            var template = $compile('
{{ text }}
')($scope);
            $scope.$digest();
            var html = template.html();

            expect(html).toEqual('Here is some text');
        });
        it('should highlight the text passed by string given search terms found in scope', function() {
            $scope.search = 'some is';

            var template = $compile('
Here is some text
')($scope);
            $scope.$digest();
            var html = template.html();

            expect(html).toEqual('Here is some text');
        });
        it('should highlight the text passed by string given search terms passed by string', function() {
            var template = $compile('
Here is some text
')($scope);
            $scope.$digest();
            var html = template.html();

            expect(html).toEqual('Here is some text');
        });
        it('should set CSS class name', function() {
            ngEmphasisConfig.setCssClass('highlight');

            var template = $compile('
highlight this
')($scope);
            $scope.$digest();
            var html = template.html();

            expect(html).toEqual('highlight this');
        });

    });

});


text:
Dewasa ini perkembangan environment frontend sangatlah pesat, dimana banyak browser sudah mengimplementasikan DOM/BOM APIs dengan baik. Kita tidak perlu lagi belajar jQuery dari nol untuk keperluan manipulasi DOM atau events. Disaat yang sama; dengan berterimakasih kepada library frontend terkini seperti React, Angular dan Vue; Memanipulasi DOM secara langsung telah menjadi anti-pattern alias sesuatu yang tidak perlu dilakukan. Dengan kata lain, jQuery sekarang menjadi semakin tidak diperlukan. Projek ini memberikan informasi mengenai metode alternatif dari jQuery untuk implementasi Native dengan support untuk browser IE 10+.

## Daftar Isi

1. [Query Selector](#query-selector)
1. [CSS & Style](#css-style)
1. [DOM Manipulation](#dom-manipulation)
1. [Ajax](#ajax)
1. [Events](#events)
1. [Utilities](#utilities)
1. [Translation](#translation)
1. [Browser Support](#browser-yang-di-support)

## Query Selector

Untuk selector-selector umum seperti class, id atau attribute, kita dapat menggunakan `document.querySelector` atau `document.querySelectorAll` sebagai pengganti. Perbedaan diantaranya adalah:
* `document.querySelector` mengembalikan elemen pertama yang cocok
* `document.querySelectorAll` mengembalikan semua elemen yang cocok sebagai NodeList. Hasilnya bisa dikonversikan menjadi Array `[].slice.call(document.querySelectorAll(selector) || []);`
* Bila tidak ada hasil pengembalian elemen yang cocok, jQuery akan mengembalikan `[]` sedangkan DOM API akan mengembalikan `null`. Mohon diperhatikan mengenai Null Pointer Exception. Anda juga bisa menggunakan operator `||` untuk set nilai awal jika hasil pencarian tidak ditemukan : `document.querySelectorAll(selector) || []`

> Perhatian: `document.querySelector` dan `document.querySelectorAll` sedikit **LAMBAT**. Silahkan menggunakan `getElementById`, `document.getElementsByClassName` atau `document.getElementsByTagName` jika anda menginginkan tambahan performa.

- [1.0](#1.0)  Query by selector

  ```js
  // jQuery
  $('selector');

  // Native
  document.querySelectorAll('selector');
  ```

- [1.1](#1.1)  Query by class

  ```js
  // jQuery
  $('.class');

  // Native
  document.querySelectorAll('.class');

  // or
  document.getElementsByClassName('class');
  ```

- [1.2](#1.2)  Query by id

  ```js
  // jQuery
  $('#id');

  // Native
  document.querySelector('#id');

  // or
  document.getElementById('id');
  ```

- [1.3](#1.3)  Query menggunakan attribute

  ```js
  // jQuery
  $('a[target=_blank]');

  // Native
  document.querySelectorAll('a[target=_blank]');
  ```

- [1.4](#1.4)  Pencarian.

  + Mencari nodes

    ```js
    // jQuery
    $el.find('li');

    // Native
    el.querySelectorAll('li');
    ```

  + Mencari body

    ```js
    // jQuery
    $('body');

    // Native
    document.body;
    ```

  + Mencari Attribute

    ```js
    // jQuery
    $el.attr('foo');

    // Native
    e.getAttribute('foo');
    ```

  + Mencari data attribute

    ```js
    // jQuery
    $el.data('foo');

    // Native
    // gunakan getAttribute
    el.getAttribute('data-foo');
    // anda juga bisa menggunakan `dataset` bila anda perlu support IE 11+
    el.dataset['foo'];
    ```

- [1.5](#1.5)  Elemen-elemen Sibling/Previous/Next

  + Elemen Sibling

    ```js
    // jQuery
    $el.siblings();

    // Native
    [].filter.call(el.parentNode.children, function(child) {
      return child !== el;
    });
    ```

  + Elemen Previous

    ```js
    // jQuery
    $el.prev();

    // Native
    el.previousElementSibling;

    ```

  + Elemen Next

    ```js
    // next
    $el.next();
    el.nextElementSibling;
    ```

- [1.6](#1.6)  Closest

  Mengembalikan elemen pertama yang cocok dari selector yang digunakan, dengan cara mencari mulai dari elemen-sekarang sampai ke document.

  ```js
  // jQuery
  $el.closest(queryString);

  // Native
  function closest(el, selector) {
    const matchesSelector = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector;

    while (el) {
      if (matchesSelector.call(el, selector)) {
        return el;
      } else {
        el = el.parentElement;
      }
    }
    return null;
  }
  ```

- [1.7](#1.7)  Parents Until

  Digunakan untuk mendapatkan "ancestor" dari setiap elemen yang ditemukan. Namun tidak termasuk elemen-sekarang yang didapat dari pencarian oleh selector, DOM node, atau object jQuery.

  ```js
  // jQuery
  $el.parentsUntil(selector, filter);

  // Native
  function parentsUntil(el, selector, filter) {
    const result = [];
    const matchesSelector = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector;

    // match start from parent
    el = el.parentElement;
    while (el && !matchesSelector.call(el, selector)) {
      if (!filter) {
        result.push(el);
      } else {
        if (matchesSelector.call(el, filter)) {
          result.push(el);
        }
      }
      el = el.parentElement;
    }
    return result;
  }
  ```

- [1.8](#1.8)  Form

  + Input/Textarea

    ```js
    // jQuery
    $('#my-input').val();

    // Native
    document.querySelector('#my-input').value;
    ```

  + Get index of e.currentTarget between `.radio`

    ```js
    // jQuery
    $(e.currentTarget).index('.radio');

    // Native
    [].indexOf.call(document.querySelectAll('.radio'), e.currentTarget);
    ```

- [1.9](#1.9)  Iframe Contents

  `$('iframe').contents()` mengembalikan `contentDocument`

  + Iframe contents

    ```js
    // jQuery
    $iframe.contents();

    // Native
    iframe.contentDocument;
    ```

  + Iframe Query

    ```js
    // jQuery
    $iframe.contents().find('.css');

    // Native
    iframe.contentDocument.querySelectorAll('.css');
    ```

**[⬆ back to top](#daftar-isi)**

## CSS Style

- [2.1](#2.1)  CSS

  + Get style

    ```js
    // jQuery
    $el.css("color");

    // Native
    // PERHATIAN: ada bug disini, dimana fungsi ini akan mengembalikan nilai 'auto' bila nilai dari atribut style adalah 'auto'
    const win = el.ownerDocument.defaultView;
    // null artinya tidak mengembalikan pseudo styles
    win.getComputedStyle(el, null).color;
    ```

  + Set style

    ```js
    // jQuery
    $el.css({ color: "#ff0011" });

    // Native
    el.style.color = '#ff0011';
    ```

  + Get/Set Styles

    Mohon dicatat jika anda ingin men-set banyak style bersamaan, anda dapat menemukan referensi di metode [setStyles](https://github.com/oneuijs/oui-dom-utils/blob/master/src/index.js#L194) pada package oui-dom-utils

  + Add class

    ```js
    // jQuery
    $el.addClass(className);

    // Native
    el.classList.add(className);
    ```

  + Remove class

    ```js
    // jQuery
    $el.removeClass(className);

    // Native
    el.classList.remove(className);
    ```

  + has class

    ```js
    // jQuery
    $el.hasClass(className);

    // Native
    el.classList.contains(className);
    ```

  + Toggle class

    ```js
    // jQuery
    $el.toggleClass(className);

    // Native
    el.classList.toggle(className);
    ```

- [2.2](#2.2)  Width & Height

  Secara teori, width dan height identik, contohnya Height:

  + Window height

    ```js
    // window height
    $(window).height();
    // without scrollbar, behaves like jQuery
    window.document.documentElement.clientHeight;
    // with scrollbar
    window.innerHeight;
    ```

  + Document height

    ```js
    // jQuery
    $(document).height();

    // Native
    document.documentElement.scrollHeight;
    ```

  + Element height

    ```js
    // jQuery
    $el.height();

    // Native
    function getHeight(el) {
      const styles = this.getComputedStyles(el);
      const height = el.offsetHeight;
      const borderTopWidth = parseFloat(styles.borderTopWidth);
      const borderBottomWidth = parseFloat(styles.borderBottomWidth);
      const paddingTop = parseFloat(styles.paddingTop);
      const paddingBottom = parseFloat(styles.paddingBottom);
      return height - borderBottomWidth - borderTopWidth - paddingTop - paddingBottom;
    }
    // accurate to integer(when `border-box`, it's `height`; when `content-box`, it's `height + padding + border`)
    el.clientHeight;
    // accurate to decimal(when `border-box`, it's `height`; when `content-box`, it's `height + padding + border`)
    el.getBoundingClientRect().height;
    ```

- [2.3](#2.3)  Position & Offset

  + Position

    ```js
    // jQuery
    $el.position();

    // Native
    { left: el.offsetLeft, top: el.offsetTop }
    ```

  + Offset

    ```js
    // jQuery
    $el.offset();

    // Native
    function getOffset (el) {
      const box = el.getBoundingClientRect();

      return {
        top: box.top + window.pageYOffset - document.documentElement.clientTop,
        left: box.left + window.pageXOffset - document.documentElement.clientLeft
      }
    }
    ```

- [2.4](#2.4)  Scroll Top

  ```js
  // jQuery
  $(window).scrollTop();

  // Native
  (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;
  ```

**[⬆ back to top](#daftar-isi)**

## DOM Manipulation

- [3.1](#3.1)  Remove
  ```js
  // jQuery
  $el.remove();

  // Native
  el.parentNode.removeChild(el);
  ```

- [3.2](#3.2)  Text

  + Get text

    ```js
    // jQuery
    $el.text();

    // Native
    el.textContent;
    ```

  + Set text

    ```js
    // jQuery
    $el.text(string);

    // Native
    el.textContent = string;
    ```

- [3.3](#3.3)  HTML

  + Get HTML

    ```js
    // jQuery
    $el.html();

    // Native
    el.innerHTML;
    ```

  + Set HTML

    ```js
    // jQuery
    $el.html(htmlString);

    // Native
    el.innerHTML = htmlString;
    ```

- [3.4](#3.4)  Append

  Menambahkan elemen-anak setelah anak terakhir dari elemen-parent

  ```js
  // jQuery
  $el.append("<div id='container'>hello</div>");

  // Native
  let newEl = document.createElement('div');
  newEl.setAttribute('id', 'container');
  newEl.innerHTML = 'hello';
  el.appendChild(newEl);
  ```

- [3.5](#3.5)  Prepend

  ```js
  // jQuery
  $el.prepend("<div id='container'>hello</div>");

  // Native
  let newEl = document.createElement('div');
  newEl.setAttribute('id', 'container');
  newEl.innerHTML = 'hello';
  el.insertBefore(newEl, el.firstChild);
  ```

- [3.6](#3.6)  insertBefore

  Memasukkan node baru sebelum elemen yang dipilih.

  ```js
  // jQuery
  $newEl.insertBefore(queryString);

  // Native
  const target = document.querySelector(queryString);
  target.parentNode.insertBefore(newEl, target);
  ```

- [3.7](#3.7)  insertAfter

  Memasukkan node baru sesudah elemen yang dipilih.

  ```js
  // jQuery
  $newEl.insertAfter(queryString);

  // Native
  const target = document.querySelector(queryString);
  target.parentNode.insertBefore(newEl, target.nextSibling);
  ```

**[⬆ back to top](#daftar-isi)**

## Ajax

Gantikan dengan [fetch](https://github.com/camsong/fetch-ie8) dan [fetch-jsonp](https://github.com/camsong/fetch-jsonp)

**[⬆ back to top](#daftar-isi)**

## Events

Untuk penggantian secara menyeluruh dengan namespace dan delegation, rujuk ke https://github.com/oneuijs/oui-dom-events

- [5.1](#5.1)  Bind event dengan menggunakan on

  ```js
  // jQuery
  $el.on(eventName, eventHandler);

  // Native
  el.addEventListener(eventName, eventHandler);
  ```

- [5.2](#5.2)  Unbind event dengan menggunakan off

  ```js
  // jQuery
  $el.off(eventName, eventHandler);

  // Native
  el.removeEventListener(eventName, eventHandler);
  ```

- [5.3](#5.3)  Trigger

  ```js
  // jQuery
  $(el).trigger('custom-event', {key1: 'data'});

  // Native
  if (window.CustomEvent) {
    const event = new CustomEvent('custom-event', {detail: {key1: 'data'}});
  } else {
    const event = document.createEvent('CustomEvent');
    event.initCustomEvent('custom-event', true, true, {key1: 'data'});
  }

  el.dispatchEvent(event);
  ```

**[⬆ back to top](#daftar-isi)**

## Utilities

- [6.1](#6.1)  isArray

  ```js
  // jQuery
  $.isArray(range);

  // Native
  Array.isArray(range);
  ```

- [6.2](#6.2)  Trim

  ```js
  // jQuery
  $.trim(string);

  // Native
  string.trim();
  ```

- [6.3](#6.3)  Object Assign

  Extend, use object.assign polyfill https://github.com/ljharb/object.assign

  ```js
  // jQuery
  $.extend({}, defaultOpts, opts);

  // Native
  Object.assign({}, defaultOpts, opts);
  ```

- [6.4](#6.4)  Contains

  ```js
  // jQuery
  $.contains(el, child);

  // Native
  el !== child && el.contains(child);
  ```

**[⬆ back to top](#daftar-isi)**

## Terjemahan

* [한국어](./README.ko-KR.md)
* [简体中文](./README.zh-CN.md)
* [Bahasa Melayu](./README-my.md)
* [Bahasa Indonesia](./README-id.md)
* [Português(PT-BR)](./README.pt-BR.md)
* [Tiếng Việt Nam](./README-vi.md)
* [Русский](./README-ru.md)
* [Türkçe](./README-tr.md)

## Browser yang di Support

![Chrome](https://raw.github.com/alrra/browser-logos/master/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/firefox/firefox_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/internet-explorer/internet-explorer_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/opera/opera_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/safari/safari_48x48.png)
--- | --- | --- | --- | --- |
Latest ✔ | Latest ✔ | 10+ ✔ | Latest ✔ | 6.1+ ✔ |

# License

MIT


text:
package io.imgn.srd5.db.model;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatNullPointerException;

import org.junit.jupiter.api.Test;

import java.util.Arrays;
import java.util.List;

class LanguageTest {

  private static final String COMMON = "common";
  private static final String DWARVISH = "dwarvish";
  private static final String ELVISH = "elvish";
  private static final List<String> LANGUAGES = Arrays.asList(COMMON, DWARVISH, ELVISH);

  @Test
  void create() {
    for(String key: LANGUAGES) {
      Language language = Language.create(key);
      assertThat(language.key()).isEqualTo(key);
    }

    assertThatNullPointerException().isThrownBy(() -> {
      Language.create(null);
    });
  }

  @Test
  void _toString() {
    for (String key : LANGUAGES) {
      Language language = Language.create(key);
      assertThat(language.toString()).contains(key);
      LANGUAGES.forEach(k -> {
        if (!key.equals(k)) {
          assertThat(language.toString()).doesNotContain(k);
        }
      });
    }
  }

  @Test
  void _equals_hashCode() {
    Language a = Language.create(COMMON);
    Language b = Language.create(COMMON);
    Language c = Language.create(DWARVISH);

    for (Language language : Arrays.asList(a, b, c)) {
      assertThat(language).isNotEqualTo(null);
      assertThat(language).isEqualTo(language);
      assertThat(language.hashCode()).isEqualTo(language.hashCode());
    }

    assertThat(a).isEqualTo(b);
    assertThat(b).isEqualTo(a);
    assertThat(a.hashCode()).isEqualTo(b.hashCode());
    assertThat(b.hashCode()).isEqualTo(a.hashCode());

    assertThat(a).isNotEqualTo(c);
    assertThat(b).isNotEqualTo(c);
    assertThat(c).isNotEqualTo(a);
    assertThat(c).isNotEqualTo(b);
  }
}


text:
class TransactionsController < ApplicationController
  def create
    @ticket = Ticket.create!(create_params)
    srv = PuntoPagosRails::TransactionService.new(@ticket)
    srv.create ? redirect_to(srv.process_url) : render(:error)
  end

  def notification
    response = PuntoPagosRails::TransactionService.notificate(params, request.headers)
    render json: response
  end

  def success
    @ticket = PuntoPagosRails::TransactionService.ticket_by_token(params)
  end

  def error
    @ticket = PuntoPagosRails::TransactionService.failed_ticket_by_token(params)
  end

  private

  def create_params
    params.require(:ticket).permit(:amount)
  end
end


text:
const fs = require('fs'), //For reading/writing to/from files
    Command = require('./commandClass.js'); //The command class

//Global Command Object in which all commands are loaded into(Can be acessed anywhere in the program)
commands = {};
//Global Command Alias object where all command alias objects are loaded into
commandAliases = {};

//Reads directory of commands assigning the command name as the file name(exluding the file extension) and the command type based on the folder the command was loaded from
exports.load = function() {
    return new Promise((resolve, reject) => {
        fs.readdir(`${__dirname}/../commands/`, (err, folders) => {
            if (err) reject(`Error reading commands directory: ${err}`);
            else if (folders) {
                folders.forEach(folder => {
                    fs.readdir(`${__dirname}/../commands/${folder}/`, (error, loaded) => {
                        if (error) reject(`Error reading commands directory: ${error}`);
                        //Skips folder if it is empty
                        else if (loaded.length < 1) console.log(errorC(folder + ' was empty and has been skipped.'))
                        else if (loaded) {
                            for (let name of loaded) {
                                //Assigning Command Files to the Global Command Object
                                commands[name.replace('.js', '')] = new Command(name.replace('.js', ''), folder, require(`${__dirname}/../commands/${folder}/${name}`))
                            }
                            for (let command in commands) {
                                //Assigning Command Aliases to the Glboal Command Alias Object
                                if (commands[command].aliases) commands[command].aliases.forEach(alias => {
                                    commandAliases[alias] = command;
                                })
                            }
                        }
                    });
                });
                //Resolves Promise when all commands loaded
                resolve();
            }
        });
    });
}


text:
var $__Object$defineProperties = Object.defineProperties;

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  var Bitmap = function() {
    "use strict";

    function Bitmap(src, width, height) {
      this.image = new Image();
      this.image.src = src;
      this.width = width;
      this.height = height;
    }

    return Bitmap;
  }();

  module.exports = Bitmap;
},{}],2:[function(require,module,exports){
  Utils = require('./utils');

  var Camera = function() {
    "use strict";

    function Camera(canvas, resolution, focalLength) {
      this.ctx = canvas.getContext('2d');
      this.width = canvas.width = window.innerWidth * 0.5;
      this.height = canvas.height = window.innerHeight * 0.5;
      this.resolution = resolution;
      this.spacing = this.width / resolution;
      this.focalLength = focalLength || 0.8;
      this.fov = Math.PI * .4;
      this.range = Utils.MOBILE ? 8 : 14;
      this.lightRange = 1.75;
      this.maxLightRange = 8;
      this.scale = (this.width + this.height) / 1200;
    }

    $__Object$defineProperties(Camera.prototype, {
      render: {
        value: function(player, map) {
          if(player.hasFlashlight && this.lightRange != 8) {
            this.lightRange += 0.2;
          }

          var currentQuadrant = Utils.quadrant(player.x, player.y, map.size);
          var skybox = map['skybox'+currentQuadrant];

          if(window.WHITE_SKYBOX_ENABLED){
            skybox = map.whiteSkybox;
          }

          if(!window.FREAKOUT_ENABLED) {
            this.drawSky(player.direction, skybox, map.light);
          }

          this.drawColumns(player, map);

          this.ctx.save();
          this.drawSprites(player,map);
          this.ctx.restore();

          if(window.MAP_ENABLED) {
            this.drawMiniMap(map, player);
          }
          // this.drawWeapon(player.weapon, player.paces);
        },

        enumerable: false,
        writable: true
      },

      drawSprites: {
        value: function(player, map) {

          var screenWidth = this.width;
          var screenHeight = this.height;
          var resolution = this.resolution;
          var screenRatio = screenWidth / this.fov;
          var camera = this;
          var ctx = this.ctx;

          var sprites = Array.prototype.slice.call(map.items)

          sprites = sprites.map(function(sprite){

            var distX = sprite.x - player.x;
            var distY = sprite.y - player.y;
            var width = sprite.width * screenWidth / sprite.distanceFromPlayer;
            var height = sprite.height * screenHeight /  sprite.distanceFromPlayer;
            var angleToPlayer = Math.atan2(distY,distX);
            var angleRelativeToPlayerView = player.direction - angleToPlayer;
            var top = (screenHeight / 2) * (1 + 1 / sprite.distanceFromPlayer) - height;

            if(angleRelativeToPlayerView >= Utils.CIRCLE / 2){
              angleRelativeToPlayerView -= Utils.CIRCLE;
            }

            var cameraXOffset = ( camera.width / 2 ) - (screenRatio * angleRelativeToPlayerView);
            var numColumns = width / screenWidth * resolution;
            var firstColumn = Math.floor( (cameraXOffset - width/2 ) / screenWidth * resolution);

            sprite.distanceFromPlayer = Math.sqrt( Math.pow( distX, 2) + Math.pow( distY, 2) );

            sprite.render = {
              width: width,
              height: height,
              angleToPlayer: angleRelativeToPlayerView,
              cameraXOffset: cameraXOffset,
              distanceFromPlayer: sprite.distanceFromPlayer,
              numColumns: numColumns,
              firstColumn: firstColumn,
              top: top
            };

            return sprite;
          })
          // Sort sprites by distance?

          camera.ctx.save();
          for (var column = 0; column < this.resolution; column++) {
            this.drawSpriteColumn(player, map, column, sprites);
          }
          camera.ctx.restore();
        },

        enumerable: false,
        writable: true
      },

      drawSpriteColumn: {
        value: function(player, map, column, sprites) {
          var ctx = this.ctx;
          var left = Math.floor(column * this.spacing);
          var width = Math.ceil(this.spacing);
          var angle = this.fov * (column / this.resolution - 0.5);
          var columnWidth = this.width / this.resolution;
          var sprite;
          var spriteIsInColumn;
          var textureX;

          for(var i = 0; i < sprites.length; i++){
            sprite = sprites[i];
            spriteIsInColumn =  left > sprite.render.cameraXOffset - ( sprite.render.width / 2 ) && left < sprite.render.cameraXOffset + ( sprite.render.width / 2 );

            if(spriteIsInColumn) {

              textureX = Math.floor( sprite.texture.width / sprite.render.numColumns * ( column - sprite.render.firstColumn ) );
              ctx.fillStyle = 'black';
              ctx.globalAlpha = 1;

              var brightness = Math.max(sprite.distanceFromPlayer / this.lightRange - map.light, 0) * 100;
              sprite.texture.image.style.webkitFilter = 'brightness(' + brightness + '%)';
              sprite.texture.image.style.filter = 'brightness(' + brightness  + '%)';
              ctx.drawImage(sprite.texture.image, textureX, 0, 1, sprite.texture.height, left, sprite.render.top, width, sprite.render.height);
            }
          }

        },

        enumerable: false,
        writable: true
      },

      drawSky: {
        value: function(direction, sky, ambient) {
          var width = sky.width * (this.height / sky.height) * 2;
          var left = (direction / Utils.CIRCLE) * -width;

          this.ctx.save();
          this.ctx.drawImage(sky.image, left, 0, width, this.height);
          if (left < width - this.width) {
            this.ctx.drawImage(sky.image, left + width, 0, width, this.height);
          }
          if (ambient > 0) {
            this.ctx.fillStyle = '#ffffff';
            this.ctx.globalAlpha = ambient * 0.1;
            this.ctx.fillRect(0, this.height * 0.5, this.width, this.height * 0.5);
          }
          this.ctx.restore();
        },

        enumerable: false,
        writable: true
      },

      drawColumns: {
        value: function(player, map) {
          this.ctx.save();
          for (var column = 0; column < this.resolution; column++) {
            var x = column / this.resolution - 0.5;
            var angle = Math.atan2(x, this.focalLength);
            var ray = map.cast(player, player.direction + angle, this.range);
            this.drawColumn(column, ray, angle, map, player);
          }
          this.ctx.restore();
        },

        enumerable: false,
        writable: true
      },

      drawColumn: {
        value: function(column, ray, angle, map, player) {
          var ctx = this.ctx;

          var currentQuadrant = Utils.quadrant(player.x, player.y, map.size);
          var texture = map['wallTexture'+currentQuadrant];

          var left = Math.floor(column * this.spacing);
          var width = Math.ceil(this.spacing);
          var hit = -1;

          while (++hit < ray.length && ray[hit].height <= 0);

          for (var s = ray.length - 1; s >= 0; s--) {
            var step = ray[s];

            var rainDrops = Math.pow(Math.random(), 3) * s;
            var rain = (rainDrops > 0) && this.project(0.1, angle, step.distance);

            if (s === hit) {
              var textureX = Math.floor(texture.width * step.offset);
              var wall = this.project(step.height, angle, step.distance);

              ctx.globalAlpha = 1;

              if(window.WALL_TEXTURE_ENABLED) {
                ctx.drawImage(texture.image, textureX, 0, 1, texture.height, left, wall.top, width, wall.height);
              }

              ctx.fillStyle = '#000000';
              ctx.globalAlpha = Math.max((step.distance + step.shading) / this.lightRange - map.light, 0);
              ctx.fillRect(left, wall.top, width, wall.height);
            }

            ctx.fillStyle = '#ffffff';
            ctx.globalAlpha = 0.15;

            if(window.RAIN_ENABLED) {
              while (--rainDrops > 0) ctx.fillRect(left, Math.random() * rain.top, 1, rain.height);
            }
          }
        },

        enumerable: false,
        writable: true
      },

      project: {
        value: function(height, angle, distance) {
          var z = distance * Math.cos(angle);
          var wallHeight = this.height * height / z;
          var bottom = this.height / 2 * (1 + 1 / z);
          return {
            top: bottom - wallHeight,
            height: wallHeight
          };
        },

        enumerable: false,
        writable: true
      },

      drawMiniMap: {
        value: function(map, player) {
          var ctx = this.ctx;
          var mapWidth = this.width * 0.25;
          var mapHeight = mapWidth;
          var x = this.width - mapWidth - 20;
          var y = 20;
          var blockWidth = mapWidth / map.size;
          var blockHeight = mapHeight / map.size;
          var playerX = player.x / map.size * mapWidth;
          var playerY = player.y / map.size * mapWidth;
          var origFillStyle = ctx.fillStyle;
          var wallIndex;
          var triangleX = x + playerX;
          var triangleY = y + playerY;

          // Draw Map
          ctx.save();
          ctx.globalAlpha = .3;
          ctx.fillRect(x, y, mapWidth, mapHeight);
          ctx.globalAlpha = .4;
          ctx.fillStyle = '#ffffff';

          for (var row = 0; row < map.size; row++) {
            for (var col = 0; col < map.size; col++) {
              wallIndex = row * map.size + col;
              if (map.wallGrid[wallIndex]) {
                ctx.fillRect(x + (blockWidth * col), y + (blockHeight * row), blockWidth, blockHeight);
              }
            }
          }

          // Draw Items on Map
          ctx.save();
          for (var i = 0; i < map.items.length; i++){
            if(map.items[i]){
              ctx.fillStyle = map.items[i].color || 'blue';
              ctx.globalAlpha = .8;
              ctx.fillRect(x + (blockWidth * map.items[i].x) + blockWidth * .25, y + (blockHeight * map.items[i].y) + blockWidth * .25, blockWidth * .5, blockHeight * .5);
            }
          }

          // Draw Player
          ctx.restore();

          ctx.globalAlpha = 1;
          ctx.fillStyle = '#FF0000';
          ctx.moveTo(triangleX,triangleY);
          ctx.translate(triangleX,triangleY);

          ctx.rotate(player.direction - Math.PI * .5);
          ctx.beginPath();
          ctx.lineTo(-2, -3); // bottom left of triangle
          ctx.lineTo(0, 2); // tip of triangle
          ctx.lineTo(2,-3); // bottom right of triangle
          ctx.fill();

          ctx.restore();
        },

        enumerable: false,
        writable: true
      }
    });

    return Camera;
  }();

  module.exports = Camera;
},{"./utils":11}],3:[function(require,module,exports){
  var Controls = function() {
    "use strict";

    function Controls() {
      this.codes  = { 37: 'left', 39: 'right', 38: 'forward', 40: 'backward' };
      this.states = { 'left': false, 'right': false, 'forward': false, 'backward': false };
      document.addEventListener('keydown', this.onKey.bind(this, true), false);
      document.addEventListener('keyup', this.onKey.bind(this, false), false);
    }

    $__Object$defineProperties(Controls.prototype, {
      onKey: {
        value: function(val, e) {
          var state = this.codes[e.keyCode];
          if (typeof state === 'undefined') return;
          this.states[state] = val;
          e.preventDefault && e.preventDefault();
          e.stopPropagation && e.stopPropagation();
        },

        enumerable: false,
        writable: true
      }
    });

    return Controls;
  }();

  module.exports = Controls;
},{}],4:[function(require,module,exports){
  var EventBus = function() {
    "use strict";

    function EventBus(src, width, height) {
      this.stack = new Array();
    }

    $__Object$defineProperties(EventBus.prototype, {
      trigger: {
        value: function(eventName) {
          for(var i = 0; i < this.stack.length; i++) {
            var item = this.stack[i];
            if(item.eventName == eventName) {
              item.callback.apply(item.context);
            }
          }
        },

        enumerable: false,
        writable: true
      },

      on: {
        value: function(eventName, context, callback) {
          this.stack.push({
            eventName: eventName,
            context: context,
            callback: callback
          })
        },

        enumerable: false,
        writable: true
      }
    });

    return EventBus;
  }();

  module.exports = EventBus;
},{}],5:[function(require,module,exports){
// Vendor Libs Modernizr, Soundcloud, Firebase

// Game Variables
window.LIGHTING_ENABLED = false;
window.RAIN_ENABLED = false;
window.FREAKOUT_ENABLED = false;
window.MAP_ENABLED = true;
window.WALL_TEXTURE_ENABLED = true;
window.WHITE_SKYBOX_ENABLED = false;
window.LOG_POSITION = false;

// Import Libraries
Utils = require('./utils');
Player = require('./player');
Map = require('./map');
Controls = require('./controls');
Bitmap = require('./bitmap');
Camera = require('./camera');
EventBus = require('./event-bus');
MessageQueue = require('./message-queue');
GameLoop = require('./gameloop');

// Start the Game Loop
var display = document.getElementById('display');
var player = new Player(30.5, 30.5, Math.PI * 1.25);
var map = new Map(32);
var controls = new Controls();
var camera = new Camera(display, Utils.MOBILE ? 160 : 320, 0.8);
var eventBus = new EventBus();
var messageQueue = new MessageQueue();
var loop = new GameLoop();

loop.start(function frame(seconds) {
  map.update(seconds);
  player.update(controls.states, map, seconds, messageQueue);
  messageQueue.update();
  camera.render(player, map);
});

messageQueue.pushNotification('You can always learn more empathy', 'system', 500);

// Load the Map
var mapImage = new Image();
var mapData = []

mapImage.onload = function() {
  var decoder = document.createElement('canvas');
  decoder.width = mapImage.width
  decoder.height = mapImage.height

  if (decoder.height != decoder.width) {
    throw new Error('map.png is not square.  Please use a square image.')
  }

  var context = decoder.getContext('2d');
  context.drawImage(mapImage, 0, 0);
  var imageData = context.getImageData(0, 0, decoder.width, decoder.height);

  for (var i = 0; i < imageData.data.length/4; i++) {
    mapData[i] = imageData.data[(i*4)+3] > 100 ? 1 : 0;
  }

  for (var i = 0; i < mapData.length; i++) {
    map.wallGrid[i] = mapData[i]
  }

  // map.addItem({
  //   x: 15,
  //   y: 14,
  //   width: .35,
  //   height: .8,
  //   texture: new Bitmap('assets/item-flashlight.png', 350, 800)
  // });

  // Flash Light
  // Map

  // Abilities:
    // Learn Empathy
    // Disconnect

  // Pickups
  map.addItem({
    x: 11.5,
    y: 25.5,
    width: 0.8,
    height: 1,
    type: "pickup",
    name: "freakout",
    texture: new Bitmap('assets/pickup-freakout.png', 1024, 1024)
  });

  map.addItem({
    x: 11.5,
    y: 11.5,
    width: 0.8,
    height: 1,
    type: "pickup",
    name: "lucid",
    texture: new Bitmap('assets/pickup-lucid.png', 1024, 1024)
  });

  map.addItem({
    x: 3,
    y: 30.5,
    width: 0.8,
    height: 1,
    type: "pickup",
    name: "flashlight",
    texture: new Bitmap('assets/pickup-flashlight.png', 1024, 1024)
  });

  // Art
  map.addItem({
    x: 3,
    y: 28,
    width: 0.8,
    height: 1,
    type: "art",
    texture: new Bitmap('assets/art-guru.png', 1024, 1024)
  });

  // Messages
  map.addItem({
    x: 29.5,
    y: 26,
    width: .8,
    height: 1,
    type: "message",
    texture: new Bitmap('assets/message-welcome.png', 1024, 1024)
  });

  // Portals
  map.addItem({
    x: 16,
    y: 30.5,
    width: 0.8,
    height: 1,
    texture: new Bitmap('assets/portal.png', 1024, 1024),
    type: "portal",
    transition: "city"
  });

  map.addItem({
    x: 15.5,
    y: 16,
    width: 0.8,
    height: 1,
    texture: new Bitmap('assets/portal.png', 1024, 1024),
    type: "portal",
    transition: "wood"
  });

  // Tracks
  map.addItem({
    x: 23.5,
    y: 23.5,
    width: .8,
    height: 1,
    texture: new Bitmap('assets/item-helix.png', 1024, 1024),
    audio: null,
    type: "track",
    trackName: "Helix",
    playing: true
  });

  map.addItem({
    x: 8.5,
    y: 8.5,
    width: .8,
    height: 1,
    texture: new Bitmap('assets/item-tva.png', 1024, 1024),
    audio: null,
    type: "track",
    trackName: "Tva Fontainer",
    playing: false
  });

  eventBus.trigger('gameLoaded');
}

// Add Range Map
Number.prototype.rangeMap = function ( in_min , in_max , out_min , out_max ) {
  number = ( this - in_min ) * ( out_max - out_min ) / ( in_max - in_min ) + out_min;
  if(number < 0){
    number = 0
  }
  return number;
}

var gameLoaded = function() {
  console.log('gameHasLoaded');
}

eventBus.on('gameLoaded', window, gameLoaded);

// Load the map.
mapImage.src = "assets/map.png";

// http://www.html5rocks.com/en/tutorials/webaudio/games/#toc-3d

// Soundcloud Stuff
SC.initialize({
  client_id: "e0db2a99463bf202ff2c9448cb174a4b",
  redirect_uri: "http://planete.siloarts.net",
});

SC.stream("/tracks/159679823", function(sound){
  console.log('Track 1 Ready.');
  window.TRACK_ONE = sound;
});

SC.stream("/tracks/159679816", function(sound){
  console.log('Track 2 Ready.');
  window.TRACK_TWO = sound;
});

SC.stream("/tracks/83743704", function(sound){
  console.log('Ambience Track Ready.');
  window.TRACK_RAIN = sound;
  window.TRACK_RAIN.setVolume(75);
  window.TRACK_RAIN.play();
});

// SC.stream("/tracks/293", {
//   autoPlay: true,
//   ontimedcomments: function(comments){
//     console.log(comments[0].body);
//   }
// });

},{"./bitmap":1,"./camera":2,"./controls":3,"./event-bus":4,"./gameloop":6,"./map":8,"./message-queue":9,"./player":10,"./utils":11}],6:[function(require,module,exports){
  var GameLoop = function() {
    "use strict";

    function GameLoop() {
      this.frame = this.frame.bind(this);
      this.lastTime = 0;
      this.callback = function() {};
    }

    $__Object$defineProperties(GameLoop.prototype, {
      start: {
        value: function(callback) {
          this.callback = callback;
          requestAnimationFrame(this.frame);
        },

        enumerable: false,
        writable: true
      },

      frame: {
        value: function(time) {
          var seconds = (time - this.lastTime) / 1000;
          this.lastTime = time;
          if (seconds < 0.2) this.callback(seconds);
          requestAnimationFrame(this.frame);
        },

        enumerable: false,
        writable: true
      }
    });

    return GameLoop;
  }();

  module.exports = GameLoop;
},{}],7:[function(require,module,exports){
  var Item = function() {
    "use strict";

    function Item(attributes) {
      for(var prop in attributes){
        this[prop] = attributes[prop];
      }
    }

    return Item;
  }();

  module.exports = Item;
},{}],8:[function(require,module,exports){
  Bitmap = require('./bitmap');
  Item = require('./item');

  var Map = function() {
    "use strict";

    function Map(size) {
      this.size = size;
      this.wallGrid = new Uint8Array(size * size);

      this.whiteSkybox = new Bitmap('assets/skybox-white.jpg', 2844, 914);
      this.skybox0 = new Bitmap('assets/skybox.jpg', 2844, 914);
      this.skybox1 = new Bitmap('assets/skybox-tiles.jpg', 2844, 914);
      this.skybox2 = new Bitmap('assets/skybox-city.jpg', 2844, 914);
      this.skybox3 = new Bitmap('assets/skybox.jpg', 2844, 914);

      // Ideas

      // PNG Walls look cool
      // Neon Everything

      this.wallTexture0 = new Bitmap('assets/wall_texture_wood.jpg', 1024, 1024);
      this.wallTexture1 = new Bitmap('assets/wall_texture_tile.jpg', 1024, 1024);
      this.wallTexture2 = new Bitmap('assets/wall_texture_brick.jpg', 1024, 1024);
      this.wallTexture3 = new Bitmap('assets/wall_texture_stone.jpg', 1024, 1024);

      this.light = 0;
      this.items = new Array();
    }

    $__Object$defineProperties(Map.prototype, {
      get: {
        value: function(x, y) {
          x = Math.floor(x);
          y = Math.floor(y);
          if (x < 0 || x > this.size - 1 || y < 0 || y > this.size - 1) return -1;
          return this.wallGrid[y * this.size + x];
        },

        enumerable: false,
        writable: true
      },

      randomize: {
        value: function() {
          for (var i = 0; i < this.size * this.size; i++) {
            this.wallGrid[i] = Math.random() < 0.3 ? 1 : 0;
          }
        },

        enumerable: false,
        writable: true
      },

      addWallAt: {
        value: function(x, y) {
          var gridIndex = (y * this.size) + x

          if(this.wallGrid[gridIndex] == 0) {
            this.wallGrid[gridIndex] = 1
            return true
          }else{
            console.log('there is a wall there already')
            return false
          }
        },

        enumerable: false,
        writable: true
      },

      removeWallAt: {
        value: function(x, y) {
          var gridIndex = (y * this.size) + x

          if(this.wallGrid[gridIndex] == 1) {
            this.wallGrid[gridIndex] = 0
            return true
          }else{
            console.log('there is no wall to remove')
            return false
          }
        },

        enumerable: false,
        writable: true
      },

      addItem: {
        value: function(x, y, texture) {
          this.items.push(new Item(x, y, texture));
        },

        enumerable: false,
        writable: true
      },

      removeItem: {
        value: function(index) {
          this.items.splice(index, 1);
        },

        enumerable: false,
        writable: true
      },

      cast: {
        value: function(point, angle, range) {
          var self = this;
          var sin = Math.sin(angle);
          var cos = Math.cos(angle);
          var noWall = { length2: Infinity };

          return ray({ x: point.x, y: point.y, height: 0, distance: 0 });

          function ray(origin) {
            var stepX = step(sin, cos, origin.x, origin.y);
            var stepY = step(cos, sin, origin.y, origin.x, true);
            var nextStep = stepX.length2 < stepY.length2
              ? inspect(stepX, 1, 0, origin.distance, stepX.y)
              : inspect(stepY, 0, 1, origin.distance, stepY.x);

            if (nextStep.distance > range) return [origin];
            return [origin].concat(ray(nextStep));
          }

          function step(rise, run, x, y, inverted) {
            if (run === 0) return noWall;
            var dx = run > 0 ? Math.floor(x + 1) - x : Math.ceil(x - 1) - x;
            var dy = dx * (rise / run);
            return {
              x: inverted ? y + dy : x + dx,
              y: inverted ? x + dx : y + dy,
              length2: dx * dx + dy * dy
            };
          }

          function inspect(step, shiftX, shiftY, distance, offset) {
            var dx = cos < 0 ? shiftX : 0;
            var dy = sin < 0 ? shiftY : 0;
            step.height = self.get(step.x - dx, step.y - dy);
            step.distance = distance + Math.sqrt(step.length2);
            if (shiftX) step.shading = cos < 0 ? 2 : 0;
            else step.shading = sin < 0 ? 2 : 1;
            step.offset = offset - Math.floor(offset);
            return step;
          }
        },

        enumerable: false,
        writable: true
      },

      update: {
        value: function(seconds) {
          if(window.LIGHTNING_ENABLED) {
            if (this.light > 0) this.light = Math.max(this.light - 10 * seconds, 0);
            else if (Math.random() * 5 < seconds) this.light = 2;
          }
        },

        enumerable: false,
        writable: true
      }
    });

    return Map;
  }();

  module.exports = Map;
},{"./bitmap":1,"./item":7}],9:[function(require,module,exports){
  var MessageQueue = function() {
    "use strict";

    function MessageQueue() {
      this.messages = {
                        system: []
                      };
    }

    $__Object$defineProperties(MessageQueue.prototype, {
      pushNotification: {
        value: function(message, type, timer) {
          this.messages[type].push({message: message, timeRemaining: timer});
        },

        enumerable: false,
        writable: true
      },

      update: {
        value: function() {
          for (var queueName in this.messages) {
            this.buildDOM(queueName, this.messages[queueName]);
          }
        },

        enumerable: false,
        writable: true
      },

      buildDOM: {
        value: function(queueName, queue) {
          var container = document.getElementById(queueName+"-messages");

          while (container.hasChildNodes()){
            container.removeChild(container.lastChild);
          }

          for (var index in queue) {
            var messageData = queue[index];
            var text = messageData['message'];
            var message = document.createElement("div");
            message.textContent = text
            container.appendChild(message);
            messageData['timeRemaining']--

            if (messageData['timeRemaining'] <= 0){
              queue.splice(index, 1);
            }
          }
        },

        enumerable: false,
        writable: true
      }
    });

    return MessageQueue;
  }();

  module.exports = MessageQueue;
},{}],10:[function(require,module,exports){
  Utils = require('./utils');

  var Player = function() {
    "use strict";

    function Player(x, y, direction) {
      this.x = x;
      this.y = y;
      this.direction = direction;
      this.hasFlashlight = false;
      this.paces = 0;
    }

    $__Object$defineProperties(Player.prototype, {
      rotate: {
        value: function(angle) {
          this.direction = (this.direction + angle + Utils.CIRCLE) % (Utils.CIRCLE);
        },

        enumerable: false,
        writable: true
      },

      walk: {
        value: function(distance, map) {
          var dx = Math.cos(this.direction) * distance;
          var dy = Math.sin(this.direction) * distance;
          if (map.get(this.x + dx, this.y) <= 0) this.x += dx;
          if (map.get(this.x, this.y + dy) <= 0) this.y += dy;
          this.paces += distance;
        },

        enumerable: false,
        writable: true
      },

      update: {
        value: function(controls, map, seconds, messageQueue) {
          if (controls.left) this.rotate(-Math.PI * seconds);
          if (controls.right) this.rotate(Math.PI * seconds);
          if (controls.forward) this.walk(3 * seconds, map);
          if (controls.backward) this.walk(-3 * seconds, map);

          if(Utils.quadrant(this.x, this.y, map.size) == 2) {
            window.RAIN_ENABLED = true
          }else {
            window.RAIN_ENABLED = false
          }

          for (var i = 0; i < map.items.length; i++) {
            var item = map.items[i];

            var distX = item.x - this.x;
            var distY = item.y - this.y;
            var distanceFromPlayer = Math.sqrt( Math.pow( distX, 2) + Math.pow( distY, 2) );

            // @@@ ITEMS @@@ //

            // HANDLE NON COLLISION CALS HERE

            if (item.type == "track") {

              switch(item.trackName) {
                case "Helix":
                  item.audio = window.TRACK_ONE;
                  break;
                case "Tva Fontainer":
                  item.audio = window.TRACK_TWO;
                  break;

              }
              if (item.audio) {
                item.audio.setVolume(distanceFromPlayer.rangeMap(0, 17, 100, 0));
              }
            }

            // ON COLISION
            if(distanceFromPlayer < 0.2) {
              // Portals
              if (item.type == "portal") {
                switch(item.transition) {
                  case "city":
                    if(map.addWallAt(17, 30)){
                      messageQueue.pushNotification("It is raining in the city", 'system', 300);
                    }
                    break;
                  case "wood":
                    console.log("wood!")
                    break;
                }
              }

              // Pickups
              if (item.type == "pickup") {
                switch(item.name) {
                  case "flashlight":
                    this.hasFlashlight = true;
                    map.removeItem(i);
                    messageQueue.pushNotification("You have found a flashlight;", 'system', 300);
                    break;
                  case "map":
                    console.log("MAP!")
                    break;
                  case "freakout":
                    window.FREAKOUT_ENABLED = true;
                    messageQueue.pushNotification("You are feeling nautious.", 'system', 300);

                    map.removeItem(i);

                    window.setTimeout(function(){
                      messageQueue.pushNotification("You are feeling better now.", 'system', 300);
                      window.FREAKOUT_ENABLED = false;
                    }, 24000)
                    break;

                  case "lucid":
                    window.WALL_TEXTURE_ENABLED = false;
                    window.WHITE_SKYBOX_ENABLED = true;

                    messageQueue.pushNotification("Your thoughts are very clear.", 'system', 300);

                    map.removeItem(i);

                    window.setTimeout(function(){
                      messageQueue.pushNotification("Your senses have dulled.", 'system', 300);
                      window.WALL_TEXTURE_ENABLED = true;
                      window.WHITE_SKYBOX_ENABLED = false;
                    }, 15000)
                    break;
                }
              }

              // Messages
              if (item.type == "message") {
                map.removeItem(i);
              }

              // Tracks
              if (item.type == "track") {
                if(!item.audio.playState) {
                  item.audio.play();
                  messageQueue.pushNotification(item.trackName+" Has started playing", 'system', 300);

                  if (map.removeWallAt(22, 21)) {
                    map.addWallAt(28, 21);
                    messageQueue.pushNotification('A door has been opened;', 'system', 300);
                  }
                }
              }
            }

          }

          if (window.LOG_POSITION) {
            console.log("postion:" + this.x +" "+ this.y)
          }
        },

        enumerable: false,
        writable: true
      }
    });

    return Player;
  }();

  module.exports = Player;
},{"./utils":11}],11:[function(require,module,exports){
module.exports = {
  CIRCLE: Math.PI * 2,
  MOBILE: /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent),

  quadrant: function quadrant(x, y, mapSize) {
    var xDif = (x / mapSize);
    var yDif = (y / mapSize);

    if(xDif >= 0.5 ) {
      if( yDif >= 0.5 )
        return 3;
      else
        return 1;
    }
    else {
      if( yDif >= 0.5 )
        return 2;
      else
        return 0;
    }
  }

};
},{}]},{},[5]);


text:
#ifndef SITYPES_H
#define SITYPES_H

#include "dcmtk/config/osconfig.h"    /* make sure OS specific configuration is included first */

#ifdef WITH_OPENSSL

#include "dcmtk/ofstd/oftypes.h"
#include "dcmtk/ofstd/ofcond.h"

#include "dcmtk/dcmsign/sidefine.h"

// DICOM defined terms for MAC algorithms, certificate and timestamp types
#define SI_DEFTERMS_RIPEMD160 "RIPEMD160"
#define SI_DEFTERMS_SHA1      "SHA1"
#define SI_DEFTERMS_MD5       "MD5"
#define SI_DEFTERMS_X509CERT  "X509_1993_SIG"
#define SI_DEFTERMS_CMS_TS    "CMS_TS"

/** type of key for public key cryptosystem
 */
enum E_KeyType
{
  /// RSA key
  EKT_RSA,

  /// DSA key
  EKT_DSA,

  /// DH key
  EKT_DH,

  /// no key present
  EKT_none
};

/** type of MAC algorithm
 */
enum E_MACType
{
  /// SHA-1
  EMT_SHA1,

  /// RIPEMD160
  EMT_RIPEMD160,

  /// MD5
  EMT_MD5
};

/*
 * specific error conditions for module dcmsign
 */

/// object initialization failed
extern DCMTK_DCMSIGN_EXPORT const OFConditionConst SI_EC_InitializationFailed;

/// an OpenSSL call has failed
extern DCMTK_DCMSIGN_EXPORT const OFConditionConst SI_EC_OpenSSLFailure;

/// file cannot be read
extern DCMTK_DCMSIGN_EXPORT const OFConditionConst SI_EC_CannotRead;

/// unable to use the selected transfer syntax for MAC computation
extern DCMTK_DCMSIGN_EXPORT const OFConditionConst SI_EC_WrongTransferSyntax;

/// no more MAC ID numbers available
extern DCMTK_DCMSIGN_EXPORT const OFConditionConst SI_EC_MacIDsExhausted;

/// certificate and private key do not match
extern DCMTK_DCMSIGN_EXPORT const OFConditionConst SI_EC_CertificateDoesNotMatchPrivateKey;

/// MAC algorithm not allowed for the current security profile
extern DCMTK_DCMSIGN_EXPORT const OFConditionConst SI_EC_MacDoesNotMatchProfile;

/// Signature algorithm not allowed for the current security profile
extern DCMTK_DCMSIGN_EXPORT const OFConditionConst SI_EC_AlgorithmDoesNotMatchProfile;

/// Transfer syntax not allowed for the current security profile
extern DCMTK_DCMSIGN_EXPORT const OFConditionConst SI_EC_TransferSyntaxDoesNotMatchProfile;

/** signature verification failed because the certificate is missing
 *  or cannot be read (e.g. unsupported format)
 */
extern DCMTK_DCMSIGN_EXPORT const OFConditionConst SI_EC_VerificationFailed_NoCertificate;

/// signature verification failed because the corresponding MAC parameters item could not be found or is incomplete
extern DCMTK_DCMSIGN_EXPORT const OFConditionConst SI_EC_VerificationFailed_NoMAC;

/// signature verification failed because the corresponding signature item is incomplete
extern DCMTK_DCMSIGN_EXPORT const OFConditionConst SI_EC_VerificationFailed_NoSignature;

/// signature verification failed because the MAC algorithm is not supported
extern DCMTK_DCMSIGN_EXPORT const OFConditionConst SI_EC_VerificationFailed_UnsupportedMACAlgorithm;

/// signature verification failed because the signature is invalid (document corrupted)
extern DCMTK_DCMSIGN_EXPORT const OFConditionConst SI_EC_VerificationFailed_Corrupted;

/// signature verification failed because the certificate was issued by an untrusted (unknown) CA
extern DCMTK_DCMSIGN_EXPORT const OFConditionConst SI_EC_VerificationFailed_NoTrust;

#endif
#endif


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Models
{
    public class ViewClaim
    {
        public string Type { get; set; }
        public string Value { get; set; }
    }
}


text:
package com.mana.innovative.authentication;

import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;

@Service
public class LogoutService {

    /**
     * Do log out.
     *
     * @param httpSession the http session
     */
    public void doLogOut( HttpSession httpSession ) {

        if ( httpSession != null ) {
            httpSession.invalidate( );
        }

    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <!-- Module Metadata -->
  <parent>
    <groupId>com.wcinformatics.umls.server</groupId>
    <artifactId>term-server-parent</artifactId>
    <version>1.5.1-SNAPSHOT</version>
    <relativePath>parent</relativePath>
  </parent>

  <artifactId>term-server-aggregator</artifactId>
  <packaging>pom</packaging>
  <name>Terminology Server</name>
  <description>Terminology Server aggregator project.</description>
  <url>https://umls.terminology.tools</url>

  <!-- Sub-modules -->
  <modules>
    <module>parent</module>
    <module>config</module>
    <module>model</module>
    <module>services</module>
    <module>jpa-model</module>
    <module>jpa-services</module>
    <module>admin</module>
    <module>custom</module>
    <module>rest</module>
    <module>rest-client</module>
    <module>integration-test</module>
    <module>examples</module>
  </modules>

  <distributionManagement>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

</project>


text:
<?php
$errorPath = ini_get('error_log');
echo $errorPath;


text:
package com.azure.spring.data.cosmos.core.mapping.event;

import com.azure.cosmos.models.PartitionKey;
import com.azure.spring.data.cosmos.IntegrationTestCollectionManager;
import com.azure.spring.data.cosmos.common.TestConstants;
import com.azure.spring.data.cosmos.core.CosmosTemplate;
import com.azure.spring.data.cosmos.domain.Address;
import com.azure.spring.data.cosmos.repository.TestRepositoryConfig;
import com.azure.spring.data.cosmos.repository.repository.ReactiveAddressRepository;
import org.assertj.core.util.Lists;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.ArrayList;
import java.util.List;

import static com.azure.spring.data.cosmos.domain.Address.TEST_ADDRESS1_PARTITION1;
import static com.azure.spring.data.cosmos.domain.Address.TEST_ADDRESS1_PARTITION2;
import static com.azure.spring.data.cosmos.domain.Address.TEST_ADDRESS2_PARTITION1;
import static com.azure.spring.data.cosmos.domain.Address.TEST_ADDRESS4_PARTITION3;
import static org.assertj.core.api.Assertions.assertThat;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = TestRepositoryConfig.class)
public class ApplicationContextEventReactiveIT {

    @ClassRule
    public static final IntegrationTestCollectionManager collectionManager = new IntegrationTestCollectionManager();

    @Autowired
    private ReactiveAddressRepository repository;
    @Autowired
    private CosmosTemplate template;
    @Autowired
    private SimpleCosmosMappingEventListener simpleCosmosMappingEventListener;

    @Rule
    public ExpectedException expectedException = ExpectedException.none();

    @Before
    public void setUp() {
        collectionManager.ensureContainersCreatedAndEmpty(template, Address.class);
        repository.saveAll(Lists.newArrayList(TEST_ADDRESS1_PARTITION1, TEST_ADDRESS1_PARTITION2,
            TEST_ADDRESS2_PARTITION1)).collectList().block();
        simpleCosmosMappingEventListener.onAfterLoadEvents = new ArrayList<>();
    }

    @Test
    public void shouldPublishAfterLoadEventOnFindById() {
        repository.findById(TEST_ADDRESS1_PARTITION1.getPostalCode(), new PartitionKey(TEST_ADDRESS1_PARTITION1.getCity())).block();
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents).hasSize(1);
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents.get(0).getContainerName()).isEqualTo("Address");
    }

    @Test
    public void shouldPublishAfterLoadEventOnFindAll() {
        repository.findAll().collectList().block();
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents).hasSize(3);
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents.get(0).getContainerName()).isEqualTo("Address");
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents.get(1).getContainerName()).isEqualTo("Address");
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents.get(2).getContainerName()).isEqualTo("Address");
    }

    @Test
    public void shouldPublishAfterLoadEventForCustomQueries() {
        List<String> cities = new ArrayList<>();
        cities.add(TEST_ADDRESS1_PARTITION1.getCity());
        repository.findByCityIn(cities).collectList().block();
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents).hasSize(2);
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents.get(0).getContainerName()).isEqualTo("Address");
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents.get(1).getContainerName()).isEqualTo("Address");
    }

    @Test
    public void shouldPublishAfterLoadEventForAnnotatedCustomQueries() {
        repository.annotatedFindListByCity(TEST_ADDRESS1_PARTITION1.getCity()).collectList().block();
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents).hasSize(2);
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents.get(0).getContainerName()).isEqualTo("Address");
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents.get(1).getContainerName()).isEqualTo("Address");
    }

    @Test
    public void shouldNotPublishAfterLoadEventForInserts() {
        repository.save(TEST_ADDRESS4_PARTITION3).block();
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents.isEmpty()).isTrue();
    }

    @Test
    public void shouldNotPublishAfterLoadEventForUpdates() {
        repository.save(new Address(TEST_ADDRESS1_PARTITION1.getPostalCode(), TestConstants.STREET_0, TEST_ADDRESS1_PARTITION1.getCity())).block();
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents.isEmpty()).isTrue();
    }

    @Test
    public void shouldNotPublishAfterLoadEventForDeletes() {
        repository.delete(TEST_ADDRESS1_PARTITION1).block();
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents.isEmpty()).isTrue();
    }

    @Test
    public void shouldNotPublishAfterLoadEventForCustomDeleteQuery() {
        repository.deleteByCity(TEST_ADDRESS1_PARTITION1.getCity()).block();
        assertThat(simpleCosmosMappingEventListener.onAfterLoadEvents.isEmpty()).isTrue();
    }
}


text:
"""Fichier contenant le paramètre 'voir' de la commande 'cap'."""

from primaires.interpreteur.masque.parametre import Parametre
from primaires.vehicule.vecteur import Vecteur
from secondaires.navigation.constantes import get_nom_distance

class PrmVoir(Parametre):

    """Commande 'cap voir'.

    """

    def __init__(self):
        """Constructeur du paramètre"""
        Parametre.__init__(self, "voir", "view")
        self.schema = "<cle>"
        self.aide_courte = "affiche le détail d'un cap"
        self.aide_longue = \
            "Cette commande permet d'obtenir plus d'informations sur " \
            "un cap maritime : son point de départ, ses points " \
            "intermédiaires et son point d'arrivée."

    def interpreter(self, personnage, dic_masques):
        """Interprétation du paramètre"""
        cle = dic_masques["cle"].cle
        if cle not in importeur.navigation.trajets:
            personnage << "|err|Ce cap n'existe pas.|ff|"
            return

        trajet = importeur.navigation.trajets[cle]

        # On réunit les informations à afficher
        etendue = trajet.etendue and trajet.etendue.cle or "|att|inconnue|ff|"
        depart = trajet.point_depart
        if depart is None:
            depart = "|att|inconnu|ff|"
        else:
            depart = "x={} y={}".format(*depart)

        msg = "Détail sur le cap {} :".format(cle)
        msg += "\nÉtendue : {}".format(etendue)
        msg += "\nDépart : {}".format(depart)
        if not trajet.points:
            msg += "\n  |att|Ce cap n'a pas de point d'arrivée.|ff|"
        else:
            x, y = trajet.point_depart
            msg += "\n  Points du cap :"
            for point in trajet.points.values():
                distance = Vecteur(point[0] - x, point[1] - y, 0)
                direction = round((distance.direction + 90) % 360)
                nom_direction = distance.nom_direction
                nom_distance = get_nom_distance(distance)
                msg += "\n    Vers x={} y={}, cap sur {}° ({}), {}".format(
                        point[0], point[1], direction, nom_direction,
                        nom_distance)
                x, y = point

            if trajet.point_depart == trajet.point_arrivee:
                msg += "\n  Ce trajet est refermé, donc circulaire."

        personnage << msg


text:
#import "HL7SectionParser.h"

@interface HL7SocialHistorySectionParser : HL7SectionParser

@end


text:
layout: post
title: How Does One Bridge the Personal & Professional on Social Media?
summary:
date: 2016-12-09
categories: blog
tags:
permalink: /personal-vs-professional/
comments: true
---

I've spent today mostly baffled by the amount of content I *could* be putting out into the world.

I challenged myself with my post on Monday, [Endless Content](https://blog.contentlab.io/endless-content-never-run-out-of-ideas-27c60589f98f) to come up with 40 piece of content, repurposed from that blog post alone.

That was a little much. I only managed 30. But still… **30 pieces of new content**!

A lot of it is very simple. Some of it is repetitive, but all of it can be used to promote the blog post itself, so it's probably a BALL-BREAKING strategy for a business that uses T.O.F.U. (top of funnel) content like blog posts acquire leads.

So now it's up to me to put it to the test.

The question which haunts me now is…how do I bring my personal and professional profiles together?

Even though I've become more content-prolific over the last three weeks, I've wanted to keep my Facebook profile at bay.

Gary Vaynerchuk himself doesn't mix his Gary V profiles with Vayner Media.

So I'm not sure how to do this. Do I keep Content Lab totally "professional" looking? Or do I throw in some random selfies and talking head monologues and stuff like that?

How the hell do you be "social" as a brand? You can publish content, sure, but when I leave comments I want to talk as if it's me. Then I hit send and it's the Content Lab logo sending that little sound bite with all that personality…not James.

This is of course a thing I'll need to become familiar with for the good of Content Lab's clients.

It seems I've cracked the problem of running out of content.

Now I'm facing the problem of brand vs personal engagement on social media.

I have no doubt I'll crack that too.


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@drawable/bus_select_btn_p" />
    <item android:drawable="@drawable/bus_select_btn" />
</selector>