text:
[![Build Status](https://travis-ci.org/tmux-plugins/tmux-resurrect.png?branch=master)](https://travis-ci.org/tmux-plugins/tmux-resurrect)

Restore `tmux` environment after system restart.

Tmux is great, except when you have to restart the computer. You lose all the
running programs, working directories, pane layouts etc.
There are helpful management tools out there, but they require initial
configuration and continuous updates as your workflow evolves or you start new
projects.

`tmux-resurrect` saves all the little details from your tmux environment so it
can be completely restored after a system restart (or when you feel like it).
No configuration is required. You should feel like you never quit tmux.

It even (optionally)
[restores vim and neovim sessions](docs/restoring_vim_and_neovim_sessions.md)!

Automatic restoring and continuous saving of tmux env is also possible with
[tmux-continuum](https://github.com/tmux-plugins/tmux-continuum) plugin.

### Screencast

[![screencast screenshot](/video/screencast_img.png)](https://vimeo.com/104763018)

### Key bindings

- `prefix + Ctrl-s` - save
- `prefix + Ctrl-r` - restore

### About

This plugin goes to great lengths to save and restore all the details from your
`tmux` environment. Here's what's been taken care of:

- all sessions, windows, panes and their order
- current working directory for each pane
- **exact pane layouts** within windows (even when zoomed)
- active and alternative session
- active and alternative window for each session
- windows with focus
- active pane for each window
- "grouped sessions" (useful feature when using tmux with multiple monitors)
- programs running within a pane! More details in the
  [restoring programs doc](docs/restoring_programs.md).

Optional:

- [restoring vim and neovim sessions](docs/restoring_vim_and_neovim_sessions.md)
- [restoring pane contents](docs/restoring_pane_contents.md)
- [restoring bash history](docs/restoring_bash_history.md) (experimental)

Requirements / dependencies: `tmux 1.9` or higher, `bash`.

`tmux-resurrect` is idempotent! It will not try to restore panes or windows that
already exist.

The single exception to this is when tmux is started with only 1 pane in order
to restore previous tmux env. Only in this case will this single pane be
overwritten.

### Installation with [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm) (recommended)

Add plugin to the list of TPM plugins in `.tmux.conf`:

    set -g @plugin 'tmux-plugins/tmux-resurrect'

Hit `prefix + I` to fetch the plugin and source it. You should now be able to
use the plugin.

### Manual Installation

Clone the repo:

    $ git clone https://github.com/tmux-plugins/tmux-resurrect ~/clone/path

Add this line to the bottom of `.tmux.conf`:

    run-shell ~/clone/path/resurrect.tmux

Reload TMUX environment with: `$ tmux source-file ~/.tmux.conf`.
You should now be able to use the plugin.

### Docs

- [Guide for migrating from tmuxinator](docs/migrating_from_tmuxinator.md)

**Configuration**

- [Changing the default key bindings](docs/custom_key_bindings.md).
- Only a conservative list of programs is restored by default:

  `vi vim nvim emacs man less more tail top htop irssi mutt`.

  [Restoring programs doc](docs/restoring_programs.md) explains how to restore
  additional programs.
- [Change a directory](docs/save_dir.md) where `tmux-resurrect` saves tmux
  environment.

**Optional features**

- [Restoring vim and neovim sessions](docs/restoring_vim_and_neovim_sessions.md)
  is nice if you're a vim/neovim user.
- [Restoring pane contents](docs/restoring_pane_contents.md) feature.

**Experimental features (also optional)**

- [restoring bash history](docs/restoring_bash_history.md)

### Other goodies

- [tmux-copycat](https://github.com/tmux-plugins/tmux-copycat) - a plugin for
  regex searches in tmux and fast match selection
- [tmux-yank](https://github.com/tmux-plugins/tmux-yank) - enables copying
  highlighted text to system clipboard
- [tmux-open](https://github.com/tmux-plugins/tmux-open) - a plugin for quickly
  opening highlighted file or a url
- [tmux-continuum](https://github.com/tmux-plugins/tmux-continuum) - automatic
  restoring and continuous saving of tmux env

You might want to follow [@brunosutic](https://twitter.com/brunosutic) on
twitter if you want to hear about new tmux plugins or feature updates.

### Reporting bugs and contributing

Both contributing and bug reports are welcome. Please check out
[contributing guidelines](CONTRIBUTING.md).

### Credits

[Mislav Marohnić](https://github.com/mislav) - the idea for the plugin came from his
[tmux-session script](https://github.com/mislav/dotfiles/blob/2036b5e03fb430bbcbc340689d63328abaa28876/bin/tmux-session).

### License
[MIT](LICENSE.md)


text:
// ==========================================================================
//  Squidex Headless CMS
// ==========================================================================
//  Copyright (c) Squidex UG (haftungsbeschraenkt)
//  All rights reserved. Licensed under the MIT license.
// ==========================================================================

using Squidex.Domain.Apps.Core.TestHelpers;
using Squidex.Infrastructure;

namespace Squidex.Domain.Apps.Core.Model.Apps;

public class AppPlanTests
{
    [Fact]
    public void Should_serialize_and_deserialize()
    {
        var plan = new AssignedPlan(RefToken.Client("Me"), "free");

        var serialized = plan.SerializeAndDeserialize();

        Assert.Equal(plan, serialized);
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.yahoo.pasc.paxos.state;

import java.io.Serializable;

import com.yahoo.pasc.CloneableDeep;
import com.yahoo.pasc.EqualsDeep;

public final class IidAcceptorsCounts implements Serializable, EqualsDeep<IidAcceptorsCounts>, CloneableDeep<IidAcceptorsCounts> {

    private static final long serialVersionUID = 7587497611602103466L;

    long iid;
    int ballot;
    int acceptors;
    int receivedRequests;	// actual number of different requests received so far
    int totalRequests;		// number of requests with the same instance id (in the same batch from the leader)
    boolean accepted;		// true if receivedRequests == totalRequests

    public IidAcceptorsCounts(long iid, int ballot) {
        this.acceptors = 0;
        this.iid = iid;
        this.ballot = ballot;
    }

    public long getIid() {
        return iid;
    }

    public void setIid(long iid) {
        this.iid = iid;
    }

    public int getAcceptors() {
        return acceptors;
    }

    public void setAcceptors(int acceptors) {
        this.acceptors = acceptors;
    }

    public void setAcceptor(int acceptor) {
        acceptors = acceptors | (1 << acceptor);
    }

    public int getCardinality(int servers) {
        int count = 0;
        for (int i = 0; i < servers; ++i) {
            if ((acceptors & (1 << i)) != 0)
                ++count;
        }
        return count;
    }

    public boolean isAccepted() {
        return accepted;
    }

    public void setAccepted(boolean accepted) {
        this.accepted = accepted;
    }

    public int getReceivedRequests() {
        return receivedRequests;
    }

    public void setReceivedRequests(int receivedRequests) {
        this.receivedRequests = receivedRequests;
    }

    public int getTotalRequests() {
        return totalRequests;
    }

    public void setTotalRequests(int totalRequests) {
        this.totalRequests = totalRequests;
    }

    public int getBallot() {
        return ballot;
    }

    public void setBallot(int ballot) {
        this.ballot = ballot;
    }

    public IidAcceptorsCounts cloneDeep() {
        IidAcceptorsCounts res = new IidAcceptorsCounts(this.iid, this.ballot);
        res.acceptors = this.acceptors;
        res.accepted = this.accepted;
        res.receivedRequests = this.receivedRequests;
        res.totalRequests = this.totalRequests;
        return res;
    }

    public boolean equalsDeep(IidAcceptorsCounts other) {
        return (this.iid == other.iid) && (this.ballot == other.ballot) && (this.acceptors == other.acceptors)
                && (this.accepted == other.accepted) && (this.receivedRequests == other.receivedRequests)
                && (this.totalRequests == other.totalRequests);
    }
}


text:
require 'rails/generators/resource_helpers'

module Rails
  module Generators
    class YamledAclGenerator < Rails::Generators::NamedBase
      include Rails::Generators::ResourceHelpers

      source_root File.expand_path('../templates', __FILE__)

      def copy_file
        path  = File.expand_path(Rails.root.join("#{YamledAcl.files_with_permissions_path}"), __FILE__)
        template 'acl.yml', "#{path}/#{controller_file_path}.yml"
      end
    end
  end
end


text:
namespace google {
namespace cloud {
namespace storage {
namespace testing {

class TempFile {
 public:
  explicit TempFile(std::string const& content);
  TempFile(TempFile const&) = delete;
  TempFile& operator=(TempFile const&) = delete;
  TempFile& operator=(TempFile&&) = delete;

  ~TempFile();

  std::string name() { return name_; }

 private:
  std::string name_;
};

}  // namespace testing
}  // namespace storage
}  // namespace cloud
}  // namespace google

#endif  // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_TESTING_TEMP_FILE_H


text:
package com.ggt.slidescast.ui.fragments;

import android.app.Activity;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Bundle;
import android.view.View;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;

import com.ggt.slidescast.R;
import com.ggt.slidescast.model.app.Presentation;
import com.ggt.slidescast.model.app.Presentation.PresentationType;
import com.ggt.slidescast.ui.adapters.DriveResultsAdapter;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Scope;
import com.google.android.gms.drive.Drive;
import com.google.android.gms.drive.DriveApi;
import com.google.android.gms.drive.DriveApi.MetadataBufferResult;
import com.google.android.gms.drive.Metadata;
import com.google.android.gms.drive.query.Filters;
import com.google.android.gms.drive.query.Query;
import com.google.android.gms.drive.query.SearchableField;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.ViewById;

/**
 * Fragment that displays presentations from google drive.
 *
 * @author guiguito
 */
@EFragment(R.layout.fragment_google_drive)
public class GoogleDriveFragment extends MotherFragment implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {

    @ViewById
    ListView mListFilesListview;
    GoogleApiClient mGoogleApiClient;
    @Bean
    DriveResultsAdapter mResultsAdapter;

    Metadata mSelectedMetadata;
    private String mNextPageToken;
    private boolean mHasMore;

    private static final int RESOLVE_CONNECTION_REQUEST_CODE = 1;

    @AfterViews
    void init() {
        mHasMore = true; // initial request assumes there are files results.
        mListFilesListview.setAdapter(mResultsAdapter);
        mListFilesListview.setOnScrollListener(new OnScrollListener() {

            @Override
            public void onScrollStateChanged(AbsListView view, int scrollState) {
            }

            /**
             * Handles onScroll to retrieve next pages of results if there are
             * more results items to display.
             */
            @Override
            public void onScroll(AbsListView view, int first, int visible, int total) {
                if (mNextPageToken != null && first + visible + 5 < total) {
                    retrieveNextPage();
                }
            }
        });
        mListFilesListview.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                onMetaDataClicked(mResultsAdapter.getItem(position));
            }
        });
        mGoogleApiClient = new GoogleApiClient.Builder(getActivity()).addApi(Drive.API).addScope(Drive.SCOPE_FILE)
                .addScope(new Scope("https://www.googleapis.com/auth/drive.readonly")).addConnectionCallbacks(this).addOnConnectionFailedListener(this).build();
        mGoogleApiClient.connect();
    }

    public void onMetaDataClicked(Metadata metadata) {
        mSelectedMetadata = metadata;
        Presentation presentation = new Presentation();
        presentation.setType(PresentationType.GOOGLEDRIVE);
        presentation.setTitle(metadata.getTitle());
        presentation.setDescription(metadata.getDescription());
        presentation.setUrl(metadata.getEmbedLink());
        // ((SlidesCastMainActivity)
        // getActivity()).setPresentation(presentation);
        // TODO launch cast activity
    }

    /**
     * Clears the result buffer to avoid memory leaks as soon as the activity is
     * no longer visible by the user.
     */

    public void onStop() {
        super.onStop();
        if (mGoogleApiClient != null) {
            mGoogleApiClient.disconnect();
        }
        mResultsAdapter.clear();
    }

    @Override
    public void onConnected(Bundle arg0) {
        retrieveNextPage();
    }

    private void retrieveNextPage() {
        // if there are no more results to retrieve,
        // return silently.
        if (!mHasMore) {
            return;
        }
        // retrieve the results for the next page.
        Query query = new Query.Builder().addFilter(Filters.eq(SearchableField.MIME_TYPE, "application/vnd.google-apps.presentation"))
                .setPageToken(mNextPageToken).build();
        // TODO add filter
        // Drive.DriveApi.getRootFolder(mGoogleApiClient).
        Drive.DriveApi.query(mGoogleApiClient, query).setResultCallback(new ResultCallback<DriveApi.MetadataBufferResult>() {

            @Override
            public void onResult(MetadataBufferResult result) {
                if (!result.getStatus().isSuccess()) {
                    Toast.makeText(getActivity(), "error retrieving files", Toast.LENGTH_LONG).show();
                    return;
                }
                mResultsAdapter.append(result.getMetadataBuffer());
                mNextPageToken = result.getMetadataBuffer().getNextPageToken();
                mHasMore = mNextPageToken != null;
            }
        });
    }

    @Override
    public void onConnectionFailed(ConnectionResult connectionResult) {
        handleError(-1, connectionResult, null);
    }

    @Override
    public void onConnectionSuspended(int connectionSuspendedValue) {
        handleError(connectionSuspendedValue, null, null);
    }

    private void handleError(int connectionSuspendedValue, ConnectionResult connectionResult, String message) {
        if (connectionResult != null && connectionResult.hasResolution()) {
            try {
                connectionResult.startResolutionForResult(getActivity(), RESOLVE_CONNECTION_REQUEST_CODE);
            } catch (IntentSender.SendIntentException e) {
                // Unable to resolve, message user appopriately
            }
        } else if (connectionResult != null) {
            GooglePlayServicesUtil.getErrorDialog(connectionResult.getErrorCode(), getActivity(), 0).show();
        } else if (message != null) {
            Toast.makeText(getActivity(), message, Toast.LENGTH_LONG).show();
        }
    }

    @Override
    public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
        switch (requestCode) {
            case RESOLVE_CONNECTION_REQUEST_CODE:
                if (resultCode == Activity.RESULT_OK) {
                    mGoogleApiClient.connect();
                }
                break;
        }
    }
}


text:
using System;
using System.IO;
using System.Reflection;
using Microsoft.Build.Utilities;

namespace Cassette.MSBuild
{
    [Serializable]
    public class CreateBundlesCommand : MarshalByRefObject
    {
        public CreateBundlesCommand(string source, string bin, string output, string appVirtualPath, bool includeRawFiles, TaskLoggingHelper taskLoggingHelper)
        {
            this.source = source;
            this.bin = bin;
            this.output = output;
            this.appVirtualPath = appVirtualPath;
            this.includeRawFiles = includeRawFiles;
            this.taskLoggingHelper = taskLoggingHelper;
        }

        readonly string source;
        readonly string bin;
        readonly string output;
        readonly string appVirtualPath;
        readonly bool includeRawFiles;
        readonly TaskLoggingHelper taskLoggingHelper;

        public void Execute()
        {
            using (var host = new MSBuildHost(source, bin, output, appVirtualPath, includeRawFiles, taskLoggingHelper))
            {
                host.Initialize();
                host.Execute();
            }
        }

        public static void ExecuteInSeparateAppDomain(CreateBundlesCommand command)
        {
            var setup = CreateAppDomainSetup(command);
            var appDomain = AppDomain.CreateDomain("Cassette-MSBuild-AppDomain", null, setup);

            try
            {
                var commandInAppDomain = CreateCommandInAppDomain(command, appDomain);
                commandInAppDomain.Execute();
            }
            finally
            {
                AppDomain.Unload(appDomain);
            }
        }

        static AppDomainSetup CreateAppDomainSetup(CreateBundlesCommand command)
        {
            var setup = new AppDomainSetup
            {
                ApplicationBase = command.bin,
                ShadowCopyFiles = "true"
            };

            AssignConfigurationFile(command, setup);
            return setup;
        }

        static void AssignConfigurationFile(CreateBundlesCommand command, AppDomainSetup setup)
        {
            var configFilename = Path.Combine(command.source, "web.config");
            if (File.Exists(configFilename))
            {
                setup.ConfigurationFile = configFilename;
            }
        }

        static Assembly OnCurrentDomainAssemblyResolve(object sender, ResolveEventArgs args)
        {
            try
            {
                Assembly assembly = Assembly.Load(args.Name);
                if (assembly != null)
                    return assembly;
            }
            catch
            {
                // ignore load error
            }

            // *** Try to load by filename - split out the filename of the full assembly name
            // *** and append the base path of the original assembly (ie. look in the same dir)
            // *** NOTE: this doesn't account for special search paths but then that never
            //           worked before either.
            string[] Parts = args.Name.Split(',');
            string File = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\" + Parts[0].Trim() + ".dll";
            return System.Reflection.Assembly.LoadFrom(File);
        }

        static CreateBundlesCommand CreateCommandInAppDomain(CreateBundlesCommand command, AppDomain appDomain)
        {
            var assemblyLocation = typeof(CreateBundlesCommand).Assembly.Location;
            var typeString = typeof(CreateBundlesCommand).FullName;

            // This is like calling
            //   new CreateBundlesCommand(command.source, command.bin, command.output, command.logInformation, command.logError);
            // but the object lives in the other AppDomain.

            var constructorArguments = new object[] { command.source, command.bin, command.output, command.appVirtualPath, command.includeRawFiles, command.taskLoggingHelper };

#if NET35
            var objectHandle = Activator.CreateInstanceFrom(
                appDomain,
                assemblyLocation,
                typeString,
                false,
                0,
                null,
                constructorArguments,
                null,
                null,
                null
            );
#else
            var objectHandle = Activator.CreateInstanceFrom(
                appDomain,
                assemblyLocation,
                typeString,
                false,
                0,
                null,
                constructorArguments,
                null,
                null
            );
#endif
            var unwrappedObject = objectHandle.Unwrap();

            AppDomain.CurrentDomain.AssemblyResolve += OnCurrentDomainAssemblyResolve;
            var typedObject = (CreateBundlesCommand)unwrappedObject;
            AppDomain.CurrentDomain.AssemblyResolve -= OnCurrentDomainAssemblyResolve;

            return typedObject;
        }

    }

}


text:
package molt
package syntax
package agenda

import scala.annotation.tailrec

import scalaz.Heap

import shapeless._
import UnaryTCConstraint._
import LUBConstraint._
import ops.hlist._

import ordered._

case class CFGProduction[ChildSymbols <: HList, ParentSymbol](
  val childSymbols: ChildSymbols,
  val parentSymbol: ParentSymbol)

case class SyncCFGProduction[ChildSymbols <: HList, Children <: HList, Parent](
  val production: CFGProduction[ChildSymbols, ParseSymbol[Parent]],
  val construct: PartialFunction[Children, ScoredStream[Parent]]) (
  implicit val comapped: Comapped.Aux[ChildSymbols, ParseSymbol, Children]) {
  def childSymbols: ChildSymbols = production.childSymbols
  def parentSymbol: ParseSymbol[Parent] = production.parentSymbol
}

case class SyncCFG[AllProductions <: HList : <<:[SyncCFGProduction[_, _, _]]#λ](productions: AllProductions)

object SyncCFGProductionSyntax {
  import syntax.std.tuple._
  import scala.language.implicitConversions

  case class CFGProductionHelper[ChildSymbols <: HList, Children <: HList, Parent](
    val children: ChildSymbols,
    val parent: ParseSymbol[Parent])(
    implicit val comapped: Comapped.Aux[ChildSymbols, ParseSymbol, Children]) {
    def using(construct: PartialFunction[Children, ScoredStream[Parent]]): SyncCFGProduction[ChildSymbols, Children, Parent] =
      SyncCFGProduction(this, construct)
    def usingSingle(construct: PartialFunction[Children, Scored[Parent]]): SyncCFGProduction[ChildSymbols, Children, Parent] =
      SyncCFGProduction(this, construct andThen { case x => ScoredStream.unit(x) })
    def usingSingleZ(construct: PartialFunction[Children, Parent]): SyncCFGProduction[ChildSymbols, Children, Parent] =
      SyncCFGProduction(this, construct andThen { case x => ScoredStream.unit(x) })
  }

  // really only exists for nice syntax
  case class UnaryCFGProductionHelper[Child, Parent](
    val child: ParseSymbol[Child],
    val parent: ParseSymbol[Parent]
  ) {
    def using(construct: PartialFunction[Child, ScoredStream[Parent]]): SyncCFGProduction[ParseSymbol[Child] :: HNil, Child :: HNil, Parent] =
      SyncCFGProduction(this, ({ case child :: HNil => child }: PartialFunction[Child :: HNil, Child]) andThen construct)
    def usingSingle(construct: PartialFunction[Child, Scored[Parent]]): SyncCFGProduction[ParseSymbol[Child] :: HNil, Child :: HNil, Parent] =
      SyncCFGProduction(this, ({ case child :: HNil => child }: PartialFunction[Child :: HNil, Child]) andThen construct andThen ScoredStream.unit[Parent])
    def usingSingleZ(construct: PartialFunction[Child, Parent]): SyncCFGProduction[ParseSymbol[Child] :: HNil, Child :: HNil, Parent] =
      SyncCFGProduction(this, ({ case child :: HNil => child }: PartialFunction[Child :: HNil, Child]) andThen construct andThen ScoredStream.unit[Parent])
  }

  case class NullaryCFGProductionHelper[Parent](
    val parent: ParseSymbol[Parent]
  ) {
    def using(construct: ScoredStream[Parent]): SyncCFGProduction[HNil, HNil, Parent] =
      SyncCFGProduction(CFGProduction(HNil, parent), { case HNil => construct })
    def usingSingle(construct: Scored[Parent]): SyncCFGProduction[HNil, HNil, Parent] =
      SyncCFGProduction(CFGProduction(HNil, parent), { case HNil => ScoredStream.unit(construct) })
    def usingSingleZ(construct: Parent): SyncCFGProduction[HNil, HNil, Parent] =
      SyncCFGProduction(CFGProduction(HNil, parent), { case HNil => ScoredStream.unit(construct) })
  }

  implicit class tuple2Children[
    ChildrenTuple <: Product,
    ChildSymbols <: HList,
    Children <: HList](
    childrenTuple: ChildrenTuple)(
    implicit val gen: Generic.Aux[ChildrenTuple, ChildSymbols],
    comapped: Comapped.Aux[ChildSymbols, ParseSymbol, Children]) {
    def to[Parent](symb: ParseSymbol[Parent]) = CFGProductionHelper[ChildSymbols, Children, Parent](childrenTuple.productElements, symb)
  }

  implicit class symbol2Child[Child](childSymbol: ParseSymbol[Child]) {
    def to[Parent](symb: ParseSymbol[Parent]) = UnaryCFGProductionHelper[Child, Parent](childSymbol, symb)
  }

  implicit class unit2Null(empty: Unit) {
    def to[Parent](symb: ParseSymbol[Parent]) = NullaryCFGProductionHelper[Parent](symb)
  }

  implicit class TerminalInterpolator(val sc: StringContext) extends AnyVal {
    def t(args: Any*) = Terminal(sc.s(args: _*))
  }

  implicit def cfgHelper2Production[ChildSymbols <: HList, Children <: HList, Parent](
    helper: CFGProductionHelper[ChildSymbols, Children, Parent]): CFGProduction[ChildSymbols, ParseSymbol[Parent]] =
    CFGProduction(helper.children, helper.parent)

  implicit def unaryCfgHelper2Production[Child, Parent](
    helper: UnaryCFGProductionHelper[Child, Parent]): CFGProduction[ParseSymbol[Child] :: HNil, ParseSymbol[Parent]] =
    CFGProduction(helper.child :: HNil, helper.parent)

  implicit def nullaryCfgHelper2Production[Parent](
    helper: NullaryCFGProductionHelper[Parent]): CFGProduction[HNil, ParseSymbol[Parent]] =
    CFGProduction(HNil, helper.parent)
}


text:
<?xml version="1.0" encoding="utf-8"?>
<{{packageName}}.ui.misc.AspectRatioImageView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/status_bar"
    android:src="@drawable/drawer_header"
    app:widthRatio="16"
    app:heightRatio="9"
    />


text:
package com.jgoodies.looks.plastic;

import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicFormattedTextFieldUI;
import javax.swing.text.Caret;

/**
 * The JGoodies Plastic L&F implementation of {@code TextFieldUI}.
 * In addition to its superclass MetalTextFieldUI, it can use a caret
 * that selects all text when the field gains focus via the keyboard.
 *
 * @author Karsten Lentzsch
 * @version $Revision: 1.8 $
 */
public final class PlasticFormattedTextFieldUI extends BasicFormattedTextFieldUI {

    /**
     * Creates a UI for a JFormattedTextField.
     *
     * @param c the formatted text field
     * @return the UI
     */
    public static ComponentUI createUI(JComponent c) {
        return new PlasticFormattedTextFieldUI();
    }

    /**
     * Creates the caret for a field.
     *
     * @return the caret
     */
    @Override
    protected Caret createCaret() {
        return new PlasticFieldCaret();
    }

}


text:
#include "db_config.h"

#include "db_int.h"

/* vxworks API to get system clock rate */
int sysClkRateGet (void);

/*
 * __os_yield --
 *	Yield the processor, optionally pausing until running again.
 */
void
__os_yield(env, secs, usecs)
	ENV *env;
	u_long secs, usecs;		/* Seconds and microseconds. */
{
	int ticks_delay, ticks_per_second;

	COMPQUIET(env, NULL);

	/* Don't require the values be normalized. */
	for (; usecs >= US_PER_SEC; usecs -= US_PER_SEC)
		++secs;

	/*
	 * Yield the processor so other processes or threads can run.
	 *
	 * As a side effect, taskDelay() moves the calling task to the end of
	 * the ready queue for tasks of the same priority. In particular, you
	 * can yield the CPU to any other tasks of the same priority by
	 * "delaying" for zero clock ticks.
	 *
	 * Never wait less than a tick, if we were supposed to wait at all.
	 */
	ticks_per_second = sysClkRateGet();
	ticks_delay =
	    secs * ticks_per_second + (usecs * ticks_per_second) / US_PER_SEC;
	if (ticks_delay == 0 && (secs != 0 || usecs != 0))
		ticks_delay = 1;
	(void)taskDelay(ticks_delay);
}


text:
#region License Header

#endregion License Header

using Quantler.Interfaces;
using Quantler.Securities;

namespace Quantler.Tests
{
    /// <summary>
    /// Static props for use during unit tests
    /// </summary>
    internal static class Props
    {
        #region Public Properties

        /// <summary>
        /// Gets the dummy ticker symbol.
        /// </summary>
        public static TickerSymbol TickerSymbol => new TickerSymbol("RDS.EQ", "RDS", CurrencyType.EUR);

        #endregion Public Properties
    }
}


text:
package elasta.core.intfs;

/**
 * Created by someone on 26-Jul-2015.
 */
public interface CallableUnckd<T> {
    public T call() throws Throwable;
}


text: All Notable changes to `Guardian` will be documented in this file


text:
<?php
/******************************************
****AuThor:rubbish.boy@163.com
****Title :单点登录
*******************************************/
namespace App\Http\Middleware;
use Closure;
class SsoMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        return $next($request);
    }
}


text:
#include "base/os.h"
#include <base/logging.h>
#include <io/event_manager.h>
#include <tbb/task.h>
#include <base/task.h>

#include <boost/shared_ptr.hpp>

#include "cfg/cfg_init.h"
#include "oper/operdb_init.h"
#include "controller/controller_init.h"
#include "pkt/pkt_init.h"
#include "services/services_init.h"
#include "vrouter/ksync/ksync_init.h"
#include "oper/agent_route_walker.h"
#include "test_cmn_util.h"
#include "kstate/test/test_kstate_util.h"
#include "vr_types.h"

using namespace std;

void RouterIdDepInit(Agent *agent) {
}

static void ValidateSandeshResponse(Sandesh *sandesh, vector<int> &result) {
    //TBD
    //Validate the response by the expectation
}

struct PortInfo input_1[] = {
    {"vnet1", 1, "1.1.1.10", "00:00:01:01:01:10", 1, 1},
};

struct PortInfo input_2[] = {
    {"vnet2", 2, "2.2.2.20", "00:00:02:02:02:20", 2, 2},
};

struct PortInfo input_3[] = {
    {"vnet3", 3, "3.3.3.30", "00:00:03:03:03:30", 3, 3},
};

IpamInfo ipam_info1[] = {
    {"1.1.1.0", 24, "1.1.1.1"},
};

IpamInfo ipam_info2[] = {
    {"2.2.2.0", 24, "2.2.2.1"},
};

IpamInfo ipam_info3[] = {
    {"3.3.3.0", 24, "3.3.3.1"},
};

class AgentRouteWalkerTest : public AgentRouteWalker {
public:
    AgentRouteWalkerTest(const std::string &name,
                         Agent *agent) :
        AgentRouteWalker(name, agent) {
        route_notifications_ = 0;
        vrf_notifications_ = vrf_notifications_count_ = 0;
        total_rt_vrf_walk_done_ = 0;
        walk_task_context_mismatch_ = false;
        route_table_walk_started_ = false;
        is_vrf_walk_done_ = false;
    };
    ~AgentRouteWalkerTest() {
    }

    virtual bool RouteWalkNotify(DBTablePartBase *partition, DBEntryBase *e) {
        //Fabric VRF
        //0.0.0.0/32; 10.1.1.0/24; 10.1.1.1/32; 10.1.1.254/3; 10.1.1.255/32;
        //169.254.1.3/32; 169.254.2.4/32; 255.255.255.255
        //vrf1
        //1.1.1.10/32; 255.255.255.255; 0:0:1:1:1:10; ff:ff:ff:ff:ff:ff
        //vrf2
        //2.2.2.20/32; 255.255.255.255; 0:0:2:2:2:20; ff:ff:ff:ff:ff:ff
        //inet_mpls table: fabric vrf: 10.1.1.1/32
        route_notifications_++;
        route_table_walk_started_ = true;
        assert(AreAllWalksDone() == false);
        return true;
    }

    virtual void RouteWalkDone(DBTableBase *part) {
        total_rt_vrf_walk_done_++;
        AgentRouteWalker::RouteWalkDone(part);
    }

    virtual bool VrfWalkNotify(DBTablePartBase *partition, DBEntryBase *e) {
        vrf_notifications_++;
        AgentRouteWalker::VrfWalkNotify(partition, e);
        //StartRouteWalk(vrf);
        assert(AreAllWalksDone() == false);
        return true;
    }

    virtual void VrfWalkDone(DBTableBase *part) {
        vrf_notifications_count_++;
        is_vrf_walk_done_ = true;
        AgentRouteWalker::VrfWalkDone(part);
        if (is_vrf_walk_done_ &&
            !route_table_walk_started_ &&
            AreAllWalksDone())
            assert(0);
    }

    void VerifyNotifications(uint32_t route_notifications,
                             uint32_t vrf_notifications,
                             uint32_t vrf_notifications_count,
                             uint32_t total_rt_vrf_walk_done) {
        client->WaitForIdle(10);
        WAIT_FOR(100, 1000, (route_notifications_ == route_notifications_));
        ASSERT_TRUE(route_notifications_ == route_notifications);
        ASSERT_TRUE(vrf_notifications_ == vrf_notifications);
        ASSERT_TRUE(vrf_notifications_count_ == vrf_notifications_count);
        ASSERT_TRUE(total_rt_vrf_walk_done_ == total_rt_vrf_walk_done);
    }

    uint32_t route_notifications_;
    uint32_t vrf_notifications_;
    uint32_t vrf_notifications_count_;
    uint32_t total_rt_vrf_walk_done_;
    bool walk_task_context_mismatch_;
    bool route_table_walk_started_;
    bool is_vrf_walk_done_;
    friend class SetupTask;
    friend class Test;
};

class Test : public ::testing::Test {
public:
    Test() {
        default_tunnel_type_ = TunnelType::MPLS_GRE;
        vrf_name_1_ = "vrf1";
        vrf_name_2_ = "vrf2";
        vrf_name_3_ = "vrf3";
        server_ip_ = Ip4Address::from_string("10.1.1.11");
        local_vm_ip_1_ = Ip4Address::from_string("1.1.1.10");
        local_vm_ip_2_ = Ip4Address::from_string("2.2.2.20");
        remote_vm_ip_ = Ip4Address::from_string("1.1.1.11");
        walker_ = new AgentRouteWalkerTest("AgentRouteWalkerTest",
                                           Agent::GetInstance());
        agent_ = Agent::GetInstance();
        agent_->oper_db()->agent_route_walk_manager()->
            RegisterWalker(static_cast<AgentRouteWalker *>(walker_.get()));
    };
    ~Test() {
    }

    void SetupEnvironment(int num_vrfs) {
        client->Reset();
        if (num_vrfs == 0)
            return;

        if (num_vrfs > 0) {
            VrfAddReq(vrf_name_1_.c_str());
        }
        if (num_vrfs > 1) {
            VrfAddReq(vrf_name_2_.c_str());
        }
        if (num_vrfs > 2) {
            VrfAddReq(vrf_name_3_.c_str());
        }
        VmInterfaceKey vhost_intf_key(AgentKey::ADD_DEL_CHANGE,
                boost::uuids::nil_uuid(),
                Agent::GetInstance()->vhost_interface()->name());
        Agent::GetInstance()->fabric_inet4_unicast_table()->AddResolveRoute(
                Agent::GetInstance()->local_peer(),
                Agent::GetInstance()->fabric_vrf_name(), server_ip_, 24,
                vhost_intf_key, 0, false, "", SecurityGroupList(),
                TagList());
        client->WaitForIdle();
        client->WaitForIdle();
        if (num_vrfs > 0) {
            CreateVmportEnv(input_1, 1);
        }
        if (num_vrfs > 1) {
            CreateVmportEnv(input_2, 1);
        }
        if (num_vrfs > 2) {
            CreateVmportEnv(input_3, 1);
        }
        client->WaitForIdle();
        client->Reset();
    }

    void DeleteEnvironment(int num_vrfs) {
        client->Reset();
        if (num_vrfs == 0)
            return;

        if (num_vrfs > 0) {
            DeleteVmportEnv(input_1, 1, true);
        }
        if (num_vrfs > 1) {
            DeleteVmportEnv(input_2, 1, true);
        }
        if (num_vrfs > 2) {
            DeleteVmportEnv(input_3, 1, true);
        }
        client->WaitForIdle();
        if (num_vrfs > 0) {
            VrfDelReq(vrf_name_1_.c_str());
            client->WaitForIdle();
            WAIT_FOR(100, 100, (VrfFind(vrf_name_1_.c_str()) != true));
        }
        if (num_vrfs > 1) {
            VrfDelReq(vrf_name_2_.c_str());
            client->WaitForIdle();
            WAIT_FOR(100, 100, (VrfFind(vrf_name_2_.c_str()) != true));
        }
        if (num_vrfs > 2) {
            VrfDelReq(vrf_name_3_.c_str());
            client->WaitForIdle();
            WAIT_FOR(100, 100, (VrfFind(vrf_name_3_.c_str()) != true));
        }
        client->WaitForIdle();
    }

    virtual void SetUp() {
        client->Reset();
        VxLanNetworkIdentifierMode(false);
        client->WaitForIdle();
        AddEncapList("MPLSoGRE", "MPLSoUDP", "VXLAN");
        client->WaitForIdle();
        AddIPAM("vn1", ipam_info1, 1);
        client->WaitForIdle();
        AddIPAM("vn2", ipam_info2, 1);
        client->WaitForIdle();
        AddIPAM("vn3", ipam_info3, 1);
        client->WaitForIdle();
    }

    virtual void TearDown() {
        client->Reset();
        DelEncapList();
        client->WaitForIdle();
        DelIPAM("vn1");
        client->WaitForIdle();
        DelIPAM("vn2");
        client->WaitForIdle();
        DelIPAM("vn3");
        client->WaitForIdle();
        if (walker_.get()) {
            agent_->oper_db()->agent_route_walk_manager()->
                ReleaseWalker(walker());
            walker_.reset(NULL);
        }
        client->WaitForIdle();

    }
    AgentRouteWalkerTest *walker() {
        return static_cast<AgentRouteWalkerTest *>(walker_.get());
    }

    void VerifyNotifications(uint32_t route_notifications,
                             uint32_t vrf_notifications,
                             uint32_t vrf_notifications_count,
                             uint32_t total_rt_vrf_walk_done) {
        walker()->VerifyNotifications(route_notifications,
                                      vrf_notifications,
                                      vrf_notifications_count,
                                      total_rt_vrf_walk_done);
    }

    TunnelType::Type default_tunnel_type_;
    std::string vrf_name_1_;
    std::string vrf_name_2_;
    std::string vrf_name_3_;
    Ip4Address  local_vm_ip_1_;
    Ip4Address  local_vm_ip_2_;
    Ip4Address  remote_vm_ip_;
    Ip4Address  server_ip_;
    AgentRouteWalkerPtr walker_;
    Agent *agent_;
    static TunnelType::Type type_;
    friend class SetupTask;
};

class SetupTask : public Task {
    public:
        SetupTask(Test *test, std::string name) :
            Task((TaskScheduler::GetInstance()->
                  GetTaskId("db::DBTable")), 0), test_(test),
            test_name_(name) {
        }

        static void AllWalkDone(AgentRouteWalkerTest *test_walker) {
            if (test_walker->is_vrf_walk_done_ && !test_walker->route_table_walk_started_)
                assert(0);
        }

        virtual bool Run() {
            if (test_name_ == "restart_walk_with_2_vrf") {
                test_->walker()->StartVrfWalk();
                test_->walker()->StartVrfWalk();
            } else if (test_name_ == "vrf_walk_with_2_vrf") {
                test_->walker()->StartVrfWalk();
            } else if (test_name_ == "vrf_state_deleted") {
                test_->walker()->WalkDoneCallback(boost::bind(&SetupTask::AllWalkDone,
                                                    test_->walker()));
                test_->walker()->StartVrfWalk();
            } else if (test_name_ ==
                       "walk_on_deleted_vrf_with_deleted_route_table") {
                test_->walker()->StartVrfWalk();
            } else if (test_name_ == "ReleaseWalker") {
                test_->agent_->oper_db()->agent_route_walk_manager()->
                    ReleaseWalker(test_->walker_.get());
                test_->walker()->StartRouteWalk(VrfGet("vrf1"));
                test_->walker_ = NULL;
            }

            return true;
        }
    std::string Description() const { return "SetupTask"; }
    private:
        Test *test_;
        std::string test_name_;
};

TEST_F(Test, walk_all_routes_wih_no_vrf) {
    client->Reset();
    SetupEnvironment(0);
    walker()->StartVrfWalk();
    VerifyNotifications(15, 2, 1, (Agent::ROUTE_TABLE_MAX - 1) * 2);
    EXPECT_TRUE(walker()->walk_task_context_mismatch_ == false);
    walker()->walk_task_context_mismatch_ = true;
    DeleteEnvironment(0);
}

TEST_F(Test, walk_all_routes_wih_1_vrf) {
    client->Reset();
    SetupEnvironment(1);
    walker()->StartVrfWalk();
    VerifyNotifications(30, 3, 1, ((Agent::ROUTE_TABLE_MAX - 1) * 3));
    EXPECT_TRUE(walker()->walk_task_context_mismatch_ == false);
    walker()->walk_task_context_mismatch_ = true;
    DeleteEnvironment(1);
}

TEST_F(Test, walk_all_routes_with_2_vrf) {
    client->Reset();
    SetupEnvironment(2);
    walker()->StartVrfWalk();
    VerifyNotifications(45, 4, 1, ((Agent::ROUTE_TABLE_MAX - 1) * 4));
    EXPECT_TRUE(walker()->walk_task_context_mismatch_ == false);
    walker()->walk_task_context_mismatch_ = true;
    DeleteEnvironment(2);
}

TEST_F(Test, walk_all_routes_with_3_vrf) {
    client->Reset();
    SetupEnvironment(3);
    walker()->StartVrfWalk();
    VerifyNotifications(60, 5, 1, ((Agent::ROUTE_TABLE_MAX - 1) * 5));
    EXPECT_TRUE(walker()->walk_task_context_mismatch_ == false);
    walker()->walk_task_context_mismatch_ = true;
    DeleteEnvironment(3);
}

TEST_F(Test, restart_walk_with_2_vrf) {
    client->Reset();
    SetupEnvironment(2);
    SetupTask * task = new SetupTask(this, "restart_walk_with_2_vrf");
    TaskScheduler::GetInstance()->Enqueue(task);
    WAIT_FOR(1000, 1000, walker()->IsWalkCompleted() == true);
    EXPECT_TRUE(walker()->walk_task_context_mismatch_ == false);
    walker()->walk_task_context_mismatch_ = true;
    DeleteEnvironment(2);
}

TEST_F(Test, vrf_walk_with_2_vrf) {
    client->Reset();
    SetupEnvironment(2);
    SetupTask * task = new SetupTask(this, "vrf_walk_with_2_vrf");
    TaskScheduler::GetInstance()->Enqueue(task);
    WAIT_FOR(1000, 1000, walker()->IsWalkCompleted() == true);
    //TODO validate
    EXPECT_TRUE(walker()->walk_task_context_mismatch_ == false);
    walker()->walk_task_context_mismatch_ = true;
    DeleteEnvironment(2);
}

TEST_F(Test, test_setup_teardown) {
}

TEST_F(Test, vrf_state_deleted) {
    client->Reset();
    SetupEnvironment(1);
    SetupTask * task = new SetupTask(this, "vrf_state_deleted");
    TaskScheduler::GetInstance()->Enqueue(task);
    WAIT_FOR(1000, 1000, walker()->IsWalkCompleted() == true);
    DeleteEnvironment(1);
}

TEST_F(Test, walk_on_deleted_vrf_with_deleted_route_table) {
    client->Reset();
    SetupEnvironment(1);
    SetupTask * task = new SetupTask(this,
                                     "walk_on_deleted_vrf_with_deleted_route_table");
    VrfEntryRef vrf = VrfGet("vrf1");
    EXPECT_TRUE(vrf != NULL);
    DeleteEnvironment(1);
    EXPECT_TRUE(vrf->IsDeleted());
    Agent::GetInstance()->vrf_table()->OnZeroRefcount(vrf.get());
    TaskScheduler::GetInstance()->Enqueue(task);
    WAIT_FOR(1000, 1000, walker()->IsWalkCompleted() == true);
    SetupEnvironment(1);
    vrf = NULL;
    DeleteEnvironment(1);
}

TEST_F(Test, RouteWalkOnDeletedWalker) {
    client->Reset();
    SetupEnvironment(1);
    SetupTask * task = new SetupTask(this, "ReleaseWalker");
    TaskScheduler::GetInstance()->Enqueue(task);
    WAIT_FOR(1000, 1000, walker()->IsWalkCompleted() == true);
    DeleteEnvironment(1);
}

//TODO REMAINING TESTS
// - based on walktype - unicast/multicast/all
//
int main(int argc, char **argv) {
    GETUSERARGS();

    client = TestInit(init_file, ksync_init);
    int ret = RUN_ALL_TESTS();
    client->WaitForIdle();
    TestShutdown();
    delete client;
    return ret;
}


text:
/**
 * 主内容组件
 * @author  WhyCoder
 * @date    2017-02-06
 */
define(function (require, exports) {
    'use strict';

    var mainRender = require('text!../template/main.tpl');
    // 子组件
    // 首页
    var teacherList = require('./home/teacherList'),
        teacherDetail = require('./home/teacherDetail'),
    // 档案管理
        insert = require('./info/insert'),
        update = require('./info/update'),
        infoList = require('./info/infoList'),
    // 课程管理
        courseClass = require('./course/class'),
        insertClass = require('./course/insert'),
        allClass = require('./course/allClass'),
        courseDemand = require('./course/demand'),
        courseExamine = require('./course/examine'),
    // 工作量管理
    // 培训管理
        trainDemand = require('./train/demand'),
        trainApply = require('./train/apply'),
        trainFeedback = require('./train/feedback'),
        trainMyFeedback = require('./train/myFeedback'),
        trainExamineApply = require('./train/examineApply'),
        trainExamineFeedback = require('./train/examineFeedback'),
    // 考核管理
        assessInsert = require('./assess/insert'),
        assessCount = require('./assess/count'),
        assessCheck = require('./assess/check'),
    // 用户管理
        user = require('./user/user');

    var main = {
        template: mainRender,
        components: {
            list: teacherList,
            detail: teacherDetail,

            insert: insert,
            update: update,
            infoList: infoList,

            class: courseClass,
            insertClass: insertClass,
            allClass: allClass,
            courseDemand: courseDemand,
            courseExamine: courseExamine,

            trainDemand: trainDemand,
            trainApply: trainApply,
            trainFeedback: trainFeedback,
            trainMyFeedback: trainMyFeedback,
            trainExamineApply: trainExamineApply,
            trainExamineFeedback: trainExamineFeedback,

            assessInsert: assessInsert,
            assessCount: assessCount,
            assessCheck: assessCheck,

            user: user
        }
    }

    return main;
});


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<title></title>

Utilities / Statistics for primers/adaptors

Description

Prints the number of tag sequences matching for different numbers of mismatches.

Parameters

Input type (FASTQ, FASTA) [FASTQ]

Tag sequence at 3'-end (String) [-]

Tag sequence at 5'-end (String) [-]

Details

Prints the number of tag (i.e. primer/adapter) sequences matching for different numbers of mismatches.

Input can be a FASTQ file or a FASTA file.

No trimming will be performed.

Output

The output is a tab-delimited text file.

References

This tool uses the TagCleaner package. Please cite the article:

Schmieder R, Lim YW, Rohwer F, Edwards R, 2010. TagCleaner: Identification and removal of tag sequences from genomic and metagenomic datasets. BMC Bioinformatics. 2010, 11:341.

Please see the TagCleaner homepage for more details.


text:
from __future__ import absolute_import

from core import collect

def main():
    collect.collect("splash")


text:
<html>
<head>
	<script type="text/javascript" src="akihabara/gbox.js"></script>
	<script type="text/javascript" src="akihabara/iphopad.js"></script>
	<script type="text/javascript" src="akihabara/trigo.js"></script>
	<script type="text/javascript" src="akihabara/toys.js"></script>
	<script type="text/javascript" src="akihabara/help.js"></script>
	<script type="text/javascript" src="akihabara/tool.js"></script>
	<script type="text/javascript" src="akihabara/gamecycle.js"></script>
	<style>BODY { -webkit-user-select:none; margin:0px}</style>
	<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
</head>
<body>
</body>
<script>
// ---
// Copyright (c) 2010 Francesco Cottone, http://www.kesiev.com/
// ---

		  // Game-specific

		  var maingame;
		  var scroller;
		  var audioserver;
		  var dialogues={};
		  var faces={};
		  var stages={};
		  var enemies={};

		  function defaultSpark(th) { // this is a little hack: this function can be used for default bullet sparks, for smaller and smarter code
		  	toys.generate.sparks.simple(th,"sparks",null,{animspeed:2,tileset:"spark"});
		  }

		  function go() {
		 	gbox.setGroups(["background","player","playerbullets","foes","foesbullets","sparks","foreground","gamecycle"]);
			gbox.setAudioChannels({bgmusic:{volume:0.8},sfx:{volume:1.0}});

		 	maingame=gamecycle.createMaingame("gamecycle","gamecycle");

		  // No level intro animation
		  maingame.gameIntroAnimation=function() { return true; }

		   // Title intro
		  maingame.gameTitleIntroAnimation=function(reset) {
			  	if (reset) {
			  		gbox.playAudio("default-music");
			  		toys.resetToy(this,"crosser");
			  		toys.resetToy(this,"flash");
			  		gbox.playGroup("foreground");
			  		scroller=toys.shmup.generateScroller("foreground","roller",help.cloneObject(stages.attractscroller.scroller));
			  		scroller.setSpeed(2);
			  		scroller.setLoop(0,2560);
		  		} else {
		  			if (toys.getToyStatus(this,"crosser"))
		  				toys.fullscreen.fadein(this,"flash",gbox.getBufferContext(),{fadespeed:0.05,color:gbox.COLOR_WHITE});
		  			else
		  				gbox.blitFade(gbox.getBufferContext(),{alpha:1});

		  			toys.logos.crossed(this,"crosser",{image:"logo",x:gbox.getScreenHW()-gbox.getImage("logo").hwidth,y:20,speed:2,gapx:250,alpha:0.5,audioreach:"megaexplosion"});
		  		}
		  	},

		  // Change level
		  maingame.changeLevel=function(level) {
		  	if (level==null) level="stage1";
			stages.currentstage=level;
		 	// Cleanup the level.
		  	gbox.trashGroup("foes");
		  	gbox.trashGroup("background");
		  	gbox.trashGroup("playerbullets");
		  	gbox.trashGroup("foes");
		  	gbox.trashGroup("foesbullets");
		  	gbox.trashGroup("sparks");
		  	gbox.trashGroup("foreground");
		  	gbox.purgeGarbage(); // Since we're starting, we can purge all now

			// This object handles the script of each level. First prepares the scroller and then does the game actions.
			gbox.addObject({
				id:"stagehandler",
				group:"foreground",
				initialize:function() {
					// Since the scroller object changes itself, let's change a cloned histance instead of the original current stage.
					scroller=toys.shmup.generateScroller("background","roller",help.cloneObject(stages[stages.currentstage].scroller));
				},
				first:function() {
					stages[stages.currentstage].script(this,scroller.y,scroller.looprounds);
					scroller.setX(gbox.getObject("player","player").x*0.5); // *0.5 for parallax
				}
			});
			toys.shmup.spawn(gbox.getObject("player","player"),{x:150,y:200,weapon:0});
			gbox.playAudio(stages[stages.currentstage].music);
			this.newLife();
		  }

		  // Custom level handler. We will call this for passing from a stage to another. For
		  // flexibility, we will check if the destination stage exists. If yes, the stage is
		  // changed else the game ends. In your games you can just call the changeLevel, if you're
		  // sure that the stage exists.
		  maingame.myChangeLevel=function(dest) {
		  	if (stages[dest]) // If the stage exists...
		  		maingame.gotoLevel(dest); // Let's go there...
		  	else // else... :)
				maingame.gameIsCompleted(); // The game is completed
		  }

		    // New life
		  maingame.newLife=function(up) {
			toys.shmup.spawn(gbox.getObject("player","player"),{health:3,invul:50,weapon:0});
		  }

			// End level animation
		   maingame.endlevelIntroAnimation=function(reset) { return true }

		  // Game ending
		  maingame.gameEndingIntroAnimation=function(reset){
		  	if (reset) {
		  		toys.resetToy(this,"intro-animation");
		  	} else {
		  		gbox.blitFade(gbox.getBufferContext(),{alpha:1});
		  		return toys.dialogue.render(this,"intro-animation",dialogues.titles);
		  	}
		  }

		  // Game initialization

		  maingame.initializeGame=function() {
		 	// Build hud
		 	maingame.hud.setWidget("label",{widget:"label",font:"small",value:"1UP",dx:10,dy:10,clear:true});
		 	maingame.hud.setWidget("score",{widget:"label",font:"small",value:0,dx:30,dy:25,prepad:10,padwith:" ",clear:true});
		 	maingame.hud.setWidget("lives",{widget:"symbols",tiles:[0],minvalue:0,value:3-maingame.difficulty,maxshown:3,tileset:"symbols",dx:10,dy:gbox.getScreenH()-23,gapx:16,gapy:0});

			// Add player
			 gbox.addObject({
		  	id:"player",
		  	group:"player",
		  	tileset:"player",
		  	weapon:0, // current weapon
		  	invul:0, // Invulnerability timer
		  	respawntimer:0, // respawn timer

		  	powerUp:function() {
		  		if (this.weapon<2) {
		  			this.weapon++;
		  			toys.generate.sparks.popupText(this,"sparks",null,{font:"bigred",jump:6,text:"POWER LV."+(this.weapon+1),keep:10});
		  		}
		  	},

		  	makeInvulnerable:function(t) {
		  		this.invul=t;
		  	},

		  	fireBullet:function() {
		  		gbox.hitAudio("laser");
		  		if (this.weapon==0) { // single shot
		  			toys.shmup.fireBullet("playerbullets",null,{collidegroup:"foes",from:this,upper:true,tileset:"bulletbig",spark:function(th){defaultSpark(th)},frames:{speed:1,frames:[0]},accx:0,accy:-8});
		  		} else if (this.weapon==1) { // double shot
		  			toys.shmup.fireBullet("playerbullets",null,{collidegroup:"foes",from:this,upper:true,tileset:"bulletbig",spark:function(th){defaultSpark(th)},frames:{speed:1,frames:[0]},accx:0,accy:-8,gapx:-8});
		  			toys.shmup.fireBullet("playerbullets",null,{collidegroup:"foes",from:this,upper:true,tileset:"bulletbig",spark:function(th){defaultSpark(th)},frames:{speed:1,frames:[0]},accx:0,accy:-8,gapx:8});
		  		} else if (this.weapon==2) { // wide shot
		  			toys.shmup.fireBullet("playerbullets",null,{collidegroup:"foes",from:this,upper:true,tileset:"bulletbig",spark:function(th){defaultSpark(th)},frames:{speed:1,frames:[0]},accx:0,accy:-10});
		  			toys.shmup.fireBullet("playerbullets",null,{collidegroup:"foes",from:this,upper:true,tileset:"bulletbig",spark:function(th){defaultSpark(th)},frames:{speed:1,frames:[0]},acc:8,angle:4.9});
		  			toys.shmup.fireBullet("playerbullets",null,{collidegroup:"foes",from:this,upper:true,tileset:"bulletbig",spark:function(th){defaultSpark(th)},frames:{speed:1,frames:[0]},acc:8,angle:4.7});
				 }

		  	},

			initialize:function() {
				toys.shmup.initialize(this,{
					bounds:{x:0,y:50,w:gbox.getScreenW(),h:gbox.getScreenH()-50},
					frames:{
						still:{ speed:2, frames:[0,1,2] },
						hit:{speed:1,frames:[0,3]}
					}
				});
			},

			collisionEnabled:function() {
				return !maingame.gameIsHold()&&!this.killed&&!this.invul;
			},

			kill:function(by){
				gbox.hitAudio("megaexplosion");
	  			toys.generate.sparks.simple(this,"sparks",null,{animspeed:2,tileset:"explosion",accx:-2,accy:-2});
	  			toys.generate.sparks.simple(this,"sparks",null,{animspeed:2,tileset:"explosion",accx:2,accy:-2});
	  			toys.generate.sparks.simple(this,"sparks",null,{animspeed:2,tileset:"explosion",accx:-2,accy:2});
	  			toys.generate.sparks.simple(this,"sparks",null,{animspeed:2,tileset:"explosion",accx:2,accy:2});
	  			this.killed=true;
	  			this.respawntimer=20;
		  	},

		  	hitByBullet:function(by) { // ignore bullets if the ship is untouchable
		  		if (this.collisionEnabled()) {
		  			toys.shmup.hitByBullet(this,by);
		  			this.makeInvulnerable(10);
		  		} else return true;
		  	},

		  	first:function() {

		  		// Counter
		  		this.counter=(this.counter+1)%10;
				if (!this.killed) {
					toys.shmup.applyForces(this); // Apply forces
					toys.shmup.controlKeys(this,{left:"left",right:"right",up:"up",down:"down"}); // Moves
					toys.shmup.handleAccellerations(this);
					toys.shmup.keepInBounds(this); // Keep the ship in his bounds
					toys.shmup.setFrame(this); // set the right animation frame
					if (this.invul) this.invul--; // the invulnerability counter
					if (gbox.keyIsHit("a"))
						this.fireBullet();
				} else {
					if (this.respawntimer) this.respawntimer--; else if (maingame.hud.getValue("lives","value")>0) {
						maingame.hud.addValue("lives","value",-1);
						if (maingame.hud.getValue("lives","value")==0) {
							scroller.panToSpeed(0,5); // slow down the roller
							maingame.playerDied({wait:10}); // trigger gameover
						}
						else maingame.newLife(); // respawn
					}
				}

		  	},
		  	blit:function() {
		  		if (!this.killed) // show is not killed and invul is pair (so it blinks during invulnerability)
		  			gbox.blitTile(gbox.getBufferContext(),{tileset:this.tileset,tile:this.frame,dx:this.x,dy:this.y,camera:this.camera,fliph:this.fliph,flipv:this.flipv,alpha:((this.invul%2)==0?1:0.5)});
		  	}

		  });

		}

		  gbox.go();

	}

	// BOOTSTRAP
	window.addEventListener('load', function () {
		/*
		tool.makecels({
			rows:[
				[
					{img:"_bin/ship_1.png"},
					{img:"_bin/ship_1_1.png"},
					{img:"_bin/ship_1_2.png"},

					{img:"_bin/ship_1.png",filter:{color:{r:255,g:255,b:255,a:255}}}
				],
				[
					{img:"_bin/bullet_long1.png"},
					{img:"_bin/bullet_long2.png"}
				],
				[
					{img:"_bin/spark_1.png"},
					{img:"_bin/spark_2.png"},
					{img:"_bin/spark_3.png"}
				],
				[
					{img:"_bin/explosion 1.png"},
					{img:"_bin/explosion 2.png"},
					{img:"_bin/explosion 3.png"},
					{img:"_bin/explosion 4.png"},
					{img:"_bin/explosion 5.png"},
					{img:"_bin/explosion 6.png"}
				],
				[
					{img:"_bin/bullet_small_1.png"},
					{img:"_bin/bullet_small_2.png"}
				],
				[
					{img:"_bin/enemy_1_1.png"},
					{img:"_bin/enemy_1_2.png"},
					{img:"_bin/enemy_1_1.png",filter:{color:{r:255,g:255,b:255,a:255}}}
				],
				[
					{img:"_bin/enemy_2_1.png"},
					{img:"_bin/enemy_2_2.png"},
					{img:"_bin/enemy_2_3.png"},
					{img:"_bin/enemy_2_1.png",filter:{color:{r:255,g:255,b:255,a:255}}}
				],
				[
					{img:"_bin/boss_1.png"},
					{img:"_bin/boss_1.png",filter:{color:{r:255,g:255,b:255,a:255}}}
				],
				[
					{img:"_bin/powerup_1.png"},
					{img:"_bin/powerup_2.png"}
				],
				[
					{img:"_bin/ship_1_1_mini.png"}
				],
				[
					{img:"_bin/solitude-commander_1_1.png"},
					{img:"_bin/solitude-commander_1_2.png"},
					{img:"_bin/solitude-commander_2_1.png"},
					{img:"_bin/solitude-commander_2_2.png"},
					{img:"_bin/solitude-commander_3_1.png"},
					{img:"_bin/solitude-girl_1_1.png"},
					{img:"_bin/solitude-girl_1_2.png"},
				],
				[
					{img:"_bin/solitude-girl_2_1.png"},
					{img:"_bin/solitude-girl_2_2.png"},
					{img:"_bin/solitude-evil.png"},
				]

			]
		});
	return;*/

		help.akihabaraInit({title:"Solitude",splash:{footnotes:["Musics by: AndyExpandy, Rich Vreeland, NE7.","Full credits on ending title."]}});

		audioserver="resources/audio/";
		gbox.addBundle({file:"resources/solitude/bundle.js"}); // Audio, sprites, fonts etc. are loaded here now. Cleaner code! Btw you can still load resources from the code, like in Capman.
		// Have a look to the resource file. Solitude implements some sort of "resource unpacking" before using them.

		gbox.loadAll(go);
	}, false);

	</script>
</html>


text:
<!DOCTYPE html>
<meta charset="utf-8" />
<title>CSS Pseudo-Elements Test: Custom Highlights currentcolor, initial, inherit, unset painting</title>
<meta name="assert" content="Checks the painting for highlight pseudos (using ::highlight), when 'color' is explicitly defaulted in a universal rule. 'inherit' (and 'unset', due to highlight inheritance) should equal the originating element 'color', because 'color' inherits through ancestor highlight pseudos up to the root, where the inherited value is defined as 'currentColor' for highlights. 'initial' should equal the initial value of 'color', which is 'CanvasText'.">
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-pseudo/#highlight-text">
<link rel="match" href="highlight-currentcolor-root-explicit-default-001-ref.html">
<link rel="stylesheet" href="support/highlights.css">

example - empty

example - color-currentcolor

example - color-initial

example - color-inherit

example - color-unset

example - color-cyan

example - backgroundcolor-currentcolor

example - color-currentcolor-backgroundcolor-currentcolor

example - color-initial-backgroundcolor-currentcolor

example - color-inherit-backgroundcolor-currentcolor

example - color-inset-backgroundcolor-currentcolor

example - color-cyan-backgroundcolor-currentcolor

example - backgroundcolor-blue

example - color-currentcolor-backgroundcolor-blue

example - color-initial-backgroundcolor-blue

example - color-inherit-backgroundcolor-blue

example - color-inset-backgroundcolor-blue


text:
"""Get credentials from file or environment variables"""

from functools import reduce

def dpath(dict_, path):
    """Dig into dictionary by string path. e.g.

    dpath({'a': {'b': {'c': 'd'}}}, 'a.b') -> {'c': 'd'}
    """
    from operator import getitem
    paths = path.split('.')
    return reduce(
        getitem,
        paths,
        dict_
    )

def credentials(filename=None, root=None):
    """Get credentials from JSON file or environment variables.

    JSON file should have credentials in the form of:
    {
        "username": "myusername",
        "password": "supersecret",
        "api_key": "myapikey"
    }

    If filename not provided, fall back on environment variables:
    - T1_API_USERNAME
    - T1_API_PASSWORD
    - T1_API_KEY

    :param filename: str filename of JSON file containing credentials.
    :param root: str path to get to credentials object. For instance, in object:
        {
            "credentials": {
                "api": {
                    "username": "myusername",
                    "password": "supersecret",
                    "api_key": "myapikey"
                }
            }
        }
        "root" is "credentials.api"
    :return: dict[str]str
    :raise: TypeError: no JSON file or envvars
    """

    if filename is not None:
        import json
        with open(filename, 'rb') as f:
            conf = json.load(f)
        if root is not None:
            conf = dpath(conf, root)
    else:
        import os
        try:
            conf = {
                'username': os.environ['T1_API_USERNAME'],
                'password': os.environ['T1_API_PASSWORD'],
                'api_key': os.environ['T1_API_KEY'],
            }
        except KeyError:
            raise TypeError('Must either supply JSON file of credentials'
                            ' or set environment variables '
                            'T1_API_{USERNAME,PASSWORD,KEY}')

    return conf


text:
<?php

use \Model as Model;
use \Localized as Localized;
use \Config as Config;
use \Logger as Logger;

use \http\Session as Session;
use \http\Cookies as Cookies;
use \http\HttpGet as HttpGet;
use \http\HttpPost as HttpPost;

use \model\user\Users as Users;
use \model\user\UsersDBO as UsersDBO;

/**
 * Class Auth
 * Simply checks if user is logged in. In the app, several controllers use Auth::handleLogin() to
 * check if user if user is logged in, useful to show controllers/methods only to logged-in users.
 */
class Auth
{
	public static function handleLogin()
	{
		// if user is still not logged in, or the user has remember-me-cookie ? then try to login with cookie ("remember me" feature),
		// if not then destroy session, handle user as "not logged in" and redirect user to login page
		if ( Session::get('user_logged_in', false) == false ) {
			if ( Cookies::get('rememberme', false) == false || (Auth::loginWithCookie() == false)) {
				Session::destroy();
				header('location: ' . Config::Web('/login') );
				return false;
			}
		}

		return true;
	}

	public static function handleLoginWithAPI($userHash = '')
	{
		$login_successful = false;
		if ( empty($userHash) == false ) {
			$user = Model::Named('Users')->objectForApi_hash($userHash);
			if ( $user instanceof UsersDBO ) {
				Session::set('user_logged_in', true);
				Session::set('user_id', $user->id);
				Session::set('user_name', $user->name);
				Session::set('user_email', $user->email);
				Session::set('user_account_type', $user->account_type);

				$user->stampLogin();
				$login_successful = true;
			}
		}

		if ( $login_successful === false ) {
			Logger::logError("Error attempting API access '" . $userHash . "'");
			Session::destroy();
			http_response_code(401); // Unauthorized
		}

		return $login_successful;
	}

	public static function requireRole($role = null) {
		if (isset($role) == false  || $role == null) {
			return true;
		}

		if (Session::get('user_logged_in') == true
			&& (Session::get('user_account_type') === Users::AdministratorRole || Session::get('user_account_type') === $role )) {
			return true;
		}

		Logger::logError("User is not authorized", Session::get('user_name'), Session::get('user_id'));
		http_response_code(401); // Not Authorized
		throw new \Exception("Not authorized", 1);
	}

	public static function login()
	{
		$userLogin = HttpPost::getModelValue( 'users', null );
		if ( is_array($userLogin) == false ) {
			Session::addNegativeFeedback(Localized::Get("Auth", "USERNAME_FIELD_EMPTY"));
			return false;
		}

		// we do negative-first checks here
		if (!isset($userLogin['user_name']) OR empty($userLogin['user_name'])) {
			Session::addNegativeFeedback(Localized::Get("Auth", "USERNAME_FIELD_EMPTY"));
			return false;
		}
		if (!isset($userLogin['user_password']) OR empty($userLogin['user_password'])) {
			Session::addNegativeFeedback(Localized::Get("Auth", "PASSWORD_FIELD_EMPTY"));
			return false;
		}

		$user_model = Model::Named("Users");
		$user = $user_model->objectForName($userLogin['user_name']);
		if ( $user == false )
		{
			Session::addNegativeFeedback(Localized::Get("Auth", "LOGIN_FAILED"));
			return false;
		}

		// block login attempt if somebody has already failed 3 times and the last login attempt is less than 30sec ago
//  		echo PHP_EOL . "*** " . var_export(($user->last_failed_login > (time()-30)), true) . PHP_EOL;
		if (($user->failed_logins >= 3) AND ($user->last_failed_login >= (time()-30))) {
			Session::addNegativeFeedback(Localized::Get("Auth", "PASSWORD_WRONG_3_TIMES"));
			return false;
		}

		$VERIFIED_PASSWORD = false;
		if ( PHP_VERSION_ID > 50500 )
		{
			$VERIFIED_PASSWORD = password_verify($userLogin['user_password'], $user->password_hash);
		}
		else if (hash(HASH_DEFAULT_ALGO, $userLogin['user_password']) === $user->password_hash)
		{
			$VERIFIED_PASSWORD = true;
		}

		if ($VERIFIED_PASSWORD == true)
		{
			if ($user->active != 1) {
				Session::addNegativeFeedback(Localized::Get("Auth", "ACCOUNT_NOT_ACTIVE" ));
				return false;
			}

			// login process, write the user data into session
			Session::set('user_logged_in', true);
			Session::set('user_id', $user->id);
			Session::set('user_name', $user->name);
			Session::set('user_email', $user->email);
			Session::set('user_account_type', $user->account_type);

			// generate integer-timestamp for saving of last-login date, also clears the failed login stats
			$user->stampLogin();

			// if user has checked the "remember me" checkbox, then write cookie
			if (isset($userLogin['user_rememberme'])) {

				// generate 64 char random string and update database
				$random_token_string = $user->generateRememberme_token();

				// generate cookie string that consists of user id, random string and combined hash of both
				$cookie_string_first_part = $user->id . ':' . $random_token_string;
				$cookie_string_hash = hash('sha256', $cookie_string_first_part);
				$cookie_string = $cookie_string_first_part . ':' . $cookie_string_hash;

				// set cookie
				Cookies::set( 'rememberme', $cookie_string );
			}

			// return true to make clear the login was successful
			return true;

		} else {
			// increment the failed login counter for that user
			$user->increaseFailedLogin();

			// feedback message
			Session::addNegativeFeedback(Localized::Get("Auth", "PASSWORD_WRONG" ));
			return false;
		}

		// default return
		return false;
	}

	public static function loginWithCookie()
	{
		$user_model = Model::Named("Users");
		$login_successful = false;
		$cookie = Cookies::get('rememberme', false);
		if (empty($cookie) == false)
		{
			// check cookie's contents, check if cookie contents belong together
			list ($user_id, $token, $hash) = explode(':', $cookie);
			if ($hash === hash('sha256', $user_id . ':' . $token) AND (empty($token) == false))
			{
				$user = $user_model->userWithRemembermeToken($user_id, $token);
				if ( $user != false )
				{
					Session::set('user_logged_in', true);
					Session::set('user_id', $user->id);
					Session::set('user_name', $user->name);
					Session::set('user_email', $user->email);
					Session::set('user_account_type', $user->account_type);

					$user->stampLogin();

					$login_successful = true;
				}
			}
		}

		if ($login_successful == false)
		{
			Logger::logError("Cookie invalid", 'cookie', $cookie);

			// delete the invalid cookie to prevent infinite login loops
			Cookies::deleteCookie('rememberme');
		}
		return $login_successful;
	}

	public static function httpAuthenticate($auth_type = 'Basic', $auth_user, $auth_pw)
	{
		// we do negative-first checks here
		if (!isset($auth_user) OR empty($auth_user)) {
			return false;
		}
		if (!isset($auth_pw) OR empty($auth_pw)) {
			return false;
		}

		$user_model = Model::Named("Users");
		$user = $user_model->objectForName($auth_user);
		if ( $user == false ) {
			Logger::logError( "Authentication failed for $auth_type, $auth_user, $auth_pw" );
			return false;
		}

		// block login attempt if somebody has already failed 3 times and the last login attempt is less than 30sec ago
		if (($user->failed_logins() >= 3) AND ($user->last_failed_login() > (time()-30))) {
			return false;
		}

		if ($user->active() != 1) {
			return false;
		}

		$VERIFIED_PASSWORD = false;
		if ( PHP_VERSION_ID > 50500 )
		{
			$VERIFIED_PASSWORD = password_verify($auth_pw, $user->password_hash);
		}
		else if (hash(HASH_DEFAULT_ALGO, $auth_pw) === $user->password_hash)
		{
			$VERIFIED_PASSWORD = true;
		}

		if ($VERIFIED_PASSWORD == true)
		{
			// login process, write the user data into session
			Session::set('user_logged_in', true);
			Session::set('user_id', $user->id);
			Session::set('user_name', $user->name);
			Session::set('user_email', $user->email);
			Session::set('user_account_type', $user->account_type);

			// return true to make clear the login was successful
			return true;

		} else {
			// increment the failed login counter for that user
			$user->increaseFailedLogin();
			Logger::logError( "Authentication failed for $auth_type, $auth_user, $auth_pw" );
			return false;
		}

		// default return
		return false;
	}
}


text:
var View = require('ampersand-view');
var templates = require('../templates');

module.exports = View.extend({
    template: templates.includes.facetseditbasevalue,
    bindings: {
        'model.isTime': {
            type: 'toggle',
            hook: 'base-value-time-panel',
        },
        'model.isNetwork': {
            type: 'toggle',
            hook: 'base-value-bccessor-panel',
        },

        'model.accessor': {
            type: 'value',
            hook: 'base-value-accessor-input',
        },
        'model.bccessor': {
            type: 'value',
            hook: 'base-value-bccessor-input',
        },
        'model.misval_astext': {
            type: 'value',
            hook: 'base-value-missing-input',
        },
        'model.isProperty': {
            type: 'booleanAttribute',
            hook: 'base-value-kind-property',
            name: 'checked',
        },
        'model.isMath': {
            type: 'booleanAttribute',
            hook: 'base-value-kind-math',
            name: 'checked',
        },

        'model.base_value_time_format': {
            type: 'value',
            hook: 'base-value-time-format-input',
        },
        'model.base_value_time_zone': {
            type: 'value',
            hook: 'base-value-time-zone-input',
        },
        'model.isDatetime': {
            type: 'booleanAttribute',
            hook: 'base-value-time-type-datetime-input',
            name: 'checked',
        },
        'model.isDuration': {
            type: 'booleanAttribute',
            hook: 'base-value-time-type-duration-input',
            name: 'checked',
        },
    },
    events: {
        // events for: base-value
        'change [data-hook~=base-value-accessor-input]': function () {
            this.model.accessor = this.queryByHook( 'base-value-accessor-input' ).value;
         },
        'change [data-hook~=base-value-bccessor-input]': function () {
            this.model.bccessor = this.queryByHook( 'base-value-bccessor-input' ).value;
        },
        'change [data-hook~=base-value-missing-input]': function () {
            this.model.misval_astext = this.queryByHook( 'base-value-missing-input' ).value;
        },

        'click [data-hook~=base-value-kind-property]': function () {
            this.model.kind = 'property';
        },
        'click [data-hook~=base-value-kind-math]': function () {
            this.model.kind = 'math';
        },

        // events for: base-value-time
        'change [data-hook~=base-value-time-format-input]': function () {
            this.model.base_value_time_format = this.queryByHook( 'base-value-time-format-input' ).value;
        },
        'change [data-hook~=base-value-time-zone-input]': function () {
            this.model.base_value_time_zone = this.queryByHook( 'base-value-time-zone-input' ).value;
        },

        'click [data-hook~=base-value-time-type-datetime-input]': function () {
            this.model.base_value_time_type = 'datetime';
        },
        'click [data-hook~=base-value-time-type-duration-input]': function () {
            this.model.base_value_time_type = 'duration';
        },
    },
});


text:
<?php

namespace mako\application\services;

use mako\event\Event;

/**
 * Event service.
 *
 * @author Frederic G. Østby
 */
class EventService extends Service
{
	/**
	 * {@inheritdoc}
	 */
	public function register()
	{
		$this->container->registerSingleton([Event::class, 'event'], function($container)
		{
			return new Event($container);
		});
	}
}


text:
<?php

declare(strict_types=1);

namespace PhpSchool\PhpWorkshop\ResultRenderer;

use PhpSchool\PhpWorkshop\Result\FunctionRequirementsFailure;

/**
 * Renderer for `PhpSchool\PhpWorkshop\Result\FunctionRequirementsFailure`.
 */
class FunctionRequirementsFailureRenderer implements ResultRendererInterface
{
    /**
     * @var FunctionRequirementsFailure
     */
    private $result;

    /**
     * @param FunctionRequirementsFailure $result The failure.
     */
    public function __construct(FunctionRequirementsFailure $result)
    {
        $this->result = $result;
    }

    /**
     * Print a list of the missing, required functions & print a list of used but banned functions.
     *
     * @param ResultsRenderer $renderer
     * @return string
     */
    public function render(ResultsRenderer $renderer): string
    {
        $output = '';
        if (count($bannedFunctions = $this->result->getBannedFunctions())) {
            $output .= sprintf(
                "  %s\n%s\n",
                $renderer->style(
                    "Some functions were used which should not be used in this exercise",
                    ['bold', 'underline', 'yellow']
                ),
                implode("\n", array_map(function (array $call) {
                    return sprintf('    %s on line %s', $call['function'], $call['line']);
                }, $bannedFunctions))
            );
        }

        if (count($missingFunctions = $this->result->getMissingFunctions())) {
            $output .= sprintf(
                "  %s\n%s\n",
                $renderer->style(
                    "Some function requirements were missing. You should use the functions",
                    ['bold', 'underline', 'yellow']
                ),
                implode("\n", array_map(function ($function) {
                    return sprintf('    %s', $function);
                }, $missingFunctions))
            );
        }

        return $output;
    }
}


text:
/**
 * Package for tasks of profession.
 * @autor Aleksandr Shigin
 * @version $Id$
 * @since 0.1
 */
package ru.job4j.profession;


text:
#include "VulkanApplication.h"
#include "VulkanDrawable.h"

std::unique_ptr<VulkanApplication> VulkanApplication::instance;
std::once_flag VulkanApplication::onlyOnce;

extern std::vector<const char *> instanceExtensionNames;
extern std::vector<const char *> layerNames;
extern std::vector<const char *> deviceExtensionNames;

// Application constructor responsible for layer enumeration.
VulkanApplication::VulkanApplication()
{
	// At application start up, enumerate instance layers
	instanceObj.layerExtension.getInstanceLayerProperties();

	deviceObj = NULL;
	debugFlag = false;
	rendererObj = NULL;
}

VulkanApplication::~VulkanApplication()
{
	delete rendererObj;
	rendererObj = NULL;
}

// Returns the Single ton object of VulkanApplication
VulkanApplication* VulkanApplication::GetInstance(){
    std::call_once(onlyOnce, [](){instance.reset(new VulkanApplication()); });
    return instance.get();
}

VkResult VulkanApplication::createVulkanInstance( std::vector<const char *>& layers, std::vector<const char *>& extensionNames, const char* applicationName)
{
	return instanceObj.createInstance(layers, extensionNames, applicationName);
}

// This function is responsible for creating the logical device.
// The process of logical device creation requires the following steps:-
// 1. Get the physical device specific layer and corresponding extensions [Optional]
// 2. Create user define VulkanDevice object
// 3. Provide the list of layer and extension that needs to enabled in this physical device
// 4. Get the physical device or GPU properties
// 5. Get the memory properties from the physical device or GPU
// 6. Query the physical device exposed queues and related properties
// 7. Get the handle of graphics queue
// 8. Create the logical device, connect it to the graphics queue.

// High level function for creating device and queues
VkResult VulkanApplication::handShakeWithDevice(VkPhysicalDevice* gpu, std::vector<const char *>& layers, std::vector<const char *>& extensions )
{

	// The user define Vulkan Device object this will manage the
	// Physical and logical device and their queue and properties
	deviceObj = new VulkanDevice(gpu);
	if (!deviceObj){
		return VK_ERROR_OUT_OF_HOST_MEMORY;
	}

	// Print the devices available layer and their extension
	deviceObj->layerExtension.getDeviceExtensionProperties(gpu);

	// Get the physical device or GPU properties
	vkGetPhysicalDeviceProperties(*gpu, &deviceObj->gpuProps);

	// Get the memory properties from the physical device or GPU.
	vkGetPhysicalDeviceMemoryProperties(*gpu, &deviceObj->memoryProperties);

	// Query the availabe queues on the physical device and their properties.
	deviceObj->getPhysicalDeviceQueuesAndProperties();

	// Retrive the queue which support graphics pipeline.
	deviceObj->getGraphicsQueueHandle();

	// Create Logical Device, ensure that this device is connecte to graphics queue
	return deviceObj->createDevice(layers, extensions);
}

VkResult VulkanApplication::enumeratePhysicalDevices(std::vector<VkPhysicalDevice>& gpuList)
{
	uint32_t gpuDeviceCount;

	VkResult result = vkEnumeratePhysicalDevices(instanceObj.instance, &gpuDeviceCount, NULL);
	assert(result == VK_SUCCESS);

	assert(gpuDeviceCount);

	gpuList.resize(gpuDeviceCount);

	result = vkEnumeratePhysicalDevices(instanceObj.instance, &gpuDeviceCount, gpuList.data());
	assert(result == VK_SUCCESS);

	return result;
}

void VulkanApplication::initialize()
{
	char title[] = "Hello World!!!";

	// Check if the supplied layer are support or not
	instanceObj.layerExtension.areLayersSupported(layerNames);

	// Create the Vulkan instance with specified layer and extension names.
	createVulkanInstance(layerNames, instanceExtensionNames, title);

	// Create the debugging report if debugging is enabled
	if (debugFlag) {
		instanceObj.layerExtension.createDebugReportCallback();
	}

	// Get the list of physical devices on the system
	std::vector<VkPhysicalDevice> gpuList;
	enumeratePhysicalDevices(gpuList);

	// This example use only one device which is available first.
	if (gpuList.size() > 0) {
		handShakeWithDevice(&gpuList[0], layerNames, deviceExtensionNames);
	}

	rendererObj = new VulkanRenderer(this, deviceObj);

	rendererObj->initialize();
}

void VulkanApplication::deInitialize()
{
	// Destroy all the pipeline objects
	rendererObj->destroyPipeline();

	// Destroy the associate pipeline cache
	rendererObj->getPipelineObject()->destroyPipelineCache();

	rendererObj->getShader()->destroyShaders();
	rendererObj->destroyFramebuffers();
	rendererObj->destroyRenderpass();
	rendererObj->destroyDrawableVertexBuffer();
	rendererObj->destroyDrawableCommandBuffer();
	rendererObj->destroyDepthBuffer();
	rendererObj->getSwapChain()->destroySwapChain();
	rendererObj->destroyCommandBuffer();
	rendererObj->destroyDrawableSynchronizationObjects();
	rendererObj->destroyCommandPool();
	rendererObj->destroyPresentationWindow();
	deviceObj->destroyDevice();
	if (debugFlag) {
		instanceObj.layerExtension.destroyDebugReportCallback();
	}
	instanceObj.destroyInstance();
}

void VulkanApplication::prepare()
{
	rendererObj->prepare();
}

void VulkanApplication::update()
{
	// Place holder, this will be utilized in the upcoming chapters
}

bool VulkanApplication::render()
{
	return rendererObj->render();
}


text:
cc.Class({
    extends: cc.Component,

    properties: {

      parent: {
        default: null,
        type:cc.Node,
      }
    },

    // use this for initialization
    onLoad: function () {
        var playerScript = this.parent.getComponent("NinjaScript");

    },
     returnToStandardMode: function(){
             cc.log("DO IT!!");
             this.parent.getComponent("NinjaScript").punch = false;
             this.parent.getComponent("NinjaScript").shoot = false;
             this.parent.getComponent("NinjaScript").playAnimation();
        },

    // called every frame, uncomment this function to activate update callback
    // update: function (dt) {

    // },
});