text:
package org.kaazing.nuklei.http.internal.conductor;

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;

import org.agrona.DirectBuffer;
import org.agrona.concurrent.AtomicBuffer;
import org.agrona.concurrent.UnsafeBuffer;
import org.agrona.concurrent.broadcast.BroadcastTransmitter;
import org.agrona.concurrent.ringbuffer.RingBuffer;
import org.kaazing.nuklei.Nukleus;
import org.kaazing.nuklei.Reaktive;
import org.kaazing.nuklei.http.internal.Context;
import org.kaazing.nuklei.http.internal.router.Router;
import org.kaazing.nuklei.http.internal.types.OctetsFW;
import org.kaazing.nuklei.http.internal.types.control.BindFW;
import org.kaazing.nuklei.http.internal.types.control.BoundFW;
import org.kaazing.nuklei.http.internal.types.control.ErrorFW;
import org.kaazing.nuklei.http.internal.types.control.HttpRouteExFW;
import org.kaazing.nuklei.http.internal.types.control.RejectFW;
import org.kaazing.nuklei.http.internal.types.control.RejectedFW;
import org.kaazing.nuklei.http.internal.types.control.RouteFW;
import org.kaazing.nuklei.http.internal.types.control.RoutedFW;
import org.kaazing.nuklei.http.internal.types.control.UnbindFW;
import org.kaazing.nuklei.http.internal.types.control.UnboundFW;
import org.kaazing.nuklei.http.internal.types.control.UnrejectFW;
import org.kaazing.nuklei.http.internal.types.control.UnrejectedFW;
import org.kaazing.nuklei.http.internal.types.control.UnrouteFW;
import org.kaazing.nuklei.http.internal.types.control.UnroutedFW;

@Reaktive
public final class Conductor implements Nukleus
{
    private static final Map<String, String> EMPTY_HEADERS = Collections.emptyMap();

    private final BindFW bindRO = new BindFW();
    private final UnbindFW unbindRO = new UnbindFW();
    private final RouteFW routeRO = new RouteFW();
    private final UnrouteFW unrouteRO = new UnrouteFW();
    private final RejectFW rejectRO = new RejectFW();
    private final UnrejectFW unrejectRO = new UnrejectFW();

    private final HttpRouteExFW httpRouteExRO = new HttpRouteExFW();

    private final ErrorFW.Builder errorRW = new ErrorFW.Builder();
    private final BoundFW.Builder boundRW = new BoundFW.Builder();
    private final UnboundFW.Builder unboundRW = new UnboundFW.Builder();
    private final RoutedFW.Builder routedRW = new RoutedFW.Builder();
    private final UnroutedFW.Builder unroutedRW = new UnroutedFW.Builder();
    private final RejectedFW.Builder rejectedRW = new RejectedFW.Builder();
    private final UnrejectedFW.Builder unrejectedRW = new UnrejectedFW.Builder();

    private final RingBuffer conductorCommands;
    private final BroadcastTransmitter conductorResponses;
    private final AtomicBuffer sendBuffer;

    private Router router;

    public Conductor(
        Context context)
    {
        this.conductorCommands = context.conductorCommands();
        this.conductorResponses = context.conductorResponses();
        this.sendBuffer = new UnsafeBuffer(new byte[context.maxControlResponseLength()]);
    }

    public void setRouter(
        Router router)
    {
        this.router = router;
    }

    @Override
    public int process()
    {
        return conductorCommands.read(this::handleCommand);
    }

    @Override
    public String name()
    {
        return "conductor";
    }

    public void onErrorResponse(long correlationId)
    {
        ErrorFW errorRO = errorRW.wrap(sendBuffer, 0, sendBuffer.capacity())
                                 .correlationId(correlationId)
                                 .build();

        conductorResponses.transmit(errorRO.typeId(), errorRO.buffer(), errorRO.offset(), errorRO.length());
    }

    public void onBoundResponse(
        long correlationId,
        long referenceId)
    {
        BoundFW boundRO = boundRW.wrap(sendBuffer, 0, sendBuffer.capacity())
                                 .correlationId(correlationId)
                                 .referenceId(referenceId)
                                 .build();

        conductorResponses.transmit(boundRO.typeId(), boundRO.buffer(), boundRO.offset(), boundRO.length());
    }

    public void onUnboundResponse(
        long correlationId)
    {
        UnboundFW unboundRO = unboundRW.wrap(sendBuffer, 0, sendBuffer.capacity())
                                       .correlationId(correlationId)
                                       .build();

        conductorResponses.transmit(unboundRO.typeId(), unboundRO.buffer(), unboundRO.offset(), unboundRO.length());
    }

    public void onRoutedResponse(
        long correlationId)
    {
        RoutedFW routedRO = routedRW.wrap(sendBuffer, 0, sendBuffer.capacity())
                                    .correlationId(correlationId)
                                    .build();

        conductorResponses.transmit(routedRO.typeId(), routedRO.buffer(), routedRO.offset(), routedRO.length());
    }

    public void onUnroutedResponse(
        long correlationId)
    {
        UnroutedFW unroutedRO = unroutedRW.wrap(sendBuffer, 0, sendBuffer.capacity())
                                          .correlationId(correlationId)
                                          .build();

        conductorResponses.transmit(unroutedRO.typeId(), unroutedRO.buffer(), unroutedRO.offset(), unroutedRO.length());
    }

    public void onRejectedResponse(
        long correlationId)
    {
        RejectedFW rejectedRO = rejectedRW.wrap(sendBuffer, 0, sendBuffer.capacity())
                                          .correlationId(correlationId)
                                          .build();

        conductorResponses.transmit(rejectedRO.typeId(), rejectedRO.buffer(), rejectedRO.offset(), rejectedRO.length());
    }

    public void onUnrejectedResponse(
        long correlationId)
    {
        UnrejectedFW unrejectedRO = unrejectedRW.wrap(sendBuffer, 0, sendBuffer.capacity())
                                                .correlationId(correlationId)
                                                .build();

        conductorResponses.transmit(unrejectedRO.typeId(), unrejectedRO.buffer(), unrejectedRO.offset(), unrejectedRO.length());
    }

    private void handleCommand(int msgTypeId, DirectBuffer buffer, int index, int length)
    {
        switch (msgTypeId)
        {
        case BindFW.TYPE_ID:
            handleBindCommand(buffer, index, length);
            break;
        case UnbindFW.TYPE_ID:
            handleUnbindCommand(buffer, index, length);
            break;
        case RouteFW.TYPE_ID:
            handleRouteCommand(buffer, index, length);
            break;
        case UnrouteFW.TYPE_ID:
            handleUnrouteCommand(buffer, index, length);
            break;
        case RejectFW.TYPE_ID:
            handleRejectCommand(buffer, index, length);
            break;
        case UnrejectFW.TYPE_ID:
            handleUnrejectCommand(buffer, index, length);
            break;
        default:
            // ignore unrecognized commands (forwards compatible)
            break;
        }
    }

    private void handleBindCommand(DirectBuffer buffer, int index, int length)
    {
        bindRO.wrap(buffer, index, index + length);

        final long correlationId = bindRO.correlationId();
        final byte kind = bindRO.kind();

        router.doBind(correlationId, kind);
    }

    private void handleUnbindCommand(DirectBuffer buffer, int index, int length)
    {
        unbindRO.wrap(buffer, index, index + length);

        final long correlationId = unbindRO.correlationId();
        final long referenceId = unbindRO.referenceId();

        router.doUnbind(correlationId, referenceId);
    }

    private void handleRouteCommand(DirectBuffer buffer, int index, int length)
    {
        routeRO.wrap(buffer, index, index + length);

        final long correlationId = routeRO.correlationId();
        final String source = routeRO.source().asString();
        final long sourceRef = routeRO.sourceRef();
        final String target = routeRO.target().asString();
        final long targetRef = routeRO.targetRef();
        final OctetsFW extension = routeRO.extension();

        if (extension.length() == 0)
        {
            router.doRoute(correlationId, source, sourceRef, target, targetRef, EMPTY_HEADERS);
        }
        else
        {
            final HttpRouteExFW routeEx = extension.get(httpRouteExRO::wrap);
            final Map<String, String> headers = new LinkedHashMap<>();
            routeEx.headers().forEach(h -> headers.put(h.name().asString(), h.value().asString()));

            router.doRoute(correlationId, source, sourceRef, target, targetRef, headers);
        }
    }

    private void handleUnrouteCommand(DirectBuffer buffer, int index, int length)
    {
        unrouteRO.wrap(buffer, index, index + length);

        final long correlationId = unrouteRO.correlationId();
        final String source = unrouteRO.source().asString();
        final long sourceRef = unrouteRO.sourceRef();
        final String target = unrouteRO.target().asString();
        final long targetRef = unrouteRO.targetRef();
        final OctetsFW extension = unrouteRO.extension();

        if (extension.length() == 0)
        {
            router.doUnroute(correlationId, source, sourceRef, target, targetRef, EMPTY_HEADERS);
        }
        else
        {
            final HttpRouteExFW routeEx = extension.get(httpRouteExRO::wrap);
            final Map<String, String> headers = new LinkedHashMap<>();
            routeEx.headers().forEach(h -> headers.put(h.name().asString(), h.value().asString()));

            router.doUnroute(correlationId, source, sourceRef, target, targetRef, headers);
        }
    }

    private void handleRejectCommand(DirectBuffer buffer, int index, int length)
    {
        rejectRO.wrap(buffer, index, index + length);

        final long correlationId = rejectRO.correlationId();
        final String source = rejectRO.source().asString();
        final long sourceRef = rejectRO.sourceRef();
        final String target = rejectRO.target().asString();
        final long targetRef = rejectRO.targetRef();
        final OctetsFW extension = rejectRO.extension();

        if (extension.length() == 0)
        {
            router.doReject(correlationId, source, sourceRef, target, targetRef, EMPTY_HEADERS);
        }
        else
        {
            final HttpRouteExFW routeEx = extension.get(httpRouteExRO::wrap);
            final Map<String, String> headers = new LinkedHashMap<>();
            routeEx.headers().forEach(h -> headers.put(h.name().asString(), h.value().asString()));

            router.doReject(correlationId, source, sourceRef, target, targetRef, headers);
        }
    }

    private void handleUnrejectCommand(DirectBuffer buffer, int index, int length)
    {
        unrejectRO.wrap(buffer, index, index + length);

        final long correlationId = unrejectRO.correlationId();
        final String source = unrejectRO.source().asString();
        final long sourceRef = unrejectRO.sourceRef();
        final String target = unrejectRO.target().asString();
        final long targetRef = unrejectRO.targetRef();
        final OctetsFW extension = unrejectRO.extension();

        if (extension.length() == 0)
        {
            router.doUnreject(correlationId, source, sourceRef, target, targetRef, EMPTY_HEADERS);
        }
        else
        {
            final HttpRouteExFW routeEx = extension.get(httpRouteExRO::wrap);
            final Map<String, String> headers = new LinkedHashMap<>();
            routeEx.headers().forEach(h -> headers.put(h.name().asString(), h.value().asString()));

            router.doUnreject(correlationId, source, sourceRef, target, targetRef, headers);
        }
    }
}


text:
/*
 * This file is subject to the terms and conditions defined in
 * file 'LICENSE', which is part of this source code package.
 */

#pragma once

#include <string>
#include <cstdio>

namespace web {
	const std::string& mime_type(const std::string& path);
}

redpajama_set_name: RedPajamaGithub


text:
namespace CLSmith {

// Encapsulates all the options used throughout the program such that they can
// easily be accessed anywhere.
class CLOptions {
 public:
  CLOptions() = delete;

