/// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/).
/// It is intended to be used with #include "json/json-forwards.h"
/// This header provides forward declaration for all JsonCpp types.

// //////////////////////////////////////////////////////////////////////
// Beginning of content of file: LICENSE
// //////////////////////////////////////////////////////////////////////

/*
The JsonCpp library's source code, including accompanying documentation,
tests and demonstration applications, are licensed under the following
conditions...

The author (Baptiste Lepilleur) explicitly disclaims copyright in all
jurisdictions which recognize such a disclaimer. In such jurisdictions,
this software is released into the Public Domain.

In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is
released under the terms of the MIT License (see below).

In jurisdictions which recognize Public Domain property, the user of this
software may choose to accept it either as 1) Public Domain, 2) under the
conditions of the MIT License (see below), or 3) under the terms of dual
Public Domain/MIT License conditions described here, as they choose.

The MIT License is about as close to Public Domain as a license can get, and is
described in clear, concise terms at:

   http://en.wikipedia.org/wiki/MIT_License

The full text of the MIT License follows:

========================================================================
Copyright (c) 2007-2010 Baptiste Lepilleur

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
========================================================================
(END LICENSE TEXT)

The MIT license is compatible with both the GPL and commercial
software, affording one all of the rights of Public Domain with the
minor nuisance of being required to keep the above copyright notice
and license text in the source code. Note also that by accepting the
Public Domain "license" you can re-license your copy using whatever
license you like.

*/

// //////////////////////////////////////////////////////////////////////
// End of content of file: LICENSE
// //////////////////////////////////////////////////////////////////////

#ifndef JSON_FORWARD_AMALGATED_H_INCLUDED
# define JSON_FORWARD_AMALGATED_H_INCLUDED
/// If defined, indicates that the source file is amalgated
/// to prevent private header inclusion.
#define JSON_IS_AMALGAMATION

// //////////////////////////////////////////////////////////////////////
// Beginning of content of file: include/json/config.h
// //////////////////////////////////////////////////////////////////////

// Copyright 2007-2010 Baptiste Lepilleur
// Distributed under MIT license, or public domain if desired and
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE

#ifndef JSON_CONFIG_H_INCLUDED
#define JSON_CONFIG_H_INCLUDED

/// If defined, indicates that json library is embedded in CppTL library.
//# define JSON_IN_CPPTL 1

/// If defined, indicates that json may leverage CppTL library
//#  define JSON_USE_CPPTL 1
/// If defined, indicates that cpptl vector based map should be used instead of
/// std::map
/// as Value container.
//#  define JSON_USE_CPPTL_SMALLMAP 1

// If non-zero, the library uses exceptions to report bad input instead of C
// assertion macros. The default is to use exceptions.
#ifndef JSON_USE_EXCEPTION
#define JSON_USE_EXCEPTION 1
#endif

/// If defined, indicates that the source file is amalgated
/// to prevent private header inclusion.
/// Remarks: it is automatically defined in the generated amalgated header.
// #define JSON_IS_AMALGAMATION

#ifdef JSON_IN_CPPTL
#include <cpptl/config.h>
#ifndef JSON_USE_CPPTL
#define JSON_USE_CPPTL 1
#endif
#endif

#ifdef JSON_IN_CPPTL
#define JSON_API CPPTL_API
#elif defined(JSON_DLL_BUILD)
#if defined(_MSC_VER)
#define JSON_API __declspec(dllexport)
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
#endif // if defined(_MSC_VER)
#elif defined(JSON_DLL)
#if defined(_MSC_VER)
#define JSON_API __declspec(dllimport)
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
#endif // if defined(_MSC_VER)
#endif // ifdef JSON_IN_CPPTL
#if !defined(JSON_API)
#define JSON_API
#endif

// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
// integer
// Storages, and 64 bits integer support is disabled.
// #define JSON_NO_INT64 1

#if defined(_MSC_VER) // MSVC
#  if _MSC_VER <= 1200 // MSVC 6
    // Microsoft Visual Studio 6 only support conversion from __int64 to double
    // (no conversion from unsigned __int64).
#    define JSON_USE_INT64_DOUBLE_CONVERSION 1
    // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
    // characters in the debug information)
    // All projects I've ever seen with VS6 were using this globally (not bothering
    // with pragma push/pop).
#    pragma warning(disable : 4786)
#  endif // MSVC 6

#  if _MSC_VER >= 1500 // MSVC 2008
    /// Indicates that the following function is deprecated.
#    define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
#  endif

#endif // defined(_MSC_VER)

#ifndef JSON_HAS_RVALUE_REFERENCES

#if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010
#define JSON_HAS_RVALUE_REFERENCES 1
#endif // MSVC >= 2010

#ifdef __clang__
#if __has_feature(cxx_rvalue_references)
#define JSON_HAS_RVALUE_REFERENCES 1
#endif  // has_feature

#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
#define JSON_HAS_RVALUE_REFERENCES 1
#endif  // GXX_EXPERIMENTAL

#endif // __clang__ || __GNUC__

#endif // not defined JSON_HAS_RVALUE_REFERENCES

#ifndef JSON_HAS_RVALUE_REFERENCES
#define JSON_HAS_RVALUE_REFERENCES 0
#endif

#ifdef __clang__
#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
#  if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
#    define JSONCPP_DEPRECATED(message)  __attribute__ ((deprecated(message)))
#  elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
#    define JSONCPP_DEPRECATED(message)  __attribute__((__deprecated__))
#  endif  // GNUC version
#endif // __clang__ || __GNUC__

#if !defined(JSONCPP_DEPRECATED)
#define JSONCPP_DEPRECATED(message)
#endif // if !defined(JSONCPP_DEPRECATED)

namespace Json {
typedef int Int;
typedef unsigned int UInt;
#if defined(JSON_NO_INT64)
typedef int LargestInt;
typedef unsigned int LargestUInt;
#undef JSON_HAS_INT64
#else                 // if defined(JSON_NO_INT64)
// For Microsoft Visual use specific types as long long is not supported
#if defined(_MSC_VER) // Microsoft Visual Studio
typedef __int64 Int64;
typedef unsigned __int64 UInt64;
#else                 // if defined(_MSC_VER) // Other platforms, use long long
typedef long long int Int64;
typedef unsigned long long int UInt64;
#endif // if defined(_MSC_VER)
typedef Int64 LargestInt;
typedef UInt64 LargestUInt;
#define JSON_HAS_INT64
#endif // if defined(JSON_NO_INT64)
} // end namespace Json

#endif // JSON_CONFIG_H_INCLUDED

// //////////////////////////////////////////////////////////////////////
// End of content of file: include/json/config.h
// //////////////////////////////////////////////////////////////////////

// //////////////////////////////////////////////////////////////////////
// Beginning of content of file: include/json/forwards.h
// //////////////////////////////////////////////////////////////////////

// Copyright 2007-2010 Baptiste Lepilleur
// Distributed under MIT license, or public domain if desired and
// recognized in your jurisdiction.
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE

#ifndef JSON_FORWARDS_H_INCLUDED
#define JSON_FORWARDS_H_INCLUDED

#if !defined(JSON_IS_AMALGAMATION)
#include "config.h"
#endif // if !defined(JSON_IS_AMALGAMATION)

namespace Json {

// writer.h
class FastWriter;
class StyledWriter;

// reader.h
class Reader;

// features.h
class Features;

// value.h
typedef unsigned int ArrayIndex;
class StaticString;
class Path;
class PathArgument;
class Value;
class ValueIteratorBase;
class ValueIterator;
class ValueConstIterator;

} // namespace Json

#endif // JSON_FORWARDS_H_INCLUDED

// //////////////////////////////////////////////////////////////////////
// End of content of file: include/json/forwards.h
// //////////////////////////////////////////////////////////////////////

#endif //ifndef JSON_FORWARD_AMALGATED_H_INCLUDED

{'repo_name': 'ValveSoftware/Proton', 'stars': '11533', 'repo_language': 'C++', 'file_name': 'binutils-0001.patch', 'mime_type': 'text/x-diff', 'hash': -8092174594394433997, 'source_dataset': 'data'}


<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    Mage
 * @package     Mage_Sales
 * @copyright  Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */

/**
 * Recurring payment profiles resource model
 *
 * @category    Mage
 * @package     Mage_Sales
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class Mage_Sales_Model_Mysql4_Recurring_Profile extends Mage_Sales_Model_Resource_Recurring_Profile
{
}

{'repo_name': 'OpenMage/magento-mirror', 'stars': '617', 'repo_language': 'PHP', 'file_name': 'editor_plugin_src.js', 'mime_type': 'text/plain', 'hash': -2946208651233134872, 'source_dataset': 'data'}


// tslint:disable:max-classes-per-file
import { ServiceBus } from './service-bus'
import { MemoryQueue } from '../transport'
import { BusState } from './bus'
import { TestEvent } from '../test/test-event'
import { TestEvent2 } from '../test/test-event-2'
import { TestCommand } from '../test/test-command'
import { sleep } from '../util'
import { Container, inject } from 'inversify'
import { TestContainer } from '../test/test-container'
import { BUS_SYMBOLS } from '../bus-symbols'
import { Logger } from '@node-ts/logger-core'
import { Mock, IMock, Times } from 'typemoq'
import { HandlesMessage } from '../handler'
import { ApplicationBootstrap } from '../application-bootstrap'
import { MessageAttributes } from '@node-ts/bus-messages'
import { BusConfiguration } from './bus-configuration'

const event = new TestEvent()
type Callback = () => void
const CALLBACK = Symbol.for('Callback')
const LONG_PERIOD_MS = 3000

@HandlesMessage(TestEvent)
class TestEventHandler {
  constructor (
    @inject(CALLBACK) private readonly callback: Callback
  ) {
  }

  async handle (_: TestEvent): Promise<void> {
    this.callback()
  }
}

@HandlesMessage(TestEvent2)
class TestEvent2Handler {
  constructor (
    @inject(CALLBACK) private readonly callback: Callback
  ) {
  }

  async handle (_: TestEvent2): Promise<void> {
    await sleep(LONG_PERIOD_MS)
    this.callback()
  }
}

describe('ServiceBus', () => {
  describe('for a single concurrency bus', () => {
    let container: Container

    let sut: ServiceBus
    let bootstrapper: ApplicationBootstrap
    let queue: MemoryQueue

    let callback: IMock<Callback>

    beforeAll(async () => {
      container = new TestContainer().silenceLogs()
      queue = new MemoryQueue(
        Mock.ofType<Logger>().object,
        container.get(BUS_SYMBOLS.HandlerRegistry)
      )

      bootstrapper = container.get<ApplicationBootstrap>(BUS_SYMBOLS.ApplicationBootstrap)
      bootstrapper.registerHandler(TestEventHandler)

      callback = Mock.ofType<Callback>()
      container.bind(CALLBACK).toConstantValue(callback.object)
      await bootstrapper.initialize(container)
      sut = container.get(BUS_SYMBOLS.Bus)
    })

    afterAll(async () => {
      await bootstrapper.dispose()
    })

    describe('when registering a send hook', () => {
      const sendCallback = jest.fn()
      const command = new TestCommand()

      beforeAll(async () => {
        sut.on('send', sendCallback)
        await sut.send(command)
        sut.off('send', sendCallback)
        await sut.send(command)
      })

      it('should trigger the hook once when send() is called', async () => {
        expect(sendCallback).toHaveBeenCalledWith(command, expect.any(MessageAttributes))
      })

      it('should only trigger the callback once before its removed', () => {
        expect(sendCallback).toHaveBeenCalledTimes(1)
      })
    })

    describe('when registering a publish hook', () => {
      const publishCallback = jest.fn()
      const evt = new TestEvent2()

      beforeAll(async () => {
        sut.on('publish', publishCallback)
        await sut.publish(evt)
        sut.off('publish', publishCallback)
        await sut.publish(evt)
      })

      it('should trigger the hook once when publish() is called', async () => {
        expect(publishCallback).toHaveBeenCalledWith(evt, expect.any(MessageAttributes))
      })

      it('should only trigger the callback once before its removed', () => {
        expect(publishCallback).toHaveBeenCalledTimes(1)
      })
    })

    describe('when starting the service bus', () => {
      it('should complete into a started state', () => {
        expect(sut.state).toEqual(BusState.Started)
      })

      describe('and then the bus is started again', () => {
        it('should throw an error', async () => {
          await expect(sut.start()).rejects.toThrowError()
        })
      })
    })

    describe('when a message is successfully handled from the queue', () => {
      it('should delete the message from the queue', async () => {
        callback.reset()
        callback
          .setup(c => c())
          .callback(() => undefined)
          .verifiable(Times.once())
        await sut.publish(event)
        await sleep(10)

        expect(queue.depth).toEqual(0)
        callback.verifyAll()
      })
    })

    describe('and a handled message throw an Error', () => {
      // Set up the callback to fail during first call and pass for the subsequent calls
      const setupErroneousCallback = () => {
        callback.reset()
        let callCount = 0
        callback
          .setup(c => c())
          .callback(() => {
            if (callCount++ === 0) {
              throw new Error()
            }
          })
          .verifiable(Times.exactly(2))
      }

      it('should return the message for retry', async () => {
        setupErroneousCallback()

        await sut.publish(event)
        await sleep(2000)

        callback.verifyAll()
      })

      it('should trigger error hook if registered', async () => {
        const errorCallback = jest.fn()
        setupErroneousCallback()

        sut.on('error', errorCallback)
        await sut.publish(event)
        await sleep(2000)

        callback.verifyAll()

        expect(errorCallback).toHaveBeenCalledTimes(1)
        expect(errorCallback).toHaveBeenCalledWith(
          event,
          expect.any(Error),
          /*
           We can't use expect.any() here because
            messageAttributes wasn't deserialized during transport.
           */
          expect.objectContaining({
            correlationId: undefined,
            attributes: expect.anything(),
            stickyAttributes: expect.anything()
          })
        )
        sut.off('error', errorCallback)
      })
    })
  })

  describe('when running with concurrency greater than 1', () => {
    const concurrency = 3
    const slowEvent = new TestEvent2()
    let container: Container

    let sut: ServiceBus
    let bootstrapper: ApplicationBootstrap

    let callback: IMock<Callback>

    beforeAll(async () => {
      container = new TestContainer().silenceLogs()

      container
        .rebind<BusConfiguration>(BUS_SYMBOLS.BusConfiguration)
        .toConstantValue({ concurrency })

      bootstrapper = container.get<ApplicationBootstrap>(BUS_SYMBOLS.ApplicationBootstrap)
      bootstrapper.registerHandler(TestEvent2Handler)

      callback = Mock.ofType<Callback>()
      container.bind(CALLBACK).toConstantValue(callback.object)
      await bootstrapper.initialize(container)
      sut = container.get(BUS_SYMBOLS.Bus)
    })

    afterAll(async () => {
      await bootstrapper.dispose()
    })

    describe('when handling multiple messages', () => {
      beforeAll(async () => {
        callback.reset()
        callback
          .setup(c => c())
          .verifiable(Times.exactly(concurrency))

        await Promise.all(new Array(concurrency)
          .fill(slowEvent)
          .map(e => sut.publish(e))
        )

        /*
          Each handle of the message takes 3 seconds to process. With 3 instances
          this will take 9 seconds+ to complete with a concurrency of 1. Given a
          concurrency of 3 we expect all messages to finish processing before the
          test times out.
        */
        const TEST_GRACE_PERIOD = 1000
        await sleep(LONG_PERIOD_MS + TEST_GRACE_PERIOD)
      })

      it('should handle all messages concurrently', async () => {
        callback.verifyAll()
      })

      it('should start the correct number of workers', async () => {
        expect(sut.runningParallelWorkerCount).toEqual(concurrency)
      })
    })
  })
})

