text:
package edu.gemini.wdba.tcc;

import edu.gemini.spModel.gemini.gnirs.InstGNIRS;
import edu.gemini.spModel.gemini.gnirs.GnirsOiwfsGuideProbe;
import edu.gemini.spModel.telescope.IssPort;

/**
 *
 */
public class GNIRSSupport implements ITccInstrumentSupport {
    //private static final Logger LOG = LogUtil.getLogger(GNIRSSupport.class);

    // TODO: determine correct port number
    public static final int GNIRS_SIDE_PORT = 3;

    private ObservationEnvironment _oe;

    // Private constructor
    private GNIRSSupport(ObservationEnvironment oe) {
        if (oe == null) throw new NullPointerException("observation environment can not be null");
        _oe = oe;
    }

    /**
     * Factory for creating a new TReCS Instrument Support.
     *
     * @param oe The current ObservationEnvironment
     * @return A new instance
     * @throws NullPointerException returned if the ObservationEnvironment is null.
     */
    static public ITccInstrumentSupport create(ObservationEnvironment oe) throws NullPointerException {
        return new GNIRSSupport(oe);
    }

    /**
     * Returns the appropriate wavelength for the observation for the TCC config.  In GNIRS
     * this is the current value of the disperser wavelength in microns.
     *
     * @return Appropriate guide wavelength
     */
    public String getWavelength() {
        InstGNIRS inst = (InstGNIRS) _oe.getInstrument();
        return inst.getCentralWavelength().getStringValue();
    }

    public String getPositionAngle() {
        InstGNIRS inst = (InstGNIRS) _oe.getInstrument();
        return inst.getPosAngleDegreesStr();
    }

    private String getPortFreeTccConfigInstrument() {
        // Return the name of the GNIRS config
        // SCI-0163: WDBA entries for GNIRS+Altair
        // Updated for 2011A testing:
        // "However, the instrument loaded for gnirs is ngs or lgs2gnirs, rather
        // than ao2gnirs. This is the correct syntax for the instrument origin,
        // but not for the instrument parameter.  Tested 11/8 by Jesse Ball"
        switch (_oe.getAoAspect()) {
            case ngs:
            case lgs: return "AO2GNIRS";
            default : return "GNIRS";
        }
    }

    private String getPortSuffix() {
        String val = "";
        if (((InstGNIRS) _oe.getInstrument()).getIssPort() == IssPort.SIDE_LOOKING) {
            val = String.valueOf(GNIRS_SIDE_PORT);
        }
        return val;
    }

    public String getTccConfigInstrument() {
        return getPortFreeTccConfigInstrument() + getPortSuffix();
    }

    /**
     * Support for instrument origins.
     *
     * @return String that is the name of a TCC config file.  See WDBA-5.
     */
    public String getTccConfigInstrumentOrigin() {
        // Updates for SCI-0289-a
        switch (_oe.getAoAspect()) {
            case ngs : return "ngs2gnirs";
            case lgs : return _oe.adjustInstrumentOriginForLGS_P1("lgs2gnirs");
            default  : return "gnirs";
        }
    }

    /**
     * Return true if the instrument is using a fixed rotator position.  In this case the pos angle is used
     * in a special rotator config
     *
     * @return String value that is the name of the fixed rotator config or null if no special name is needed
     */
    public String getFixedRotatorConfigName() {
        return null;
    }

    /**
     * Add the OIWFS wavelength.
     */
    public void addGuideDetails(ParamSet guideConfig) {
        if (_oe.containsTargets(GnirsOiwfsGuideProbe.instance)) {
            guideConfig.putParameter(TccNames.OIWFSWAVELENGTH, "GNIRS OIWFS");
        }
    }

    /**
     * Returns the TCC chop parameter value.
     *
     * @return Chop value or null if there is no chop parameter for this instrument.
     */
    public String getChopState() {
        return TccNames.NOCHOP;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.ashman.fivehundredpx;

import android.app.Activity;
import android.app.ActivityManager;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.ashman.fivehundredpx.enums.GalleryCategory;
import com.ashman.fivehundredpx.enums.PhotoSize;
import com.ashman.fivehundredpx.net.json.replies.Image;
import com.ashman.fivehundredpx.net.json.replies.Photo;
import com.ashman.fivehundredpx.net.json.replies.PhotoStreamReply;
import com.ashman.fivehundredpx.net.json.requests.PhotoStreamRequest;

public class GalleryFragment extends Fragment {
    private static final String TAG = "GalleryFragment";
    private static final int PICS_PER_PAGE_MULTIPLIER = 10;
    private static final int PICS_PER_PAGE = GalleryRow.IMAGES_PER_ROW * PICS_PER_PAGE_MULTIPLIER;
    private static final int DEFAULT_CURRENT_PAGE = 1;
    private static final int DEFAULT_NEXT_PAGE = -1;

    private ListView list;
    private TextView errorText;
    private TextView downloadingMoreText;
    private View loadingLayout;
    private View listLayout;
    private ArrayAdapter<GalleryRow> listAdapter;

    private GalleryData galleryData;
    private GalleryCategory currentCategory = FiveHundredApplication.DEFAULT_CATEGORY;
    private int currentPage;
    private int nextPageToDownload;
    private boolean isEndOfList;

    public static GalleryFragment findOrCreateNewInstance(FragmentManager fragmentManager) {
        GalleryFragment fragment = (GalleryFragment) fragmentManager.findFragmentByTag(TAG);
        if(fragment == null)
            return new GalleryFragment();
        return fragment;
    }

    public GalleryFragment() {
        reset();
    }

    private void reset() {
        if(galleryData != null)
            galleryData.clear();
        currentPage = DEFAULT_CURRENT_PAGE;
        nextPageToDownload = DEFAULT_NEXT_PAGE;
        isEndOfList = false;
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);

        if(galleryData == null) {
            ActivityManager activityManager = (ActivityManager)
                    activity.getSystemService(Activity.ACTIVITY_SERVICE);
            int maxCache = activityManager.getMemoryClass() / 4;
            galleryData = new GalleryData(((BaseFragmentActivity)activity).getRequestQueue(), maxCache);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View root = inflater.inflate(R.layout.fragment_gallery, container, false);
        errorText = (TextView) root.findViewById(R.id.gallery_errorText);
        loadingLayout = root.findViewById(R.id.gallery_loadingLayout);
        listLayout = root.findViewById(R.id.gallery_listLayout);
        downloadingMoreText = (TextView) root.findViewById(R.id.gallery_listDownloadingMore);
        list = (ListView) root.findViewById(R.id.gallery_list);
        list.setAdapter(createListAdapter());
        list.setOnScrollListener(new AbsListView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(AbsListView listView, int i) {
            }

            @Override
            public void onScroll(AbsListView listView, int firstVisibleItem,
                                 int visibleItemCount, int totalItemCount) {
                if((firstVisibleItem + visibleItemCount) == totalItemCount) {
                    if(isEndOfList) {
                        downloadingMoreText.setVisibility(View.VISIBLE);
                        downloadingMoreText.setText(R.string.gallery_noMoreImages);
                    } else {
                        getNextGalleryPage();
                    }
                }
            }
        });

        photoSize = FiveHundredApplication.get().getDefaultPhotoSize();

        if(nextPageToDownload == nextPageToDownload)
            getNextGalleryPage();
        return root;
    }

    private void getNextGalleryPage() {
        //TODO: handle 'last' page more gracefully
        if(nextPageToDownload > currentPage)
            return;
        if(isEndOfList)
            return;
        nextPageToDownload = currentPage + 1;

        RequestQueue requestQueue = ((BaseFragmentActivity)getActivity()).getRequestQueue();
        Response.Listener<PhotoStreamReply> listener = new Response.Listener<PhotoStreamReply>() {
            @Override
            public void onResponse(PhotoStreamReply response) {
                Photo[] photos = response.getPhotos();
                for(Photo photo : photos) {
                    Image image = photo.getImages()[0];
                    galleryData.download(image.getUrl(), null);
                    galleryData.addToRow(photo);
                }
                if(currentPage == DEFAULT_CURRENT_PAGE)
                    showView(listLayout);
                downloadingMoreText.setVisibility(View.GONE);
                currentPage++;
                listAdapter.notifyDataSetChanged();

                if(response.getCurrent_page() == response.getTotal_pages())
                    isEndOfList = true;
            }
        };
        Response.ErrorListener errorListener = new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                if(currentPage == DEFAULT_CURRENT_PAGE)
                    showView(errorText);
                else {
                    downloadingMoreText.setText(getString(R.string.gallery_errorGettingPage));
                    isEndOfList = true;
                }
            }
        };

        PhotoStreamRequest request = new PhotoStreamRequest(currentCategory,
                currentPage, PICS_PER_PAGE, new int[] { 1, 2, 3, 4 });

        ((BaseFragmentActivity)getActivity()).getPxApi().get(
                requestQueue, PhotoStreamReply.class, request, listener, errorListener);
        downloadingMoreText.setText(R.string.gallery_downloadingMore);
        downloadingMoreText.setVisibility(View.VISIBLE);
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //Retain instance so the cache and listview don't download destroyed in configuration changes
        setRetainInstance(true);
    }

    @Override
    public void onPause() {
        super.onPause();

        //If request is still pending, it has been cancelled in super.onPause()
        //reset next page counter so it is redownloaded on resume
        if(nextPageToDownload == currentPage + 1)
            nextPageToDownload -= 1;
    }

    @Override
    public void onResume() {
        super.onResume();

        PhotoSize newPhotoSize = FiveHundredApplication.get().getDefaultPhotoSize();
        if(photoSize != newPhotoSize) {
            photoSize= newPhotoSize;
            galleryData.reset();
            listAdapter.notifyDataSetChanged();
            reset();
        }

        if(galleryData.getGalleryRows().size() > 0) {
            showView(listLayout);
            listAdapter.notifyDataSetChanged();
        } else {
            getNextGalleryPage();
            showView(loadingLayout);
        }
    }

    private PhotoSize photoSize;

    public void showView(View view) {
        if(view != errorText && view != loadingLayout && view != listLayout)
            throw new IllegalArgumentException(
                    "Must be one of errorText, loadingLayout or list");
        errorText.setVisibility(View.GONE);
        loadingLayout.setVisibility(View.GONE);
        listLayout.setVisibility(View.GONE);

        view.setVisibility(View.VISIBLE);
    }

    public ArrayAdapter<GalleryRow> createListAdapter() {
        listAdapter = new GalleryListAdapter((BaseFragmentActivity)getActivity(),
                0, galleryData);
        return listAdapter;
    }

    public void setCurrentCategory(GalleryCategory category) {
        if(currentCategory != category) {
            currentCategory = category;
            showView(loadingLayout);
            reset();
            listAdapter.notifyDataSetChanged();
            getNextGalleryPage();
        }
    }
}


text:
prog=$(basename "$0")
if ! [ -S /var/run/docker.sock ]
then
	echo "$prog: there are no running docker" >&2
	exit 2
fi

cd "$(dirname "$0")" || exit
PATH=$(pwd):$PATH
plugin=$(basename "$(pwd)")
if ! which "$plugin" >/dev/null
then
	echo "$prog: $plugin is not installed" >&2
	exit 2