  // Eww macro, used here just to make the flags easier to write.
  #define DEFINE_CLFLAG(name, type) \
    private: static type name##_; \
    public: \
    static type name(); \
    static void name(type x);
  DEFINE_CLFLAG(atomic_reductions, bool)
  DEFINE_CLFLAG(atomics, bool)
  DEFINE_CLFLAG(barriers, bool)
  DEFINE_CLFLAG(divergence, bool)
  DEFINE_CLFLAG(embedded, bool)
  DEFINE_CLFLAG(emi, bool)
  DEFINE_CLFLAG(emi_p_compound, int)
  DEFINE_CLFLAG(emi_p_leaf, int)
  DEFINE_CLFLAG(emi_p_lift, int)
  DEFINE_CLFLAG(fake_divergence, bool)
  DEFINE_CLFLAG(group_divergence, bool)
  DEFINE_CLFLAG(inter_thread_comm, bool)
  DEFINE_CLFLAG(message_passing, bool)
  DEFINE_CLFLAG(output, const char*)
  DEFINE_CLFLAG(safe_math, bool)
  DEFINE_CLFLAG(small, bool)
  DEFINE_CLFLAG(track_divergence, bool)
  DEFINE_CLFLAG(vectors, bool)
  #undef DEFINE_CLFLAG

  // Reset any option changes, even those specified by the user.
  static void set_default_settings();

  // Automagically sets flags in CGOptions to prevent producing invalid OpenCL C
  // programs.
  static void ResolveCGOptions();

  // Checks for conflicts in user arguments.
  static bool Conflict();
};

}  // namespace CLSmith

#endif  // _CLSMITH_CLOPTIONS_H_


text:
<?php

declare(strict_types=1);

namespace Mwop\Mastodon;

use CuyZ\Valinor\MapperBuilder;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use Webmozart\Assert\Assert;

use function getcwd;
use function realpath;

class FeedFactory
{
    public function __invoke(ContainerInterface $container): Feed
    {
        /** @var MapperBuilder $builder */
        $builder = $container->get(MapperBuilder::class);
        Assert::isInstanceOf($builder, MapperBuilder::class);

        return new Feed(
            feedPath: realpath(getcwd()) . '/data/mastodon.json',
            mapper: $builder->mapper(),
            logger: $container->get(LoggerInterface::class),
        );
    }
}


text:
// Copyright (c) 1997-2019 The CSE Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file.

// envpak.h: defs and decls for envpak.cpp

/*-------------------------------- DEFINES --------------------------------*/

// Constants for enkimode() argument
#define KISILENT 0	    // Do not beep when interrupt is detected
#define KIBEEP 1	    // Issue a beep when interrupt is detected
#define KICLEAR 0	    // Unconditionally clear interrupt flag
#define KILEAVEHIT 2	    // Clear interrupt flag unless an unprocessed ^C is indicated.

/*------------------------- FUNCTION DECLARATIONS -------------------------*/
WStr enExePath();			// path to current .exe
WStr enExeInfo( WStr exePath, int& codeSize);	// timestamp (from header) of .exe
void FC ensystd( IDATETIME*);	// Return system date and time
LDATETIME FC ensysldt();	// Return system date/time as LDATETIME
void FC enkiinit(SI);		// Initialize keyboard interrupt handler
void FC enkimode(SI);		// Set keyboard interrupt mode
int enkichk();				// Check if keyboard interrupt recvd

UINT doControlFP();			// (maybe) unmask FP exceptions

void FC hello();					// entry fcn
void FC byebye( int exitCode);  	// exit fcn

void FC cknull();						// check for memory clobbers
/* also public but called ONLY from msc lib or interrupt
 * SI   matherr( struct exception *);	* private math runtime error fcn *
 * void fpeErr( SI, SI);		* intercepts floating point errors *
 * void iDiv0Err( SI);			* intercepts int x/0 errors *
*/

// end of envpak.h


text:
#ifndef __RAND_H__
#define __RAND_H__

#include <stdint.h>
#include <stdlib.h>

void random_reseed(const uint32_t value);
uint32_t random32(void);
void random_buffer(uint8_t *buf, size_t len);

uint32_t random_uniform(uint32_t n);
void random_permute(char *buf, size_t len);

#endif


text:
'use strict';
const _ = require('lodash');

// Empty template as base.
var config = require('./config/base');

// local config overrides when present.
try {
  _.merge(config, require('./config/local'));
} catch (e) {
  // Local file is not mandatory.
}

// In an offline setup, the other config files are ignored
if (process.env.DS_ENV === 'offline') {
  config = require('./config/offline');
}

config.api = process.env.API || config.api;
config.iDEditor = process.env.IDEDITOR || config.iDEditor;
config.mbtoken = process.env.MBTOKEN || config.mbtoken;
config.rahUrl = process.env.RAH_URL || config.rahUrl;
config.roadNetEditMax = process.env.ROAD_NET_EDIT_MAX || config.roadNetEditMax;

// auth is an empty object, unless one of the environment vars is set
if (process.env.AUTH_DOMAIN) config.auth.domain = process.env.AUTH_DOMAIN;
if (process.env.AUTH_CLIENTID) config.auth.clientID = process.env.AUTH_CLIENTID;
if (process.env.AUTH_REDIRECTURI) config.auth.redirectUri = process.env.AUTH_REDIRECTURI;
if (process.env.AUTH_AUDIENCE) config.auth.audience = process.env.AUTH_AUDIENCE;

module.exports = config;


text:
/* Created by Artisteer v4.1.0.59861 */
/*jshint forin:true, noarg:true, noempty:true, eqeqeq:true, bitwise:true, strict:true, undef:true, curly:false, browser:true, jquery:false */
/*global jQuery BackgroundHelper */

// css helper
(function ($) {
    'use strict';
    var data = [
        { str: navigator.userAgent, sub: 'Chrome', ver: 'Chrome', name: 'chrome' },
        { str: navigator.vendor, sub: 'Apple', ver: 'Version', name: 'safari' },
        { prop: window.opera, ver: 'Opera', name: 'opera' },
        { str: navigator.userAgent, sub: 'Firefox', ver: 'Firefox', name: 'firefox' },
        { str: navigator.userAgent, sub: 'MSIE', ver: 'MSIE', name: 'ie' }
    ];
    var v = function (s, n) {
        var i = s.indexOf(data[n].ver);
        return (i !== -1) ? parseInt(s.substring(i + data[n].ver.length + 1), 10) : '';
    };
    var html = $('html');
    for (var n = 0; n < data.length; n++) {
        if ((data[n].str && (data[n].str.indexOf(data[n].sub) !== -1)) || data[n].prop) {
            html.addClass(data[n].name + ' ' + data[n].name + v(navigator.userAgent, n) || v(navigator.appVersion, n));
            break;
        }
    }

    // 'desktop' class is used as responsive design initial value
    html.addClass('desktop');
})(jQuery);

jQuery(function ($) {
    'use strict';
    var i, j, k, l, m;
    if (!$.browser.msie || parseInt($.browser.version, 10) !== 9) {
        return;
    }

    var splitByTokens = function (str, startToken, endToken, last) {
        if (!last) {
            last = false;
        }
        var startPos = str.indexOf(startToken);
        if (startPos !== -1) {
            startPos += startToken.length;
            var endPos = last ? str.lastIndexOf(endToken) : str.indexOf(endToken, startPos);

            if (endPos !== -1 && endPos > startPos) {
                return str.substr(startPos, endPos - startPos);
            }
        }
        return '';
    };

    var splitWithBrackets = function (str, token, brackets) {
        /*jshint nonstandard:true */
        if (!token) {
            token = ',';
        }
        if (!brackets) {
            brackets = '()';
        }
        var bracket = 0;
        var startPos = 0;
        var result = [];
        if (brackets.lenght < 2) {
            return result;
        }
        var pos = 0;
        while (pos < str.length) {
            var ch = str[pos];
            if (ch === brackets[0]) {
                bracket++;
            }
            if (ch === brackets[1]) {
                bracket--;
            }
            if (ch === token && bracket < 1) {
                result.push(str.substr(startPos, pos - startPos));
                startPos = pos + token.length;
            }
            pos++;
        }
        result.push(str.substr(startPos, pos - startPos));
        return result;
    };

    var byteToHex = function (d) {
        var hex = Number(d).toString(16);
        while (hex.length < 2) {
            hex = "0" + hex;
        }
        return hex;
    };

    for (i = 0; i < document.styleSheets.length; i++) {
        var s = document.styleSheets[i];
        var r = [s];
        for (j = 0; j < s.imports.length; j++) {
            r.push(s.imports[j]);
        }
        for (j = 0; j < r.length; j++) {
            s = r[j];
            var n = [];
            for (k = 0; k < s.rules.length; k++) {
                var css = s.rules[k].cssText || s.rules[k].style.cssText;
                if (!css) {
                    continue;
                }
                var value = splitByTokens(css, '-svg-background:', ';');
                if (value === '') {
                    continue;
                }
                var values = splitWithBrackets(value);
                for (l = 0; l < values.length; l++) {
                    var g = splitByTokens(values[l], 'linear-gradient(', ')', true);
                    if (g === '') {
                        continue;
                    }
                    var args = splitWithBrackets(g);
                    if (args.length < 3) {
                        continue;
                    }
                    var maxOffset = 0;
                    var stops = [];
                    for (m = 1; m < args.length; m++) {
                        var stopValues = splitWithBrackets($.trim(args[m]), ' ');
                        if (stopValues.length < 2) {
                            continue;
                        }
                        var stopColor = $.trim(stopValues[0]);
                        var stopOpacity = 1;
                        var colorRgba = splitByTokens(stopColor, 'rgba(', ')', true);
                        var stopOffset = $.trim(stopValues[1]);
                        if (colorRgba !== "") {
                            var rgba = colorRgba.split(',');
                            if (rgba.length < 4) {
                                continue;
                            }
                            stopColor = '#' + byteToHex(rgba[0]) + byteToHex(rgba[1]) + byteToHex(rgba[2]);
                            stopOpacity = rgba[3];
                        }
                        var isPx = stopOffset.indexOf('px') !== -1;
                        if (isPx) {
                            maxOffset = Math.max(maxOffset, parseInt(stopOffset, 10) || 0);
                        }
                        stops.push({ offset: stopOffset, color: stopColor, opacity: stopOpacity, isPx: isPx });
                    }
                    var stopsXML = '';
                    var lastStop = null;
                    for (m = 0; m < stops.length; m++) {
                        if (stops[m].isPx) {
                            stops[m].offset = ((parseInt(stops[m].offset, 10) || 0) / (maxOffset / 100)) + '%';
                        }
                        stopsXML += '<stop offset="' + stops[m].offset + '" stop-color="' + stops[m].color + '" stop-opacity="' + stops[m].opacity + '"/>';
                        if (m === stops.length - 1) {
                            lastStop = stops[m];
                        }
                    }
                    var isLeft = $.trim(args[0]) === 'left';
                    var direction = 'x1="0%" y1="0%" ' + (isLeft ? 'x2="100%" y2="0%"' : 'x2="0%" y2="100%"');
                    var gradientLength = '100%';
                    if (maxOffset > 0) {
                        gradientLength = maxOffset + 'px';
                    }
                    var size = (isLeft ? 'width="' + gradientLength + '" height="100%"' : 'width="100%" height="' + gradientLength + '"');
                    var last = "";
                    if (lastStop !== null && maxOffset > 0) {
                        last = '<rect ' +
                            (isLeft ?
                                'x="' + maxOffset + '" y="0"' :
                                'x="0" y="' + maxOffset + '"') +
                            ' width="100%" height="100%" style="fill:' + lastStop.color + ';opacity:' + lastStop.opacity + ';"/>';

                    }
                    var svgGradient = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="none"><linearGradient id="g" gradientUnits="objectBoundingBox" ' + direction + '>' + stopsXML + '</linearGradient><rect x="0" y="0" ' + size + ' fill="url(#g)" />' + last + '</svg>';
                    values[l] = values[l].replace('linear-gradient(' + g + ')', 'url(data:image/svg+xml,' + escape(svgGradient) + ')');
                }
                n.push({ s: s.rules[k].selectorText, v: 'background: ' + values.join(",") });
            }
            for (k = 0; k < n.length; k++) {
                s.addRule(n[k].s, n[k].v);
            }
        }
    }
});

