text:
#pragma once
#ifndef VHACD_MANIFOLD_MESH_H
#define VHACD_MANIFOLD_MESH_H
#include "vhacdCircularList.h"
#include "vhacdSArray.h"
#include "vhacdVector.h"
namespace VHACD
{
class TMMTriangle;
class TMMEdge;
class TMMesh;
class ICHull;

//!    Vertex data structure used in a triangular manifold mesh (TMM).
class TMMVertex
{
public:
	void Initialize();
	TMMVertex(void);
	~TMMVertex(void);

private:
	Vec3<double> m_pos;
	int m_name;
	size_t m_id;
	CircularListElement<TMMEdge>* m_duplicate;  // pointer to incident cone edge (or NULL)
	bool m_onHull;
	bool m_tag;
	TMMVertex(const TMMVertex& rhs);
	friend class ICHull;
	friend class TMMesh;
	friend class TMMTriangle;
	friend class TMMEdge;
};

//!    Edge data structure used in a triangular manifold mesh (TMM).
class TMMEdge
{
public:
	void Initialize();
	TMMEdge(void);
	~TMMEdge(void);

private:
	size_t m_id;
	CircularListElement<TMMTriangle>* m_triangles[2];
	CircularListElement<TMMVertex>* m_vertices[2];
	CircularListElement<TMMTriangle>* m_newFace;
	TMMEdge(const TMMEdge& rhs);
	friend class ICHull;
	friend class TMMTriangle;
	friend class TMMVertex;
	friend class TMMesh;
};

//!    Triangle data structure used in a triangular manifold mesh (TMM).
class TMMTriangle
{
public:
	void Initialize();
	TMMTriangle(void);
	~TMMTriangle(void);

private:
	size_t m_id;
	CircularListElement<TMMEdge>* m_edges[3];
	CircularListElement<TMMVertex>* m_vertices[3];
	bool m_visible;

	TMMTriangle(const TMMTriangle& rhs);
	friend class ICHull;
	friend class TMMesh;
	friend class TMMVertex;
	friend class TMMEdge;
};
//!    triangular manifold mesh data structure.
class TMMesh
{
public:
	//! Returns the number of vertices>
	inline size_t GetNVertices() const { return m_vertices.GetSize(); }
	//! Returns the number of edges
	inline size_t GetNEdges() const { return m_edges.GetSize(); }
	//! Returns the number of triangles
	inline size_t GetNTriangles() const { return m_triangles.GetSize(); }
	//! Returns the vertices circular list
	inline const CircularList<TMMVertex>& GetVertices() const { return m_vertices; }
	//! Returns the edges circular list
	inline const CircularList<TMMEdge>& GetEdges() const { return m_edges; }
	//! Returns the triangles circular list
	inline const CircularList<TMMTriangle>& GetTriangles() const { return m_triangles; }
	//! Returns the vertices circular list
	inline CircularList<TMMVertex>& GetVertices() { return m_vertices; }
	//! Returns the edges circular list
	inline CircularList<TMMEdge>& GetEdges() { return m_edges; }
	//! Returns the triangles circular list
	inline CircularList<TMMTriangle>& GetTriangles() { return m_triangles; }
	//! Add vertex to the mesh
	CircularListElement<TMMVertex>* AddVertex() { return m_vertices.Add(); }
	//! Add vertex to the mesh
	CircularListElement<TMMEdge>* AddEdge() { return m_edges.Add(); }
	//! Add vertex to the mesh
	CircularListElement<TMMTriangle>* AddTriangle() { return m_triangles.Add(); }
	//! Print mesh information
	void Print();
	//!
	void GetIFS(Vec3<double>* const points, Vec3<int>* const triangles);
	//!
	void Clear();
	//!
	void Copy(TMMesh& mesh);
	//!
	bool CheckConsistancy();
	//!
	bool Normalize();
	//!
	bool Denormalize();
	//!    Constructor
	TMMesh();
	//! Destructor
	virtual ~TMMesh(void);

private:
	CircularList<TMMVertex> m_vertices;
	CircularList<TMMEdge> m_edges;
	CircularList<TMMTriangle> m_triangles;

	// not defined
	TMMesh(const TMMesh& rhs);
	friend class ICHull;
};
}  // namespace VHACD
#endif  // VHACD_MANIFOLD_MESH_H


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

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.thanksmister.btcblue">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

    <application
        android:name="com.thanksmister.btcblue.BaseApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".ui.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.CalculatorActivity"
            android:label="@string/title_calculator" >
        </activity>

        <provider
                android:name="android.support.v4.content.FileProvider"
                android:authorities="${applicationId}.provider"
                android:exported="false"
                android:grantUriPermissions="true">
            <meta-data
                    android:name="android.support.FILE_PROVIDER_PATHS"
                    android:resource="@xml/provider_paths"/>
        </provider>

    </application>

</manifest>

redpajama_set_name: RedPajamaGithub


text:
To run the app :
- npm install
- gulp server