fi

port=10389
image=osixia/openldap
password=passpass

# By default, LDAP_DOMAIN=example.org and LDAP_ORGANISATION=Example Inc
docker run --name "test-$plugin" -p "$port:389" -d \
	-e "LDAP_ADMIN_PASSWORD=$password" \
	"$image"
trap 'docker stop test-$plugin; docker rm test-$plugin; exit' EXIT
sleep 10

base_dn='dc=example,dc=org'
exec $plugin -p $port -D "cn=admin,$base_dn" -P "$password" -b "$base_dn" -c 2 -w 1


text:
using System;
using System.Reflection;

namespace John.Doyle.Mediocore.Developer.Areas.HelpPage.ModelDescriptions
{
    public interface IModelDocumentationProvider
    {
        string GetDocumentation(MemberInfo member);

        string GetDocumentation(Type type);
    }
}


text:
namespace CoreRCON.PacketFormats
{
	public enum ServerEnvironment
	{
		Linux = 0x6C,
		Windows = 0x77,
		Mac = 0x6F
	}

	public enum ServerType
	{
		Dedicated = 0x64,
		NonDedicated = 0x6C,
		SourceTV = 0x70
	}

	public enum ServerVAC
	{
		Unsecured = 0x0,
		Secured = 0x1
	}

	public enum ServerVisibility
	{
		Public = 0x0,
		Private = 0x1
	}

	public class SourceQueryInfo : IQueryInfo
    {
		public byte Bots { get; private set; }
		public ServerEnvironment Environment { get; private set; }
		public string Folder { get; private set; }
		public string Game { get; private set; }
		public short GameId { get; private set; }
		public string Map { get; private set; }
		public byte MaxPlayers { get; private set; }
		public string Name { get; private set; }
		public byte Players { get; private set; }
		public byte ProtocolVersion { get; private set; }
		public ServerType Type { get; private set; }
		public ServerVAC VAC { get; private set; }
		public ServerVisibility Visibility { get; private set; }

		public static SourceQueryInfo FromBytes(byte[] buffer)
		{
			int i = 6;
			return new SourceQueryInfo
			{
				ProtocolVersion = buffer[4],
				Name = buffer.ReadNullTerminatedString(i, ref i),
				Map = buffer.ReadNullTerminatedString(i, ref i),
				Folder = buffer.ReadNullTerminatedString(i, ref i),
				Game = buffer.ReadNullTerminatedString(i, ref i),
				GameId = buffer.ReadShort(i, ref i),
				Players = buffer[i++],
				MaxPlayers = buffer[i++],
				Bots = buffer[i++],
				Type = (ServerType)buffer[i++],
				Environment = (ServerEnvironment)buffer[i++],
				Visibility = (ServerVisibility)buffer[i++],
				VAC = (ServerVAC)buffer[i++]
			};
		}
	}

	public class ServerQueryPlayer
	{
		public float Duration { get; private set; }
		public string Name { get; private set; }
		public short Score { get; private set; }

		public static ServerQueryPlayer[] FromBytes(byte[] buffer)
		{
			int i = 7;

			ServerQueryPlayer[] players = new ServerQueryPlayer[buffer[5]];

			for (int p = 0; p < players.Length; ++p)
			{
				players[p] = new ServerQueryPlayer
				{
					Name = buffer.ReadNullTerminatedString(i, ref i),
					Score = buffer.ReadShort(i, ref i),
					Duration = buffer.ReadFloat(i + 2, ref i)
				};

				i += 3;
			}

			return players;
		}
	}
}


text:
   /*******************************************************/
   /*      "C" Language Integrated Production System      */
   /*                                                     */
   /*            CLIPS Version 6.40  01/06/16             */
   /*                                                     */
   /*                  SETUP HEADER FILE                  */
   /*******************************************************/

/*************************************************************/
/* Purpose: This file is the general header file included by */
/*   all of the .c source files. It contains global          */
/*   definitions and the compiler flags which must be edited */
/*   to create a version for a specific machine, operating   */
/*   system, or feature set.                                 */
/*                                                           */
/* Principal Programmer(s):                                  */
/*      Gary D. Riley                                        */
/*      Brian L. Dantes                                      */
/*                                                           */
/* Contributing Programmer(s):                               */
/*                                                           */
/* Revision History:                                         */
/*                                                           */
/*      6.24: Default locale modification.                   */
/*                                                           */
/*            Removed CONFLICT_RESOLUTION_STRATEGIES,        */
/*            DYNAMIC_SALIENCE, INCREMENTAL_RESET,           */
/*            LOGICAL_DEPENDENCIES, IMPERATIVE_METHODS,      */
/*            INSTANCE_PATTERN_MATCHING, and                 */
/*            IMPERATIVE_MESSAGE_HANDLERS, and               */
/*            AUXILIARY_MESSAGE_HANDLERS compilation flags.  */
/*                                                           */
/*            Removed the SHORT_LINK_NAMES compilation flag. */
/*                                                           */
/*            Renamed BOOLEAN macro type to intBool.         */
/*                                                           */
/*      6.30: Removed conditional code for unsupported       */
/*            compilers/operating systems (IBM_MCW,          */
/*            MAC_MCW, IBM_ICB, IBM_TBC, IBM_ZTC, and        */
/*            IBM_SC).                                       */
/*                                                           */
/*            Renamed IBM_MSC and WIN_MVC compiler flags     */
/*            and IBM_GCC to WIN_GCC.                        */
/*                                                           */
/*            Added LINUX and DARWIN compiler flags.         */
/*                                                           */
/*            Removed HELP_FUNCTIONS compilation flag and    */
/*            associated functionality.                      */
/*                                                           */
/*            Removed EMACS_EDITOR compilation flag and      */
/*            associated functionality.                      */
/*                                                           */
/*            Combined BASIC_IO and EXT_IO compilation       */
/*            flags into the single IO_FUNCTIONS flag.       */
/*                                                           */
/*            Used #ifndef for preprocessor definitions so   */
/*            they can be set at the project or makefile     */
/*            level.                                         */
/*                                                           */
/*            Removed ENVIRONMENT_API_ONLY compilation flag. */
/*                                                           */
/*            Combined BASIC_IO and EXT_IO compilation       */
/*            flags into the IO_FUNCTIONS compilation flag.  */
/*                                                           */
/*            Changed the EX_MATH compilation flag to        */
/*            EXTENDED_MATH_FUNCTIONS.                       */
/*                                                           */
/*            Removed VOID definition because of conflict    */
/*            with Windows.h header file.                    */
/*                                                           */
/*            Removed deprecated definitions.                */
/*                                                           */
/*            The ALLOW_ENVIRONMENT_GLOBALS flag now         */
/*            defaults to 0. The use of functions enabled    */
/*            by this flag is deprecated.                    */
/*                                                           */
/*            Removed support for BLOCK_MEMORY.              */
/*                                                           */
/*      6.40: ALLOW_ENVIRONMENT_GLOBALS no longer supported. */
/*                                                           */
/*            Removed VAX_VMS support.                       */
/*                                                           */
/*************************************************************/

#ifndef _H_setup

#pragma once

#define _H_setup

/****************************************************************/
/* -------------------- COMPILER FLAGS ------------------------ */
/****************************************************************/

/*********************************************************************/
/* Flag denoting the environment in which the executable is to run.  */
/* Only one of these flags should be turned on (set to 1) at a time. */
/*********************************************************************/

#ifndef UNIX_V
#define UNIX_V  0   /* UNIX System V, 4.2bsd, or HP Unix, presumably with gcc */
#endif

#ifndef UNIX_7
#define UNIX_7  0   /* UNIX System III Version 7 or Sun Unix, presumably with gcc */
#endif

#ifndef LINUX
#define LINUX   0   /* Untested, presumably with gcc */
#endif

#ifndef DARWIN
#define DARWIN  0   /* Darwin Mac OS 10.10.2, presumably with gcc or Xcode 6.2 with Console */
#endif

#ifndef MAC_XCD
#define MAC_XCD 0   /* MacOS 10.10.2, with Xcode 6.2 and Cocoa GUI */
#endif

#ifndef WIN_MVC
#define WIN_MVC 0   /* Windows 7, with Visual Studio 2013 */
#endif

/* The following are unsupported: */

#ifndef WIN_GCC
#define WIN_GCC 0   /* Windows XP, with DJGPP 3.21 */
#endif

/* Use GENERIC if nothing else is used. */

#ifndef GENERIC
#if (! UNIX_V) && (! LINUX) && (! UNIX_7) && \
    (! MAC_XCD) && (! DARWIN) && \
    (! WIN_MVC) && (! WIN_GCC)
#define GENERIC 1   /* Generic (any machine)                   */
#else
#define GENERIC 0   /* Generic (any machine)                   */
#endif
#endif

#if WIN_MVC
#define IBM 1
#else
#define IBM 0
#endif

/***********************************************/
/* Some definitions for use with declarations. */
/***********************************************/

#define STD_SIZE size_t

/*******************************************/
/* RUN_TIME:  Specifies whether a run-time */
/*   module is being created.              */
/*******************************************/

#ifndef RUN_TIME
#define RUN_TIME 0
#endif

/*************************************************/
/* DEFRULE_CONSTRUCT: Determines whether defrule */
/*   construct is included.                      */
/*************************************************/

#ifndef DEFRULE_CONSTRUCT
#define DEFRULE_CONSTRUCT 1
#endif

/************************************************/
/* DEFMODULE_CONSTRUCT:  Determines whether the */
/*   defmodule construct is included.           */
/************************************************/

#ifndef DEFMODULE_CONSTRUCT
#define DEFMODULE_CONSTRUCT 1
#endif

/****************************************************/
/* DEFTEMPLATE_CONSTRUCT:  Determines whether facts */
/*   and the deftemplate construct are included.    */
/****************************************************/

#ifndef DEFTEMPLATE_CONSTRUCT
#define DEFTEMPLATE_CONSTRUCT 1
#endif

#if ! DEFRULE_CONSTRUCT
#undef DEFTEMPLATE_CONSTRUCT
#define DEFTEMPLATE_CONSTRUCT 0
#endif

/************************************************************/
/* FACT_SET_QUERIES: Determines if fact-set query functions */
/*  such as any-factp and do-for-all-facts are included.    */
/************************************************************/

#ifndef FACT_SET_QUERIES
#define FACT_SET_QUERIES 1
#endif

#if ! DEFTEMPLATE_CONSTRUCT
#undef FACT_SET_QUERIES
#define FACT_SET_QUERIES        0
#endif

/****************************************************/
/* DEFFACTS_CONSTRUCT:  Determines whether deffacts */
/*   construct is included.                         */
/****************************************************/

#ifndef DEFFACTS_CONSTRUCT
#define DEFFACTS_CONSTRUCT 1
#endif

#if ! DEFTEMPLATE_CONSTRUCT
#undef DEFFACTS_CONSTRUCT
#define DEFFACTS_CONSTRUCT 0
#endif

/************************************************/
/* DEFGLOBAL_CONSTRUCT:  Determines whether the */
/*   defglobal construct is included.           */
/************************************************/