{'repo_name': 'node-ts/bus', 'stars': '102', 'repo_language': 'TypeScript', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -4261432721934243592, 'source_dataset': 'data'}


using System;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using LiteNetLib;
using LiteNetLib.Utils;

namespace LibSample
{
    class BroadcastTest
    {
        private class ClientListener : INetEventListener
        {
            public NetManager Client;

            public void OnPeerConnected(NetPeer peer)
            {
                Console.WriteLine("[Client {0}] connected to: {1}:{2}", Client.LocalPort, peer.EndPoint.Address, peer.EndPoint.Port);
            }

            public void OnPeerDisconnected(NetPeer peer, DisconnectInfo disconnectInfo)
            {
                Console.WriteLine("[Client] disconnected: " + disconnectInfo.Reason);
            }

            public void OnNetworkError(IPEndPoint endPoint, SocketError error)
            {
                Console.WriteLine("[Client] error! " + error);
            }

            public void OnNetworkReceive(NetPeer peer, NetPacketReader reader, DeliveryMethod deliveryMethod)
            {

            }

            public void OnNetworkReceiveUnconnected(IPEndPoint remoteEndPoint, NetPacketReader reader, UnconnectedMessageType messageType)
            {
                var text = reader.GetString(100);
                Console.WriteLine("[Client] ReceiveUnconnected {0}. From: {1}. Data: {2}", messageType, remoteEndPoint, text);
                if (messageType == UnconnectedMessageType.BasicMessage && text == "SERVER DISCOVERY RESPONSE")
                {
                    Client.Connect(remoteEndPoint, "key");
                }
            }

            public void OnNetworkLatencyUpdate(NetPeer peer, int latency)
            {

            }

            public void OnConnectionRequest(ConnectionRequest request)
            {
                request.Reject();
            }
        }

        private class ServerListener : INetEventListener
        {
            public NetManager Server;

            public void OnPeerConnected(NetPeer peer)
            {
                Console.WriteLine("[Server] Peer connected: " + peer.EndPoint);
                var peers = Server.ConnectedPeerList;
                foreach (var netPeer in peers)
                {
                    Console.WriteLine("ConnectedPeersList: id={0}, ep={1}", netPeer.Id, netPeer.EndPoint);
                }
            }

            public void OnPeerDisconnected(NetPeer peer, DisconnectInfo disconnectInfo)
            {
                Console.WriteLine("[Server] Peer disconnected: " + peer.EndPoint + ", reason: " + disconnectInfo.Reason);
            }

            public void OnNetworkError(IPEndPoint endPoint, SocketError socketErrorCode)
            {
                Console.WriteLine("[Server] error: " + socketErrorCode);
            }

            public void OnNetworkReceive(NetPeer peer, NetPacketReader reader, DeliveryMethod deliveryMethod)
            {

            }

            public void OnNetworkReceiveUnconnected(IPEndPoint remoteEndPoint, NetPacketReader reader, UnconnectedMessageType messageType)
            {
                Console.WriteLine("[Server] ReceiveUnconnected {0}. From: {1}. Data: {2}", messageType, remoteEndPoint, reader.GetString(100));
                NetDataWriter wrtier = new NetDataWriter();
                wrtier.Put("SERVER DISCOVERY RESPONSE");
                Server.SendUnconnectedMessage(wrtier, remoteEndPoint);
            }

            public void OnNetworkLatencyUpdate(NetPeer peer, int latency)
            {

            }

            public void OnConnectionRequest(ConnectionRequest request)
            {
                request.AcceptIfKey("key");
            }
        }

        private ClientListener _clientListener1;
        private ClientListener _clientListener2;
        private ServerListener _serverListener;