Your app will run on [http://localhost:9000](http://localhost:9000)


text:
@interface SnowView : CAEmitterLayerView

@end


text:
/*
 *  UDPLITE     An implementation of the UDP-Lite protocol (RFC 3828).
 *
 *  Authors:    Gerrit Renker       <gerrit@erg.abdn.ac.uk>
 *
 *  Changes:
 *  Fixes:
 *		This program is free software; you can redistribute it and/or
 *		modify it under the terms of the GNU General Public License
 *		as published by the Free Software Foundation; either version
 *		2 of the License, or (at your option) any later version.
 */

#define pr_fmt(fmt) "UDPLite: " fmt

#include <linux/export.h>
#include "udp_impl.h"

struct udp_table 	udplite_table __read_mostly;
EXPORT_SYMBOL(udplite_table);

static int udplite_rcv(struct sk_buff *skb)
{
	return __udp4_lib_rcv(skb, &udplite_table, IPPROTO_UDPLITE);
}

static void udplite_err(struct sk_buff *skb, u32 info)
{
	__udp4_lib_err(skb, info, &udplite_table);
}

static const struct net_protocol udplite_protocol = {
	.handler	= udplite_rcv,
	.err_handler	= udplite_err,
	.no_policy	= 1,
	.netns_ok	= 1,
};

struct proto 	udplite_prot = {
	.name		   = "UDP-Lite",
	.owner		   = THIS_MODULE,
	.close		   = udp_lib_close,
	.connect	   = ip4_datagram_connect,
	.disconnect	   = udp_disconnect,
	.ioctl		   = udp_ioctl,
	.init		   = udplite_sk_init,
	.destroy	   = udp_destroy_sock,
	.setsockopt	   = udp_setsockopt,
	.getsockopt	   = udp_getsockopt,
	.sendmsg	   = udp_sendmsg,
	.recvmsg	   = udp_recvmsg,
	.sendpage	   = udp_sendpage,
	.backlog_rcv	   = udp_queue_rcv_skb,
	.hash		   = udp_lib_hash,
	.unhash		   = udp_lib_unhash,
	.get_port	   = udp_v4_get_port,
	.obj_size	   = sizeof(struct udp_sock),
	.slab_flags	   = SLAB_DESTROY_BY_RCU,
	.h.udp_table	   = &udplite_table,
#ifdef CONFIG_COMPAT
	.compat_setsockopt = compat_udp_setsockopt,
	.compat_getsockopt = compat_udp_getsockopt,
#endif
	.clear_sk	   = sk_prot_clear_portaddr_nulls,
};
EXPORT_SYMBOL(udplite_prot);

static struct inet_protosw udplite4_protosw = {
	.type		=  SOCK_DGRAM,
	.protocol	=  IPPROTO_UDPLITE,
	.prot		=  &udplite_prot,
	.ops		=  &inet_dgram_ops,
	.no_check	=  0,		/* must checksum (RFC 3828) */
	.flags		=  INET_PROTOSW_PERMANENT,
};

#ifdef CONFIG_PROC_FS

static const struct file_operations udplite_afinfo_seq_fops = {
	.owner    = THIS_MODULE,
	.open     = udp_seq_open,
	.read     = seq_read,
	.llseek   = seq_lseek,
	.release  = seq_release_net
};

static struct udp_seq_afinfo udplite4_seq_afinfo = {
	.name		= "udplite",
	.family		= AF_INET,
	.udp_table 	= &udplite_table,
	.seq_fops	= &udplite_afinfo_seq_fops,
	.seq_ops	= {
		.show		= udp4_seq_show,
	},
};

static int __net_init udplite4_proc_init_net(struct net *net)
{
	return udp_proc_register(net, &udplite4_seq_afinfo);
}

static void __net_exit udplite4_proc_exit_net(struct net *net)
{
	udp_proc_unregister(net, &udplite4_seq_afinfo);
}

static struct pernet_operations udplite4_net_ops = {
	.init = udplite4_proc_init_net,
	.exit = udplite4_proc_exit_net,
};

static __init int udplite4_proc_init(void)
{
	return register_pernet_subsys(&udplite4_net_ops);
}
#else
static inline int udplite4_proc_init(void)
{
	return 0;
}
#endif

void __init udplite4_register(void)
{
	udp_table_init(&udplite_table, "UDP-Lite");
	if (proto_register(&udplite_prot, 1))
		goto out_register_err;

	if (inet_add_protocol(&udplite_protocol, IPPROTO_UDPLITE) < 0)
		goto out_unregister_proto;

	inet_register_protosw(&udplite4_protosw);

	if (udplite4_proc_init())
		pr_err("%s: Cannot register /proc!\n", __func__);
	return;

out_unregister_proto:
	proto_unregister(&udplite_prot);
out_register_err:
	pr_crit("%s: Cannot add UDP-Lite protocol\n", __func__);
}


text:
const cors_coep_headers = coep_require_corp + corp_cross_origin;
const same_origin = get_host_info().HTTPS_ORIGIN;
const cross_origin = get_host_info().HTTPS_REMOTE_ORIGIN;
const dedicatedWorkerPostMessage = `
  self.addEventListener('message', (e) => {
    e.data.port.postMessage(self.crossOriginIsolated);
  });
`;

const postMessageIsWorkerCrossOriginIsolated = async (
  test,
  frame,
  worker_url
) => {
  const worker = new frame.contentWindow.Worker(worker_url);
  const mc = new MessageChannel();
  worker.postMessage({port: mc.port2}, [mc.port2]);
  worker.onerror = test.unreached_func('cannot create dedicated worker');
  return (await new Promise(r => mc.port1.onmessage = r)).data;
}

const isDataDedicatedWorkerCrossOriginIsolated = async (
  test,
  parent_headers
) => {
  const [future_child, future_error] =
    await createIsolatedFrame('', parent_headers);
  future_error.then(test.unreached_func('cannot create isolated iframe'));

  const child = await future_child;
  add_completion_callback(() => child.remove());

  const worker_url =
    `data:application/javascript;base64,${btoa(dedicatedWorkerPostMessage)}`;
  return postMessageIsWorkerCrossOriginIsolated(test, child, worker_url);
}

const isBlobURLDedicatedWorkerCrossOriginIsolated = async(
  test,
  parent_headers
) => {
  const [future_child, future_error] =
    await createIsolatedFrame("", parent_headers);
  future_error.then(test.unreached_func('cannot create isolated iframe'));

  const child = await future_child;
  add_completion_callback(() => child.remove());

  const blob =
    new Blob([dedicatedWorkerPostMessage], {type: 'text/plaintext'});
  const workerURL = URL.createObjectURL(blob);
  return postMessageIsWorkerCrossOriginIsolated(test, child, workerURL)
}

const isHTTPSDedicatedWorkerCrossOriginIsolated = async(
  test,
  parent_headers
) => {
  const [future_child, future_error] =
    await createIsolatedFrame("", parent_headers);
  future_error.then(test.unreached_func('cannot create isolated iframe'));

  const child = await future_child;
  add_completion_callback(() => child.remove());

  const worker_token = token();
  const workerURL =
    `${executor_worker_path}${cors_coep_headers}&uuid=${worker_token}`;
  const worker = new child.contentWindow.Worker(workerURL);
  return IsCrossOriginIsolated(worker_token);
}

const sharedWorkerIsCrossOriginIsolated = async(
  test,
  withCoopCoep
) => {
  const [worker, future_error] =
    environments.shared_worker(withCoopCoep ? cors_coep_headers : "");
  future_error.then(test.unreached_func('cannot create shared worker.'));
  return IsCrossOriginIsolated(worker);
}

const serviceWorkerIsCrossOriginIsolated = async(
  test,
  withCoopCoep
) => {
  const [worker, future_error] =
    environments.service_worker(withCoopCoep ? cors_coep_headers : "");
  future_error.then(test.unreached_func('cannot create service worker.'));
  return IsCrossOriginIsolated(worker);
}

const dedicatedWorkerIsCrossOriginIsolated = async (
  test,
  scheme,
  parent_permission_coi
) => {
  let parent_headers = cors_coep_headers;
  if (parent_permission_coi !== undefined) {
    // Escape right parenthesis in WPT cors_coep_headers:
    parent_permission_coi = parent_permission_coi.replace(')', '\\)');
    parent_headers += `|header(permissions-policy,` +
                      `cross-origin-isolated=${parent_permission_coi})`;
  }
  switch (scheme) {
    case 'https':
      return isHTTPSDedicatedWorkerCrossOriginIsolated(test, parent_headers);
    case 'data':
      return isDataDedicatedWorkerCrossOriginIsolated(test, parent_headers);
    case 'blob':
      return isBlobURLDedicatedWorkerCrossOriginIsolated(test, parent_headers);
    default:
      assert_unreached("wrong scheme for dedicated worker test.");
  }
}

const generate_shared_worker_test = async (withCoopCoep, expected) => {
  promise_test_parallel(async (test) => {
  const isCrossOriginIsolated =
    await sharedWorkerIsCrossOriginIsolated(test, withCoopCoep);
  assert_equals(isCrossOriginIsolated, expected)
  }, `shared_worker (withCoopCoep: ${withCoopCoep}) ` +
     `cross origin isolated permission test`);
}

const generate_dedicated_worker_test = async (
  scheme,
  parent_permission_coi,
  expected
) => {
  promise_test_parallel(async (test) => {
  const isCrossOriginIsolated =
    await dedicatedWorkerIsCrossOriginIsolated(test, scheme, parent_permission_coi);
  assert_equals(isCrossOriginIsolated, expected)
  }, `dedicated_worker (scheme: ${scheme}) cross origin ` +
     `isolated (${parent_permission_coi}) permission test`);
}

const generate_service_worker_test = async (withCoopCoep, expected) => {
  promise_test_parallel(async (test) => {
  const isCrossOriginIsolated =
    await serviceWorkerIsCrossOriginIsolated(test, withCoopCoep);
  assert_equals(isCrossOriginIsolated, expected)
  }, `service_worker (withCoopCoep: ${withCoopCoep}) ` +
     `cross origin isolated permission test`);
}

generate_shared_worker_test(false, false);
generate_shared_worker_test(true, true);

generate_dedicated_worker_test('https', undefined, true);
generate_dedicated_worker_test('https', '*', true);
generate_dedicated_worker_test('https', 'self', true);
generate_dedicated_worker_test('https', '()', false);
generate_dedicated_worker_test('data', undefined, false);
generate_dedicated_worker_test('data', '*', false);
generate_dedicated_worker_test('data', 'self', false);
generate_dedicated_worker_test('blob', undefined, true);
generate_dedicated_worker_test('blob', '*', true);
generate_dedicated_worker_test('blob', 'self', true);
generate_dedicated_worker_test('blob', '()', false);

generate_service_worker_test(false, false);
generate_service_worker_test(true, true);


text:
package org.apache.maven.plugin.docck;

import org.apache.maven.model.ReportPlugin;
import org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.Parameter;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugin.docck.reports.DocumentationReporter;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.project.MavenProject;
import org.apache.maven.tools.plugin.extractor.ExtractionException;
import org.apache.maven.tools.plugin.scanner.MojoScanner;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;

import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;

/**
 * Checks a plugin's documentation for the standard minimums.
 *
 * @author jdcasey
 */
@Mojo( name = "check", aggregator = true, defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true )
public class CheckPluginDocumentationMojo
    extends AbstractCheckDocumentationMojo
{

    /**
     * Plexus component that searches for Mojos.
     */
    @Component
    protected MojoScanner mojoScanner;

    // TODO: really a description of length 1 isn't all that helpful...
    private static final int MIN_DESCRIPTION_LENGTH = 1;

    protected void checkPackagingSpecificDocumentation( MavenProject project, DocumentationReporter reporter )
    {
        PluginDescriptor descriptor = new PluginDescriptor();

        try
        {
            mojoScanner.populatePluginDescriptor( project, descriptor );
        }
        catch ( InvalidPluginDescriptorException e )
        {
            reporter.error( "Failed to parse mojo descriptors.\nError: " + e.getMessage() );
            descriptor = null;
        }
        catch ( ExtractionException e )
        {
            reporter.error( "Failed to parse mojo descriptors.\nError: " + e.getMessage() );
            descriptor = null;
        }

        if ( descriptor != null )
        {
            @SuppressWarnings( "unchecked" )
            List<MojoDescriptor> mojos = descriptor.getMojos();

            // ensure that all mojo classes are documented
            if ( mojos != null && !mojos.isEmpty() )
            {
                for ( MojoDescriptor mojo : mojos )
                {
                    String mojoDescription = mojo.getDescription();

                    if ( mojoDescription == null || mojoDescription.trim().length() < MIN_DESCRIPTION_LENGTH )
                    {
                        reporter.error( "Mojo: \'" + mojo.getGoal() + "\' is missing a description." );
                    }

                    @SuppressWarnings( "unchecked" )
                    List<Parameter> params = mojo.getParameters();

                    // ensure that all parameters are documented
                    if ( params != null && !params.isEmpty() )
                    {
                        for ( Parameter param : params )
                        {
                            if ( param.getRequirement() == null && param.isEditable() )
                            {
                                String paramDescription = param.getDescription();

                                if ( paramDescription == null
                                    || paramDescription.trim().length() < MIN_DESCRIPTION_LENGTH )
                                {
                                    reporter.error( "Parameter: \'" + param.getName() + "\' in mojo: \'"
                                        + mojo.getGoal() + "\' is missing a description." );
                                }
                            }
                        }
                    }
                }
            }
        }

        checkConfiguredReportPlugins( project, reporter );

        checkProjectSite( project, reporter );
    }

    protected boolean approveProjectPackaging( String packaging )
    {
        return "maven-plugin".equals( packaging );
    }

    private void checkProjectSite( MavenProject project, DocumentationReporter reporter )
    {
        File projectSiteDirectory = new File( project.getBasedir(), siteDirectory );

        // check for site.xml
        File siteXml = new File( projectSiteDirectory, "site.xml" );

        if ( !siteXml.exists() )
        {
            reporter.error( "site.xml is missing." );
        }
        else
        {
            Reader streamReader = null;
            try
            {
                streamReader = ReaderFactory.newXmlReader( siteXml );

                String siteHtml = IOUtil.toString( streamReader );

                if (!siteHtml.contains("href=\"index.html\""))
                {
                    reporter.error( "site.xml is missing the link to: index.html \"Introduction\"." );
                }

                if (!siteHtml.contains("href=\"usage.html\""))
                {
                    reporter.error( "site.xml is missing the link to: usage.html \"Usage\"." );
                }

                if (!siteHtml.contains("href=\"plugin-info.html\""))
                {
                    reporter.error( "site.xml is missing the link to: plugin-info.html \"Goals\"." );
                }

                if (!siteHtml.contains("href=\"faq.html\""))
                {
                    reporter.error( "site.xml is missing the link to: faq.html \"FAQ\"." );
                }
            }
            catch ( IOException e )
            {
                reporter.error( "Unable to read site.xml file: \'" + siteXml.getAbsolutePath()
                    + "\'.\nError: " + e.getMessage() );
            }
            finally
            {
                IOUtil.close( streamReader );
            }
        }

        // check for index.(apt|html|xml)[.vm]
        if ( !findFiles( projectSiteDirectory, "index" ) )
        {
            reporter.error( "There is no \'index\' file in your site directory (in apt|html|xml[.vm] format)." );
        }

        // check for usage.(apt|html|xml)[.vm]
        if ( !findFiles( projectSiteDirectory, "usage" ) )
        {
            reporter.error( "There is no \'usage\' file in your site directory (in apt|html|xml[.vm] format)." );
        }

        // check for **/examples/**.(apt|html|xml)[.vm] or **/example*.(apt|html|xml)[.vm]
        if ( !findFiles( projectSiteDirectory, "**/examples/*" )
             && !findFiles( projectSiteDirectory, "**/example*" ) )
        {
            reporter.error( "There are no example files in your site directory (in apt|html|xml[.vm] format)."
                + " They should either be called \'example*.(apt|html|xml)[.vm]\'"
                + " or they should be located in the \'examples\' directory." );
        }

        if ( !findFiles( projectSiteDirectory, "faq" ) )
        {
            reporter.error( "There is no \'faq\' file in your site directory (in apt|fml|html|xml[.vm] format)." );
        }
    }

    /**
     * Checks the project configured plugins if the required report plugins are present.
     *
     * @param project  MavenProject to check
     * @param reporter listener
     * @todo maybe this should be checked default for all project?
     */
    private void checkConfiguredReportPlugins( MavenProject project, DocumentationReporter reporter )
    {
        List<String> expectedPlugins = getRequiredPlugins();

        @SuppressWarnings( "unchecked" )
        List<ReportPlugin> reportPlugins = project.getReportPlugins();
        if ( reportPlugins != null && reportPlugins.size() > 0 )
        {
            for ( ReportPlugin plugin : reportPlugins )
            {
                expectedPlugins.remove( plugin.getArtifactId() );
            }
        }
        else
        {
            reporter.error( "pom.xml has no report plugins configured." );
        }

        for ( String expectedPlugin : expectedPlugins )
        {
            reporter.error( "pom.xml is missing the report plugin: " + expectedPlugin + "." );
        }
    }

    /**
     * Returns a List of Strings of required report plugins.
     *
     * @return List of report plugin artifactIds
     */
    private List<String> getRequiredPlugins()
    {
        List<String> list = new ArrayList<String>();

        list.add( "maven-javadoc-plugin" );
        list.add( "maven-jxr-plugin" );

        return list;
    }
}


text:
#define GLX_GLXEXT_PROTOTYPES
#include <GL/glx.h>
#include <GL/glxext.h>
#include <X11/Xlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>

typedef const char * glXGetScreenDriver_t (Display *dpy, int scrNum);
typedef const char * glXGetDriverConfig_t (const char *driverName);

static glXGetScreenDriver_t *GetScreenDriver;
static glXGetDriverConfig_t *GetDriverConfig;

enum INFO_FUNC {
    LIST, NSCREENS, DRIVER, OPTIONS
};

void printUsage (void);

void printUsage (void) {
    fprintf (stderr,
"Usage: xdriinfo [-display <dpy>] [command]\n"
"Commands:\n"
"  nscreens               print the number of screens on display\n"
"  driver screen          print the DRI driver name of screen\n"
"  options screen|driver  print configuration information about screen or driver\n"
"If no command is given then the DRI drivers for all screens are listed.\n");
}

int main (int argc, char *argv[]) {
    Display *dpy;
    int nScreens, screenNum, i;
    enum INFO_FUNC func = LIST;
    char *funcArg = NULL;
    char *dpyName = NULL;

    GetScreenDriver = (glXGetScreenDriver_t *)glXGetProcAddressARB ((const GLubyte *)"glXGetScreenDriver");
    GetDriverConfig = (glXGetDriverConfig_t *)glXGetProcAddressARB ((const GLubyte *)"glXGetDriverConfig");
    if (!GetScreenDriver || !GetDriverConfig) {
	fprintf (stderr, "libGL is too old.\n");
	return 1;
    }

  /* parse the command line */
    for (i = 1; i < argc; ++i) {
	char **argPtr = NULL;
	if (!strcmp (argv[i], "-display"))
	    argPtr = &dpyName;
	else if (!strcmp (argv[i], "nscreens"))
	    func = NSCREENS;
	else if (!strcmp (argv[i], "driver")) {
	    func = DRIVER;
	    argPtr = &funcArg;
	} else if (!strcmp (argv[i], "options")) {
	    func = OPTIONS;
	    argPtr = &funcArg;
	} else {
	    printUsage ();
	    return 1;
	}
	if (argPtr) {
	    if (++i == argc) {
		printUsage ();
		return 1;
	    }
	    *argPtr = argv[i];
	}
    }

  /* parse screen number argument */
    if (func == DRIVER || func == OPTIONS) {
	if (sscanf (funcArg, "%i", &screenNum) != 1)
	    screenNum = -1;
	else if (screenNum < 0) {
	    fprintf (stderr, "Negative screen number \"%s\".\n", funcArg);
	    return 1;
	}
    }
  /* if the argument to the options command is a driver name, we can handle
   * it without opening an X connection */
    if (func == OPTIONS && screenNum == -1) {
	const char *options = (*GetDriverConfig) (funcArg);
	if (!options) {
	    fprintf (stderr,
		     "Driver \"%s\" is not installed or does not support configuration.\n",
		     funcArg);
	    return 1;
	}
	printf ("%s", options);
	if (isatty (STDOUT_FILENO))
	    printf ("\n");
	return 0;
    }
  /* driver command needs a valid screen number */
    else if (func == DRIVER && screenNum == -1) {
	fprintf (stderr, "Invalid screen number \"%s\".\n", funcArg);
	return 1;
    }

  /* open display and count the number of screens */
    if (!(dpy = XOpenDisplay (dpyName))) {
	fprintf (stderr, "Error: Couldn't open display\n");
	return 1;
    }
    nScreens = ScreenCount (dpy);

  /* final check on the screen number argument (if any)*/
    if ((func == DRIVER || func == OPTIONS) && screenNum >= nScreens) {
	fprintf (stderr, "Screen number \"%d\" out of range.\n", screenNum);
	return 1;
    }

    switch (func) {
      case NSCREENS:
	printf ("%d", nScreens);
	if (isatty (STDOUT_FILENO))
	    printf ("\n");
	break;
      case DRIVER: {
	  const char *name = (*GetScreenDriver) (dpy, screenNum);
	  if (!name) {
	      fprintf (stderr, "Screen \"%d\" is not direct rendering capable.\n",
		       screenNum);
	      return 1;
	  }
	  printf ("%s", name);
	  if (isatty (STDOUT_FILENO))
	      printf ("\n");
	  break;
      }
      case OPTIONS: {
	  const char *name = (*GetScreenDriver) (dpy, screenNum), *options;
	  if (!name) {
	      fprintf (stderr, "Screen \"%d\" is not direct rendering capable.\n",
		       screenNum);
	      return 1;
	  }
	  options = (*GetDriverConfig) (name);
	  if (!options) {
	      fprintf (stderr,
		       "Driver \"%s\" is not installed or does not support configuration.\n",
		       name);
	      return 1;
	  }
	  printf ("%s", options);
	  if (isatty (STDOUT_FILENO))
	      printf ("\n");
	  break;
      }
      case LIST:
	for (i = 0; i < nScreens; ++i) {
	    const char *name = (*GetScreenDriver) (dpy, i);
	    if (name)
		printf ("Screen %d: %s\n", i, name);
	    else
		printf ("Screen %d: not direct rendering capable.\n", i);
	}
    }

    return 0;
}


text:
var common = require('./common');

describe('RETR command', function () {
  'use strict';

  var client,
    server;

  beforeEach(function (done) {
    server = common.server();
    client = common.client(done);
  });

  it('should contain "hola!"', function (done) {
    var str = '';
    client.get('/data.txt', function (error, socket) {
      common.should.not.exist(error);
      socket.on('data', function (data) {
        str += data.toString();
      }).on('close', function (error) {
        error.should.not.equal(true);
        str.should.eql('hola!');
        done();
      }).resume();
    });
  });

  afterEach(function () {
    server.close();
  });
});


text:
require 'spec_helper'

describe Babl::Operators::Extends do
    extend SpecHelper::OperatorTesting

    let(:lookup_context) {
        TestLookupContext.new(
            object_partial: TestLookupContext.new('object(a: 1, b: 3)'),
            object_partial_2: TestLookupContext.new('object(b: 4)'),
            string_partial: TestLookupContext.new('"lol"')
        )
    }
    let(:object) { [nil] }

    context 'simple use case' do
        template { each.extends('object_partial', object(x: 1, b: 34)) }
        it { expect(json).to eq(['a' => 1, 'x' => 1, 'b' => 34]) }
    end

    context 'multiple extensions' do
        template { each.extends('object_partial', nil, 'object_partial_2', x: 1) }
        it { expect(json).to eq(['a' => 1, 'x' => 1, 'b' => 4]) }
    end

    context 'extend a non-object' do
        template { extends('string_partial') }
        it { expect { schema }.to raise_error Babl::Errors::InvalidTemplate }
    end

    context 'extend a non-object and try to add properties' do
        template { each.extends('string_partial', test: 1) }
        it { expect { schema }.to raise_error Babl::Errors::InvalidTemplate }
    end
end


text:
var setUpEventInformation = function(store, events) {
  events[0].result.forEach(item => {
    var details = {};
    details.marketId = item.marketId;
    if(item.event.venue) {
      details.venue = item.event.venue;
    } else {
      details.venue = item.event.name;
    }
    details.marketName = item.marketName;
    details.startTime = item.marketStartTime;
    store.dispatch({
      type: 'ADD_MARKET_DETAILS',
      id : item.marketId,
      details : details
    })
    item.runners.forEach(runner => {
      store.dispatch({
        type: 'ADD_RUNNER_NAME',
        id : runner.selectionId,
        name : runner.runnerName
      })
    });
  });
}

module.exports = setUpEventInformation;


text:
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 * vim: set ts=4 sw=4 et tw=99 ft=cpp:
 */

//#define DEBUG_FUNCTIONS 1

#include <string.h>

#include "ejs-value.h"
#include "ejs-ops.h"
#include "ejs-object.h"
#include "ejs-function.h"
#include "ejs-proxy.h"
#include "ejs-array.h"
#include "ejs-error.h"
#include "ejs-string.h"
#include "ejs-symbol.h"

EJSBool trace = EJS_FALSE;

static int indent_level = 0;
#define INDENT_AMOUNT 1

static void indent(char ch)
{
    int i;
    for (i = 0; i < indent_level; i ++)
        putchar (ch);
}

ejsval
_ejs_function_new (ejsval env, ejsval name, EJSClosureFunc func)
{
    EJSFunction *rv = _ejs_gc_new(EJSFunction);

    _ejs_init_object ((EJSObject*)rv, _ejs_Function_prototype, &_ejs_Function_specops);

    rv->func = func;
    rv->env = env;

    ejsval fun = OBJECT_TO_EJSVAL(rv);

    rv->constructor_kind = CONSTRUCTOR_KIND_BASE;

    // ECMA262: 15.3.2.1
    ejsval fun_proto = _ejs_object_new (_ejs_Object_prototype, &_ejs_Object_specops);
    _ejs_object_define_value_property (fun, _ejs_atom_prototype, fun_proto, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_CONFIGURABLE | EJS_PROP_WRITABLE);

    _ejs_object_define_value_property (fun_proto, _ejs_atom_constructor, fun, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_CONFIGURABLE | EJS_PROP_WRITABLE);
    _ejs_object_define_value_property (fun, _ejs_atom_name, name, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_CONFIGURABLE | EJS_PROP_NOT_WRITABLE);
    return fun;
}

ejsval
_ejs_function_new_without_env (ejsval name, EJSClosureFunc func)
{
    return _ejs_function_new (_ejs_undefined, name, func);
}

ejsval
_ejs_function_new_without_proto (ejsval env, ejsval name, EJSClosureFunc func)
{
    EJSFunction *rv = _ejs_gc_new(EJSFunction);

    _ejs_init_object ((EJSObject*)rv, _ejs_Function_prototype, &_ejs_Function_specops);

    rv->func = func;
    rv->env = env;

    ejsval fun = OBJECT_TO_EJSVAL(rv);

    _ejs_object_define_value_property (fun, _ejs_atom_name, name, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_CONFIGURABLE | EJS_PROP_NOT_WRITABLE);
    return fun;
}

ejsval
_ejs_function_new_utf8_with_proto (ejsval env, const char* name, EJSClosureFunc func, ejsval prototype)
{
    ejsval function_name = _ejs_string_new_utf8 (name);
    EJSFunction *rv = _ejs_gc_new(EJSFunction);

    _ejs_init_object ((EJSObject*)rv, _ejs_Function_prototype, &_ejs_Function_specops);

    rv->func = func;
    rv->env = env;

    ejsval fun = OBJECT_TO_EJSVAL(rv);

    _ejs_object_define_value_property (fun, _ejs_atom_name, function_name, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_CONFIGURABLE | EJS_PROP_NOT_WRITABLE);
    _ejs_object_define_value_property (fun, _ejs_atom_prototype, prototype, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_CONFIGURABLE | EJS_PROP_WRITABLE);

    return fun;
}

ejsval
_ejs_function_new_native (ejsval env, ejsval name, EJSClosureFunc func)
{
    EJSFunction *rv = _ejs_gc_new(EJSFunction);

    _ejs_init_object ((EJSObject*)rv, _ejs_Function_prototype, &_ejs_Function_specops);

    rv->func = func;
    rv->env = env;

    ejsval fun = OBJECT_TO_EJSVAL(rv);

    _ejs_object_define_value_property (fun, _ejs_atom_name, name, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_CONFIGURABLE | EJS_PROP_NOT_WRITABLE);

    return OBJECT_TO_EJSVAL(rv);
}

ejsval
_ejs_function_new_anon (ejsval env, EJSClosureFunc func)
{
    return _ejs_function_new (env, _ejs_atom_empty, func);
}

ejsval
_ejs_function_new_utf8 (ejsval env, const char *name, EJSClosureFunc func)
{
    ejsval function_name = _ejs_string_new_utf8 (name);
    ejsval rv = _ejs_function_new (env, function_name, func);

    return rv;
}

ejsval _ejs_Function_prototype EJSVAL_ALIGNMENT;
ejsval _ejs_Function EJSVAL_ALIGNMENT;

static EJS_NATIVE_FUNC(_ejs_Function_impl) {
    printf ("Function() called either as a function or a constructor is not supported in ejs\n");
    abort();
}

// ECMA262 15.3.4.2
static EJS_NATIVE_FUNC(_ejs_Function_prototype_toString) {
    char terrible_fixed_buffer[256];

    if (!EJSVAL_IS_FUNCTION(*_this))
        _ejs_throw_nativeerror_utf8 (EJS_TYPE_ERROR, "Function.prototype.toString is not generic.");

    ejsval func_name = _ejs_object_getprop (*_this, _ejs_atom_name);

    char *utf8_funcname = ucs2_to_utf8(EJSVAL_TO_FLAT_STRING(func_name));

    snprintf (terrible_fixed_buffer, sizeof (terrible_fixed_buffer), "function %s() {}", utf8_funcname);

    free (utf8_funcname);

    return _ejs_string_new_utf8(terrible_fixed_buffer);
}

// ECMA262 15.3.4.3
static EJS_NATIVE_FUNC(_ejs_Function_prototype_apply) {
    ejsval func = *_this;

    /* 1. If IsCallable(func) is false, then throw a TypeError exception. */
    if (!IsCallable(*_this)) {
        printf ("throw TypeError, func is not callable\n");
        EJS_NOT_IMPLEMENTED();
    }

    ejsval thisArg = _ejs_undefined;
    ejsval argArray = _ejs_undefined;
    if (argc > 0) thisArg = args[0];
    if (argc > 1) argArray = args[1];

    /* 2. If argArray is null or undefined, then */
    if (EJSVAL_IS_UNDEFINED(argArray) || EJSVAL_IS_NULL(argArray)) {
        /*    a. Return the result of calling the [[Call]] internal method of func, providing thisArg as the this value */
        /*       and an empty list of arguments. */
        return _ejs_invoke_closure (func, &thisArg, 0, NULL, _ejs_undefined);
    }
    /* 3. If Type(argArray) is not Object, then throw a TypeError exception. */
    if (!EJSVAL_IS_OBJECT(argArray)) {
        printf ("throw TypeError, argArray is not an object\n");
        EJS_NOT_IMPLEMENTED();
    }
    EJSObject* argArray_ = EJSVAL_TO_OBJECT(argArray);

    /* 4. Let len be the result of calling the [[Get]] internal method of argArray with argument "length". */
    ejsval len = OP(argArray_,Get) (argArray, _ejs_atom_length, argArray);

    /* 5. Let n be ToUint32(len). */
    uint32_t n = (uint32_t)EJSVAL_TO_NUMBER(len);

    ejsval* argList;
    EJSBool argList_allocated = EJS_FALSE;

    if (EJSVAL_IS_DENSE_ARRAY(argArray)) {
        argList = EJSDENSEARRAY_ELEMENTS(argArray_);
    }
    else {
        /* 6. Let argList be an empty List. */
        argList = (ejsval*)malloc(sizeof(ejsval) * n);
        argList_allocated = EJS_TRUE;

        /* 7. Let index be 0. */
        int index = 0;

        /* 8. Repeat while index < n */
        while (index < n) {
            /*    a. Let indexName be ToString(index). */
            ejsval indexName = NUMBER_TO_EJSVAL(index);
            /*    b. Let nextArg be the result of calling the [[Get]] internal method of argArray with indexName as the  */
            /*       argument. */
            ejsval nextArg = OP(argArray_,Get)(argArray, indexName, argArray);
            /*    c. Append nextArg as the last element of argList. */
            argList[index] = nextArg;
            /*    d. Set index to index + 1. */
            ++index;
        }
    }

    /* 9. Return the result of calling the [[Call]] internal method of func, providing thisArg as the this value and */
    /*    argList as the list of arguments. */
    ejsval rv = OP(EJSVAL_TO_OBJECT(func), Call)(func, thisArg, n, argList);

    if (argList_allocated)
        free (argList);
    return rv;
}

// ECMA262 15.3.4.4
static EJS_NATIVE_FUNC(_ejs_Function_prototype_call) {
    // XXX nanboxing breaks this EJS_ASSERT (EJSVAL_IS_FUNCTION(_this));

    ejsval func = *_this;
    ejsval thisArg = _ejs_undefined;

    if (argc > 0) {
        thisArg = args[0];
        args = &args[1];
        argc --;
    }

    ejsval rv = OP(EJSVAL_TO_OBJECT(func), Call)(func, thisArg, argc, argc == 0 ? NULL : args);

    return rv;
}

#define EJS_BOUNDFUNC_TARGET_SLOT 0
#define EJS_BOUNDFUNC_THIS_SLOT 1
#define EJS_BOUNDFUNC_ARGC_SLOT 2
#define EJS_BOUNDFUNC_FIRST_ARG_SLOT 3
#define EJS_BOUNDFUNC_RESERVED_SLOT_COUNT 3

#define EJS_BOUNDFUNC_ENV_NEW(argc)      _ejs_closureenv_new(EJS_BOUNDFUNC_RESERVED_SLOT_COUNT + (argc))
#define EJS_BOUNDFUNC_ENV_GET_TARGET(bf) _ejs_closureenv_get_slot((bf), EJS_BOUNDFUNC_TARGET_SLOT)
#define EJS_BOUNDFUNC_ENV_GET_THIS(bf)   _ejs_closureenv_get_slot((bf), EJS_BOUNDFUNC_THIS_SLOT)
#define EJS_BOUNDFUNC_ENV_GET_ARGC(bf)   _ejs_closureenv_get_slot((bf), EJS_BOUNDFUNC_ARGC_SLOT)
#define EJS_BOUNDFUNC_ENV_GET_ARG(bf,a)  _ejs_closureenv_get_slot((bf), EJS_BOUNDFUNC_FIRST_ARG_SLOT + (a))

#define EJS_BOUNDFUNC_ENV_SET_TARGET(bf,v) (*_ejs_closureenv_get_slot_ref((bf), EJS_BOUNDFUNC_TARGET_SLOT) = v)
#define EJS_BOUNDFUNC_ENV_SET_THIS(bf,v)   (*_ejs_closureenv_get_slot_ref((bf), EJS_BOUNDFUNC_THIS_SLOT) = v)
#define EJS_BOUNDFUNC_ENV_SET_ARGC(bf,v)   (*_ejs_closureenv_get_slot_ref((bf), EJS_BOUNDFUNC_ARGC_SLOT) = v)
#define EJS_BOUNDFUNC_ENV_SET_ARG(bf,a,v)  (*_ejs_closureenv_get_slot_ref((bf), EJS_BOUNDFUNC_FIRST_ARG_SLOT + (a)) = v)

static EJS_NATIVE_FUNC(bound_wrapper) {
    EJS_ASSERT(EJSVAL_IS_UNDEFINED(newTarget)); // we don't currently support 'new $boundfunc()'

    ejsval target = EJS_BOUNDFUNC_ENV_GET_TARGET(env);
    ejsval thisArg = EJS_BOUNDFUNC_ENV_GET_THIS(env);
    uint32_t bound_argc = ToUint32(EJS_BOUNDFUNC_ENV_GET_ARGC(env));

    if (bound_argc == 0) {
        return _ejs_invoke_closure(target, &thisArg, argc, args, _ejs_undefined);
    }
    else if (argc == 0) {
        return _ejs_invoke_closure(target, &thisArg, bound_argc, _ejs_closureenv_get_slot_ref(env, EJS_BOUNDFUNC_FIRST_ARG_SLOT), _ejs_undefined);
    }
    else {
        uint32_t call_argc = argc + bound_argc;
        ejsval* call_args = alloca(sizeof(ejsval) * call_argc);
        memcpy (call_args, _ejs_closureenv_get_slot_ref(env, EJS_BOUNDFUNC_FIRST_ARG_SLOT), sizeof(ejsval) * bound_argc);
        memcpy (call_args + bound_argc, args, sizeof(ejsval) * argc);
        return _ejs_invoke_closure(target, &thisArg, call_argc, call_args, _ejs_undefined);
    }
}

// ECMA262 15.3.4.5
static EJS_NATIVE_FUNC(_ejs_Function_prototype_bind) {
    /* 1. Let Target be the this value. */
    ejsval Target = *_this;

    /* 2. If IsCallable(Target) is false, throw a TypeError exception. */
    if (!IsCallable(Target)) {
        _ejs_throw_nativeerror_utf8 (EJS_TYPE_ERROR, "object not a function");
    }

    ejsval thisArg = _ejs_undefined;
    if (argc > 0)
        thisArg = args[0];

    /* 3. Let A be a new (possibly empty) internal list of all of the argument values provided after thisArg (arg1, arg2 etc), in order. */
    int bound_argc = argc > 1 ? argc - 1 : 0;

    /* 4. Let F be a new native ECMAScript object . */

    ejsval bound_env = EJS_BOUNDFUNC_ENV_NEW(bound_argc);
    EJS_BOUNDFUNC_ENV_SET_TARGET(bound_env, Target);
    EJS_BOUNDFUNC_ENV_SET_THIS(bound_env, thisArg);
    EJS_BOUNDFUNC_ENV_SET_ARGC(bound_env, NUMBER_TO_EJSVAL(bound_argc));
    for (int i = 0; i < bound_argc; i ++) {
        EJS_BOUNDFUNC_ENV_SET_ARG(bound_env, i, args[i+1]);
    }

    ejsval target_name = _ejs_object_getprop (Target, _ejs_atom_name);
    ejsval bound_name;
    if (EJSVAL_IS_STRING(target_name))
        bound_name = _ejs_string_concat(_ejs_atom_bound_space, target_name);
    else
        bound_name = _ejs_atom_bound_space;

    ejsval F = _ejs_function_new_without_proto (bound_env, bound_name, bound_wrapper);
    EJSFunction *F_ = (EJSFunction*)EJSVAL_TO_OBJECT(F);
    ((EJSObject*)F_)->proto = EJSVAL_TO_OBJECT(Target)->proto;

    F_->bound = EJS_TRUE;

    return F;
}

EJS_NATIVE_FUNC(_ejs_Function_empty) {
    return _ejs_undefined;
}

static EJS_NATIVE_FUNC(_ejs_Function_create) {
    _ejs_throw_nativeerror_utf8 (EJS_ERROR, "ejs doesn't support dynamic creation of functions");
}

void
_ejs_function_set_derived_constructor (ejsval F)
{
    EJS_ASSERT(EJSVAL_IS_FUNCTION(F));
    EJSFunction *F_ = (EJSFunction*)EJSVAL_TO_OBJECT(F);
    F_->constructor_kind = CONSTRUCTOR_KIND_DERIVED;
    F_->function_kind = FUNCTION_KIND_CLASS_CONSTRUCTOR;
}

void
_ejs_function_set_base_constructor (ejsval F)
{
    EJS_ASSERT(EJSVAL_IS_FUNCTION(F));
    EJSFunction *F_ = (EJSFunction*)EJSVAL_TO_OBJECT(F);
    F_->constructor_kind = CONSTRUCTOR_KIND_BASE;
    F_->function_kind = FUNCTION_KIND_CLASS_CONSTRUCTOR;
}

static void
_ejs_function_init_proto()
{
    _ejs_gc_add_root (&_ejs_Function_prototype);

    // Function.prototype = function () { return undefined; }

    EJSFunction* proto = _ejs_gc_new(EJSFunction);
    _ejs_Function_prototype = OBJECT_TO_EJSVAL(proto);
    _ejs_init_object ((EJSObject*)proto, _ejs_Object_prototype, &_ejs_Function_specops);
    proto->func = _ejs_Function_empty;
    proto->env = _ejs_null;

    _ejs_object_define_value_property (OBJECT_TO_EJSVAL(proto), _ejs_atom_name, _ejs_atom_empty, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_CONFIGURABLE | EJS_PROP_NOT_WRITABLE);
}

void
_ejs_function_init(ejsval global)
{
    trace = getenv("EJS_TRACE") != NULL;

    _ejs_function_init_proto();

    _ejs_Function = _ejs_function_new_without_proto (_ejs_null, _ejs_atom_Function, _ejs_Function_impl);
    _ejs_object_setprop (global, _ejs_atom_Function, _ejs_Function);

    // ECMA262 15.3.3.1
    _ejs_object_define_value_property (_ejs_Function, _ejs_atom_prototype, _ejs_Function_prototype, EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_CONFIGURABLE | EJS_PROP_NOT_WRITABLE);
    // ECMA262 15.3.3.2
    _ejs_object_define_value_property (_ejs_Function, _ejs_atom_length, NUMBER_TO_EJSVAL(1), EJS_PROP_NOT_ENUMERABLE | EJS_PROP_NOT_CONFIGURABLE | EJS_PROP_NOT_WRITABLE);

#define PROTO_METHOD(x) EJS_INSTALL_ATOM_FUNCTION_FLAGS(_ejs_Function_prototype, x, _ejs_Function_prototype_##x, EJS_PROP_NOT_ENUMERABLE)

    PROTO_METHOD(toString);
    PROTO_METHOD(apply);
    PROTO_METHOD(call);
    PROTO_METHOD(bind);

#undef PROTO_METHOD

}

#define DEBUG_FUNCTION_ENTER(x) EJS_MACRO_START                         \
    if (trace) {                                                        \
        ejsval closure_name = _ejs_Function_prototype_toString (_ejs_null, x, 0, NULL); \
        char *closure_utf8 = ucs2_to_utf8(EJSVAL_TO_FLAT_STRING(closure_name)); \
        indent('*');                                                    \
        printf ("invoking %s\n", closure_utf8);                         \
        free (closure_utf8);                                            \
        indent_level += INDENT_AMOUNT;                                  \
    }                                                                   \
    EJS_MACRO_END
#define DEBUG_FUNCTION_EXIT(x) EJS_MACRO_START                          \
    if (trace) {                                                        \
        ejsval closure_name = _ejs_Function_prototype_toString (_ejs_null, x, 0, NULL); \
        char *closure_utf8 = ucs2_to_utf8(EJSVAL_TO_FLAT_STRING(closure_name)); \
        indent_level -= INDENT_AMOUNT;                                  \
        indent(' ');                                                    \
        printf ("returning from %s\n", closure_utf8);                   \
        free (closure_utf8);                                            \
    }                                                                   \
    EJS_MACRO_END

ejsval
_ejs_invoke_closure (ejsval closure, ejsval* _this, uint32_t argc, ejsval* args, ejsval newTarget)
{
    if (!EJSVAL_IS_FUNCTION(closure)) {
        _ejs_throw_nativeerror_utf8 (EJS_TYPE_ERROR, "object not a function");
    }

    EJSFunction* func = (EJSFunction*)EJSVAL_TO_OBJECT(closure);
    if (func->function_kind == FUNCTION_KIND_CLASS_CONSTRUCTOR) {
        _ejs_throw_nativeerror_utf8 (EJS_TYPE_ERROR, "class constructors are not callable as functions.  use 'new'");
    }

    return OP(EJSVAL_TO_OBJECT(closure),Call) (closure, *_this, argc, args);
}

ejsval
_ejs_construct_closure (ejsval _closure, ejsval* _this, uint32_t argc, ejsval* args, ejsval newTarget)
{
    *_this = Construct(_closure, newTarget, argc, args);
    return *_this;
}

ejsval
_ejs_construct_closure_apply (ejsval _closure, ejsval* _this, uint32_t argc, ejsval* args, ejsval newTarget)
{
    EJS_ASSERT(argc == 1);
    ejsval args_array = args[0];

    EJS_ASSERT(EJSVAL_IS_ARRAY(args_array));

    *_this = Construct(_closure, newTarget, EJS_ARRAY_LEN(args_array), EJS_DENSE_ARRAY_ELEMENTS(args_array));

    EJS_ASSERT(!EJSVAL_IS_UNDEFINED(*_this));

    return *_this;
}

// ECMA262: 15.3.5.3
static EJSBool
_ejs_function_specop_has_instance (ejsval F, ejsval V)
{
    /* 1. If V is not an object, return false. */
    if (!EJSVAL_IS_OBJECT(V))
        return EJS_FALSE;

    /* 2. Let O be the result of calling the [[Get]] internal method of F with property name "prototype". */
    ejsval O = OP(EJSVAL_TO_OBJECT(F),Get)(F, _ejs_atom_prototype, F);

    /* 3. If Type(O) is not Object, throw a TypeError exception. */
    if (!EJSVAL_IS_OBJECT(O)) {
        printf ("throw TypeError, O is not an object\n");
        EJS_NOT_IMPLEMENTED();
    }

    /* 4. Repeat */
    while (1) {
        /*    a. Let V be the value of the [[Prototype]] internal property of V. */
        V = EJSVAL_TO_OBJECT(V)->proto;
        /*    b. If V is null, return false. */
        if (EJSVAL_IS_NULL(V)) return EJS_FALSE;
        /*    c. If O and V refer to the same object, return true. */
        if (EJSVAL_EQ(O, V)) return EJS_TRUE;
    }
}

static EJSObject*
_ejs_function_specop_allocate ()
{
    // we shouldn't ever get here..
    EJS_NOT_IMPLEMENTED();
}

static void
_ejs_function_specop_finalize (EJSObject* obj)
{
    _ejs_Object_specops.Finalize (obj);
}

static void
_ejs_function_specop_scan (EJSObject* obj, EJSValueFunc scan_func)
{
    EJSFunction* f = (EJSFunction*)obj;
    scan_func (f->env);
    _ejs_Object_specops.Scan (obj, scan_func);
}

// ES2015, June 2015
// 9.2.1
static ejsval
_ejs_function_specop_call (ejsval F, ejsval _this, uint32_t argc, ejsval *args)
{
    // 1. Assert: F is an ECMAScript function object.
    EJS_ASSERT(EJSVAL_IS_FUNCTION(F));
    EJSFunction* F_ = (EJSFunction*)EJSVAL_TO_OBJECT(F);

    // 2. If F's [[FunctionKind]] internal slot is "classConstructor", throw a TypeError exception.
    if (F_->function_kind == FUNCTION_KIND_CLASS_CONSTRUCTOR) {
        _ejs_throw_nativeerror_utf8 (EJS_TYPE_ERROR, "class constructors are not callable");
    }

    // 3. Let callerContext be the running execution context.
    // 4. Let calleeContext be PrepareForOrdinaryCall(F, undefined).
    // 5. Assert: calleeContext is now the running execution context.
    // 6. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
    // 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
    // 8. Remove calleeContext from the execution context stack and restore callerContext as the running execution context.
    // 9. If result.[[type]] is return, return NormalCompletion(result.[[value]]).
    // 10. ReturnIfAbrupt(result).
    // 11. Return NormalCompletion(undefined)
    return F_->func (F_->env, &_this, argc, args, _ejs_undefined);
}

// ES2015, June 2015
// 9.2.2
static ejsval
_ejs_function_specop_construct (ejsval F, ejsval newTarget, uint32_t argc, ejsval* args)
{
    // 1. Assert: F is an ECMAScript function object.
    EJS_ASSERT(EJSVAL_IS_FUNCTION(F));
    EJSFunction* F_ = (EJSFunction*)EJSVAL_TO_OBJECT(F);

    // 2. Assert: Type(newTarget) is Object.
    EJS_ASSERT(EJSVAL_IS_OBJECT(newTarget));

    // 3. Let callerContext be the running execution context.

    // 4. Let kind be F's [[ConstructorKind]] internal slot.
    EJSConstructorKind kind = F_->constructor_kind;

    ejsval thisArgument = _ejs_undefined;
    // 5. If kind is "base", then
    if (kind == CONSTRUCTOR_KIND_BASE) {
        // a. Let thisArgument be OrdinaryCreateFromConstructor(newTarget, "%ObjectPrototype%").
        // b. ReturnIfAbrupt(thisArgument).
        thisArgument = OrdinaryCreateFromConstructor(newTarget, _ejs_Object_prototype, &_ejs_Object_specops);
    }

    // 6. Let calleeContext be PrepareForOrdinaryCall(F, newTarget).
    // 7. Assert: calleeContext is now the running execution context.
    // 8. If kind is "base", perform OrdinaryCallBindThis(F, calleeContext, thisArgument).
    // 9. Let constructorEnv be the LexicalEnvironment of calleeContext.
    // 10. Let envRec be constructorEnv's EnvironmentRecord.
    // 11. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
    ejsval result = F_->func (F_->env, &thisArgument, argc, args, newTarget);
    // 12. Remove calleeContext from the execution context stack and restore callerContext as the running execution context.
    // 13. If result.[[type]] is return, then
    // a. If Type(result.[[value]]) is Object, return NormalCompletion(result.[[value]]).
    if (EJSVAL_IS_OBJECT(result))
        return result;
    // b. If kind is "base", return NormalCompletion(thisArgument).
    if (kind == CONSTRUCTOR_KIND_BASE)
        return thisArgument;
    // c. If result.[[value]] is not undefined, throw a TypeError exception.
    if (!EJSVAL_IS_UNDEFINED(result)) {
        _ejs_throw_nativeerror_utf8 (EJS_TYPE_ERROR, "constructor returned non-object");
    }
    // 14. Else, ReturnIfAbrupt(result).
    // 15. Return envRec.GetThisBinding().
    return thisArgument;
}

EJS_DEFINE_CLASS(Function,
                 OP_INHERIT, // [[GetPrototypeOf]]
                 OP_INHERIT, // [[SetPrototypeOf]]
                 OP_INHERIT, // [[IsExtensible]]
                 OP_INHERIT, // [[PreventExtensions]]
                 OP_INHERIT, // [[GetOwnProperty]]
                 OP_INHERIT, // [[DefineOwnProperty]]
                 OP_INHERIT, // [[HasProperty]]
                 OP_INHERIT, // [[Get]]
                 OP_INHERIT, // [[Set]]
                 OP_INHERIT, // [[Delete]]
                 OP_INHERIT, // [[Enumerate]]
                 OP_INHERIT, // [[OwnPropertyKeys]]
                 _ejs_function_specop_call,      // [[Call]]
                 _ejs_function_specop_construct, // [[Construct]]
                 _ejs_function_specop_allocate,
                 _ejs_function_specop_finalize,
                 _ejs_function_specop_scan
                 )


text:
import { validateMax140Chars } from '.';
import { NexusGenAllTypes } from '../typegen';

export const validateCreateWeb = (
  input: NexusGenAllTypes['CreateWebInput'],
): Required<NexusGenAllTypes['CreateWebErrors']> => ({
  name: validateMax140Chars(input.name),
});


text:
package com.github.eostermueller.heapspank.leakyspank.console;

import static org.junit.Assert.*;

import org.junit.Test;

import com.github.eostermueller.heapspank.leakyspank.JMapHistoLine;
import com.github.eostermueller.heapspank.leakyspank.LeakySpankContext;
import com.github.eostermueller.heapspank.leakyspank.TheLeakiest;
import com.github.eostermueller.heapspank.leakyspank.LeakySpankContext.LeakResult;
import com.github.eostermueller.heapspank.leakyspank.Model;

public class TestTheLeakiestWithLeakySpankCalculations {
	private static final String RUN_A_LINE_1 = " 3512: 1 15 sun.reflect.GeneratedMethodAccessor2";
	private static final String RUN_A_LINE_2 = " 3513: 1 14 sun.reflect.GeneratedMethodAccessor1";
	private static final String RUN_A_LINE_3 = " 3511: 1 16 sun.reflect.GeneratedMethodAccessor3";

	private static final String RUN_B_LINE_1 = " 3514: 10 160 sun.reflect.GeneratedMethodAccessor1";
	private static final String RUN_B_LINE_2 = " 3513: 5 150 sun.reflect.GeneratedMethodAccessor2";

	private static final String RUN_C_LINE_1 = " 3514: 10 160 sun.reflect.GeneratedMethodAccessor1";
	private static final String RUN_C_LINE_2 = " 3512: 1 15 sun.reflect.GeneratedMethodAccessor2";
	//private static final String RUN_C_LINE_3 = " 3511: 1 16 sun.reflect.GeneratedMethodAccessor3";

	@Test
	public void testSimpleResultTransfer() {
		Model run_B = new Model();
		JMapHistoLine line1b = new JMapHistoLine(RUN_B_LINE_1);
		JMapHistoLine line2b = new JMapHistoLine(RUN_B_LINE_2);
		run_B.put(line1b);
		run_B.put(line2b);
		Model run_C = new Model();
		JMapHistoLine line1c = new JMapHistoLine(RUN_C_LINE_1);
		JMapHistoLine line2c = new JMapHistoLine(RUN_C_LINE_2);
		run_C.put(line1c);
		run_C.put(line2c);

		//long pid, int interval_in_seconds, int interval_count, int topNSupsects
		LeakySpankContext ctx = new LeakySpankContext(1,1,1,5);
		ctx.addJMapHistoRun(run_B);
		ctx.addJMapHistoRun(run_C);

		LeakResult[] results = ctx.getTopResults();
		TheLeakiest theLeakiest = new TheLeakiest(5);
		theLeakiest.addLeakResults(results);

		LeakResult[] allResults = theLeakiest.getTopResults();

		assertEquals("Put in 2 JMap histo lines, should have gotten 2 back out", 2, allResults.length);

		assertEquals(allResults[0].line.className , "sun.reflect.GeneratedMethodAccessor1");
		assertEquals(160, allResults[0].line.bytes);
		assertEquals(1, allResults[0].countRunsPresent);
		assertEquals(0, allResults[0].countRunsWithBytesIncrease);
		assertEquals(0, allResults[0].countRunsWithInstanceCountIncrease);
		assertEquals(0, allResults[0].countRunsWithLeakierRank);

		assertEquals(allResults[1].line.className , "sun.reflect.GeneratedMethodAccessor2");
		assertEquals(15, allResults[1].line.bytes);
		assertEquals(1, allResults[1].countRunsPresent);
		assertEquals(0, allResults[1].countRunsWithBytesIncrease);
		assertEquals(0, allResults[1].countRunsWithInstanceCountIncrease);
		assertEquals(1, allResults[1].countRunsWithLeakierRank);

	}

	@Test
	public void testThreeRuns() {
		JMapHistoLine line1a = new JMapHistoLine(RUN_A_LINE_1);
		JMapHistoLine line2a = new JMapHistoLine(RUN_A_LINE_2);
		JMapHistoLine line3a = new JMapHistoLine(RUN_A_LINE_3);
		Model run_A = new Model();
		run_A.put(line1a);
		run_A.put(line2a);
		run_A.put(line3a);

		JMapHistoLine line1b = new JMapHistoLine(RUN_B_LINE_1);
		JMapHistoLine line2b = new JMapHistoLine(RUN_B_LINE_2);
		Model run_B = new Model();
		run_B.put(line1b);
		run_B.put(line2b);
		JMapHistoLine line1c = new JMapHistoLine(RUN_C_LINE_1);
		JMapHistoLine line2c = new JMapHistoLine(RUN_C_LINE_2);
//		JMapHistoLine line3c = new JMapHistoLine(RUN_C_LINE_3);
		Model run_C = new Model();
		run_C.put(line1c);
		run_C.put(line2c);
	//	run_C.put(line3c);

		//long pid, int interval_in_seconds, int interval_count, int topNSupsects
		LeakySpankContext ctx = new LeakySpankContext(1,1,5,5);
		ctx.addJMapHistoRun(run_A);
		ctx.addJMapHistoRun(run_B);
		ctx.addJMapHistoRun(run_C);

		LeakResult[] results = ctx.getLeakSuspectsOrdered();
		TheLeakiest theLeakiest = new TheLeakiest(5);
		theLeakiest.addLeakResults(results);

		LeakResult[] allResults = theLeakiest.getTopResults();

		assertEquals("Only put 3 JMap histo lines in the latest run , so should have gotten exactly 2 back out", 2, allResults.length);

		assertEquals("sun.reflect.GeneratedMethodAccessor1", allResults[0].line.className  );
		//assertEquals(16, allResults[0].line.bytes);
		assertEquals(2, allResults[0].countRunsPresent);
		assertEquals(1, allResults[0].countRunsWithBytesIncrease);
		assertEquals(1, allResults[0].countRunsWithInstanceCountIncrease);
		assertEquals(0, allResults[0].countRunsWithLeakierRank);

		assertEquals("sun.reflect.GeneratedMethodAccessor2", allResults[1].line.className );
		assertEquals(15, allResults[1].line.bytes);
		assertEquals(2, allResults[1].countRunsPresent);
		assertEquals(1, allResults[1].countRunsWithBytesIncrease);
		assertEquals(1, allResults[1].countRunsWithInstanceCountIncrease);
		assertEquals(1, allResults[1].countRunsWithLeakierRank);
	}

}


text:
import {BaseTileLayer} from 'react-leaflet';
import { PropTypes } from 'react';
import { tileLayer } from 'leaflet';
import { featureLayer } from 'esri-leaflet'

var esri = require('esri-leaflet')

export default class ESRIFeatureLayer extends BaseTileLayer {
  componentWillMount() {
    super.componentWillMount();
    const { url, layerStyle, zoom, max_zoom, min_zoom, center } = this.props;

    //make sure style json is set to null
    //styles defined by leaflet path
    //http://leafletjs.com/reference.html#path-options
    var jsonSyle ={}
    if(layerStyle){
      jsonSyle= JSON.parse(layerStyle);
    }
    //make sure maxzoom json is set to null
    var the_max_zoom = 19;
    if(max_zoom){
      the_max_zoom = max_zoom;
    }
    //make sure min_zoom json is set to null
    var the_min_zoom = 0;
    if(min_zoom){
      the_min_zoom = min_zoom;
    }

    //add layer to map with style
    this.leafletElement = esri.featureLayer({url:url,
    style: function(){
        return jsonSyle
      },
    maxZoom: the_max_zoom,
    minZoom: the_min_zoom,

    })

    var name = this.props.name
    //this.leafletElement is the layer to map.addLayer(name) or map.removeLayer(name) - toggle layer
    //this.setState({maplayer:[{name,layer:this.leafletElement}] })
    this.props.setMapLayers({name,layer:this.leafletElement})

  }
}


text:
Sprint Log 25

start date: 08/21/2016

end date: 09/03/2016

Day 1 Scrum Meeting
Date: 08/21/2016
 - plague trooper walk

Day 2 Scrum Meeting
Date: 08/22/2016
 - plague trooper stand

Day 3 Scrum Meeting
Date: 08/23/2016
 - knight attack sprite

Day 4 Scrum Meeting
Date: 08/24/2016
 - generalized AI

Day 5 Scrum Meeting
Date: 08/25/2016
 - generalized AI

Day 6 Scrum Meeting
Date: 08/26/2016
 - fixed missing dependencies in the prototype
 - adjusted timings on the animations
 - refactored AI
 - fixed origin and collision glitches

Day 7 Scrum Meeting
Date: 08/27/2016
 - ability and item system
 - HUD
 - refactored keyboard input system
 - adjusted UI

Day 8 Scrum Meeting
Date: 08/28/2016
 -

Goals for this sprint:
	combat
		damage
		blood effects
		damage number
		knockback
	Level Editor

	Dungeon Generation
		load entire dungeon


text:
class LRU
  size = 5;
  hash = {};

  def get(key)
  end

  def set(key,value)
  end

end

class Node
  attr_accessor :next_node
  attr_accessor :prev_node
  attr_accessor :data

  def initialize(data=null, n=null, p=null)
    @data = data
    @next_node = n
    @prev_node = p
  end
end

class DoublyLinkedList
  attr_accessor :head, :tail, :max_size, :size

  def initialize(max_size)
      @size = 0
      @head = null
      @tail = null
  end

  def push(node)
    if size == 0
      @tail = node
    end

    node.next_node = @head
    node.prev_node = null
    @head = node
    @size = @size + 1
  end

  def delete(node)

    if @size == 0
      return
    end
    if @size == 1
      @head = null
      @tail = null
    elsif node != @head && node != @tail
      node.prev_node.next_node=node.next_node
      node.next_node.prev_node=node.prev_node
    elsif node == @head
      node.next_node.prev_node=node.prev_node
    elsif node == @tail
      node.prev_node.next_node=node.next_node
    end
    @size = @size - 1
    #node.prev_node = node.next_node = null
    #node = null
  end

end


text:
      amv System Demo

        {{topnavigation.gitinfo.local.branch.name}}-{{topnavigation.gitinfo.local.branch.shortSHA}}

Home

Settings

About

Home

Settings

About

    menu


text:
package com.baidubce.services.cdn.model.domain;

import com.baidubce.services.cdn.model.CdnRequest;

/**
 * Quick UDP Internet Connection(QUIC)
 */
public class SetDomainQUICRequest extends CdnRequest {

    private boolean QUIC;

    public boolean isQUIC() {
        return QUIC;
    }

    public void setQUIC(boolean QUIC) {
        this.QUIC = QUIC;
    }

    /**
     * @param QUIC
     * @return this object
     */
    public SetDomainQUICRequest withQUIC(boolean QUIC) {
        setQUIC(QUIC);
        return this;
    }
}


text:
package API.amazon.mws.feeds.model;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for anonymous complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="Marketplace" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="Merchant" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="NextToken" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 * Generated by AWS Code Generator
 *

 * Wed Feb 18 13:28:59 PST 2009
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "marketplace",
    "merchant",
    "nextToken"
})
@XmlRootElement(name = "GetFeedSubmissionListByNextTokenRequest")
public class GetFeedSubmissionListByNextTokenRequest {

