text:
add_custom_command
------------------

Add a custom build rule to the generated build system.

There are two main signatures for add_custom_command The first
signature is for adding a custom command to produce an output.

::

  add_custom_command(OUTPUT output1 [output2 ...]
                     COMMAND command1 [ARGS] [args1...]
                     [COMMAND command2 [ARGS] [args2...] ...]
                     [MAIN_DEPENDENCY depend]
                     [DEPENDS [depends...]]
                     [IMPLICIT_DEPENDS <lang1> depend1
                                      [<lang2> depend2] ...]
                     [WORKING_DIRECTORY dir]
                     [COMMENT comment] [VERBATIM] [APPEND])

This defines a command to generate specified OUTPUT file(s).  A target
created in the same directory (CMakeLists.txt file) that specifies any
output of the custom command as a source file is given a rule to
generate the file using the command at build time.  Do not list the
output in more than one independent target that may build in parallel
or the two instances of the rule may conflict (instead use
add_custom_target to drive the command and make the other targets
depend on that one).  If an output name is a relative path it will be
interpreted relative to the build tree directory corresponding to the
current source directory.  Note that MAIN_DEPENDENCY is completely
optional and is used as a suggestion to visual studio about where to
hang the custom command.  In makefile terms this creates a new target
in the following form:

::

  OUTPUT: MAIN_DEPENDENCY DEPENDS
          COMMAND

If more than one command is specified they will be executed in order.
The optional ARGS argument is for backward compatibility and will be
ignored.

The second signature adds a custom command to a target such as a
library or executable.  This is useful for performing an operation
before or after building the target.  The command becomes part of the
target and will only execute when the target itself is built.  If the
target is already built, the command will not execute.

::

  add_custom_command(TARGET target
                     PRE_BUILD | PRE_LINK | POST_BUILD
                     COMMAND command1 [ARGS] [args1...]
                     [COMMAND command2 [ARGS] [args2...] ...]
                     [WORKING_DIRECTORY dir]
                     [COMMENT comment] [VERBATIM])

This defines a new command that will be associated with building the
specified target.  When the command will happen is determined by which
of the following is specified:

::

  PRE_BUILD - run before all other dependencies
  PRE_LINK - run after other dependencies
  POST_BUILD - run after the target has been built

Note that the PRE_BUILD option is only supported on Visual Studio 7 or
later.  For all other generators PRE_BUILD will be treated as
PRE_LINK.

If WORKING_DIRECTORY is specified the command will be executed in the
directory given.  If it is a relative path it will be interpreted
relative to the build tree directory corresponding to the current
source directory.  If COMMENT is set, the value will be displayed as a
message before the commands are executed at build time.  If APPEND is
specified the COMMAND and DEPENDS option values are appended to the
custom command for the first output specified.  There must have
already been a previous call to this command with the same output.
The COMMENT, WORKING_DIRECTORY, and MAIN_DEPENDENCY options are
currently ignored when APPEND is given, but may be used in the future.

If VERBATIM is given then all arguments to the commands will be
escaped properly for the build tool so that the invoked command
receives each argument unchanged.  Note that one level of escapes is
still used by the CMake language processor before add_custom_command
even sees the arguments.  Use of VERBATIM is recommended as it enables
correct behavior.  When VERBATIM is not given the behavior is platform
specific because there is no protection of tool-specific special
characters.

If the output of the custom command is not actually created as a file
on disk it should be marked as SYMBOLIC with
SET_SOURCE_FILES_PROPERTIES.

The IMPLICIT_DEPENDS option requests scanning of implicit dependencies
of an input file.  The language given specifies the programming
language whose corresponding dependency scanner should be used.
Currently only C and CXX language scanners are supported.  The
language has to be specified for every file in the IMPLICIT_DEPENDS
list.  Dependencies discovered from the scanning are added to those of
the custom command at build time.  Note that the IMPLICIT_DEPENDS
option is currently supported only for Makefile generators and will be
ignored by other generators.

If COMMAND specifies an executable target (created by ADD_EXECUTABLE)
it will automatically be replaced by the location of the executable
created at build time.  Additionally a target-level dependency will be
added so that the executable target will be built before any target
using this custom command.  However this does NOT add a file-level
dependency that would cause the custom command to re-run whenever the
executable is recompiled.

Arguments to COMMAND may use "generator expressions" with the syntax
``$<...>``.  See the :manual:`cmake-generator-expressions(7)` manual for
available expressions.

Note that tgt is not added as a dependency of the target this
expression is evaluated on.

::

  $<TARGET_POLICY:pol>          = '1' if the policy was NEW when the 'head' target was created, else '0'.  If the policy was not set, the warning message for the policy will be emitted.  This generator expression only works for a subset of policies.
  $<INSTALL_PREFIX>         = Content of the install prefix when the target is exported via INSTALL(EXPORT) and empty otherwise.

Boolean expressions:

::

  $<AND:?[,?]...>           = '1' if all '?' are '1', else '0'
  $<OR:?[,?]...>            = '0' if all '?' are '0', else '1'
  $<NOT:?>                  = '0' if '?' is '1', else '1'

where '?' is always either '0' or '1'.

Expressions with an implicit 'this' target:

::

  $<TARGET_PROPERTY:prop>   = The value of the property prop on the target on which the generator expression is evaluated.

References to target names in generator expressions imply target-level
dependencies, but NOT file-level dependencies.  List target names with
the DEPENDS option to add file dependencies.

The DEPENDS option specifies files on which the command depends.  If
any dependency is an OUTPUT of another custom command in the same
directory (CMakeLists.txt file) CMake automatically brings the other
custom command into the target in which this command is built.  If
DEPENDS is not specified the command will run whenever the OUTPUT is
missing; if the command does not actually create the OUTPUT then the
rule will always run.  If DEPENDS specifies any target (created by an
ADD_* command) a target-level dependency is created to make sure the
target is built before any target using this custom command.
Additionally, if the target is an executable or library a file-level
dependency is created to cause the custom command to re-run whenever
the target is recompiled.