#ifndef DEFGLOBAL_CONSTRUCT
#define DEFGLOBAL_CONSTRUCT 1
#endif

/**********************************************/
/* DEFFUNCTION_CONSTRUCT:  Determines whether */
/*   deffunction construct is included.       */
/**********************************************/

#ifndef DEFFUNCTION_CONSTRUCT
#define DEFFUNCTION_CONSTRUCT 1
#endif

/*********************************************/
/* DEFGENERIC_CONSTRUCT:  Determines whether */
/*   generic functions  are included.        */
/*********************************************/

#ifndef DEFGENERIC_CONSTRUCT
#define DEFGENERIC_CONSTRUCT 1
#endif

/*****************************************************************/
/* OBJECT_SYSTEM:  Determines whether object system is included. */
/*   The MULTIFIELD_FUNCTIONS flag should also be on if you want */
/*   to be able to manipulate multi-field slots.                 */
/*****************************************************************/

#ifndef OBJECT_SYSTEM
#define OBJECT_SYSTEM 1
#endif

/*****************************************************************/
/* DEFINSTANCES_CONSTRUCT: Determines whether the definstances   */
/*   construct is enabled.                                       */
/*****************************************************************/

#ifndef DEFINSTANCES_CONSTRUCT
#define DEFINSTANCES_CONSTRUCT      1
#endif

#if ! OBJECT_SYSTEM
#undef DEFINSTANCES_CONSTRUCT
#define DEFINSTANCES_CONSTRUCT      0
#endif

/********************************************************************/
/* INSTANCE_SET_QUERIES: Determines if instance-set query functions */
/*  such as any-instancep and do-for-all-instances are included.    */
/********************************************************************/

#ifndef INSTANCE_SET_QUERIES
#define INSTANCE_SET_QUERIES 1
#endif

#if ! OBJECT_SYSTEM
#undef INSTANCE_SET_QUERIES
#define INSTANCE_SET_QUERIES        0
#endif

/******************************************************************/
/* Check for consistencies associated with the defrule construct. */
/******************************************************************/

#if (! DEFTEMPLATE_CONSTRUCT) && (! OBJECT_SYSTEM)
#undef DEFRULE_CONSTRUCT
#define DEFRULE_CONSTRUCT 0
#endif

/*******************************************************************/
/* BLOAD/BSAVE_INSTANCES: Determines if the save/restore-instances */
/*  functions can be enhanced to perform more quickly by using     */
/*  binary files                                                   */
/*******************************************************************/

#ifndef BLOAD_INSTANCES
#define BLOAD_INSTANCES 1
#endif
#ifndef BSAVE_INSTANCES
#define BSAVE_INSTANCES 1
#endif

#if ! OBJECT_SYSTEM
#undef BLOAD_INSTANCES
#undef BSAVE_INSTANCES
#define BLOAD_INSTANCES             0
#define BSAVE_INSTANCES             0
#endif

/****************************************************************/
/* EXTENDED MATH PACKAGE FLAG: If this is on, then the extended */
/* math package functions will be available for use, (normal    */
/* default). If this flag is off, then the extended math        */
/* functions will not be available, and the 30K or so of space  */
/* they require will be free. Usually a concern only on PC type */
/* machines.                                                    */
/****************************************************************/

#ifndef EXTENDED_MATH_FUNCTIONS
#define EXTENDED_MATH_FUNCTIONS 1
#endif

/****************************************************************/
/* TEXT PROCESSING : Turn on this flag for support of the       */
/* hierarchical lookup system.                                  */
/****************************************************************/

#ifndef TEXTPRO_FUNCTIONS
#define TEXTPRO_FUNCTIONS 1
#endif

/*************************************************************************/
/* BLOAD_ONLY:      Enables bload command and disables the load command. */
/* BLOAD:           Enables bload command.                               */
/* BLOAD_AND_BSAVE: Enables bload, and bsave commands.                   */
/*************************************************************************/

#ifndef BLOAD_ONLY
#define BLOAD_ONLY 0
#endif
#ifndef BLOAD
#define BLOAD 0
#endif
#ifndef BLOAD_AND_BSAVE
#define BLOAD_AND_BSAVE 1
#endif

#if RUN_TIME
#undef BLOAD_ONLY
#define BLOAD_ONLY      0
#undef BLOAD
#define BLOAD           0
#undef BLOAD_AND_BSAVE
#define BLOAD_AND_BSAVE 0
#endif

/********************************************************************/
/* CONSTRUCT COMPILER: If this flag is turned on, you can generate  */
/*   C code representing the constructs in the current environment. */
/*   With the RUN_TIME flag set, this code can be compiled and      */
/*   linked to create a stand-alone run-time executable.            */
/********************************************************************/

#ifndef CONSTRUCT_COMPILER
#define  CONSTRUCT_COMPILER 1
#endif

#if CONSTRUCT_COMPILER
#define API_HEADER "clips.h"
#endif

/************************************************/
/* IO_FUNCTIONS: Includes printout, read, open, */
/*   close, format, and readline functions.     */
/************************************************/

#ifndef IO_FUNCTIONS
#define IO_FUNCTIONS 1
#endif

/************************************************/
/* STRING_FUNCTIONS: Includes string functions: */
/*   str-length, str-compare, upcase, lowcase,  */
/*   sub-string, str-index, and eval.           */
/************************************************/

#ifndef STRING_FUNCTIONS
#define STRING_FUNCTIONS 1
#endif

/*********************************************/
/* MULTIFIELD_FUNCTIONS: Includes multifield */
/*   functions:  mv-subseq, mv-delete,       */
/*   mv-append, str-explode, str-implode.    */
/*********************************************/

#ifndef MULTIFIELD_FUNCTIONS
#define MULTIFIELD_FUNCTIONS 1
#endif

/****************************************************/
/* DEBUGGING_FUNCTIONS: Includes functions such as  */
/*   rules, facts, matches, ppdefrule, etc.         */
/****************************************************/

#ifndef DEBUGGING_FUNCTIONS
#define DEBUGGING_FUNCTIONS 1
#endif

/***************************************************/
/* PROFILING_FUNCTIONS: Enables code for profiling */
/*   constructs and user functions.                */
/***************************************************/

#ifndef PROFILING_FUNCTIONS
#define PROFILING_FUNCTIONS 1
#endif

/*******************************************************************/
/* WINDOW_INTERFACE : Set this flag if you are recompiling any of  */
/*   the machine specific GUI interfaces. Currently, when enabled, */
/*   this flag disables the more processing used by the help       */
/*   system. This flag also prevents any input or output being     */
/*   directly sent to stdin or stdout.                             */
/*******************************************************************/

#ifndef WINDOW_INTERFACE
#define WINDOW_INTERFACE 0
#endif

/********************************************/
/* DEVELOPER: Enables code for debugging a  */
/*   development version of the executable. */
/********************************************/

#ifndef DEVELOPER
#define DEVELOPER 0
#endif

#if DEVELOPER
#include <assert.h>
#define Bogus(x) assert(! (x))
#else
#define Bogus(x)
#endif

/***************************/
/* Environment Definitions */
/***************************/

#include "envrnmnt.h"

/*************************************************/
/* Any user defined global setup information can */
/* be included in the file usrsetup.h which is   */
/* an empty file in the baseline version.        */
/*************************************************/

#include "usrsetup.h"

#endif	/* _H_setup */


text:
package ca.corefacility.bioinformatics.irida.ria.security;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.authentication.CredentialsExpiredException;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
import org.springframework.stereotype.Component;

import ca.corefacility.bioinformatics.irida.model.user.PasswordReset;
import ca.corefacility.bioinformatics.irida.model.user.Role;
import ca.corefacility.bioinformatics.irida.model.user.User;
import ca.corefacility.bioinformatics.irida.security.SequencerUILoginException;
import ca.corefacility.bioinformatics.irida.service.user.PasswordResetService;
import ca.corefacility.bioinformatics.irida.service.user.UserService;

import com.google.common.collect.ImmutableList;

/**
 * AuthenticationFailureHandler used to handle specific AuthenticationException's. This handler will handle the
 * exception or defer to default handling from SimpleUrlAuthenticationFailureHandler.
 */
@Component
public class IridaPostAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler {
	private static final Logger logger = LoggerFactory.getLogger(IridaPostAuthenticationFailureHandler.class);

	private final PasswordResetService resetService;
	private final UserService userService;

	@Autowired
	public IridaPostAuthenticationFailureHandler(PasswordResetService resetService, UserService userService) {
		this.resetService = resetService;
		this.userService = userService;
	}

	/**
	 * Custom authentication failure handling for specific AuthenticationException's otherwise default to
	 * {@link SimpleUrlAuthenticationFailureHandler} behaviour.
	 */
	@Override
	public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
			AuthenticationException exception) throws IOException, ServletException {
		if (exception instanceof CredentialsExpiredException) {
			// get the username of the user who tried to login
			String username = request.getParameter("username");
			logger.trace("Password is expired for [ " + username + " ].  Generating a password reset.");

			// set an anonymous auth token
			setAuthentication();

			// get the user and create a password reset
			User userByUsername = userService.getUserByUsername(username);
			PasswordReset create = resetService.create(new PasswordReset(userByUsername));

			// Clear the anonymous auth token
			SecurityContextHolder.clearContext();

			// redirect the user to the password reset page
			String contextPath = request.getContextPath();
			String resetId = create.getId();
			response.sendRedirect(contextPath + "/password_reset/" + resetId + "?expired=true");
		} else if (exception instanceof SequencerUILoginException) {
			// Clear the anonymous auth token
			SecurityContextHolder.clearContext();

			// redirect the user to the login page with the sequencer-login url param
			String contextPath = request.getContextPath();
			response.sendRedirect(contextPath + "/login?error=true&sequencer-login=true");
		} else {
			super.onAuthenticationFailure(request, response, exception);
		}

	}

	/**
	 * Set an anonymous authentication token
	 */
	private void setAuthentication() {
		AnonymousAuthenticationToken anonymousToken = new AnonymousAuthenticationToken("nobody", "nobody",
				ImmutableList.of(Role.ROLE_ANONYMOUS));
		SecurityContextHolder.getContext().setAuthentication(anonymousToken);
	}
}


text:
@API(apiVersion="1.3.4", owner="RailcraftAPI|core", provides="RailcraftAPI|signals")
package mods.railcraft.api.signals;
import cpw.mods.fml.common.API;


text:
package org.commoncrawl.protocol.shared;

import java.io.DataInput;
import java.io.DataOutput;
import java.util.BitSet;
import java.io.IOException;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.record.Buffer;
import org.commoncrawl.util.shared.FlexBuffer;
import org.commoncrawl.util.shared.TextBytes;
import org.commoncrawl.util.shared.MurmurHash;
import org.commoncrawl.util.shared.ImmutableBuffer;
import org.commoncrawl.rpc.BinaryProtocol;
import org.apache.hadoop.util.ReflectionUtils;
import org.apache.hadoop.conf.Configuration;

// Generated File: HTMLMetaTags
public class HTMLMetaTags extends org.commoncrawl.rpc.RPCStruct<HTMLMetaTags> implements Writable {