    @XmlElement(name = "Marketplace")
    protected String marketplace;
    @XmlElement(name = "Merchant", required = true)
    protected String merchant;
    @XmlElement(name = "NextToken", required = true)
    protected String nextToken;

    /**
     * Default constructor
     *
     */
    public GetFeedSubmissionListByNextTokenRequest() {
        super();
    }

    /**
     * Value constructor
     *
     */
    public GetFeedSubmissionListByNextTokenRequest(final String marketplace, final String merchant, final String nextToken) {
        this.marketplace = marketplace;
        this.merchant = merchant;
        this.nextToken = nextToken;
    }

    /**
     * Gets the value of the marketplace property.
     *
     * @deprecated  See {@link #setMarketplace(String)}
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getMarketplace() {
        return marketplace;
    }

    /**
     * Sets the value of the marketplace property.
     * @deprecated Not used anymore.  MWS ignores this parameter, but it is left
     * in here for backwards compatibility.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setMarketplace(String value) {
        this.marketplace = value;
    }

    /**
     * @deprecated  See {@link #setMarketplace(String)}
     */
    public boolean isSetMarketplace() {
        return (this.marketplace!= null);
    }

    /**
     * Gets the value of the merchant property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getMerchant() {
        return merchant;
    }

    /**
     * Sets the value of the merchant property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setMerchant(String value) {
        this.merchant = value;
    }

    public boolean isSetMerchant() {
        return (this.merchant!= null);
    }

    /**
     * Gets the value of the nextToken property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getNextToken() {
        return nextToken;
    }

    /**
     * Sets the value of the nextToken property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setNextToken(String value) {
        this.nextToken = value;
    }

    public boolean isSetNextToken() {
        return (this.nextToken!= null);
    }

    /**
     * Sets the value of the Marketplace property.
     *
     * @deprecated  See {@link #setMarketplace(String)}
     * @param value
     * @return
     *     this instance
     */
    public GetFeedSubmissionListByNextTokenRequest withMarketplace(String value) {
        setMarketplace(value);
        return this;
    }

