text:
class CreateMessages < ActiveRecord::Migration[5.1]
  def change
    create_table :messages do |t|
      t.belongs_to :user, index: true
      t.belongs_to :room, index: true
      t.string :content
      t.timestamps
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace KitVideoBundle\Controller;

use KitVideoBundle\Entity\VideoLog;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

/**
 * Videolog controller.
 *
 */
class VideoLogController extends Controller
{
    /**
     * Lists all videoLog entities.
     *
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        $videoLogs = $em->getRepository('KitVideoBundle:VideoLog')->findAll();

        return $this->render('videolog/index.html.twig', array(
            'videoLogs' => $videoLogs,
        ));
    }

    /**
     * Creates a new videoLog entity.
     *
     */
    public function newAction(Request $request)
    {
        $videoLog = new Videolog();
        $form = $this->createForm('KitVideoBundle\Form\VideoLogType', $videoLog);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($videoLog);
            $em->flush($videoLog);

            return $this->redirectToRoute('videolog_show', array('id' => $videoLog->getId()));
        }

        return $this->render('videolog/new.html.twig', array(
            'videoLog' => $videoLog,
            'form' => $form->createView(),
        ));
    }

    /**
     * Finds and displays a videoLog entity.
     *
     */
    public function showAction(VideoLog $videoLog)
    {
        $deleteForm = $this->createDeleteForm($videoLog);

        return $this->render('videolog/show.html.twig', array(
            'videoLog' => $videoLog,
            'delete_form' => $deleteForm->createView(),
        ));
    }

    /**
     * Displays a form to edit an existing videoLog entity.
     *
     */
    public function editAction(Request $request, VideoLog $videoLog)
    {
        $deleteForm = $this->createDeleteForm($videoLog);
        $editForm = $this->createForm('KitVideoBundle\Form\VideoLogType', $videoLog);
        $editForm->handleRequest($request);

        if ($editForm->isSubmitted() && $editForm->isValid()) {
            $this->getDoctrine()->getManager()->flush();

            return $this->redirectToRoute('videolog_edit', array('id' => $videoLog->getId()));
        }

        return $this->render('videolog/edit.html.twig', array(
            'videoLog' => $videoLog,
            'edit_form' => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        ));
    }

    /**
     * Deletes a videoLog entity.
     *
     */
    public function deleteAction(Request $request, VideoLog $videoLog)
    {
        $form = $this->createDeleteForm($videoLog);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->remove($videoLog);
            $em->flush($videoLog);
        }

        return $this->redirectToRoute('videolog_index');
    }

    /**
     * Creates a form to delete a videoLog entity.
     *
     * @param VideoLog $videoLog The videoLog entity
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createDeleteForm(VideoLog $videoLog)
    {
        return $this->createFormBuilder()
            ->setAction($this->generateUrl('videolog_delete', array('id' => $videoLog->getId())))
            ->setMethod('DELETE')
            ->getForm()
        ;
    }
}


text:
using System;
using System.Collections;
using System.Runtime.InteropServices;

public struct AA
{
    public static byte Static2()
    {
        do
        {
            TypedReference local19 = __makeref(App.m_xFwd6);
            do
            {
            }
            while (App.m_bFwd5);
        }
        while (App.m_bFwd5);
        return App.m_byFwd9;
    }
}

[StructLayout(LayoutKind.Sequential)]
public class App
{
    private static int Main()
    {
        try
        {
            Console.WriteLine("Testing AA::Static2");
            AA.Static2();
        }
        catch (Exception x)
        {
            Console.WriteLine("Exception handled: " + x.ToString());
        }
        Console.WriteLine("Passed.");
        return 100;
    }
    public static bool m_bFwd5;
    public static AA m_xFwd6;
    public static byte m_byFwd9;
}


text:
<?php

namespace SFDigital\ColourPickerBundle\FieldType\ColourPicker;

use eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter;
use eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue;
//use eZ\Publish\Core\Persistence\Legacy\Content\FieldDefinition;
use eZ\Publish\SPI\Persistence\Content\FieldValue;
use eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition;
use eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition;

class LegacyConverter implements Converter
{
    public function toStorageValue( FieldValue $value, StorageFieldValue $storageFieldValue )
    {
        $storageFieldValue->dataText = $value->hexValue;
        $storageFieldValue->sortKeyInt = $value->sortKey;
    }
    public function toFieldValue( StorageFieldValue $value, FieldValue $fieldValue )
    {
        $fieldValue->hexValue = $value->dataText;
        $fieldValue->sortKey = $value->sortKeyInt;
    }

    public function toStorageFieldDefinition( FieldDefinition $fieldDef, StorageFieldDefinition $storageDef )
    {
    }

    public function toFieldDefinition( StorageFieldDefinition $storageDef, FieldDefinition $fieldDef )
    {
    }

    public function getIndexColumn()
    {
        return 'sort_key_int';
    }
}

?>


text:
package org.efaps.esjp.common.dashboard;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

import org.efaps.admin.program.esjp.EFapsApplication;
import org.efaps.admin.program.esjp.EFapsClassLoader;
import org.efaps.admin.program.esjp.EFapsUUID;
import org.efaps.api.ui.IDashboard;
import org.efaps.api.ui.IEsjpSnipplet;
import org.efaps.ci.CIAdminProgram;
import org.efaps.db.CachedPrintQuery;
import org.efaps.db.Instance;
import org.efaps.db.MultiPrintQuery;
import org.efaps.db.PrintQuery;
import org.efaps.db.QueryBuilder;
import org.efaps.db.SelectBuilder;
import org.efaps.esjp.ci.CICommon;
import org.efaps.esjp.common.AbstractCommon;
import org.efaps.util.EFapsBaseException;
import org.efaps.util.EFapsException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * The Class EsjpSnippletFactory_Base.
 *
 * @author The eFaps Team
 */
@EFapsUUID("159f73ed-f9ee-4015-b6eb-0acbf5fcc812")
@EFapsApplication("eFaps-Kernel")
public abstract class Dashboard_Base
    extends AbstractCommon
    implements IDashboard
{

    /** The Constant CACHEKEY. */
    public static final String CACHEKEY = Dashboard.class.getName() + ".CacheKey";

    /** */
    private static final long serialVersionUID = 1L;

    /**
     * Logger for this class.
     */
    private static final Logger LOG = LoggerFactory.getLogger(Dashboard.class);

    /** The title. */
    private String title;

    /** The dashboard inst. */
    private Instance dashboardInst;

    /**
     * Gets the dashboard inst.
     *
     * @return the dashboard inst
     */
    public Instance getDashboardInst()
    {
        return this.dashboardInst;
    }

    /**
     * Sets the dashboard inst.
     *
     * @param _dashboardInst the new dashboard inst
     */
    public void setDashboardInst(final Instance _dashboardInst)
    {
        this.dashboardInst = _dashboardInst;
    }

    @Override
    public IEsjpSnipplet getEsjpSnipplet(final String _key)
    {
        IEsjpSnipplet ret = null;
        try {
            Instance elInst = null;

            final QueryBuilder elQueryBldr = new QueryBuilder(CICommon.DashboardDefault2Element);
            elQueryBldr.addWhereAttrEqValue(CICommon.DashboardDefault2Element.Field, _key);
            elQueryBldr.addWhereAttrEqValue(CICommon.DashboardDefault2Element.FromLink, getDashboardInst());
            final MultiPrintQuery multi = elQueryBldr.getCachedPrint(CACHEKEY);
            final SelectBuilder selElInst = SelectBuilder.get().linkto(CICommon.DashboardDefault2Element.ToLink)
                            .instance();
            multi.addSelect(selElInst);
            multi.execute();
            if (multi.next()) {
                elInst = multi.getSelect(selElInst);
            }

            if (elInst != null && elInst.isValid()) {
                final PrintQuery print = new CachedPrintQuery(elInst, CACHEKEY);
                final SelectBuilder selEsjpName = SelectBuilder.get().linkto(CICommon.DashboardElement.EsjpLink)
                                .attribute(CIAdminProgram.Java.Name);
                print.addSelect(selEsjpName);
                print.addAttribute(CICommon.DashboardElement.Config);
                if (print.execute()) {
                    final String className = print.getSelect(selEsjpName);
                    final String config = print.getAttribute(CICommon.DashboardElement.Config);
                    final Class<?> clazz = Class.forName(className, false, EFapsClassLoader.getInstance());
                    final Constructor<?>[] constructors = clazz.getDeclaredConstructors();
                    for (final Constructor<?> constructor : constructors) {
                        if (constructor.getParameterTypes().length == 1 && constructor.getParameterTypes()[0]
                                        .isInstance(new String())) {
                            ret = (IEsjpSnipplet) constructor.newInstance(config);
                            break;
                        }
                    }
                    if (ret == null) {
                        ret = (IEsjpSnipplet) clazz.newInstance();
                    }
                }
            }
        } catch (final ClassNotFoundException | SecurityException | InstantiationException | IllegalAccessException
                        | IllegalArgumentException | InvocationTargetException e) {
            LOG.error("Catched error during class instantiation: ", e);
        } catch (final EFapsException e) {
            LOG.error("Catched error: ", e);
        }
        return ret == null ? new DefaultSnipplet() : ret;
    }

    @Override
    public String getTitle()
    {
        return this.title;
    }

    /**
     * Sets the title.
     *
     * @param _title the new title
     */
    public void setTitle(final String _title)
    {
        this.title = _title;
    }

    /**
     * The Class DefaultSnipplet.
     *
     */
    public static class DefaultSnipplet
        implements IEsjpSnipplet
    {

        /**
         *
         */
        private static final long serialVersionUID = 1L;

        @Override
        public CharSequence getHtmlSnipplet()
            throws EFapsBaseException
        {
            return "";
        }

        @Override
        public boolean isVisible()
            throws EFapsBaseException
        {
            return false;
        }

        @Override
        public String getIdentifier()
            throws EFapsBaseException
        {
            return "DefaultSnipplet";
        }
    }
}


text:
Java Libraries

Some sample questions to build some simple Java classes


text:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace DaaSDemo.KubeClient.Models
{
    /// <summary>
    ///     SecurityContext holds security configuration that will be applied to a container. Some fields are present in both SecurityContext and PodSecurityContext.  When both are set, the values in SecurityContext take precedence.
    /// </summary>
    public class SecurityContextV1
    {
        /// <summary>
        ///     Run container in privileged mode. Processes in privileged containers are essentially equivalent to root on the host. Defaults to false.
        /// </summary>
        [JsonProperty("privileged")]
        public bool Privileged { get; set; }

        /// <summary>
        ///     Whether this container has a read-only root filesystem. Default is false.
        /// </summary>
        [JsonProperty("readOnlyRootFilesystem")]
        public bool ReadOnlyRootFilesystem { get; set; }

        /// <summary>
        ///     The UID to run the entrypoint of the container process. Defaults to user specified in image metadata if unspecified. May also be set in PodSecurityContext.  If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.
        /// </summary>
        [JsonProperty("runAsUser")]
        public int RunAsUser { get; set; }

        /// <summary>
        ///     The capabilities to add/drop when running containers. Defaults to the default set of capabilities granted by the container runtime.
        /// </summary>
        [JsonProperty("capabilities")]
        public CapabilitiesV1 Capabilities { get; set; }

        /// <summary>
        ///     The SELinux context to be applied to the container. If unspecified, the container runtime will allocate a random SELinux context for each container.  May also be set in PodSecurityContext.  If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.
        /// </summary>
        [JsonProperty("seLinuxOptions")]
        public SELinuxOptionsV1 SeLinuxOptions { get; set; }

        /// <summary>
        ///     Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext.  If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.
        /// </summary>
        [JsonProperty("runAsNonRoot")]
        public bool RunAsNonRoot { get; set; }
    }
}


text:
<?php

namespace Omnipay\Mollie\Message\Request;

use Omnipay\Common\Exception\InvalidRequestException;
use Omnipay\Common\Message\ResponseInterface;
use Omnipay\Mollie\Message\Response\PurchaseResponse;

/**
 * Create a payment with the Mollie API.
 *
 * @see https://docs.mollie.com/reference/v2/payments-api/create-payment
 * @method PurchaseResponse send()
 */
class PurchaseRequest extends AbstractMollieRequest
{
    /**
     * @return array
     */
    public function getMetadata()
    {
        return $this->getParameter('metadata');
    }

    /**
     * @param array $value
     * @return $this
     */
    public function setMetadata(array $value)
    {
        return $this->setParameter('metadata', $value);
    }

    /**
     * @return string
     */
    public function getLocale()
    {
        return $this->getParameter('locale');
    }

    /**
     * @param string $value
     * @return $this
     */
    public function setLocale($value)
    {
        return $this->setParameter('locale', $value);
    }

    /**
     * @return string
     */
    public function getBillingEmail()
    {
        return $this->getParameter('billingEmail');
    }

    /**
     * @param string $value
     * @return $this
     */
    public function setBillingEmail($value)
    {
        return $this->setParameter('billingEmail', $value);
    }

    /**
     * @return string
     */
    public function getCustomerReference()
    {
        return $this->getParameter('customerReference');
    }

    /**
     * @param string $value
     * @return $this
     */
    public function setCustomerReference($value)
    {
        return $this->setParameter('customerReference', $value);
    }

    /**
     * @return string
     */
    public function getMandateId()
    {
        return $this->getParameter('mandateId');
    }

    /**
     * @param string $value
     * @return $this
     */
    public function setMandateId($value)
    {
        return $this->setParameter('mandateId', $value);
    }

    /**
     * @return string
     */
    public function getSequenceType()
    {
        return $this->getParameter('sequenceType');
    }

    /**
     * @param string $value
     * @return $this
     */
    public function setSequenceType($value)
    {
        return $this->setParameter('sequenceType', $value);
    }

    /**
     * @return string
     */
    public function getCardToken()
    {
        return $this->getParameter('cardToken');
    }

    /**
     * @param string $value
     * @return $this
     */
    public function setCardToken($value)
    {
        return $this->setParameter('cardToken', $value);
    }

    /**
     * @return string
     */
    public function getInclude()
    {
        return $this->getParameter('include');
    }

    /**
     * @param string $value
     * @return $this
     */
    public function setInclude($value)
    {
        return $this->setParameter('include', $value);
    }

    /**
     * @return array
     * @throws InvalidRequestException
     */
    public function getData()
    {
        $this->validate('apiKey', 'amount', 'currency', 'description', 'returnUrl');

        $data = [];
        $data['amount'] = [
            "value" => $this->getAmount(),
            "currency" => $this->getCurrency()
        ];
        $data['description'] = $this->getDescription();
        $data['redirectUrl'] = $this->getReturnUrl();
        $data['method'] = $this->getPaymentMethod();
        $data['metadata'] = $this->getMetadata();

        if ($this->getTransactionId()) {
            $data['metadata']['transactionId'] = $this->getTransactionId();
        }

        if ($issuer = $this->getIssuer()) {
            $data['issuer'] = $issuer;
        }

        $webhookUrl = $this->getNotifyUrl();
        if (null !== $webhookUrl) {
            $data['webhookUrl'] = $webhookUrl;
        }

        if ($locale = $this->getLocale()) {
            $data['locale'] = $locale;
        }

        if ($billingEmail = $this->getBillingEmail()) {
            $data['billingEmail'] = $billingEmail;
        }

        if ($customerReference = $this->getCustomerReference()) {
            $data['customerId'] = $customerReference;
        }

        if ($sequenceType = $this->getSequenceType()) {
            $data['sequenceType'] = $sequenceType;
        }

        if ($mandateId = $this->getMandateId()) {
            $data['mandateId'] = $mandateId;
        }

        if ($cardToken = $this->getCardToken()) {
            $data['cardToken'] = $cardToken;
        }

        return $data;
    }

    /**
     * @param array $data
     * @return ResponseInterface|PurchaseResponse
     */
    public function sendData($data)
    {
        $endpoint = '/payments';

        if ($include = $this->getInclude()) {
            $endpoint .= '?include=' . $include;
        }

        $response = $this->sendRequest(self::POST, $endpoint, $data);

        return $this->response = new PurchaseResponse($this, $response);
    }
}


text: The c++ codes for exemples


text:
import os
from django.conf import settings

"""URL mapping for the chirp website.

All URLs point to the administrative interface.  For example, the
URL to administer new task assignments for volunteers would be::

    /volunteers/taskassignment/

"""

from django.conf.urls.defaults import *

from django.contrib import admin
# Necessary to load modules from chirp.volunteers.admin
admin.autodiscover()

urlpatterns = patterns('',
    # Example:
    (r'^chirp/', include('chirp.volunteers.urls')),
)

if settings.DEBUG:
    urlpatterns += patterns('',
    # this needs to be separate from admin media:
    (r'^local_site_media/(?P<path>.*)$',
                    'django.views.static.serve', {
                        'show_indexes': True,
                        'document_root': os.path.join(settings.PROJECT_ROOT_DIR, 'media')
                    }),
    )

# route all other requests to admin:
urlpatterns += patterns('',
    (r'^$', 'chirp.volunteers.views.admin_index'), # special case
    (r'', include(admin.site.urls)),
)


text:
<?php

namespace SocketCluster;

use Illuminate\Broadcasting\BroadcastManager;
use Illuminate\Support\ServiceProvider as BaseServiceProvider;

class SocketClusterServiceProvider extends BaseServiceProvider
{
    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * Register bindings in the container.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton('SocketClusterClient', function ($app) {
            $config = $app['config']['broadcasting']['connections']['socketcluster'];
            $websocket = WebSocketClient::factory($config['options']);

            return new SocketClusterClient($websocket, $config['app_key'],
                $config['secret']);
        });
    }

    /**
     * Register new BroadcastManager in boot.
     *
     * @return void
     */
    public function boot()
    {
        $this->app
            ->make(BroadcastManager::class)
            ->extend('socketcluster', function ($app) {
                return new SocketClusterBroadcaster($app['SocketClusterClient']);
            });
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {
        return ['SocketClusterClient'];
    }
}


text:
public partial class GameEntity {

    public UnsupportedObjectComponent unsupportedObject { get { return (UnsupportedObjectComponent)GetComponent(GameComponentsLookup.UnsupportedObject); } }
    public bool hasUnsupportedObject { get { return HasComponent(GameComponentsLookup.UnsupportedObject); } }

    public void AddUnsupportedObject(UnsupportedObject newUnsupportedObject) {
        var index = GameComponentsLookup.UnsupportedObject;
        var component = (UnsupportedObjectComponent)CreateComponent(index, typeof(UnsupportedObjectComponent));
        component.unsupportedObject = newUnsupportedObject;
        AddComponent(index, component);
    }

    public void ReplaceUnsupportedObject(UnsupportedObject newUnsupportedObject) {
        var index = GameComponentsLookup.UnsupportedObject;
        var component = (UnsupportedObjectComponent)CreateComponent(index, typeof(UnsupportedObjectComponent));
        component.unsupportedObject = newUnsupportedObject;
        ReplaceComponent(index, component);
    }

    public void RemoveUnsupportedObject() {
        RemoveComponent(GameComponentsLookup.UnsupportedObject);
    }
}

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by Entitas.CodeGeneration.Plugins.ComponentMatcherApiGenerator.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
public sealed partial class GameMatcher {

    static Entitas.IMatcher<GameEntity> _matcherUnsupportedObject;

    public static Entitas.IMatcher<GameEntity> UnsupportedObject {
        get {
            if (_matcherUnsupportedObject == null) {
                var matcher = (Entitas.Matcher<GameEntity>)Entitas.Matcher<GameEntity>.AllOf(GameComponentsLookup.UnsupportedObject);
                matcher.componentNames = GameComponentsLookup.componentNames;
                _matcherUnsupportedObject = matcher;
            }

            return _matcherUnsupportedObject;
        }
    }
}


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports["default"] = undefined;

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _reactNative = require('react-native');

var _default = require('../style/themes/default');

var _default2 = _interopRequireDefault(_default);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var __assign = undefined && undefined.__assign || Object.assign || function (t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
        s = arguments[i];
        for (var p in s) {
            if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
    }
    return t;
};