        public void Run()
        {
            Console.WriteLine("=== Broadcast Test ===");
            //Server
            _serverListener = new ServerListener();

            NetManager server = new NetManager(_serverListener)
            {
                BroadcastReceiveEnabled = true,
                IPv6Enabled = IPv6Mode.DualMode
            };
            if (!server.Start(9050))
            {
                Console.WriteLine("Server start failed");
                Console.ReadKey();
                return;
            }
            _serverListener.Server = server;

            //Client
            _clientListener1 = new ClientListener();

            NetManager client1 = new NetManager(_clientListener1)
            {
                UnconnectedMessagesEnabled = true,
                SimulateLatency = true,
                SimulationMaxLatency = 1500,
                IPv6Enabled = IPv6Mode.DualMode
            };
            _clientListener1.Client = client1;
            if (!client1.Start())
            {
                Console.WriteLine("Client1 start failed");

                return;
            }

            _clientListener2 = new ClientListener();
            NetManager client2 = new NetManager(_clientListener2)
            {
                UnconnectedMessagesEnabled = true,
                SimulateLatency = true,
                SimulationMaxLatency = 1500,
                IPv6Enabled = IPv6Mode.DualMode
            };

            _clientListener2.Client = client2;
            client2.Start();

            //Send broadcast
            NetDataWriter writer = new NetDataWriter();

            writer.Put("CLIENT 1 DISCOVERY REQUEST");
            client1.SendBroadcast(writer, 9050);
            writer.Reset();

            writer.Put("CLIENT 2 DISCOVERY REQUEST");
            client2.SendBroadcast(writer, 9050);

            while (!Console.KeyAvailable)
            {
                client1.PollEvents();
                client2.PollEvents();
                server.PollEvents();
                Thread.Sleep(15);
            }

            client1.Stop();
            client2.Stop();
            server.Stop();
            Console.ReadKey();
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
    }
}

{'repo_name': 'RevenantX/LiteNetLib', 'stars': '1624', 'repo_language': 'C#', 'file_name': 'NetManagerStack.cs', 'mime_type': 'text/plain', 'hash': 8107033462778767148, 'source_dataset': 'data'}


#import "MPULayoutInterpolator.h"
#import "MPUMarqueeView.h"
#import "MPUMarqueeViewDelegate-Protocol.h"

{'repo_name': 'andrewwiik/Tweaks', 'stars': '101', 'repo_language': 'Objective-C', 'file_name': 'control', 'mime_type': 'text/plain', 'hash': 3522122824697696555, 'source_dataset': 'data'}


"""
This file provides the declaration for ``CAElement`` and the morphisms to
the integers and rationals.

It is included in the .pxd files associated to gluing files, such as
padic_capped_absolute_element.pxd.

AUTHORS:

- David Roe (2012-03-01) -- initial version
"""

#*****************************************************************************
#       Copyright (C) 2012 David Roe <roed.math@gmail.com>
#                          William Stein <wstein@gmail.com>
#
#  Distributed under the terms of the GNU General Public License (GPL)
#  as published by the Free Software Foundation; either version 2 of
#  the License, or (at your option) any later version.
#
#                  http://www.gnu.org/licenses/
#*****************************************************************************

# includes the header for pAdicTemplateElement
include "padic_template_element_header.pxi"

from sage.categories.morphism cimport Morphism
from sage.rings.morphism cimport RingHomomorphism, RingMap

cdef class CAElement(pAdicTemplateElement):
    cdef celement value
    cdef long absprec

    cdef CAElement _new_c(self)

cdef class pAdicCoercion_ZZ_CA(RingHomomorphism):
    cdef CAElement _zero
    cdef RingMap _section
cdef class pAdicConvert_CA_ZZ(RingMap):
    pass
cdef class pAdicConvert_QQ_CA(Morphism):
    cdef CAElement _zero
    cdef RingMap _section
# There should also be a pAdicConvert_CA_QQ for extension rings....
cdef class pAdicCoercion_CA_frac_field(RingHomomorphism):
    cdef CRElement _zero
    cdef Morphism _section
cdef class pAdicConvert_CA_frac_field(Morphism):
    cdef CAElement _zero

{'repo_name': 'sagemath/sage', 'stars': '1249', 'repo_language': 'Python', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': 9141816074170822425, 'source_dataset': 'data'}


<?php

/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Service
 * @subpackage Amazon
 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: OfferSet.php 24780 2012-05-08 19:34:59Z adamlundrigan $
 */

/**
 * @category   Zend
 * @package    Zend_Service
 * @subpackage Amazon
 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Service_Amazon_OfferSet
{
    /**
     * @var string
     */
    public $LowestNewPrice;

    /**
     * @var string
     */
    public $LowestNewPriceCurrency;

    /**
     * @var string
     */
    public $LowestUsedPrice;

    /**
     * @var string
     */
    public $LowestUsedPriceCurrency;

    /**
     * @var int
     */
    public $TotalNew;

    /**
     * @var int
     */
    public $TotalUsed;

    /**
     * @var int
     */
    public $TotalCollectible;

    /**
     * @var int
     */
    public $TotalRefurbished;

    /**
     * @var Zend_Service_Amazon_Offer[]
     */
    public $Offers;

    /**
     * Parse the given Offer Set Element
     *
     * @param  DOMElement $dom
     * @return void
     */
    public function __construct(DOMElement $dom)
    {
        $xpath = new DOMXPath($dom->ownerDocument);
        $xpath->registerNamespace('az', 'http://webservices.amazon.com/AWSECommerceService/2011-08-01');

        $offer = $xpath->query('./az:OfferSummary', $dom);
        if ($offer->length == 1) {
            $lowestNewPrice = $xpath->query('./az:OfferSummary/az:LowestNewPrice/az:Amount', $dom);
            if ($lowestNewPrice->length == 1) {
                $this->LowestNewPrice = (int) $xpath->query('./az:OfferSummary/az:LowestNewPrice/az:Amount/text()', $dom)->item(0)->data;
                $this->LowestNewPriceCurrency = (string) $xpath->query('./az:OfferSummary/az:LowestNewPrice/az:CurrencyCode/text()', $dom)->item(0)->data;
            }
            $lowestUsedPrice = $xpath->query('./az:OfferSummary/az:LowestUsedPrice/az:Amount', $dom);
            if ($lowestUsedPrice->length == 1) {
                $this->LowestUsedPrice = (int) $xpath->query('./az:OfferSummary/az:LowestUsedPrice/az:Amount/text()', $dom)->item(0)->data;
                $this->LowestUsedPriceCurrency = (string) $xpath->query('./az:OfferSummary/az:LowestUsedPrice/az:CurrencyCode/text()', $dom)->item(0)->data;
            }
            $this->TotalNew = (int) $xpath->query('./az:OfferSummary/az:TotalNew/text()', $dom)->item(0)->data;
            $this->TotalUsed = (int) $xpath->query('./az:OfferSummary/az:TotalUsed/text()', $dom)->item(0)->data;
            $this->TotalCollectible = (int) $xpath->query('./az:OfferSummary/az:TotalCollectible/text()', $dom)->item(0)->data;
            $this->TotalRefurbished = (int) $xpath->query('./az:OfferSummary/az:TotalRefurbished/text()', $dom)->item(0)->data;
        }
        $offers = $xpath->query('./az:Offers/az:Offer', $dom);
        if ($offers->length >= 1) {
            /**
             * @see Zend_Service_Amazon_Offer
             */
            require_once 'Zend/Service/Amazon/Offer.php';
            foreach ($offers as $offer) {
                $this->Offers[] = new Zend_Service_Amazon_Offer($offer);
            }
        }
    }
}

{'repo_name': 'mnapoli/phpBeanstalkdAdmin', 'stars': '136', 'repo_language': 'PHP', 'file_name': 'messagebox.js', 'mime_type': 'text/plain', 'hash': -1098185167581666908, 'source_dataset': 'data'}


<?php
/**
 * @link http://www.simpleforum.org/
 * @copyright Copyright (c) 2015 Simple Forum
 * @author Jiandong Yu admin@simpleforum.org
 */

use yii\helpers\Html;

$this->title = '修改链接';
?>