    /**
     * Sets the value of the Merchant property.
     *
     * @param value
     * @return
     *     this instance
     */
    public GetFeedSubmissionListByNextTokenRequest withMerchant(String value) {
        setMerchant(value);
        return this;
    }

    /**
     * Sets the value of the NextToken property.
     *
     * @param value
     * @return
     *     this instance
     */
    public GetFeedSubmissionListByNextTokenRequest withNextToken(String value) {
        setNextToken(value);
        return this;
    }

    /**
     *
     * JSON fragment representation of this object
     *
     * @return JSON fragment for this object. Name for outer
     * object expected to be set by calling method. This fragment
     * returns inner properties representation only
     *
     */
    protected String toJSONFragment() {
        StringBuffer json = new StringBuffer();
        boolean first = true;
        if (isSetMarketplace()) {
            if (!first) json.append(", ");
            json.append(quoteJSON("Marketplace"));
            json.append(" : ");
            json.append(quoteJSON(getMarketplace()));
            first = false;
        }
        if (isSetMerchant()) {
            if (!first) json.append(", ");
            json.append(quoteJSON("Merchant"));
            json.append(" : ");
            json.append(quoteJSON(getMerchant()));
            first = false;
        }
        if (isSetNextToken()) {
            if (!first) json.append(", ");
            json.append(quoteJSON("NextToken"));
            json.append(" : ");
            json.append(quoteJSON(getNextToken()));
            first = false;
        }
        return json.toString();
    }