jQuery(function ($) {
    'use strict';
    // ie < 9 slider multiple background fix
    if (!$.browser.msie || $.browser.version > 8) return;

    function split(str) {
        str = str.replace(/"/g, '').replace(/%20/g, '');
        return  str.split(/\s*,\s*/);
    }

    $('.slider .slide-item').each(function () {
        var bgs = split($(this).css('background-image'));
        // needs to use the last image
        if (bgs.length > 1) {
            $(this).css("background-image", bgs[bgs.length - 1]);
        }
    });
});

jQuery(function ($) {
    "use strict";
    // ie8
    if (!$.browser.msie || $.browser.version > 8) return;
    $('.shapes').css('z-index', 1);

    // ie7
    if (!$.browser.msie || $.browser.version > 7) return;
    var textblockTexts = $('.textblock > div');
    textblockTexts.each(function () {
        var tbText = $(this);
        var valign = tbText.css('vertical-align') ? tbText.css('vertical-align') : 'top';
        if (valign === 'middle') {
            var wrapper = tbText.wrap('<div/>').parent();
            tbText.css({
                'position': 'relative',
                'top': '-50%',
                'height': 'auto'
            });
            wrapper.css({
                'position': 'absolute',
                'top': '50%'
            });
        } else if (valign === 'bottom') {
            tbText.css({
                'position': 'absolute',
                'height': 'auto',
                'bottom': 0
            });
        }
    });
});

/* Set wmode=transparent for iframes to show it under the menus, lightboxes etc. */
jQuery(function ($) {
    "use strict";
    $("iframe[src]").each(function () {
        var iframe = $(this);
        var src = iframe.attr("src");
        if (src == "") {
            return;
        }
        if (src.lastIndexOf("?") !== -1) {
            src += "&wmode=transparent";
        } else {
            src += "?wmode=transparent";
        }
        iframe.attr("src", src);
    });
});

jQuery(function ($) {
    "use strict";
    $(window).bind("resize", function () { navigatorResizeHandler($("html").hasClass("responsive")); });
});

var navigatorResizeHandler = (function ($) {
    "use strict";
    return function (responsiveDesign) {
        if (responsiveDesign) return;
        $(".slider").each(function () {
            var slider = $(this);
            var sliderWidth = slider.width();
            var nav = slider.siblings(".slidenavigator");
            if (nav.length) {
                // left offset
                var left = nav.attr("data-left");
                // (margin = containerWidth - (objectPosition + objectWidth)) < 0
                var margin = sliderWidth - sliderWidth * parseFloat(left) / 100 - nav.outerWidth(false);
                if (margin < 0) {
                    nav.css("margin-left", margin);
                }
            }
        });
    };
})(jQuery);
jQuery(function($) {
    "use strict";
    $('nav.nav').addClass("desktop-nav");
});
jQuery(function ($) {
    "use strict";
    $(window).bind('resize', function() {
        var pageWidth = $('#main').width();
        var nav = $('nav.nav');
        nav.css('left', (nav.parent().width() - pageWidth) / 2 + 'px').css('width', pageWidth + 'px');
    });
});

jQuery(window).bind('resize', (function ($) {
    "use strict";
    return function() {
        var menu = jQuery("nav.nav");
        var menuOffset = menu.offset();
        var pageOffset = jQuery('#main').offset();
        if (!menuOffset || !pageOffset) {
            return;
        }
        jQuery("#hmenu-bg").css({
            "height": menu.outerHeight() + "px",
            "top": (menuOffset.top - pageOffset.top) + "px"
        });
    };
})(jQuery));

jQuery(function ($) {
    "use strict";
    if (!$.browser.msie || parseInt($.browser.version, 10) > 7) {
        return;
    }
    $('ul.hmenu>li:not(:first-child)').each(function () { $(this).prepend('<span class="hmenu-separator"> </span>'); });
});

jQuery(function ($) {
    "use strict";
    $("ul.hmenu a:not([href])").attr('href', '#').click(function (e) { e.preventDefault(); });
});

jQuery(function ($) {
    "use strict";
    if (!$.browser.msie) {
        return;
    }
    var ieVersion = parseInt($.browser.version, 10);
    if (ieVersion > 7) {
        return;
    }

    /* Fix width of submenu items.
    * The width of submenu item calculated incorrectly in IE6-7. IE6 has wider items, IE7 display items like stairs.
    */
    $.each($("ul.hmenu ul"), function () {
        var maxSubitemWidth = 0;
        var submenu = $(this);
        var subitem = null;
        $.each(submenu.children("li").children("a"), function () {
            subitem = $(this);
            var subitemWidth = subitem.outerWidth(false);
            if (maxSubitemWidth < subitemWidth) {
                maxSubitemWidth = subitemWidth;
            }
        });
        if (subitem !== null) {
            var subitemBorderLeft = parseInt(subitem.css("border-left-width"), 10) || 0;
            var subitemBorderRight = parseInt(subitem.css("border-right-width"), 10) || 0;
            var subitemPaddingLeft = parseInt(subitem.css("padding-left"), 10) || 0;
            var subitemPaddingRight = parseInt(subitem.css("padding-right"), 10) || 0;
            maxSubitemWidth -= subitemBorderLeft + subitemBorderRight + subitemPaddingLeft + subitemPaddingRight;
            submenu.children("li").children("a").css("width", maxSubitemWidth + "px");
        }
    });
});
jQuery(function () {
    "use strict";
    setHMenuOpenDirection({
        container: "div.sheet",
        defaultContainer: "#main",
        menuClass: "hmenu",
        leftToRightClass: "hmenu-left-to-right",
        rightToLeftClass: "hmenu-right-to-left"
    });
});

var setHMenuOpenDirection = (function ($) {
    "use strict";
    return (function(menuInfo) {
        var defaultContainer = $(menuInfo.defaultContainer);
        defaultContainer = defaultContainer.length > 0 ? defaultContainer = $(defaultContainer[0]) : null;

        $("ul." + menuInfo.menuClass + ">li>ul").each(function () {
            var submenu = $(this);

            var submenuWidth = submenu.outerWidth(false);
            var submenuLeft = submenu.offset().left;

            var mainContainer = submenu.parents(menuInfo.container);
            mainContainer = mainContainer.length > 0 ? mainContainer = $(mainContainer[0]) : null;

            var container = mainContainer || defaultContainer;
            if (container !== null) {
                var containerLeft = container.offset().left;
                var containerWidth = container.outerWidth(false);

                if (submenuLeft + submenuWidth >= containerLeft + containerWidth) {
                    /* right to left */
                    submenu.addClass(menuInfo.rightToLeftClass).find("ul").addClass(menuInfo.rightToLeftClass);
                } else if (submenuLeft <= containerLeft) {
                    /* left to right */
                    submenu.addClass(menuInfo.leftToRightClass).find("ul").addClass(menuInfo.leftToRightClass);
                }
            }
        });
    });
})(jQuery);

jQuery(function ($) {
    $("ul.hmenu ul li").hover(function () { $(this).prev().children("a").addClass("hmenu-before-hovered"); },
        function () { $(this).prev().children("a").removeClass("hmenu-before-hovered"); });
});

jQuery(window).bind("resize", (function ($) {
    /*global responsiveDesign */
    "use strict";
    return function () {
        if (typeof responsiveDesign !== "undefined" && responsiveDesign.isResponsive)
            return;
        var sheetLeft = $(".sheet").offset().left;
        $("header.header #flash-area").each(function () {
            var object = $(this);
            object.css("left", sheetLeft + "px");
        });
    };
})(jQuery));

jQuery(function ($) {
    'use strict';
    $(window).bind('resize', function () {
        var bh = $('body').height();
        var mh = 0;
        var c = $('div.content');
        c.removeAttr('style');

        $('#main').children().each(function() {
            if ($(this).css('position') !== 'absolute') {
                mh += $(this).outerHeight(true);
            }
        });

        if (mh < bh) {
            var r = bh - mh;
            c.css('height', (c.outerHeight(true) + r) + 'px');
        }
    });

    if ($.browser.msie && parseInt($.browser.version, 10) < 8) {
        $(window).bind('resize', function() {
            var c = $('div.content');
            var s = c.parent().children('.layout-cell:not(.content)');
            var w = 0;
            c.hide();
            s.each(function() { w += $(this).outerWidth(true); });
            c.w = c.parent().width(); c.css('width', c.w - w + 'px');
            c.show();
        });
    }

    $(window).trigger('resize');
});

var artButtonSetup = (function ($) {
    'use strict';
    return (function (className) {
        $.each($("a." + className + ", button." + className + ", input." + className), function (i, val) {
            var b = $(val);
            if (!b.hasClass('button')) {
                b.addClass('button');
            }
            if (b.is('input')) {
                b.val(b.val().replace(/^\s*/, '')).css('zoom', '1');
            }
            b.mousedown(function () {
                var b = $(this);
                b.addClass("active");
            });
            b.mouseup(function () {
                var b = $(this);
                if (b.hasClass('active')) {
                    b.removeClass('active');
                }
            });
            b.mouseleave(function () {
                var b = $(this);
                if (b.hasClass('active')) {
                    b.removeClass('active');
                }
            });
        });
    });
})(jQuery);
jQuery(function () {
    'use strict';
    artButtonSetup("button");
});

var Control = (function ($) {
    'use strict';
    return (function () {
        this.init = function(label, type, callback) {
            var chAttr = label.find('input[type="' +type + '"]').attr('checked');
            if (chAttr === 'checked') {
              label.addClass('checked');
            }

            label.mouseleave(function () {
              $(this).removeClass('hovered').removeClass('active');
            });
            label.mouseover(function () {
              $(this).addClass('hovered').removeClass('active');
            });
            label.mousedown(function (event) {
              if (event.which !== 1) {
                  return;
              }
              $(this).addClass('active').removeClass('hovered');
            });
            label.mouseup(function (event) {
              if (event.which !== 1) {
                  return;
              }
              callback.apply(this);
              $(this).removeClass('active').addClass('hovered');
            });
        };
    });
})(jQuery);

jQuery(function ($) {
    'use strict';
    $('.pager').contents().filter(
        function () {
            return this.nodeType === this.TEXT_NODE;
        }
    ).remove();
});
var fixRssIconLineHeight = (function ($) {
    "use strict";
    return function (className) {
        $("." + className).css("line-height", $("." + className).height() + "px");
    };
})(jQuery);

jQuery(function ($) {
    "use strict";
    var rssIcons = $(".rss-tag-icon");
    if (rssIcons.length){
        fixRssIconLineHeight("rss-tag-icon");
        if ($.browser.msie && parseInt($.browser.version, 10) < 9) {
            rssIcons.each(function () {
                if ($.trim($(this).html()) === "") {
                    $(this).css("vertical-align", "middle");
                }
            });
        }
    }
});
/**
* @license
* jQuery Tools 1.2.6 Mousewheel
*
* NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
*
* http://flowplayer.org/tools/toolbox/mousewheel.html
*
* based on jquery.event.wheel.js ~ rev 1 ~
* Copyright (c) 2008, Three Dub Media
* http://threedubmedia.com
*
* Since: Mar 2010
* Date:
*/
(function ($) {
    'use strict';
    $.fn.mousewheel = function (fn) {
        return this[fn ? "bind" : "trigger"]("wheel", fn);
    };

    // special event config
    $.event.special.wheel = {
        setup: function () {
            $.event.add(this, wheelEvents, wheelHandler, {});
        },
        teardown: function () {
            $.event.remove(this, wheelEvents, wheelHandler);
        }
    };

    // events to bind ( browser sniffed... )
    var wheelEvents = !$.browser.mozilla ? "mousewheel" : // IE, opera, safari
        "DOMMouseScroll" + ($.browser.version < "1.9" ? " mousemove" : ""); // firefox

    // shared event handler
    function wheelHandler(event) {
        /*jshint validthis:true*/

        switch (event.type) {

            // FF2 has incorrect event positions
            case "mousemove":
                return $.extend(event.data, { // store the correct properties
                    clientX: event.clientX, clientY: event.clientY,
                    pageX: event.pageX, pageY: event.pageY
                });

                // firefox
            case "DOMMouseScroll":
                $.extend(event, event.data); // fix event properties in FF2
                event.delta = -event.detail / 3; // normalize delta
                break;

            // IE, opera, safari
            case "mousewheel":
                event.delta = event.wheelDelta / 120;
                break;
        }

        event.type = "wheel"; // hijack the event
        return $.event.handle.call(this, event, event.delta);
    }

})(jQuery);

var ThemeLightbox = (function ($) {
    'use strict';
    return (function () {
        var current;
        var images = $(".lightbox");

        this.init = function (ctrl) {
            $(".lightbox").live("click", { _ctrl: ctrl }, function (e) {

                if (e.data._ctrl === true && !e.ctrlKey) {
                    return;
                }

                reload();
                current = images.index(this);
                show(this);
            });

            $(".lightbox-wrapper .arrow.left:not(.disabled)").live("click", function () {
                move(current - 1);
            });

            $(".lightbox-wrapper .arrow.right:not(.disabled)").live("click", function () {
                move(current + 1);
            });

            $(".lightbox-wrapper .active").live("click", function () {
                move(current + 1);
            });

            $(".lightbox-wrapper .close").live("click", function () {
                close();
            });
        };

        function show(src) {
            var closeBtn = $('<div class="close"><div class="cw"> </div><div class="ccw"> </div><div class="close-alt">✗</div></div>')
                .click(close);

            var imgContainer = $('.lightbox-wrapper');
            if (imgContainer.length === 0) {
                imgContainer = $('<div class="lightbox-wrapper">').css('line-height', $(window).height() + "px")
                    .appendTo($("body"));
            }

            var img = $('<img class="lightbox-image active" src="' + getFullImgSrc($(src).attr("src")) + '">');
            img.appendTo(imgContainer);

            showArrows();
            closeBtn.appendTo(imgContainer);
            showLoader(true);

            img.load(function () {
                showLoader(false);
            });

            img.error(function () {
                showLoader(false);
                img.attr("src", $(src).attr("src"));
            });

            bindMouse($(".lightbox-wrapper .arrow").add(img).add(imgContainer));
        }

        function reload() {
            images = $(".lightbox");
        }

        function move(index) {
            if (index < 0 || index >= images.length) {
                return;
            }

            showError(false);

            current = index;

            $(".lightbox-wrapper .lightbox-image:not(.active)").remove();

            var active = $(".lightbox-wrapper .active");
            var target = $('<img class="lightbox-image" alt="" src="' + getFullImgSrc($(images[current]).attr("src")) + '" />');

            active.after(target);

            showArrows();
            showLoader(true);

            bindMouse($(".lightbox-wrapper").add(target));

            target.load(function () {
                showLoader(false);

                active.removeClass("active");
                target.addClass("active");
            });

            target.error(function () {
                showLoader(false);
                active.removeClass("active");
                target.addClass("active");
                target.attr("src", $(images[current]).attr("src"));
            });
        }

        function showArrows() {
            if ($(".lightbox-wrapper .arrow").length === 0) {
                $(".lightbox-wrapper").append($('<div class="arrow left"><div class="arrow-t ccw"> </div><div class="arrow-b cw"> </div><div class="arrow-left-alt">←</div></div>').css("top", $(window).height() / 2 - 40));
                $(".lightbox-wrapper").append($('<div class="arrow right"><div class="arrow-t cw"> </div><div class="arrow-b ccw"> </div><div class="arrow-right-alt">→</div></div>').css("top", $(window).height() / 2 - 40));
            }

            if (current === 0) {
                $(".lightbox-wrapper .arrow.left").addClass("disabled");
            } else {
                $(".lightbox-wrapper .arrow.left").removeClass("disabled");
            }

            if (current === images.length - 1) {
                $(".lightbox-wrapper .arrow.right").addClass("disabled");
            } else {
                $(".lightbox-wrapper .arrow.right").removeClass("disabled");
            }
        }

        function showError(enable) {
            if (enable) {
                $(".lightbox-wrapper").append($('<div class="lightbox-error">Le contenu demandé ne peut pas être chargé.<br/>Veuillez réessayer plus tard.</div>')
                        .css({ "top": $(window).height() / 2 - 60, "left": $(window).width() / 2 - 170 }));
            } else {
                $(".lightbox-wrapper .lightbox-error").remove();
            }
        }

        function showLoader(enable) {
            if (!enable) {
                $(".lightbox-wrapper .loading").remove();
            }
            else {
                $('<div class="loading"> </div>').css({ "top": $(window).height() / 2 - 16, "left": $(window).width() / 2 - 16 }).appendTo($(".lightbox-wrapper"));
            }
        }

        var close = function () {
            $(".lightbox-wrapper").remove();
        };

        function bindMouse(img) {
            img.unbind("wheel").mousewheel(function (event, delta) {
                delta = delta > 0 ? 1 : -1;
                move(current + delta);
                event.preventDefault();
            });

            img.mousedown(function (e) {
                // close on middle button click
                if (e.which === 2) {
                    close();
                }
                e.preventDefault();
            });
        }

        function getFullImgSrc(src) {
            var fileName = src.substring(0, src.lastIndexOf('.'));
            var ext = src.substring(src.lastIndexOf('.'));
            src = fileName + "-large" + ext;

            return src;
        }

    });
})(jQuery);

jQuery(function () {
    'use strict';
    new ThemeLightbox().init();
});

(function($) {
    'use strict';
    // transition && transitionEnd && browser prefix
    $.support.transition = (function() {
        var thisBody = document.body || document.documentElement,
            thisStyle = thisBody.style,
            support = thisStyle.transition !== undefined ||
                thisStyle.WebkitTransition !== undefined ||
                thisStyle.MozTransition !== undefined ||
                thisStyle.MsTransition !== undefined ||
                thisStyle.OTransition !== undefined;
        return support && {
            event: (function() {
                var e = "transitionend";
                if ($.browser.opera) {
                    var version = parseFloat($.browser.version);
                    e = version >= 12 ? (version < 12.50 ? "otransitionend" : "transitionend") : "oTransitionEnd";
                } else if ($.browser.webkit) {
                    e = "webkitTransitionEnd";
                }
                return e;
            })(),
            prefix: (function() {
                var result;
                $.each($.browser, function(key, value) {
                    if (key === "version") {
                        return true;
                    }
                    return (result = {
                        opera: "-o-",
                        mozilla: "-moz-",
                        webkit: "-webkit-",
                        msie: "-ms-"
                    }[key]) ? false : true;
                });
                return result || "";
            })()
        };
    })();

    window.BackgroundHelper = function () {
        var slides = [];
        var direction = "next";
        var motion = "horizontal";
        var width = 0;
        var height = 0;
        var multiplier = 1;
        var transitionDuration = "";

        this.init = function(motionType, dir, duration) {
            direction = dir;
            motion = motionType;
            slides = [];
            width = 0;
            height = 0;
            multiplier = 1;
            transitionDuration = duration;
        };

        this.processSlide = function(element, modify) {
            this.updateSize(element, null);
            var pos = [];

            var bgPosition = element.css("background-position");
            var positions = bgPosition.split(",");
            $.each(positions, function (i) {
                var position = $.trim(this);
                var point = position.split(" ");
                if (point.length > 1) {
                    var x = parseInt(point[0], 10);
                    var y = parseInt(point[1], 10);
                    pos.push({ x: x, y: y });
                }
            });

            slides.push({
                "images": element.css("background-image"),
                "sizes": element.css("background-size"),
                "positions": pos
            });

            if (modify)
                element.css("background-image", "none");
        };

        this.updateSize = function (element, initialSize) {
            width = element.outerWidth(false);
            height = element.outerHeight();
            if (initialSize && parseInt(initialSize.width, 10) !== 0) {
                multiplier = width / initialSize.width;
                if (motion === "fade") {
                    $.each(element.children(), function (i) {
                        $(this).css("background-position", getCssPositions(slides[i].positions, { x: 0, y: 0 }));
                    });
                }
            }
        };

        this.setBackground = function(element, items) {
            var bg = [];
            var sizes = [];
            $.each(items, function (i, o) {
                bg.push(o.images);
                sizes.push(o.sizes);
            });
            element.css({
                "background-image": bg.join(", "),
                "background-size": sizes.join(", "),
                "background-repeat": "no-repeat"
            });
        };

        this.setPosition = function(element, items) {
            var pos = [];
            $.each(items, function(i, o) {
                pos.push(o.positions);
            });
            element.css({
                "background-position": pos.join(", ")
            });
        };

        this.current = function(index) {
            return slides[index] || null;
        };

        this.next = function(index) {
            var next;
            if (direction === "next") {
                next = (index + 1) % slides.length;
            } else {
                next = index - 1;
                if (next < 0) {
                    next = slides.length - 1;
                }
            }
            return slides[next];
        };

        this.items = function(prev, next, move) {
            var prevItem = { x: 0, y: 0 };
            var nextItem = { x: 0, y: 0 };
            var isDirectionNext = direction === "next";
            if (motion === "horizontal") {
                nextItem.x = isDirectionNext ? width : -width;
                nextItem.y = 0;
                if (move) {
                    prevItem.x += isDirectionNext ? -width : width;
                    nextItem.x += isDirectionNext ? -width : width;
                }
            } else if (motion === "vertical") {
                nextItem.x = 0;
                nextItem.y = isDirectionNext ? height : -height;
                if (move) {
                    prevItem.y += isDirectionNext ? -height : height;
                    nextItem.y += isDirectionNext ? -height : height;
                }
            }
            var result = [ ];
            if (!!prev) {
                result.push({ images: prev.images, positions: getCssPositions(prev.positions, prevItem), sizes: prev.sizes });
            }
            if (!!next) {
                result.push({ images: next.images, positions: getCssPositions(next.positions, nextItem), sizes: next.sizes });
            }

            if (direction === "next") {
                result.reverse();
            }

            return result;
        };

        this.transition = function(container, on) {
            container.css($.support.transition.prefix + "transition", on ? transitionDuration + " ease-in-out background-position" : "");
        };

        function getCssPositions(positions, offset) {
            var result = [];
            if (positions === undefined) {
                return "";
            }
            offset.x = offset.x || 0;
            offset.y = offset.y || 0;
            for (var i = 0; i < positions.length; i++) {
                result.push((positions[i].x * multiplier + offset.x) + "px " + (positions[i].y * multiplier + offset.y) + "px");
            }
            return result.join(", ");
        }
    };

    var Slider = function (element, settings) {

        var interval = null;
        var active = false;
        var children = element.find(".active").parent().children();
        var last = false;
        var running = false;

        this.settings = $.extend({ }, {
            "animation": "horizontal",
            "direction": "next",
            "speed": 600,
            "pause": 2500,
            "auto": true,
            "repeat": true,
            "navigator": null,
            "clickevents": true,
            "hover": true,
            "helper": null
        }, settings);

        this.move = function (direction, next) {
            var activeItem = element.find(".active"),
                nextItem = next || activeItem[direction](),
                innerDirection = this.settings.direction === "next" ? "forward" : "back",
                reset = direction === "next" ? "first" : "last",
                moving = interval,
                slider = this, tmp;

            active = true;

            if (moving) { this.stop(true); }

            if (!nextItem.length) {
                nextItem = element.find(".slide-item")[reset]();
                if (!this.settings.repeat) { last = true; active = false; return; }
            }

            if ($.support.transition) {
                nextItem.addClass(this.settings.direction);
                tmp = nextItem.get(0).offsetHeight;

                activeItem.addClass(innerDirection);
                nextItem.addClass(innerDirection);

                element.trigger("beforeSlide", children.length);

                element.one($.support.transition.event, function () {
                    nextItem.removeClass(slider.settings.direction)
                        .removeClass(innerDirection)
                        .addClass("active");
                    activeItem.removeClass("active")
                        .removeClass(innerDirection);
                    active = false;
                    setTimeout(function () {
                        element.trigger("afterSlide", children.length);
                    }, 0);
                });
            } else {
                element.trigger("beforeSlide", children.length);

                activeItem.removeClass("active");
                nextItem.addClass("active");
                active = false;

                element.trigger("afterSlide", children.length);
            }

            this.navigate(nextItem);

            if (moving) { this.start(); }
        };

        this.navigate = function (position) {
            var index = children.index(position);
            $(this.settings.navigator).children().removeClass("active").eq(index).addClass("active");
        };

        this.to = function (index) {
            var activeItem = element.find(".active"),
                children = activeItem.parent().children(),
                activeIndex = children.index(activeItem),
                slider = this;

            if (index > (children.length - 1) || index < 0) {
                return;
            }

            if (active) {
                return element.one("afterSlide", function () {
                    slider.to(index);
                });
            }

            if (activeIndex === index) {
                return;
            }

            this.move(index > activeIndex ? "next" : "prev", $(children[index]));
        };

        this.next = function () {
            if (!active) {
                if (last) { this.stop(); return;  }
                this.move("next");
            }
        };

        this.prev = function () {
            if (!active) {
                if (last) { this.stop(); return; }
                this.move("prev");
            }
        };

        this.start = function (force) {
            if (!!force) {
                setTimeout($.proxy(this.next, this), 10);
            }
            interval = setInterval($.proxy(this.next, this), this.settings.pause);
            running = true;
        };

        this.stop = function (pause) {
            clearInterval(interval);
            interval = null;
            running = !!pause;
            active = false;
        };

        this.active = function () {
            return running;
        };

        this.moving = function () {
            return active;
        };

        this.navigate(children.filter(".active"));

        if (this.settings.clickevents) {
            $(this.settings.navigator).on("click", "a", { slider: this }, function (event) {
                var activeIndex = children.index(children.filter(".active"));
                var index = $(this).parent().children().index($(this));
                if (activeIndex !== index) {
                    event.data.slider.to(index);
                }
                event.preventDefault();
            });
        }

        if (this.settings.hover) {
            var slider = this;
            element.add(this.settings.navigator)
                   .add(element.siblings(".shapes")).hover(function () {
                if (element.is(":visible") && !last) { slider.stop(true); }
            }, function () {
                if (element.is(":visible") && !last) { slider.start(); }
            });
        }
    };

    $.fn.slider = function (arg) {
        return this.each(function () {
            var element = $(this),
                data = element.data("slider"),
                options = typeof arg === "object" && arg;

            if (!data) {
                data = new Slider(element, options);
                element.data("slider", data);
            }

            if (typeof arg === "string" && data[arg]) {
                data[arg]();
            } else if (data.settings.auto && element.is(":visible")) {
                data.start();
            }
        });
    };

})(jQuery);

jQuery(window).bind("resize", (function ($) {
    /*global responsiveDesign */
    "use strict";
    return function () {
        if (typeof responsiveDesign !== "undefined" && responsiveDesign.isResponsive) {
            $("header.header .shapes").children().css("left", "");
            return;
        }
        var sheetWidth = $(".sheet").width();
        var sheetLeft = $(".sheet").offset().left;
        $("header.header .shapes>*, header.header>.textblock, header.header>.headline, header.header>.slogan").each(function () {
            var object = $(this);
            var objectLeft = sheetWidth * parseFloat(object.attr("data-left") || "0") / 100 + sheetLeft;
            object.css("left", objectLeft + "px");
        });
    };
})(jQuery));

jQuery(function ($) {
    "use strict";
    $(window).trigger("resize");
});
jQuery(function ($) {
    "use strict";
    if (!$.browser.msie || parseInt($.browser.version, 10) > 8)
        return;
    var path = "";
    var scripts = $("script[src*='script.js']");
    if (scripts.length > 0) {
        var src = scripts.last().attr('src');
        path = src.substr(0, src.indexOf("script.js"));
    }
    processHeaderMultipleBg(path);
});

var processHeaderMultipleBg = (function ($) {
    "use strict";
    return (function (path) {
        var header = $(".header");
        var bgimages = "".split(",");
        var bgpositions = "".split(",");
        for (var i = bgimages.length - 1; i >= 0; i--) {
            var bgimage = $.trim(bgimages[i]);
            if (bgimage === "")
                continue;
            if (path !== "") {
                bgimage = bgimage.replace(/(url\(['"]?)/i, "$1" + path);
            }
            header.append("<div style=\"position:absolute;top:0;left:0;width:100%;height:100%;background:" + bgimage + " " + bgpositions[i] + " no-repeat\">");
        }
        header.css('background-image', "url('images/header.png')".replace(/(url\(['"]?)/i, "$1" + path));
        header.css('background-position', "center top");
    });
})(jQuery);


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

namespace Gold_Client.ViewModel.Others
{
    public static class ReceivePackageFromServer
    {
        public static event EventHandler OnDataReceived;

        public static bool IsClientStartReceive { get; set; }

        public static Task<int> ReceiveAsync(this Socket socket, byte[] buffer, int offset, int size, SocketFlags socketFlags)
        {
            var tcs = new TaskCompletionSource<int>(socket);
            socket.BeginReceive(buffer, offset, size, socketFlags, iar =>
            {
                var t = (TaskCompletionSource<int>)iar.AsyncState;
                var s = (Socket)t.Task.AsyncState;
                try
                {
                    t.TrySetResult(s.EndReceive(iar));
                }
                catch (Exception ex)
                {
                    t.TrySetException(ex);
                }
            }, tcs);
            return tcs.Task;
        }

        public static async void BeginReceive()
        {
            while (true)
            {
                int x = await ReceiveAsync(App.Client.cSocket, App.Client.Buffer, 0, App.Client.Buffer.Length, SocketFlags.None);
                IsClientStartReceive = true;
                OnDataReceived?.Invoke(null, EventArgs.Empty);
            }
            // clientReceive.BeginReceive();
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;

namespace CheckpointAndLevelEndDemo.GumRuntimes.DefaultForms
{
    public partial class TreeViewItemRuntime
    {
        partial void CustomInitialize ()
        {
        }
    }
}


text:
package com.vangent.hieos.policyutil.pip.model;

import com.vangent.hieos.policyutil.util.PolicyConstants;
import javax.xml.namespace.QName;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;

/**
 *
 * @author Bernie Thuman
 */
public class PIPRequestBuilder {

    //<pip:GetConsentDirectivesRequest xsi:schemaLocation="urn:hieos:policy:pip PIP.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pip="urn:hieos:policy:pip">
    //  <pip:PatientId>String</pip:PatientId>
    //</pip:GetConsentDirectivesRequest>
    /**
     *
     * @param pipRequest
     * @return
     */
    public PIPRequestElement buildPIPRequestElement(PIPRequest pipRequest) {
        OMFactory omfactory = OMAbstractFactory.getOMFactory();

        // Request
        OMElement requestNode = omfactory.createOMElement(new QName(PolicyConstants.HIEOS_PIP_NS, "GetConsentDirectivesRequest", PolicyConstants.HIEOS_PIP_NS_PREFIX));

        // PatientId
        OMElement patientIdNode = omfactory.createOMElement(new QName(PolicyConstants.HIEOS_PIP_NS, "PatientId", PolicyConstants.HIEOS_PIP_NS_PREFIX));
        patientIdNode.setText(pipRequest.getPatientId().getCXFormatted());
        requestNode.addChild(patientIdNode);

        return new PIPRequestElement(requestNode);
    }
}


text:
require 'eb_ruby_client'

module EbRubyClient
  module Endpoints
    class Venues
      attr_reader :connection

      def initialize(connection:)
        @connection = connection
      end

      def create(venue)
        response = connection.post('venues/', venue.to_data)

        EbRubyClient::Resource::Venue.new(response)
      end
    end
  end
end


text:
import logging

from oslo_config import cfg
from oslo_log import log

API_SERVICE_OPTS = [
    cfg.StrOpt('host_ip',
               default='0.0.0.0',
               help='The IP address on which api listens.'),
    cfg.IntOpt('port',
               default=9322,
               min=1, max=65535,
               help='The TCP port on which api listens.'),
]

DISCOVERY_SERVICE_OPTS = [
    cfg.StrOpt('discovery_host_ip',
               default='0.0.0.0',
               help='The IP address on which discovery api listens.'),
    cfg.IntOpt('discovery_port',
               default=8881,
               min=1, max=65535,
               help='The TCP port on which dsiscovry api listens.'),
]

opt_group = cfg.OptGroup(
    name='api',
    title='Options for the api service')

def make_config():
    conf = cfg.ConfigOpts()

    conf.register_group(opt_group)

    conf.register_opts(API_SERVICE_OPTS, opt_group)
    conf.register_cli_opts(API_SERVICE_OPTS)

    conf.register_opts(DISCOVERY_SERVICE_OPTS, opt_group)
    conf.register_cli_opts(DISCOVERY_SERVICE_OPTS)

    log.register_options(conf)
    return conf

def parse_args(conf, args=None):
    import sys

    conf(args=args if args else sys.argv[1:],
         project='bareon-api',
         version='1.0.0')

CONF = make_config()
logging.getLogger(__name__)
parse_args(CONF)


text:
/**
 * This is a script for testing the performance of the NLI iiif server.
 * Just add http addresses to the `testImages` variable and it will test
 * the response and provide timing info in the output.
 */

// Some code taken from: https://github.com/RisingStack/example-http-timings/blob/master/README.md
// See explanation at: https://blog.risingstack.com/measuring-http-timings-node-js/
'use strict'

const assert = require('assert')
const url = require('url')
const http = require('http')
const https = require('https')

const TIMEOUT_IN_MILLISECONDS = 30 * 1000
const NS_PER_SEC = 1e9
const MS_PER_NS = 1e6

/**
* Creates a request and collects HTTP timings
* @function request
* @param {Object} options
* @param {String} [options.method='GET']
* @param {String} options.protocol
* @param {String} options.hostname
* @param {Number} [options.port]
* @param {String} [options.path]
* @param {Object} [options.headers={}]
* @param {String} [options.body]
* @param {Function} callback
*/
function request ({
  method = 'GET',
  protocol,
  hostname,
  port,
  path,
  headers = {},
  body
} = {}, callback) {
  // Validation
  assert(protocol, 'options.protocol is required')
  assert(['http:', 'https:'].includes(protocol), 'options.protocol must be one of: "http:", "https:"')
  assert(hostname, 'options.hostname is required')
  assert(callback, 'callback is required')

  // Initialization
  const eventTimes = {
    // use process.hrtime() as it's not a subject of clock drift
    startAt: process.hrtime(),
    dnsLookupAt: undefined,
    tcpConnectionAt: undefined,
    tlsHandshakeAt: undefined,
    firstByteAt: undefined,
    endAt: undefined
  }

  // Making request
  const req = (protocol.startsWith('https') ? https : http).request({
    protocol,
    method,
    hostname,
    port,
    path,
    headers
  }, (res) => {
    let responseBody = ''

    req.setTimeout(TIMEOUT_IN_MILLISECONDS)

    // Response events
    res.once('readable', () => {
      eventTimes.firstByteAt = process.hrtime()
    })
    res.on('data', (chunk) => { responseBody += chunk })

    // End event is not emitted when stream is not consumed fully
    // in our case we consume it see: res.on('data')
    res.on('end', () => {
      eventTimes.endAt = process.hrtime()

      callback(null, {
        headers: res.headers,
        timings: getTimings(eventTimes),
        body: responseBody
      })
    })
  })

  // Request events
  req.on('socket', (socket) => {
    socket.on('lookup', () => {
      eventTimes.dnsLookupAt = process.hrtime()
    })
    socket.on('connect', () => {
      eventTimes.tcpConnectionAt = process.hrtime()
    })
    socket.on('secureConnect', () => {
      eventTimes.tlsHandshakeAt = process.hrtime()
    })
    socket.on('timeout', () => {
      req.abort()

      const err = new Error('ETIMEDOUT')
      err.code = 'ETIMEDOUT'
      callback(err)
    })
  })
  req.on('error', callback)

  // Sending body
  if (body) {
    req.write(body)
  }

  req.end()
}

/**
* Calculates HTTP timings
* @function getTimings
* @param {Object} eventTimes
* @param {Number} eventTimes.startAt
* @param {Number|undefined} eventTimes.dnsLookupAt
* @param {Number} eventTimes.tcpConnectionAt
* @param {Number|undefined} eventTimes.tlsHandshakeAt
* @param {Number} eventTimes.firstByteAt
* @param {Number} eventTimes.endAt
* @return {Object} timings - { dnsLookup, tcpConnection, tlsHandshake, firstByte, contentTransfer, total }
*/
function getTimings (eventTimes) {
  return {
    // There is no DNS lookup with IP address
    dnsLookup: eventTimes.dnsLookupAt !== undefined ?
      getHrTimeDurationInMs(eventTimes.startAt, eventTimes.dnsLookupAt) : undefined,
    tcpConnection: getHrTimeDurationInMs(eventTimes.dnsLookupAt || eventTimes.startAt, eventTimes.tcpConnectionAt),
    // There is no TLS handshake without https
    tlsHandshake: eventTimes.tlsHandshakeAt !== undefined ?
      (getHrTimeDurationInMs(eventTimes.tcpConnectionAt, eventTimes.tlsHandshakeAt)) : undefined,
    firstByte: getHrTimeDurationInMs((eventTimes.tlsHandshakeAt || eventTimes.tcpConnectionAt), eventTimes.firstByteAt),
    contentTransfer: getHrTimeDurationInMs(eventTimes.firstByteAt, eventTimes.endAt),
    total: getHrTimeDurationInMs(eventTimes.startAt, eventTimes.endAt)
  }
}

/**
* Get duration in milliseconds from process.hrtime()
* @function getHrTimeDurationInMs
* @param {Array} startTime - [seconds, nanoseconds]
* @param {Array} endTime - [seconds, nanoseconds]
* @return {Number} durationInMs
*/
function getHrTimeDurationInMs (startTime, endTime) {
  const secondDiff = endTime[0] - startTime[0]
  const nanoSecondDiff = endTime[1] - startTime[1]
  const diffInNanoSecond = secondDiff * NS_PER_SEC + nanoSecondDiff

  return diffInNanoSecond / MS_PER_NS
}

const testImages = [
  'http://192.114.7.208:8182/iiif/2/P593-Fg001-R-C01-R01-D30122013-T142907-LR445%20_ColorCalData_IAA_Left_CC110304_110702-test.tif/full/size/0/default.jpg',
  //'http://192.114.7.208:8182/iiif/2/P593-Fg001-R-C01-R01-D30122013-T142907-LR445%20_ColorCalData_IAA_Left_CC110304_110702.tif/full/size/0/default.jpg'
]
const sizes = [
  '150:',
  'pct:25',
  'pct:50',
  'pct:100'
]

// Getting timings
for (const address of testImages) {
  for (const size of sizes) {
    const formattedURL = address.replace('size', size)
    request(
      Object.assign(
        url.parse(formattedURL),
        {
          headers: {
            'User-Agent': 'Example'
          }
        }
      ), (err, res) => {
        console.log(formattedURL)
        console.log(err || res.timings)
      }
    )
  }
}


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>Statistics of amod in UD_Moksha-JR</title>
    <link rel="root" href=""/>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/jquery-ui-redmond.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style-vis.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/hint.css"/>

          home

          edit page
          issue tracker

          <gcse:search></gcse:search>

        This page pertains to UD version 2.

            It appears that you have Javascript disabled.
            Please consider enabling Javascript for this page to see the visualizations.

Treebank Statistics: UD_Moksha-JR: Relations: amod

This relation is universal.

123 nodes (4%) are attached to their parents as amod.

123 instances of amod (100%) are right-to-left (child precedes parent).
Average distance between parent and child is 1.17886178861789.

The following 5 pairs of parts of speech are connected with amod: <tt>NOUN</tt>-<tt>ADJ</tt> (119; 97% instances), <tt>ADV</tt>-<tt>ADJ</tt> (1; 1% instances), <tt>NOUN</tt>-<tt>PRON</tt> (1; 1% instances), <tt>NOUN</tt>-<tt>VERB</tt> (1; 1% instances), <tt>VERB</tt>-<tt>ADJ</tt> (1; 1% instances).

# visual-style 3	bgColor:blue
# visual-style 3	fgColor:white
# visual-style 4	bgColor:blue
# visual-style 4	fgColor:white
# visual-style 4 3 amod	color:blue
1	И	и	CCONJ	CC	_	2	cc	_	_
2	уендихть	уендемс	VERB	V	Mood=Ind|Number[subj]=Plur|Person[subj]=3|Tense=Pres|Valency=1	0	root	_	_
3	сенем	сенем	ADJ	A	Case=Nom|Definite=Ind|Number=Sing	4	amod	_	_
4	менельть	менель	NOUN	N	Case=Gen|Definite=Def|Number=Sing	5	nmod	_	_
5	потмоса	потма	NOUN	N	Case=Ine|Definite=Ind|Number=Plur,Sing	2	obl:lmod	_	SpaceAfter=No
6	,	,	PUNCT	CLB	_	9	punct	_	_
7	кода	кода	ADV	Adv	_	9	mark	_	_
8	оцю	оцю	ADJ	A	Case=Nom|Number=Sing	9	amod	_	_
9	морява	моря	NOUN	N	Case=Prl|Definite=Ind|Number=Plur,Sing	4	obl:lmod	_	SpaceAfter=No
10	.	.	PUNCT	CLB	_	2	punct	_	_

# visual-style 6	bgColor:blue
# visual-style 6	fgColor:white
# visual-style 7	bgColor:blue
# visual-style 7	fgColor:white
# visual-style 7 6 amod	color:blue
1	Тянемс	тянемс	ADV	Adv	AdvType=Tim	4	advmod:tmod	_	GTtags=Sem/Time
2	вестенге	весть	ADV	Adv	Clitic=AddGA	4	advmod:freq	_	GTtags=Temp,Clt/Add
3	ашезь	аф	AUX	V	Mood=Ind|Number[subj]=Sing|Person[subj]=3|Polarity=Neg|Tense=Past|VerbType=Aux	4	aux:neg	_	GTtags=Aux,Neg,Ind,Prt1,ScSg3
4	няенде	няендемс	VERB	V	Connegative=Yes	0	root	_	GTtags=ConNeg
5	сонь	сон	PRON	Pron	Case=Gen|Number=Sing|Person=3|PronType=Prs	4	obj	_	GTtags=Pers,Sg3,Gen
6	тяфтама	тяфтама	ADJ	A	Case=Nom|Definite=Ind|Number=Sing|PronType=Dem	7	amod	_	GTtags=Dem,Sg,Nom,Indef
7	весяласта	весяласта	ADV	Adv	_	4	xcomp	_	_
8	и	и	CCONJ	CC	_	9	cc	_	_
9	ляпоста	ляпоста	ADV	Adv	_	7	conj	_	_
10	главнайть	главнай	ADJ	A	Case=Gen|Definite=Def|Number=Sing	7	obl	_	GTtags=Sg,Gen,Def
11	мархта	мархта	ADP	Adp	_	10	case	_	SpaceAfter=No
12	.	.	PUNCT	PUNCT	_	4	punct	_	_

# visual-style 12	bgColor:blue
# visual-style 12	fgColor:white
# visual-style 14	bgColor:blue
# visual-style 14	fgColor:white
# visual-style 14 12 amod	color:blue
1	Эрь	эрь	INTJ	Interj	_	11	discourse	_	SpaceAfter=No
2	,	,	PUNCT	PUNCT	_	3	punct	_	_
3	аванят	ава	NOUN	N	Case=Nom|Definite=Ind|Derivation=Dimin|Number=Plur	11	vocative	_	GTtags=Der/Dimin,Pl,Nom,Indef|SpaceAfter=No
4	,	,	PUNCT	PUNCT	_	3	punct	_	_
5	аф	аф	AUX	_	Polarity=Neg|VerbType=Aux	6	aux:neg	_	GTtags=Aux,Neg
6	озадонь	озадонь	ADJ	A	Derivation=GenAttr	7	amod	_	GTtags=GenAttr
7	седи	седи	NOUN	N	Case=Nom|Definite=Ind|Number=Sing	11	advcl	_	GTtags=Sg,Nom,Indef
8	улефтяряль	улемс	AUX	V	Mood=NegCndSub|Number[subj]=Sing|Person[subj]=3|Polarity=Neg	7	cop	_	GTtags=NegProt,Conj,ScSg3|SpaceAfter=No
9	,	,	PUNCT	PUNCT	_	7	punct	_	_
10	дяряй	дяряй	PART	Pcle	_	11	advmod	_	GTtags=Cond
11	сявольхце	сявомс	VERB	V	Mood=Sub|Number[obj]=Sing|Number[subj]=Sing|Person[obj]=3|Person[subj]=3	0	root	_	GTtags=Conj,ScSg3,OcSg3
12	илянь	иля	PRON	Pron	Case=Gen|Definite=Ind|Number=Plur,Sing	14	amod	_	GTtags=VGen
13	пря	пря	NOUN	N	Case=Nom|Definite=Ind|Number=Sing	14	nmod	_	GTtags=Sg,Nom,Indef
14	урмать	урма	NOUN	N	Case=Gen|Definite=Def|Number=Sing	11	obj	_	GTtags=Sg,Gen,Def|SpaceAfter=No
15	,	,	PUNCT	PUNCT	_	11	punct	_	_
16	...	...	PUNCT	PUNCT	_	11	punct	_	_

© 2014–2021
            Universal Dependencies contributors.
            Site powered by Annodoc and brat
.


text:
namespace spvtools {
namespace fuzz {

// This fuzzer pass searches for image sample instructions in the module and
// randomly applies the transformation to add unused components to the image
// sample coordinate.
class FuzzerPassAddImageSampleUnusedComponents : public FuzzerPass {
 public:
  FuzzerPassAddImageSampleUnusedComponents(
      opt::IRContext* ir_context, TransformationContext* transformation_context,
      FuzzerContext* fuzzer_context,
      protobufs::TransformationSequence* transformations,
      bool ignore_inapplicable_transformations);

  void Apply() override;
};

}  // namespace fuzz
}  // namespace spvtools

#endif  // SOURCE_FUZZ_FUZZER_PASS_ADD_IMAGE_SAMPLE_UNUSED_COMPONENTS_H_


text:
package dk.silverbullet.telemed.device.andweightscale;

public class Weight {
    public static enum Unit {
        KG("kg"), LBS("lbs.");

        private final String name;

        Unit(String name) {
            this.name = name;
        }

        public String getName() {
            return name;
        }
    };

    private final float weight;
    private final Unit unit;

    public Weight(float weight, Unit unit) {
        this.weight = weight;
        this.unit = unit;
    }

    public float getWeight() {
        return weight;
    }

    public Unit getUnit() {
        return unit;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((unit == null) ? 0 : unit.hashCode());
        result = prime * result + Float.floatToIntBits(weight);
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Weight other = (Weight) obj;
        if (unit != other.unit)
            return false;
        if (Float.floatToIntBits(weight) != Float.floatToIntBits(other.weight))
            return false;
        return true;
    }

    @Override
    public String toString() {
        return "Weight [weight=" + weight + ", unit=" + unit + "]";
    }
}


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Flat Login Form</title>

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">

  <link rel='stylesheet prefetch' href='http://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900'>
  <link rel='stylesheet prefetch' href='http://fonts.googleapis.com/css?family=Montserrat:400,700'>
  <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css'>

      <link rel="stylesheet" href="css/style.css">

Flat Login Form
Made with  by Andy Tran

  <form class="register-form">
    <input type="text" placeholder="name"/>
    <input type="password" placeholder="password"/>
    <input type="text" placeholder="email address"/>
    <button>create</button>

Already registered? Sign In

  </form>
  <form class="login-form">
    <input type="text" placeholder="username"/>
    <input type="password" placeholder="password"/>
    <button>login</button>

Not registered? Create an account

  </form>


text:
using System;
using System.Xml.Serialization;

namespace EZOper.NetSiteUtilities.AopApi
{
    /// <summary>
    /// AlipayPassTplAddResponse.
    /// </summary>
    public class AlipayPassTplAddResponse : AopResponse
    {
        /// <summary>
        /// 接口返回业务错误码
        /// </summary>
        [XmlElement("error_code")]
        public string ErrorCode { get; set; }

        /// <summary>
        /// 接口调用返回结果信息
        /// </summary>
        [XmlElement("result")]
        public string Result { get; set; }

        /// <summary>
        /// 操作成功标识【T:成功;F:失败】
        /// </summary>
        [XmlElement("success")]
        public string Success { get; set; }
    }
}


text:
namespace Junaio.Core.Model
{
    public class Minaccuracy : IElement<int>
    {
        private int _accuracy;

        public Minaccuracy(int accuracy)
        {
            _accuracy = accuracy;
        }

        public Minaccuracy()
        {
            // TODO: Complete member initialization
        }

        public int Value
        {
            get { return _accuracy; }
            set { _accuracy = value; }
        }
    }
}


text:
import { ILogger } from 'core/logging';
import {
  DocumentFactory,
  SuggestionFactory,
  PackageDocument,
  PackageSourceTypes,
  PackageVersionTypes,
  PackageRequest,
  VersionHelpers,
  IPackageClient,
  ResponseFactory,
} from 'core/packages';

import {
  HttpClientResponse,
  HttpClientRequestMethods,
  HttpRequestOptions,
  UrlHelpers,
} from 'core/clients';

import { JsonHttpClientRequest } from 'infrastructure/clients';

import { NuGetClientData } from '../definitions/nuget';
import { DotNetVersionSpec } from '../definitions/dotnet';
import { parseVersionSpec } from '../dotnetUtils.js';
import { DotNetConfig } from '../dotnetConfig';

export class NuGetPackageClient
  extends JsonHttpClientRequest
  implements IPackageClient<NuGetClientData> {

  config: DotNetConfig;

  constructor(config: DotNetConfig, options: HttpRequestOptions, logger: ILogger) {
    super(logger, options);
    this.config = config;
  }

  async fetchPackage(request: PackageRequest<NuGetClientData>): Promise<PackageDocument> {
    const dotnetSpec = parseVersionSpec(request.package.version);
    return this.fetchPackageRetry(request, dotnetSpec);
  }

  async fetchPackageRetry(
    request: PackageRequest<NuGetClientData>,
    dotnetSpec: DotNetVersionSpec
  ): Promise<PackageDocument> {
    const urls = request.clientData.serviceUrls;
    const autoCompleteUrl = urls[request.attempt];

    return createRemotePackageDocument(this, autoCompleteUrl, request, dotnetSpec)
      .catch((error: HttpClientResponse) => {

        // increase the attempt number
        request.attempt++;

        // only retry if 404 and we have more urls to try
        if (error.status === 404 && request.attempt < urls.length) {
          // retry
          return this.fetchPackageRetry(request, dotnetSpec)
        }

        if (error.status === 404) {
          return DocumentFactory.createNotFound(
            request.providerName,
            request.package,
            PackageVersionTypes.Version,
            ResponseFactory.createResponseStatus(error.source, 404)
          );
        }

        // unexpected
        return Promise.reject(error);
      });

  }

}

async function createRemotePackageDocument(
  client: JsonHttpClientRequest,
  url: string,
  request: PackageRequest<NuGetClientData>,
  dotnetSpec: DotNetVersionSpec
): Promise<PackageDocument> {

  const packageUrl = UrlHelpers.ensureEndSlash(url) + `${request.package.name}/index.json`;

  return client.requestJson(HttpClientRequestMethods.get, packageUrl)
    .then(function (httpResponse) {

      const { data } = httpResponse;

      const source = PackageSourceTypes.Registry;

      const { providerName } = request;

      const requested = request.package;

      const packageInfo = data;

      const response = {
        source: httpResponse.source,
        status: httpResponse.status,
      };

      // sanitize to semver only versions
      const rawVersions = VersionHelpers.filterSemverVersions(packageInfo.versions);

      // seperate versions to releases and prereleases
      const { releases, prereleases } = VersionHelpers.splitReleasesFromArray(rawVersions)

      // four segment is not supported
      if (dotnetSpec.spec && dotnetSpec.spec.hasFourSegments) {
        return DocumentFactory.createFourSegment(
          providerName,
          requested,
          ResponseFactory.createResponseStatus(httpResponse.source, 404),
          <any>dotnetSpec.type,
        )
      }

      // no match if null type
      if (dotnetSpec.type === null) {
        return DocumentFactory.createNoMatch(
          providerName,
          source,
          PackageVersionTypes.Version,
          requested,
          ResponseFactory.createResponseStatus(httpResponse.source, 404),
          // suggest the latest release if available
          releases.length > 0 ? releases[releases.length - 1] : null,
        )
      }

      const versionRange = dotnetSpec.resolvedVersion;

      const resolved = {
        name: requested.name,
        version: versionRange,
      };

      // analyse suggestions
      const suggestions = SuggestionFactory.createSuggestionTags(
        versionRange,
        releases,
        prereleases
      );

      return {
        providerName,
        source,
        response,
        type: dotnetSpec.type,
        requested,
        resolved,
        suggestions,
      };
    });
}


text:
function graderr(finite_diff_deriv, analytic_deriv, gradfcn)
%GRADERR Checks gradient discrepancy in optimization routines.
%
% This is a helper function.

%   Copyright 1990-2004 The MathWorks, Inc.
%   $Revision: 1.1.4.1 $  $Date: 2004/03/26 13:27:17 $

try
    if isa(gradfcn,'function_handle')
      gradfcnstr = func2str(gradfcn);
    else
      gradfcnstr = char(gradfcn);
    end
catch
    gradfcnstr = '';
end

finite_diff_deriv = full(finite_diff_deriv);
analytic_deriv = full(analytic_deriv);
err=max(max(abs(analytic_deriv-finite_diff_deriv)));
disp(sprintf('Maximum discrepancy between derivatives  = %g',err));
if (err > 1e-6*norm(analytic_deriv) + 1e-5)
    disp('Warning: Derivatives do not match within tolerance')
    disp('Derivative from finite difference calculation:')
    disp(finite_diff_deriv)
    if ~isempty(gradfcnstr)
        disp(['User-supplied derivative, ', gradfcnstr ': '])
    else
        disp(['User-supplied derivative: '])
    end
    disp(analytic_deriv)
    disp('Difference:')
    disp(analytic_deriv - finite_diff_deriv)
    disp('Strike any key to continue or Ctrl-C to abort')
    pause
end
end


text:
goog.setTestOnly();
goog.require('goog.testing.AsyncTestCase');
goog.require('goog.testing.jsunit');
goog.require('lf.Binder');
goog.require('lf.Exception');
goog.require('lf.bind');
goog.require('lf.eval.Type');
goog.require('lf.pred.JoinPredicate');
goog.require('lf.pred.ValuePredicate');
goog.require('lf.proc.Relation');
goog.require('lf.testing.MockEnv');

/** @type {!goog.testing.AsyncTestCase} */
var asyncTestCase = goog.testing.AsyncTestCase.createAndInstall(
    'ValuePredicate');

/** @type {!lf.schema.Database} */
var schema;

function setUp() {
  asyncTestCase.waitForAsync('setUp');

  var env = new lf.testing.MockEnv();
  env.init().then(function() {
    schema = env.schema;
    asyncTestCase.continueTesting();

  }, fail);
}

function testCopy() {
  var table = schema.getTables()[0];
  var original = new lf.pred.ValuePredicate(
      table.id, 'myId', lf.eval.Type.EQ);
  var copy = original.copy();

  assertTrue(copy instanceof lf.pred.ValuePredicate);
  assertFalse(original == copy);
  assertEquals(original.column, copy.column);
  assertEquals(original.value, copy.value);
  assertEquals(original.evaluatorType, copy.evaluatorType);
}

function testEval_Eq() {
  var table = schema.getTables()[0];
  var sampleRow = getSampleRows(1)[0];
  var relation = lf.proc.Relation.fromRows(
      [sampleRow], [table.getName()]);

  var predicate1 = new lf.pred.ValuePredicate(
      table.id, sampleRow.payload().id, lf.eval.Type.EQ);
  var finalRelation1 = predicate1.eval(relation);
  assertEquals(1, finalRelation1.entries.length);

  var predicate2 = new lf.pred.ValuePredicate(
      table.id, 'otherId', lf.eval.Type.EQ);
  var finalRelation2 = predicate2.eval(relation);
  assertEquals(0, finalRelation2.entries.length);
}

function testEval_Match() {
  var table = schema.getTables()[0];
  var sampleRow = getSampleRows(1)[0];
  var relation = lf.proc.Relation.fromRows(
      [sampleRow], [table.getName()]);

  // Testing true case.
  var predicate1 = new lf.pred.ValuePredicate(
      table.name, /sampleName0/, lf.eval.Type.MATCH);
  var finalRelation1 = predicate1.eval(relation);
  assertEquals(1, finalRelation1.entries.length);

  var predicate2 = new lf.pred.ValuePredicate(
      table.name, /\bsample[A-Za-z0-9]+\b/, lf.eval.Type.MATCH);
  var finalRelation2 = predicate2.eval(relation);
  assertEquals(1, finalRelation2.entries.length);

  // Testing false case.
  var predicate3 = new lf.pred.ValuePredicate(
      table.name, /SAMPLENAME0/, lf.eval.Type.MATCH);
  var finalRelation3 = predicate3.eval(relation);
  assertEquals(0, finalRelation3.entries.length);
}

/**
 * Tests ValuePredicate#eval() in the case where the predicate is of type
 * lf.eval.Type.IN.
 */
function testEval_In() {
  var table = schema.getTables()[0];
  var sampleRows = getSampleRows(6);
  var expectedNames = ['sampleName0', 'sampleName2', 'sampleName4'];
  var predicate = new lf.pred.ValuePredicate(
      table.name, expectedNames, lf.eval.Type.IN);

  var inputRelation = lf.proc.Relation.fromRows(sampleRows, ['tableA']);
  var outputRelation = predicate.eval(inputRelation);
  var actualNames = outputRelation.entries.map(function(entry) {
    return entry.getField(table.name);
  });
  assertArrayEquals(expectedNames, actualNames);
}

/**
 * Tests ValuePredicate#eval() in the case where the predicate is of type
 * lf.eval.Type.IN and the predicate has been reversed.
 */
function testEval_In_Reversed() {
  var table = schema.getTables()[0];
  var sampleRows = getSampleRows(6);
  var predicate = new lf.pred.ValuePredicate(
      table.name,
      ['sampleName1', 'sampleName3', 'sampleName5'],
      lf.eval.Type.IN);
  predicate.setComplement(true);

  var inputRelation = lf.proc.Relation.fromRows(sampleRows, ['tableA']);
  var outputRelation = predicate.eval(inputRelation);
  var actualNames = outputRelation.entries.map(function(entry) {
    return entry.getField(table.name);
  });

  assertArrayEquals(
      ['sampleName0', 'sampleName2', 'sampleName4'],
      actualNames);
}

/**
 * Testing the case where a ValuePredicate is applied on a relation that is the
 * result of a previous join operation.
 */
function testEval_Eq_PreviousJoin() {
  var table1 = schema.getTables()[0];
  var table2 = schema.getTables()[4];

  var leftRow = table1.createRow({
    'id': 'dummyId',
    'name': 'dummyName'
  });
  var rightRow1 = table2.createRow({
    'id': 'dummyId',
    'email': 'dummyEmail1'
  });
  var rightRow2 = table2.createRow({
    'id': 'dummyId',
    'email': 'dummyEmail2'
  });

  var leftRelation = lf.proc.Relation.fromRows(
      [leftRow], [table1.getName()]);
  var rightRelation = lf.proc.Relation.fromRows(
      [rightRow1, rightRow2], [table2.getName()]);

  var joinPredicate = new lf.pred.JoinPredicate(
      table1.id, table2.id, lf.eval.Type.EQ);
  var joinedRelation = joinPredicate.evalRelations(leftRelation, rightRelation);

  var valuePredicate = new lf.pred.ValuePredicate(
      table2.email, rightRow2.payload()['email'], lf.eval.Type.EQ);
  var finalRelation = valuePredicate.eval(joinedRelation);
  assertEquals(1, finalRelation.entries.length);
  assertEquals(
      rightRow2.payload()['email'],
      finalRelation.entries[0].getField(table2.email));
}

/**
 * Tests the conversion of a value predicate to a KeyRange.
 */
function testToKeyRange() {
  var table = schema.getTables()[0];

  var p = new lf.pred.ValuePredicate(
      table.id, 'otherId', lf.eval.Type.EQ);
  assertTrue(p.isKeyRangeCompatible());
  assertEquals('[otherId, otherId]', p.toKeyRange().toString());

  p = new lf.pred.ValuePredicate(
      table.id, 10, lf.eval.Type.GTE);
  assertTrue(p.isKeyRangeCompatible());
  assertEquals('[10, unbound]', p.toKeyRange().toString());

  p = new lf.pred.ValuePredicate(
      table.id, 10, lf.eval.Type.GT);
  assertTrue(p.isKeyRangeCompatible());
  assertEquals('(10, unbound]', p.toKeyRange().toString());

  p = new lf.pred.ValuePredicate(
      table.id, 10, lf.eval.Type.LTE);
  assertTrue(p.isKeyRangeCompatible());
  assertEquals('[unbound, 10]', p.toKeyRange().toString());

  p = new lf.pred.ValuePredicate(
      table.id, 10, lf.eval.Type.LT);
  assertTrue(p.isKeyRangeCompatible());
  assertEquals('[unbound, 10)', p.toKeyRange().toString());

  p = new lf.pred.ValuePredicate(
      table.id, [10, 20], lf.eval.Type.BETWEEN);
  assertTrue(p.isKeyRangeCompatible());
  assertEquals('[10, 20]', p.toKeyRange().toString());

  p.setComplement(true);
  assertEquals(2, p.toKeyRange().length);
  assertEquals('[unbound, 10),(20, unbound]', p.toKeyRange().toString());
}

/**
 * Tests that isKeyRangeCompatible() returns false when the predicate involves
 * 'null' values.
 */
function testIsKeyRangeCompatible_False() {
  var table = schema.getTables()[0];
  var p = new lf.pred.ValuePredicate(
      table.id, null, lf.eval.Type.EQ);
  assertFalse(p.isKeyRangeCompatible());
}

/**
 * Generates sample table rows.
 * @param {number} rowCount The number of rows to be generated.
 * @return {!Array.<!lf.Row>} The generated rows.
 */
function getSampleRows(rowCount) {
  var table = schema.getTables()[0];
  var sampleRows = new Array(rowCount);

  for (var i = 0; i < rowCount; i++) {
    sampleRows[i] = table.createRow({
      'id': 'sampleId' + i.toString(),
      'name': 'sampleName' + i.toString()
    });
  }

  return sampleRows;
}

function testUnboundPredicate() {
  var table = schema.getTables()[0];
  var sampleRow = getSampleRows(1)[0];
  var relation = lf.proc.Relation.fromRows([sampleRow], [table.getName()]);

  var binder = lf.bind(1);
  var p = new lf.pred.ValuePredicate(table.id, binder, lf.eval.Type.EQ);

  // Predicate shall be unbound.
  assertTrue(p.value instanceof lf.Binder);

  // Tests binding.
  p.bind([9999, sampleRow.payload().id]);
  assertEquals(sampleRow.payload().id, p.value);
  assertFalse(p.value instanceof lf.Binder);
  var result = p.eval(relation);
  assertEquals(1, result.entries.length);

  // Tests binding to an invalid array throws error.
  try {
    p.bind([8888]);
  } catch (e) {
    assertEquals(lf.Exception.Type.SYNTAX, e.name);
  }
}

function testUnboundPredicate_Array() {
  var table = schema.getTables()[0];
  var sampleRows = getSampleRows(3);
  var ids = sampleRows.map(function(row) {
    return row.payload().id;
  });
  var relation = lf.proc.Relation.fromRows(sampleRows, [table.getName()]);

  var binder = [lf.bind(0), lf.bind(1), lf.bind(2)];
  var p = new lf.pred.ValuePredicate(table.id, binder, lf.eval.Type.IN);

  // Tests binding.
  p.bind(ids);
  assertEquals(3, p.eval(relation).entries.length);
}

function testCopy_UnboundPredicate() {
  var table = schema.getTables()[0];
  var sampleRow = getSampleRows(1)[0];

  var binder = lf.bind(1);
  var p = new lf.pred.ValuePredicate(table.id, binder, lf.eval.Type.EQ);
  var p2 = p.copy();

  // Both predicates shall be unbound.
  assertTrue(p.value instanceof lf.Binder);
  assertTrue(p2.value instanceof lf.Binder);

  // Copying a bounded predicate shall still make it bounded.
  p.bind([9999, sampleRow.payload().id]);
  var p3 = p.copy();
  assertEquals(sampleRow.payload().id, p3.value);

  // The clone should also be able to bind to a new array.
  var sampleRow2 = getSampleRows(2)[1];
  p3.bind([9999, sampleRow2.payload().id]);
  assertEquals(sampleRow2.payload().id, p3.value);
}

function testCopy_UnboundPredicate_Array() {
  var table = schema.getTables()[0];
  var sampleRows = getSampleRows(6);
  var ids = sampleRows.map(function(row) {
    return row.payload().id;
  });

  var binder = [lf.bind(0), lf.bind(1), lf.bind(2)];
  var p = new lf.pred.ValuePredicate(table.id, binder, lf.eval.Type.IN);
  p.bind(ids);
  var p2 = p.copy();
  assertArrayEquals(ids.slice(0, 3), p2.value);

  // Tests binding.
  p2.bind(ids.slice(3));
  assertArrayEquals(ids.slice(3), p2.value);
}


text:
@interface UIView (AXBadgeView)
/// Badge view.
@property(readonly, nonatomic) AXBadgeView *badgeView;
/// Show badge view with a badge style.
- (void)showBadge:(BOOL)animated;
/// Clear badge.
- (void)clearBadge:(BOOL)animated;
@end


text: takes client id and client_secret and generates access_token and then shows apache jena dashboard .


text:
namespace chromeos {

// FakeBluetoothGattDescriptorClient simulates the behavior of the Bluetooth
// Daemon GATT characteristic descriptor objects and is used in test cases in
// place of a mock and on the Linux desktop.
class CHROMEOS_EXPORT FakeBluetoothGattDescriptorClient
    : public BluetoothGattDescriptorClient {
 public:
  struct Properties : public BluetoothGattDescriptorClient::Properties {
    explicit Properties(const PropertyChangedCallback& callback);
    virtual ~Properties();

    // dbus::PropertySet override
    virtual void Get(dbus::PropertyBase* property,
                     dbus::PropertySet::GetCallback callback) OVERRIDE;
    virtual void GetAll() OVERRIDE;
    virtual void Set(dbus::PropertyBase* property,
                     dbus::PropertySet::SetCallback callback) OVERRIDE;
  };

  FakeBluetoothGattDescriptorClient();
  virtual ~FakeBluetoothGattDescriptorClient();

  // DBusClient override.
  virtual void Init(dbus::Bus* bus) OVERRIDE;

  // BluetoothGattDescriptorClient overrides.
  virtual void AddObserver(Observer* observer) OVERRIDE;
  virtual void RemoveObserver(Observer* observer) OVERRIDE;
  virtual std::vector<dbus::ObjectPath> GetDescriptors() OVERRIDE;
  virtual Properties* GetProperties(const dbus::ObjectPath& object_path)
      OVERRIDE;

 private:
  // TODO(armansito): Add simulated descriptors, once BlueZ's behavior is
  // better defined.

  // List of observers interested in event notifications from us.
  ObserverList<Observer> observers_;

  DISALLOW_COPY_AND_ASSIGN(FakeBluetoothGattDescriptorClient);
};

}  // namespace chromeos

#endif  // CHROMEOS_DBUS_FAKE_BLUETOOTH_GATT_DESCRIPTOR_CLIENT_H_


text:
/**
 * This code may be modified and used for non-commercial
 * purposes as long as attribution is maintained.
 *
 * @author: Isaac Levy
 */

package edu.utexas.cs.netutil;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;

public class OutgoingSock {
	final static byte[] MSG_SEP = "&".getBytes();
	Socket sock;
	OutputStream out;

	protected OutgoingSock(Socket sock) throws IOException {
		this.sock = sock;

		out = sock.getOutputStream();
		sock.shutdownInput();
	}

	/**
	 * Do not use '&' character.  This is a hardcoded separator
	 * @param msg
	 * @throws IOException
	 */
	protected synchronized void sendMsg(String msg) throws IOException {
		out.write(msg.getBytes());
		out.write(MSG_SEP);
		out.flush();
	}

	public synchronized void cleanShutdown() {
		try { out.close(); }
		catch (IOException e) {}

		try {
			sock.shutdownOutput();
			sock.close();
		} catch (IOException e) {}
	}
}


text:
import glob as _glob

import setuptools as _st

import tues as _tues

if __name__ == '__main__':
    _st.setup(
        name='tues',
        version=_tues.__version__,
        url='https://github.com/wontfix-org/tues/',
        license='Apache Software License',
        author='Michael van Bracht',
        author_email='michael@wontfix.org',
        description='Easy remote command execution',
        packages=_st.find_packages(),
        scripts=_glob.glob('scripts/tues*'),
        include_package_data=True,
        platforms='any',
        setup_requires=['setuptools-markdown'],
        long_description_markdown_filename='README.md',
        install_requires=['docopt', 'fabric', 'requests>=2.4'],
        download_url='https://github.com/wontfix-org/tues/tarball/{0}'.format(_tues.__version__),
        classifiers=[
            'Programming Language :: Python',
            'Development Status :: 4 - Beta',
            'Natural Language :: English',
        ],
    )


text:
/*
 * generated by Xtext 2.11.0
 */
package edu.uah.rsesc.aadlsimulator.xtext.ide;

import com.google.inject.Binder;
import com.google.inject.name.Names;
import edu.uah.rsesc.aadlsimulator.xtext.ide.contentassist.antlr.InputConstraintParser;
import edu.uah.rsesc.aadlsimulator.xtext.ide.contentassist.antlr.internal.InternalInputConstraintLexer;
import org.eclipse.xtext.ide.DefaultIdeModule;
import org.eclipse.xtext.ide.LexerIdeBindings;
import org.eclipse.xtext.ide.editor.contentassist.IProposalConflictHelper;
import org.eclipse.xtext.ide.editor.contentassist.antlr.AntlrProposalConflictHelper;
import org.eclipse.xtext.ide.editor.contentassist.antlr.IContentAssistParser;
import org.eclipse.xtext.ide.editor.contentassist.antlr.internal.Lexer;

/**
 * Manual modifications go to {@link InputConstraintIdeModule}.
 */
@SuppressWarnings("all")
public abstract class AbstractInputConstraintIdeModule extends DefaultIdeModule {

	// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
	public void configureContentAssistLexer(Binder binder) {
		binder.bind(Lexer.class)
			.annotatedWith(Names.named(LexerIdeBindings.CONTENT_ASSIST))
			.to(InternalInputConstraintLexer.class);
	}

	// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
	public Class<? extends IContentAssistParser> bindIContentAssistParser() {
		return InputConstraintParser.class;
	}

	// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
	public Class<? extends IProposalConflictHelper> bindIProposalConflictHelper() {
		return AntlrProposalConflictHelper.class;
	}

}