		<?php
			echo Html::a('论坛管理', ['admin/setting/all']), ' / ', Html::a('链接管理', ['index']), ' / 链接修改' ;
		?>

	    <?php echo $this->render('_form', ['model' => $model]) ?>

<?php echo $this->render('@app/views/common/_admin-right'); ?>

{'repo_name': 'yujiandong/simpleforum', 'stars': '243', 'repo_language': 'PHP', 'file_name': 'SmdAsset.php', 'mime_type': 'text/x-php', 'hash': -1074277813573497115, 'source_dataset': 'data'}


package storage_test

import (
	"context"
	"testing"

	"github.com/golang/mock/gomock"
	"github.com/influxdata/influxdb/v2"
	"github.com/influxdata/influxdb/v2/inmem"
	"github.com/influxdata/influxdb/v2/kv"
	"github.com/influxdata/influxdb/v2/kv/migration/all"
	"github.com/influxdata/influxdb/v2/storage"
	"github.com/influxdata/influxdb/v2/storage/mocks"
	"go.uber.org/zap/zaptest"
)

func TestBucketService(t *testing.T) {
	ctrl := gomock.NewController(t)
	defer ctrl.Finish()

	i, err := influxdb.IDFromString("2222222222222222")
	if err != nil {
		panic(err)
	}

	engine := mocks.NewMockEngineSchema(ctrl)

	inmemService := newInMemKVSVC(t)
	service := storage.NewBucketService(inmemService, engine)

	if err := service.DeleteBucket(context.TODO(), *i); err == nil {
		t.Fatal("expected error, got nil")
	}

	org := &influxdb.Organization{Name: "org1"}
	if err := inmemService.CreateOrganization(context.TODO(), org); err != nil {
		panic(err)
	}

	bucket := &influxdb.Bucket{OrgID: org.ID}
	if err := inmemService.CreateBucket(context.TODO(), bucket); err != nil {
		panic(err)
	}

	engine.EXPECT().DeleteBucket(gomock.Any(), org.ID, bucket.ID)

	// Test deleting a bucket calls into the deleter.
	service = storage.NewBucketService(inmemService, engine)

	if err := service.DeleteBucket(context.TODO(), bucket.ID); err != nil {
		t.Fatal(err)
	}
}

func newInMemKVSVC(t *testing.T) *kv.Service {
	t.Helper()

	logger := zaptest.NewLogger(t)
	store := inmem.NewKVStore()
	if err := all.Up(context.Background(), logger, store); err != nil {
		t.Fatal(err)
	}

	return kv.NewService(logger, store)
}

{'repo_name': 'influxdata/influxdb', 'stars': '19205', 'repo_language': 'Go', 'file_name': 'middleware_auth.go', 'mime_type': 'text/plain', 'hash': -8708472215300355337, 'source_dataset': 'data'}


[[constraint]]
  branch = "master"
  name = "github.com/influxdata/kapacitor"

[[constraint]]
  branch = "master"
  name = "github.com/prometheus/client_golang"

[[constraint]]
  branch = "master"
  name = "github.com/prometheus/client_model"

{'repo_name': 'nathanielc/morgoth', 'stars': '275', 'repo_language': 'Go', 'file_name': 'main.go', 'mime_type': 'text/x-c', 'hash': 8259248627671803734, 'source_dataset': 'data'}


import { BaseMsg, Msg, SignMsg } from "../"
import * as crypto from "../../../crypto"
import { AminoPrefix } from "../../tx"

export interface SignedIssueMiniTokenMsg extends SignMsg {
  name: string
  symbol: string
  total_supply: number
  mintable: boolean
  from: string
  token_uri: string | undefined
}

export interface IssueMiniTokenData extends Msg {
  name: string
  symbol: string
  total_supply: number
  mintable: boolean
  from: Buffer
  token_uri: string | undefined
  aminoPrefix: AminoPrefix
}

export class IssueMiniTokenMsg extends BaseMsg {
  private params: SignedIssueMiniTokenMsg

  constructor(params: SignedIssueMiniTokenMsg) {
    super()
    this.params = params
  }

  getSignMsg() {
    const signMsg: SignedIssueMiniTokenMsg = {
      ...this.params,
    }

    return signMsg
  }

  getMsg() {
    const data: IssueMiniTokenData = {
      from: crypto.decodeAddress(this.params.from),
      name: this.params.name,
      symbol: this.params.symbol,
      total_supply: this.params.total_supply,
      mintable: this.params.mintable,
      token_uri: this.params.token_uri,
      aminoPrefix: AminoPrefix.IssueMiniMsg,
    }

    return data
  }

  static defaultMsg() {
    return {
      from: Buffer.from,
      name: "",
      symbol: "",
      total_supply: 0,
      mintable: false,
      token_uri: "",
      aminoPrefix: AminoPrefix.IssueMiniMsg,
    }
  }
}

{'repo_name': 'binance-chain/javascript-sdk', 'stars': '109', 'repo_language': 'TypeScript', 'file_name': 'transfer.json', 'mime_type': 'text/plain', 'hash': 6272307023342454325, 'source_dataset': 'data'}


/*
 * Copyright 2001 Werner Freytag - please read to the LICENSE file
 *
 * Copyright 2002-2015, Stephan Aßmus <superstippi@gmx.de>
 * All rights reserved.
 *
 */

#include "ColorSlider.h"

#include <stdio.h>

#include <Bitmap.h>
#include <ControlLook.h>
#include <LayoutUtils.h>
#include <OS.h>
#include <Window.h>
#include <math.h>

#include "support_ui.h"

#include "rgb_hsv.h"

#define round(x) (int)(x+.5)

enum {
	MSG_UPDATE			= 'Updt',
};

#define MAX_X 255
#define MAX_Y 255

ColorSlider::ColorSlider(SelectedColorMode mode,
	float value1, float value2, orientation dir, border_style border)
	:  BControl("ColorSlider", "", new BMessage(MSG_COLOR_SLIDER),
		B_WILL_DRAW | B_FRAME_EVENTS)
{
	_Init(mode, value1, value2, dir, border);
	FrameResized(Bounds().Width(), Bounds().Height());
}

ColorSlider::ColorSlider(BPoint offsetPoint, SelectedColorMode mode,
	float value1, float value2, orientation dir, border_style border)
	:  BControl(BRect(0.0, 0.0, 35.0, 265.0).OffsetToCopy(offsetPoint),
		"ColorSlider", "", new BMessage(MSG_COLOR_SLIDER),
		B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS)
{
	_Init(mode, value1, value2, dir, border);
	FrameResized(Bounds().Width(), Bounds().Height());
}

ColorSlider::~ColorSlider()
{
	delete fBitmap;
}

BSize
ColorSlider::MinSize()
{
	BSize minSize;
	if (fOrientation == B_VERTICAL)
		minSize = BSize(36, 10 + MAX_Y / 17);
	else
		minSize = BSize(10 + MAX_X / 17, 10);
	return BLayoutUtils::ComposeSize(ExplicitMinSize(), minSize);
}

BSize
ColorSlider::PreferredSize()
{
	return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), MinSize());
}