    /**
     *
     * Quote JSON string
     */
    private String quoteJSON(String string) {
        StringBuffer sb = new StringBuffer();
        sb.append("\"");
        int length = string.length();
        for (int i = 0; i < length; ++i) {
            char c = string.charAt(i);
            switch (c) {
            case '"':
                sb.append("\\\"");
                break;
            case '\\':
                sb.append("\\\\");
                break;
            case '/':
                sb.append("\\/");
                break;
            case '\b':
                sb.append("\\b");
                break;
            case '\f':
                sb.append("\\f");
                break;
            case '\n':
                sb.append("\\n");
                break;
            case '\r':
                sb.append("\\r");
                break;
            case '\t':
                sb.append("\\t");
                break;
            default:
                if (c <  ' ') {
                    sb.append("\\u" + String.format("%03x", Integer.valueOf(c)));
                } else {
                sb.append(c);
            }
        }
        }
        sb.append("\"");
        return sb.toString();
    }

}


text:
FROM cogrob/omnimapper-dox
MAINTAINER Cognitive Robotics "http://cogrob.org/"

USER dox

# download and unzip gtsam
ENV GTSAM_VERSION 3.2.0
WORKDIR /home/dox
RUN wget https://research.cc.gatech.edu/borg/sites/edu.borg/files/downloads/gtsam-${GTSAM_VERSION}.tgz \
	&& mkdir gtsam \
	&& tar -xvzf gtsam-${GTSAM_VERSION}.tgz --strip=1 -C gtsam/ \
	&& rm gtsam-${GTSAM_VERSION}.tgz