var Button = function (_React$Component) {
    (0, _inherits3["default"])(Button, _React$Component);

    function Button(props) {
        (0, _classCallCheck3["default"])(this, Button);

        var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this, props));

        _this.onPressIn = function () {
            for (var _len = arguments.length, arg = Array(_len), _key = 0; _key < _len; _key++) {
                arg[_key] = arguments[_key];
            }

            if (!_this.props.disabled) {
                _this.setState({ pressIn: true });
            }
            if (_this.props.onPressIn) {
                _this.props.onPressIn(arg);
            }
        };
        _this.onPressOut = function () {
            for (var _len2 = arguments.length, arg = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
                arg[_key2] = arguments[_key2];
            }

            if (!_this.props.disabled) {
                _this.setState({ pressIn: false });
            }
            if (_this.props.onPressOut) {
                _this.props.onPressOut(arg);
            }
        };
        _this.onShowUnderlay = function () {
            for (var _len3 = arguments.length, arg = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
                arg[_key3] = arguments[_key3];
            }

            if (!_this.props.disabled) {
                _this.setState({ touchIt: true });
            }
            if (_this.props.onShowUnderlay) {
                _this.props.onShowUnderlay(arg);
            }
        };
        _this.onHideUnderlay = function () {
            for (var _len4 = arguments.length, arg = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
                arg[_key4] = arguments[_key4];
            }

            if (!_this.props.disabled) {
                _this.setState({ touchIt: false });
            }
            if (_this.props.onHideUnderlay) {
                _this.props.onHideUnderlay(arg);
            }
        };
        _this.state = {
            pressIn: false,
            touchIt: false
        };
        return _this;
    }

    Button.prototype.render = function render() {
        var _this2 = this;

        var _props = this.props,
            size = _props.size,
            type = _props.type,
            disabled = _props.disabled,
            activeStyle = _props.activeStyle;

        var height = void 0;
        var fontSize = void 0;
        var paddingLeft = void 0;
        var paddingRight = void 0;
        var backgroundColor = void 0;
        var textColor = void 0;
        var borderColor = void 0;
        var highlightBackgroundColor = void 0;
        var highlightTextColor = void 0;
        var highlightBorderColor = void 0;
        switch (size) {
            case 'large':
                height = _default2["default"].button_height;
                fontSize = _default2["default"].button_font_size;
                paddingLeft = paddingRight = _default2["default"].h_spacing_sm;
                break;
            case 'small':
                height = _default2["default"].button_height_sm;
                fontSize = _default2["default"].button_font_size_sm;
                paddingLeft = paddingRight = _default2["default"].h_spacing_sm;
                break;
            default:
                break;
        }
        if (type === 'primary') {
            textColor = _default2["default"].color_text_base_inverse;
            backgroundColor = _default2["default"].primary_button_fill;
            borderColor = _default2["default"].primary_button_fill;
            highlightTextColor = _default2["default"].color_text_base_inverse;
            highlightBackgroundColor = _default2["default"].primary_button_fill_tap;
            highlightBorderColor = _default2["default"].primary_button_fill;
        } else if (type === 'ghost') {
            textColor = _default2["default"].ghost_button_color;
            backgroundColor = 'transparent';
            borderColor = _default2["default"].ghost_button_color;
            highlightTextColor = _default2["default"].color_text_base_inverse;
            highlightBackgroundColor = _default2["default"].ghost_button_fill_tap;
            highlightBorderColor = _default2["default"].ghost_button_color;
        } else if (type === 'warning') {
            textColor = _default2["default"].brand_warning;
            backgroundColor = _default2["default"].fill_base;
            borderColor = _default2["default"].brand_warning;
            highlightTextColor = _default2["default"].color_text_base_inverse;
            highlightBackgroundColor = _default2["default"].brand_warning;
            highlightBorderColor = _default2["default"].brand_warning;
        } else {
            textColor = _default2["default"].color_text_base;
            backgroundColor = _default2["default"].fill_base;
            borderColor = _default2["default"].border_color_base;
            highlightTextColor = textColor;
            highlightBackgroundColor = _default2["default"].fill_tap;
            highlightBorderColor = _default2["default"].border_color_base;
        }
        if (disabled) {
            textColor = _default2["default"].color_text_disabled;
            backgroundColor = _default2["default"].fill_disabled;
            borderColor = _default2["default"].fill_disabled;
        }
        var textStyle = [{
            fontSize: fontSize,
            color: this.state.pressIn ? highlightTextColor : textColor
        }];
        var wrapperStyle = [{
            alignItems: 'center',
            height: height,
            paddingLeft: paddingLeft,
            paddingRight: paddingRight,
            backgroundColor: backgroundColor,
            borderRadius: _default2["default"].radius_md,
            borderWidth: 1,
            borderColor: borderColor,
            justifyContent: 'center'
        }, {
            borderColor: this.state.pressIn ? highlightBorderColor : borderColor
        }];
        var unProp = {};
        unProp.underlayColor = activeStyle ? highlightBackgroundColor : backgroundColor;
        if (activeStyle && this.state.touchIt) {
            wrapperStyle.push(activeStyle);
        }
        wrapperStyle.push(this.props.style);
        var newChild = _react2["default"].createElement(_reactNative.Text, { style: textStyle }, this.props.children);
        if (disabled) {
            return _react2["default"].createElement(_reactNative.View, __assign({}, this.props, { style: wrapperStyle }), newChild);
        }
        return _react2["default"].createElement(_reactNative.TouchableHighlight, __assign({ activeOpacity: 1, delayPressOut: 1 }, this.props, unProp, { style: wrapperStyle, onPress: function onPress(e) {
                return _this2.props.onClick && _this2.props.onClick(e);
            }, onPressIn: this.onPressIn, onPressOut: this.onPressOut, onShowUnderlay: this.onShowUnderlay, onHideUnderlay: this.onHideUnderlay }), newChild);
    };

    return Button;
}(_react2["default"].Component);

exports["default"] = Button;

Button.defaultProps = {
    pressIn: false,
    size: 'large',
    disabled: false,
    inline: false,
    loading: false,
    activeStyle: {},
    onClick: function onClick(_x) {},
    onPressIn: function onPressIn(_x) {},
    onPressOut: function onPressOut(_x) {},
    onShowUnderlay: function onShowUnderlay(_x) {},
    onHideUnderlay: function onHideUnderlay(_x) {}
};
module.exports = exports['default'];


text:
/* CSS Document */
@page {
    @bottom-center { content: 'Used with Permission © 2000 Wycliffe Bible Translators Inc.'; color:silver; font-size:70%}
}


text:
package com.navercorp.pinpoint.profiler.context;

import com.navercorp.pinpoint.common.util.CollectionUtils;
import com.navercorp.pinpoint.profiler.context.compress.SpanEventCompressor;
import com.navercorp.pinpoint.profiler.context.compress.SpanEventCompressorV2;

import java.util.List;

/**
 * @author Woonduk Kang(emeroad)
 */
public class SpanPostProcessorV2 implements SpanPostProcessor {

    private static final TraceDataFormatVersion V2 = TraceDataFormatVersion.V2;

    // TODO refactor injector
    private final SpanEventCompressor<Long> spanEventCompressor = new SpanEventCompressorV2();

    @Override
    public Span postProcess(Span span, List<SpanEvent> spanEventList) {
        span.setVersion(V2.getVersion());
        span.finish();
        if (CollectionUtils.hasLength(spanEventList)) {
            long spanStartTime = span.getStartTime();
            spanEventCompressor.compress(spanEventList, spanStartTime);
            span.setSpanEventList((List) spanEventList);
        }
        return span;
    }
}


text:
SpecBegin(A0EmailValidator)

describe(@"A0EmailValidator", ^{

    __block A0EmailValidator *validator;
    __block UITextField *field;

    beforeEach(^{
        field = mock(UITextField.class);
        validator = [[A0EmailValidator alloc] initWithField:field];
    });

    it(@"should fail init with nil field", ^{
        expect(^{
            validator = [[A0EmailValidator alloc] initWithField:nil];
        }).to.raise(NSInternalInconsistencyException);
    });

    sharedExamplesFor(@"valid email", ^(NSDictionary *data) {

        beforeEach(^{
            [given(field.text) willReturn:data[@"mail"]];
        });

        specify(@"should obtain value from field", ^{
            [validator validate];
            [MKTVerify(field) text];
        });

        specify(@"no error", ^{
            expect([validator validate]).to.beNil();
        });

    });

    itShouldBehaveLike(@"valid email", @{@"mail": @"mail@mail.com"});
    itShouldBehaveLike(@"valid email", @{@"mail": @"mail+filter1@auth0.com"});
    itShouldBehaveLike(@"valid email", @{@"mail": @"mail+filter1@auth0.com.ar"});
    itShouldBehaveLike(@"valid email", @{@"mail": @" mail@auth0.com.ar"});
    itShouldBehaveLike(@"valid email", @{@"mail": @"filter1@auth0.com.ar  "});
    itShouldBehaveLike(@"valid email", @{@"mail": @" mail@auth0.com.ar  "});

    sharedExamplesFor(@"invalid email", ^(NSDictionary *data) {

        beforeEach(^{
            [given(field.text) willReturn:data[@"mail"]];
        });

        specify(@"should obtain value from field", ^{
            [validator validate];
            [MKTVerify(field) text];
        });

        specify(@"an error", ^{
            expect([validator validate]).notTo.beNil();
        });

        specify(@"email error code", ^{
            expect([[validator validate] code]).to.equal(@(A0ErrorCodeInvalidEmail));
        });

    });

    itShouldBehaveLike(@"invalid email", @{});
    itShouldBehaveLike(@"invalid email", @{@"mail": @""});
    itShouldBehaveLike(@"invalid email", @{@"mail": @" "});
    itShouldBehaveLike(@"invalid email", @{@"mail": @"mail"});
    itShouldBehaveLike(@"invalid email", @{@"mail": @"mail.com"});
    itShouldBehaveLike(@"invalid email", @{@"mail": @"mail@mail"});
    itShouldBehaveLike(@"invalid email", @{@"mail": @"@mail.com"});
    itShouldBehaveLike(@"invalid email", @{@"mail": @"|mail@mail.com"});
    itShouldBehaveLike(@"invalid email", @{@"mail": @"mail@m.c"});
});