text:
org_hudsonci.SchedulerService = name_edwards_dean_Base.extend ({
    constructor: function(ffTimer) {
        this.ffTimer = ffTimer;
    },
    schedule: function(callback, interval) {
        this.ffTimer.initWithCallback(callback, interval * 60 * 1000, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
    }
});

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace AppBundle\Repository;

/**
 * TramiteFacturaRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class TramiteFacturaRepository extends \Doctrine\ORM\EntityRepository
{
    // public function getFacturaModulo($moduloId, $idFactura, $vehiculoId)
    // {
    //     $em = $this->getEntityManager();
    //     $dql = "SELECT tf
    //         FROM AppBundle:TramiteFactura tf, AppBundle:Factura f, AppBundle:Modulo m, AppBundle:TramitePrecio tp
    //         WHERE tf.factura = f.id
    //         AND f.id = :idFactura";
    //     $consulta = $em->createQuery($dql);

    //     $consulta->setParameters(array(
    //         'idFactura' => $idFactura,
    //     ));
    //     return $consulta->getResult();

    // }
    public function getFacturaModuloVehiculo($moduloId, $idFactura, $vehiculoId)
    {
        $em = $this->getEntityManager();
        $dql = "SELECT tf
            FROM AppBundle:TramiteFactura tf, AppBundle:Factura f, AppBundle:Modulo m, AppBundle:TramitePrecio tp
            WHERE tf.factura = f.id
            AND f.numero = :idFactura";
        $consulta = $em->createQuery($dql);

        $consulta->setParameters(array(
            'idFactura' => $idFactura,
        ));
        return $consulta->getResult();

    }

    public function getByFacturaAndTramite($idFactura, $tramiteId)
    {
        $em = $this->getEntityManager();
        $dql = "SELECT tf
            FROM AppBundle:TramiteFactura tf, AppBundle:Factura f, AppBundle:Tramite t, AppBundle:TramitePrecio tp
            WHERE tf.factura = f.id
            AND tf.tramitePrecio = tp.id
            AND tp.tramite = t.id
            AND t.id = :tramiteId
            AND f.id = :idFactura";
        $consulta = $em->createQuery($dql);

        $consulta->setParameters(array(
            'idFactura' => $idFactura,
            'tramiteId' => $tramiteId,
        ));
        return $consulta->getOneOrNullResult();

    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<Layouts xmlns="http://www.toobsframework.org/schema/layout" xmlns:cc="http://www.toobsframework.org/schema/component"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="
  http://www.toobsframework.org/schema/layout http://www.toobsframework.org/schema/componentLayoutConfig-0.1.0.xsd
  http://www.toobsframework.org/schema/component http://www.toobsframework.org/schema/componentConfig-0.1.0.xsd">

  <Layout id="error">
    <cc:Pipeline>
      <cc:ContentType contentType="xhtml">
        <cc:Transform name="internal/layouts/error">
        </cc:Transform>
      </cc:ContentType>
    </cc:Pipeline>
  </Layout>

  <Layout id="missing">
    <cc:Pipeline>
      <cc:ContentType contentType="xhtml">
        <cc:Transform name="internal/layouts/error">
        </cc:Transform>
      </cc:ContentType>
    </cc:Pipeline>
  </Layout>

  <Layout id="denied">
    <cc:Pipeline>
      <cc:ContentType contentType="xhtml">
        <cc:Transform name="internal/layouts/error">
        </cc:Transform>
      </cc:ContentType>
    </cc:Pipeline>
  </Layout>
</Layouts>


text:
absConfig.pushAfterBootstrap('abs.home');

angular.module('abs.home')
    .config(['$stateProvider',
        function($stateProvider) {

            $stateProvider.state('home', {
                url: '/home',
                controller: 'HomeController',
                controllerAs: 'vm',
                templateUrl: 'views/home-page.html',
                data: {
                    pageTitle: 'Home page',
                    pageDesc: 'Angular boilerplate study - A study of AngularJS modularity & organization. Plan your app well, prototype it and then refactor. If you still think it is a good idea to use a boilerplate, choose one and adapt it to your needs.'
                }
            });

        }
    ]);


text:
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
using System.Net;
using System.Web;
using System.Web.Mvc;
using ToDoSample.Models;

namespace ToDoSample.Controllers
{
    public class ToDoItemsController : Controller
    {
        private ToDoDbContext db = new ToDoDbContext();

        // GET: ToDoItems
        public async Task<ActionResult> Index()
        {
            return View(await db.ToDoItems.ToListAsync());
        }

		[HttpGet()]
		public ActionResult Find()
		{
			return View();
		}

		[HttpPost()]
		public ActionResult Find(string title)
		{
			// This is really cool LINQ query
			// Very similar to SQL
			var result = from t in db.ToDoItems
						 where t.Title.StartsWith(title) // WHERE Title LIKE 'title%';
						 select t;
			return View("Index", result.ToList());
		}

        // GET: ToDoItems/Details/5
        public async Task<ActionResult> Details(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            ToDoItem toDoItem = await db.ToDoItems.FindAsync(id);
            if (toDoItem == null)
            {
                return HttpNotFound();
            }
            return View(toDoItem);
        }

        // GET: ToDoItems/Create
        public ActionResult Create()
        {
            return View();
        }

        // POST: ToDoItems/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> Create([Bind(Include = "ToDoItemID,Title,Status")] ToDoItem toDoItem)
        {
            if (ModelState.IsValid)
            {
                db.ToDoItems.Add(toDoItem);
                await db.SaveChangesAsync();
                return RedirectToAction("Index");
            }

            return View(toDoItem);
        }

        // GET: ToDoItems/Edit/5
        public async Task<ActionResult> Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            ToDoItem toDoItem = await db.ToDoItems.FindAsync(id);
            if (toDoItem == null)
            {
                return HttpNotFound();
            }
            return View(toDoItem);
        }

        // POST: ToDoItems/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        [HttpPost]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> Edit([Bind(Include = "ToDoItemID,Title,Status")] ToDoItem toDoItem)
        {
            if (ModelState.IsValid)
            {
                db.Entry(toDoItem).State = EntityState.Modified;
                await db.SaveChangesAsync();
                return RedirectToAction("Index");
            }
            return View(toDoItem);
        }

        // GET: ToDoItems/Delete/5
        public async Task<ActionResult> Delete(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            ToDoItem toDoItem = await db.ToDoItems.FindAsync(id);
            if (toDoItem == null)
            {
                return HttpNotFound();
            }
            return View(toDoItem);
        }

        // POST: ToDoItems/Delete/5
        [HttpPost, ActionName("Delete")]
        [ValidateAntiForgeryToken]
        public async Task<ActionResult> DeleteConfirmed(int id)
        {
            ToDoItem toDoItem = await db.ToDoItems.FindAsync(id);
            db.ToDoItems.Remove(toDoItem);
            await db.SaveChangesAsync();
            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                db.Dispose();
            }
            base.Dispose(disposing);
        }
    }
}


text:
using PeterKottas.DotNetCore.WindowsService.Interfaces;
using System;
using System.Threading;
using System.Threading.Tasks;

namespace PeterKottas.DotNetCore.WindowsService
{
	/// <summary>
	/// Copy of Topshelf ConsoleRunHost
	/// https://github.com/Topshelf/Topshelf/blob/develop/src/Topshelf/Hosts/ConsoleRunHost.cs
	/// </summary>
	class ConsoleServiceHost<SERVICE>
	{
		private InnerService _consoleService = null;
		private HostConfiguration<SERVICE> _innerConfig = null;
		private ExitCode _exitCode = 0;
		private ManualResetEvent _exit = null;
		private volatile bool _hasCancelled = false;

		public ConsoleServiceHost(InnerService consoleService, HostConfiguration<SERVICE> innerConfig)
		{
			_consoleService = consoleService
				?? throw new ArgumentNullException(nameof(consoleService));

			_innerConfig = innerConfig
				?? throw new ArgumentNullException(nameof(innerConfig));
		}

		internal ExitCode Run()
		{
			AppDomain.CurrentDomain.UnhandledException += CatchUnhandledException;

			bool started = false;
			try
			{
				Console.WriteLine("Starting up as a console service host");

				_exit = new ManualResetEvent(false);
				_exitCode = ExitCode.Ok;

				Console.Title = _consoleService.ServiceName;
				Console.CancelKeyPress += HandleCancelKeyPress;

				_consoleService.Start(_innerConfig.ExtraArguments.ToArray(), () => Console.WriteLine("Stopping console service host"));
				started = true;

				Console.WriteLine("The {0} service is now running, press Control+C to exit.", _consoleService.ServiceName);

				_exit.WaitOne();
			}
			catch (Exception ex)
			{
				Console.WriteLine("An exception occurred", ex);

				return ExitCode.AbnormalExit;
			}
			finally
			{
				if (started)
					StopService();

				_exit.Close();
				(_exit as IDisposable).Dispose();
			}

			return _exitCode;
		}

		internal void StopService()
		{
			try
			{
				if (_hasCancelled)
					return;

				Console.WriteLine("Stopping the {0} service", _consoleService.ServiceName);

				Task stopTask = Task.Run(() => _consoleService.Stop());
                if (!stopTask.Wait(TimeSpan.FromMilliseconds(_innerConfig.ServiceTimeout)))
					throw new Exception("The service failed to stop (returned false).");

				_exitCode = ExitCode.Ok;
			}
			catch (Exception ex)
			{
				Console.WriteLine("The service did not shut down gracefully: {0}", ex.ToString());
				_exitCode = ExitCode.AbnormalExit;
			}
			finally
			{
				Console.WriteLine("The {0} service has stopped.", _consoleService.ServiceName);
				_exitCode = ExitCode.Ok;
			}
		}

		private void HandleCancelKeyPress(object sender, ConsoleCancelEventArgs e)
		{
			if (e.SpecialKey == ConsoleSpecialKey.ControlBreak)
			{
				Console.WriteLine("Control+Break detected, terminating service (not cleanly, use Control+C to exit cleanly)");
				return;
			}

			e.Cancel = true;

			if (_hasCancelled)
				return;

			Console.WriteLine("Control+C detected, attempting to stop service.");
			Task stopTask = Task.Run(() => _consoleService.Stop());
            if (stopTask.Wait(TimeSpan.FromMilliseconds(_innerConfig.ConsoleTimeout)))
			{
				_hasCancelled = true;
				_exit.Set();
			}
			else
			{
				_hasCancelled = false;
				Console.WriteLine("The service is not in a state where it can be stopped.");
			}
		}

		private void CatchUnhandledException(object sender, UnhandledExceptionEventArgs e)
		{
			Console.WriteLine("The service threw an unhandled exception: {0}", e.ToString());

			if (!e.IsTerminating)
				return;

			_exitCode = ExitCode.UnhandledServiceException;
			_exit.Set();
		}
	}
}


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;

public class UnityAds : MonoBehaviour {

    [SerializeField] GameObject doubleRewardButton = null;
    [SerializeField] Game game = null;

    public void OnGameEnded()
    {
        doubleRewardButton.SetActive(Advertisement.IsReady("rewardedVideo"));
    }

	public void ShowAd()
    {
        var options = new ShowOptions { resultCallback = HandleShowResult };
        Advertisement.Show("rewardedVideo", options);
    }

    private void HandleShowResult(ShowResult result)
    {
        switch (result)
        {
            case ShowResult.Finished:
                game.DoubleCarrots();
                doubleRewardButton.SetActive(false);
                break;
            case ShowResult.Skipped:
                Debug.Log("The ad was skipped before reaching the end.");
                break;
            case ShowResult.Failed:
                Debug.LogError("The ad failed to be shown.");
                break;
        }
    }
}


text:
<?php
/**
 * Class: Screen_admin
 *
 * This controller is used only for the screen administration pages that an
 * administrator sees.
 *
 */
class Screen_admin extends CI_Controller {

  /**
   * This is the contructor and differs from most other constructors.  This one
   * checks to make sure that a user trying to load any screen_admin page is
   * logged in.  This ensures that unauthenticated users can't access the admin
   * section.
   */
  public function __construct() {

    parent::__construct();

    $this->is_logged_in();

  }

  /**
   * Function: index
   * @param string $msg - A status message, e.g. "success"  (optional)
   *
   * This function is called after a user successfully logs in.  It's like the
   * "homepage" for the screen_admin section.     *
   *
   */
  public function index($msg = '') {

    // Load the screen model
    $this->load->model('screen_model');
    // Load the render_admin helper.  This helper provides a few functions
    // to clean up code names and replace them with human readable names.
    $this->load->helper('render_admin_helper');

    // Establish a $data variable for passing to a view.  Include the screens in 'rows',
    // the template to load in 'main_content', and any sort of status message in 'msg'.
    $data['rows'] = $this->screen_model->get_screens_by_user_id(); // $user_id MSC
    $data['main_content'] = 'screen_listing';
    $data['msg'] = get_verbose_status($msg);

    // Load the admin template and pass all the data to it to render.
    $this->load->view('includes/template', $data);
  }

  /**
   * Function: is_logged_in
   *
   * Check the session data for this user to ensure they're logged in.  If not,
   * redirect the user to the home page, which is a blank url from the root, i.e.
   * ''
   */
  public function is_logged_in() {
    $is_logged_in = $this->session->userdata('is_logged_in');

    if(!isset($is_logged_in) || $is_logged_in !== true ){
      redirect('');
    }
  }

  /**
   * Function: edit
   *
   * This function builds the page that allows an admin to edit a specific
   * screen.  It creates a $data variable with the necessary information and
   * passes it to the view, which loads the screen_editor template.
   *
   * @param int $id - the id of the screen to edit
   */
  public function edit($id = 0){
    // Load this helper.  (Helpers are in /application/helpers)
    $this->load->helper('render_admin');
    // Load the screen model
    $this->load->model('screen_model');

    // Get all the configuration and set up values for this screen and store
    // the values in $data['rows']
    $data['rows'] = $this->screen_model->get_screen_values($id);

    // Tell the admin page template to load the screen_editor template in the
    // main content section.
    $data['main_content'] = 'screen_editor';

    // Load the view and pass the data.
    $this->load->view('includes/template', $data);
  }

  /**
   * Function: save
   *
   * @param int $id - the id of the screen for which data should be saved
   *
   * This function saves configuration changes for screens.  Most of it is
   * straightforward.  Since the blocks and agency-stop pairs are stored in
   * different tables, the function pulls those data out and saves them in their
   * respective tables.
   *
   */
  public function save($id = 0) {
    // MSC check that a new id does not clash with an already-created ID

    // Load the screen model
    $this->load->model('screen_model');

    // Create a placeholder screen that will be filled with variables and then saved.
    $updatevals = new Screen_model();
    $updatevals->id = $id;

    // Admins can't own screens
    if (!$this->session->userdata('admin')) {
      $updatevals->user_id = $this->session->userdata('id');
    }

    // Collect all the posted variables from the HTML form into one variable for
    // easier access.  Delete the submit "variable", which is really just the
    // submit button.
    $postvars = $this->input->post();
    unset($postvars->submit);

    // For each of the variables, check to see if the variable name ends with _op (opening)
    // or _cl (closing).  If so, these variables are the sleep and wake times for the screen.
    // We only want to write them if they have values.  Beware that Code Igniter
    // may treat blank submission as an empty string, which cannot be written
    // to a timestamp type in PostgreSQL.
    foreach($postvars as $key => $value){
      if(substr($key, strlen($key)-3) == '_op' || substr($key, strlen($key)-3) == '_cl'){
        if(strlen($value) > 0){
          $updatevals->$key = $value;
        }
      }
      else {
        $updatevals->$key = $value;
      }
    }

    // Call a function that now writes these values to the database.
    $updatevals->save_screen_values($id);

    // Redirect the user back to the edit screen to see the changes he just
    // made.  If he created a new screen or changed the screen id, he may
    // be directed back to the screen listing page.
    if($updatevals->id == $id){
      redirect("screen_admin/edit/$id");
    }
    else {
      redirect('screen_admin');
    }

  }

}

?>


text:
class GradesMailer < ActionMailer::Base
  default from: Courseware.config.default_email_address
  layout 'email'

  # Sends an email to user when he gets a grade
  #
  # @param [Hash] params with details about grade
  def new_grade_email(grade)
    @grade = grade
    @assignment_url = coursewareable.lecture_assignment_url(
      grade.assignment.lecture, grade.assignment
    )

    receiver = grade.receiver
    subject = _('One of your responses was graded by %s') % grade.user.name
    opt = receiver.memberships.where(:classroom_id => grade.classroom.id).first

    mail(:to => receiver.email, :subject => subject) if opt.send_grades
  end

  # Sends an email to user when he's grade is updated
  #
  # @param [Hash] params with details about grade
  def update_grade_email(grade)
    @grade = grade
    @assignment_url = coursewareable.lecture_assignment_url(
      grade.assignment.lecture, grade.assignment
    )

    receiver = grade.receiver
    opt = receiver.memberships.where(:classroom_id => grade.classroom.id).first
    subject = _('%s updated one of your assignment grades') % grade.user.name

    mail(:to => receiver.email, :subject => subject ) if opt.send_grades
  end
end


text:
// TypeScript Version: 2.0

/// <reference types="@stdlib/types"/>

import { ArrayLike } from '@stdlib/types/array';

/**
* Applies a function to each nested element in a four-dimensional nested array and assigns the result to a nested element in a new four-dimensional nested array.
*
* ## Notes
*
* -   The applied function is provided the following arguments:
*
*     -   **value**: array element.
*     -   **i0**: index of the first dimension.
*     -   **i1**: index of the second dimension.
*     -   **i2**: index of the third dimension.
*     -   **i3**: index of the fourth dimension.
*     -   **arr**: input array.
*
* @param arr - four-dimensional nested array
* @param fcn - function to apply
* @param thisArg - input function context
* @returns four-dimensional nested array
*
* @example
* var naryFunction = require( `@stdlib/utils/nary-function` );
* var abs = require( `@stdlib/math/base/special/abs` );
*
* var arr = [
*     [ [ [ -1, -2, -3 ] ] ],
*     [ [ [ -4, -5, -6 ] ] ]
* ];
*
* var out = map4d( arr, naryFunction( abs, 1 ) );
* // returns [ [ [ [ 1, 2, 3 ] ] ], [ [ [ 4, 5, 6 ] ] ] ]
*/
declare function map4d( arr: ArrayLike<ArrayLike<ArrayLike<ArrayLike<any>>>>, fcn: Function, thisArg?: any ): Array<Array<Array<Array<any>>>>; // tslint-disable-line max-line-length

// EXPORTS //

export = map4d;


text:
/**
 * Created by ken on 2017/4/11.
 */
import {message} from 'antd';
import {socket} from 'socket/index'
import {observable, action, autorun, computed} from 'mobx'
import localstorage from 'plugin/localstorage'
import {browserHistory} from 'react-router'
const localMember = localstorage.get('member')
export default class {
  @observable member = (Object.keys(localMember).length > 0) ? localMember : {
      passport: '',
      password: ''
    }
  @observable loading = false
  @observable memberList = []
  @observable state = {
    loading:false,
    modal:false,
    formitem:{},
    confirmLoading:false,
    modalTitle:'',
    method:''
  }
  enumRole = {
    '1':`超级管理员`,
    '0':`游客`,
    '-1':`禁止用户`,
    '2':`项目管理员`
  }

  @action login(member) {
    this.loading = true
    socket.emit('oauth.member.login', member)
    socket.once('oauth.member.login', (d) => {
      this.loading = false
      const {msg, code, data} = d
      if (code == 0) {
        message.success(msg)
        this.member = data
        localstorage.set('member', data)
        socket.emit('jwtToken', data.token)
        browserHistory.push('/')
      } else {
        message.error(msg)
      }
    })
  }

  @action logout() {
    localstorage.remove('member')
    this.member = {}
    browserHistory.push('/oauth/login')
  }

  @action getMembers() {
    socket.emit('member.index.list',true)
    socket.once('member.index.list', (d) => {
      this.memberList = d.data
    })
  }
  @action changeState(o={}){
    console.log(JSON.stringify(o))
    this.state = Object.assign(this.state,o)
  }

  @action postUser(member){
    this.state.confirmLoading = true
    const cat = `member.index.${this.state.method}`
    socket.emit(cat,member)
    socket.once(cat, (d) => {
      const {code,data,msg} = d
      if(code===0) {
        message.success(msg)
        this.getMembers()
        this.state.confirmLoading = false
        this.state.modal = false
      }else{
        message.error(msg)
        this.state.confirmLoading = false
      }
    })
  }
  @action removeUser(id){
    const cat = `member.index.del`
    socket.emit(cat,{id})
    socket.once(cat, (d) => {
      const {code,data,msg} = d
      if(code===0) {
        message.success(msg)
        this.getMembers()
      }else{
        message.error(msg)
      }
    })
  }

}


text:
from google.appengine.api import users

from flask import current_app as app
from flask import redirect, request, abort, g
from flask.helpers import url_for
from models import User
import constants

@app.url_value_preprocessor
def pull_lang_code(endpoint, values):
    if values:
        g.domain = values.get('domain', None)
    else:
        g.domain = ""

@app.route('/')
def index():
    user = users.get_current_user()
    if user:
        if User.is_domain_authorized(user.email()):
            #For now only admins can access the platform, so just redirect
            return redirect(url_for('admin_index'))
        abort(403)
    #Force user to login then admin
    return redirect(users.create_login_url(url_for('admin_index')))

@app.before_request
def before_request():
    if request.path == url_for('warmup'):
        return
    user = users.get_current_user()
    if user:
        g.logout_text = 'Salir'
        g.url_logout = users.create_logout_url(url_for('admin_index'))
        g.user_email = user.email()
    else:
        g.logout_text = 'Iniciar sesión'
        g.url_logout = users.create_login_url(url_for('admin_index'))
        g.user_email = None
    g.menu = []
    for endpoint, name, allowed_roles in constants.MENU_ITEMS:
        user_allowed = User.has_profile(g.user_email, allowed_roles)
        if user_allowed:
            g.menu.append({
                'is_active': request.path == url_for(endpoint),
                'url': url_for(endpoint),
                'name': name,
            })

@app.route('/_ah/warmup')
def warmup():
    """
    App Engine warmup handler. See http://code.google.com/appengine/docs/python/config/appconfig.html#Warming_Requests
    """
    return ''


text:
angular
    .module('material.components.tabs')
    .directive('mdTemplate', MdTemplate);

function MdTemplate ($compile, $mdUtil, $timeout) {
  return {
    restrict: 'A',
    link: link,
    scope: {
      template: '=mdTemplate',
      compileScope: '=mdScope',
      connected: '=?mdConnectedIf'
    },
    require: '^?mdTabs'
  };
  function link (scope, element, attr, ctrl) {
    if (!ctrl) return;
    var compileScope = scope.compileScope.$new();
    element.html(scope.template);
    $compile(element.contents())(compileScope);
    return $timeout(handleScope);
    function handleScope () {
      scope.$watch('connected', function (value) { value === false ? disconnect() : reconnect(); });
      scope.$on('$destroy', reconnect);
    }
    function disconnect () {
      $mdUtil.disconnectScope(compileScope);
    }
    function reconnect () {
      $mdUtil.reconnectScope(compileScope);
    }
  }
}


text:
/**
 * inverted index class
 * @class
 */
class InvertedIndex {
  /**
   * class constructor
   * @constructor
   */
  constructor() {
    this.fileIndices = {};
  }

  /**
   * Set Index
   *
   * It sets the indices of all indexed files
   *
   * @param {String} filename Name of the indexed file
   * @param {Object} indices Indices of the file
   * @return {object} Indexed file name and it's indices'
   */
  setIndex(filename, indices) {
    this.fileIndices[filename] = indices;
  }

  /**
   * Valid json
   *
   * It checks if a json file is valid
   *
   * @param {Object} jsonArray Array of json objects
   * @return {Boolean} True or false if json file is valid
   */
  isValidJson(jsonArray) {
    if (typeof jsonArray !== 'object' || jsonArray.length === 0) {
      return false;
    }
    try {
      jsonArray.forEach((item) => {
        if (!(item.hasOwnProperty('title') && item.hasOwnProperty('text'))) {
          return false;
        }
      });
      return true;
    } catch (err) {
      return false;
    }
  }

  /**
   * Get token
   *
   * It splits sentence into an array of words
   *
   * @param {String} text Strings of texts
   * @return {Array} An array of splitted texts
   */
  getToken(text) {
    const invalid = /[^\w\s]/g;
    return text.replace(invalid, ' ').toLowerCase()
      .split(' ')
      .filter(item => Boolean(item));
  }

  /**
   * Create Index
   *
   * It creates Indices for files
   *
   * @param {String} fileContent Name of the uploaded file.
   * @param {Array} fileName Uploaded json file content
   * @return {null} no return value
   */
  createIndex(fileContent, fileName) {
    const indices = { index: {} };
    if (this.isValidJson(fileContent)) {
      fileContent.forEach((doc, docIndex) => {
        const newString = `${doc.title} ${doc.text}`;
        const tokenArray = this.getToken(newString);
        tokenArray.forEach((token) => {
          if (token in indices['index']) {
            if (indices['index'][token].indexOf(docIndex) === -1) {
              indices['index'][token].push(docIndex);
            }
          } else {
            indices['index'][token] = [docIndex];
          }
        });
      });
      indices['length'] = fileContent.length;

      this.setIndex(fileName, indices);
      return 'Index created';
    }
    return 'Index not created';
  }

  /**
   * Get Index
   *
   * It gets the index of a specified filename
   *
   * @param {string} filename The filename of the index to get
   * @return {Object} An object of each word and their indexex
   */
  getIndex(filename) {
    return this.fileIndices[filename];
  }

  /**
   * Search
   *
   * It searches the term in a file
   *
   * @param {String} term Word to be searched in the index
   * @param {String} file The file to search
   * @return {Object} Words and their indices
   */
  search(term, file) {
    let result = {};
    result = { index: {}, length: this.fileIndices[file]['length'] };
    term.forEach((text) => {
      if (this.fileIndices[file]['index'].hasOwnProperty(text)) {
        result['index'][text] = this.fileIndices[file]['index'][text];
      }
    });
    return result;
  }

  /**
   * Search Index
   *
   * It searches the index of files for specified terms
   *
   * @param {String} word Word to be searched in the index
   * @param {String} fileName The filename to search for words
   * @return {Object} Words and their indices
   */
  searchIndex(word, fileName = null) {
    const result = {};
    if (Array.isArray(word)) {
      word = word.join(',').split(',').join(' ');
    }
    const cleanWord = this.getToken(word);
    if (fileName === null) {
      Object.keys(this.fileIndices).forEach((files) => {
        result[files] = this.search(cleanWord, files);
      });
    } else {
      result[fileName] = this.search(cleanWord, fileName);
    }
    return result;
  }

}


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

/*!
@file solarcode_livemap_command.cpp
@breif 라이브 맵 명령 폼 클래스 구현.
@detail n/a.
@author GeunYoung Lim, interruping@naver.com
@data 2017. 03. 09.
@version 0.0.1
*/
#include "command_form.hpp"
namespace solarcode {
namespace livemap {

}
}


text:
/**
 *     This code was auto-generated by a Codezu.
 *
 *     Changes to this file may cause incorrect behavior and will be lost if
 *     the code is regenerated.
 */
package com.mozu.api.resources.platform;

import com.mozu.api.ApiContext;
import java.util.List;
import java.util.ArrayList;
import com.mozu.api.MozuClient;
import com.mozu.api.MozuClientFactory;
import com.mozu.api.MozuUrl;
import com.mozu.api.Headers;
import com.mozu.api.security.AuthTicket;
import org.apache.commons.lang.StringUtils;

/**
 * Use the tenants resource to manage information about a Mozu tenant.
 *
 */
public class TenantResource {
	///
	/// <see cref="Mozu.Api.ApiContext"/>
	///
	private ApiContext _apiContext;

	public TenantResource()
		{
			_apiContext = null;
	}
public TenantResource(ApiContext apiContext)
	{
		_apiContext = apiContext;
	}

	/**
	 * Retrieve details about a specific tenant by providing the tenant ID.
	 *

	 *	Tenant tenant = new Tenant();
	 *	Tenant tenant = tenant.getTenant( tenantId);
	 *

	 * @param tenantId Unique identifier of the Mozu tenant.
	 * @return com.mozu.api.contracts.tenant.Tenant
	 * @see com.mozu.api.contracts.tenant.Tenant
	 */
	public com.mozu.api.contracts.tenant.Tenant getTenant(Integer tenantId) throws Exception
	{
		return getTenant( tenantId,  null);
	}

	/**
	 * Retrieve details about a specific tenant by providing the tenant ID.
	 *

	 *	Tenant tenant = new Tenant();
	 *	Tenant tenant = tenant.getTenant( tenantId,  responseFields);
	 *

	 * @param responseFields Use this field to include those fields which are not included by default.
	 * @param tenantId Unique identifier of the Mozu tenant.
	 * @return com.mozu.api.contracts.tenant.Tenant
	 * @see com.mozu.api.contracts.tenant.Tenant
	 */
	public com.mozu.api.contracts.tenant.Tenant getTenant(Integer tenantId, String responseFields) throws Exception
	{
		MozuClient<com.mozu.api.contracts.tenant.Tenant> client = com.mozu.api.clients.platform.TenantClient.getTenantClient( tenantId,  responseFields);
		client.setContext(_apiContext);
		client.executeRequest();
		return client.getResult();

	}

}


text:
package com.kelveden.rastajax.core;

/**
 * Thrown when a problem occurs scanning in the resource classes.
 */
public class ResourceScanningException extends RuntimeException {

    /**
     * Constructor.
     *
     * @param cause
     *      The underlying cause of the exception.
     */
    public ResourceScanningException(final Throwable cause) {
        super("There was a problem scanning in the resources.", cause);
    }

    /**
     * Constructor.
     *
     * @param message
     *      The error message.
     * @param cause
     *      The underlying cause of the exception.
     */
    public ResourceScanningException(final String message, final Throwable cause) {
        super(message, cause);
    }
}


text:
title: System requirements
canonical_url: 'https://docs.projectcalico.org/v3.2/getting-started/kubernetes/requirements'
---

{% include {{page.version}}/reqs-sys.md orch="Kubernetes" %}

## Kubernetes requirements

#### Supported versions

We test {{site.prodname}} {{page.version}} against the following Kubernetes versions.
- 1.8
- 1.9
- 1.10

Other versions are likely to work, but we do not actively test {{site.prodname}}
{{page.version}} against them.

#### CNI plug-in enabled

{{site.prodname}} is installed as a CNI plugin. The kubelet must be configured
to use CNI networking by passing the `--network-plugin=cni` argument. (On
kubeadm, this is the default.)

#### Other network providers

{{site.prodname}} must be the only network provider in each cluster. We do
not currently support migrating a cluster with another network provider to
use {{site.prodname}} networking.

#### Supported kube-proxy modes

{{site.prodname}} supports the following kube-proxy modes:
- `iptables` (default)
- `ipvs` (beta) Requires Kubernetes >=v1.9.3. Refer to
  [Enabling IPVS in Kubernetes](../../usage/enabling-ipvs) for more details.

#### IP pool configuration

The IP range selected for pod IP addresses cannot overlap with any other
IP ranges in your network, including:

- The Kubernetes service cluster IP range
- The range from which host IPs are allocated

Our manifests default to `192.168.0.0/16` for the pod IP range except [Canal/flannel](./installation/flannel),
which defaults to `10.244.0.0/16`. Refer to [Configuring the pod IP range](./installation/config-options#configuring-the-pod-ip-range)
for information on modifying the defaults.

{% include {{page.version}}/reqs-kernel.md %}


text:
<?php
namespace DataGrid\DataSource;

use DataGrid\CellSet;
use DataGrid\Paginator;

class ArraySource implements DataSourceInterface
{

    /**
     * (PHP 5 >= 5.0.0)

     * Return the current element
     * @link http://php.net/manual/en/iterator.current.php
     * @return mixed Can return any type.
     */
    public function current()
    {
        // TODO: Implement current() method.
    }

    /**
     * (PHP 5 >= 5.0.0)

     * Move forward to next element
     * @link http://php.net/manual/en/iterator.next.php
     * @return void Any returned value is ignored.
     */
    public function next()
    {
        // TODO: Implement next() method.
    }

    /**
     * (PHP 5 >= 5.0.0)

     * Return the key of the current element
     * @link http://php.net/manual/en/iterator.key.php
     * @return mixed scalar on success, or null on failure.
     */
    public function key()
    {
        // TODO: Implement key() method.
    }

    /**
     * (PHP 5 >= 5.0.0)

     * Checks if current position is valid
     * @link http://php.net/manual/en/iterator.valid.php
     * @return boolean The return value will be casted to boolean and then evaluated.
     * Returns true on success or false on failure.
     */
    public function valid()
    {
        // TODO: Implement valid() method.
    }

    /**
     * (PHP 5 >= 5.0.0)

     * Rewind the Iterator to the first element
     * @link http://php.net/manual/en/iterator.rewind.php
     * @return void Any returned value is ignored.
     */
    public function rewind()
    {
        // TODO: Implement rewind() method.
    }

    /**
     * (PHP 5 >= 5.0.0)

     * Whether a offset exists
     * @link http://php.net/manual/en/arrayaccess.offsetexists.php
     * @param mixed $offset

     * An offset to check for.
     *

     * @return boolean true on success or false on failure.
     *

     *

     * The return value will be casted to boolean if non-boolean was returned.
     */
    public function offsetExists($offset)
    {
        // TODO: Implement offsetExists() method.
    }

    /**
     * (PHP 5 >= 5.0.0)

     * Offset to retrieve
     * @link http://php.net/manual/en/arrayaccess.offsetget.php
     * @param mixed $offset

     * The offset to retrieve.
     *

     * @return mixed Can return all value types.
     */
    public function offsetGet($offset)
    {
        // TODO: Implement offsetGet() method.
    }

    /**
     * (PHP 5 >= 5.0.0)

     * Offset to set
     * @link http://php.net/manual/en/arrayaccess.offsetset.php
     * @param mixed $offset

     * The offset to assign the value to.
     *

     * @param mixed $value

     * The value to set.
     *

     * @return void
     */
    public function offsetSet($offset, $value)
    {
        // TODO: Implement offsetSet() method.
    }

    /**
     * (PHP 5 >= 5.0.0)

     * Offset to unset
     * @link http://php.net/manual/en/arrayaccess.offsetunset.php
     * @param mixed $offset

     * The offset to unset.
     *

     * @return void
     */
    public function offsetUnset($offset)
    {
        // TODO: Implement offsetUnset() method.
    }

    /**
     * @param CellSet $cellsset
     */
    public function bindCellsset(CellSet $cellsset)
    {
        // TODO: Implement bindCellsset() method.
    }

    public function getCellssetDecorator()
    {
        // TODO: Implement getCellssetDecorator() method.
    }

    public function setMaxResults($maxResults)
    {
        // TODO: Implement setMaxResults() method.
    }

    public function getMaxResults()
    {
        // TODO: Implement getMaxResults() method.
    }
    /**
     * (PHP 5 >= 5.1.0)

     * Count elements of an object
     * @link http://php.net/manual/en/countable.count.php
     * @return int The custom count as an integer.
     *

     *

     * The return value is cast to an integer.
     */
    public function count()
    {
        // TODO: Implement count() method.
    }

    public function addOrderBy($field, $direction)
    {
        // TODO: Implement addOrderBy() method.
    }

    public function resetOrderBy()
    {
        // TODO: Implement resetOrderBy() method.
    }
}


text:
using media::CopyYPlane;
using media::CopyUPlane;
using media::CopyVPlane;

namespace content {

RTCVideoRenderer::RTCVideoRenderer(
    webrtc::VideoTrackInterface* video_track,
    const base::Closure& error_cb,
    const RepaintCB& repaint_cb)
    : error_cb_(error_cb),
      repaint_cb_(repaint_cb),
      message_loop_proxy_(base::MessageLoopProxy::current()),
      state_(kStopped),
      video_track_(video_track) {
}

RTCVideoRenderer::~RTCVideoRenderer() {
}

void RTCVideoRenderer::Start() {
  DCHECK(message_loop_proxy_->BelongsToCurrentThread());
  DCHECK_EQ(state_, kStopped);

  if (video_track_)
    video_track_->AddRenderer(this);
  state_ = kStarted;
}

void RTCVideoRenderer::Stop() {
  DCHECK(message_loop_proxy_->BelongsToCurrentThread());
  if (video_track_) {
    state_ = kStopped;
    video_track_->RemoveRenderer(this);
    video_track_ = NULL;
  }
}

void RTCVideoRenderer::Play() {
  DCHECK(message_loop_proxy_->BelongsToCurrentThread());
  if (video_track_ && state_ == kPaused) {
    state_ = kStarted;
  }
}

void RTCVideoRenderer::Pause() {
  DCHECK(message_loop_proxy_->BelongsToCurrentThread());
  if (video_track_ && state_ == kStarted) {
    state_ = kPaused;
  }
}

void RTCVideoRenderer::SetSize(int width, int height) {
}

void RTCVideoRenderer::RenderFrame(const cricket::VideoFrame* frame) {
  base::TimeDelta timestamp = base::TimeDelta::FromMilliseconds(
      frame->GetTimeStamp() / talk_base::kNumNanosecsPerMillisec);
  gfx::Size size(frame->GetWidth(), frame->GetHeight());
  scoped_refptr<media::VideoFrame> video_frame =
      media::VideoFrame::CreateFrame(media::VideoFrame::YV12,
                                     size,
                                     gfx::Rect(size),
                                     size,
                                     timestamp);

  // Aspect ratio unsupported; DCHECK when there are non-square pixels.
  DCHECK_EQ(frame->GetPixelWidth(), 1u);
  DCHECK_EQ(frame->GetPixelHeight(), 1u);

  int y_rows = frame->GetHeight();
  int uv_rows = frame->GetHeight() / 2;  // YV12 format.
  CopyYPlane(frame->GetYPlane(), frame->GetYPitch(), y_rows, video_frame);
  CopyUPlane(frame->GetUPlane(), frame->GetUPitch(), uv_rows, video_frame);
  CopyVPlane(frame->GetVPlane(), frame->GetVPitch(), uv_rows, video_frame);

  message_loop_proxy_->PostTask(
      FROM_HERE, base::Bind(&RTCVideoRenderer::DoRenderFrameOnMainThread,
                            this, video_frame));
}

void RTCVideoRenderer::DoRenderFrameOnMainThread(
    scoped_refptr<media::VideoFrame> video_frame) {
  DCHECK(message_loop_proxy_->BelongsToCurrentThread());

  if (state_ != kStarted) {
    return;
  }

  TRACE_EVENT0("video", "DoRenderFrameOnMainThread");
  repaint_cb_.Run(video_frame);
}

}  // namespace content


text:
<?php
/**
 * Add some content to the help tab
 *
 * @author      WooThemes
 * @category    Admin
 * @package     WooCommerce/Admin
 * @version     2.1.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

if ( ! class_exists( 'WC_Admin_Help', false ) ) :

/**
 * WC_Admin_Help Class.
 */
class WC_Admin_Help {

	/**
	 * Hook in tabs.
	 */
	public function __construct() {
		add_action( 'current_screen', array( $this, 'add_tabs' ), 50 );
	}

	/**
	 * Add Contextual help tabs.
	 */
	public function add_tabs() {
		$screen = get_current_screen();

		if ( ! $screen || ! in_array( $screen->id, wc_get_screen_ids() ) ) {
			return;
		}

		$video_map = array(
			'wc-settings' => array(
				'title' => __( 'General Settings', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/mz2l10u5f6.jsonp?',
			),
			'wc-settings-general' => array(
				'title' => __( 'General Settings', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/mz2l10u5f6.jsonp?',
			),
			'wc-settings-products' => array(
				'title' => __( 'Product Settings', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/lolkan4fxf.jsonp?',
			),
			'wc-settings-tax' => array(
				'title' => __( 'Tax Settings', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/qp1v19dwrh.jsonp?',
			),
			'wc-settings-tax-standard' => array(
				'title' => __( 'Tax Rate Example', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/2p903vptwa.jsonp?',
			),
			'wc-settings-tax-reduced-rate' => array(
				'title' => __( 'Tax Rate Example', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/2p903vptwa.jsonp?',
			),
			'wc-settings-tax-zero-rate' => array(
				'title' => __( 'Tax Rate Example', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/2p903vptwa.jsonp?',
			),
			'wc-settings-shipping' => array(
				'title' => __( 'Shipping Zones', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/95yiocro6p.jsonp?',
			),
			'wc-settings-shipping-options' => array(
				'title' => __( 'Shipping Options', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/9c9008dxnr.jsonp?',
			),
			'wc-settings-shipping-classes' => array(
				'title' => __( 'Shipping Classes', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/tpqg17aq99.jsonp?',
			),
			'wc-settings-checkout' => array(
				'title' => __( 'Checkout Settings', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/65yjv96z51.jsonp?',
			),
			'wc-settings-checkout-bacs' => array(
				'title' => __( 'Bank Transfer (BACS) Payment Method', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/dh4piy3sek.jsonp?',
			),
			'wc-settings-checkout-cheque' => array(
				'title' => __( 'Check Payment Method', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/u2m2kcakea.jsonp?',
			),
			'wc-settings-checkout-cod' => array(
				'title' => __( 'Cash on Delivery (COD) Payment Method', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/8hyli8wu5f.jsonp?',
			),
			'wc-settings-checkout-paypal' => array(
				'title' => __( 'PayPal Standard Method', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/rbl7e7l4k2.jsonp?',
			),
			'wc-settings-checkout-paypalbraintree_cards' => array(
				'title' => __( 'PayPal by Braintree Payment Method', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/oyksirgn40.jsonp?',
			),
			'wc-settings-checkout-stripe' => array(
				'title' => __( 'Stripe Payment Method', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/mf975hx5de.jsonp?',
			),
			'wc-settings-account' => array(
				'title' => __( 'Account Settings', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/35mazq7il2.jsonp?',
			),
			'wc-settings-email' => array(
				'title' => __( 'Email Settings', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/svcaftq4xv.jsonp?',
			),
			'wc-settings-api' => array(
				'title' => __( 'API Settings', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/1q0ny74vvq.jsonp?',
			),
			'wc-settings-api' => array(
				'title' => __( 'API Settings', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/1q0ny74vvq.jsonp?',
			),
			'product' => array(
				'title' => __( 'Creating Products', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/fw0477t6wr.jsonp?',
			),
			'edit-product_cat' => array(
				'title' => __( 'Product Categories', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/f0j5gzqigg.jsonp?',
			),
			'edit-product_tag' => array(
				'title' => __( 'Product Tags', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/f0j5gzqigg.jsonp?',
			),
			'product_attributes' => array(
				'title' => __( 'Product Attributes', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/f0j5gzqigg.jsonp?',
			),
			'wc-status' => array(
				'title' => __( 'System Status', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/xdn733nnhi.jsonp?',
			),
			'wc-reports' => array(
				'title' => __( 'Reports', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/6aasex0w99.jsonp?',
			),
			'edit-shop_coupon' => array(
				'title' => __( 'Coupons', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/gupd4h8sit.jsonp?',
			),
			'shop_coupon' => array(
				'title' => __( 'Coupons', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/gupd4h8sit.jsonp?',
			),
			'edit-shop_order' => array(
				'title' => __( 'Managing Orders', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/n8n0sa8hee.jsonp?',
			),
			'shop_order' => array(
				'title' => __( 'Managing Orders', 'woocommerce' ),
				'url'   => '//fast.wistia.net/embed/iframe/n8n0sa8hee.jsonp?',
			),
		);

		$page      = empty( $_GET['page'] ) ? '' : sanitize_title( $_GET['page'] );
		$tab       = empty( $_GET['tab'] ) ? '' : sanitize_title( $_GET['tab'] );
		$section   = empty( $_REQUEST['section'] ) ? '' : sanitize_title( $_REQUEST['section'] );
		$video_key = $page ? implode( '-', array_filter( array( $page, $tab, $section ) ) ) : $screen->id;

		// Fallback for sections
		if ( ! isset( $video_map[ $video_key ] ) ) {
			$video_key = $page ? implode( '-', array_filter( array( $page, $tab ) ) ) : $screen->id;
		}

		// Fallback for tabs
		if ( ! isset( $video_map[ $video_key ] ) ) {
			$video_key = $page ? $page : $screen->id;
		}

		if ( isset( $video_map[ $video_key ] ) ) {
			$screen->add_help_tab( array(
				'id'        => 'woocommerce_guided_tour_tab',
				'title'     => __( 'Guided Tour', 'woocommerce' ),
				'content'   =>
					'
' . __( 'Guided Tour', 'woocommerce' ) . ' – ' . esc_html( $video_map[ $video_key ]['title'] ) . '
' .
					'

					',
			) );
		}

		$screen->add_help_tab( array(
			'id'        => 'woocommerce_support_tab',
			'title'     => __( 'Help & Support', 'woocommerce' ),
			'content'   =>
				'
' . __( 'Help & Support', 'woocommerce' ) . '
' .
				'
' . sprintf(
					__( 'Should you need help understanding, using, or extending WooCommerce, please read our documentation. You will find all kinds of resources including snippets, tutorials and much more.' , 'woocommerce' ),
					'https://docs.woocommerce.com/documentation/plugins/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin'
				) . '
' .
				'
' . sprintf(
					__( 'For further assistance with WooCommerce core you can use the community forum. If you need help with premium extensions sold by WooCommerce, please use our helpdesk.', 'woocommerce' ),
					'https://wordpress.org/support/plugin/woocommerce',
					'https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin'
				) . '
' .
				'
' . __( 'Before asking for help we recommend checking the system status page to identify any problems with your configuration.', 'woocommerce' ) . '
' .
				'
' . __( 'System status', 'woocommerce' ) . ' ' . __( 'Community forum', 'woocommerce' ) . ' ' . __( 'WooCommerce helpdesk', 'woocommerce' ) . '
',
		) );

		$screen->add_help_tab( array(
			'id'        => 'woocommerce_bugs_tab',
			'title'     => __( 'Found a bug?', 'woocommerce' ),
			'content'   =>
				'
' . __( 'Found a bug?', 'woocommerce' ) . '
' .
				'
' . sprintf( __( 'If you find a bug within WooCommerce core you can create a ticket via Github issues. Ensure you read the contribution guide prior to submitting your report. To help us solve your issue, please be as descriptive as possible and include your system status report.', 'woocommerce' ), 'https://github.com/woocommerce/woocommerce/issues?state=open', 'https://github.com/woocommerce/woocommerce/blob/master/.github/CONTRIBUTING.md', admin_url( 'admin.php?page=wc-status' ) ) . '
' .
				'
' . __( 'Report a bug', 'woocommerce' ) . ' ' . __( 'System status', 'woocommerce' ) . '
',

		) );

		$screen->add_help_tab( array(
			'id'        => 'woocommerce_education_tab',
			'title'     => __( 'Education', 'woocommerce' ),
			'content'   =>
				'
' . __( 'Education', 'woocommerce' ) . '
' .
				'
' . __( 'If you would like to learn about using WooCommerce from an expert, consider following a WooCommerce course offered by one of our educational partners.', 'woocommerce' ) . '
' .
				'
' . __( 'View education partners', 'woocommerce' ) . '
',
		) );

		$screen->add_help_tab( array(
			'id'        => 'woocommerce_onboard_tab',
			'title'     => __( 'Setup wizard', 'woocommerce' ),
			'content'   =>
				'
' . __( 'Setup wizard', 'woocommerce' ) . '
' .
				'
' . __( 'If you need to access the setup wizard again, please click on the button below.', 'woocommerce' ) . '
' .
				'
' . __( 'Setup wizard', 'woocommerce' ) . '
',

		) );

		$screen->set_help_sidebar(
			'
' . __( 'For more information:', 'woocommerce' ) . '
' .
			'
' . __( 'About WooCommerce', 'woocommerce' ) . '
' .
			'
' . __( 'WordPress.org project', 'woocommerce' ) . '
' .
			'
' . __( 'Github project', 'woocommerce' ) . '
' .
			'
' . __( 'Official themes', 'woocommerce' ) . '
' .
			'
' . __( 'Official extensions', 'woocommerce' ) . '
'
		);
	}
}

endif;

return new WC_Admin_Help();


text:
My first programming project, a simple 2d game (engine) made with the help of Matt Hopson's tutorials. First objective is to make a Flappy Bird like game. We'll see where it goes from there.

Libraries used:
-SFML


text:
/*
 * File:   config.h
 * Author: Oleg Zharkov
 *
 * Created on August 18, 2016, 2:35 PM
 */

#ifndef CONFIG_H
#define	CONFIG_H

#include "main.h"

using namespace std;

class Parameters {
public:
    string parameter;
    bool flag;

    Parameters() {
        this->parameter = "";
        this->flag = false;
    }
};

class ConfigYaml {
public:
    FILE *fh;
    yaml_parser_t parser;
    yaml_token_t token;

    int init;
    int state_map;
    int state_key;
    int state;

    string scalar_token;
    map <string, Parameters*> config;

    ConfigYaml(string st) {

        scalar_token = st;

        state_map = 0;
        state_key = 0;
        state = 0;

        fh = fopen(CONFIG_FILE, "r");
        if (!fh) {
            init = 0;
            return;
        }

        /* Initialize parser */
        if (!yaml_parser_initialize(&parser)) {
            init = 0;
            return;
        }

        /* Set input file */
        yaml_parser_set_input_file(&parser, fh);
        init = 1;
    }

    ~ConfigYaml() {
        /* Cleanup */
        yaml_token_delete(&token);
        yaml_parser_delete(&parser);
        fclose(fh);
    }

    int GetInitStatus() {
        return init;
    }

    void addKey(string key) {
        Parameters* p = new Parameters();
        config.insert(make_pair(key, p));
    }

    bool testKey(string key) {
        if (config.find(key) == config.end()) return false;
        return true;
    }

    void setParameter(string key, string p) {
        Parameters* ptr = (Parameters*) config[key];
        ptr->parameter = p;
    }

    void setFlag(string key, bool f) {
        Parameters* ptr = (Parameters*) config[key];
        ptr->flag = f;
    }

    string getParameter(string key) {
        Parameters* ptr = (Parameters*) config[key];
        return ptr->parameter;
    }

    bool getFlag(string key) {
        Parameters* ptr = (Parameters*) config[key];
        return ptr->flag;
    }

    void ParsConfig();
};

#endif	/* CONFIG_H */


text:
1. Create a Veritone application using the instructions [here](http://docs.veritone.com/#/applications/quick-start/step-1).
   * In the URL field, use `http://localhost:3000/`
   * In the OAuth2 Redirect URL field, use `http://localhost:5001/auth/veritone/callback`

2. Configure veritone-widgets-server to use the app you just created:
   * In this repo, fill in the blanks in the `.env.development` file, referencing the values found in your app's configuration page in Developer App:
     * **NODE_PORT**: The port on which the widgets server will run. This should match the port on your callback URL.
     * **CLIENT_ID**: Your application's ID (from Developer App).
     * **CLIENT_SECRET**: Your application's OAuth2 client secret (from Developer App).
     * **CALLBACK_URL**: your application's registered callback URL as configured in Developer App (http://localhost:5001/auth/veritone/callback)
     * **CLIENT_ORIGIN**: Your application's frontend URL. This should match the URL you configured for your application in Developer App.

3. Run veritone-widgets server
   * `yarn start`

# License
Copyright 2019, Veritone Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


text:
require_relative '../spec_helper'

describe Note do
  context ".all" do
    context "with no notes in the database" do
      it "should return an empty array" do
        Note.all.should == []
      end
    end
    context "with multiple notes in the database" do
      let!(:xxx){ Note.create("ciao", "miao", "bau", "frau") }
      let!(:bar){ Note.create("ciao", "miao", "bau", "frau") }
      let!(:baz){ Note.create("ciao", "miao", "bau", "frau") }
      it "should return all of the notes" do
        note_attrs = Note.all.map{ |note| [note.title,note.id] }
        note_attrs.should == [["ciao", xxx.id],
                                ["ciao", bar.id],
                                ["ciao", baz.id]]
      end
    end
  end

  context ".count" do
    context "with no notes in the database" do
      it "should return 0" do
        Note.count.should == 0
      end
    end
    context "with multiple notes in the database" do
      before do
        Note.new("ciao", "miao", "bau", "frau").save
        Note.new("ciao", "miao", "bau", "frau").save
        Note.new("ciao", "miao", "bau", "frau").save
      end
      it "should return the correct count" do
        Note.count.should == 3
      end
    end
  end

  context ".find_all" do
    context "with no notes in the database" do
      it "should return 0" do
        Note.find_all("Foo").should == []
      end
    end
    context "with some notes by in the database" do
      let(:foo){ Note.create("Foo", "miao", "bau", "frau") }
      let(:baz){ Note.create("Baz", "miao", "bau", "frau") }
      before do
        foo
        baz
        Note.new("Bar", "xxx", "yyy", "frau").save
        Note.new("Baz", "miao", "bau", "frau").save
        Note.new("Grille", "ccc", "vvv", "frau").save
      end
      it "should return the note with that title" do
        Note.find_all("bau").length.should == 3
      end
    end
  end

  context ".find_by_title" do
    context "with no notes in the database" do
      it "should return 0" do
        Note.find_by_title("Foo").should be_nil
      end
    end
    context "with a note by that title in the database" do
      let(:foo){ Note.create("Foo", "miao", "bau", "frau") }
      let(:baz){ Note.create("Baz", "miao", "bau", "frau") }
      before do
        foo
        baz
        Note.new("Bar", "xxx", "yyy", "frau").save
        Note.new("Baz", "miao", "bau", "frau").save
        Note.new("Grille", "ccc", "vvv", "frau").save
      end
      it "should return the note with that title" do
        Note.find_by_title("Foo").id.should == foo.id
      end
      it "should do the same for baz" do
        Note.find_by_title("Baz").id.should == baz.id
      end
      it "should return the note with that title" do
        Note.find_by_title("Foo").title.should == foo.title
      end
    end
  end

  context ".find_by_title_user" do
    context "with no notes in the database" do
      it "should return 0" do
        Note.find_by_title_user("Foo", "stuff").should be_nil
      end
    end
    context "with a note by that title in the database" do
      let(:foo){ Note.create("Foo", "miao", "bau", "frau") }
      let(:baz){ Note.create("Baz", "miao", "bau", "frau") }
      before do
        foo
        baz
        Note.new("Bar", "xxx", "yyy", "frau").save
        Note.new("Baz", "miao", "bau", "frau").save
        Note.new("Grille", "ccc", "vvv", "frau").save
      end
      it "should return the note with that title" do
        Note.find_by_title_user("Foo", "bau").id.should == foo.id
      end
      it "should do the same for baz" do
        Note.find_by_title_user("Baz", "bau").id.should == baz.id
      end
      it "should return the note with that title" do
        Note.find_by_title_user("Foo", "bau").title.should == foo.title
      end
    end
  end

  context ".find_by_tag" do
    context "with some notes in the database" do
      before do
        Note.new("Bar", "xxx", "yyy", "frau").save
        Note.new("Rol", "xxx", "yyy", "miao").save
        Note.new("Baz", "miao", "bau", "frau").save
        Note.new("Grille", "ccc", "vvv", "frau").save
      end
      it "should return 2" do
        Note.find_by_tag("xxx", "yyy").length.should == 2
      end
      it "should return 1" do
        Note.find_by_tag("miao", "bau").length.should == 1
      end
      it "should return 1" do
        Note.find_by_tag("ccc", "vvv").length.should == 1
      end
    end
  end

  context ".update" do
    context "after updating the body on a note" do
      before do
        Note.new("Bar", "xxx", "yyy", "frau").save
        Note.new("Rol", "xxx", "yyy", "miao").save
        Note.new("Baz", "miao", "bau", "frau").save
        Note.new("Grille", "ccc", "vvv", "").save
      end
      #it "should return 2" do
      #  Note.update("yyy", "Bar", "bluher")[3].should == "frau bluher"
      #end
      it "should return 1" do
        Note.find_by_tag("miao", "bau").length.should == 1
      end
      it "should return 1" do
        Note.find_by_tag("ccc", "vvv").length.should == 1
      end
    end
  end

  context ".last" do
    context "with no notes in the database" do
      it "should return nil" do
        Note.last.should be_nil
      end
    end
    context "with multiple notes in the database" do
      before do
        Note.new("Ryu", "xxx", "aaa", "frau").save
        Note.new("Ken", "xxx", "aaa", "frau").save
        Note.new("Akuma", "xxx", "aaa", "frau").save
        Note.new("Gouki", "xxx", "aaa", "frau").save
      end
      it "should return the last one inserted" do
        Note.last.title.should == "Gouki"
      end
      it "should return the last one inserted" do
        Note.last.tag.should == "xxx"
      end
      it "should return the last one inserted" do
        Note.last.user_name.should == "aaa"
      end
      it "should return the last one inserted" do
        Note.last.body.should == "frau"
      end
    end
  end

  context "#new" do
    let(:note) { Note.new("Ryu", "xxx", "aaa", "frau") }
    it "should store the title" do
      note.title.should == "Ryu"
    end
    it "should store the title" do
      note.tag.should == "xxx"
    end
    it "should store the title" do
      note.user_name.should == "aaa"
    end
    it "should store the title" do
      note.body.should == "frau"
    end
  end
end


text:
{{<layout}}

{{$pageTitle}}
  GAIN CAPITAL Design Kit
{{/pageTitle}}

{{$content}}

  <link href="/public/stylesheets/application.css" media="screen" rel="stylesheet" type="text/css" />

Fund Account

You can add funds to your account using various payment methods from within the platform at any time.

Open the funding page from the [Platform] menu then follow the instructions provided to use BACS, CHAPS, Cheque, and Debit/Credit Card methods.

Please Rate this Page

In order to help us improve the content, please rate whether you found it helpful and useful.

</>

You can leave any additional comments in the field provided.

Other Platform Features

Chart Profiles

Platform Workspaces

Price Tolerance

Price Alerts

Research

Fund Account

  </form>

{{/content}}

{{/layout}}


text:
package com.att.m2x.android.utils;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;

/**
 * Created by Joaquin on 2/12/14.
 */
public class ArrayUtils {

    public static final String mapToQueryString(HashMap<String,String> queryString){
        StringBuilder sb = new StringBuilder();
        try {
            for(HashMap.Entry<String, String> e : queryString.entrySet()){
                if(sb.length() > 0){
                    sb.append('&');
                }
                sb.append(URLEncoder.encode(e.getKey(), "UTF-8")).append('=').append(URLEncoder.encode(e.getValue(), "UTF-8"));
            }
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        }
        return sb.toString();
    }

}


text:
module.exports = (opts) => {
  const optsDefault = {
    bem: {
      blockPrefix: '_',
      elementPrefix: '__',
      modifirePrefix: '--'
    },
    suitecss: {
      blockPrefix: '_',
      elementPrefix: '-',
      modifirePrefix: '--'
    }
  }
  if (!opts) {
    opts = optsDefault.bem
  } else if (opts.preset && Object.keys(optsDefault).includes(opts.preset)) {
    opts = optsDefault[opts.preset]
  }
  const patternBlock = new RegExp(`(^| )${opts.blockPrefix}(?!${opts.blockPrefix.slice(0, 1)})([^\\s]+)`)
  const patternModifire = new RegExp(`(^| )(${opts.modifirePrefix}(?!${opts.modifirePrefix.slice(0, 1)})[^\\s]+)`, 'g')
  const patternElement = new RegExp(`(^| )(${opts.elementPrefix}(?!${opts.elementPrefix.slice(0, 1)})[^\\s]+)`)

  const walk = (node, blockName) => {
    const existClass = !!node.attrs && !!node.attrs.class
    const isBlock = existClass && patternBlock.test(node.attrs.class)
    const isElement = existClass && patternElement.test(node.attrs.class)

    if (isBlock) {
      blockName = blockName || node.attrs.class.match(patternBlock)[2]
      node.attrs.class = node.attrs.class.replace(patternBlock, '$1$2')
      node.attrs.class = node.attrs.class.replace(patternModifire, `$1${blockName}$2`)
    }
    if (isElement) {
      const element = node.attrs.class.match(patternElement)[2]
      node.attrs.class = node.attrs.class.replace(patternElement, `$1${blockName}$2`)
      node.attrs.class = node.attrs.class.replace(patternModifire, `$1${blockName}${element}$2`)
    }
    if (!node.content) {
      return
    }
    node.content.forEach((node) => {
      const isBlock = !!node.attrs && !!node.attrs.class && patternBlock.test(node.attrs.class)
      if (node.tag && !isBlock) {
        walk(node, blockName)
      }
    })
  }
  return (tree) => {
    tree.match({attrs: {class: patternBlock}}, (node) => {
      walk(node)
      return node
    })
    return tree
  }
}


text:
package apple.metalperformanceshaders;

import apple.NSObject;
import apple.foundation.NSArray;
import apple.foundation.NSCoder;
import apple.foundation.NSMethodSignature;
import apple.foundation.NSSet;
import apple.metal.protocol.MTLCommandBuffer;
import apple.metal.protocol.MTLDevice;
import org.moe.natj.c.ann.FunctionPtr;
import org.moe.natj.general.NatJ;
import org.moe.natj.general.Pointer;
import org.moe.natj.general.ann.Generated;
import org.moe.natj.general.ann.Library;
import org.moe.natj.general.ann.Mapped;
import org.moe.natj.general.ann.NInt;
import org.moe.natj.general.ann.NUInt;
import org.moe.natj.general.ann.Owned;
import org.moe.natj.general.ann.Runtime;
import org.moe.natj.general.ptr.VoidPtr;
import org.moe.natj.objc.Class;
import org.moe.natj.objc.ObjCRuntime;
import org.moe.natj.objc.SEL;
import org.moe.natj.objc.ann.ObjCClassBinding;
import org.moe.natj.objc.ann.ProtocolClassMethod;
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.map.ObjCObjectMapper;

/**
 * MPSMatrixFullyConnectedGradient
 *

 * [@dependency] This depends on Metal.framework.
 *

 * Computes the gradient of the fully connected layer with respect
 * to either the weights and bias terms or the input feature vectors.
 *

 * An MPSMatrixFullyConnectedGradient kernel may be used to compute
 * the gradients corresponding to a MPSMatrixFullyConnected kernel.
 * The properties, input, and weight data must match those values
 * used in the forward computation.
 * This kernel does not compute the gradient of any non-identity
 * activation function which may have been applied in the forward
 * kernel. Such a kernel must be expressed using both MPSMatrixFullyConnected
 * and MPSMatrixNeuron if a gradient is to be computed.
 */
@Generated
@Library("MetalPerformanceShaders")
@Runtime(ObjCRuntime.class)
@ObjCClassBinding
public class MPSMatrixFullyConnectedGradient extends MPSMatrixBinaryKernel {
    static {
        NatJ.register();
    }

    @Generated
    protected MPSMatrixFullyConnectedGradient(Pointer peer) {
        super(peer);
    }

    @Generated
    @Selector("accessInstanceVariablesDirectly")
    public static native boolean accessInstanceVariablesDirectly();

    @Generated
    @Owned
    @Selector("alloc")
    public static native MPSMatrixFullyConnectedGradient alloc();

    @Owned
    @Generated
    @Selector("allocWithZone:")
    public static native MPSMatrixFullyConnectedGradient allocWithZone(VoidPtr zone);

    /**
     * [@property] alpha
     *

     * Scale factor to apply to the product. This value should be equal
     * to the corresponding value in the forward fully connected kernel.
     */
    @Generated
    @Selector("alpha")
    public native double alpha();

    @Generated
    @Selector("automaticallyNotifiesObserversForKey:")
    public static native boolean automaticallyNotifiesObserversForKey(String key);

    @Generated
    @Selector("cancelPreviousPerformRequestsWithTarget:")
    public static native void cancelPreviousPerformRequestsWithTarget(@Mapped(ObjCObjectMapper.class) Object aTarget);

    @Generated
    @Selector("cancelPreviousPerformRequestsWithTarget:selector:object:")
    public static native void cancelPreviousPerformRequestsWithTargetSelectorObject(
            @Mapped(ObjCObjectMapper.class) Object aTarget, SEL aSelector,
            @Mapped(ObjCObjectMapper.class) Object anArgument);

    @Generated
    @Selector("classFallbacksForKeyedArchiver")
    public static native NSArray<String> classFallbacksForKeyedArchiver();

    @Generated
    @Selector("classForKeyedUnarchiver")
    public static native Class classForKeyedUnarchiver();

    /**
     * Make a copy of this kernel for a new device - @see MPSKernel
     *
     * @param zone   The NSZone in which to allocate the object
     * @param device The device for the new MPSKernel. If nil, then use
     *               self.device.
     * @return A pointer to a copy of this MPSKernel. This will fail, returning
     *         nil if the device is not supported. Devices must be
     *         MTLFeatureSet_iOS_GPUFamily2_v1 or later.
     */
    @Generated
    @Owned
    @Selector("copyWithZone:device:")
    public native MPSMatrixFullyConnectedGradient copyWithZoneDevice(VoidPtr zone,
            @Mapped(ObjCObjectMapper.class) MTLDevice device);

    @Generated
    @Selector("debugDescription")
    public static native String debugDescription_static();

    @Generated
    @Selector("description")
    public static native String description_static();

    /**
     * Encode a MPSMatrixFullyConnectedGradient object to a command buffer and
     * produce the gradient of the loss function with respect to the input data.
     *

     * This operation computes the resulting gradient of the loss function with respect
     * to the forward kernel's input data. weightMatrix should contain the same values
     * used to compute the result of the forward kernel.
     *
     * @param commandBuffer               A valid MTLCommandBuffer to receive the encoded kernel.
     * @param gradientMatrix              A valid MPSMatrix object which specifies the input gradient.
     * @param weightMatrix                A valid MPSMatrix object which specifies the weight array.
     * @param resultGradientForDataMatrix A valid MPSMatrix object which specifies the result gradient.
     */
    @Generated
    @Selector("encodeGradientForDataToCommandBuffer:gradientMatrix:weightMatrix:resultGradientForDataMatrix:")
    public native void encodeGradientForDataToCommandBufferGradientMatrixWeightMatrixResultGradientForDataMatrix(
            @Mapped(ObjCObjectMapper.class) MTLCommandBuffer commandBuffer, MPSMatrix gradientMatrix,
            MPSMatrix weightMatrix, MPSMatrix resultGradientForDataMatrix);

    /**
     * Encode a MPSMatrixFullyConnectedGradient object to a command buffer and
     * produce the gradient of the loss function with respect to the weight matrix
     * and bias vector.
     *

     * This operation computes the resulting gradient of the loss function with respect
     * to the forward kernel's weight data. inputMatrix should contain the same values
     * used to compute the result of the forward kernel.
     *
     * @param commandBuffer                 A valid MTLCommandBuffer to receive the encoded kernel.
     * @param gradientMatrix                A valid MPSMatrix object which specifies the input gradient.
     * @param inputMatrix                   A valid MPSMatrix object which specifies the input array.
     * @param resultGradientForWeightMatrix A valid MPSMatrix object which specifies the resulting gradients
     *                                      with respect to the weights.
     * @param resultGradientForBiasVector   A valid MPSVector object which specifies the resulting gradients
     *                                      with respect to the bias terms. If NULL these values will not be
     *                                      returned.
     */
    @Generated
    @Selector("encodeGradientForWeightsAndBiasToCommandBuffer:gradientMatrix:inputMatrix:resultGradientForWeightMatrix:resultGradientForBiasVector:")
    public native void encodeGradientForWeightsAndBiasToCommandBufferGradientMatrixInputMatrixResultGradientForWeightMatrixResultGradientForBiasVector(
            @Mapped(ObjCObjectMapper.class) MTLCommandBuffer commandBuffer, MPSMatrix gradientMatrix,
            MPSMatrix inputMatrix, MPSMatrix resultGradientForWeightMatrix, MPSVector resultGradientForBiasVector);

    @Generated
    @Selector("hash")
    @NUInt
    public static native long hash_static();

    @Generated
    @Selector("init")
    public native MPSMatrixFullyConnectedGradient init();

    @Generated
    @Selector("initWithCoder:")
    public native MPSMatrixFullyConnectedGradient initWithCoder(NSCoder aDecoder);

    /**
     * NSSecureCoding compatability
     *

     * See @ref MPSKernel#initWithCoder.
     *
     * @param aDecoder The NSCoder subclass with your serialized MPSMatrixFullyConnectedGradient
     * @param device   The MTLDevice on which to make the MPSMatrixFullyConnectedGradient object.
     * @return A new MPSMatrixFullyConnected object, or nil if failure.
     */
    @Generated
    @Selector("initWithCoder:device:")
    public native MPSMatrixFullyConnectedGradient initWithCoderDevice(NSCoder aDecoder,
            @Mapped(ObjCObjectMapper.class) Object device);

    @Generated
    @Selector("initWithDevice:")
    public native MPSMatrixFullyConnectedGradient initWithDevice(@Mapped(ObjCObjectMapper.class) Object device);

    @Generated
    @Selector("instanceMethodForSelector:")
    @FunctionPtr(name = "call_instanceMethodForSelector_ret")
    public static native NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(SEL aSelector);

    @Generated
    @Selector("instanceMethodSignatureForSelector:")
    public static native NSMethodSignature instanceMethodSignatureForSelector(SEL aSelector);

    @Generated
    @Selector("instancesRespondToSelector:")
    public static native boolean instancesRespondToSelector(SEL aSelector);

    @Generated
    @Selector("isSubclassOfClass:")
    public static native boolean isSubclassOfClass(Class aClass);

    @Generated
    @Selector("keyPathsForValuesAffectingValueForKey:")
    public static native NSSet<String> keyPathsForValuesAffectingValueForKey(String key);

    @Generated
    @Owned
    @Selector("new")
    public static native MPSMatrixFullyConnectedGradient new_objc();

    @Generated
    @Selector("resolveClassMethod:")
    public static native boolean resolveClassMethod(SEL sel);

    @Generated
    @Selector("resolveInstanceMethod:")
    public static native boolean resolveInstanceMethod(SEL sel);

    /**
     * [@property] alpha
     *

     * Scale factor to apply to the product. This value should be equal
     * to the corresponding value in the forward fully connected kernel.
     */
    @Generated
    @Selector("setAlpha:")
    public native void setAlpha(double value);

    /**
     * [@property] sourceInputFeatureChannels
     *

     * The number of feature channels in the input to the forward
     * fully connected layer.
     * This is equivalent to the number of columns in the input matrix.
     *

     * This value should be equal to the corresponding value in the
     * forward fully connected kernel.
     */
    @Generated
    @Selector("setSourceInputFeatureChannels:")
    public native void setSourceInputFeatureChannels(@NUInt long value);

    /**
     * [@property] sourceNumberOfFeatureVectors
     *

     * The number of input vectors which make up the input array.
     * This is equivalent to the number of rows in both the input
     * matrix and the source gradient matrix.
     *

     * This value should be equal to the corresponding value in the
     * forward fully connected kernel.
     */
    @Generated
    @Selector("setSourceNumberOfFeatureVectors:")
    public native void setSourceNumberOfFeatureVectors(@NUInt long value);

    /**
     * [@property] sourceOutputFeatureChannels
     *

     * The number of feature channels in the output of the forward
     * fully connected layer.
     * This is equivalent to the number of columns in both the weight
     * matrix and the source gradient matrix.
     *

     * This value should be equal to the corresponding value in the
     * forward fully connected kernel.
     */
    @Generated
    @Selector("setSourceOutputFeatureChannels:")
    public native void setSourceOutputFeatureChannels(@NUInt long value);

    @Generated
    @Selector("setVersion:")
    public static native void setVersion_static(@NInt long aVersion);

    /**
     * [@property] sourceInputFeatureChannels
     *

     * The number of feature channels in the input to the forward
     * fully connected layer.
     * This is equivalent to the number of columns in the input matrix.
     *

     * This value should be equal to the corresponding value in the
     * forward fully connected kernel.
     */
    @Generated
    @Selector("sourceInputFeatureChannels")
    @NUInt
    public native long sourceInputFeatureChannels();

    /**
     * [@property] sourceNumberOfFeatureVectors
     *

     * The number of input vectors which make up the input array.
     * This is equivalent to the number of rows in both the input
     * matrix and the source gradient matrix.
     *

     * This value should be equal to the corresponding value in the
     * forward fully connected kernel.
     */
    @Generated
    @Selector("sourceNumberOfFeatureVectors")
    @NUInt
    public native long sourceNumberOfFeatureVectors();

    /**
     * [@property] sourceOutputFeatureChannels
     *

     * The number of feature channels in the output of the forward
     * fully connected layer.
     * This is equivalent to the number of columns in both the weight
     * matrix and the source gradient matrix.
     *

     * This value should be equal to the corresponding value in the
     * forward fully connected kernel.
     */
    @Generated
    @Selector("sourceOutputFeatureChannels")
    @NUInt
    public native long sourceOutputFeatureChannels();

    @Generated
    @Selector("superclass")
    public static native Class superclass_static();

    @Generated
    @Selector("supportsSecureCoding")
    public static native boolean supportsSecureCoding();

    @Generated
    @ProtocolClassMethod("supportsSecureCoding")
    public boolean _supportsSecureCoding() {
        return supportsSecureCoding();
    }

    @Generated
    @Selector("version")
    @NInt
    public static native long version_static();
}


text:
<?php

require_once(dmOs::join(sfConfig::get('dm_core_dir'), 'lib/vendor/gapi/gapi.class.php'));

class dmGapi extends gapi
{
  protected
  $cacheManager,
  $reportId,
  $defaultReportOptions;

  public function __construct(dmCacheManager $cacheManager)
  {
    $this->cacheManager = $cacheManager;
  }

  /**
   * Set up authenticate with Google and get auth_token
   *
   * @param String $email
   * @param String $password
   * @param String $token
   * @return gapi
   */
  public function authenticate($email, $password, $token = null)
  {
    if (!($email && $password) && !$token)
    {
      throw new dmGapiException('No google analytics account configured');
    }

    $this->reportId = null;

    if($token !== null)
    {
      $this->auth_token = $token;
    }
    else
    {
      $this->authenticateUser($email, $password);
    }

    $this->getReportId();

    return $this;
  }

  public function getTotalPageViews()
  {
    $report = $this->getReport(array(
      'dimensions'  => array('year'),
      'metrics'     => array('pageviews')
    ));

    $pageviews = 0;
    foreach($report as $entry)
    {
      $pageviews += $entry->get('pageviews');
    }

    unset($report);

    return $pageviews;
  }

  public function getReport(array $options)
  {
    $options = array_merge($this->getDefaultReportOptions(), $options);

    return $this->requestReportData(
    $this->getReportId(),
    $options['dimensions'],
    $options['metrics'],
    $options['sort_metric'],
    $options['filter'],
    $options['start_date'],
    $options['end_date'],
    $options['start_index'],
    $options['max_results']
    );
  }

  public function getDefaultReportOptions()
  {
    if (null === $this->defaultReportOptions)
    {
      $this->defaultReportOptions = array(
        'dimensions'  => array(),
        'metrics'     => array(),
        'sort_metric' => null,
        'filter'      => null,
        'start_date'  => date('Y-m-d',strtotime('11 months ago')),
        'end_date'    => null,
        'start_index' => 1,
        'max_results' => 30
      );
    }

    return $this->defaultReportOptions;
  }

  public function getReportId()
  {
    if ($this->reportId)
    {
      return $this->reportId;
    }

    if (!$gaKey = dmConfig::get('ga_key'))
    {
      throw new dmGapiException('You must configure a ga_key in the configuration panel');
    }

    $start_index = 1;

    while($accounts = $this->requestAccountData($start_index++))
    {
      foreach($accounts as $account)
      {
        if ($account->getWebPropertyId() === $gaKey)
        {
          return $this->reportId = $account->getProfileId();
        }
      }
    }

    throw new dmGapiException('Current report not found for ga key : '.$gaKey);
  }

  public function setCacheManager(dmCacheManager $cacheManager)
  {
    $this->cacheManager = $cacheManager;
  }

  /**
   * Request account data from Google Analytics
   *
   * @param Int $start_index OPTIONAL: Start index of results
   * @param Int $max_results OPTIONAL: Max results returned
   */
  public function requestAccountData($start_index=1, $max_results=20)
  {
    if ($this->cacheManager)
    {
      $cacheKey = 'account-data-'.$start_index.'-to-'.$max_results;

      if ($this->cacheManager->getCache('gapi/request')->has($cacheKey))
      {
        return $this->cacheManager->getCache('gapi/request')->get($cacheKey);
      }
    }

    try
    {
      $result = parent::requestAccountData($start_index, $max_results);
    }
    catch(Exception $e)
    {
      throw new dmGapiException($e->getMessage());
    }

    if ($this->cacheManager)
    {
      $this->cacheManager->getCache('gapi/request')->set($cacheKey, $result);
    }

    return $result;
  }

  /**
   * Request report data from Google Analytics
   *
   * $report_id is the Google report ID for the selected account
   *
   * $parameters should be in key => value format
   *
   * @param String $report_id
   * @param Array $dimensions Google Analytics dimensions e.g. array('browser')
   * @param Array $metrics Google Analytics metrics e.g. array('pageviews')
   * @param Array $sort_metric OPTIONAL: Dimension or dimensions to sort by e.g.('-visits')
   * @param String $filter OPTIONAL: Filter logic for filtering results
   * @param String $start_date OPTIONAL: Start of reporting period
   * @param String $end_date OPTIONAL: End of reporting period
   * @param Int $start_index OPTIONAL: Start index of results
   * @param Int $max_results OPTIONAL: Max results returned
   */
  public function requestReportData($report_id, $dimensions, $metrics, $sort_metric=null, $filter=null, $start_date=null, $end_date=null, $start_index=1, $max_results=30)
  {
    if ($this->cacheManager)
    {
      $cacheKey = 'report-data-'.md5(serialize(func_get_args()));

      if ($this->cacheManager->getCache('gapi/request')->has($cacheKey))
      {
        return $this->cacheManager->getCache('gapi/request')->get($cacheKey);
      }
    }

    $result = parent::requestReportData($report_id, $dimensions, $metrics, $sort_metric, $filter, $start_date, $end_date, $start_index, $max_results);

    if ($this->cacheManager)
    {
      $this->cacheManager->getCache('gapi/request')->set($cacheKey, $result);
    }

    return $result;
  }

  /**
   * Authenticate Google Account with Google
   *
   * @param String $email
   * @param String $password
   */
  protected function authenticateUser($email, $password)
  {
    try
    {
      return parent::authenticateUser($email, $password);
    }
    catch(Exception $e)
    {
      throw new dmGapiException('GAPI: Failed to authenticate with email '.$email.'. Please configure email and password in the admin configuration panel');
    }
  }

  /**
   * Report Object Mapper to convert the XML to array of useful PHP objects
   *
   * @param String $xml_string
   * @return Array of gapiReportEntry objects
   */
  protected function reportObjectMapper($xml_string)
  {
    $xml = simplexml_load_string($xml_string);

    $this->results = null;
    $results = array();

    $report_root_parameters = array();
    $report_aggregate_metrics = array();

    //Load root parameters

    $report_root_parameters['updated'] = strval($xml->updated);
    $report_root_parameters['generator'] = strval($xml->generator);
    $report_root_parameters['generatorVersion'] = strval($xml->generator->attributes());

    $open_search_results = $xml->children('http://a9.com/-/spec/opensearchrss/1.0/');

    foreach($open_search_results as $key => $open_search_result)
    {
      $report_root_parameters[$key] = intval($open_search_result);
    }

    $google_results = $xml->children('http://schemas.google.com/analytics/2009');

    foreach($google_results->dataSource->property as $property_attributes)
    {
      $report_root_parameters[str_replace('ga:','',$property_attributes->attributes()->name)] = strval($property_attributes->attributes()->value);
    }

    $report_root_parameters['startDate'] = strval($google_results->startDate);
    $report_root_parameters['endDate'] = strval($google_results->endDate);

    //Load result aggregate metrics

    foreach($google_results->aggregates->metric as $aggregate_metric)
    {
      $metric_value = strval($aggregate_metric->attributes()->value);

      //Check for float, or value with scientific notation
      if(preg_match('/^(\d+\.\d+)|(\d+E\d+)|(\d+.\d+E\d+)$/',$metric_value))
      {
        $report_aggregate_metrics[str_replace('ga:','',$aggregate_metric->attributes()->name)] = floatval($metric_value);
      }
      else
      {
        $report_aggregate_metrics[str_replace('ga:','',$aggregate_metric->attributes()->name)] = intval($metric_value);
      }
    }

    //Load result entries

    foreach($xml->entry as $entry)
    {
      $metrics = array();
      foreach($entry->children('http://schemas.google.com/analytics/2009')->metric as $metric)
      {
        $metric_value = strval($metric->attributes()->value);

        //Check for float, or value with scientific notation
        if(preg_match('/^(\d+\.\d+)|(\d+E\d+)|(\d+.\d+E\d+)$/',$metric_value))
        {
          $metrics[str_replace('ga:','',$metric->attributes()->name)] = floatval($metric_value);
        }
        else
        {
          $metrics[str_replace('ga:','',$metric->attributes()->name)] = intval($metric_value);
        }
      }

      $dimensions = array();
      foreach($entry->children('http://schemas.google.com/analytics/2009')->dimension as $dimension)
      {
        $dimensions[str_replace('ga:','',$dimension->attributes()->name)] = strval($dimension->attributes()->value);
      }

      $results[] = new dmGapiReportEntry($metrics,$dimensions);
    }

    $this->report_root_parameters = $report_root_parameters;
    $this->report_aggregate_metrics = $report_aggregate_metrics;
    $this->results = $results;

    return $results;
  }
}


text:
def testAndPrint(got, expected):
    if got == expected:
        test.expect(True)
    else:
        print "
Got '%s', expected '%s'
" % (got, expected)
        test.expect(False)

test.describe('Example from description')
testAndPrint(decodeMorse('.... . -.--   .--- ..- -.. .'), 'HEY JUDE')