# build and install gtsam
RUN cd /home/dox/gtsam/ \
	&& mkdir build \
	&& cd build \
	&& cmake .. \
	&& make -j8 \
	&& sudo make install

COPY HouseholderQR.h /usr/include/eigen3/Eigen/src/QR/HouseholderQR.h
COPY CommaInitializer.h /usr/include/eigen3/Eigen/src/CommaInitializer.h
RUN sudo chmod 644 /usr/include/eigen3/Eigen/src/QR/HouseholderQR.h
RUN sudo chmod 644 /usr/include/eigen3/Eigen/src/CommaInitializer.h

# clone omnimapper project
WORKDIR /home/dox
RUN git clone https://github.com/CognitiveRobotics/omnimapper.git

# build omnimapper project
RUN cd /home/dox/omnimapper/ \
	&& mkdir build \
	&& cd build \
	&& cmake .. \
	&& make -j8

# build omnimapper ros wrapper
# Need to use script to use easly use local variables set from .bashrc
WORKDIR /home/dox
RUN sudo chown dox /home/dox/.bashrc

ADD build.sh /home/dox/build.sh
RUN sudo chown dox /home/dox/build.sh \
	&& bash /home/dox/build.sh


text:
<?xml version="1.0" encoding="utf-8"?>

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

<paths
    xmlns:tools="http://schemas.android.com/tools">
  <!-- Based on default Glide operation, see InternalCacheDiskCacheFactory instantiated
                   from GlideBuilder.createGlide() -->
  <cache-path
      name="share"
      path="image_manager_disk_cache"
      tools:path="DiskCache.Factory.DEFAULT_DISK_CACHE_DIR"/>