	// optimized constructor helper
	public static HTMLMetaTags newInstance(Configuration conf) {
		return ReflectionUtils.newInstance(HTMLMetaTags.class, conf);
	}

	// Writable Implementation
	public void write(DataOutput out) throws IOException {
		this.serialize(out, new BinaryProtocol());
	}

	public void readFields(DataInput in) throws IOException {
		this.deserialize(in, new BinaryProtocol());
	}

	// Field Constants
	public static final int Field_ROBOTSFLAGS = 1;
	public static final int Field_PRAGMAS = 2;
	public static final int Field_OPTIONALREFRESHURL = 3;
	public static final int Field_OPTIONALREFRESHTIME = 4;
	public static final int Field_OTHERMETATAGS = 6;
	static final int FieldID_MAX = Field_OTHERMETATAGS;

	// Enumerations

	// Enum:RobotsFlags
	public static final class RobotsFlags {
		public static final int ALL = 1;
		public static final int NO_INDEX = 2;
		public static final int NO_FOLLOW = 4;
		public static final int NO_ARCHIVE = 8;

		public static String toString(int enumValue) {
			switch (enumValue) {
			case 1:
				return "ALL";
			case 2:
				return "NO_INDEX";
			case 4:
				return "NO_FOLLOW";
			case 8:
				return "NO_ARCHIVE";
			default:
				return "";
			}
		}
	}

	// Enum:Pragmas
	public static final class Pragmas {
		public static final int NO_CACHE = 1;

		public static String toString(int enumValue) {
			switch (enumValue) {
			case 1:
				return "NO_CACHE";
			default:
				return "";
			}
		}
	}

	// Field Declarations
	private BitSet __validFields = new BitSet(FieldID_MAX + 1);

	private byte robotsFlags;
	private byte pragmas;
	private TextBytes optionalRefreshURL = new TextBytes();
	private int optionalRefreshTime;
	private TextBytes otherMetaTags = new TextBytes();

	// Default Constructor
	public HTMLMetaTags() {
	}

	// Accessors

	public final boolean isFieldDirty(int fieldId) {
		return __validFields.get(fieldId);
	}

	public final HTMLMetaTags setFieldDirty(int fieldId) {
		__validFields.set(fieldId);
		return this;
	}

	public final HTMLMetaTags setFieldClean(int fieldId) {
		__validFields.clear(fieldId);
		return this;
	}

	public byte getRobotsFlags() {
		return robotsFlags;
	}

	public HTMLMetaTags setRobotsFlags(byte robotsFlags) {
		__validFields.set(Field_ROBOTSFLAGS);
		this.robotsFlags = robotsFlags;
		return this;
	}

	public byte getPragmas() {
		return pragmas;
	}

	public HTMLMetaTags setPragmas(byte pragmas) {
		__validFields.set(Field_PRAGMAS);
		this.pragmas = pragmas;
		return this;
	}

	public TextBytes getOptionalRefreshURLAsTextBytes() {
		return optionalRefreshURL;
	}

	public String getOptionalRefreshURL() {
		return optionalRefreshURL.toString();
	}

	public HTMLMetaTags setOptionalRefreshURL(String optionalRefreshURL) {
		__validFields.set(Field_OPTIONALREFRESHURL);
		this.optionalRefreshURL.set(optionalRefreshURL);
		return this;
	}

	public int getOptionalRefreshTime() {
		return optionalRefreshTime;
	}

	public HTMLMetaTags setOptionalRefreshTime(int optionalRefreshTime) {
		__validFields.set(Field_OPTIONALREFRESHTIME);
		this.optionalRefreshTime = optionalRefreshTime;
		return this;
	}

	public TextBytes getOtherMetaTagsAsTextBytes() {
		return otherMetaTags;
	}

	public String getOtherMetaTags() {
		return otherMetaTags.toString();
	}

	public HTMLMetaTags setOtherMetaTags(String otherMetaTags) {
		__validFields.set(Field_OTHERMETATAGS);
		this.otherMetaTags.set(otherMetaTags);
		return this;
	}

	// Object Dirty support

	public final boolean isObjectDirty() {
		boolean isDirty = !__validFields.isEmpty();
		return isDirty;
	}

	// serialize implementation
	public final void serialize(DataOutput output, BinaryProtocol encoder) throws java.io.IOException {
		encoder.beginFields(output);
		// serialize field:robotsFlags
		if (__validFields.get(Field_ROBOTSFLAGS)) {
			encoder.beginField(output, "robotsFlags", Field_ROBOTSFLAGS);
			encoder.writeByte(output, robotsFlags);
		}
		// serialize field:pragmas
		if (__validFields.get(Field_PRAGMAS)) {
			encoder.beginField(output, "pragmas", Field_PRAGMAS);
			encoder.writeByte(output, pragmas);
		}
		// serialize field:optionalRefreshURL
		if (__validFields.get(Field_OPTIONALREFRESHURL)) {
			encoder.beginField(output, "optionalRefreshURL", Field_OPTIONALREFRESHURL);
			encoder.writeTextBytes(output, optionalRefreshURL);
		}
		// serialize field:optionalRefreshTime
		if (__validFields.get(Field_OPTIONALREFRESHTIME)) {
			encoder.beginField(output, "optionalRefreshTime", Field_OPTIONALREFRESHTIME);
			encoder.writeVInt(output, optionalRefreshTime);
		}
		// serialize field:otherMetaTags
		if (__validFields.get(Field_OTHERMETATAGS)) {
			encoder.beginField(output, "otherMetaTags", Field_OTHERMETATAGS);
			encoder.writeTextBytes(output, otherMetaTags);
		}
		encoder.endFields(output);
	}

	// deserialize implementation
	public final void deserialize(DataInput input, BinaryProtocol decoder) throws java.io.IOException {
		// clear existing data first
		clear();

		// reset protocol object to unknown field id enconding mode (for compatibility)
		decoder.pushFieldIdEncodingMode(BinaryProtocol.FIELD_ID_ENCODING_MODE_UNKNOWN);
		// keep reading fields until terminator (-1) is located
		int fieldId;
		while ((fieldId = decoder.readFieldId(input)) != -1) {
			switch (fieldId) {
			case Field_ROBOTSFLAGS: {
				__validFields.set(Field_ROBOTSFLAGS);
				robotsFlags = decoder.readByte(input);
			}
				break;
			case Field_PRAGMAS: {
				__validFields.set(Field_PRAGMAS);
				pragmas = decoder.readByte(input);
			}
				break;
			case Field_OPTIONALREFRESHURL: {
				__validFields.set(Field_OPTIONALREFRESHURL);
				decoder.readTextBytes(input, optionalRefreshURL);
			}
				break;
			case Field_OPTIONALREFRESHTIME: {
				__validFields.set(Field_OPTIONALREFRESHTIME);
				optionalRefreshTime = decoder.readVInt(input);
			}
				break;
			case Field_OTHERMETATAGS: {
				__validFields.set(Field_OTHERMETATAGS);
				decoder.readTextBytes(input, otherMetaTags);
			}
				break;
			}
		}
		// pop extra encoding mode off of stack
		decoder.popFieldIdEncodingMode();
	}

	// clear implementation
	public final void clear() {
		__validFields.clear();
		robotsFlags = 0;
		pragmas = 0;
		optionalRefreshURL.clear();
		optionalRefreshTime = 0;
		otherMetaTags.clear();
	}

	// equals implementation
	public final boolean equals(final Object peer_) {
		if (!(peer_ instanceof HTMLMetaTags)) {
			return false;
		}
		if (peer_ == this) {
			return true;
		}
		HTMLMetaTags peer = (HTMLMetaTags) peer_;
		boolean ret = __validFields.equals(peer.__validFields);
		if (!ret)
			return ret;
		if (__validFields.get(Field_ROBOTSFLAGS)) {
			ret = (robotsFlags == peer.robotsFlags);
			if (!ret)
				return ret;
		}
		if (__validFields.get(Field_PRAGMAS)) {
			ret = (pragmas == peer.pragmas);
			if (!ret)
				return ret;
		}
		if (__validFields.get(Field_OPTIONALREFRESHURL)) {
			ret = optionalRefreshURL.equals(peer.optionalRefreshURL);
			if (!ret)
				return ret;
		}
		if (__validFields.get(Field_OPTIONALREFRESHTIME)) {
			ret = (optionalRefreshTime == peer.optionalRefreshTime);
			if (!ret)
				return ret;
		}
		if (__validFields.get(Field_OTHERMETATAGS)) {
			ret = otherMetaTags.equals(peer.otherMetaTags);
			if (!ret)
				return ret;
		}
		return ret;
	}

	// clone implementation
	@SuppressWarnings("unchecked")
	public final Object clone() throws CloneNotSupportedException {
		HTMLMetaTags other = new HTMLMetaTags();
		other.__validFields.or(this.__validFields);
		if (__validFields.get(Field_ROBOTSFLAGS)) {
			other.robotsFlags = this.robotsFlags;
		}
		if (__validFields.get(Field_PRAGMAS)) {
			other.pragmas = this.pragmas;
		}
		if (__validFields.get(Field_OPTIONALREFRESHURL)) {
			other.optionalRefreshURL = (TextBytes) this.optionalRefreshURL.clone();
		}
		if (__validFields.get(Field_OPTIONALREFRESHTIME)) {
			other.optionalRefreshTime = this.optionalRefreshTime;
		}
		if (__validFields.get(Field_OTHERMETATAGS)) {
			other.otherMetaTags = (TextBytes) this.otherMetaTags.clone();
		}
		return other;
	}

	// merge implementation
	@SuppressWarnings("unchecked")
	public final void merge(HTMLMetaTags peer) throws CloneNotSupportedException {
		__validFields.or(peer.__validFields);
		if (peer.__validFields.get(Field_ROBOTSFLAGS)) {
			this.robotsFlags = peer.robotsFlags;
		}
		if (peer.__validFields.get(Field_PRAGMAS)) {
			this.pragmas = peer.pragmas;
		}
		if (peer.__validFields.get(Field_OPTIONALREFRESHURL)) {
			this.optionalRefreshURL = (TextBytes) peer.optionalRefreshURL.clone();
		}
		if (peer.__validFields.get(Field_OPTIONALREFRESHTIME)) {
			this.optionalRefreshTime = peer.optionalRefreshTime;
		}
		if (peer.__validFields.get(Field_OTHERMETATAGS)) {
			this.otherMetaTags = (TextBytes) peer.otherMetaTags.clone();
		}
	}

	// hashCode implementation
	public final int hashCode() {
		int result = 1;
		result = MurmurHash.hashInt((int) robotsFlags, result);
		result = MurmurHash.hashInt((int) pragmas, result);
		result = MurmurHash.hash(optionalRefreshURL.getBytes(), optionalRefreshURL.getOffset(),
				optionalRefreshURL.getLength(), result);
		result = MurmurHash.hashInt((int) optionalRefreshTime, result);
		result = MurmurHash
				.hash(otherMetaTags.getBytes(), otherMetaTags.getOffset(), otherMetaTags.getLength(), result);
		return result;
	}
}


text:
<?php

namespace utest\authentication\unit\toolbox;