BSize
ColorSlider::MaxSize()
{
	BSize maxSize;
	if (fOrientation == B_VERTICAL)
		maxSize = BSize(36, 10 + MAX_Y);
	else
		maxSize = BSize(10 + MAX_X, 18);
	return BLayoutUtils::ComposeSize(ExplicitMaxSize(), maxSize);
}

void
ColorSlider::AttachedToWindow()
{
}

status_t
ColorSlider::Invoke(BMessage* message)
{
	if (message == NULL)
		message = Message();

	if (message == NULL)
		return BControl::Invoke(message);

	message->RemoveName("value");
	message->RemoveName("begin");

	switch (fMode) {
		case R_SELECTED:
		case G_SELECTED:
		case B_SELECTED:
			message->AddFloat("value", 1.0 - (float)Value() / 255);
			break;

		case H_SELECTED:
			message->AddFloat("value", (1.0 - (float)Value() / 255) * 6);
			break;

		case S_SELECTED:
		case V_SELECTED:
			message->AddFloat("value", 1.0 - (float)Value() / 255);
			break;
	}

	// some other parts of WonderBrush rely on this.
	// if the flag is present, it triggers generating an undo action
	// fMouseDown is not set yet the first message is sent
	if (!fMouseDown)
		message->AddBool("begin", true);

	return BControl::Invoke(message);
}

void
ColorSlider::Draw(BRect updateRect)
{
	if (fBitmapDirty && fBitmap != NULL) {
		_FillBitmap(fBitmap, fMode, fFixedValue1, fFixedValue2, fOrientation);
		fBitmapDirty = false;
	}

	BRect bounds = _BitmapRect();

	// Frame
	if (fBorderStyle == B_FANCY_BORDER) {
		bounds.InsetBy(-2, -2);
		rgb_color color = LowColor();
		be_control_look->DrawTextControlBorder(this, bounds, updateRect,
			color);
	}

	// Color slider fill
	if (fBitmap != NULL)
		DrawBitmap(fBitmap, bounds.LeftTop());
	else {
		SetHighColor(255, 0, 0);
		FillRect(bounds);
	}

	// Marker background
	if (fOrientation == B_VERTICAL) {
		bounds.InsetBy(-2, -2);
		BRect r = Bounds();
		FillRect(BRect(r.left, r.top, bounds.left - 1, r.bottom),
			B_SOLID_LOW);
		FillRect(BRect(bounds.right + 1, r.top, r.right, r.bottom),
			B_SOLID_LOW);
		FillRect(
			BRect(bounds.left, r.top, bounds.right, bounds.top - 1),
			B_SOLID_LOW);
		FillRect(
			BRect(bounds.left, bounds.bottom + 1, bounds.right, r.bottom),
			B_SOLID_LOW);
	}

	// marker
	if (fOrientation == B_VERTICAL) {
		// draw the triangle markers
		SetHighColor(0, 0, 0);
		BRect r = Bounds();
		float offset = Value() * (r.Height() - 10) / 255.0;
		_DrawTriangle(
			BPoint(r.left, offset),
			BPoint(r.left + 5.0, offset + 5.0),
			BPoint(r.left, offset + 10.0));

		_DrawTriangle(
			BPoint(r.right, offset),
			BPoint(r.right - 5.0, offset + 5.0),
			BPoint(r.right, offset + 10.0));
	} else {
		BRect r = bounds;
		float x = bounds.left - 2 + (255 - Value()) * bounds.Width() / 255.0;
		if (x > r.left) {
			SetHighColor(255, 255, 255);
			StrokeLine(BPoint(x, bounds.top),
				BPoint(x, bounds.bottom));
		}
		if (x + 1 > r.left) {
			SetHighColor(0, 0, 0);
			StrokeLine(BPoint(x + 1, bounds.top),
				BPoint(x + 1, bounds.bottom));
		}
		if (x + 3 < r.right) {
			SetHighColor(0, 0, 0);
			StrokeLine(BPoint(x + 3, bounds.top),
				BPoint(x + 3, bounds.bottom));
		}
		if (x + 4 < r.right) {
			SetHighColor(255, 255, 255);
			StrokeLine(BPoint(x + 4, bounds.top),
				BPoint(x + 4, bounds.bottom));
		}
	}
}

void
ColorSlider::FrameResized(float width, float height)
{
	BRect r = _BitmapRect();
	_AllocBitmap(r.IntegerWidth() + 1, r.IntegerHeight() + 1);
	Invalidate();
}

void
ColorSlider::MouseDown(BPoint where)
{
	SetMouseEventMask(B_POINTER_EVENTS,
		B_SUSPEND_VIEW_FOCUS | B_LOCK_WINDOW_FOCUS);
	_TrackMouse(where);
	fMouseDown = true;
}

void
ColorSlider::MouseUp(BPoint where)
{
	fMouseDown = false;
}

void
ColorSlider::MouseMoved( BPoint where, uint32 code,
	const BMessage* dragMessage)
{
	if (dragMessage != NULL || !fMouseDown)
		return;

	_TrackMouse(where);
}

void
ColorSlider::SetValue(int32 value)
{
	value = max_c(min_c(value, 255), 0);
	if (value != Value()) {
		BControl::SetValue(value);
		Invalidate();
	}
}

void
ColorSlider::SetModeAndValues(SelectedColorMode mode,
							  float value1, float value2)
{
	float R = 0;
	float G = 0;
	float B = 0;
	float h = 0;
	float s = 0;
	float v = 0;

	switch (fMode) {
		case R_SELECTED:
			R = 255 - Value();
			G = round(fFixedValue1 * 255.0);
			B = round(fFixedValue2 * 255.0);
			break;

		case G_SELECTED:
			R = round(fFixedValue1 * 255.0);
			G = 255 - Value();
			B = round(fFixedValue2 * 255.0);
			break;

		case B_SELECTED:
			R = round(fFixedValue1 * 255.0);
			G = round(fFixedValue2 * 255.0);
			B = 255 - Value();
			break;

		case H_SELECTED:
			h = (1.0 - (float)Value()/255.0)*6.0;
			s = fFixedValue1;
			v = fFixedValue2;
			break;

		case S_SELECTED:
			h = fFixedValue1;
			s = 1.0 - (float)Value()/255.0;
			v = fFixedValue2;
			break;

		case V_SELECTED:
			h = fFixedValue1;
			s = fFixedValue2;
			v = 1.0 - (float)Value()/255.0;
			break;
	}

	if ((fMode & (H_SELECTED | S_SELECTED | V_SELECTED)) != 0) {
		HSV_to_RGB(h, s, v, R, G, B);
		R *= 255.0;
		G *= 255.0;
		B *= 255.0;
	}

	rgb_color color = { (uint8)round(R), (uint8)round(G), (uint8)round(B),
		255 };

	fMode = mode;
	SetOtherValues(value1, value2);

	SetMarkerToColor(color);
	_Update();
}