</paths>


text:
package client.model;

import java.io.Serializable;
import java.util.UUID;

import client.model.enums.GameColor;

public class Wall implements Serializable{

	private static final long serialVersionUID = 2305273572387917119L;

	private String id;
	private String gameMapId;

	private int x; //x-position
	private int y; //y-position

	private GameColor color;

	public Wall(int x,int y, String gameMapId) {
		id = UUID.randomUUID().toString();
		color = GameColor.NONE;
		this.gameMapId = gameMapId;
		this.x=x;
		this.y=y;
	}

	public String getGameMapId() {
		return gameMapId;
	}

	public void setGameMapId(String gameMapId) {
		this.gameMapId = gameMapId;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public GameColor getColor() {
		return color;
	}

	public void setColor(GameColor color) {
		this.color = color;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getId() {
		return id;
	}

	@Override
	public String toString() {
		return color.toString() +" Wall ("+x+","+y+")";
	}

}


text:
package mfengin;

import java.util.Scanner;
import javax.swing.JFileChooser;
import java.io.*;

//Class Description:
//The ESQLReader class reads ESQL from text file, format it and split it into clauses.

public class ESQLReader
{
	public static void main(String[] args)
	{
		// TODO Auto-generated method stub

		String strESQL = readESQL();
		strESQL = formatESQL(strESQL);
	}

	//Public Interfaces:

	public static String getESQL()
	{
		String strESQL = readESQL();
		String strFormatedESQL = formatESQL(strESQL);
		return strFormatedESQL;
	}

	//Inner Procedures:

	private static String readESQL()
	{
		//store the complete ESQL statement
		String strESQL = new String();
		JFileChooser fileChosser = new JFileChooser("./");

		//read ESQL from file
		if (JFileChooser.APPROVE_OPTION == fileChosser.showOpenDialog(null))
		{
			File esqlFile = fileChosser.getSelectedFile();
			try
			{
				Scanner inputFromFile = new Scanner(esqlFile);

				while (inputFromFile.hasNext())
				{
					//read all the lines of the ESQL file into a string
					//and separate them with whitespace
					strESQL +=  inputFromFile.nextLine() + " ";
				}

				inputFromFile.close();
			}
			catch (FileNotFoundException exception)
			{
				exception.printStackTrace();
				System.exit(1);
			}
		}
		else
		{
			System.exit(1);
		}

		return strESQL;
	}

	private static String formatESQL(String in_strESQL)
	{
		String strResult = new String();

		//the strings within a pair of "'"
		//are exempt from all format operations

		//1. Lower Case
		//convert all characters into lower case,
		String[] tokensForLowerCase = in_strESQL.split("'");
		for (int i = 0; i < tokensForLowerCase.length; i++)
		{
			if (i % 2 == 0)
			{
				//tokens[i] is beyond the pair of "'"
				tokensForLowerCase[i] = tokensForLowerCase[i].toLowerCase();
			}

			//reassemble the tokens
			strResult += tokensForLowerCase[i];
			if (i < tokensForLowerCase.length - 1)
			{
				strResult += "'";
			}
		}

		//2. unify separators
		//convert '\t' or multiple continuous white spaces into one,
		//(assume the values of the records do not contain multiple continuous white spaces)
		strResult = strResult.replaceAll("\t", " ");
		String[] tokensForUniform = strResult.split(" ");
		strResult = new String();
		for (int i = 0; i < tokensForUniform.length; i++)
		{
			if (!tokensForUniform[i].isEmpty())
			{
				strResult += tokensForUniform[i];
				if (i < tokensForUniform.length - 1)
				{
					strResult += " ";
				}
			}
		}

		//3 trim the ESQL
		strResult = strResult.trim();

		return strResult;
	}

}


text:
package org.apache.jackrabbit.oak.api;

import java.math.BigDecimal;

import javax.jcr.PropertyType;

import com.google.common.base.Objects;

import static com.google.common.base.Preconditions.checkState;

/**
 * Instances of this class map Java types to {@link PropertyType property types}.
 * Passing an instance of this class to {@link PropertyState#getValue(Type)} determines
 * the return type of that method.
 * @param <T>
 */
public final class Type<T> {

    /** Map {@code String} to {@link PropertyType#STRING} */
    public static final Type<String> STRING = create(PropertyType.STRING, false);

    /** Map {@code Blob} to {@link PropertyType#BINARY} */
    public static final Type<Blob> BINARY = create(PropertyType.BINARY, false);

    /** Map {@code Long} to {@link PropertyType#LONG} */
    public static final Type<Long> LONG = create(PropertyType.LONG, false);

    /** Map {@code Double} to {@link PropertyType#DOUBLE} */
    public static final Type<Double> DOUBLE = create(PropertyType.DOUBLE, false);

    /** Map {@code String} to {@link PropertyType#DATE} */
    public static final Type<String> DATE = create(PropertyType.DATE, false);

    /** Map {@code Boolean} to {@link PropertyType#BOOLEAN} */
    public static final Type<Boolean> BOOLEAN = create(PropertyType.BOOLEAN, false);

    /** Map {@code String} to {@link PropertyType#STRING} */
    public static final Type<String> NAME = create(PropertyType.NAME, false);

    /** Map {@code String} to {@link PropertyType#PATH} */
    public static final Type<String> PATH = create(PropertyType.PATH, false);

    /** Map {@code String} to {@link PropertyType#REFERENCE} */
    public static final Type<String> REFERENCE = create(PropertyType.REFERENCE, false);

    /** Map {@code String} to {@link PropertyType#WEAKREFERENCE} */
    public static final Type<String> WEAKREFERENCE = create(PropertyType.WEAKREFERENCE, false);

    /** Map {@code String} to {@link PropertyType#URI} */
    public static final Type<String> URI = create(PropertyType.URI, false);

    /** Map {@code BigDecimal} to {@link PropertyType#DECIMAL} */
    public static final Type<BigDecimal> DECIMAL = create(PropertyType.DECIMAL, false);

    /** Map {@code Iterable<String>} to array of {@link PropertyType#STRING} */
    public static final Type<Iterable<String>> STRINGS = create(PropertyType.STRING, true);

    /** Map {@code Iterable<Blob>} to array of {@link PropertyType#BINARY} */
    public static final Type<Iterable<Blob>> BINARIES = create(PropertyType.BINARY, true);

    /** Map {@code Iterable<Long>} to array of {@link PropertyType#LONG} */
    public static final Type<Iterable<Long>> LONGS = create(PropertyType.LONG, true);

    /** Map {@code Iterable<Double>} to array of {@link PropertyType#DOUBLE} */
    public static final Type<Iterable<Double>> DOUBLES = create(PropertyType.DOUBLE, true);

    /** Map {@code Iterable<String>} to array of {@link PropertyType#DATE} */
    public static final Type<Iterable<String>> DATES = create(PropertyType.DATE, true);

    /** Map {@code Iterable<Boolean>} to array of {@link PropertyType#BOOLEAN} */
    public static final Type<Iterable<Boolean>> BOOLEANS = create(PropertyType.BOOLEAN, true);

    /** Map {@code Iterable<String>} to array of {@link PropertyType#NAME} */
    public static final Type<Iterable<String>> NAMES = create(PropertyType.NAME, true);

    /** Map {@code Iterable<String>} to array of {@link PropertyType#PATH} */
    public static final Type<Iterable<String>> PATHS = create(PropertyType.PATH, true);

    /** Map {@code Iterable<String>} to array of {@link PropertyType#REFERENCE} */
    public static final Type<Iterable<String>> REFERENCES = create(PropertyType.REFERENCE, true);

    /** Map {@code Iterable<String>} to array of {@link PropertyType#WEAKREFERENCE} */
    public static final Type<Iterable<String>> WEAKREFERENCES = create(PropertyType.WEAKREFERENCE, true);

    /** Map {@code Iterable<String>} to array of {@link PropertyType#URI} */
    public static final Type<Iterable<String>> URIS = create(PropertyType.URI, true);

    /** Map {@code Iterable<BigDecimal>} to array of {@link PropertyType#DECIMAL} */
    public static final Type<Iterable<BigDecimal>> DECIMALS = create(PropertyType.DECIMAL, true);

    private final int tag;
    private final boolean array;

    private Type(int tag, boolean array){
        this.tag = tag;
        this.array = array;
    }

    private static <T> Type<T> create(int tag, boolean array) {
        return new Type<T>(tag, array);
    }

    /**
     * Corresponding type tag as defined in {@link PropertyType}.
     * @return  type tag
     */
    public int tag() {
        return tag;
    }

    /**
     * Determine whether this is an array type
     * @return  {@code true} if and only if this is an array type
     */
    public boolean isArray() {
        return array;
    }

    /**
     * Corresponding {@code Type} for a given type tag and array flag.
     * @param tag  type tag as defined in {@link PropertyType}.
     * @param array  whether this is an array or not
     * @return  {@code Type} instance
     * @throws IllegalArgumentException if tag is not valid as per definition in {@link PropertyType}.
     */
    public static Type<?> fromTag(int tag, boolean array) {
        switch (tag) {
            case PropertyType.STRING: return array ? STRINGS : STRING;
            case PropertyType.BINARY: return array ? BINARIES : BINARY;
            case PropertyType.LONG: return array ? LONGS : LONG;
            case PropertyType.DOUBLE: return array ? DOUBLES : DOUBLE;
            case PropertyType.DATE: return array ? DATES: DATE;
            case PropertyType.BOOLEAN: return array ? BOOLEANS: BOOLEAN;
            case PropertyType.NAME: return array ? NAMES : NAME;
            case PropertyType.PATH: return array ? PATHS: PATH;
            case PropertyType.REFERENCE: return array ? REFERENCES : REFERENCE;
            case PropertyType.WEAKREFERENCE: return array ? WEAKREFERENCES : WEAKREFERENCE;
            case PropertyType.URI: return array ? URIS: URI;
            case PropertyType.DECIMAL: return array ? DECIMALS : DECIMAL;
            default: throw new IllegalArgumentException("Invalid type tag: " + tag);
        }
    }

    /**
     * Determine the base type of array types
     * @return  base type
     * @throws IllegalStateException if {@code isArray} is false.
     */
    public Type<?> getBaseType() {
        checkState(isArray(), "Not an array");
        return fromTag(tag, false);
    }

    /**
     * Determine the array type which has this type as base type
     * @return  array type with this type as base type
     * @throws IllegalStateException if {@code isArray} is true.
     */
    public Type<?> getArrayType() {
        checkState(!isArray(), "Not a simply type");
        return fromTag(tag, true);
    }

    @Override
    public String toString() {
        return isArray()
            ? "[]" + PropertyType.nameFromValue(getBaseType().tag)
            : PropertyType.nameFromValue(tag);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(tag, array);
    }

    @Override
    public boolean equals(Object other) {
        return this == other;
    }

}


text:
{% extends "base.html" %}{% import "components/forms.html" as forms with context %}

{% block title %}Login{% endblock %}

{% block body %}

        {% if g.current_account and not current_account.is_anonymous %}

You Are Logged in as {{ g.current_account }}

If you'd like, you can add multiple authentication methods to your account. You will still have only one overall account, but with
                    multiple ways of logging in.

        {% endif %}

                {% if g.current_account and not current_account.is_anonymous %}

Add Email Login

                    Add Email Login
                {% else %}

Email Login

                    {{ forms.show_form(form, action=url_for('users.login'), submit_icon='user', submit_button_text='Login') }}

                        Signup by Email • Forgot Your Password?

                {% endif %}

                {% if g.current_account %}

Add Social Login

                {% else %}

Social Login

                {% endif %}

                    {% for provider_code, provider in login_providers.items() %}

                                {% if provider.icon %}

                                {% endif %}
                                {{ provider.name }}

                    {% endfor %}

        {% if g.current_account and not current_account.is_anonymous %}

If you'd like to login as another user, logout first.

                     {% trans %}Logout{% endtrans %}

        {% endif %}

    {% if result %}
        {# Check for errors. #}
        {% if result.error %}

Problem Logging In

{{ result.error.message }}

        {% endif %}
    {% endif %}
{% endblock body %}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII" />
<title>
  File: README

    — Documentation by YARD 0.8.3

</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />

    Index »
    File: README

(no frames)

      Class List

      Method List

      File List

README A Brandwatch rake wrapper, Brake

Brake, A Cucumber options parser wrapper for Rake, because, cake was
already taken!, Give Rake a Brake. Usage: brake <task> [options]

Cucmber options:

-t, --tags @high,@login          Array:  A list of all tagged test to be run
-d, --dry-run                    Bool: Invokes the formatters without executing steps
-v, --verbose                    Bool: Show the files and features loaded
-f, --format pretty              String: How to format the output (Default: pretty)
-S, --strict                     Bool: Fail if there are and undefined or pending steps
-n, --name featureName           String: Only execute features with a partial match to the given name
-g, --guess                      Bool: Guess best match for ambiguous steps
-x, --expand                     Bool: Expand scenario outline tables in output

Global options:

-e, --enviroment release         String: The enviroment to run the tests against eg Release
-l, --log_level debug            String: The log output level debug|info
-c, --controller chrome          String: The type of controller to run (API, Chrome, Safari)
    --[no-]headless              Bool: To turn on/off headless mode (only works on Linux!)
    --[no-]cleanup               Bool: To turn on/off setup cleanup
    --[no-]database              Bool: Defines whether to log out to the database
    --[no-]jenkins               Bool: Defines whether to log out to the jenkins specific database
    --retries 3                  String: The number of retries to perform on element methods
    --timeouts 10                String: The length of the timeouts on element methods

Web options:

-s, --screen 1280,1024           Array:  The width,hight of the browser window
-p, --position 0,0               Array:  The x,y coords of the browser 0,0 top left

Browser options:

-H, --[no-]highlight             Bool: To turn on/off the highlight of elements

Brake options:

-V, --version                    Bool: Output the current version of brake
-I, --iterate 5                  Int: Number of times to run the task
-U, --[no-]untangle              Bool: Turns Debug on/off
-h, --help                       You're Looking at it

For further assistance please contact Ben Slaughter or Jonathan Chrisp
bens@brandwatch.com or jonathan@brandwatch.com

Release Notes: 0.1.0 Class structure created

0.1.6 Code cleanup Changed the names so that all the task names are strings
rather than half symbol and half strings

0.2.0 Added this readme file Cleaned up the debug code Added the Version
output to display the current version number Added the debug method so that
the code looks cleaner and easier to understand Added the RuntimeError
handling to mimic the same rake functionality Moved rake requier to be
called before the Brakefile load

0.2.1 Ben - Added cucumber dry run Ben - Added -s as default (removes
source)

0.2.2 Jon - Updated API task to run release as default

0.2.3 Ben - Removed '--require features' from the default args so now only
-P disable profiles and -s disable source code line numbers Ben - Removed
platform, this is no longer required

0.2.4 Ben - Some typos in comments and improved readme and code comments
for yard docs Jon - Added headless, retries, highlight and cleanup options

0.3.0 Ben - Improved code, Cleaned up options parser, now a single block of
code Ben - There are no more pre included tasks, it is either default or
user entered Ben - Error checking on screen and position Ben - Brake passes
a hash of arguments to the rake task Ben - Cucumber options added and task
iterations

0.3.0 Ben - Format was missing the layout definition in the options parser

0.3.2 Ben - Added cucumber options: strict, name, guess, expand

0.3.3 Ben - Added Docs and fixed a few comment typos and changes for docs
Ben - Added brake version option

0.3.4 Ben - Added the exit code to mimic what is returned from the task Ben
- Fixed test iterate

0.3.5 Jon - Added the database option Jon - Added the jenkins option Jon -
Cleaned up spelling errors

0.3.6  Jon - Added database flag to jenkins option so no longer to include
database flag also

0.3.7 Jon - Updated gemspec, added new homepage as now on GitHub, created
and changed license to MIT and added .gitignore file

END

  Generated on Thu Feb 14 22:26:34 2013 by
  yard
  0.8.3 (ruby-1.9.3).


text:
<?php

final class PhabricatorMailManagementReceiveTestWorkflow
  extends PhabricatorMailManagementWorkflow {

  protected function didConstruct() {
    $this
      ->setName('receive-test')
      ->setSynopsis(
        pht(
          'Simulate receiving mail. This is primarily useful if you are '.
          'developing new mail receivers.'))
      ->setExamples(
        '**receive-test** --as alincoln --to D123 < body.txt')
      ->setArguments(
        array(
          array(
            'name'    => 'as',
            'param'   => 'user',
            'help'    => pht('Act as the specified user.'),
          ),
          array(
            'name'    => 'from',
            'param'   => 'email',
            'help'    => pht('Simulate mail delivery "From:" the given user.'),
          ),
          array(
            'name'    => 'to',
            'param'   => 'object',
            'help'    => pht('Simulate mail delivery "To:" the given object.'),
          ),
          array(
            'name' => 'cc',
            'param' => 'address',
            'help' => pht('Simulate a mail delivery "Cc:" address.'),
            'repeat' => true,
          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {
    $viewer = $this->getViewer();
    $console = PhutilConsole::getConsole();

    $to = $args->getArg('to');
    if (!$to) {
      throw new PhutilArgumentUsageException(
        pht(
          "Use '%s' to specify the receiving object or email address.",
          '--to'));
    }

    $to_application_email = id(new PhabricatorMetaMTAApplicationEmailQuery())
      ->setViewer($this->getViewer())
      ->withAddresses(array($to))
      ->executeOne();

    $as = $args->getArg('as');
    if (!$as && $to_application_email) {
      $default_phid = $to_application_email->getConfigValue(
        PhabricatorMetaMTAApplicationEmail::CONFIG_DEFAULT_AUTHOR);
      if ($default_phid) {
        $default_user = id(new PhabricatorPeopleQuery())
          ->setViewer($this->getViewer())
          ->withPHIDs(array($default_phid))
          ->executeOne();
        if ($default_user) {
          $as = $default_user->getUsername();
        }
      }
    }

    if (!$as) {
      throw new PhutilArgumentUsageException(
        pht("Use '--as' to specify the acting user."));
    }

    $user = id(new PhabricatorPeopleQuery())
      ->setViewer($this->getViewer())
      ->withUsernames(array($as))
      ->executeOne();
    if (!$user) {
      throw new PhutilArgumentUsageException(
        pht("No such user '%s' exists.", $as));
    }

    $from = $args->getArg('from');
    if (!$from) {
      $from = $user->loadPrimaryEmail()->getAddress();
    }

    $cc = $args->getArg('cc');

    $console->writeErr("%s\n", pht('Reading message body from stdin...'));
    $body = file_get_contents('php://stdin');

    $received = new PhabricatorMetaMTAReceivedMail();
    $header_content = array(
      'Message-ID' => Filesystem::readRandomCharacters(12),
      'From'       => $from,
      'Cc' => implode(', ', $cc),
    );

    if (preg_match('/.+@.+/', $to)) {
      $header_content['to'] = $to;
    } else {

      // We allow the user to use an object name instead of a real address
      // as a convenience. To build the mail, we build a similar message and
      // look for a receiver which will accept it.

      // In the general case, mail may be processed by multiple receivers,
      // but mail to objects only ever has one receiver today.

      $pseudohash = PhabricatorObjectMailReceiver::computeMailHash('x', 'y');

      $raw_target = $to.'+1+'.$pseudohash;
      $target = new PhutilEmailAddress($raw_target.'@local.cli');

      $pseudomail = id(new PhabricatorMetaMTAReceivedMail())
        ->setHeaders(
          array(
            'to' => $raw_target,
          ));

      $receivers = id(new PhutilClassMapQuery())
        ->setAncestorClass('PhabricatorMailReceiver')
        ->setFilterMethod('isEnabled')
        ->execute();

      $receiver = null;
      foreach ($receivers as $possible_receiver) {
        $possible_receiver = id(clone $possible_receiver)
          ->setViewer($viewer)
          ->setSender($user);

        if (!$possible_receiver->canAcceptMail($pseudomail, $target)) {
          continue;
        }
        $receiver = $possible_receiver;
        break;
      }

      if (!$receiver) {
        throw new Exception(
          pht("No configured mail receiver can accept mail to '%s'.", $to));
      }

      if (!($receiver instanceof PhabricatorObjectMailReceiver)) {
        $class = get_class($receiver);
        throw new Exception(
          pht(
            "Receiver '%s' accepts mail to '%s', but is not a ".
            "subclass of PhabricatorObjectMailReceiver.",
            $class,
            $to));
      }

      $object = $receiver->loadMailReceiverObject($to, $user);
      if (!$object) {
        throw new Exception(pht("No such object '%s'!", $to));
      }

      $mail_key = PhabricatorMetaMTAMailProperties::loadMailKey($object);

      $hash = PhabricatorObjectMailReceiver::computeMailHash(
        $mail_key,
        $user->getPHID());

      $header_content['to'] = $to.'+'.$user->getID().'+'.$hash.'@test.com';
    }

    $received->setHeaders($header_content);
    $received->setBodies(
      array(
        'text' => $body,
      ));

    $received->save();
    $received->processReceivedMail();

    $console->writeErr(
      "%s\n\n    phabricator/ $ ./bin/mail show-inbound --id %d\n\n",
      pht('Mail received! You can view details by running this command:'),
      $received->getID());
  }

}


text:
package com.digitalpetri.opcua.stack.core.types.structured;

import com.digitalpetri.opcua.stack.core.serialization.DelegateRegistry;
import com.digitalpetri.opcua.stack.core.serialization.UaDecoder;
import com.digitalpetri.opcua.stack.core.serialization.UaEncoder;
import com.digitalpetri.opcua.stack.core.serialization.UaStructure;
import com.digitalpetri.opcua.stack.core.types.UaDataType;
import com.digitalpetri.opcua.stack.core.types.builtin.NodeId;
import com.digitalpetri.opcua.stack.core.types.builtin.unsigned.UInteger;
import com.digitalpetri.opcua.stack.core.Identifiers;

@UaDataType("SubscriptionAcknowledgement")
public class SubscriptionAcknowledgement implements UaStructure {

    public static final NodeId TypeId = Identifiers.SubscriptionAcknowledgement;
    public static final NodeId BinaryEncodingId = Identifiers.SubscriptionAcknowledgement_Encoding_DefaultBinary;
    public static final NodeId XmlEncodingId = Identifiers.SubscriptionAcknowledgement_Encoding_DefaultXml;

    protected final UInteger _subscriptionId;
    protected final UInteger _sequenceNumber;

    public SubscriptionAcknowledgement() {
        this._subscriptionId = null;
        this._sequenceNumber = null;
    }

    public SubscriptionAcknowledgement(UInteger _subscriptionId, UInteger _sequenceNumber) {
        this._subscriptionId = _subscriptionId;
        this._sequenceNumber = _sequenceNumber;
    }

    public UInteger getSubscriptionId() {
        return _subscriptionId;
    }

    public UInteger getSequenceNumber() {
        return _sequenceNumber;
    }

    @Override
    public NodeId getTypeId() {
        return TypeId;
    }

    @Override
    public NodeId getBinaryEncodingId() {
        return BinaryEncodingId;
    }

    @Override
    public NodeId getXmlEncodingId() {
        return XmlEncodingId;
    }

    public static void encode(SubscriptionAcknowledgement subscriptionAcknowledgement, UaEncoder encoder) {
        encoder.encodeUInt32("SubscriptionId", subscriptionAcknowledgement._subscriptionId);
        encoder.encodeUInt32("SequenceNumber", subscriptionAcknowledgement._sequenceNumber);
    }

    public static SubscriptionAcknowledgement decode(UaDecoder decoder) {
        UInteger _subscriptionId = decoder.decodeUInt32("SubscriptionId");
        UInteger _sequenceNumber = decoder.decodeUInt32("SequenceNumber");

        return new SubscriptionAcknowledgement(_subscriptionId, _sequenceNumber);
    }

    static {
        DelegateRegistry.registerEncoder(SubscriptionAcknowledgement::encode, SubscriptionAcknowledgement.class, BinaryEncodingId, XmlEncodingId);
        DelegateRegistry.registerDecoder(SubscriptionAcknowledgement::decode, SubscriptionAcknowledgement.class, BinaryEncodingId, XmlEncodingId);
    }

}


text:
class Cache {
  constructor(opt) {
    this.timeout = (opt || {}).timeout || 3600
    this.values = new Map()
  }

  async fetch(key, fresh) {
    const v = this.values
    if (v.has(key))
      return v.get(key)

    const val = await fresh()
    v.set(key, val)
    setTimeout(() => v.delete(key), this.timeout * 1000)
    return val
  }
}

module.exports = Cache