use umi\authentication\exception\OutOfBoundsException;
use umi\authentication\IAuthenticationFactory;
use umi\authentication\toolbox\factory\AuthenticationFactory;
use utest\authentication\AuthenticationTestCase;

/**
 * Тест аутентификации
 */
class AuthFactoryTest extends AuthenticationTestCase
{
    /**
     * @var IAuthenticationFactory $adapter
     */
    protected $auth;

    public function setUpFixtures()
    {
        $this->auth = new AuthenticationFactory();
        $this->resolveOptionalDependencies($this->auth);
    }

    /**
     * Тест базовых операций
     */
    public function testBasic()
    {
        $storage = $this->auth->createStorage(IAuthenticationFactory::STORAGE_SIMPLE);

        $this->assertInstanceOf(
            'umi\authentication\storage\IAuthStorage',
            $storage,
            'Ожидается, что будет возвращено хранилище'
        );

        $adapter = $this->auth->createAdapter(IAuthenticationFactory::ADAPTER_SIMPLE);
        $this->assertInstanceOf(
            'umi\authentication\adapter\IAuthAdapter',
            $adapter,
            'Ожидается, что будет возвращен адаптер'
        );

        $this->assertInstanceOf(
            'umi\authentication\IAuthManager',
            $this->auth->createAuthManager($adapter, $storage),
            'Ожидается, что менеджер будет получен.'
        );

        $provider = $this->auth->createProvider(IAuthenticationFactory::PROVIDER_SIMPLE);
        $this->assertInstanceOf(
            'umi\authentication\provider\IAuthProvider',
            $provider,
            'Ожидается, что будет возвращен провайдер'
        );
    }

    /**
     * @test получения неверного типа хранилища
     * @expectedException OutOfBoundsException
     */
    public function getInvalidStorage()
    {
        $this->auth->createStorage("INVALID");
    }

    /**
     * @test получения неверного типа адаптера
     * @expectedException OutOfBoundsException
     */
    public function getInvalidAdapter()
    {
        $this->auth->createAdapter("INVALID");
    }

    /**
     * @test получения неверного типа провайдера
     * @expectedException OutOfBoundsException
     */
    public function getInvalidProvider()
    {
        $this->auth->createProvider("INVALID");
    }
}


text:
<resources>
    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>

    <dimen name="item_vertical_margin_small">8dp</dimen>
    <dimen name="item_vertical_margin_medium">16dp</dimen>
    <dimen name="item_vertical_margin_large">24dp</dimen>
    <dimen name="item_vertical_margin_larger">32dp</dimen>

    <dimen name="button_padding_horizontal">24dp</dimen>
    <dimen name="button_padding_vertical">16dp</dimen>

    <dimen name="divider_height">0.5dp</dimen>
</resources>


text:
require 'spec_helper'

describe API::API do
  include ApiHelpers

  let(:user) { create(:user) }
  let(:user2) { create(:user) }
  let!(:trigger_token) { 'secure_token' }
  let!(:trigger_token_2) { 'secure_token_2' }
  let!(:project) { create(:project, creator_id: user.id) }
  let!(:master) { create(:project_member, :master, user: user, project: project) }
  let!(:developer) { create(:project_member, :developer, user: user2, project: project) }
  let!(:trigger) { create(:ci_trigger, project: project, token: trigger_token) }
  let!(:trigger2) { create(:ci_trigger, project: project, token: trigger_token_2) }
  let!(:trigger_request) { create(:ci_trigger_request, trigger: trigger, created_at: '2015-01-01 12:13:14') }

  describe 'POST /projects/:project_id/trigger' do
    let!(:project2) { create(:empty_project) }
    let(:options) do
      {
        token: trigger_token
      }
    end

    before do
      stub_ci_pipeline_to_return_yaml_file
    end

    context 'Handles errors' do
      it 'returns bad request if token is missing' do
        post api("/projects/#{project.id}/trigger/builds"), ref: 'master'
        expect(response).to have_http_status(400)
      end

      it 'returns not found if project is not found' do
        post api('/projects/0/trigger/builds'), options.merge(ref: 'master')
        expect(response).to have_http_status(404)
      end

      it 'returns unauthorized if token is for different project' do
        post api("/projects/#{project2.id}/trigger/builds"), options.merge(ref: 'master')
        expect(response).to have_http_status(401)
      end
    end

    context 'Have a commit' do
      let(:pipeline) { project.pipelines.last }

      it 'creates builds' do
        post api("/projects/#{project.id}/trigger/builds"), options.merge(ref: 'master')
        expect(response).to have_http_status(201)
        pipeline.builds.reload
        expect(pipeline.builds.pending.size).to eq(2)
        expect(pipeline.builds.size).to eq(5)
      end

      it 'returns bad request with no builds created if there\'s no commit for that ref' do
        post api("/projects/#{project.id}/trigger/builds"), options.merge(ref: 'other-branch')
        expect(response).to have_http_status(400)
        expect(json_response['message']).to eq('No builds created')
      end

      context 'Validates variables' do
        let(:variables) do
          { 'TRIGGER_KEY' => 'TRIGGER_VALUE' }
        end

        it 'validates variables to be a hash' do
          post api("/projects/#{project.id}/trigger/builds"), options.merge(variables: 'value', ref: 'master')
          expect(response).to have_http_status(400)
          expect(json_response['message']).to eq('variables needs to be a hash')
        end

        it 'validates variables needs to be a map of key-valued strings' do
          post api("/projects/#{project.id}/trigger/builds"), options.merge(variables: { key: %w(1 2) }, ref: 'master')
          expect(response).to have_http_status(400)
          expect(json_response['message']).to eq('variables needs to be a map of key-valued strings')
        end

        it 'creates trigger request with variables' do
          post api("/projects/#{project.id}/trigger/builds"), options.merge(variables: variables, ref: 'master')
          expect(response).to have_http_status(201)
          pipeline.builds.reload
          expect(pipeline.builds.first.trigger_request.variables).to eq(variables)
        end
      end
    end
  end

  describe 'GET /projects/:id/triggers' do
    context 'authenticated user with valid permissions' do
      it 'returns list of triggers' do
        get api("/projects/#{project.id}/triggers", user)

        expect(response).to have_http_status(200)
        expect(json_response).to be_a(Array)
        expect(json_response[0]).to have_key('token')
      end
    end

    context 'authenticated user with invalid permissions' do
      it 'does not return triggers list' do
        get api("/projects/#{project.id}/triggers", user2)

        expect(response).to have_http_status(403)
      end
    end

    context 'unauthenticated user' do
      it 'does not return triggers list' do
        get api("/projects/#{project.id}/triggers")

        expect(response).to have_http_status(401)
      end
    end
  end

  describe 'GET /projects/:id/triggers/:token' do
    context 'authenticated user with valid permissions' do
      it 'returns trigger details' do
        get api("/projects/#{project.id}/triggers/#{trigger.token}", user)

        expect(response).to have_http_status(200)
        expect(json_response).to be_a(Hash)
      end

      it 'responds with 404 Not Found if requesting non-existing trigger' do
        get api("/projects/#{project.id}/triggers/abcdef012345", user)

        expect(response).to have_http_status(404)
      end
    end

    context 'authenticated user with invalid permissions' do
      it 'does not return triggers list' do
        get api("/projects/#{project.id}/triggers/#{trigger.token}", user2)

        expect(response).to have_http_status(403)
      end
    end

    context 'unauthenticated user' do
      it 'does not return triggers list' do
        get api("/projects/#{project.id}/triggers/#{trigger.token}")

        expect(response).to have_http_status(401)
      end
    end
  end

  describe 'POST /projects/:id/triggers' do
    context 'authenticated user with valid permissions' do
      it 'creates trigger' do
        expect do
          post api("/projects/#{project.id}/triggers", user)
        end.to change{project.triggers.count}.by(1)

        expect(response).to have_http_status(201)
        expect(json_response).to be_a(Hash)
      end
    end

    context 'authenticated user with invalid permissions' do
      it 'does not create trigger' do
        post api("/projects/#{project.id}/triggers", user2)

        expect(response).to have_http_status(403)
      end
    end

    context 'unauthenticated user' do
      it 'does not create trigger' do
        post api("/projects/#{project.id}/triggers")

        expect(response).to have_http_status(401)
      end
    end
  end

  describe 'DELETE /projects/:id/triggers/:token' do
    context 'authenticated user with valid permissions' do
      it 'deletes trigger' do
        expect do
          delete api("/projects/#{project.id}/triggers/#{trigger.token}", user)
        end.to change{project.triggers.count}.by(-1)
        expect(response).to have_http_status(200)
      end

      it 'responds with 404 Not Found if requesting non-existing trigger' do
        delete api("/projects/#{project.id}/triggers/abcdef012345", user)

        expect(response).to have_http_status(404)
      end
    end

    context 'authenticated user with invalid permissions' do
      it 'does not delete trigger' do
        delete api("/projects/#{project.id}/triggers/#{trigger.token}", user2)

        expect(response).to have_http_status(403)
      end
    end

    context 'unauthenticated user' do
      it 'does not delete trigger' do
        delete api("/projects/#{project.id}/triggers/#{trigger.token}")

        expect(response).to have_http_status(401)
      end
    end
  end
end


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/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>RakNet: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

RakNet
    4.0

Main Page

Related Pages

Modules

Namespaces

Classes

Files

Class List

Class Index

Class Hierarchy

Class Members

RakNet

RPC4GlobalRegistration

RakNet::RPC4GlobalRegistration Member List

This is the complete list of members for RakNet::RPC4GlobalRegistration, including all inherited members.

RPC4GlobalRegistration(const char *uniqueID, void(*functionPointer)(RakNet::BitStream *userData, Packet *packet))	RakNet::RPC4GlobalRegistration

RPC4GlobalRegistration(const char *uniqueID, void(*functionPointer)(RakNet::BitStream *userData, Packet *packet), int callPriority)	RakNet::RPC4GlobalRegistration

RPC4GlobalRegistration(const char *uniqueID, void(*functionPointer)(RakNet::BitStream *userData, RakNet::BitStream *returnData, Packet *packet))	RakNet::RPC4GlobalRegistration

RPC4GlobalRegistration(const char *uniqueID, MessageID messageId)	RakNet::RPC4GlobalRegistration

<address class="footer">
Generated on Mon Jun 2 2014 20:10:29 for RakNet by

 1.8.2
</address>


text:
@interface ViewController : UIViewController <SCLRSAMCallback>

