text:
/* 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.
 */

package org.camunda.bpm.engine.impl.pvm.runtime;

import java.util.List;

import org.camunda.bpm.engine.delegate.ExecutionListener;
import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl;
import org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl;
import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl;
import org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext;

/**
 * @author Tom Baeyens
 * @author Daniel Meyer
 */
public class AtomicOperationProcessStart extends AbstractEventAtomicOperation {

  @Override
  public boolean isAsync(InterpretableExecution execution) {
    ProcessInstanceStartContext startContext = execution.getProcessInstanceStartContext();
    if (startContext != null && startContext.isAsync()) {
      return true;
    }
    return false;
  }

  @Override
  protected ScopeImpl getScope(InterpretableExecution execution) {
    return execution.getProcessDefinition();
  }

  @Override
  protected String getEventName() {
    return org.camunda.bpm.engine.impl.pvm.PvmEvent.EVENTNAME_START;
  }

  protected void eventNotificationsStarted(InterpretableExecution execution) {
    // Note: the following method call initializes the property
    // "processInstanceStartContext" on the given execution.
    // Do not remove it!
    execution.getProcessInstanceStartContext();
  }

  protected void eventNotificationsCompleted(InterpretableExecution execution) {
    ProcessDefinitionImpl processDefinition = execution.getProcessDefinition();
    ProcessInstanceStartContext processInstanceStartContext = execution.getProcessInstanceStartContext();
    List<ActivityImpl> initialActivityStack = processDefinition.getInitialActivityStack(processInstanceStartContext.getInitial());
    execution.setActivity(initialActivityStack.get(0));
    execution.performOperation(PROCESS_START_INITIAL);
  }

  @Override
  public String getCanonicalName() {
    return "process-start";
  }

}


text:
using System;
using System.Net;
using System.Net.Sockets;

namespace TestEasy.Core.Abstractions
{
    /// <summary>
    ///     Abstraction to deal with Environment
    /// </summary>
    public class EnvironmentSystem : IEnvironmentSystem
    {
        public string ExpandEnvironmentVariables(string environmentVariable)
        {
            return Environment.ExpandEnvironmentVariables(environmentVariable);
        }

        public int GetNextAvailablePort(int usedPort = 0)
        {
            const int lowerAddressRangeBoundary = 2048;
            const int higherAddressRangeBoundary = 3072;
            var r = new Random(unchecked((int)DateTime.Now.Ticks));
            int port;

            do
            {
                port = r.Next(lowerAddressRangeBoundary, higherAddressRangeBoundary);

            } while (IsLocalTcpPortInUse(port)  || port == usedPort);

            return port;
        }

        public Version OSVersion
        {
            get
            {
                return Environment.OSVersion.Version;
            }
        }

        public string MachineName
        {
            get { return Environment.MachineName; }
        }

        public bool Is64BitOperatingSystem
        {
            get { return Environment.Is64BitOperatingSystem;  }
        }

        private bool IsLocalTcpPortInUse(int port)
        {
            bool result;

            var ipAddress = Dns.GetHostEntry("127.0.0.1").AddressList[0];
            var ipe = new IPEndPoint(ipAddress, port);
            var socket = new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp);

            try
            {
                socket.Connect(ipe);
                result = socket.Connected;
            }
            catch (SocketException)
            {
                result = false;
            }
            finally
            {
                if (socket.Connected)
                {
                    socket.Shutdown(SocketShutdown.Both);
                }
            }