SpecEnd


text:
from selenium.webdriver.common.by import By
from . import base

class Home(base.Page):
    scene_links = base.make_elements(By.CSS_SELECTOR, "ul.scenes li a")


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <title>ActiveRecord::ConnectionAdapters::ConnectionPool::Reaper</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/github.css" type="text/css" media="screen" />

            Ruby on Rails 4.2.1

            Class
            ActiveRecord::ConnectionAdapters::ConnectionPool::Reaper

                <

                    Object

/Users/tony/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb

Every frequency seconds, the reaper will call
reap on pool. A reaper instantiated with a nil
frequency will never reap the connection pool.

Configure the frequency by setting "reaping_frequency" in your database
yaml file.

Methods

N

                new

R

                run

Attributes

              [R]

            frequency

              [R]

            pool

Class Public methods

              new(pool, frequency)

            Link

                Source:
                show

# File ../../../.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb, line 206
def initialize(pool, frequency)
  @pool      = pool
  @frequency = frequency
end

Instance Public methods

              run()

            Link

                Source:
                show

# File ../../../.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb, line 211
def run
  return unless frequency
  Thread.new(frequency, pool) { |t, p|
    while true
      sleep t
      p.reap
    end
  }
end


text:
// By default eslint assumes packages imported are supposed to be dependencies,
// not devDependencies. Disabling this rule in webpack.conig.js
/* eslint-disable import/no-extraneous-dependencies */
const webpack = require('webpack');

const path = require('path');
const Autoprefixer = require('autoprefixer');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const I18nAggregatorPlugin = require('terra-i18n-plugin');
const i18nSupportedLocales = require('terra-i18n/lib/i18nSupportedLocales');
const CustomProperties = require('postcss-custom-properties');
const rtl = require('postcss-rtl');

const customProperties = CustomProperties({ preserve: true, warnings: false });
customProperties.setVariables({
  '--terra-base-font-family': 'Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif',
  // Body
  '--terra-consumer-body-background-color': '#c7d4ea',
  // Nav
  '--terra-consumer-nav-background-color': 'rgba(255, 255, 255, 0.25)',
  '--terra-consumer-nav-width': '320px',
  '--terra-consumer-nav-link-color': '#3d3d3d',
  '--terra-consumer-nav-text-color': '#3d3d3d',
  '--terra-consumer-mobile-close-button-color': '#3d3d3d',
  // profile
  // TODO profile-link-border-background color is time being as we don't have best way to access background image
  '--terra-consumer-profile-link-border-background': '#c7d4ea',
  '--terra-consumer-profile-link-background': 'rgba(255, 255, 255, 0.25)',
  '--terra-consumer-profile-link-width': '320px',
  '--terra-consumer-profile-link-color': '#3d3d3d',
});

module.exports = {
  entry: {
    'babel-polyfill': 'babel-polyfill',
    'terra-consumer': path.resolve(path.join(__dirname, 'src', 'Index')),
  },
  module: {
    loaders: [{
      test: /\.(jsx|js)$/,
      exclude: /node_modules/,
      loader: 'babel-loader',
    },
    {
      test: /\.json$/,
      loader: 'json-loader',
    },
    {
      test: /\.(scss|css)$/,
      use: ExtractTextPlugin.extract({
        fallback: 'style-loader',
        use: [{
          loader: 'css-loader',
          options: {
            sourceMap: true,
            importLoaders: 2,
            localIdentName: '[path]___[name]__[local]___[hash:base64:5]',
          },
        }, {
          loader: 'postcss-loader',
          options: {
            plugins() {
              return [
                Autoprefixer({
                  browsers: [
                    'ie >= 10',
                    'last 2 versions',
                    'last 2 android versions',
                    'last 2 and_chr versions',
                    'iOS >= 8',
                  ],
                }),
                customProperties,
                rtl(),
              ];
            },
          },
        },
        {
          loader: 'sass-loader',
        }],
      }),
    },
    {
      test: /\.md$/,
      loader: 'raw-loader',
    },
    {
      test: /\.(png|svg|jpg|gif)$/,
      use: [
        'file-loader',
      ],
    },
    ],
  },
  plugins: [
    new ExtractTextPlugin('[name]-[hash].css'),
    new HtmlWebpackPlugin({
      template: path.join(__dirname, 'src', 'index.html'),
      chunks: ['babel-polyfill', 'terra-consumer'],
    }),
    new I18nAggregatorPlugin({
      baseDirectory: __dirname,
      supportedLocales: i18nSupportedLocales,
    }),
    new webpack.NamedChunksPlugin(),
  ],
  resolve: {
    extensions: ['.js', '.jsx'],
    modules: [path.resolve(__dirname, 'aggregated-translations'), 'node_modules'],

    // See https://github.com/facebook/react/issues/8026
    alias: {
      react: path.resolve(__dirname, 'node_modules', 'react'),
      'react-intl': path.resolve(__dirname, 'node_modules/react-intl'),
      moment: path.resolve(__dirname, 'node_modules/moment'),
      'react-dom': path.resolve(__dirname, 'node_modules/react-dom'),
    },
  },
  output: {
    filename: '[name].js',
    path: path.join(__dirname, 'dist'),
  },
  devtool: 'source-map',
  devServer: {
    host: '0.0.0.0',
    disableHostCheck: true,
    stats: {
      assets: true,
      children: false,
      chunks: false,
      hash: false,
      modules: false,
      publicPath: false,
      timings: true,
      version: true,
      warnings: true,
    },
    overlay: {
      warnings: true,
      errors: true,
    },
  },
  resolveLoader: {
    modules: [path.resolve(path.join(__dirname, 'node_modules'))],
  },
};


text:
chrome.app.runtime.onLaunched.addListener(function() {
  chrome.app.window.create('index.html', {
	id: "mainwin",
    bounds: {
      width: 1050,
      height: 700
    }
  });
});


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Websites
{
    class Website
    {
        public string Host { get; set; }
        public string Domain { get; set; }
        public List<string> Queries { get; set; }

        public Website(string host, string domain, List<string> queries)
        {
            this.Host = host;
            this.Domain = domain;
            this.Queries = queries;
        }
    }

    class Websites
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            var websites = new List<Website>();

            while (line != "end")
            {
                string[] tokens = line.Split(new string[] { " | " }, StringSplitOptions.RemoveEmptyEntries);
                string host = tokens[0];
                string domain = tokens[1];

                if (tokens.Length > 2)
                {
                    List<string> queries = tokens[2].Split(',').ToList();
                    websites.Add(new Website(host, domain, queries));
                }
                else
                {
                    websites.Add(new Website(host, domain, null));
                }

                line = Console.ReadLine();
            }

            foreach (var website in websites)
            {
                Console.Write($"https://www.{website.Host}.{website.Domain}");

                if (website.Queries != null)
                {
                    Console.Write("/query?=[" + string.Join("]&[", website.Queries) + "]");
                }
                Console.WriteLine();
            }
        }
    }
}


text:
package pl.maciejwalkowiak.drools;

public class Purchase {
    private Customer customer;
    private Ticket ticket;

    public Purchase(Customer customer) {
        this.customer = customer;
        this.ticket = new Ticket();
    }

    public Customer getCustomer() {
        return customer;
    }

    public Ticket getTicket() {
        return ticket;
    }
}


text:
package com.google.javascript.jscomp;

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

import com.google.javascript.rhino.IR;
import com.google.javascript.rhino.JSDocInfoBuilder;
import com.google.javascript.rhino.JSTypeExpression;
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.Token;
import java.util.ArrayDeque;
import java.util.Deque;

/** Converts ES6 arrow functions to standard anonymous ES3 functions. */
public class Es6RewriteArrowFunction implements NodeTraversal.Callback, HotSwapCompilerPass {
  // The name of the vars that capture 'this' and 'arguments'
  // for converting arrow functions.
  private static final String ARGUMENTS_VAR = "$jscomp$arguments";
  private static final String THIS_VAR = "$jscomp$this";

  private static class ThisContext {
    final Node scopeBody;
    final boolean isConstructor;
    Node lastSuperStatement = null; // Last statement in the body that refers to super().
    boolean needsThisVar = false;
    boolean needsArgumentsVar = false;

    ThisContext(Node scopeBody, boolean isConstructor) {
      this.scopeBody = scopeBody;
      this.isConstructor = isConstructor;
    }

    static ThisContext forFunction(Node functionNode, Node functionParent) {
      Node scopeBody = functionNode.getLastChild();
      boolean isConstructor =
          functionParent.isMemberFunctionDef() && functionParent.getString().equals("constructor");
      return new ThisContext(scopeBody, isConstructor);
    }

    static ThisContext forScript(Node scriptNode) {
      return new ThisContext(scriptNode, false /* isConstructor */);
    }
  }

  private final AbstractCompiler compiler;
  private final Deque<ThisContext> thisContextStack;

  public Es6RewriteArrowFunction(AbstractCompiler compiler) {
    this.compiler = compiler;
    this.thisContextStack = new ArrayDeque<>();
  }

  @Override
  public void process(Node externs, Node root) {
    TranspilationPasses.processTranspile(compiler, externs, this);
    TranspilationPasses.processTranspile(compiler, root, this);
  }

  @Override
  public void hotSwapScript(Node scriptRoot, Node originalRoot) {
    TranspilationPasses.hotSwapTranspile(compiler, scriptRoot, this);
  }

  @Override
  public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {
    switch (n.getToken()) {
      case SCRIPT:
        thisContextStack.push(ThisContext.forScript(n));
        break;
      case FUNCTION:
        if (!n.isArrowFunction()) {
          thisContextStack.push(ThisContext.forFunction(n, parent));
        }
        break;
      case SUPER:
        ThisContext thisContext = checkNotNull(thisContextStack.peek());
        // super(...) within a constructor.
        if (thisContext.isConstructor && parent.isCall() && parent.getFirstChild() == n) {
          thisContext.lastSuperStatement = getEnclosingStatement(parent, thisContext.scopeBody);
        }
        break;
      default:
        break;
    }
    return true;
  }