// Outlets
@property (weak, nonatomic) IBOutlet UILabel *sch_day1;
@property (weak, nonatomic) IBOutlet UILabel *sch_day2;
@property (weak, nonatomic) IBOutlet UILabel *sch_day3;
@property (weak, nonatomic) IBOutlet UILabel *sch_day4;
@property (weak, nonatomic) IBOutlet UILabel *sch_day5;
@property (weak, nonatomic) IBOutlet UILabel *sch_day6;
@property (weak, nonatomic) IBOutlet UILabel *sch_day7;
@property (weak, nonatomic) IBOutlet UISwitch *sch_enable1;
@property (weak, nonatomic) IBOutlet UISwitch *sch_enable2;
@property (weak, nonatomic) IBOutlet UISwitch *sch_enable3;
@property (weak, nonatomic) IBOutlet UISwitch *sch_enable4;
@property (weak, nonatomic) IBOutlet UISwitch *sch_enable5;
@property (weak, nonatomic) IBOutlet UISwitch *sch_enable6;
@property (weak, nonatomic) IBOutlet UISwitch *sch_enable7;
@property (weak, nonatomic) IBOutlet UILabel *sch_state1;
@property (weak, nonatomic) IBOutlet UILabel *sch_state2;
@property (weak, nonatomic) IBOutlet UILabel *sch_state3;
@property (weak, nonatomic) IBOutlet UILabel *sch_state4;
@property (weak, nonatomic) IBOutlet UILabel *sch_state5;
@property (weak, nonatomic) IBOutlet UILabel *sch_state6;
@property (weak, nonatomic) IBOutlet UILabel *sch_state7;
@property (weak, nonatomic) IBOutlet UIButton *sch_from1;
@property (weak, nonatomic) IBOutlet UIButton *sch_from2;
@property (weak, nonatomic) IBOutlet UIButton *sch_from3;
@property (weak, nonatomic) IBOutlet UIButton *sch_from4;
@property (weak, nonatomic) IBOutlet UIButton *sch_from5;
@property (weak, nonatomic) IBOutlet UIButton *sch_from6;
@property (weak, nonatomic) IBOutlet UIButton *sch_from7;
@property (weak, nonatomic) IBOutlet UIButton *sch_to1;
@property (weak, nonatomic) IBOutlet UIButton *sch_to2;
@property (weak, nonatomic) IBOutlet UIButton *sch_to3;
@property (weak, nonatomic) IBOutlet UIButton *sch_to4;
@property (weak, nonatomic) IBOutlet UIButton *sch_to5;
@property (weak, nonatomic) IBOutlet UIButton *sch_to6;
@property (weak, nonatomic) IBOutlet UIButton *sch_to7;
@property (weak, nonatomic) IBOutlet UILabel *nextAlarmLbl;

// Actions

// All the switches are connected to this particular action.
// They can be distinguished by the sender object
- (IBAction)schedStateChanged:(UISwitch *)sender forEvent:(UIEvent *)event;

// All the "From" buttons are connected to this particular action.
- (IBAction)fromTimePressed:(UIButton *)sender;

// All the "To" buttons are connected to this particular action.
- (IBAction)toTimePressed:(UIButton *)sender;

@end


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:background="?attr/colorPrimary"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize">

        <Spinner
            android:id="@+id/spinner_nav"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
    </android.support.v7.widget.Toolbar>

    <com.hanks.library.SuperRecyclerView
        android:layout_below="@id/toolbar"
        android:id="@+id/super_recyclerview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</RelativeLayout>


text:
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using OwlNinja.Database;
using OwlNinja.Models;
using Microsoft.EntityFrameworkCore;
namespace OwlNinja.Controllers
{

    [AllowAnonymous]
    public class PostsController : Controller
    {
        private BlogContext db;

        public PostsController([FromServices] BlogContext db)
        {
            this.db = db;
        }

        // GET: api/posts get posts list
        [Route("api/posts")]
        [HttpGet]
        [AllowAnonymous]
        public JsonResult GetPosts([FromQuery] int skip,[FromQuery] string tag)
        {
            PostsResult result = new PostsResult();
            result.Posts = new List<PostResult>();

            IQueryable<Database.Models.Post> query;
            if (string.IsNullOrWhiteSpace(tag))
            {
                query = db.Posts.OrderByDescending(post => post.Time);
            }
            else
            {
                query = db.Posts.OrderByDescending(post => post.Time).Include(p=>p.Tags).Where(post => post.Tags.Any(t => t.Tag == tag));
            }

            result.CountLeft = query.Skip(skip + 10).Count();
            var posts = query.Skip(skip).Take(10).Include(p => p.Tags);

            foreach (var post in posts)
            {
                result.Posts.Add(new PostResult() {
                    Id = post.Id.ToString(),
                    PostTitle = post.Title,
                    PostSubHeading = post.Summary,
                    HeaderPostImage = post.HeaderImage,
                    EnTitle = post.EnTitle,
                    PostHtml = post.Content,
                    PostDate = post.Time.ToString("HH:MM dd.mm.yyyy"),
                    Tags = post.Tags.Select(t => t.Tag).ToList()
                });
            }

            return Json(result);
        }

        // GET api/posts/1 get post N data
        [Route("api/post")]
        [AllowAnonymous]
        [HttpGet]
        public IActionResult GetPost([FromQuery]string url)
        {
            var post = db.Posts.Include(p=>p.Tags).SingleOrDefault(p => p.EnTitle == url);

            if (post != null)
            {
                var result = new PostResult()
                {
                    Id = post.Id.ToString(),
                    PostTitle = post.Title,
                    PostSubHeading = post.Summary,
                    HeaderPostImage = post.HeaderImage,
                    EnTitle = post.EnTitle,
                    PostHtml = post.Content,
                    PostDate = post.Time.ToString("HH:MM dd.mm.yyyy"),
                    Tags = post.Tags.Select(tag => tag.Tag).ToList()
                };

                return Json(result);
            }
            else
            {
                return NotFound();
            }
        }

    }
}


text:
<?php
/**
 * Class ProducerVIBRATORYANDECCENTRIC
 * @package TO\SiteBundle\Entity\Filters
 */

namespace TO\SiteBundle\Entity\Filters;

use TO\SiteBundle\Entity\Filter;
use TO\SiteBundle\Entity\ProducerCategoriesLink;
use TO\SiteBundle\Helpers\Catalog;

class ProducerVIBRATORYANDECCENTRIC extends ProducerElectric
{
    public function getCategoryId()
    {
        return Catalog::CATEGORY_VIBRATORY_AND_ECCENTRIC;
    }
}


text:
/* don't let assert() stringify some hwloc names that would not
 * renamed afterwards, and wouldn't be easy to filter out */
#define NDEBUG 1

#define _GNU_SOURCE 1
#include "sched.h"

/* all headers should be included */
#include "hwloc.h"
#include "hwloc/bitmap.h"
#include "hwloc/helper.h"
#include "hwloc/plugins.h"

#if HWLOC_TEST_RENAME_LINUX
#include "hwloc/linux.h"
#endif
#if HWLOC_TEST_RENAME_LINUX_LIBNUMA
#include "hwloc/linux-libnuma.h"
#endif
#if HWLOC_TEST_RENAME_GLIBC_SCHED
#include "hwloc/glibc-sched.h"
#endif
#if HWLOC_TEST_RENAME_MYRIEXPRESS
#include "hwloc/myriexpress.h"
#endif
#if HWLOC_TEST_RENAME_OPENFABRICS_VERBS
#include "hwloc/openfabrics-verbs.h"
#endif
#if HWLOC_TEST_RENAME_OPENCL
#include "hwloc/opencl.h"
#endif
#if HWLOC_TEST_RENAME_CUDA
#include "hwloc/cuda.h"
#endif
#if HWLOC_TEST_RENAME_CUDART
#include "hwloc/cudart.h"
#endif
#if HWLOC_TEST_RENAME_NVML
#include "hwloc/nvml.h"
#endif
#include "hwloc/gl.h"
#include "hwloc/intel-mic.h"

#include "private/autogen/config.h"
#include "private/components.h"
#include "private/cpuid-x86.h"
#include "private/debug.h"
#include "private/misc.h"
#include "private/private.h"
#include "private/solaris-chiptype.h"
#include "private/xml.h"


text:
package net.codaview.utils.keyword;

/**
 * 关键字替换策略。
 */
public interface ReplaceStrategy {

	/**
	 * 将关键字替换为期望的结果字符串
	 *
	 * @param keyword
	 *            keyword
	 * @return The resulting <tt>String</tt>
	 */
	String replaceWith(String keyword);

}


text:
using System.Text;
using NUnit.Framework;

namespace BasicCases
{
    internal class SteeringExamples
    {
        public void M()
        {
            var sb = new StringBuilder();
            sb.Append("");
            Assert.AreEqual("", "");
        }
    }
}


text:
<?php
namespace eMapper\Dynamic\Builder;

use eMapper\Dynamic\Provider\EnvironmentProvider;

/**
 * The EnvironmentBuilder trait provides access to the EnvironmentProvider class
 * in order to obtain dynamically generated execution environment for eMacros expressions
 * @author emaphp
 */
trait EnvironmentBuilder {
	/**
	 * Returns an execution environment
	 * @param array $config
	 * @return \eMapper\Dynamic\Environment\DynamicSQLEnvironment
	 */
	protected function buildEnvironment($config) {
		$environmentId = $config['env.id'];

		if (!EnvironmentProvider::hasEnvironment($environmentId))
			EnvironmentProvider::buildEnvironment($environmentId, $config['env.class']);

		//setup environment
		$env = EnvironmentProvider::getEnvironment($environmentId);
		$env->setConfig($config);
		return $env;
	}
}


text:
'use strict';

module.exports = function(driver, connectorSpec) {
	connectorSpec.shouldBehaveLikeMusicSite(driver, {
		url: 'http://onair.europa2.sk',
		playButtonSelector: '.e2-player-control-skip'
	});
	connectorSpec.shouldBehaveLikeMusicSite(driver, {
		url: 'http://onair.europa2.sk',
		playButtonSelector: '.e2-player-control-skip'
	});
};


text:
describe("Dependency Injection Container", function() {
    var dic;

    beforeEach(function() {
        dic = new DIC();
    });

    it("returns scalar values", function() {
        dic.register('Pi', 3.14);

        expect(dic.get('Pi')).toEqual(3.14);
    });

    it("throws an error for non-existing names", function () {
        expect(function() {
            dic.get("foo");
        }).toThrow("Undefined key: 'foo'");
    });

    it("executes constructor functions", function() {
        var Bar = function() { };

        dic.register('Foo', function() {
            return new Bar();
        });

        expect(dic.get('Foo') instanceof Bar).toEqual(true);
    });

    it("passes itself as a parameter to constructor functions", function() {
        dic.register('first', 1);
        dic.register('second', function(dic) {
            return dic.get('first');
        });

        expect(dic.get('second')).toEqual(1);
    });

    it("executes shared constructor functions only once", function() {
        var Bar = function() { };

        dic.register('Foo', function() {
            return new Bar();
        }, {
            shared: true
        });

        expect(dic.get('Foo')).toBe(dic.get('Foo'));
    });

    it("returns logical names by tags", function() {
        dic.register('two',   2, { tags: [ 'prime', 'even' ] });
        dic.register('three', 3, { tags: [ 'prime', 'odd' ] });
        dic.register('four',  4, { tags: [ 'even' ] });

        var tagged = dic.getTagged('prime');

        expect(tagged).toContain('two');
        expect(tagged).toContain('three');
        expect(tagged.length).toEqual(2);
    });

    it("returns an empty array for non-existing tag", function() {
        expect(dic.getTagged('foobar').length).toEqual(0);
    })

    it("creates a new DIC based on tagged subset of itself", function () {
        dic.register('one',   1, { tags: [ 'leave-me' ] });
        dic.register('two',   2, { tags: [ 'pick-me' ] });
        dic.register('three', 3, { tags: [ 'pick-me' ] });
        dic.register('four',  4, { tags: [ 'leave-me' ] });

        var anotherDic = dic.createNewFromTag('pick-me');

        expect(anotherDic.get('two')).toEqual(2);
        expect(anotherDic.get('three')).toEqual(3);
    });
});