void
ColorSlider::SetOtherValues(float value1, float value2)
{
	fFixedValue1 = value1;
	fFixedValue2 = value2;

	if (fMode != H_SELECTED)
		_Update();
}

void
ColorSlider::GetOtherValues(float* value1, float* value2) const
{
	if (value1 != NULL)
		*value1 = fFixedValue1;

	if (value2 != NULL)
		*value2 = fFixedValue2;
}

void
ColorSlider::SetMarkerToColor(rgb_color color)
{
	float h = 0;
	float s = 0;
	float v = 0;
	if ((fMode & (H_SELECTED | S_SELECTED | V_SELECTED)) != 0) {
		RGB_to_HSV(
			(float)color.red / 255.0,
			(float)color.green / 255.0,
			(float)color.blue / 255.0,
			h, s, v
		);
	}

	switch (fMode) {
		case R_SELECTED:
			SetValue(255 - color.red);
			break;

		case G_SELECTED:
			SetValue(255 - color.green);
			break;

		case B_SELECTED:
			SetValue(255 - color.blue);
			break;

		case H_SELECTED:
			SetValue(255.0 - round(h / 6.0 * 255.0));
			break;

		case S_SELECTED:
			SetValue(255.0 - round(s * 255.0));
			break;

		case V_SELECTED:
			SetValue(255.0 - round(v * 255.0));
			break;
	}
}

// #pragma mark - private

void
ColorSlider::_Init(SelectedColorMode mode, float value1, float value2,
	orientation dir, border_style border)
{
	fMode = mode;
	fFixedValue1 = value1;
	fFixedValue2 = value2;
	fMouseDown = false;
	fBitmap = NULL;
	fBitmapDirty = true;
	fOrientation = dir;
	fBorderStyle = border;

	SetViewColor(B_TRANSPARENT_COLOR);
	SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}

void
ColorSlider::_AllocBitmap(int32 width, int32 height)
{
	if (width < 2 || height < 2)
		return;

	delete fBitmap;
	fBitmap = new BBitmap(BRect(0, 0, width - 1, height - 1), 0, B_RGB32);

	fBitmapDirty = true;
}

void
ColorSlider::_Update()
{
	fBitmapDirty = true;
	Invalidate();
}

BRect
ColorSlider::_BitmapRect() const
{
	BRect r = Bounds();
	if (fOrientation == B_VERTICAL)
		r.InsetBy(7, 3);
	if (fBorderStyle == B_FANCY_BORDER)
		r.InsetBy(2, 2);
	return r;
}

void
ColorSlider::_FillBitmap(BBitmap* bitmap, SelectedColorMode mode,
	float fixedValue1, float fixedValue2, orientation orient) const
{
	int32 width = bitmap->Bounds().IntegerWidth();
	int32 height = bitmap->Bounds().IntegerHeight();
	uint32 bpr = bitmap->BytesPerRow();

	uint8* bits = (uint8*)bitmap->Bits();

	float r = 0;
	float g = 0;
	float b = 0;
	float h;
	float s;
	float v;

	switch (mode) {
		case R_SELECTED:
			g = round(fixedValue1 * 255);
			b = round(fixedValue2 * 255);
			if (orient == B_VERTICAL) {
				for (int y = 0; y <= height; y++) {
					r = 255 - y * 255 / height;
					_DrawColorLineY(bits, width, r, g, b);
					bits += bpr;
				}
			} else {
				for (int x = 0; x <= width; x++) {
					r = x * 255 / width;
					_DrawColorLineX(bits, height, bpr, r, g, b);
					bits += 4;
				}
			}
			break;

		case G_SELECTED:
			r = round(fixedValue1 * 255);
			b = round(fixedValue2 * 255);
			if (orient == B_VERTICAL) {
				for (int y = 0; y <= height; y++) {
					g = 255 - y * 255 / height;
					_DrawColorLineY(bits, width, r, g, b);
					bits += bpr;
				}
			} else {
				for (int x = 0; x <= width; x++) {
					g = 255 - x * 255 / width;
					_DrawColorLineX(bits, height, bpr, r, g, b);
					bits += 4;
				}
			}
			break;

		case B_SELECTED:
			r = round(fixedValue1 * 255);
			g = round(fixedValue2 * 255);
			if (orient == B_VERTICAL) {
				for (int y = 0; y <= height; y++) {
					b = 255 - y * 255 / height;
					_DrawColorLineY(bits, width, r, g, b);
					bits += bpr;
				}
			} else {
				for (int x = 0; x <= width; x++) {
					b = x * 255 / width;
					_DrawColorLineX(bits, height, bpr, r, g, b);
					bits += 4;
				}
			}

		case H_SELECTED:
			s = 1.0;//fixedValue1;
			v = 1.0;//fixedValue2;
			if (orient == B_VERTICAL) {
				for (int y = 0; y <= height; y++) {
					HSV_to_RGB(6.0 - (float)y * 6.0 / height, s, v, r, g, b);
					_DrawColorLineY(bits, width, r * 255, g * 255, b * 255);
					bits += bpr;
				}
			} else {
				for (int x = 0; x <= width; x++) {
					HSV_to_RGB((float)x * 6.0 / width, s, v, r, g, b);
					_DrawColorLineX(bits, height, bpr,
						r * 255, g * 255, b * 255);
					bits += 4;
				}
			}
			break;

		case S_SELECTED:
			h = fixedValue1;
			v = 1.0;//fixedValue2;
			if (orient == B_VERTICAL) {
				for (int y = 0; y <= height; y++) {
					HSV_to_RGB(h, 1.0 - (float)y / height, v, r, g, b);
					_DrawColorLineY(bits, width, r * 255, g * 255, b * 255);
					bits += bpr;
				}
			} else {
				for (int x = 0; x <= width; x++) {
					HSV_to_RGB(h, 1.0 - (float)x / width, v, r, g, b);
					_DrawColorLineX(bits, height, bpr,
						r * 255, g * 255, b * 255);
					bits += 4;
				}
			}
			break;

		case V_SELECTED:
			h = fixedValue1;
			s = 1.0;//fixedValue2;
			if (orient == B_VERTICAL) {
				for (int y = 0; y <= height; y++) {
					HSV_to_RGB(h, s, 1.0 - (float)y / height, r, g, b);
					_DrawColorLineY(bits, width, r * 255, g * 255, b * 255);
					bits += bpr;
				}
			} else {
				for (int x = 0; x <= width; x++) {
					HSV_to_RGB(h, s, (float)x / width, r, g, b);
					_DrawColorLineX(bits, height, bpr,
						r * 255, g * 255, b * 255);
					bits += 4;
				}
			}
			break;
	}
}