  /**
   * @param n
   * @param block
   * @return The statement Node that is a child of block and contains n.
   */
  private Node getEnclosingStatement(Node n, Node block) {
    while (checkNotNull(n.getParent()) != block) {
      n = checkNotNull(NodeUtil.getEnclosingStatement(n.getParent()));
    }
    return n;
  }

  @Override
  public void visit(NodeTraversal t, Node n, Node parent) {
    ThisContext thisContext = thisContextStack.peek();

    if (n.isArrowFunction()) {
      visitArrowFunction(n, checkNotNull(thisContext));
    } else if (thisContext != null && thisContext.scopeBody == n) {
      thisContextStack.pop();
      addVarDecls(thisContext);
    }
  }

  private void visitArrowFunction(Node n, ThisContext thisContext) {
    n.setIsArrowFunction(false);
    n.makeNonIndexable();
    Node body = n.getLastChild();
    if (!body.isNormalBlock()) {
      body.detach();
      body = IR.block(IR.returnNode(body)).useSourceInfoIfMissingFromForTree(body);
      n.addChildToBack(body);
    }

    UpdateThisAndArgumentsReferences updater = new UpdateThisAndArgumentsReferences(compiler);
    NodeTraversal.traverseEs6(compiler, body, updater);
    thisContext.needsThisVar = thisContext.needsThisVar || updater.changedThis;
    thisContext.needsArgumentsVar = thisContext.needsArgumentsVar || updater.changedArguments;

    compiler.reportCodeChange();
  }

  private void addVarDecls(ThisContext thisContext) {
    Node scopeBody = thisContext.scopeBody;
    if (thisContext.needsArgumentsVar) {
      Node name = IR.name(ARGUMENTS_VAR);
      Node argumentsVar = IR.constNode(name, IR.name("arguments"));
      JSDocInfoBuilder jsdoc = new JSDocInfoBuilder(false);
      jsdoc.recordType(
          new JSTypeExpression(
              new Node(Token.BANG, IR.string("Arguments")), "<Es6RewriteArrowFunction>"));
      argumentsVar.setJSDocInfo(jsdoc.build());
      argumentsVar.useSourceInfoIfMissingFromForTree(scopeBody);
      scopeBody.addChildToFront(argumentsVar);
    }
    if (thisContext.needsThisVar) {
      Node name = IR.name(THIS_VAR);
      Node thisVar = IR.constNode(name, IR.thisNode());
      thisVar.useSourceInfoIfMissingFromForTree(scopeBody);
      if (thisContext.lastSuperStatement == null) {
        scopeBody.addChildToFront(thisVar);
      } else {
        // Not safe to reference `this` until after super() has been called.
        // TODO(bradfordcsmith): Some complex cases still aren't covered, like
        //     if (...) { super(); arrow function } else { super(); }
        scopeBody.addChildAfter(thisVar, thisContext.lastSuperStatement);
      }
    }
    compiler.reportCodeChange();
  }

  private static class UpdateThisAndArgumentsReferences implements NodeTraversal.Callback {
    private boolean changedThis = false;
    private boolean changedArguments = false;
    private final AbstractCompiler compiler;

    public UpdateThisAndArgumentsReferences(AbstractCompiler compiler) {
      this.compiler = compiler;
    }

    @Override
    public void visit(NodeTraversal t, Node n, Node parent) {
      if (n.isThis()) {
        Node name = IR.name(THIS_VAR).srcref(n);
        if (compiler.getOptions().preservesDetailedSourceInfo()) {
          name.setOriginalName("this");
        }
        parent.replaceChild(n, name);
        changedThis = true;
      } else if (n.isName() && n.getString().equals("arguments")) {
        Node name = IR.name(ARGUMENTS_VAR).srcref(n);
        if (compiler.getOptions().preservesDetailedSourceInfo()) {
          name.setOriginalName("arguments");
        }
        parent.replaceChild(n, name);
        changedArguments = true;
      }
    }

    @Override
    public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {
      return !n.isFunction() || n.isArrowFunction();
    }
  }
}