text:
from django.conf.urls import patterns, url
from django.views.generic import RedirectView

urlpatterns = patterns('dfss.demo.views',
                       url(r'^resumes/$', 'resumes', name='resumes'),
                       url(r'^resume/(?P<epoc_time>[0-9]+)/$', 'get_resume', name='resume'),
                       url(r'^register/$', 'register', name='register'),
                       url(r'^login/$', 'user_login', name='login'),
                       url(r'^logout/$', 'user_logout', name='logout'),
                       url(r'^$', RedirectView.as_view(url='/demo/resumes/')),
                       )


text:
name: Work Item
about: Work that needs to be done within the project
title: "[Work Item]"
labels: Work Item
assignees: ''

---

**Describe the work**
Provide details of the work that needs to be done within the project

**Additional Context**
Any other context here.


text:
from braces.views import LoginRequiredMixin
from django.views.generic import UpdateView
from .forms import UserPreferencesForm
from pipeye.utils.urls import url_lazy

class PreferencesView(LoginRequiredMixin, UpdateView):
    form_class = UserPreferencesForm
    template_name = 'accounts/preferences.html'
    success_url = url_lazy('preferences')

    def get_object(self, queryset=None):
        return self.request.user
preferences = PreferencesView.as_view()


text:
namespace Urho3D
{

/// Dynamically sized buffer that can be read and written to as a stream.
class URHO3D_API VectorBuffer : public AbstractFile
{
public:
    /// Construct an empty buffer.
    VectorBuffer();
    /// Construct from another buffer.
    explicit VectorBuffer(const ByteVector& data);
    /// Construct from a memory area.
    VectorBuffer(const void* data, unsigned size);
    /// Construct from a stream.
    VectorBuffer(Deserializer& source, unsigned size);

    /// Returns name of this object.
    const ea::string& GetName() const override;

    /// Read bytes from the buffer. Return number of bytes actually read.
    unsigned Read(void* dest, unsigned size) override;
    /// Set position from the beginning of the buffer. Return actual new position.
    unsigned Seek(unsigned position) override;
    /// Write bytes to the buffer. Return number of bytes actually written.
    unsigned Write(const void* data, unsigned size) override;

    /// Set data from another buffer.
    void SetData(const ByteVector& data);
    /// Set data from a memory area.
    void SetData(const void* data, unsigned size);
    /// Set data from a stream.
    void SetData(Deserializer& source, unsigned size);
    /// Reset to zero size.
    void Clear();
    /// Set size.
    void Resize(unsigned size);

    /// Return data.
    const unsigned char* GetData() const { return size_ ? &buffer_[0] : nullptr; }

    /// Return non-const data.
    unsigned char* GetModifiableData() { return size_ ? &buffer_[0] : nullptr; }

    /// Return the buffer.
    const ByteVector& GetBuffer() const { return buffer_; }
    /// Return the buffer.
    ByteVector& GetBuffer() { return buffer_; }

private:
    /// Dynamic data buffer.
    ByteVector buffer_;
};

}


text:
import { CREATE_ITEM, RECEIVE_ITEMS, REQUEST_ITEMS, EDIT_ITEM, DELETE_ITEM } from '../actions/ItemActions';

const initialState = { items: [], isFetching: false };

export default function itemReducer(state = initialState, action) {
  switch (action.type) {

    case CREATE_ITEM:
      return Object.assign({}, state, {
        items: [...state.items, action.text]
      });

    case REQUEST_ITEMS:
      return Object.assign({}, state, {
        isFetching: true
      });

    case RECEIVE_ITEMS:
      return Object.assign({}, state, {
        isFetching: false,
        items: action.items
      });
      // return {
      //   ...state,
      //   isFetching: false,
      //   items: action.items
      // });

    // case CREATE_ITEM:
    //   return state.concat(action.text);

    // case EDIT_ITEM:
    //   return state.set(action.id, action.text);

    // case DELETE_ITEM:
    //   return state.delete(action.id);

    default:
      return state;
  }
}


text:
class WXDLLIMPEXP_FWD_CORE wxWizard;
class WXDLLIMPEXP_FWD_CORE wxWizardPageSimple;

class WXDLLIMPEXP_XRC wxWizardXmlHandler : public wxXmlResourceHandler
{
    wxDECLARE_DYNAMIC_CLASS(wxWizardXmlHandler);

public:
    wxWizardXmlHandler();
    virtual wxObject *DoCreateResource() wxOVERRIDE;
    virtual bool CanHandle(wxXmlNode *node) wxOVERRIDE;

private:
    wxWizard *m_wizard;
    wxWizardPageSimple *m_lastSimplePage;
};

#endif // wxUSE_XRC && wxUSE_WIZARDDLG

#endif // _WX_XH_WIZRD_H_


text:
package io.udash
package rest

import scala.concurrent.Future

trait TestServerRESTInterface {
  def serviceOne(): TestServerRESTInternalInterface
  def serviceTwo(@Header("X_AUTH_TOKEN") token: String, @Header("Lang") lang: String): TestServerRESTInternalInterface
  @Prefix("service_three") def serviceThree(@Path arg: String): TestServerRESTInternalInterface

  def auth(@Header("X-Password") pass: String): TestServerRESTInternalInterface
}
object TestServerRESTInterface extends DefaultRestApiCompanion[TestServerRESTInterface]

trait TestServerRESTInternalInterface {
  @GET("loadAll") def load(): Future[Seq[TestRESTRecord]]
  @GET def load(@Path id: Int, trash: String, @Query("trash_two") trash2: String): Future[TestRESTRecord]
  def create(@Body record: TestRESTRecord): Future[TestRESTRecord]
  @PUT def update(@Query id: Int)(@Body record: TestRESTRecord): Future[TestRESTRecord]
  @PUT def modify(@Path id: Int)(s: String, i: Int): Future[TestRESTRecord]
  @DELETE("remove") def delete(@Path id: Int): Future[TestRESTRecord]
  def deeper(): TestServerRESTDeepInterface
}
object TestServerRESTInternalInterface extends DefaultRestApiCompanion[TestServerRESTInternalInterface]

trait TestServerRESTDeepInterface {
  @GET def load(@Path id: Int): Future[TestRESTRecord]
}
object TestServerRESTDeepInterface extends DefaultRestApiCompanion[TestServerRESTDeepInterface]


text:
/**
This module defines the tournament settings general view Class, which is a part of the settings page.
@module TournamentSettingsGeneralViewModule
@require jquery
@require underscore
@require backbone
@require ../state
@require ../eventCenter
@require ../undo
@require ../singletons
@require ../utils
@output TournamentSettingsGeneralView
*/
define(['require','jquery','underscore','backbone','../singletons','../utils','../eventCenter','../state','../undo'], function(require,$,_,Backbone,singletons,utils,eventCenter,state,undo)
{
	/**
	The tournament settings general view is a content view for the tournament settings view where you can access the general settings of the tournament
	@type Class:TournamentSettingsGeneralView
	@extend Backbone.View
	*/
	var TournamentSettingsGeneralView = Backbone.View.extend({
		/**
		The class name
		@type String:className
		*/
		className: "data",
		/**
		The path for this page
		@type String:path
		*/
		path: "tournamentSettings/general",
		/**
		A model with data the page can use
		@type Backbone.Model:model
		*/
		model: false,
		/**
		An object to define event handling
		@type Object:events
		*/
		events:
		{
			"keyup input[type='text']": "update",
			"blur input[type='text']": "update",
			"change input[type='radio']": "update",
			"change input[type='checkbox']": "update",
			"keyup textarea": "update",
			"blur textarea": "update"
		},
		/**
		Initialize the TournamentSettingsGeneralView
		@type Function:initialize
		@return TournamentSettingsGeneralView:Returns itself for chaining
		*/
		initialize: function()
		{
			this.model = singletons.tournament;
			return this;
		},
		/**
		Change the values in on the page according to the models changes
		@type Function:change
		@param Backbone.Model:The model
		@return TournamentSettingsGeneralView:Returns itself for chaining
		*/
		change: function(model)
		{
			this.$el.find("[name='name']").val(model.get("name"));
			this.$el.find("[name='startDate']").val(model.get("startDate"));
			this.$el.find("[name='endDate']").val(model.get("endDate"));

			$("#tournamentSettingsGeneralStartDateText").text($.datepicker.formatDate(
													utils.config.dateFormatText,
													$.datepicker.parseDate(
																		$.datepicker._defaults.dateFormat,
																		model.get("startDate"))
													));

			$("#tournamentSettingsGeneralEndDateText").text($.datepicker.formatDate(
													utils.config.dateFormatText,
													$.datepicker.parseDate(
																		$.datepicker._defaults.dateFormat,
																		model.get("endDate"))
													));
			return this;

		},
		/**
		Update the model by the changes on the page
		@type Function:update
		@param Event:The event
		@return TournamentSettingsGeneralView:Returns itself for chaining
		*/
		update: function(ev)
		{
			var $element = $(ev.currentTarget);
			if ($element.prop("type") == "text") newValue = $element.val();
			else if ($element.prop("type") == "number") newValue = $element.val();
			else if ($element.prop("type") == "email") newValue = $element.val();
			else if ($element.prop("type") == "hidden") newValue = $element.val();
			else if ($element.prop("type") == "radio") newValue = this.$el.find("input[name='" + $element.prop("name") + "']:checked").val();
			else if ($element.prop("type") == "checkbox") newValue = $element.is(":checked");
			else newValue = newValue = $element.val();
			var oldValue = this.model.get($element.prop("name"));
			if (newValue == oldValue) return;
			var undoAction = new undo.Action(
			{
				path: this.path,
				context: this,
				undoDescription: "Tournament - '" + $element.attr("name") + "': " + oldValue + " ← " + newValue + ".",
				redoDescription: "Tournament - '" + $element.attr("name") + "': " + oldValue + " → " + newValue + ".",
				undo: function()
				{
					this.model.set($element.prop("name"),oldValue,{validate: true});
				},
				redo: function()
				{
					this.model.set($element.prop("name"),newValue,{validate: true});
				},
			});

			this.model.set($element.prop("name"),newValue);
			undo.manager.addUndoActions(undoAction);
			return this;
		},
		/**
		Render the view
		@type Function:render
		@return TournamentSettingsGeneralView:Returns itself for chaining
		*/
		render: function()
		{
			var ext =
			{
				startDateText: $.datepicker.formatDate(
													"d. M yy",
													$.datepicker.parseDate(
																		$.datepicker._defaults.dateFormat,
																		this.model.get("startDate"))
													),
				endDateText: $.datepicker.formatDate(
													utils.config.dateFormatText,
													$.datepicker.parseDate(
																		$.datepicker._defaults.dateFormat,
																		this.model.get("endDate"))
													),
				creationDateText: $.datepicker.formatDate(
													utils.config.dateFormatText,
													$.datepicker.parseDate(
																		$.datepicker._defaults.dateFormat,
																		this.model.get("creationDate"))
													),
			}
			this.$el.html(utils.templates["TournamentSettingsGeneralView"](utils.merge(_.pick(utils.config,"baseURL"),this.model.toJSON(),ext)));

			this.$el.find("#tournamentSettingsGeneralStartEndRange").datepicker(
			{
				firstDay: utils.config.tournamentSettingsFirstDay,
				maxDate: utils.config.tournamentSettingsMaxDate,
				minDate: utils.config.tournamentSettingsMinDate,
				yearRange: utils.config.tournamentSettingsYearRange,
				beforeShowDay: function(date)
				{
					var date1 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#tournamentSettingsGeneralStartDate").val());
					var date2 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#tournamentSettingsGeneralEndDate").val());
					return [true, date1 && ((date.getTime() == date1.getTime()) || (date2 && date >= date1 && date <= date2)) ? "dp-highlightRange" : ""];
				},
				onSelect: function(dateText, inst) {
					var date1 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#tournamentSettingsGeneralStartDate").val());
					var date2 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#tournamentSettingsGeneralEndDate").val());
					if (!date1 || date2)
					{
						$("#tournamentSettingsGeneralStartDate").val(dateText).trigger("blur");
						$(this).datepicker("option", "minDate", dateText);
						setTimeout(function()
						{
							$("#tournamentSettingsGeneralEndDate").val("");
							$("#tournamentSettingsGeneralStartEndRange").datepicker("show");
						}, 0)
					}
					else
					{
						$("#tournamentSettingsGeneralEndDate").val(dateText).trigger("blur");
						$(this).datepicker("option", "minDate", null);
					}

				}
			});
			return this;
		},
		/**
		Gets called when the page turns active
		@type Function:active
		@return TournamentSettingsGeneralView:Returns itself for chaining
		*/
		active: function()
		{
			this.listenTo(this.model,"change",this.change);
			return this;
		},
		/**
		Gets called when the page turns inactive
		@type Function:inactive
		@return TournamentSettingsGeneralView:Returns itself for chaining
		*/
		inactive: function()
		{
			this.stopListening(this.model);
			return this;
		}
	});

	return TournamentSettingsGeneralView;
});