void
ColorSlider::_DrawColorLineY(uint8* bits, int width, int r, int g, int b)
{
	for (int x = 0; x <= width; x++) {
		bits[0] = b;
		bits[1] = g;
		bits[2] = r;
		bits[3] = 255;
		bits += 4;
	}
}

void
ColorSlider::_DrawColorLineX(uint8* bits, int height, int bpr,
	int r, int g, int b)
{
	for (int y = 0; y <= height; y++) {
		bits[0] = b;
		bits[1] = g;
		bits[2] = r;
		bits[3] = 255;
		bits += bpr;
	}
}

void
ColorSlider::_DrawTriangle(BPoint point1, BPoint point2, BPoint point3)
{
	StrokeLine(point1, point2);
	StrokeLine(point3);
	StrokeLine(point1);
}

void
ColorSlider::_TrackMouse(BPoint where)
{
	BRect b(_BitmapRect());

	if (fOrientation == B_VERTICAL)
		SetValue((int)(((where.y - b.top) / b.Height()) * 255.0));
	else
		SetValue(255 - (int)(((where.x - b.left) / b.Width()) * 255.0));

	Invoke();
}

{'repo_name': 'haiku/haiku', 'stars': '971', 'repo_language': 'C++', 'file_name': 'bootstrap', 'mime_type': 'text/plain', 'hash': -1405718085526755862, 'source_dataset': 'data'}


<?php

declare(strict_types=1);

namespace atk4\ui\TableColumn\FilterModel;

if (!class_exists(\SebastianBergmann\CodeCoverage\CodeCoverage::class, false)) {
    'trigger_error'('Class atk4\ui\TableColumn\FilterModel\TypeDatetime is deprecated. Use atk4\ui\Table\Column\FilterModel\TypeDatetime instead', E_USER_DEPRECATED);
}

/**
 * @deprecated will be removed dec-2020
 */
class TypeDatetime extends \atk4\ui\Table\Column\FilterModel\TypeDatetime
{
}

{'repo_name': 'atk4/ui', 'stars': '304', 'repo_language': 'PHP', 'file_name': 'ui-build-deploy.yaml', 'mime_type': 'text/plain', 'hash': -388217711005772307, 'source_dataset': 'data'}


<?php

namespace Ornicar\GravatarBundle\Twig;

use Ornicar\GravatarBundle\Templating\Helper\GravatarHelperInterface;

/**
 * @author Thibault Duplessis
 * @author Henrik Bjornskov   <hb@peytz.dk>
 */
class GravatarExtension extends \Twig_Extension implements GravatarHelperInterface
{
    /**
     * @var GravatarHelperInterface
     */
    protected $baseHelper;

    /**
     * @param GravatarHelperInterface $helper
     */
    public function __construct(GravatarHelperInterface $helper)
    {
        $this->baseHelper = $helper;
    }

    public function getFunctions()
    {
        return array(
            new \Twig_SimpleFunction('gravatar', array($this, 'getUrl')),
            new \Twig_SimpleFunction('gravatar_hash', array($this, 'getUrlForHash')),
            new \Twig_SimpleFunction('gravatar_profile', array($this, 'getProfileUrl')),
            new \Twig_SimpleFunction('gravatar_profile_hash', array($this, 'getProfileUrlForHash')),
            new \Twig_SimpleFunction('gravatar_exists', array($this, 'exists')),
        );
    }

    /**
     * {@inheritdoc}
     */
    public function getUrl($email, $size = null, $rating = null, $default = null, $secure = true)
    {
        return $this->baseHelper->getUrl($email, $size, $rating, $default, $secure);
    }

    /**
     * {@inheritdoc}
     */
    public function getUrlForHash($hash, $size = null, $rating = null, $default = null, $secure = true)
    {
        return $this->baseHelper->getUrlForHash($hash, $size, $rating, $default, $secure);
    }

    /**
     * {@inheritdoc}
     */
    public function getProfileUrl($email, $secure = true)
    {
        return $this->baseHelper->getProfileUrl($email, $secure);
    }

    /**
     * {@inheritdoc}
     */
    public function getProfileUrlForHash($hash, $secure = true)
    {
        return $this->baseHelper->getProfileUrlForHash($hash, $secure);
    }

    /**
     * {@inheritdoc}
     */
    public function exists($email)
    {
        return $this->baseHelper->exists($email);
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'ornicar_gravatar';
    }
}

{'repo_name': 'henrikbjorn/GravatarBundle', 'stars': '132', 'repo_language': 'PHP', 'file_name': 'GravatarExtensionTest.php', 'mime_type': 'text/x-php', 'hash': -629194628796892337, 'source_dataset': 'data'}


# scarpet-nn
Tools and libraries to run neural networks in Minecraft :pick:

scarpet-nn allows you to run neural networks (specifically binarized neural networks) in your Minecraft world. This could be useful for benchmarking neural network performance in research scenarios. If you are a Minecraft map designer, you can use scarpet-nn to perform specific/hidden actions based on what user draws on a wall or the input area of your choice.

Read the full documentation [here](https://ashutoshbsathe.github.io/scarpet-nn)

## License
[GNU General Public License v3](LICENSE)

{'repo_name': 'ashutoshbsathe/scarpet-nn', 'stars': '127', 'repo_language': 'Python', 'file_name': 'mnist2classdataloader.py', 'mime_type': 'text/x-python', 'hash': -3154252692464001307, 'source_dataset': 'data'}


{'repo_name': 'symplify/monorepo-builder', 'stars': '156', 'repo_language': 'PHP', 'file_name': 'box.json', 'mime_type': 'text/plain', 'hash': 1649733907133191789, 'source_dataset': 'data'}


/*
 *  Original work: Copyright (c) 2014, Oculus VR, Inc.
 *  All rights reserved.
 *
 *  This source code is licensed under the BSD-style license found in the
 *  RakNet License.txt file in the licenses directory of this source tree. An additional grant
 *  of patent rights can be found in the RakNet Patents.txt file in the same directory.
 *
 *
 *  Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
 *
 *  This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
 *  license found in the license.txt file in the root directory of this source tree.
 */

#include "defines.h"

#if defined(_WIN32) && !(defined(__GNUC__)  || defined(__GCCXML__)) && !defined(_RAKNET_LIB) && defined(_RAKNET_DLL)
#define RAK_DLL_EXPORT __declspec(dllexport)
#else
#define RAK_DLL_EXPORT
#endif

#define STATIC_FACTORY_DECLARATIONS(x) static x* GetInstance(void); \
static void DestroyInstance( x *i);

#define STATIC_FACTORY_DEFINITIONS(x,y) x* x::GetInstance(void) {return SLNet::OP_NEW<y>( _FILE_AND_LINE_ );} \
void x::DestroyInstance( x *i) {SLNet::OP_DELETE(( y* ) i, _FILE_AND_LINE_);}

{'repo_name': 'rokups/rbfx', 'stars': '268', 'repo_language': 'C++', 'file_name': 'footer.html', 'mime_type': 'text/plain', 'hash': 7147307004193256220, 'source_dataset': 'data'}