text:
[![npm Version](https://img.shields.io/npm/v/node-d3ck-bstrap.svg)](https://www.npmjs.com/package/node-d3ck-bstrap)
[![JS-Standard](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
[![Build Status](https://api.travis-ci.org/d3ck-org/node-d3ck-bstrap.svg?branch=master)](https://travis-ci.org/d3ck-org/node-d3ck-bstrap)
[![Dependency Status](https://david-dm.org/d3ck-org/node-d3ck-bstrap.svg)](https://david-dm.org/d3ck-org/node-d3ck-bstrap)

# node-d3ck-bstrap

Lightweight bootstrapping for node.js applications

**Please note** the major version of this module: [Major version zero (0.y.z) is for initial development. Anything may change at any time. The public API should not be considered stable.](http://semver.org/#spec-item-4).

## Features

Uses the modules [node-d3ck-log](https://github.com/d3ck-org/node-d3ck-log), [node-d3ck-cfg](https://github.com/d3ck-org/node-d3ck-cfg), [command-line-args](https://github.com/75lb/command-line-args) and optional
[node-uuid](https://github.com/broofa/node-uuid) to bootstrap (logging, configuration, command line arguments) a node.js application.

Features from [node-d3ck-log](https://github.com/d3ck-org/node-d3ck-log):

  * Lightweight and simple wrapper + utilities for [node-bunyan](https://github.com/trentm/node-bunyan) logger
  * Initializes a preconfigured (STDOUT / info) [bunyan](https://github.com/trentm/node-bunyan) logger (sharable across the whole application)
  * Supports [bunyan](https://github.com/trentm/node-bunyan) stream and log level changing with utility functions
  * Very lightweight: No extra module dependencies except [bunyan](https://github.com/trentm/node-bunyan)
  * Well documented (readme, manual and API reference)

Features from [node-d3ck-cfg](https://github.com/d3ck-org/node-d3ck-cfg):

  * Lightweight and simple configuration management based on JSON files
  * Supports staging
  * Supports environment variables and `init()` arguments to define configuration directories
  * Features a flat configuration structure with camel case keys (nested structures also possible)
  * Very lightweight: No extra module dependencies
  * Well documented (readme, manual and API reference)

Summary of [command-line-args](https://github.com/75lb/command-line-args):
  * _A library to collect command-line args and generate a usage guide_

Summary of [node-uuid](https://github.com/broofa/node-uuid):
  * _Simple, fast generation of RFC4122 UUIDS_

## Installation

    npm install node-d3ck-bstrap

## Usage

Configuration file:

    $ cat /home/foo/etc/cfg.json
    {"foo": "from cfg file"}

node.js application:

    var bstrap = require('node-d3ck-bstrap')
    var cfg = bstrap.cfg
    var log = bstrap.log

    // define supported command line arguments
    var clargs = {
      args: [
        {name: 'action', alias: 'a', type: String, description: 'Action: start, stop'}
      ],
      addArgs: ['help', 'verbose', 'quiet', 'stage', 'cfgdir'],
      usage: {
        title: 'Sample script for node-d3ck-bstrap',
        description: 'An application bootstrapped by node-d3ck-bstrap',
        synopsis: [
          '$ node [bold]{foo.js} --action X [--verbose] [--stage X] ...',
        ],
        examples: [
          '$ node [bold]{test.js} --action start --verbose'
        ],
        footer: 'Project home: [underline]{https://github.com/d3ck-org/node-d3ck-bstrap}'
      }
    }

    // bootstrapping
    var opts = {stage: 'dev', uuid: false}
    var data = {bar: 'from init()'}
    bstrap.init(clargs, opts, data)

    // print the configuration with the STDOUT-info bunyan logger
    log.info({cfg: cfg.get()}, 'Dumping configuration')

Run the application:

    $ node /path/to/script/foo.js -a start | ./node_modules/node-d3ck-log/node_modules/.bin/bunyan
      [2015-11-09T15:34:09.330Z]  INFO: stdout/2901: Dumping configuration
        cfg: {
          "_startTime": 1447083402646,
          "_myFilePath": "/path/to/script/foo.js",
          "_clargs": {                        // all command line arguments
            "action": "start"
          },
          "_pid": 2924,
          "_errors": 0,
          "_warnings": 0,
          "_count": 0,
          "_logLevel": "info",
          "_logStream": "stdout",
          "_verbose": false,
          "_quiet": false,
          "_uuid": null,
          "_uid": "path_to_script_foo_js",
          "_myFileName": "foo.js",
          "_myDirPath": "/path/to/script",
          "_tmpFileName": "foo.js.tmp",
          "_stage": "dev",
          "_cfgFiles": [
            "/path/to/script/cfg.json"
          ],
          "action": "start",                  // command line argument
          "bar": "from init()",               // init() argument
          "foo": "from cfg file"              // JSON cfg file value
        }

So, [node-d3ck-bstrap](https://github.com/d3ck-org/node-d3ck-bstrap) ...

* reads the JSON configuration file
* parses the command line arguments
* exports the configuration, command line arguments and some other useful values as `cfg`
* initializes and preconfigures the [bunyan](https://github.com/trentm/node-bunyan) logger

When the _--help_ command line argument is set, only the usage message is printed:

    $ node /path/to/script/foo.js -h
      USAGE HELP:

      Sample script for node-d3ck-bstrap
        An application bootstrapped by node-d3ck-bstrap

      Synopsis
        $ node foo.js --action X [--verbose] [--stage X] ...

      Options
        -a, --action string   Action: start, stop
        -h, --help            Display this usage guide
        -v, --verbose         Enable verbose mode
        -Q, --quiet           Enable silent mode
        -S, --stage string    Set stage (e.g. to dev, test or prod)

      Examples
        $ node foo.js --action start --verbose

        Project home: https://github.com/d3ck-org/node-d3ck-bstrap

## Documentation

* [User Manual](https://github.com/d3ck-org/node-d3ck-bstrap/blob/master/doc/manual.md)
* [API Reference](https://github.com/d3ck-org/node-d3ck-bstrap/blob/master/doc/api.md)

## See also / Credits

* [node-bunyan](https://github.com/trentm/node-bunyan)
* [command-line-args](https://github.com/75lb/command-line-args)
* [node-uuid](https://github.com/broofa/node-uuid)
* [js-standard](https://github.com/feross/standard)
* [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown)
* [node-d3ck-cfg](https://github.com/d3ck-org/node-d3ck-cfg)
* [node-d3ck-log](https://github.com/d3ck-org/node-d3ck-log)


text:
<?php
/**
 * RegEx values validator test
 * @file    RegExValidatorTest.php
 *
 * PHP version 7.1+
 *
 * @author  Alexander Yancharuk <alex at itvault dot info>
 * @date    Вск Фев 17 10:48:43 2013
 * @license The BSD 3-Clause License
 *          <https://tldrlegal.com/license/bsd-3-clause-license-(revised)>.
 */

namespace Veles\Tests\Validators;

use PHPUnit\Framework\TestCase;
use Veles\Validators\RegExValidator;

/**
 * Generated by PHPUnit_SkeletonGenerator 1.2.0 on 2013-05-26 at 09:40:24.
 * @group validators
 */
class RegExValidatorTest extends TestCase
{
    /**
     * @group Validators
	 * @see RegExValidator::check()
	 * @dataProvider checkProvider
     */
    public function testCheck($pattern, $value, $expected): void
    {
		$object = new RegExValidator($pattern);

		$actual = $object->check($value);

		$msg = 'Wrong RegExValidator::check() validation';
		self::assertSame($expected, $actual, $msg);
    }

	public function checkProvider(): array
	{
		return [
			[
				'/^\/(?:index.html|page\-(\d+)\.html)?$/',
				'/index.html',
				true
			],
			[
				'/^\/(?:index.html|page\-(\d+)\.html)?$/',
				'/page-19.html',
				true
			],
			[
				'/^\/(?:index.html|page\-(\d+)\.html)?$/',
				'/page-1d9.html',
				false
			]
		];
	}

    /**
	 * @group Validators
	 * @see RegExValidator::validate()
	 * @dataProvider validateProvider
     */
    public function testValidate($pattern, $value, $expected): void
    {
		$actual = RegExValidator::validate($pattern, $value);

		$msg = 'Wrong RegExValidator::validate() validation';
		self::assertSame($expected, $actual, $msg);
    }

	public function validateProvider(): array
	{
		return [
			[
				'/^\/(?:index.html|page\-(\d+)\.html)?$/',
				'/index.html',
				true
			],
			[
				'/^\/(?:index.html|page\-(\d+)\.html)?$/',
				'/page-19.html',
				true
			],
			[
				'/^\/(?:index.html|page\-(\d+)\.html)?$/',
				'/page-1d9.html',
				false
			]
		];
	}
}


text:
The following guide will show you how to build and run the sample [etcd ACI](https://github.com/coreos/etcd/releases/download/v2.0.9/etcd-v2.0.9-linux-amd64.aci) on the standard vagrantcloud.com [box for Ubuntu Trusty](https://vagrantcloud.com/ubuntu/boxes/trusty64).

## Download and start an Ubuntu Trusty box

```
vagrant init ubuntu/trusty64
vagrant up --provider virtualbox
```

## SSH into the VM and Install rkt

```
vagrant ssh
sudo su

wget https://github.com/coreos/rkt/releases/download/v0.7.0/rkt-v0.7.0.tar.gz
tar xzvf rkt-v0.7.0.tar.gz
cd rkt-v0.7.0
./rkt help
```

## Trust the CoreOS signing key

This shows how to trust the CoreOS signing key using the [`rkt trust` command](https://github.com/coreos/rkt/blob/master/Documentation/commands.md#rkt-trust).

```
./rkt trust --prefix=coreos.com/etcd
Prefix: "coreos.com/etcd"
Key: "https://coreos.com/dist/pubkeys/aci-pubkeys.gpg"
GPG key fingerprint is: 8B86 DE38 890D DB72 9186  7B02 5210 BD88 8818 2190
	CoreOS ACI Builder <release@coreos.com>
	Are you sure you want to trust this key (yes/no)? yes
	Trusting "https://coreos.com/dist/pubkeys/aci-pubkeys.gpg" for prefix "coreos.com/etcd".
	Added key for prefix "coreos.com/etcd" at "/etc/rkt/trustedkeys/prefix.d/coreos.com/etcd/8b86de38890ddb7291867b025210bd8888182190"
```

For more details on how signature verification works in rkt, see the [Signing and Verification Guide](https://github.com/coreos/rkt/blob/master/Documentation/signing-and-verification-guide.md).

## Fetch the ACI

The simplest way to retrieve the etcd ACI is to use image discovery:

```
./rkt fetch coreos.com/etcd:v2.0.9
rkt: searching for app image coreos.com/etcd:v2.0.9
rkt: fetching image from https://github.com/coreos/etcd/releases/download/v2.0.9/etcd-v2.0.9-linux-amd64.aci
Downloading signature from https://github.com/coreos/etcd/releases/download/v2.0.9/etcd-v2.0.9-linux-amd64.aci.asc
Downloading ACI: [================================             ] 2.71 MB/3.79 MB
rkt: signature verified:
  CoreOS ACI Builder <release@coreos.com>
  sha512-91e98d7f1679a097c878203c9659f2a2
```

For more on this and other ways to retrieve ACIs, check out the `rkt fetch` section of the [commands guide](https://github.com/coreos/rkt/blob/master/Documentation/commands.md#rkt-fetch).

## Run the ACI

Finally, let's run the application we just retrieved:

```
./rkt run coreos.com/etcd:v2.0.9
  rkt: searching for app image coreos.com/etcd:v2.0.9
  rkt: fetching image from https://github.com/coreos/etcd/releases/download/v2.0.9/etcd-v2.0.9-linux-amd64.aci
  2015/04/19 03:57:32 etcd: no data-dir provided, using default data-dir ./default.etcd
  2015/04/19 03:57:32 etcd: listening for peers on http://localhost:2380
  2015/04/19 03:57:32 etcd: listening for peers on http://localhost:7001
  2015/04/19 03:57:32 etcd: listening for client requests on http://localhost:2379
  2015/04/19 03:57:32 etcd: listening for client requests on http://localhost:4001
  2015/04/19 03:57:32 etcdserver: datadir is valid for the 2.0.1 format
  2015/04/19 03:57:32 etcdserver: name = default
  2015/04/19 03:57:32 etcdserver: data dir = default.etcd
  2015/04/19 03:57:32 etcdserver: member dir = default.etcd/member
  2015/04/19 03:57:32 etcdserver: heartbeat = 100ms
  2015/04/19 03:57:32 etcdserver: election = 1000ms
  2015/04/19 03:57:32 etcdserver: snapshot count = 10000
  2015/04/19 03:57:32 etcdserver: advertise client URLs = http://localhost:2379,http://localhost:4001
  2015/04/19 03:57:32 etcdserver: initial advertise peer URLs = http://localhost:2380,http://localhost:7001
  2015/04/19 03:57:32 etcdserver: initial cluster = default=http://localhost:2380,default=http://localhost:7001
  2015/04/19 03:57:32 etcdserver: start member ce2a822cea30bfca in cluster 7e27652122e8b2ae
  2015/04/19 03:57:32 raft: ce2a822cea30bfca became follower at term 0
  2015/04/19 03:57:32 raft: newRaft ce2a822cea30bfca [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
  2015/04/19 03:57:32 raft: ce2a822cea30bfca became follower at term 1
  2015/04/19 03:57:32 etcdserver: added local member ce2a822cea30bfca [http://localhost:2380 http://localhost:7001] to cluster 7e27652122e8b2ae
  2015/04/19 03:57:33 raft: ce2a822cea30bfca is starting a new election at term 1
  2015/04/19 03:57:33 raft: ce2a822cea30bfca became candidate at term 2
  2015/04/19 03:57:33 raft: ce2a822cea30bfca received vote from ce2a822cea30bfca at term 2
  2015/04/19 03:57:33 raft: ce2a822cea30bfca became leader at term 2
  2015/04/19 03:57:33 raft.node: ce2a822cea30bfca elected leader ce2a822cea30bfca at term 2
  2015/04/19 03:57:33 etcdserver: published {Name:default ClientURLs:[http://localhost:2379 http://localhost:4001]} to cluster 7e27652122e8b2ae
```

Congratulations! You've run your first application with rkt.
For more on how to use rkt, check out the [commands guide](https://github.com/coreos/rkt/blob/master/Documentation/commands.md).


text:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">

    <PreferenceCategory
        android:title="@string/pref_header_general"
        android:key="pref_key_settings_general">

        <SwitchPreference
            android:defaultValue="true"
            android:key="double_back_to_exit"
            android:title="@string/pref_title_double_back_to_exit" />

        <SwitchPreference
            android:defaultValue="true"
            android:key="mascot_voice_switch"
            android:title="@string/pref_title_enable_mascot_voice" />
    </PreferenceCategory>

    <PreferenceCategory
        android:title="@string/pref_header_account"
        android:key="pref_key_settings_account">

        <SwitchPreference
            android:defaultValue="true"
            android:key="keep_login_switch"
            android:summary="@string/pref_description_keep_login"
            android:title="@string/pref_title_keep_login" />
    </PreferenceCategory>
</PreferenceScreen>


text:
function check_range_error(code)
{
  try {
    eval(code);
    assert(false);
  } catch (e) {
    assert(e instanceof RangeError);
  }
}

// Invalid cases

check_range_error("new Uint8Array(1e15)");
check_range_error("new Uint8Array(4294967296)");
check_range_error("new Uint8Array(4294967296 - 1)");
check_range_error("new Uint8Array(-1)");

// Valid cases
assert((new Uint8Array(3.5)).length === 3)
assert((new Uint8Array(-0.5)).length === 0)


text:
/*
  Place all the styles related to the matching controller here.
  They will automatically be included in application.css.
*/
.links {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    position: fixed;
    bottom: 0;
    background-color: white;
    width: 100%;
    padding: 5px
}

.links a {
    color: rgb(0, 136, 204);
}

.links a:visited {
    color: rgb(0, 85, 128);
}

.log_table {
    width: 100%;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
}

.log_table td, th {
    border-bottom: 1px dashed lightgray;
    padding: 5px;
}

td.error {
    color: #ac0000;
    background-color: linen;
}

input {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    padding: 5px;
    border-width: 1px;
    border-color: lightgray;
    border-radius: 4px;
    border-style: solid;
    width: 30%;
}

#refresh {
    position: fixed;
    top: 10px;
    right: 30px;
    opacity: 0.45;
    background-color: white;
    border-radius: 2px
}

#flush {
    position: fixed;
    bottom: 0px;
    right: 30px;
    opacity: 0.1;
    background-color: white;
    border-radius: 2px
}

#more {
    margin-right: 20px
}

#up {
    position: fixed;
    top: 50px;
    right: 32px;
    opacity: 0.45;
    background-color: white;
    border-radius: 2px
}


text:
var istanbul = require('istanbul');

var log = require('../logger').create('preprocess.coverage');

var instrumenter = new istanbul.Instrumenter();
var Coverage = function(content, file, basePath, done) {
  log.debug('Processing "%s".', file.originalPath);
  var jsPath = file.originalPath.replace(basePath + '/', './');
  instrumenter.instrument(content, jsPath, function(err, instrumentedCode) {
    if(err) {
      log.error('%s\n  at %s', err.message, file.originalPath);
    }
    done(instrumentedCode);
  });
};

//PUBLISH
module.exports = Coverage;


text:
Find and play any music Build with ASP.net.

### Demo
http://houssemdh1-001-site1.gtempurl.com/

### Features

* [Search] - Powerful search that will find nearly any song, artist or album.
* [PlayList] - User can create and edit his playlist.
* [Player] - Has many functionality (seek, shuffle, repeat, lyrics and more)
* [Single Page] - ajax based
* [Responsive] - fully responsive and will scale to the size of any device.

### JS libs
Boombox uses a number of open source projects to work properly:

* [JQuery] - HTML enhanced for web apps!
* [KnockoutJS] - Custom templating
* [Bootstrap] - responsive design
* [typeahead] - autocomplete search

### Api
* [Last.fm] - Gathering info of music, artist and albums
* [Youtube] - video player
* [Twilio] - share music via SMS and Calls
* [Facebook] - social sharing
* [Google Maps] - find events of an Artist


text:
function removeByIdService() {
    return function removeById(from, what) {
        var i = _.indexOf(from, function(item) {
            return item.id === what.id;
        });

        if (i !== -1) {
            from.splice(i, 1);
        }

        return i;
    };
}

angular.module('materialscommons').factory('removeByIdService', removeByIdService);


text:
var Slate = {};

(function ($) {
    "use strict";
    function resize_canvas_surfaces() {
        // Doing this, because $().width() with set a style - but that scales the
        // canvas up, instead of resizing it.
        document.getElementById("artboard").width = $(window).width();
        document.getElementById("artboard").height = $(window).height();

        document.getElementById("draw_surface").width = $(window).width();
        document.getElementById("draw_surface").height = $(window).height();

        var canvas = document.getElementById("artboard"),
            origin = Slate.Artboard.get_canvas_origin();

        Slate.Layer.invalidate_rectangle({
            x: -1 * origin.x - 10,
            y: -1 * origin.y - 10,
            width: Slate.Artboard.screen_to_canvas_zoom(canvas.width + 20),
            height: Slate.Artboard.screen_to_canvas_zoom(canvas.height + 20)
        });
        Slate.Layer.redraw_regions();

    }

    function initialize_application(data) {
        Slate.Artboard.update_origin_from_url();

        resize_canvas_surfaces();
        $(window).on("resize", resize_canvas_surfaces);

        $("#add_layer").on("click", Slate.Layer.add_new_layer);
        Slate.Drawing.add_drawing_events();
        Slate.Attributes.add_attribute_events();
        Slate.Artboard.add_zoom_events();

        Slate.Artboard.post_artboard_data(data);
        if (data.layers.length > 0){
            Slate.Layer.select_layer(data.layers[0].id);
        }

        $("#loading_cover").hide();
    }

    $(document).ready(function () {
        $.ajax(window.slate_home + '/rest/artboard/' + window.artboard_url_token, {
            success: initialize_application
        });
    });
})(jQuery);


text:
class DialogImportValidator
  class ImportNonYamlError < StandardError; end
  class InvalidDialogFieldTypeError < StandardError; end
  class ParsedNonDialogYamlError < StandardError; end

  def determine_validity(import_file_upload)
    potential_dialogs = YAML.load(import_file_upload.uploaded_content)
    check_dialogs_for_validity(potential_dialogs)
  rescue Psych::SyntaxError
    raise ImportNonYamlError
  end

  private

  def check_dialogs_for_validity(dialogs)
    dialogs.each do |dialog|
      raise ParsedNonDialogYamlError unless dialog["dialog_tabs"]
      check_dialog_tabs_for_validity(dialog["dialog_tabs"])
    end
  end

  def check_dialog_tabs_for_validity(dialog_tabs)
    dialog_tabs.each do |dialog_tab|
      raise ParsedNonDialogYamlError unless dialog_tab["dialog_groups"]
      check_dialog_groups_for_validity(dialog_tab["dialog_groups"])
    end
  end

  def check_dialog_groups_for_validity(dialog_groups)
    dialog_groups.each do |dialog_group|
      raise ParsedNonDialogYamlError unless dialog_group["dialog_fields"]
      check_dialog_fields_for_validity(dialog_group["dialog_fields"])
    end
  end

  def check_dialog_fields_for_validity(dialog_fields)
    dialog_fields.each do |dialog_field|
      unless valid_dialog_field_type?(dialog_field["type"])
        raise InvalidDialogFieldTypeError
      end
    end
  end

  def valid_dialog_field_type?(type)
    DialogField::DIALOG_FIELD_TYPES.include?(type) || type.nil? || type == "DialogFieldDynamicList"
  end
end


text:
from datetime import date

from holidays.constants import JAN, MAY, SEP, AUG, OCT, DEC
from holidays.holiday_base import HolidayBase
from dateutil.easter import easter, EASTER_ORTHODOX
from dateutil.relativedelta import relativedelta as rd
from holidays.utils import islamic_to_gre

class NorthMacedonia(HolidayBase):
    """
    https://en.wikipedia.org/wiki/Public_holidays_in_North_Macedonia
    """

    country = "MK"

    def __init__(self, **kwargs):
        HolidayBase.__init__(self, **kwargs)

    def _populate(self, year):
        self[date(year, JAN, 1)] = "New Year's Day"

        self[date(year, JAN, 7)] = "Christmas Day (Orthodox)"
        eater_day = easter(year, method=EASTER_ORTHODOX)
        self[eater_day + rd(days=1)] = "Easter Monday(Orthodox)"
        self[date(year, MAY, 1)] = "Labour Day"
        self[date(year, MAY, 24)] = "Saints Cyril and Methodius Day"
        self[date(year, AUG, 2)] = "Republic Day"
        self[date(year, SEP, 8)] = "Independence Day"
        self[date(year, OCT, 11)] = "Day of Macedonian Uprising in 1941"
        self[
            date(year, OCT, 23)
        ] = "Day of the Macedonian Revolutionary Struggle"
        self[date(year, DEC, 8)] = "Saint Clement of Ohrid Day"
        for date_obs in islamic_to_gre(year, 10, 1):
            self[date_obs] = "Eid al-Fitr"

class MK(NorthMacedonia):
    pass

class MKD(NorthMacedonia):
    pass


text:
<?php
namespace TYPO3\CMS\Rtehtmlarea\Extension;

use TYPO3\CMS\Rtehtmlarea\RteHtmlAreaApi;

/**
 * CharacterMap plugin for htmlArea RTE
 */
class QuickTag extends RteHtmlAreaApi
{
    /**
     * The name of the plugin registered by the extension
     *
     * @var string
     */
    protected $pluginName = 'QuickTag';

    /**
     * The comma-separated list of button names that the registered plugin is adding to the htmlArea RTE toolbar
     *
     * @var string
     */
    protected $pluginButtons = 'inserttag';

    /**
     * The name-converting array, converting the button names used in the RTE PageTSConfing to the button id's used by the JS scripts
     *
     * @var array
     */
    protected $convertToolbarForHtmlAreaArray = [
        'inserttag' => 'InsertTag'
    ];

    /**
     * The comma-separated list of names of prerequisite plugins
     *
     * @var string
     */
    protected $requiredPlugins = 'TYPO3Color';
}


text:
namespace mirrage::graphic {
	struct Pipeline_description;
	class Subpass_builder;
} // namespace mirrage::graphic

namespace mirrage::renderer {

	class Model_comp;

	struct Shadowmap {
		graphic::Render_target_2D texture;
		graphic::Framebuffer      framebuffer;
		ecs::Entity_handle        owner;
		glm::vec3                 light_source_position;
		glm::quat                 light_source_orientation;

		util::maybe<Culling_mask>   culling_mask;
		graphic::Command_pool_group model_group;
		graphic::Command_pool_group model_animated_group;
		graphic::Command_pool_group model_animated_dqs_group;
		glm::mat4                   view_proj;

		Shadowmap(Deferred_renderer& r, graphic::Device&, std::int32_t size, vk::Format);
		Shadowmap(Shadowmap&& rhs) noexcept;
	};

	class Shadowmapping_pass_factory;

	class Shadowmapping_pass : public Render_pass {
	  public:
		using Factory = Shadowmapping_pass_factory;

		Shadowmapping_pass(Deferred_renderer&, ecs::Entity_manager&);

		void pre_draw(Frame_data&);

		template <typename... Passes>
		void handle_obj(Frame_data&,
		                Object_router<Passes...>& router,
		                Culling_mask,
		                const glm::quat& orientation,
		                const glm::vec3& position,
		                Directional_light_comp&);

		void handle_obj(Frame_data&,
		                Culling_mask,
		                ecs::Entity_facet,
		                const glm::vec4& emissive_color,
		                const glm::mat4& transform,
		                const Model&,
		                const Material_override&,
		                const Sub_mesh&);
		void handle_obj(Frame_data&,
		                Culling_mask,
		                ecs::Entity_facet,
		                const glm::vec4& emissive_color,
		                const glm::mat4& transform,
		                const Model&,
		                gsl::span<const Material_override>,
		                Skinning_type skinning_type,
		                std::uint32_t pose_offset);

		void post_draw(Frame_data&);

		auto name() const noexcept -> const char* override { return "Shadowmapping"; }

	  private:
		struct Shadowmapping_pass_impl_helper;

		ecs::Entity_manager&      _entities;
		vk::Format                _shadowmap_format;
		graphic::Render_target_2D _depth;
		bool                      _first_frame = true;

		vk::UniqueSampler _shadowmap_sampler;
		vk::UniqueSampler _shadowmap_depth_sampler;

		std::vector<Shadowmap> _shadowmaps;

		graphic::Render_pass                 _render_pass;
		const graphic::Render_pass_stage_ref _model_stage;
		const graphic::Render_pass_stage_ref _model_animated_stage;
		const graphic::Render_pass_stage_ref _model_animate_dqs_stage;
	};

	class Shadowmapping_pass_factory : public Render_pass_factory {
	  public:
		auto id() const noexcept -> Render_pass_id override
		{
			return render_pass_id_of<Shadowmapping_pass_factory>();
		}

		auto create_pass(Deferred_renderer&,
		                 std::shared_ptr<void>,
		                 util::maybe<ecs::Entity_manager&>,
		                 Engine&,
		                 bool&) -> std::unique_ptr<Render_pass> override;

		auto rank_device(vk::PhysicalDevice, util::maybe<std::uint32_t>, int) -> int override;

		void configure_device(vk::PhysicalDevice,
		                      util::maybe<std::uint32_t>,
		                      graphic::Device_create_info&) override;
	};

	template <typename... Passes>
	void Shadowmapping_pass::handle_obj(Frame_data&,
	                                    Object_router<Passes...>& router,
	                                    Culling_mask,
	                                    const glm::quat&        orientation,
	                                    const glm::vec3&        position,
	                                    Directional_light_comp& light)
	{
		if(_renderer.gbuffer().shadowmapping_enabled && light.color().length() * light.intensity() > 0.0001f
		   && light.shadowcaster() && light.needs_update()) {

			if(light.shadowmap_id() == -1) {
				auto next_free_shadowmap = std::find_if(
				        _shadowmaps.begin(), _shadowmaps.end(), [&](auto& s) { return !s.owner; });

				if(next_free_shadowmap != _shadowmaps.end()) {
					light.shadowmap_id(
					        static_cast<int>(std::distance(_shadowmaps.begin(), next_free_shadowmap)));
					next_free_shadowmap->owner = light.owner_handle();

				} else {
					return;
				}
			}

			light.on_update();
			auto& shadowmap                    = _shadowmaps[light.shadowmap_id()];
			shadowmap.light_source_position    = position;
			shadowmap.light_source_orientation = orientation;
			shadowmap.view_proj                = light.calc_shadowmap_view_proj(position, orientation);
			shadowmap.culling_mask             = router.add_viewer(shadowmap.view_proj, false);

			if(!shadowmap.model_group)
				shadowmap.model_group = _renderer.reserve_secondary_command_buffer_group();

			if(!shadowmap.model_animated_group)
				shadowmap.model_animated_group = _renderer.reserve_secondary_command_buffer_group();
		}
	}

} // namespace mirrage::renderer


text:
"""Provides device automations for Lock."""
from __future__ import annotations

import voluptuous as vol

from homeassistant.const import (
    ATTR_ENTITY_ID,
    CONF_DEVICE_ID,
    CONF_DOMAIN,
    CONF_ENTITY_ID,
    CONF_TYPE,
    SERVICE_LOCK,
    SERVICE_OPEN,
    SERVICE_UNLOCK,
)
from homeassistant.core import Context, HomeAssistant
from homeassistant.helpers import entity_registry
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import get_supported_features

from . import DOMAIN, SUPPORT_OPEN

ACTION_TYPES = {"lock", "unlock", "open"}

ACTION_SCHEMA = cv.DEVICE_ACTION_BASE_SCHEMA.extend(
    {
        vol.Required(CONF_TYPE): vol.In(ACTION_TYPES),
        vol.Required(CONF_ENTITY_ID): cv.entity_domain(DOMAIN),
    }
)

async def async_get_actions(
    hass: HomeAssistant, device_id: str
) -> list[dict[str, str]]:
    """List device actions for Lock devices."""
    registry = await entity_registry.async_get_registry(hass)
    actions = []

    # Get all the integrations entities for this device
    for entry in entity_registry.async_entries_for_device(registry, device_id):
        if entry.domain != DOMAIN:
            continue

        supported_features = get_supported_features(hass, entry.entity_id)

        # Add actions for each entity that belongs to this integration
        base_action = {
            CONF_DEVICE_ID: device_id,
            CONF_DOMAIN: DOMAIN,
            CONF_ENTITY_ID: entry.entity_id,
        }

        actions.append({**base_action, CONF_TYPE: "lock"})
        actions.append({**base_action, CONF_TYPE: "unlock"})

        if supported_features & (SUPPORT_OPEN):
            actions.append({**base_action, CONF_TYPE: "open"})

    return actions

async def async_call_action_from_config(
    hass: HomeAssistant, config: dict, variables: dict, context: Context | None
) -> None:
    """Execute a device action."""
    service_data = {ATTR_ENTITY_ID: config[CONF_ENTITY_ID]}

    if config[CONF_TYPE] == "lock":
        service = SERVICE_LOCK
    elif config[CONF_TYPE] == "unlock":
        service = SERVICE_UNLOCK
    elif config[CONF_TYPE] == "open":
        service = SERVICE_OPEN

    await hass.services.async_call(
        DOMAIN, service, service_data, blocking=True, context=context
    )


text:
**Sendgrid** là một trong những dịch vụ cung cấp transaction email theo chuẩn SMTP, dựa trên nền tảng đám mây thay thế cho hệ thống mail server.
Để sử dụng dịch vụ này cần đăng ký một tài khoản tại [Sendgrid.com](https://sendgrid.com)

###2. Cấu hình để gửi email qua Sendgrid API.
Trong file  `.env` , chỉnh sửa một số thông tin:

```
MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=sendgridusername
MAIL_PASSWORD=sendgridpassword
MAIL_ENCRYPTION=tls
```

###3. Sử dụng Sendgrid API để gửi mail.
   * Tạo controller trong `routes/web.php`:
```
Route::get('mail', 'HomeController@mail');
```

   * Tạo method `mail` trong `app/Http/Controllers/HomeController.php`:

```
public function mail()
{
    Mail::send('emails.mailEvent', function($message) {
        $message->from('admin@gmail.com', 'Admin');
        $message->to('thanhnt@gmail.com', 'ThanhNT');
        $message->subject('Sendgrid Testing');
    });
    dd('Mail Send Successfully');
}
```

   * Tạo template mail `resources/views/emails/mailEvent.blade.php` với nội dung:
```
Hi, sendgrid testing.
```


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

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <title>set_directory_properties — CMake 3.8.2 Documentation</title>

    <link rel="stylesheet" href="../_static/cmake.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="shortcut icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="set_property" href="set_property.html" />
    <link rel="prev" title="separate_arguments" href="separate_arguments.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.8.2 Documentation »

cmake-commands(7) »

set_directory_properties¶

Set a property of the directory.

set_directory_properties(PROPERTIES prop1 value1 prop2 value2)

Set a property for the current directory and subdirectories. See
Properties on Directories for the list of properties known
to CMake.

Previous topic

separate_arguments

Next topic

set_property

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">

<input type="text" name="q" />

<input type="submit" value="Go" />

      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.8.2 Documentation »

cmake-commands(7) »

        © Copyright 2000-2017 Kitware, Inc. and Contributors.
      Created using Sphinx 1.5.2.


text:
package encryption.cipher;

public   class Cipher {

	public static final  int KEY = 128;
    public static String Encrypt(String message)
    {
        String result = "";
        for (int i = 0; i < message.length(); i++)
        	result += (char)(message.charAt(i) + KEY);
        return result;
    }

    public static String Decrypt(String message)
    {

        String result = "";
        for (int i = 0; i < message.length(); i++)
        	result += (char)(message.charAt(i) - KEY);
        return result;
    }

}


text:
package me.tfeng.rest.resource;

import java.util.Collections;

import javax.ws.rs.container.AsyncResponse;

import org.springframework.stereotype.Component;

@Component
public class AsyncHandler {

  public void handle(AsyncResponse response) {
    response.resume(Collections.singletonMap("synchronized", false));
  }
}


text:
using EasyNetQ.Consumer;
using NSubstitute;
using Xunit;

namespace EasyNetQ.Tests.ConsumerTests;

public class WhenAСonsumerStartsConsuming : Given_a_сonsumer
{
    public WhenAСonsumerStartsConsuming()
    {
        consumer.StartConsuming();
    }

    [Fact]
    public void Should_ask_the_internal_consumer_to_start_consuming()
    {
        internalConsumers[0].Received().StartConsuming();
    }

    [Fact]
    public void Should_create_internal_consumer()
    {
        internalConsumerFactory.Received(1).CreateConsumer(Arg.Any<ConsumerConfiguration>());
    }
}

// ReSharper restore InconsistentNaming


text:
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using TestApplication.Types;

namespace TestApplication.Windsor.TestCases
{
    public class FromAssemblyContainingBasedOnNonGeneric : IWindsorInstaller
    {
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(
                AllTypes.FromAssemblyContaining(typeof(IFoo)).BasedOn<IFoo>(),
                Classes.FromAssemblyContaining(typeof(IFoo)).BasedOn<IFoo>(),
                Castle.MicroKernel.Registration.Types.FromAssemblyContaining(typeof(IFoo)).BasedOn<IFoo>()
                );
        }
    }
}


text:
[ -d tmp ] || mkdir tmp
nohup ttserver -port 45001 tmp/data.tch &
nohup ttserver -port 45002 tmp/data.tct &

ruby19 -Ilib test/readme0.rb
ruby19 -Ilib test/readme1.rb
ruby19 -Ilib test/readme2.rb
ruby19 -Ilib test/readme3.rb

killall ttserver