text:
@implementation RepeatEnumerator {
    MemoisedEnumerator *enumerator;
}
- (RepeatEnumerator *)initWith:(MemoisedEnumerator *)anEnumerator {
    self = [super init];
    enumerator = anEnumerator;
    return self;
}

- (id)nextObject {
    id item = [enumerator nextObject];
    return (item == nil) ? [enumerator firstObject] : item;
}

+ (RepeatEnumerator *)with:(MemoisedEnumerator *)anEnumerator {
    return [[RepeatEnumerator alloc] initWith:anEnumerator];
}
@end


text:
namespace WienerLinienApi.Information
{
    public class MeansOfTransportWrapper
    {
        public const string Metro = @"ptmetro";
        public const string Tram = "pttram";
        public const string TramWlb = "pttramwlb";
        public const string Bus = "ptbuscity";
        public const string NightBus = "ptbusnight";
        public const string TrainS = "pttrains";
        public static MeansOfTransport GetMeansOfTransportFromString(string input)
        {
            var returnMot = MeansOfTransport.Unknown;
            switch (input.ToLowerInvariant())
            {

                case Metro:
                    returnMot = MeansOfTransport.Metro;
                    break;
                case Tram:
                    returnMot = MeansOfTransport.Tram;
                    break;
                case TramWlb:
                    returnMot = MeansOfTransport.TramWlb;
                    break;
                case Bus:
                    returnMot = MeansOfTransport.Bus;
                    break;
                case TrainS:
                    returnMot = MeansOfTransport.SBahn;
                    break;
                case NightBus:
                    returnMot = MeansOfTransport.NightBus;
                    break;
                case "other":
                    returnMot = MeansOfTransport.Other;
                    break;
            }

            return returnMot;
        }

        public static string GetStringFromMeansOfTransport(MeansOfTransport input)
        {
            var returnString = "";

            switch (input)
            {
                case MeansOfTransport.Metro:
                    returnString = Metro;
                    break;
                case MeansOfTransport.Tram:
                    returnString = Tram;
                    break;
                case MeansOfTransport.TramWlb:
                    returnString = TramWlb;
                    break;
                case MeansOfTransport.Bus:
                    returnString = Bus;
                    break;
                case MeansOfTransport.NightBus:
                    returnString = NightBus;
                    break;
            }

            return returnString;
        }
    }
    public enum MeansOfTransport
    {
        Metro = 1,
        Tram,
        TramWlb,
        Bus,
        SBahn,
        Other,
        NightBus,
        Unknown
    }
}


text:
import {Component} from '@angular/core';

@Component({
  selector: 'select-form-example',
  templateUrl: './select-form-example.html',
})
export class SelectFormExample {
  selectedValue: string;

  foods = [
    {value: 'steak-0', viewValue: 'Steak'},
    {value: 'pizza-1', viewValue: 'Pizza'},
    {value: 'tacos-2', viewValue: 'Tacos'}
  ];
}


text:
<?php

namespace Bootstrap\View\Helper;

use Cake\View\Helper;

class BootstrapModalHelper extends Helper {

    use BootstrapTrait ;

    public $helpers = ['Html'];

    protected $_current = null;

    protected $_currentId = null;

    /**
     *
     * Create a Twitter Bootstrap like modal.
     *
     * @param array|string $title If array, works as $options, otherwize used as the modal title.
     * @param array $options Options for the main div of the modal.
     *
     * Extra options (useless if $title not specified) :
     *     - close: Add close buttons to header (default true)
     *     - no-body: Do not open the body after the create (default false)
     *     - size: Modal size (small, large or custom classes)
     **/
    public function create($title = null, $options = []) {

        if (is_array($title)) {
            $options = $title ;
        }

        $this->_currentId = null;
        $this->_current   = null;

        $options += [
            'id' => null,
            'close' => true,
            'body' => true,
            'tabindex' => -1,
            'role' => 'dialog',
            'aria-hidden' => 'true',
            'size' => false
        ];

        $close = $options['close'];
        $body  = $options['body'];
        unset ($options['close'], $options['body']) ;

        if ($options['id']) {
            $this->_currentId = $options['id'] ;
            $options['aria-labelledby'] = $this->_currentId.'Label' ;
        }

        switch($options['size']) {
        case 'lg':
        case 'large':
        case 'modal-lg':
            $size = ' modal-lg';
            break;
        case 'sm':
        case 'small':
        case 'modal-sm':
            $size = ' modal-sm';
            break;
        case false:
            $size = '';
            break;
        default:
            $size = ' '.$options['size'];
            break;
        }
        unset($options['size']);

        $options = $this->addClass($options, 'modal fade');
        $res = $this->Html->tag('div', null, $options)
             .$this->Html->div('modal-dialog'.$size).$this->Html->div('modal-content');
        if (is_string($title) && $title) {
            $res .= $this->_createHeader($title, ['close' => $close]) ;
            if ($body) {
                $res .= $this->_createBody();
            }
        }
        return $res ;
    }

    /**
     *
     * End a modal. If $buttons is not null, the ModalHelper::footer functions is called
     * with $buttons and $options arguments.
     *
     * @param array|null $buttons
     * @param array $options
     *
     **/
    public function end ($buttons = NULL, $options = []) {
        $res = $this->_cleanCurrent();
        if ($buttons !== null) {
            $res .= $this->footer($buttons, $options) ;
        }
        $res .= '

' ;
        return $res ;
    }

    protected function _cleanCurrent () {
        if ($this->_current) {
            $this->_current = null ;
            return '
';
        }
        return '' ;
    }

    protected function _part ($part, $content = null, $options = []) {
        $out = $this->_cleanCurrent().$this->Html->tag('div', $content, $options);
        if (!$content)
            $this->_current = $part;
        return $out;
    }

    protected function _createHeader ($title = null, $options = []) {
        $options += [
            'close' => true
        ];

        $close = $options['close'];
        unset($options['close']) ;

        $options = $this->addClass($options, 'modal-header');

        $out = null;
        if ($title) {
            $out = '';
            if ($close) {
                $out .= $this->Html->tag('button', '×', [
                    'type' => 'button',
                    'class' => 'close',
                    'data-dismiss' => 'modal',
                    'aria-hidden' => 'true'
                ]);
            }
            $out .= $this->Html->tag('h4', $title, [
                'class' => 'modal-title',
                'id' => $this->_currentId ? $this->_currentId.'Label' : false
            ]);
        }

        return $this->_part('header', $out, $options);
    }

    protected function _createBody ($text = null, $options = []) {
        $options = $this->addClass($options, 'modal-body');
        return $this->_part('body', $text, $options);
    }

    protected function _createFooter ($buttons = null, $options = []) {
        $options += [
            'close' => true
        ];
        $close = $options['close'];
        unset($options['close']);

        $content = '';
        if (!$buttons && $close) {
            $content .= '<button type="button" class="btn btn-default" data-dismiss="modal">'
                     .__('Close')
                     .'</button>' ;
        }
        $content .= $buttons;

        $options = $this->addClass($options, 'modal-footer');
        return $this->_part('footer', $buttons, $options);
    }

    /**
     *
     * Create / Start the header. If $info is specified as a string, create and return the
     * whole header, otherwize only open the header.
     *
     * @param array|string $info If string, use as the modal title, otherwize works as $options.
     * @param array $options Options for the header div.
     *
     * Special option (if $info is string):
     *     - close: Add the 'close' button in the header (default true).
     *
     **/
    public function header ($info = null, $options = []) {
        if (is_array($info)) {
            $options = $info;
            $info = null;
        }
        return $this->_createHeader($info, $options) ;
    }

    /**
     *
     * Create / Start the body. If $info is not null, it is used as the body content,
     * otherwize start the body div.
     *
     * @param array|string $info If string, use as the body content, otherwize works as $options.
     * @param array $options Options for the footer div.
     *
     *
     **/
    public function body ($info = null, $options = []) {
        if (is_array($info)) {
            $options = $info;
            $info = null;
        }
        return $this->_createBody($info, $options) ;
    }

    /**
     *
     * Create / Start the footer. If $buttons is specified as an associative arrays or as null,
     * start the footer, otherwize create the footer with the specified buttons.
     *
     * @param array|string $buttons If string, use as the footer content, if list, concatenate
     *        values in the list as content (use for buttons purpose), otherwize works as $options.
     * @param array $options Options for the footer div.
     *
     * Special option (if $buttons is NOT NULL but empty):
     *     - close: Add the 'close' button to the footer (default true).
     *
     **/
    public function footer ($buttons = null, $options = []) {
        if (is_array($buttons)) {
            if (!empty($buttons) && $this->_isAssociativeArray($buttons)) {
                $options = $buttons;
                $buttons = null;
            }
            else {
                $buttons = implode('', $buttons);
            }
        }
        return $this->_createFooter($buttons, $options) ;
    }

}

?>