            return result;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
var _ = require("underscore");

function Config() {
	this.get = function() {
		var file = require("./installer/settings.json");

		if(_.isObject(file) && !_.isEmpty(file)) {
			return file;
		}
		else {
			console.log("Mariachi is not configured, enabling installer, go to http://yoursite:port/install to install Mariachi");
			return false;
		}
	}
}

module.exports = new Config().get();


text:
describe("Control", function() {
    beforeEach(function(){
        // cleanup - make sure global theme is not set
        GOWN.Theme.removeTheme();
        new GOWN.TestTheme();
    });

    it("get mouse position", function() {
        var fake_mouse_event = {};
        fake_mouse_event.data = new PIXI.interaction.InteractionData();
        fake_mouse_event.type = "mousedown";
        fake_mouse_event.stoped = false;
        fake_mouse_event.data.global.x = 1337;
        fake_mouse_event.data.global.y = 42;

        var control = new GOWN.Control();
        var pos = control.mousePos(fake_mouse_event);
        expect(fake_mouse_event.data.global.x).equal(pos.x);
        expect(fake_mouse_event.data.global.y).equal(pos.y);
    });
});


text:
"""Tests for the swig wrapper of clusters."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow.python.framework import meta_graph
from tensorflow.python.framework import ops
from tensorflow.python.grappler import cluster
from tensorflow.python.grappler import item
from tensorflow.python.ops import random_ops
from tensorflow.python.platform import test

class ClusterTest(test.TestCase):

  def testBasic(self):
    with ops.Graph().as_default() as g:
      a = random_ops.random_uniform(shape=())
      b = random_ops.random_uniform(shape=())
      c = a + b
      train_op = ops.get_collection_ref(ops.GraphKeys.TRAIN_OP)
      train_op.append(c)
      mg = meta_graph.create_meta_graph_def(graph=g)
      grappler_item = item.Item(mg)
      grappler_cluster = cluster.Cluster(
          disable_detailed_stats=False, disable_timeline=False)
      op_perfs, run_time, step_stats = grappler_cluster.MeasureCosts(
          grappler_item)
      self.assertTrue(run_time > 0)
      self.assertEqual(len(op_perfs), 10)
      self.assertTrue(step_stats.dev_stats)

  def testNoDetailedStats(self):
    with ops.Graph().as_default() as g:
      a = random_ops.random_uniform(shape=())
      b = random_ops.random_uniform(shape=())
      c = a + b
      train_op = ops.get_collection_ref(ops.GraphKeys.TRAIN_OP)
      train_op.append(c)
      mg = meta_graph.create_meta_graph_def(graph=g)
      grappler_item = item.Item(mg)
      grappler_cluster = cluster.Cluster(disable_detailed_stats=True)

      op_perfs, run_time, step_stats = grappler_cluster.MeasureCosts(
          grappler_item)
      self.assertTrue(run_time > 0)
      self.assertEqual(len(op_perfs), 0)
      self.assertEqual(len(step_stats.dev_stats), 0)

  def testMemoryEstimates(self):
    with ops.Graph().as_default() as g:
      with ops.device('/job:localhost/replica:0/task:0/cpu:0'):
        a = random_ops.random_uniform(shape=())
        b = random_ops.random_uniform(shape=())
        c = a + b
        train_op = ops.get_collection_ref(ops.GraphKeys.TRAIN_OP)
        train_op.append(c)
        mg = meta_graph.create_meta_graph_def(graph=g)
        grappler_item = item.Item(mg)
        grappler_cluster = cluster.Cluster(
            disable_detailed_stats=True, disable_timeline=True)
        peak_mem = grappler_cluster.DeterminePeakMemoryUsage(grappler_item)
        self.assertLessEqual(1, len(peak_mem))
        snapshot = peak_mem['/job:localhost/replica:0/task:0/cpu:0']
        peak_usage = snapshot[0]
        self.assertEqual(52, peak_usage)
        live_tensors = snapshot[1]
        self.assertEqual(15, len(live_tensors))

if __name__ == '__main__':
  test.main()


text:
[![NPM version][npm-image]][npm-url]
[![Dependency status][dependency-image]][dependency-url]
[![devDependency status][devdependency-image]][devdependency-url]

Currently you must use the `--harmony` flag when running node 0.11.x to get access to generators.

You can chat with me. Thanks to [gitter](https://gitter.im/yamb).

[![Gitter chat](https://badges.gitter.im/yamb.png)](https://gitter.im/yamb)

## Installation

_TO BE DONE_

## Examples

_TO BE DONE_

## API

_TO BE DONE_

## Author

  - [Alexey Simonenko](https://github.com/meritt)

## License

The MIT License, see the included `license.md` file.

[npm-image]: https://img.shields.io/npm/v/yamb-express.svg?style=flat
[npm-url]: https://npmjs.org/package/yamb-express
[dependency-image]: https://img.shields.io/david/yamb/yamb-express.svg?style=flat
[dependency-url]: https://david-dm.org/yamb/yamb-express
[devdependency-image]: https://img.shields.io/david/dev/yamb/yamb-express.svg?style=flat
[devdependency-url]: https://david-dm.org/yamb/yamb-express#info=devDependencies


text:
#ifndef WEBRTC_VOICE_ENGINE_VOE_CPU_TEST_H
#define WEBRTC_VOICE_ENGINE_VOE_CPU_TEST_H

#include "voe_standard_test.h"

namespace voetest {

class VoETestManager;

class VoECpuTest {
 public:
  VoECpuTest(VoETestManager& mgr);
  ~VoECpuTest() {}
  int DoTest();
 private:
  VoETestManager& _mgr;
};

} // namespace voetest

#endif // WEBRTC_VOICE_ENGINE_VOE_CPU_TEST_H


text:
Managing Jobs
~~~~~~~~~~~~~

Jobs describe actions performed on data in BigQuery tables:

- Load data into a table
- Run a query against data in one or more tables
- Extract data from a table
- Copy a table

Listing jobs
^^^^^^^^^^^^

List jobs for a project with the
:func:`~google.cloud.bigquery.client.Client.list_jobs` method:

.. literalinclude:: ../samples/client_list_jobs.py
   :language: python
   :dedent: 4
   :start-after: [START bigquery_list_jobs]
   :end-before: [END bigquery_list_jobs]


text:
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/33bf1eb1-f008-409b-acfa-63bd7311478c/mini.png)](https://insight.sensiolabs.com/projects/33bf1eb1-f008-409b-acfa-63bd7311478c)
[![Build Status](https://travis-ci.org/Modelizer/Bank.svg?branch=CHAPTER-2)](https://travis-ci.org/Modelizer/Bank)

Idea to create this repository is to help developers to enhance there skills
and who want to learn new things in PHP beyond average coding.

Please remember branch will be treated as Chapter.

#### Topics which we will cover up:

* Directory Structure.
* SOLID and DRY Principle.
* PSR's standards.
* Raw Sql query vs ORM.
* Design patterns such as Repository, Command Oriented and much more.
* Security Checks.
* Tight Coding.
* PHP 7 (Will be covered in few chapters)
* Package building and injection.
* Database Normalization.
* Seeders and Migration.
* When to build custom framework.

##### Note:
* Repository is in development mode, more things can be added for more clarity.
* Contribute to make more clear understanding of programming concept and topic listed above.
* You can add your own topics if you need such as design patterns, but make sure example should be related to banking.


text:
public class BlankElement: EditorElement
{

    public BlankElement(): base(null)
    {

    }
    public override void OnGUI()
    {

    }
}


text:
module OptimalPayments
  module CustomerVault
    class Mandate < JsonObject

      attr_accessor :id
      attr_accessor :reference
      attr_accessor :bankAccountId
      attr_accessor :status
      attr_accessor :paymentToken
      attr_accessor :accountNumber
      attr_accessor :statusChangeDate
      attr_accessor :statusReasonCode
      attr_accessor :statusReason
      attr_accessor :profileID
    end
  end
end


text:
<!DOCTYPE html>

  <link href="http://gmpg.org/xfn/11" rel="profile">
  <meta http-equiv="content-type" content="text/html; charset=utf-8">

  <link rel="stylesheet" href="/public/font-awesome/css/font-awesome.min.css">

  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

  <title>

      Feedback · Home

  </title>

  <link rel="stylesheet" href="/public/css/poole.css">
  <link rel="stylesheet" href="/public/css/syntax.css">
  <link rel="stylesheet" href="/public/css/hyde.css">
  <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">

  <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/public/apple-touch-icon-144-precomposed.png">
                                 <link rel="shortcut icon" href="/public/favicon.ico">

  <link rel="alternate" type="application/rss+xml" title="RSS" href="/atom.xml">

		 Home

              About

              Projects

              Feedback

© 2014. All rights reserved.

Feedback

  We greatly appreciate our users' feedback. Please be honest and don't hesitate, we could listen! Directly e-mail us or fill the form below.

<form action="http://getsimpleform.com/messages?form_api_token=4fb6476dc833933b90361933203c40d1" class="form" id="form1" method="post">

 Name
            <input name="name">

            Email
            <input name="email" type="email">

            Message
            <textarea name="message" placeholder="Type your greatest feedback here! :-)"></textarea>

            <input id="submit" name="submit" type="submit" value="Submit">

        </form>


text:
package com.jaquadro.minecraft.storagedrawers.integration;

import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.api.registry.IWailaTooltipHandler;
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawersComp;
import cpw.mods.fml.common.event.FMLInterModComms;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaRegistrar;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;

import java.util.List;

/**
 * @author dmillerw
 * @author jaquadro
 */
public class Waila extends IntegrationModule
{
    @Override
    public String getModID () {
        return "Waila";
    }

    @Override
    public void init () throws Throwable {
        FMLInterModComms.sendMessage("Waila", "register", StorageDrawers.SOURCE_PATH + "integration.Waila.registerProvider");
    }

    @Override
    public void postInit () { }

    public static void registerProvider(IWailaRegistrar registrar) {
        registrar.registerBodyProvider(new WailaDrawer(), BlockDrawers.class);
    }

    public static class WailaDrawer implements IWailaDataProvider
    {
        @Override
        public ItemStack getWailaStack (IWailaDataAccessor accessor, IWailaConfigHandler config) {
            return null;
        }

        @Override
        public List<String> getWailaHead (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
            return currenttip;
        }

        @Override
        public List<String> getWailaBody (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
            TileEntityDrawers tile = (TileEntityDrawers) accessor.getTileEntity();

            for (int i = 0; i < tile.getDrawerCount(); i++) {
                String name = StatCollector.translateToLocal("storageDrawers.waila.empty");

                IDrawer drawer = tile.getDrawer(i);
                ItemStack stack = drawer.getStoredItemPrototype();
                if (stack != null && stack.getItem() != null) {
                    String stackName = stack.getDisplayName();
                    List<IWailaTooltipHandler> handlers = StorageDrawers.wailaRegistry.getTooltipHandlers();
                    for (int j = 0, n = handlers.size(); j < n; j++)
                        stackName = handlers.get(j).transformItemName(drawer, stackName);

                    if (tile instanceof TileEntityDrawersComp)
                        name = stackName + ((i == 0) ? " [" : " [+") + ((TileEntityDrawersComp) tile).getStoredItemRemainder(i) + "]";
                    else
                        name = stackName + " [" + drawer.getStoredItemCount() + "]";
                }
                currenttip.add(StatCollector.translateToLocalFormatted("storageDrawers.waila.drawer", i + 1, name));
            }

            String attrib = "";
            if (tile.isLocked())
                attrib += (attrib.isEmpty() ? "" : ", ") + StatCollector.translateToLocal("storageDrawers.waila.locked");
            if (tile.isVoid())
                attrib += (attrib.isEmpty() ? "" : ", ") + StatCollector.translateToLocal("storageDrawers.waila.void");
            if (tile.isSorting())
                attrib += (attrib.isEmpty() ? "" : ", ") + StatCollector.translateToLocal("storageDrawers.waila.sorting");

            if (!attrib.isEmpty())
                currenttip.add(attrib);

            return currenttip;
        }

        @Override
        public List<String> getWailaTail (ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
            return currenttip;
        }

        @Override
        public NBTTagCompound getNBTData (EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
            return null;
        }
    }
}


text:
// Type definitions for mCustomScrollbar 2.8.2
// Project: https://github.com/malihu/malihu-custom-scrollbar-plugin
// Definitions by: Sarah Williams <https://github.com/flurg>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

/// <reference path="../jquery/jquery.d.ts" />

declare module MCustomScrollbar {
    interface CustomScrollbarOptions {
        /**
        * Set the width of your content (overwrites CSS width), value in pixels (integer) or percentage (string)
        */
        set_width?: any;
        /**
        * Set the height of your content (overwirtes CSS height), value in pixels (integer) or percentage (string)
        */
        set_height?: any;
        /**
        * Add horizontal scrollbar (default is vertical), value: true, false
        */
        horizontalScroll?: boolean;
        /**
        * Scrolling inertia (easing), value in milliseconds (0 for no scrolling inertia)
        */
        scrollInertia?: number;
        /**
        * Mouse wheel support, value: true, false
        */
        mouseWheel?: boolean;
        /**
        * Mouse wheel scrolling pixels amount, value in pixels (integer) or "auto" (script calculates and sets pixels amount according to content length)
        */
        mouseWheelPixels?: any;
        /**
        * Auto-adjust scrollbar height/width according to content, values: true, false
        */
        autoDraggerLength?: boolean;
        /**
        * Automatically hide the scrollbar when idle or mouse is not over the content
        */
        autoHideScrollbar?: boolean;
        scrollButtons?: {
            /**
            * Scroll buttons scroll type, values: "continuous" (scroll continuously while pressing the button), "pixels" (scrolls by a fixed number of pixels on each click")
            */
            scrollType?: string;
            /**
            * Scroll buttons continuous scrolling speed, integer value or "auto" (script calculates and sets the speed according to content length)
            */
            scrollSpeed?: any;
            /**
            * Scroll buttons pixels scrolling amount, value in pixels
            */
            scrollAmount?: number;
        }
    advanced?: {
            /**
            * Update scrollbars on browser resize (for fluid content blocks and layouts based on percentages), values: true, false. Set to false only when you content has fixed dimensions
            */
            updateOnBrowserResize?: boolean;
            /**
            * Auto-update scrollbars on content resize (useful when adding/changing content progrmatically), value: true, false. Setting this to true makes the script check for content
            * length changes (every few milliseconds) and automatically call plugin's update method to adjust the scrollbar accordingly
            */
            updateOnContentResize?: boolean;
            /**
            * Auto-expanding content's width on horizontal scrollbars, values: true, false. Set to true if you have horizontal scrollbr on content that change on-the-fly. Demo contains
            * blocks with images and horizontal scrollbars that use this option parameter
            */
            autoExpandHorizontalScroll?: boolean;
            /**
            * Auto-scrolling on elements that have focus (e.g. scrollbar automatically scrolls to form text fields when the TAB key is pressed), values: true, false
            */
            autoScrollOnFocus?: boolean;
            /**
            * Normalize mouse wheel delta (-1/1), values: true, false
            */
            normalizeMouseWheelDelta?: boolean;
        }
    /**
    * Additional scrolling method by touch-swipe content (for touch enabled devices), value: true, false
    */
    contentTouchScroll?: boolean;
        /**
        * All of the following callbacks option have examples in the callback demo - http://manos.malihu.gr/tuts/custom-scrollbar-plugin/callbacks_example.html
        */
        callbacks?: {
            /**
            * User defined callback function, triggered on scroll start event. You can call your own function(s) each time a scroll event begins
            */
            onScrollStart?: () => void;
            /**
            * User defined callback function, triggered on scroll event. Call your own function(s) each time a scroll event completes
            */
            onScroll?: () => void;
            /**
            * User defined callback function, triggered when scroll end-limit is reached
            */
            onTotalScrollBack?: () => void;
            /**
            * Scroll end-limit offset, value in pixels
            */
            onTotalScrollOffset?: number;
            /**
            * User defined callback function, triggered while scrolling
            */
            whileScrolling?: () => void;
        }
    /**
    * Set a scrollbar ready-to-use theme. See themes demo for all themes - http://manos.malihu.gr/tuts/custom-scrollbar-plugin/scrollbar_themes_demo.html
    */
    theme?: string;
    }

    interface ScrollToParameterOptions {
        /**
        * Scroll-to animation speed, value in milliseconds
        */
        scrollInertia?: number;
        /**
        * Scroll scrollbar dragger (instead of content) to a number of pixels, values: true, false
        */
        moveDragger?: boolean;
        /**
        * Trigger user defined callback after scroll-to completes, value: true, false
        */
        callbacks?: boolean;
    }
}

interface JQuery {
    /**
    * Creates a new mCustomScrollbar with the specified or default options
    *
    * @param options Override default options
    */
    mCustomScrollbar(options?: MCustomScrollbar.CustomScrollbarOptions): JQuery;
    /**
    * Calls specified methods on the scrollbar "update", "stop", "disable", "destroy"
    *
    * @param method Method name to call on scrollbar e.g. "update", "stop"
    */
    mCustomScrollbar(method: string): JQuery;
    /**
    * Calls the scrollTo method on the scrollbar
    *
    * @param scrollTo Method name as a string "scrollTo"
    * @param parameter String or pixel integer value to specify where to scroll to e.g. "bottom", "top" or 20
    * @param options Override default options
    */
    mCustomScrollbar(scrollTo: string, parameter: any, options?: MCustomScrollbar.ScrollToParameterOptions): JQuery;
}


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

namespace AdaBot.Bot.Utils
{
    public static class StringExtensions
    {
        private static readonly Random _spintaxRnd = new Random();

        public static string Spintax(this string str, Random seed = null)
        {
            if (str == null) throw new ArgumentNullException(nameof(str));
            if (seed == null)
            {
                seed = _spintaxRnd;
            }

            string pattern = @"\[[^\[\]]*\]";
            Match m = Regex.Match(str, pattern);
            while (m.Success)
            {
                string seg = str.Substring(m.Index + 1, m.Length - 2);
                string[] choices = seg.Split('|');
                str = str.Substring(0, m.Index) + choices[seed.Next(choices.Length)] + str.Substring(m.Index + m.Length);
                m = Regex.Match(str, pattern);
            }
            return str;
        }
    }
}


text:
Explore your city

This repository contains the source code for goon client to API and fill database.

The API consists in the following main components:

 * Get data from API
 * Clean data
 * Add data to database
 * Notify [Goon-Server](https://github.com/HexanomeBeurreTwo/Goon-Server/)

## Requirements

- Node 0.10.x & NPM

Use whatever you want to install them (from source, homebrew, apt).

## Run

Run the API server:

```
npm install
npm start
```

The server should be running on http://localhost:3000.

## Contributing

Everything works around one branch (`master`) to follow the [Github Flow](https://guides.github.com/introduction/flow/).

**Test your code** and existing (not yet tested) code if possible.


text:
<?php

/**
 * ### Condition: String is lowercase
 *
 * Condition ViewHelper which renders the `then` child if provided
 * string is lowercase. By default only the first letter is tested.
 * To test the full string set $fullString to TRUE.
 *
 * @author Björn Fromme <fromme@dreipunktnull.com>, dreipunktnull
 * @package Vhs
 * @subpackage ViewHelpers\If\String
 */
class Tx_Vhs_ViewHelpers_If_String_IsLowercaseViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractConditionViewHelper {

	/**
	 * Render method
	 *
	 * @param string $string
	 * @param boolean $fullString
	 * @return string
	 */
	public function render($string, $fullString = FALSE) {
		if (TRUE === $fullString) {
			$result = ctype_lower($string);
		} else {
			$result = ctype_lower(substr($string, 0, 1));
		}
		if (TRUE === $result) {
			return $this->renderThenChild();
		} else {
			return $this->renderElseChild();
		}
	}
}


text:
<?php

declare(strict_types=1);

namespace Cmfcmf\Module\MediaModule\Entity\Media;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity()
 */
class YouTubeEntity extends UrlEntity
{
    public function setYouTubeId($youTubeId)
    {
        $this->extraData['youTubeId'] = $youTubeId;

        return $this;
    }

    public function getYouTubeId()
    {
        return isset($this->extraData['youTubeId']) ? $this->extraData['youTubeId'] : null;
    }

    public function setYouTubeType($youTubeType)
    {
        $this->extraData['youTubeType'] = $youTubeType;

        return $this;
    }

    public function getYouTubeType()
    {
        return isset($this->extraData['youTubeType']) ? $this->extraData['youTubeType'] : null;
    }

    public function setYouTubeThumbnailUrl($youTubeThumbnailUrl)
    {
        $this->extraData['youTubeThumbnailUrl'] = $youTubeThumbnailUrl;

        return $this;
    }

    public function getYouTubeThumbnailUrl()
    {
        return isset($this->extraData['youTubeThumbnailUrl']) ? $this->extraData['youTubeThumbnailUrl'] : null;
    }
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.

#nullable enable

using System;
using System.Collections.Generic;
using System.Linq;

using Microsoft.Scripting;
using Microsoft.Scripting.Runtime;

namespace IronPython.Runtime {
    internal abstract class CustomDictionaryStorage : DictionaryStorage {
        private DictionaryStorage/*!*/ _storage;

        public CustomDictionaryStorage() {
            _storage = new CommonDictionaryStorage();
        }

        protected CustomDictionaryStorage(DictionaryStorage storage) {
            _storage = storage;
        }

        public DictionaryStorage Storage => _storage;

        public override void Add(ref DictionaryStorage storage, object? key, object? value) {
            Add(key, value);
        }

        public override void AddNoLock(ref DictionaryStorage storage, object? key, object? value) {
            if (key is string skey && TrySetExtraValue(skey, value)) {
                return;
            }
            _storage.AddNoLock(ref _storage, key, value);
        }

        public void Add(object? key, object? value) {
            if (key is string skey && TrySetExtraValue(skey, value)) {
                return;
            }
            _storage.Add(ref _storage, key, value);
        }

        public override bool Contains(object? key) {
            if (key is string skey && TryGetExtraValue(skey, out object? dummy)) {
                return dummy != Uninitialized.Instance;
            }

            return _storage.Contains(key);
        }

        public override bool Remove(ref DictionaryStorage storage, object? key) {
            return Remove(key);
        }

        public bool Remove(object? key) {
            if (key is string skey) {
                return TryRemoveExtraValue(skey) ?? _storage.Remove(ref _storage, key);

            }
            return _storage.Remove(ref _storage, key);
        }

        public override DictionaryStorage AsMutable(ref DictionaryStorage storage) => this;

        public override bool TryGetValue(object? key, out object? value) {
            if (key is string skey && TryGetExtraValue(skey, out value)) {
                return value != Uninitialized.Instance;
            }

            return _storage.TryGetValue(key, out value);
        }

        public override int Count => _storage.Count + GetExtraItems().Count();

        public override void Clear(ref DictionaryStorage storage) {
            _storage.Clear(ref _storage);
            foreach (var item in GetExtraItems()) {
                TryRemoveExtraValue(item.Key);
            }
        }

        public override List<KeyValuePair<object?, object?>> GetItems() {
            List<KeyValuePair<object?, object?>> res = _storage.GetItems();

            foreach (var item in GetExtraItems()) {
                res.Add(new KeyValuePair<object?, object?>(item.Key, item.Value));
            }

            return res;
        }

        /// <summary>
        /// Gets all of the extra names and values stored in the dictionary.
        /// </summary>
        protected abstract IEnumerable<KeyValuePair<string, object?>> GetExtraItems();

        /// <summary>
        /// Attemps to sets a value in the extra keys.  Returns true if the value is set, false if
        /// the value is not an extra key.
        /// </summary>
        protected abstract bool TrySetExtraValue(string key, object? value);

        /// <summary>
        /// Attempts to get a value from the extra keys.  Returns true if the value is an extra
        /// key and has a value.  False if it is not an extra key or doesn't have a value.
        /// </summary>
        protected abstract bool TryGetExtraValue(string key, out object? value);

        /// <summary>
        /// Attempts to remove the key.  Returns true if the key is removed, false
        /// if the key was not removed, or null if the key is not an extra key.
        /// </summary>
        protected abstract bool? TryRemoveExtraValue(string key);
    }
}


text:
namespace clang {

class DirectoryEntry;
class FileEntry;
class FileManager;
class DiagnosticConsumer;
class DiagnosticsEngine;
class HeaderSearch;
class ModuleMapParser;

/// \brief A mechanism to observe the actions of the module map parser as it
/// reads module map files.
class ModuleMapCallbacks {
public:
  virtual ~ModuleMapCallbacks() = default;

  /// \brief Called when a module map file has been read.
  ///
  /// \param FileStart A SourceLocation referring to the start of the file's
  /// contents.
  /// \param File The file itself.
  /// \param IsSystem Whether this is a module map from a system include path.
  virtual void moduleMapFileRead(SourceLocation FileStart,
                                 const FileEntry &File, bool IsSystem) {}

  /// \brief Called when a header is added during module map parsing.
  ///
  /// \param Filename The header file itself.
  virtual void moduleMapAddHeader(StringRef Filename) {}

  /// \brief Called when an umbrella header is added during module map parsing.
  ///
  /// \param FileMgr FileManager instance
  /// \param Header The umbrella header to collect.
  virtual void moduleMapAddUmbrellaHeader(FileManager *FileMgr,
                                          const FileEntry *Header) {}
};

class ModuleMap {
  SourceManager &SourceMgr;
  DiagnosticsEngine &Diags;
  const LangOptions &LangOpts;
  const TargetInfo *Target;
  HeaderSearch &HeaderInfo;

  llvm::SmallVector<std::unique_ptr<ModuleMapCallbacks>, 1> Callbacks;

  /// \brief The directory used for Clang-supplied, builtin include headers,
  /// such as "stdint.h".
  const DirectoryEntry *BuiltinIncludeDir;

  /// \brief Language options used to parse the module map itself.
  ///
  /// These are always simple C language options.
  LangOptions MMapLangOpts;

  // The module that the main source file is associated with (the module
  // named LangOpts::CurrentModule, if we've loaded it).
  Module *SourceModule;

  /// \brief The top-level modules that are known.
  llvm::StringMap<Module *> Modules;

  /// \brief The number of modules we have created in total.
  unsigned NumCreatedModules;

public:
  /// \brief Flags describing the role of a module header.
  enum ModuleHeaderRole {
    /// \brief This header is normally included in the module.
    NormalHeader  = 0x0,
    /// \brief This header is included but private.
    PrivateHeader = 0x1,
    /// \brief This header is part of the module (for layering purposes) but
    /// should be textually included.
    TextualHeader = 0x2,
    // Caution: Adding an enumerator needs other changes.
    // Adjust the number of bits for KnownHeader::Storage.
    // Adjust the bitfield HeaderFileInfo::HeaderRole size.
    // Adjust the HeaderFileInfoTrait::ReadData streaming.
    // Adjust the HeaderFileInfoTrait::EmitData streaming.
    // Adjust ModuleMap::addHeader.
  };

  /// \brief A header that is known to reside within a given module,
  /// whether it was included or excluded.
  class KnownHeader {
    llvm::PointerIntPair<Module *, 2, ModuleHeaderRole> Storage;

  public:
    KnownHeader() : Storage(nullptr, NormalHeader) { }
    KnownHeader(Module *M, ModuleHeaderRole Role) : Storage(M, Role) { }

    friend bool operator==(const KnownHeader &A, const KnownHeader &B) {
      return A.Storage == B.Storage;
    }
    friend bool operator!=(const KnownHeader &A, const KnownHeader &B) {
      return A.Storage != B.Storage;
    }

    /// \brief Retrieve the module the header is stored in.
    Module *getModule() const { return Storage.getPointer(); }

    /// \brief The role of this header within the module.
    ModuleHeaderRole getRole() const { return Storage.getInt(); }

    /// \brief Whether this header is available in the module.
    bool isAvailable() const {
      return getModule()->isAvailable();
    }

    /// \brief Whether this header is accessible from the specified module.
    bool isAccessibleFrom(Module *M) const {
      return !(getRole() & PrivateHeader) ||
             (M && M->getTopLevelModule() == getModule()->getTopLevelModule());
    }

    // \brief Whether this known header is valid (i.e., it has an
    // associated module).
    explicit operator bool() const {
      return Storage.getPointer() != nullptr;
    }
  };

  typedef llvm::SmallPtrSet<const FileEntry *, 1> AdditionalModMapsSet;

private:
  typedef llvm::DenseMap<const FileEntry *, SmallVector<KnownHeader, 1>>
  HeadersMap;

  /// \brief Mapping from each header to the module that owns the contents of
  /// that header.
  HeadersMap Headers;

  /// \brief Mapping from directories with umbrella headers to the module
  /// that is generated from the umbrella header.
  ///
  /// This mapping is used to map headers that haven't explicitly been named
  /// in the module map over to the module that includes them via its umbrella
  /// header.
  llvm::DenseMap<const DirectoryEntry *, Module *> UmbrellaDirs;

  /// \brief The set of attributes that can be attached to a module.
  struct Attributes {
    Attributes()
        : IsSystem(), IsExternC(), IsExhaustive(), NoUndeclaredIncludes() {}

    /// \brief Whether this is a system module.
    unsigned IsSystem : 1;

    /// \brief Whether this is an extern "C" module.
    unsigned IsExternC : 1;

    /// \brief Whether this is an exhaustive set of configuration macros.
    unsigned IsExhaustive : 1;

    /// \brief Whether files in this module can only include non-modular headers
    /// and headers from used modules.
    unsigned NoUndeclaredIncludes : 1;
  };

  /// \brief A directory for which framework modules can be inferred.
  struct InferredDirectory {
    InferredDirectory() : InferModules() {}

    /// \brief Whether to infer modules from this directory.
    unsigned InferModules : 1;

    /// \brief The attributes to use for inferred modules.
    Attributes Attrs;

    /// \brief If \c InferModules is non-zero, the module map file that allowed
    /// inferred modules.  Otherwise, nullptr.
    const FileEntry *ModuleMapFile;

    /// \brief The names of modules that cannot be inferred within this
    /// directory.
    SmallVector<std::string, 2> ExcludedModules;
  };

  /// \brief A mapping from directories to information about inferring
  /// framework modules from within those directories.
  llvm::DenseMap<const DirectoryEntry *, InferredDirectory> InferredDirectories;

  /// A mapping from an inferred module to the module map that allowed the
  /// inference.
  llvm::DenseMap<const Module *, const FileEntry *> InferredModuleAllowedBy;

  llvm::DenseMap<const Module *, AdditionalModMapsSet> AdditionalModMaps;

  /// \brief Describes whether we haved parsed a particular file as a module
  /// map.
  llvm::DenseMap<const FileEntry *, bool> ParsedModuleMap;

  friend class ModuleMapParser;

  /// \brief Resolve the given export declaration into an actual export
  /// declaration.
  ///
  /// \param Mod The module in which we're resolving the export declaration.
  ///
  /// \param Unresolved The export declaration to resolve.
  ///
  /// \param Complain Whether this routine should complain about unresolvable
  /// exports.
  ///
  /// \returns The resolved export declaration, which will have a NULL pointer
  /// if the export could not be resolved.
  Module::ExportDecl
  resolveExport(Module *Mod, const Module::UnresolvedExportDecl &Unresolved,
                bool Complain) const;

  /// \brief Resolve the given module id to an actual module.
  ///
  /// \param Id The module-id to resolve.
  ///
  /// \param Mod The module in which we're resolving the module-id.
  ///
  /// \param Complain Whether this routine should complain about unresolvable
  /// module-ids.
  ///
  /// \returns The resolved module, or null if the module-id could not be
  /// resolved.
  Module *resolveModuleId(const ModuleId &Id, Module *Mod, bool Complain) const;

  /// \brief Looks up the modules that \p File corresponds to.
  ///
  /// If \p File represents a builtin header within Clang's builtin include
  /// directory, this also loads all of the module maps to see if it will get
  /// associated with a specific module (e.g. in /usr/include).
  HeadersMap::iterator findKnownHeader(const FileEntry *File);

  /// \brief Searches for a module whose umbrella directory contains \p File.
  ///
  /// \param File The header to search for.
  ///
  /// \param IntermediateDirs On success, contains the set of directories
  /// searched before finding \p File.
  KnownHeader findHeaderInUmbrellaDirs(const FileEntry *File,
                    SmallVectorImpl<const DirectoryEntry *> &IntermediateDirs);

  /// \brief Given that \p File is not in the Headers map, look it up within
  /// umbrella directories and find or create a module for it.
  KnownHeader findOrCreateModuleForHeaderInUmbrellaDir(const FileEntry *File);

  /// \brief A convenience method to determine if \p File is (possibly nested)
  /// in an umbrella directory.
  bool isHeaderInUmbrellaDirs(const FileEntry *File) {
    SmallVector<const DirectoryEntry *, 2> IntermediateDirs;
    return static_cast<bool>(findHeaderInUmbrellaDirs(File, IntermediateDirs));
  }

  Module *inferFrameworkModule(const DirectoryEntry *FrameworkDir,
                               Attributes Attrs, Module *Parent);

public:
  /// \brief Construct a new module map.
  ///
  /// \param SourceMgr The source manager used to find module files and headers.
  /// This source manager should be shared with the header-search mechanism,
  /// since they will refer to the same headers.
  ///
  /// \param Diags A diagnostic engine used for diagnostics.
  ///
  /// \param LangOpts Language options for this translation unit.
  ///
  /// \param Target The target for this translation unit.
  ModuleMap(SourceManager &SourceMgr, DiagnosticsEngine &Diags,
            const LangOptions &LangOpts, const TargetInfo *Target,
            HeaderSearch &HeaderInfo);

  /// \brief Destroy the module map.
  ///
  ~ModuleMap();

  /// \brief Set the target information.
  void setTarget(const TargetInfo &Target);

  /// \brief Set the directory that contains Clang-supplied include
  /// files, such as our stdarg.h or tgmath.h.
  void setBuiltinIncludeDir(const DirectoryEntry *Dir) {
    BuiltinIncludeDir = Dir;
  }

  /// \brief Get the directory that contains Clang-supplied include files.
  const DirectoryEntry *getBuiltinDir() const {
    return BuiltinIncludeDir;
  }

  /// \brief Is this a compiler builtin header?
  static bool isBuiltinHeader(StringRef FileName);

  /// \brief Add a module map callback.
  void addModuleMapCallbacks(std::unique_ptr<ModuleMapCallbacks> Callback) {
    Callbacks.push_back(std::move(Callback));
  }

  /// \brief Retrieve the module that owns the given header file, if any.
  ///
  /// \param File The header file that is likely to be included.
  ///
  /// \param AllowTextual If \c true and \p File is a textual header, return
  /// its owning module. Otherwise, no KnownHeader will be returned if the
  /// file is only known as a textual header.
  ///
  /// \returns The module KnownHeader, which provides the module that owns the
  /// given header file.  The KnownHeader is default constructed to indicate
  /// that no module owns this header file.
  KnownHeader findModuleForHeader(const FileEntry *File,
                                  bool AllowTextual = false);

  /// \brief Retrieve all the modules that contain the given header file. This
  /// may not include umbrella modules, nor information from external sources,
  /// if they have not yet been inferred / loaded.
  ///
  /// Typically, \ref findModuleForHeader should be used instead, as it picks
  /// the preferred module for the header.
  ArrayRef<KnownHeader> findAllModulesForHeader(const FileEntry *File) const;

  /// \brief Reports errors if a module must not include a specific file.
  ///
  /// \param RequestingModule The module including a file.
  ///
  /// \param RequestingModuleIsModuleInterface \c true if the inclusion is in
  ///        the interface of RequestingModule, \c false if it's in the
  ///        implementation of RequestingModule. Value is ignored and
  ///        meaningless if RequestingModule is nullptr.
  ///
  /// \param FilenameLoc The location of the inclusion's filename.
  ///
  /// \param Filename The included filename as written.
  ///
  /// \param File The included file.
  void diagnoseHeaderInclusion(Module *RequestingModule,
                               bool RequestingModuleIsModuleInterface,
                               SourceLocation FilenameLoc, StringRef Filename,
                               const FileEntry *File);

  /// \brief Determine whether the given header is part of a module
  /// marked 'unavailable'.
  bool isHeaderInUnavailableModule(const FileEntry *Header) const;

  /// \brief Determine whether the given header is unavailable as part
  /// of the specified module.
  bool isHeaderUnavailableInModule(const FileEntry *Header,
                                   const Module *RequestingModule) const;

  /// \brief Retrieve a module with the given name.
  ///
  /// \param Name The name of the module to look up.
  ///
  /// \returns The named module, if known; otherwise, returns null.
  Module *findModule(StringRef Name) const;

  /// \brief Retrieve a module with the given name using lexical name lookup,
  /// starting at the given context.
  ///
  /// \param Name The name of the module to look up.
  ///
  /// \param Context The module context, from which we will perform lexical
  /// name lookup.
  ///
  /// \returns The named module, if known; otherwise, returns null.
  Module *lookupModuleUnqualified(StringRef Name, Module *Context) const;

  /// \brief Retrieve a module with the given name within the given context,
  /// using direct (qualified) name lookup.
  ///
  /// \param Name The name of the module to look up.
  ///
  /// \param Context The module for which we will look for a submodule. If
  /// null, we will look for a top-level module.
  ///
  /// \returns The named submodule, if known; otherwose, returns null.
  Module *lookupModuleQualified(StringRef Name, Module *Context) const;

  /// \brief Find a new module or submodule, or create it if it does not already
  /// exist.
  ///
  /// \param Name The name of the module to find or create.
  ///
  /// \param Parent The module that will act as the parent of this submodule,
  /// or NULL to indicate that this is a top-level module.
  ///
  /// \param IsFramework Whether this is a framework module.
  ///
  /// \param IsExplicit Whether this is an explicit submodule.
  ///
  /// \returns The found or newly-created module, along with a boolean value
  /// that will be true if the module is newly-created.
  std::pair<Module *, bool> findOrCreateModule(StringRef Name, Module *Parent,
                                               bool IsFramework,
                                               bool IsExplicit);

  /// \brief Create a new module for a C++ Modules TS module interface unit.
  /// The module must not already exist, and will be configured for the current
  /// compilation.
  ///
  /// Note that this also sets the current module to the newly-created module.
  ///
  /// \returns The newly-created module.
  Module *createModuleForInterfaceUnit(SourceLocation Loc, StringRef Name);

  /// \brief Infer the contents of a framework module map from the given
  /// framework directory.
  Module *inferFrameworkModule(const DirectoryEntry *FrameworkDir,
                               bool IsSystem, Module *Parent);

  /// \brief Retrieve the module map file containing the definition of the given
  /// module.
  ///
  /// \param Module The module whose module map file will be returned, if known.
  ///
  /// \returns The file entry for the module map file containing the given
  /// module, or NULL if the module definition was inferred.
  const FileEntry *getContainingModuleMapFile(const Module *Module) const;

  /// \brief Get the module map file that (along with the module name) uniquely
  /// identifies this module.
  ///
  /// The particular module that \c Name refers to may depend on how the module
  /// was found in header search. However, the combination of \c Name and
  /// this module map will be globally unique for top-level modules. In the case
  /// of inferred modules, returns the module map that allowed the inference
  /// (e.g. contained 'module *'). Otherwise, returns
  /// getContainingModuleMapFile().
  const FileEntry *getModuleMapFileForUniquing(const Module *M) const;

  void setInferredModuleAllowedBy(Module *M, const FileEntry *ModuleMap);

  /// \brief Get any module map files other than getModuleMapFileForUniquing(M)
  /// that define submodules of a top-level module \p M. This is cheaper than
  /// getting the module map file for each submodule individually, since the
  /// expected number of results is very small.
  AdditionalModMapsSet *getAdditionalModuleMapFiles(const Module *M) {
    auto I = AdditionalModMaps.find(M);
    if (I == AdditionalModMaps.end())
      return nullptr;
    return &I->second;
  }

  void addAdditionalModuleMapFile(const Module *M, const FileEntry *ModuleMap) {
    AdditionalModMaps[M].insert(ModuleMap);
  }

  /// \brief Resolve all of the unresolved exports in the given module.
  ///
  /// \param Mod The module whose exports should be resolved.
  ///
  /// \param Complain Whether to emit diagnostics for failures.
  ///
  /// \returns true if any errors were encountered while resolving exports,
  /// false otherwise.
  bool resolveExports(Module *Mod, bool Complain);

  /// \brief Resolve all of the unresolved uses in the given module.
  ///
  /// \param Mod The module whose uses should be resolved.
  ///
  /// \param Complain Whether to emit diagnostics for failures.
  ///
  /// \returns true if any errors were encountered while resolving uses,
  /// false otherwise.
  bool resolveUses(Module *Mod, bool Complain);

  /// \brief Resolve all of the unresolved conflicts in the given module.
  ///
  /// \param Mod The module whose conflicts should be resolved.
  ///
  /// \param Complain Whether to emit diagnostics for failures.
  ///
  /// \returns true if any errors were encountered while resolving conflicts,
  /// false otherwise.
  bool resolveConflicts(Module *Mod, bool Complain);

  /// \brief Infers the (sub)module based on the given source location and
  /// source manager.
  ///
  /// \param Loc The location within the source that we are querying, along
  /// with its source manager.
  ///
  /// \returns The module that owns this source location, or null if no
  /// module owns this source location.
  Module *inferModuleFromLocation(FullSourceLoc Loc);

  /// \brief Sets the umbrella header of the given module to the given
  /// header.
  void setUmbrellaHeader(Module *Mod, const FileEntry *UmbrellaHeader,
                         Twine NameAsWritten);

  /// \brief Sets the umbrella directory of the given module to the given
  /// directory.
  void setUmbrellaDir(Module *Mod, const DirectoryEntry *UmbrellaDir,
                      Twine NameAsWritten);

  /// \brief Adds this header to the given module.
  /// \param Role The role of the header wrt the module.
  void addHeader(Module *Mod, Module::Header Header,
                 ModuleHeaderRole Role, bool Imported = false);

  /// \brief Marks this header as being excluded from the given module.
  void excludeHeader(Module *Mod, Module::Header Header);

  /// \brief Parse the given module map file, and record any modules we
  /// encounter.
  ///
  /// \param File The file to be parsed.
  ///
  /// \param IsSystem Whether this module map file is in a system header
  /// directory, and therefore should be considered a system module.
  ///
  /// \param HomeDir The directory in which relative paths within this module
  ///        map file will be resolved.
  ///
  /// \param ExternModuleLoc The location of the "extern module" declaration
  ///        that caused us to load this module map file, if any.
  ///
  /// \returns true if an error occurred, false otherwise.
  bool parseModuleMapFile(const FileEntry *File, bool IsSystem,
                          const DirectoryEntry *HomeDir,
                          SourceLocation ExternModuleLoc = SourceLocation());

  /// \brief Dump the contents of the module map, for debugging purposes.
  void dump();

  typedef llvm::StringMap<Module *>::const_iterator module_iterator;
  module_iterator module_begin() const { return Modules.begin(); }
  module_iterator module_end()   const { return Modules.end(); }
};

} // end namespace clang

#endif // LLVM_CLANG_LEX_MODULEMAP_H


text: <xr-user-settings></xr-user-settings>


text:
{% extends "base.html" %}{% load i18n comments %}

{% block headtitle %}Articles{% endblock %}

{% block main %}

List of articles

    {% if object_list %}

            {% for article in object_list %}
                {% get_comment_count for article as comments_count %}

{{ article }} ({{ comments_count }} comments)

            {% endfor %}

    {% else %}

No articles posted

    {% endif %}

{% endblock %}


text:
Passec
==========

Secure Password keeper for [ServerPlatform](https://github.com/palantus/serverplatform).

Try it [here](https://ahkpro.dk/passec/).

## What is Passec?

Passec is a password manager which is designed to be very easy to use across all platforms and, of course, very secure.

## How to use it? ##

Open a bucket, which is simply a set of passwords. The Id of the bucket is a unique identifier for a bucket which can be accessed by anyone using an URL like this:

https://ahkpro.dk/passec?b=mybucket

"Is that secure?" - you might ask. The answer is yes, because every entry in a bucket is encrypted with a password (or sentence) of your choosing. If someone else opens your bucket, they can only see the passwords that they can decrypt using whatever password they enter, keeping your passwords accessible to only you. If you do not enter an ID, a random one will be generated for you. Just remember to bookmark it!
All buckets that you access will be cached locally on your device and the site is developed to be accessed offline, so even if we some day pull the plug on this site, you can still access your passwords.

## How secure is it? ##

Very. The passwords are encrypted locally on your computer using an AES 256-bit encryption. The only time your passwords aren't encrypted, is when you open your list of passwords and enter the password to decrypt. The only information that are sent to our server is your bucket ID and a long encrypted string for every entry into the bucket. So your passwords are secure even if our servers are compromised or your computer gets stolen!

## How does it work? ##

A bucket is a list of entries. An entry can be either an added password, a trashed password or a modified password. It is not possible to delete or modify these entries and only those decryptable with your password will be used to generate your list of passwords. So noone else can delete or edit your passwords without your decryption password.
Every entry is entirely encrypted and without the password, it is not even possible to know which type of entry it is. Whenever you synchronize with the server, every entry the server doesn't have gets stored in our database. These entries will then be synchronized to other clients accessing that bucket. When you enter a password for a bucket, the client will attempt to decrypt every entry. Only those successful will be used to generate your list of passwords.

## Can I backup my passwords? ##

The data is stored securly on our server in the Microsoft Azure cloud and also cached on every client you have used to access your bucket(s). However, if you want a backup, it is possible. For now, we do not have a button for it, but you can open your browser development tool and enter "lastLoadedEncryptedPasswords" in the console if you want an encrypted backup of your passwords or "passwords" for a decrypted. It is, obviously, only possible to backup the passwords when you have entered the correct password.

## Keyboard shortcuts ##

a - add password
s - sync
t - show/hide trash
l - lock bucket
o - open bucket
1-9 - show password 1-9


text:
#ifndef TENSORFLOW_FRAMEWORK_KERNEL_DEF_BUILDER_H_
#define TENSORFLOW_FRAMEWORK_KERNEL_DEF_BUILDER_H_

#include "tensorflow/core/framework/kernel_def.pb.h"
#include "tensorflow/core/framework/types.h"
#include "tensorflow/core/lib/gtl/array_slice.h"
#include "tensorflow/core/platform/macros.h"
#include "tensorflow/core/platform/types.h"

namespace tensorflow {

// Builder class passed to the REGISTER_KERNEL_BUILDER() macro.
class KernelDefBuilder {
 public:
  // Starts with just the name field set.
  // Caller MUST call Build() and take ownership of the result.
  explicit KernelDefBuilder(const char* op_name);

  ~KernelDefBuilder() {
    DCHECK(kernel_def_ == nullptr) << "Did not call Build()";
  }

  // Required: specify the type of device this kernel supports.
  // Returns *this.
  KernelDefBuilder& Device(const char* device_type);
  //  KernelDefBuilder& Device(DeviceType device_type);

  // Specify that this kernel supports a limited set of values for a
  // particular type or list(type) attr (a further restriction than
  // what the Op allows).
  // Returns *this.
  KernelDefBuilder& TypeConstraint(const char* attr_name,
                                   gtl::ArraySlice<DataType> allowed);

  // Like TypeConstraint but supports just a single type.
  KernelDefBuilder& TypeConstraint(const char* attr_name, DataType allowed);

  // Like TypeConstraint, but (a) gets the type from a template parameter
  // and (b) only supports a constraint to a single type.
  template <class T>
  KernelDefBuilder& TypeConstraint(const char* attr_name);
  // TODO(josh11b): Support other types of attr constraints as needed.

  // Specify that this kernel requires/provides an input/output arg
  // in host memory (instead of the default, device memory).
  // Returns *this.
  KernelDefBuilder& HostMemory(const char* arg_name);

  // Specify that this kernel requires a particular value for the
  // "_kernel" attr.  May only be specified once.  Returns *this.
  KernelDefBuilder& Label(const char* label);

  // Returns a pointer to a KernelDef with fields set based on the
  // above calls to this instance.
  // Caller takes ownership of the result.
  const KernelDef* Build() {
    KernelDef* r = kernel_def_;
    kernel_def_ = nullptr;
    return r;
  }

 private:
  KernelDef* kernel_def_;

  TF_DISALLOW_COPY_AND_ASSIGN(KernelDefBuilder);
};

// IMPLEMENTATION

template <class T>
inline KernelDefBuilder& KernelDefBuilder::TypeConstraint(
    const char* attr_name) {
  return this->TypeConstraint(attr_name, DataTypeToEnum<T>::v());
}

}  // namespace tensorflow

#endif  // TENSORFLOW_FRAMEWORK_KERNEL_DEF_BUILDER_H_


text:
Sentry Server
=============

The Sentry Server is the core Python application that powers all of our
Sentry installations.  This covers everything related to getting it
running on your own infrastructure.

.. toctree::
   :maxdepth: 1

   installation/index
   upgrading
   config
   nginx
   nodestore
   filestore
   queue
   buffer
   filestore
   sso
   throttling
   tsdb
   digests
   inbound-mail
   internal-metrics
   performance
   cli/index
   monitoring
   beacon
   plugins
   warnings
   dsym
   faq
   changelog


text:
package org.apache.sis.referencing.factory;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import javax.measure.unit.SI;
import org.opengis.referencing.IdentifiedObject;
import org.opengis.referencing.NoSuchAuthorityCodeException;
import org.opengis.referencing.crs.CRSAuthorityFactory;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.crs.GeocentricCRS;
import org.opengis.referencing.crs.GeodeticCRS;
import org.opengis.referencing.crs.GeographicCRS;
import org.opengis.referencing.crs.VerticalCRS;
import org.opengis.referencing.datum.Datum;
import org.opengis.referencing.datum.DatumAuthorityFactory;
import org.opengis.referencing.datum.GeodeticDatum;
import org.opengis.referencing.datum.PrimeMeridian;
import org.opengis.referencing.datum.VerticalDatum;
import org.opengis.util.FactoryException;
import org.apache.sis.internal.system.Loggers;
import org.apache.sis.metadata.iso.extent.Extents;
import org.apache.sis.referencing.crs.HardCodedCRS;
import org.apache.sis.referencing.datum.HardCodedDatum;
import org.apache.sis.test.LoggingWatcher;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.After;
import org.junit.Rule;
import org.junit.Test;

import static org.apache.sis.test.Assert.*;

/**
 * Tests {@link MultiAuthoritiesFactory}.
 *
 * @author  Martin Desruisseaux (Geomatys)
 * @since   0.7
 * @version 0.7
 * @module
 */
@DependsOn(AuthorityFactoryProxyTest.class)
public final strictfp class MultiAuthoritiesFactoryTest extends TestCase {
    /**
     * A JUnit {@link Rule} for listening to log events. This field is public because JUnit requires us to
     * do so, but should be considered as an implementation details (it should have been a private field).
     */
    @Rule
    public final LoggingWatcher loggings = new LoggingWatcher(Loggers.CRS_FACTORY);

    /**
     * Verifies that no unexpected warning has been emitted in any test defined in this class.
     */
    @After
    public void assertNoUnexpectedLog() {
        loggings.assertNoUnexpectedLog();
    }

    /**
     * Tests consistency of the mock factory used by other tests in this class.
     *
     * @throws FactoryException if no object was found for a code.
     */
    @Test
    public void testAuthorityFactoryMock() throws FactoryException {
        final AuthorityFactoryMock factory = new AuthorityFactoryMock("MOCK", null);
        final Class<?>[] types = {
            GeocentricCRS.class,
            GeographicCRS.class,
            GeodeticDatum.class,
            VerticalDatum.class,
            VerticalCRS.class,
            GeodeticCRS.class,
            PrimeMeridian.class,
            Datum.class,
            CoordinateReferenceSystem.class,
            IdentifiedObject.class
        };
        for (final Class<?> type : types) {
            for (final String code : factory.getAuthorityCodes(type.asSubclass(IdentifiedObject.class))) {
                assertInstanceOf(code, type, factory.createObject(code));
            }
        }
    }

    /**
     * Tests {@link MultiAuthoritiesFactory#getCodeSpaces()}.
     */
    @Test
    public void testGetCodeSpaces() {
        final AuthorityFactoryMock mock1 = new AuthorityFactoryMock("MOCK1", "2.3");
        final AuthorityFactoryMock mock2 = new AuthorityFactoryMock("MOCK2", null);
        final AuthorityFactoryMock mock3 = new AuthorityFactoryMock("MOCK3", null);
        final MultiAuthoritiesFactory factory = new MultiAuthoritiesFactory(
                Arrays.asList(mock1, mock2), null,
                Arrays.asList(mock1, mock3), null);
        assertSetEquals(Arrays.asList("MOCK1", "MOCK2", "MOCK3"), factory.getCodeSpaces());
    }

    /**
     * Tests {@link MultiAuthoritiesFactory#getAuthorityFactory(Class, String, String)}.
     *
     * @throws NoSuchAuthorityFactoryException if an authority is not recognized.
     */
    @Test
    public void testGetAuthorityFactory() throws NoSuchAuthorityFactoryException {
        final AuthorityFactoryMock mock1 = new AuthorityFactoryMock("MOCK1", null);
        final AuthorityFactoryMock mock2 = new AuthorityFactoryMock("MOCK2", "1.2");
        final AuthorityFactoryMock mock3 = new AuthorityFactoryMock("MOCK1", "2.3");
        final MultiAuthoritiesFactory factory = new MultiAuthoritiesFactory(
                Arrays.asList(mock1, mock2, mock3), null,
                Arrays.asList(mock1, mock3), null);

        assertSame("MOCK2", mock2, factory.getAuthorityFactory(  CRSAuthorityFactory.class, "mock2", null));
        assertSame("MOCK1", mock1, factory.getAuthorityFactory(  CRSAuthorityFactory.class, "mock1", null));
        assertSame("MOCK2", mock2, factory.getAuthorityFactory(  CRSAuthorityFactory.class, "mock2", "1.2"));
        assertSame("MOCK3", mock3, factory.getAuthorityFactory(  CRSAuthorityFactory.class, "mock1", "2.3"));
        assertSame("MOCK3", mock3, factory.getAuthorityFactory(DatumAuthorityFactory.class, "mock1", "2.3"));
        assertSame("MOCK1", mock1, factory.getAuthorityFactory(DatumAuthorityFactory.class, "mock1", null));
        try {
            factory.getAuthorityFactory(DatumAuthorityFactory.class, "mock2", null);
            fail("Should not have found a 'mock2' factory for datum objects.");
        } catch (NoSuchAuthorityFactoryException e) {
            final String message = e.getMessage();
            assertTrue(message, message.contains("MOCK2"));
        }
        try {
            factory.getAuthorityFactory(CRSAuthorityFactory.class, "mock1", "9.9");
            fail("Should not have found a 'mock1' factory for the 9.9 version.");
        } catch (NoSuchAuthorityFactoryException e) {
            final String message = e.getMessage();
            assertTrue(message, message.contains("MOCK1"));
            assertTrue(message, message.contains("9.9"));
        }
    }

    /**
     * Tests {@link MultiAuthoritiesFactory#getAuthorityFactory(Class, String, String)}
     * with a conflict in the factory namespace.
     *
     * @throws NoSuchAuthorityFactoryException if an authority is not recognized.
     */
    @Test
    @DependsOnMethod("testGetAuthorityFactory")
    public void testConflict() throws NoSuchAuthorityFactoryException {
        final AuthorityFactoryMock mock1 = new AuthorityFactoryMock("MOCK1", "2.3");
        final AuthorityFactoryMock mock2 = new AuthorityFactoryMock("MOCK1", "2.3");
        final AuthorityFactoryMock mock3 = new AuthorityFactoryMock("MOCK3", "1.2");
        final AuthorityFactoryMock mock4 = new AuthorityFactoryMock("MOCK3", null);
        final AuthorityFactoryMock mock5 = new AuthorityFactoryMock("MOCK5", null);
        final MultiAuthoritiesFactory factory = new MultiAuthoritiesFactory(
                Arrays.asList(mock1, mock2, mock3, mock4, mock5), null, null, null);

        assertSame("MOCK1", mock1, factory.getAuthorityFactory(CRSAuthorityFactory.class, "mock1", null));
        assertSame("MOCK1", mock1, factory.getAuthorityFactory(CRSAuthorityFactory.class, "mock1", "2.3"));
        loggings.assertNoUnexpectedLog();

        assertSame("MOCK3", mock3, factory.getAuthorityFactory(CRSAuthorityFactory.class, "mock3", null));
        loggings.assertNextLogContains("CRSAuthorityFactory", "AuthorityFactoryMock", "MOCK1", "2.3");
        loggings.assertNoUnexpectedLog();

        assertSame("MOCK5", mock5, factory.getAuthorityFactory(CRSAuthorityFactory.class, "mock5", null));
        loggings.assertNextLogContains("CRSAuthorityFactory", "AuthorityFactoryMock", "MOCK3");
        loggings.assertNoUnexpectedLog();

        // Ask again the same factories. No logging should be emitted now, because we already logged.
        assertSame("MOCK3", mock3, factory.getAuthorityFactory(CRSAuthorityFactory.class, "mock3", null));
        assertSame("MOCK5", mock5, factory.getAuthorityFactory(CRSAuthorityFactory.class, "mock5", null));
        loggings.assertNoUnexpectedLog();
    }

    /**
     * Tests {@code MultiAuthoritiesFactory.createFoo(String)} from codes in the {@code "AUTHORITY:CODE"} form.
     * Tests also {@code "AUTHORITY:VERSION:CODE"}.
     *
     * @throws FactoryException if an authority or a code is not recognized.
     */
    @Test
    @DependsOnMethod("testGetAuthorityFactory")
    public void testCreateFromSimpleCodes() throws FactoryException {
        final Set<AuthorityFactoryMock> mock = Collections.singleton(new AuthorityFactoryMock("MOCK", "2.3"));
        final MultiAuthoritiesFactory factory = new MultiAuthoritiesFactory(mock, mock, mock, null);

        assertSame("Straight",      HardCodedCRS  .WGS84_φλ,  factory.createGeographicCRS("MOCK:4326"));
        assertSame("With spaces",   HardCodedCRS  .WGS84,     factory.createGeographicCRS("  mock :  84 "));
        assertSame("With version",  HardCodedDatum.WGS84,     factory.createGeodeticDatum("mock:2.3:6326"));
        assertSame("Empty version", HardCodedDatum.GREENWICH, factory.createPrimeMeridian(" MoCk :: 8901"));
        assertSame("With spaces",   HardCodedCRS  .DEPTH,     factory.createVerticalCRS  (" MoCk : : 9905"));
        assertSame("Version 0",     HardCodedDatum.SPHERE,    factory.createGeodeticDatum("MOCK: 0:6047"));
        assertSame("With spaces",   Extents       .WORLD,     factory.createExtent       ("MOCK: 2.3 : 1262"));
        assertSame("With spaces",   SI            .METRE,     factory.createUnit         (" MoCK : : 9001 "));
        assertEquals("Greenwich",   factory.getDescriptionText("MOCK:8901").toString());
        try {
            factory.createGeodeticDatum("MOCK2:4326");
            fail("Should not have found an object from a non-existent factory.");
        } catch (NoSuchAuthorityFactoryException e) {
            final String message = e.getMessage();
            assertTrue(message, message.contains("MOCK2"));
        }
    }

    /**
     * Tests {@code MultiAuthoritiesFactory.createFoo(String)} from codes in the
     * {@code "urn:ogc:def:type:authority:version:code"} form.
     *
     * @throws FactoryException if an authority or a code is not recognized.
     */
    @Test
    @DependsOnMethod("testCreateFromSimpleCodes")
    public void testCreateFromURNs() throws FactoryException {
        final Set<AuthorityFactoryMock> mock = Collections.singleton(new AuthorityFactoryMock("MOCK", "2.3"));
        final MultiAuthoritiesFactory factory = new MultiAuthoritiesFactory(mock, mock, mock, null);

        assertSame("Empty version", HardCodedCRS  .WGS84_φλ,  factory.createGeographicCRS("urn:ogc:def:crs:MOCK::4326"));
        assertSame("With spaces",   HardCodedCRS  .WGS84,     factory.createGeographicCRS(" urn : ogc  : def:crs :  mock : :  84 "));
        assertSame("Mixed case",    HardCodedCRS  .DEPTH,     factory.createVerticalCRS  (" Urn : OGC : dEf : CRS : MoCk : : 9905"));
        assertSame("With version",  HardCodedDatum.WGS84,     factory.createDatum        ("urn:ogc:def:datum:mock:2.3:6326"));
        assertSame("Empty version", HardCodedDatum.GREENWICH, factory.createObject       ("urn:ogc:def:meridian: MoCk :: 8901"));
        assertSame("Version 0",     HardCodedDatum.SPHERE,    factory.createGeodeticDatum("urn:ogc:def:datum:MOCK: 0 :6047"));
        assertSame("Upper case",    SI            .METRE,     factory.createUnit         ("URN:OGC:DEF:UOM:MOCK::9001"));
        try {
            factory.createGeographicCRS("urn:ogc:def:datum:MOCK::4326");
            fail("Should create an object of the wrong type.");
        } catch (NoSuchAuthorityCodeException e) {
            final String message = e.getMessage();
            assertTrue(message, message.contains("datum"));
            assertTrue(message, message.contains("GeographicCRS"));
        }
    }

    /**
     * Tests {@code MultiAuthoritiesFactory.createFoo(String)} from codes in the
     * {@code "http://www.opengis.net/gml/srs/authority.xml#code"} form.
     *
     * @throws FactoryException if an authority or a code is not recognized.
     */
    @Test
    @DependsOnMethod("testCreateFromURNs")
    public void testCreateFromHTTPs() throws FactoryException {
        final Set<AuthorityFactoryMock> mock = Collections.singleton(new AuthorityFactoryMock("MOCK", "2.3"));
        final MultiAuthoritiesFactory factory = new MultiAuthoritiesFactory(mock, mock, mock, null);

        assertSame("HTTP",          HardCodedCRS  .WGS84_φλ,  factory.createGeographicCRS("http://www.opengis.net/def/crs/mock/0/4326"));
        assertSame("GML",           HardCodedCRS  .WGS84_φλ,  factory.createObject       ("http://www.opengis.net/gml/srs/mock.xml#4326"));
        assertSame("With spaces",   HardCodedCRS  .WGS84,     factory.createGeographicCRS("http://www.opengis.net/gml/srs/ mock.xml # 84 "));
        assertSame("Mixed case",    HardCodedCRS  .DEPTH,     factory.createVerticalCRS  ("HTTP://www.OpenGIS.net/GML/SRS/MoCk.xml#9905"));
        try {
            factory.createDatum("http://www.opengis.net/gml/srs/mock.xml#6326");
            fail("Should create an object of the wrong type.");
        } catch (NoSuchAuthorityCodeException e) {
            final String message = e.getMessage();
            assertTrue(message, message.contains("crs"));
            assertTrue(message, message.contains("Datum"));
        }
    }

    /**
     * Tests {@link MultiAuthoritiesFactory#getAuthorityCodes(Class)}.
     *
     * @throws FactoryException if an error occurred while fetching the set of codes.
     */
    @Test
    public void testGetAuthorityCodes() throws FactoryException {
        final List<AuthorityFactoryMock> mock = Arrays.asList(
                new AuthorityFactoryMock("MOCK", null),
                new AuthorityFactoryMock("MOCK", "2.3"));
        final MultiAuthoritiesFactory factory = new MultiAuthoritiesFactory(mock, mock, mock, null);
        final Set<String> codes = factory.getAuthorityCodes(CoordinateReferenceSystem.class);

        assertTrue("MOCK:4979",   codes.contains("MOCK:4979"));     // A geocentric CRS.
        assertTrue(" mock :: 84", codes.contains(" mock :: 84"));   // A geographic CRS.
        assertTrue("http://www.opengis.net/gml/srs/mock.xml#4326",
                codes.contains("http://www.opengis.net/gml/srs/mock.xml#4326"));

        assertFalse("MOCK:6326", codes.contains("MOCK:6326"));      // A geodetic datum.
        assertFalse("isEmpty()", codes.isEmpty());
        assertArrayEquals(new String[] {"MOCK:4979", "MOCK:84", "MOCK:4326", "MOCK:5714", "MOCK:9905"}, codes.toArray());
    }

    /**
     * Tests {@link MultiAuthoritiesFactory#createFromCoordinateReferenceSystemCodes(String, String)}.
     *
     * @throws FactoryException if an error occurred while creating the operation.
     */
    @Test
    public void testCreateFromCoordinateReferenceSystemCodes() throws FactoryException {
        final List<AuthorityFactoryMock> mock = Arrays.asList(
                new AuthorityFactoryMock("MOCK", null),
                new AuthorityFactoryMock("MOCK", "2.3"));
        final MultiAuthoritiesFactory factory = new MultiAuthoritiesFactory(mock, null, null, mock);
        /*
         * Our mock factory does not implement createFromCoordinateReferenceSystemCodes(String, String),
         * so we just test that we didn't got an exception and no message were logged.
         */
        assertTrue(factory.createFromCoordinateReferenceSystemCodes("MOCK:4326", "MOCK:84").isEmpty());
        /*
         * Following should log a warning telling that the authority factories do not match.
         */
        assertTrue(factory.createFromCoordinateReferenceSystemCodes("MOCK:4326", "MOCK:2.3:84").isEmpty());
        loggings.assertNextLogContains("MOCK:4326", "MOCK:2.3:84");
        loggings.assertNoUnexpectedLog();
    }

    /**
     * Tests {@link MultiAuthoritiesFactory#newIdentifiedObjectFinder()}.
     *
     * @throws FactoryException if an error occurred while creating the finder.
     */
    @Test
    public void testNewIdentifiedObjectFinder() throws FactoryException {
        final List<AuthorityFactoryMock> mock = Arrays.asList(
                new AuthorityFactoryMock("MOCK", null),
                new AuthorityFactoryMock("MOCK", "2.3"));
        final MultiAuthoritiesFactory factory = new MultiAuthoritiesFactory(mock, null, mock, null);
        final IdentifiedObjectFinder finder = factory.newIdentifiedObjectFinder();
        assertSame(HardCodedDatum.WGS72, finder.findSingleton(HardCodedDatum.WGS72));
    }
}


text:
"use strict";

/**
 * Timer is used to keep time of time.
 */
function Timer()
{
	this.initial = 0.0;
}

/**
 * Start the timer.
 */
Timer.prototype.start = function()
{
	this.initial = performance.now();
};

/**
 * Get time value.
 */
Timer.prototype.get = function()
{
	return performance.now() - this.initial;
};


text:
using System.Collections;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
	private new Rigidbody rigidbody;

	public float movementSpeed = 5; // meters per second

	private Vector3 surfaceNormal = Vector3.zero;

	void Awake()
	{
		rigidbody = GetComponent<Rigidbody>();
	}

	void Update()
	{
		AlignPlayerToSurface();
		ApplyMovement();
	}

	void ApplyMovement()
	{
		float horizontal = Input.GetAxis("Horizontal");
		float vertical = Input.GetAxis("Vertical");

		Vector3 transformDiff = Vector3.zero;
		transformDiff += vertical * transform.forward;
		transformDiff += horizontal * transform.right;
		if (transformDiff.magnitude > 1)
		{
			transformDiff.Normalize();
		}

		Vector3 targetPosition = transform.position + transformDiff * movementSpeed * Time.deltaTime;

		rigidbody.angularVelocity = Vector3.zero;
		rigidbody.velocity = Vector3.zero;

		transform.position = targetPosition;
	}

	void AlignPlayerToSurface()
	{
		Ray ray = new Ray(transform.position, -transform.up);

		var hits = Physics.RaycastAll(ray, transform.localScale.y);

		foreach (RaycastHit hit in hits)
		{
			if (hit.transform.tag == "Planet")
			{
				surfaceNormal = hit.normal;

				Quaternion targetRotation = Quaternion.FromToRotation(transform.up, surfaceNormal) * transform.rotation;

				transform.position = hit.point + transform.up * transform.lossyScale.y / 2;
				transform.rotation = targetRotation;

				break;
			}
		}
	}

	public void GiveBoost(float duration, float increase)
	{
		if (isBoosting)
			currDuration = 0f; //reset the boost;
		else
			StartCoroutine(SpeedBoost(duration, increase));
	}

	bool isBoosting = false;
	float currDuration = 0f;
	IEnumerator SpeedBoost(float duration, float increase)
	{
		currDuration = 0f;
		var prevSpeed = movementSpeed;
		movementSpeed = prevSpeed * increase;
		isBoosting = true;
		while (currDuration < duration)
		{
			currDuration += Time.deltaTime;
			yield return new WaitForEndOfFrame();
		}
		movementSpeed = prevSpeed;
		isBoosting = false;
	}
}


text:
FROM nginx:stable

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        bc \
        curl \
        unzip \
    && rm -rf /var/lib/apt/lists/*

ENV CONSUL_TEMPLATE_VERSION 0.16.0
ENV CONSUL_TEMPLATE_SHA1 064b0b492bb7ca3663811d297436a4bbf3226de706d2b76adade7021cd22e156

RUN curl --retry 7 -Lso /tmp/consul-template.zip \
        "https://releases.hashicorp.com/consul-template/${CONSUL_TEMPLATE_VERSION}/consul-template_${CONSUL_TEMPLATE_VERSION}_linux_amd64.zip" \
    && echo "${CONSUL_TEMPLATE_SHA1}  /tmp/consul-template.zip" | sha256sum -c \
    && unzip /tmp/consul-template.zip -d /usr/local/bin \
    && rm /tmp/consul-template.zip

ENV CONTAINERPILOT_VERSION 2.4.3
ENV CONTAINERPILOT_SHA1 2c469a0e79a7ac801f1c032c2515dd0278134790
ENV CONTAINERPILOT file:///etc/containerpilot.json

RUN curl --retry 7 -Lso /tmp/containerpilot.tar.gz \
         "https://github.com/joyent/containerpilot/releases/download/${CONTAINERPILOT_VERSION}/containerpilot-${CONTAINERPILOT_VERSION}.tar.gz" \
    && echo "${CONTAINERPILOT_SHA1}  /tmp/containerpilot.tar.gz" | sha1sum -c \
    && tar zxf /tmp/containerpilot.tar.gz -C /usr/local/bin \
    && rm /tmp/containerpilot.tar.gz

COPY config/ /etc
COPY scripts/ /usr/local/bin

RUN chmod +x /usr/local/bin/reload.sh
RUN chmod +x /usr/local/bin/sensor.sh

CMD [ "/usr/local/bin/containerpilot", \
    "nginx", \
        "-g", \
        "daemon off;"]


text:
<?php

/**
 * FileDocComment
 * Category install migration
 * Класс миграций для модуля Category:
 *
 * @category YupeMigration
 * @package  yupe.modules.category.install.migrations
 * @author   YupeTeam <team@yupe.ru>
 * @license  BSD https://raw.github.com/yupe/yupe/master/LICENSE
 * @link     http://yupe.ru
 **/
class m000000_000000_category_base extends yupe\components\DbMigration
{
    /**
     * Функция настройки и создания таблицы:
     *
     * @return null
     **/
    public function safeUp()
    {
        $this->createTable(
            '{{category_category}}',
            array(
                'id'                => 'pk',
                'parent_id'         => 'integer DEFAULT NULL',
                'alias'             => 'varchar(150) NOT NULL',
                'lang'              => 'char(2) DEFAULT NULL',
                'name'              => 'varchar(250) NOT NULL',
                'image'             => 'varchar(250) DEFAULT NULL',
                'short_description' => 'text',
                'description'       => 'text NOT NULL',
                'status'            => "boolean NOT NULL DEFAULT '1'",
            ),
            $this->getOptions()
        );

        //ix
        $this->createIndex("ux_{{category_category}}_alias_lang", '{{category_category}}', "alias,lang", true);
        $this->createIndex("ix_{{category_category}}_parent_id", '{{category_category}}', "parent_id", false);
        $this->createIndex("ix_{{category_category}}_status", '{{category_category}}', "status", false);

        //fk
        $this->addForeignKey(
            "fk_{{category_category}}_parent_id",
            '{{category_category}}',
            'parent_id',
            '{{category_category}}',
            'id',
            'SET NULL',
            'NO ACTION'
        );
    }

    /**
     * Функция удаления таблицы:
     *
     * @return null
     **/
    public function safeDown()
    {
        $this->dropTableWithForeignKeys('{{category_category}}');
    }
}


text:
using System;
using System.Collections.Generic;
using System.Reflection;
using BlackJack.Common;

namespace BlackJack.Client
{
    internal class ClientGameManager : IBjGameManager
    {
        private GameType GameType = GameType.NotSet;

        public ClientGameManager(Connection connection)
        {
            Connection = connection;
        }

        public Connection Connection { get; set; }

        public GameState Initialize()
        {
            throw new NotImplementedException();
        }

        public GameState IncreaseBet(int value = 50)
        {
            var args = new List<object> {value};
            var req = new ServerRequest
            {
                GameType = GameType,
                RequestType = ServerMessageType.InGame
            };
            var methodInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            var response = InvokeRemote(methodInfo, args, req);
            return response.GameState;
        }

        public GameState DecreaseBet(int value = 50)
        {
            var args = new List<object> {value};
            var req = new ServerRequest
            {
                GameType = GameType,
                RequestType = ServerMessageType.InGame
            };
            var methodInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            var response = InvokeRemote(methodInfo, args, req);
            return response.GameState;
        }

        public GameState Start(GameType gameType = GameType.NotSet)
        {
            GameType = gameType;
            var args = new List<object>();
            var req = new ServerRequest
            {
                GameType = gameType,
                RequestType = ServerMessageType.StartGame
            };
            var methodInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            var response = InvokeRemote(methodInfo, args, req);
            return response.GameState;
        }

        public GameState Stop()
        {
            var args = new List<object>();
            var req = new ServerRequest
            {
                GameType = GameType,
                RequestType = ServerMessageType.InGame
            };
            var methodInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            var response = InvokeRemote(methodInfo, args, req);
            return response.GameState;
        }

        public GameState Double()
        {
            var args = new List<object>();
            var req = new ServerRequest
            {
                GameType = GameType,
                RequestType = ServerMessageType.InGame
            };
            var methodInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            var response = InvokeRemote(methodInfo, args, req);
            return response.GameState;
        }

        public GameState Stand()
        {
            var args = new List<object>();
            var req = new ServerRequest
            {
                GameType = GameType,
                RequestType = ServerMessageType.InGame
            };
            var methodInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            var response = InvokeRemote(methodInfo, args, req);
            return response.GameState;
        }

        public GameState Hit()
        {
            var args = new List<object>();
            var req = new ServerRequest
            {
                GameType = GameType,
                RequestType = ServerMessageType.InGame
            };
            var methodInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            var response = InvokeRemote(methodInfo, args, req);
            return response.GameState;
        }

        public GameState Login(string username, string pass)
        {
            var args = new List<object> {username, pass};
            var methodInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            var req = new ServerRequest
            {
                Credentials = new Credentials(username, pass),
                GameType = GameType,
                RequestType = ServerMessageType.Auth
            };
            var response = InvokeRemote(methodInfo, args, req);
            return response.GameState;
        }

        public GameState Logoff()
        {
            var args = new List<object>();
            var methodInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            var req = new ServerRequest
            {
                GameType = GameType,
                RequestType = ServerMessageType.Deauth
            };
            var response = InvokeRemote(methodInfo, args, req);
            return response.GameState;
        }

        public GameState GetState()
        {
            var args = new List<object>();
            var req = new ServerRequest
            {
                GameType = GameType,
                RequestType = ServerMessageType.InGame
            };
            var methodInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            var response = InvokeRemote(methodInfo, args, req);
            return response.GameState;
        }

        public bool IsAuthenticated()
        {
            var args = new List<object>();
            var req = new ServerRequest
            {
                RequestType = ServerMessageType.CheckAuth
            };
            var methodInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            var response = InvokeRemote(methodInfo, args, req);
            return response.IsAuthenticated;
        }

        public GameState GetLeaderboard()
        {
            var args = new List<object>();
            var req = new ServerRequest
            {
                GameType = GameType,
                RequestType = ServerMessageType.Leaderboard
            };
            var methodInfo = MethodBase.GetCurrentMethod() as MethodInfo;
            var response = InvokeRemote(methodInfo, args, req);
            return response.GameState;
        }

        private ServerResponse InvokeRemote(MethodInfo methodInfo, List<object> args, ServerRequest request)
        {
            var methodRequest = new MethodCallRequest
            {
                Arguments = args,
                Signature = methodInfo.ToMethodSignature()
            };
            request.RequestedMethod = methodRequest;
            Connection.SendRequest(request);
            var response = Connection.GetResponse();
            return response;
        }
    }
}


text:
//
//  JotTextView.h
//  jot
//
//  Created by Laura Skelton on 4/30/15.
//
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

/**
 *  Private class to handle text display and gesture interactions.
 *  Change the properties in a JotViewController instance to
 *  configure this private class.
 */
@interface JotTextView : UIView

/**
 *  The text string the JotTextView is currently displaying.
 *
 *  @note Set textString in JotViewController
 *  to control or read this property.
 */
@property (nonatomic, strong) NSString *textString;

/**
 *  The color of the text displayed in the JotTextView.
 *
 *  @note Set textColor in JotViewController
 *  to control this property.
 */
@property (nonatomic, strong) UIColor *textColor;

/**
 *  The font of the text displayed in the JotTextView.
 *
 *  @note Set font in JotViewController to control this property.
 *  To change the default size of the font, you must also set the
 *  fontSize property to the desired font size.
 */
@property (nonatomic, assign) UIFont *font;

/**
 *  The initial font size of the text displayed in the JotTextView. The
 *  displayed text's font size will get proportionally larger or smaller
 *  than this size if the viewer pinch zooms the text.
 *
 *  @note Set fontSize in JotViewController to control this property,
 *  which overrides the size of the font property.
 */
@property (nonatomic, assign) CGFloat fontSize;

/**
 *  The alignment of the text displayed in the JotTextView, which only
 *  applies if fitOriginalFontSizeToViewWidth is true.
 *
 *  @note Set textAlignment in JotViewController to control this property,
 *  which will be ignored if fitOriginalFontSizeToViewWidth is false.
 */
@property (nonatomic, assign) NSTextAlignment textAlignment;

/**
 *  The initial insets of the text displayed in the JotTextView, which only
 *  applies if fitOriginalFontSizeToViewWidth is true. If fitOriginalFontSizeToViewWidth
 *  is true, then initialTextInsets sets the initial insets of the displayed text relative to the
 *  full size of the JotTextView. The user can resize, move, and rotate the text from that
 *  starting position, but the overall proportions of the text will stay the same.
 *
 *  @note Set initialTextInsets in JotViewController to control this property,
 *  which will be ignored if fitOriginalFontSizeToViewWidth is false.
 */
@property (nonatomic, assign) UIEdgeInsets initialTextInsets;

/**
 *  If fitOriginalFontSizeToViewWidth is true, then the text will wrap to fit within the width
 *  of the JotTextView, with the given initialTextInsets, if any. The layout will reflect
 *  the textAlignment property as well as the initialTextInsets property. If this is false,
 *  then the text will be displayed as a single line, and will ignore any initialTextInsets and
 *  textAlignment settings
 *
 *  @note Set fitOriginalFontSizeToViewWidth in JotViewController to control this property.
 */
@property (nonatomic, assign) BOOL fitOriginalFontSizeToViewWidth;

/**
 *  Clears text from the drawing, giving a blank slate.
 *
 *  @note Call clearText or clearAll in JotViewController
 *  to trigger this method.
 */
- (void)clearText;

/**
 *  Overlays the text on the given background image.
 *
 *  @param image The background image to render text on top of.
 *
 *  @return An image of the rendered drawing on the background image.
 *
 *  @note Call drawOnImage: in JotViewController
 *  to trigger this method.
 */
- (UIImage *)drawTextOnImage:(UIImage *)image;

/**
 *  Renders the text overlay at full resolution for the given size.
 *
 *  @param size The size of the image to return.
 *
 *  @return An image of the rendered text.
 *
 *  @note Call renderWithSize: in JotViewController
 *  to trigger this method.
 */
- (UIImage *)renderDrawTextViewWithSize:(CGSize)size;

/**
 *  Tells the JotTextView to handle a pan gesture.
 *
 *  @param recognizer The pan gesture recognizer to handle.
 *
 *  @note This method is triggered by the JotDrawController's
 *  internal pan gesture recognizer.
 */
- (void)handlePanGesture:(UIGestureRecognizer *)recognizer;

/**
 *  Tells the JotTextView to handle a pinch or rotate gesture.
 *
 *  @param recognizer The pinch or rotation gesture recognizer to handle.
 *
 *  @note This method is triggered by the JotDrawController's
 *  internal pinch and rotation gesture recognizers.
 */
- (void)handlePinchOrRotateGesture:(UIGestureRecognizer *)recognizer;

@end


text:
import { parseToolbar } from 'gm3/actions/toolbar';

describe('test the toolbar parser', () => {

    const toolbarXml = `
        <toolbar>
            <tool name="findme" title="Find Me" type="action"/>

            <drawer name="dummy-drawer">
                <tool name="dummy1" title="Dummy Tool 1" type="service"/>
                <tool name="dummy2" title="Dummy Tool 2" type="service"/>
            </drawer>
        </toolbar>`;

    it('parses the xml', () => {
        const parser = new DOMParser();
        const xml = parser.parseFromString(toolbarXml, 'text/xml');
        const results = parseToolbar(xml.getElementsByTagName('toolbar')[0]);
        expect(results).toBeDefined();
    });

    it('should return no actions when the toolbar is undefined', () => {
        expect(parseToolbar(undefined).length).toBe(0);
    });

});


text:
class TestRule
  def match(to, sms)
    to
  end
end


text:
module FilterForm
  module InputOptions
    module Boolean
      class Base < FilterForm::InputOptions::Base
        DEFAULT_PREDICATE = :true

        private

        def additional_options
          { as: :boolean }
        end

        def additional_input_options
          super.merge(checked: !!input_value)
        end
      end
    end
  end
end


text:
'use strict';

var base = './fixtures',
    util = require('../../../../tasks/lib/util')(require('grunt')),

    fixtures = {

        single: {
            source      : require(base + '/single.json'),
            expected    : require(base + '/single.expected.json'),
            message     : 'should generate a config array'
        },

        literal: {
            source      : require(base + '/literal.json'),
            expected    : require(base + '/literal.expected.json'),
            message     : 'should support objects'
        },

        deep: {
            source      : require(base + '/deep.json'),
            expected    : require(base + '/deep.expected.json'),
            message     : "should support nesting"
        },

        options: {

            source      : function () {

                return [require(base + '/single.json'), {
                    namespace: 'ft',
                    delimiter: '_'
                }];

            },

            expected    : require(base + '/options.expected.json'),
            message     : 'should support option overrides'

        },

    };

module.exports.util = {

    setUp: function(done) {

        // setup here if necessary
        done();

    },

    register: function(test) {

        var register = util.register,
            tests    = Object.keys(fixtures);

        test.expect(tests.length);

        tests.forEach(function (tst) {

            tst = fixtures[tst];

            var source = typeof tst.source === 'function' ? tst.source() : [tst.source];

            test.deepEqual(register.apply(register, source), tst.expected, tst.message);

        });

        test.done();

    }

};