text:
// Package generic contains the shared Client code of the Minion and Master Client.
package generic

import (
	"bytes"
	"encoding/json"
	"errors"
	"io/ioutil"
	"net/http"
	"net/url"

	"github.com/wikiwi/kube-volume-freezer/pkg/api"
)

const (
	mediaType = "application/json"
)

// Client implements a generic basic client for consuming the projects REST API.
type Client struct {
	// Client is the native HTTP client all requests get delegated to.
	Client *http.Client

	// BaseURL is the base URL for relative paths.
	BaseURL *url.URL

	// Headers that are set on each request.
	Headers map[string]string
}

// NewRequest creates an API Request to urlStr which can be a relative string.
// If supplied the body will be included and encoded to JSON.
func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {
	rel, err := url.Parse(urlStr)
	if err != nil {
		return nil, err
	}

	u := c.BaseURL.ResolveReference(rel)

	buf := new(bytes.Buffer)
	if body != nil {
		err := json.NewEncoder(buf).Encode(body)
		if err != nil {
			return nil, err
		}
	}

	req, err := http.NewRequest(method, u.String(), buf)
	if err != nil {
		return nil, err
	}

	req.Header.Add("Content-Type", mediaType)
	req.Header.Add("Accept", mediaType)
	for k, v := range c.Headers {
		req.Header.Set(k, v)
	}
	return req, nil
}

// NewRequestOrDie is the same as NewRequest but panics on error.
func (c *Client) NewRequestOrDie(method, urlStr string, body interface{}) *http.Request {
	req, err := c.NewRequest(method, urlStr, body)
	if err != nil {
		panic(err)
	}
	return req
}

// Do sends an API request and returns the API response. If decodeTo is set, the response body will
// be decoded (expects JSON) into the variable. This method automatically parses an API error and
// returns the error.
func (c *Client) Do(req *http.Request, decodeTo interface{}) (*http.Response, error) {
	resp, err := c.Client.Do(req)
	if err != nil {
		return nil, err
	}

	defer func() {
		if rerr := resp.Body.Close(); err == nil {
			err = rerr
		}
	}()

	err = CheckResponse(resp)
	if err != nil {
		return resp, err
	}

	if decodeTo != nil {
		err := json.NewDecoder(resp.Body).Decode(decodeTo)
		if err != nil {
			return nil, err
		}
	}

	return resp, err
}

// CheckResponse checks the response for an API error and returns it.
func CheckResponse(r *http.Response) error {
	if c := r.StatusCode; c >= 200 && c <= 299 {
		return nil
	}

	var apiError api.Error
	data, err := ioutil.ReadAll(r.Body)
	if err == nil && len(data) > 0 {
		err := json.Unmarshal(data, &apiError)
		if err != nil {
			return errors.New(string(data))
		}
	}

	return &apiError
}

// New returns a new Client.
func New(address string, httpClient *http.Client) (*Client, error) {
	if httpClient == nil {
		httpClient = http.DefaultClient
	}

	parsed, err := url.Parse(address)
	if err != nil {
		return nil, err
	}
	c := &Client{Client: httpClient, BaseURL: parsed, Headers: map[string]string{}}
	return c, nil
}

// NewOrDie is the same as New but panics on error.
func NewOrDie(address string, httpClient *http.Client) *Client {
	c, err := New(address, httpClient)
	if err != nil {
		panic(err)
	}
	return c
}


text:
#ifndef STK_ASYMP_H
#define STK_ASYMP_H

#include "Generator.h"

namespace stk {

/***************************************************/
/*! class Asymp
    \brief STK asymptotic curve envelope class

    This class implements a simple envelope generator
    which asymptotically approaches a target value.
    The algorithm used is of the form:

    y[n] = a y[n-1] + (1-a) target,

    where a = exp(-T/tau), T is the sample period, and
    tau is a time constant.  The user can set the time
    constant (default value = 0.3) and target value.
    Theoretically, this recursion never reaches its
    target, though the calculations in this class are
    stopped when the current value gets within a small
    threshold value of the target (at which time the
    current value is set to the target).  It responds
    to \e keyOn and \e keyOff messages by ramping to
    1.0 on keyOn and to 0.0 on keyOff.

    by Perry R. Cook and Gary P. Scavone, 1995--2016.
*/
/***************************************************/

const StkFloat TARGET_THRESHOLD = 0.000001;

class Asymp : public Generator {
public:
  //! Default constructor.
  Asymp(void);

  //! Class destructor.
  ~Asymp(void);

  //! Set target = 1.
  void keyOn(void);

  //! Set target = 0.
  void keyOff(void);

  //! Set the asymptotic rate via the time factor \e tau (must be > 0).
  /*!
    The rate is computed as described above.  The value of \e tau
    must be greater than zero.  Values of \e tau close to zero produce
    fast approach rates, while values greater than 1.0 produce rather
    slow rates.
  */
  void setTau(StkFloat tau);

  //! Set the asymptotic rate based on a time duration (must be > 0).
  void setTime(StkFloat time);

  //! Set the asymptotic rate such that the target value is perceptually reached
  //! (to within -60dB of the target) in \e t60 seconds.
  void setT60(StkFloat t60);

  //! Set the target value.
  void setTarget(StkFloat target);

  //! Set current and target values to \e value.
  void setValue(StkFloat value);

  //! Return the current envelope \e state (0 = at target, 1 otherwise).
  int getState(void) const { return state_; };

  //! Return the last computed output value.
  StkFloat lastOut(void) const { return lastFrame_[0]; };

  //! Compute and return one output sample.
  StkFloat tick(void);

  //! Fill a channel of the StkFrames object with computed outputs.
  /*!
    The \c channel argument must be less than the number of
    channels in the StkFrames argument (the first channel is specified
    by 0).  However, range checking is only performed if _STK_DEBUG_
    is defined during compilation, in which case an out-of-range value
    will trigger an StkError exception.
  */
  StkFrames &tick(StkFrames &frames, unsigned int channel = 0);

protected:
  void sampleRateChanged(StkFloat newRate, StkFloat oldRate);

  StkFloat value_;
  StkFloat target_;
  StkFloat factor_;
  StkFloat constant_;
  int state_;
};

inline StkFloat Asymp ::tick(void) {
  if (state_) {

    value_ = factor_ * value_ + constant_;

    // Check threshold.
    if (target_ > value_) {
      if (target_ - value_ <= TARGET_THRESHOLD) {
        value_ = target_;
        state_ = 0;
      }
    } else {
      if (value_ - target_ <= TARGET_THRESHOLD) {
        value_ = target_;
        state_ = 0;
      }
    }
    lastFrame_[0] = value_;
  }

  return value_;
}

inline StkFrames &Asymp ::tick(StkFrames &frames, unsigned int channel) {
#if defined(_STK_DEBUG_)
  if (channel >= frames.channels()) {
    oStream_
        << "Asymp::tick(): channel and StkFrames arguments are incompatible!";
    handleError(StkError::FUNCTION_ARGUMENT);
  }
#endif

  StkFloat *samples = &frames[channel];
  unsigned int hop = frames.channels();
  for (unsigned int i = 0; i < frames.frames(); i++, samples += hop)
    *samples = Asymp::tick();

  return frames;
}

} // namespace stk

#endif

redpajama_set_name: RedPajamaGithub


text:
class TrayIcon
{
	HWND _hWnd;
	HINSTANCE _hInstance;
public:
	TrayIcon(HINSTANCE hInstance, HWND hWnd);
	~TrayIcon();
	void Show();
	void Hide();
};


text:
	<title>Mario Cantone's panel show appearances</title>

	<link rel="stylesheet" media="all" href="../style.css" type="text/css"/>

Mario Cantone's panel show appearances

Mario Cantone (born 1959-12-09[ref]) has appeared in 2 episodes between 2008-2008.  Mario Cantone on IMDB. Mario Cantone on Wikipedia.

2008

2008-05-13 / Loose Women

2008-05-12 / Loose Women


text:
from .models import ec2_backends
from ..core.models import base_decorator

mock_ec2 = base_decorator(ec2_backends)


text:
sort-by [![travis ci](https://travis-ci.org/kvnneff/sort-by.svg)](https://travis-ci.org/kvnneff/sort-by)
=====================

A utility to create comparator functions for the native `Array.sort()` in both node and the browser.  Allows for sorting by multiple properties.

Inspired by [this StackOverflow answer][1].

----------

Example
---------

    var sortBy = require('sort-by'),
        users = [];

    users = [{
        id: 7,
        name: 'Foo',
        age: '34',
        email: { primary: 'foo@email.com' }
    }, {
        id: 3,
        name: 'Baz',
        age: '67',
        email: { primary: 'baz@email.com' }
    }, {
        id: 4,
        name: 'Bar',
        age: '67',
        email: { primary: 'bar@email.com' }
    }];

    users.sort(sortBy('name', 'age'));

    /**
    *   result:
    *       [{id: 4, name: 'Bar', age: '67', email: { primary: 'bar@email.com' }},
    *       {id: 3, name: 'Baz', age: '67', email: { primary: 'baz@email.com' }},
    *       {id: 7, name: 'Foo', age: '34', email: { primary: 'foo@email.com' }}]
    */

    /**
    * Use `-` to reverse the sort order
    */

    users.sort(sortBy('-id', 'name'));

    /*
    *   result:
    *       [{id: 7, name: 'Foo', age: '34', email: { primary: 'foo@email.com' }},
    *       {id: 4, name: 'Bar', age: '67', email: { primary: 'bar@email.com' }},
    *       {id: 3, name: 'Baz', age: '67', email: { primary: 'baz@email.com' }}]
    */

    /**
    * Use `.` notation to traverse nested properties. See [object-path](https://www.npmjs.org/package/object-path) npm module for support.
    */

    users.sort(sortBy('age', 'email.primary'));

    /*
    *   result:
    *       [{id: 7, name: 'Foo', age: '34', email: { primary: 'foo@email.com' }},
    *       {id: 4, name: 'Bar', age: '67', email: { primary: 'bar@email.com' }},
    *       {id: 3, name: 'Baz', age: '67', email: { primary: 'baz@email.com' }}]
    */

Test in node
---
    git clone https://github.com/staygrimm/sort-by.git
    cd sort-by && make test-node

Test in the browser
---
    git clone https://github.com/staygrimm/sort-by.git
    cd sort-by && make test

License
---
(The MIT License)

Copyright (c) 2013 Kevin Neff kvnneff@gmail.com

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.

  [1]: http://stackoverflow.com/a/4760279


text:
describe "Oxford American Writer's Thesaurus" do

  Dir.glob(
    File.join(
      File.dirname(__FILE__), "oxford_american_writers_thesaurus", "*.txt"
    )
  ).each do |path|

    term = File.basename(path).split(".").first
    it "look up term '#{term}'" do
      actual   = `bin/dictionary "#{term}"`
      expected = File.read(path)
      expect(actual).to eql(expected)
    end

  end
end


text:
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/types.h>
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/ioport.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/moduleparam.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/uaccess.h>

static struct platform_device *ibwdt_platform_device;
static unsigned long ibwdt_is_open;
static DEFINE_SPINLOCK(ibwdt_lock);
static char expect_close;

/* Module information */
#define DRV_NAME "ib700wdt"

/*
 *
 * Watchdog Timer Configuration
 *
 * The function of the watchdog timer is to reset the system
 * automatically and is defined at I/O port 0443H.  To enable the
 * watchdog timer and allow the system to reset, write I/O port 0443H.
 * To disable the timer, write I/O port 0441H for the system to stop the
 * watchdog function.  The timer has a tolerance of 20% for its
 * intervals.
 *
 * The following describes how the timer should be programmed.
 *
 * Enabling Watchdog:
 * MOV AX,000FH (Choose the values from 0 to F)
 * MOV DX,0443H
 * OUT DX,AX
 *
 * Disabling Watchdog:
 * MOV AX,000FH (Any value is fine.)
 * MOV DX,0441H
 * OUT DX,AX
 *
 * Watchdog timer control table:
 * Level   Value  Time/sec | Level Value Time/sec
 *   1       F       0     |   9     7      16
 *   2       E       2     |   10    6      18
 *   3       D       4     |   11    5      20
 *   4       C       6     |   12    4      22
 *   5       B       8     |   13    3      24
 *   6       A       10    |   14    2      26
 *   7       9       12    |   15    1      28
 *   8       8       14    |   16    0      30
 *
 */

#define WDT_STOP 0x441
#define WDT_START 0x443

/* Default timeout */
#define WATCHDOG_TIMEOUT 30		/* 30 seconds +/- 20% */
static int timeout = WATCHDOG_TIMEOUT;	/* in seconds */
module_param(timeout, int, 0);
MODULE_PARM_DESC(timeout,
	"Watchdog timeout in seconds. 0<= timeout <=30, default="
		__MODULE_STRING(WATCHDOG_TIMEOUT) ".");

static bool nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0);
MODULE_PARM_DESC(nowayout,
		"Watchdog cannot be stopped once started (default="
				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");

/*
 *	Watchdog Operations
 */

static void ibwdt_ping(void)
{
	int wd_margin = 15 - ((timeout + 1) / 2);

	spin_lock(&ibwdt_lock);

	/* Write a watchdog value */
	outb_p(wd_margin, WDT_START);

	spin_unlock(&ibwdt_lock);
}

static void ibwdt_disable(void)
{
	spin_lock(&ibwdt_lock);
	outb_p(0, WDT_STOP);
	spin_unlock(&ibwdt_lock);
}

static int ibwdt_set_heartbeat(int t)
{
	if (t < 0 || t > 30)
		return -EINVAL;

	timeout = t;
	return 0;
}

/*
 *	/dev/watchdog handling
 */

static ssize_t ibwdt_write(struct file *file, const char __user *buf,
						size_t count, loff_t *ppos)
{
	if (count) {
		if (!nowayout) {
			size_t i;

			/* In case it was set long ago */
			expect_close = 0;

			for (i = 0; i != count; i++) {
				char c;
				if (get_user(c, buf + i))
					return -EFAULT;
				if (c == 'V')
					expect_close = 42;
			}
		}
		ibwdt_ping();
	}
	return count;
}

static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	int new_margin;
	void __user *argp = (void __user *)arg;
	int __user *p = argp;

	static const struct watchdog_info ident = {
		.options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
							| WDIOF_MAGICCLOSE,
		.firmware_version = 1,
		.identity = "IB700 WDT",
	};

	switch (cmd) {
	case WDIOC_GETSUPPORT:
		if (copy_to_user(argp, &ident, sizeof(ident)))
			return -EFAULT;
		break;

	case WDIOC_GETSTATUS:
	case WDIOC_GETBOOTSTATUS:
		return put_user(0, p);

	case WDIOC_SETOPTIONS:
	{
		int options, retval = -EINVAL;

		if (get_user(options, p))
			return -EFAULT;

		if (options & WDIOS_DISABLECARD) {
			ibwdt_disable();
			retval = 0;
		}
		if (options & WDIOS_ENABLECARD) {
			ibwdt_ping();
			retval = 0;
		}
		return retval;
	}
	case WDIOC_KEEPALIVE:
		ibwdt_ping();
		break;

	case WDIOC_SETTIMEOUT:
		if (get_user(new_margin, p))
			return -EFAULT;
		if (ibwdt_set_heartbeat(new_margin))
			return -EINVAL;
		ibwdt_ping();
		/* Fall */

	case WDIOC_GETTIMEOUT:
		return put_user(timeout, p);

	default:
		return -ENOTTY;
	}
	return 0;
}

static int ibwdt_open(struct inode *inode, struct file *file)
{
	if (test_and_set_bit(0, &ibwdt_is_open))
		return -EBUSY;
	if (nowayout)
		__module_get(THIS_MODULE);

	/* Activate */
	ibwdt_ping();
	return nonseekable_open(inode, file);
}

static int ibwdt_close(struct inode *inode, struct file *file)
{
	if (expect_close == 42) {
		ibwdt_disable();
	} else {
		pr_crit("WDT device closed unexpectedly.  WDT will not stop!\n");
		ibwdt_ping();
	}
	clear_bit(0, &ibwdt_is_open);
	expect_close = 0;
	return 0;
}

/*
 *	Kernel Interfaces
 */

static const struct file_operations ibwdt_fops = {
	.owner		= THIS_MODULE,
	.llseek		= no_llseek,
	.write		= ibwdt_write,
	.unlocked_ioctl	= ibwdt_ioctl,
	.open		= ibwdt_open,
	.release	= ibwdt_close,
};

static struct miscdevice ibwdt_miscdev = {
	.minor = WATCHDOG_MINOR,
	.name = "watchdog",
	.fops = &ibwdt_fops,
};

/*
 *	Init & exit routines
 */

static int ibwdt_probe(struct platform_device *dev)
{
	int res;

#if WDT_START != WDT_STOP
	if (!request_region(WDT_STOP, 1, "IB700 WDT")) {
		pr_err("STOP method I/O %X is not available\n", WDT_STOP);
		res = -EIO;
		goto out_nostopreg;
	}
#endif

	if (!request_region(WDT_START, 1, "IB700 WDT")) {
		pr_err("START method I/O %X is not available\n", WDT_START);
		res = -EIO;
		goto out_nostartreg;
	}

	/* Check that the heartbeat value is within it's range ;
	 * if not reset to the default */
	if (ibwdt_set_heartbeat(timeout)) {
		ibwdt_set_heartbeat(WATCHDOG_TIMEOUT);
		pr_info("timeout value must be 0<=x<=30, using %d\n", timeout);
	}

	res = misc_register(&ibwdt_miscdev);
	if (res) {
		pr_err("failed to register misc device\n");
		goto out_nomisc;
	}
	return 0;

out_nomisc:
	release_region(WDT_START, 1);
out_nostartreg:
#if WDT_START != WDT_STOP
	release_region(WDT_STOP, 1);
#endif
out_nostopreg:
	return res;
}

static int ibwdt_remove(struct platform_device *dev)
{
	misc_deregister(&ibwdt_miscdev);
	release_region(WDT_START, 1);
#if WDT_START != WDT_STOP
	release_region(WDT_STOP, 1);
#endif
	return 0;
}

static void ibwdt_shutdown(struct platform_device *dev)
{
	/* Turn the WDT off if we have a soft shutdown */
	ibwdt_disable();
}

static struct platform_driver ibwdt_driver = {
	.probe		= ibwdt_probe,
	.remove		= ibwdt_remove,
	.shutdown	= ibwdt_shutdown,
	.driver		= {
		.owner	= THIS_MODULE,
		.name	= DRV_NAME,
	},
};

static int __init ibwdt_init(void)
{
	int err;

	pr_info("WDT driver for IB700 single board computer initialising\n");

	err = platform_driver_register(&ibwdt_driver);
	if (err)
		return err;

	ibwdt_platform_device = platform_device_register_simple(DRV_NAME,
								-1, NULL, 0);
	if (IS_ERR(ibwdt_platform_device)) {
		err = PTR_ERR(ibwdt_platform_device);
		goto unreg_platform_driver;
	}

	return 0;

unreg_platform_driver:
	platform_driver_unregister(&ibwdt_driver);
	return err;
}

static void __exit ibwdt_exit(void)
{
	platform_device_unregister(ibwdt_platform_device);
	platform_driver_unregister(&ibwdt_driver);
	pr_info("Watchdog Module Unloaded\n");
}

module_init(ibwdt_init);
module_exit(ibwdt_exit);

MODULE_AUTHOR("Charles Howes <chowes@vsol.net>");
MODULE_DESCRIPTION("IB700 SBC watchdog driver");
MODULE_LICENSE("GPL");

/* end of ib700wdt.c */


text:
package brut.androlib.res.data;

import brut.androlib.AndrolibException;
import brut.androlib.err.UndefinedResObject;
import java.util.*;

/**
 * @author Ryszard Wiśniewski <brut.alll@gmail.com>
 */
public final class ResType {
    private final String mName;
    private final Map<String, ResResSpec> mResSpecs = new LinkedHashMap<String, ResResSpec>();

    private final ResTable mResTable;
    private final ResPackage mPackage;

    public ResType(String name, ResTable resTable, ResPackage package_) {
        this.mName = name;
        this.mResTable = resTable;
        this.mPackage = package_;
    }

    public String getName() {
        return mName;
    }

    public boolean isString() {
        return mName.equalsIgnoreCase("string");
    }

    public Set<ResResSpec> listResSpecs() {
        return new LinkedHashSet<ResResSpec>(mResSpecs.values());
    }

    public boolean hasResSpec(String name) {
        if (mResSpecs.get(name) == null) {
            return false;
        } else {
            return true;
        }
    }

    public ResResSpec getResSpec(String name) throws AndrolibException {
        ResResSpec spec = mResSpecs.get(name);
        if (spec == null) {
            throw new UndefinedResObject(String.format("resource spec: %s/%s",
                    getName(), name));
        }
        return spec;
    }

    public void addResSpec(ResResSpec spec) throws AndrolibException {
        if (mResSpecs.put(spec.getName(), spec) != null) {
            throw new AndrolibException(String.format(
                    "Multiple res specs: %s/%s", getName(), spec.getName()));
        }
    }

    @Override
    public String toString() {
        return mName;
    }
}


text:
//============================================================================
// Name        : IPhysicsComponent.h
// Author      : Duarte Peixinho
// Version     :
// Copyright   : ;)
// Description : Physics Component Interface
//============================================================================

#ifndef IPHYSICSCOMPONENT_H
#define	IPHYSICSCOMPONENT_H

#include <iostream>
#include <Pyros3D/Components/IComponent.h>
#include <Pyros3D/Physics/Physics.h>
#include <Pyros3D/Other/Export.h>

namespace p3d {

	namespace CollisionShapes {
		enum {
			Box = 0,
			Sphere,
			Cylinder,
			Cone,
			Capsule,
			MultipleSphere,
			ConvexHull,
			ConvexTriangleMesh,
			TriangleMesh,
			HeightFieldTerrain,
			StaticPlane,
			Vehicle,
			Ghost
		};
	};

	class PYROS3D_API IPhysicsComponent : public IComponent
	{

		friend class GameObject;

	public:

		virtual void Register(SceneGraph* Scene);
		virtual void Init();
		virtual void Update(const f64 time = 0);
		virtual void Destroy();
		virtual void Unregister(SceneGraph* Scene);

		const f32 GetMass() const;
		const uint32 GetShape() const;

		void SaveRigidBodyPTR(void* ptr) { rigidBodyPTR = ptr; rigidBodyRegistered = true; }
		void* GetRigidBodyPTR() { return rigidBodyPTR; }
		bool RigidBodyRegistered() { return rigidBodyRegistered; }
		bool IsGhost() { return isGhost; }

		// Physics Methods Attributes
		virtual void SetPosition(const Vec3 &position);
		virtual void SetRotation(const Vec3 &rotation);
		virtual void CleanForces();
		virtual void SetAngularVelocity(const Vec3 &velocity);
		virtual void SetLinearVelocity(const Vec3 &velocity);
		virtual void Activate();

		virtual ~IPhysicsComponent();

	protected:

		// Add Wheel to Vehicle
		void InternalAddWheel(const Vec3 &WheelDirection, const Vec3 &WheelAxle, const f32 WheelRadius, const f32 WheelWidth, const f32 WheelFriction, const f32 WheelRollInfluence, const Vec3 &Position, bool isFrontWheel);

		// Protected Constructor
		IPhysicsComponent(const f32 Mass, const uint32 shape, IPhysics* engine, bool ghost = false) : mass(Mass), Shape(shape), rigidBodyRegistered(false), PhysicsEngine(engine), isGhost(ghost), IComponent() {}

		// Keep Shape Type
		unsigned Shape;
		f32 mass;
		void* rigidBodyPTR;
		bool rigidBodyRegistered;
		bool isGhost;
		IPhysics* PhysicsEngine;
	};

};

#endif /*IPHYSICSCOMPONENT_H*/


text:
package org.fusesource.camel.component.sap;

import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultEndpoint;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
import org.fusesource.camel.component.sap.model.idoc.DocumentList;
import org.fusesource.camel.component.sap.util.IDocUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sap.conn.idoc.IDocRepository;
import com.sap.conn.idoc.jco.JCoIDoc;
import com.sap.conn.idoc.jco.JCoIDocServer;
import com.sap.conn.jco.JCoException;

/**
 * An SAP endpoint receiving an IDoc (Intermediate Document) list from an SAP system
 * using transactional remote function calls (tRFC).
 *
 * @author William Collins <punkhornsw@gmail.com>
 *
 */
@UriEndpoint(scheme = "sap-idoclist-server", consumerClass = SapTransactionalIDocListConsumer.class)
public class SapTransactionalIDocListServerEndpoint extends DefaultEndpoint {

	private static final Logger LOG = LoggerFactory.getLogger(SapTransactionalIDocListServerEndpoint.class);

	protected String serverName;
	protected String idocType;
	protected String idocTypeExtension;
	protected String systemRelease;
	protected String applicationRelease;
	@UriParam
	protected boolean propagateExceptions;
	@UriParam
	protected boolean stateful;

	protected JCoIDocServer server;

	public SapTransactionalIDocListServerEndpoint() {
	}

	public SapTransactionalIDocListServerEndpoint(String uri, SapTransactionalIDocListServerComponent component) {
		super(uri, component);
	}

	public String getServerName() {
		return serverName;
	}

	public void setServerName(String serverName) {
		this.serverName = serverName;
	}

	public String getIdocType() {
		return idocType;
	}

	public void setIdocType(String idocType) {
		this.idocType = idocType;
	}

	public String getIdocTypeExtension() {
		return idocTypeExtension;
	}

	public void setIdocTypeExtension(String idocTypeExtension) {
		this.idocTypeExtension = idocTypeExtension;
	}

	public String getSystemRelease() {
		return systemRelease;
	}

	public void setSystemRelease(String systemRelease) {
		this.systemRelease = systemRelease;
	}

	public String getApplicationRelease() {
		return applicationRelease;
	}

	public void setApplicationRelease(String applicationRelease) {
		this.applicationRelease = applicationRelease;
	}

	public boolean isPropagateExceptions() {
		return propagateExceptions;
	}

	public void setPropagateExceptions(boolean propagateExceptions) {
		this.propagateExceptions = propagateExceptions;
	}

	public boolean isStateful() {
		return stateful;
	}

	public void setStateful(boolean stateful) {
		this.stateful = stateful;
	}

	@Override
	public boolean isSingleton() {
		return true;
	}

	@Override
	public Producer createProducer() throws Exception {
		throw new UnsupportedOperationException("Endpoint '" + getEndpointUri() + "' does not support producers");
	}

	@Override
	public Consumer createConsumer(Processor processor) throws Exception {
		IDocHandlerFactory handlerFactory = getComponent().getIDocHandlerFactory(serverName);
		if (handlerFactory == null) {
			throw new IllegalStateException("IDoc Handler Factory for '" + serverName + "' missing.");
		}
		SapTransactionalIDocListConsumer consumer = new SapTransactionalIDocListConsumer(this, processor);
		if (isStateful()) {
			consumer.setStateful(true);
		}
		handlerFactory.registerHandler(getIdocType(), getIdocTypeExtension(), getSystemRelease(), getApplicationRelease(), consumer);
		return consumer;
	}

	public DocumentList createDocumentList() throws Exception {
		try {
			return IDocUtil.createDocumentList(getIDocRepository(), getIdocType(), getIdocTypeExtension(), getSystemRelease(), getApplicationRelease());
		} catch (Exception e) {
			throw new Exception("Failed to get DocumentList from endpoint", e);
		}
	}

	@Override
	public SapTransactionalIDocListServerComponent getComponent() {
		return (SapTransactionalIDocListServerComponent) super.getComponent();
	}

	protected IDocRepository getIDocRepository() throws Exception{
		return getServer().getIDocRepository();
	}

	protected JCoIDocServer getServer() {
		if (server == null) {
			try {
				server = JCoIDoc.getServer(serverName);
			} catch (JCoException e) {
				LOG.warn("Failed to get server object for endpoint '" + getEndpointUri() + "'. This exception will be ignored.", e);
			}
		}
		return server;
	}

}


text:
import * as React from 'react';

class Introduction extends React.Component<{}, void> {
  public render() {
    return (

                A full-day event to learn about

                TypeScript
                 +
                Angular
                 +
                Node.js
                 +
                Azure

                Full Stack TypeScript Bootcamp is a one day technical training
                session about full stack TypeScript development driven by the
                community.

                The learning resources used during the event are maintained by
                the TypeScript community and are available as an Open Source
                project on GitHub. The learning resources teach how to use
                TypeScript to implement frontend applications with Angular,
                backend development  with Nodel.js, and continuous integration
                and continuous delivery with Azure.

    );
  }
}

export { Introduction };


text:
title: Structure View
---

The Structure View implementation used for a specific file type can be customized on many levels.
If a custom language plugin provides an implementation of the
[StructureView](upsource:///platform/structure-view-api/src/com/intellij/ide/structureView/StructureView.java)
interface, it can completely replace the standard structure view implementation with a custom user interface component.
However, for most languages this is not necessary, and the standard
[StructureView](upsource:///platform/structure-view-api/src/com/intellij/ide/structureView/StructureView.java)
implementation provided by *IntelliJ Platform* can be reused.

The starting point for the structure view is the
[PsiStructureViewFactory](upsource:///platform/structure-view-api/src/com/intellij/lang/PsiStructureViewFactory.java)
interface, which is registered in the `com.intellij.lang.psiStructureViewFactory` extension point.

**Example:**
[PsiStructureViewFactory](upsource:///plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewBuilderFactory.java)
for
[Properties language plugin](upsource:///plugins/properties)

To reuse the *IntelliJ Platform* implementation of the
[StructureView](upsource:///platform/structure-view-api/src/com/intellij/ide/structureView/StructureView.java),
the plugin returns a
[TreeBasedStructureViewBuilder](upsource:///platform/structure-view-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java)
from its
[PsiStructureViewFactory.getStructureViewBuilder()](upsource:///platform/structure-view-api/src/com/intellij/lang/PsiStructureViewFactory.java)<!--#L35-->
method.
As the model for the builder, the plugin can specify a subclass of
[TextEditorBasedStructureViewModel](upsource:///platform/structure-view-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java),
and by overriding methods of this subclass it customizes the structure view for a specific language.

**Example**:
[StructureViewModel](upsource:///plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewModel.java)
for
[Properties language plugin](upsource:///plugins/properties)

The main method to override is `getRoot()`, which returns the instance of a class implementing the
[StructureViewTreeElement](upsource:///platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java)
interface.
There exists no  standard implementation of this interface, so a plugin will need to implement it completely.

The structure view tree is usually built as a partial mirror of the PSI tree.
In the implementation of
`StructureViewTreeElement.getChildren()`,
the plugin can specify which of the child elements of a specific PSI tree node need to be represented as elements in the structure view.
Another important method is `getPresentation()`, which can be used to customize the text, attributes and icon used to represent an element in the structure view.

The implementation of `StructureViewTreeElement.getChildren()` needs to be matched by `TextEditorBasedStructureViewModel.getSuitableClasses()`.
The latter method returns an array of `PsiElement`\-derived classes which can be shown as structure view elements, and is used to select the Structure View item matching the cursor position when the structure view is first opened or when the `Autoscroll from source` option is used.

**Example:**
[StructureViewElement](upsource:///plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java)
for
[Properties language plugin](upsource:///plugins/properties/)


text:
Note:
Le confort, c'est bien, mais ça ne fait pas en sorte qu'on évolue et qu'on grandit.

“We are all shaped by the tools we train ourselves to use”

- Edsger W.Dijkstra

Note:
Le langage humain dans lequel nous baignons structure notre manière de penser.

## La maîtrise de deux langages humains et plus offre:

une plus *grande flexibilité mentale*

davantage de facilités à *apprendre et intégrer des concepts complexes*

davantage de facilités à *intégrer des cultures et modes de pensées différents*


text:
Criv is based on the Python language, version 2.7
To install Python 2.7 : https://www.python.org/

## DOCUMENTATION

A complete Criv code documentation is available at https://github.com/rivtools/Criv/wiki

## Installation:

Download CRIV_app as a zip archive or clone it with git.

Criv depends on Gmsh (mesh creation) and Sutra (flow model). You need to place the two executables in the ./bin directory of the CRIV_app directory.

The executables and source codes can be found at following locations:
SUTRA : http://water.usgs.gov/nrp/gwsoftware/sutra.html

Gmsh : http://geuz.org/gmsh/#Download

## Launch the app

You need to set your parameters in the ./model/user_param.txt text file

To launch the app you need to open a python terminal in the CrivApp/model/ directory

Now you can use the different functions of CRIV_app by copy/pasting the commands from CrivApp/execut.py in the python terminal.


text:
package com.seovic.batch;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

/**
 * Abstract base class for composite Step implementations.
 *
 * @author Aleksandar Seovic  2009.11.04
 */
public abstract class AbstractCompositeStep
        extends AbstractStep
        implements CompositeStep {

    private static final long serialVersionUID = 3517824007584120850L;

    // ---- data members ----------------------------------------------------

    /**
     * A list of child steps.
     */
    private List<Step> steps = new ArrayList<Step>();

    // ---- constructors ----------------------------------------------------

    protected AbstractCompositeStep(String name) {
        super(name);
    }

    // ---- CompositeStep implementation ------------------------------------

    public List<Step> getSteps() {
        return steps;
    }

    public CompositeStep addStep(Step step) {
        steps.add(step);
        return this;
    }

    // ---- helper methods --------------------------------------------------

    protected void processStepResult(ExecutionContext context,
                                     Step step,
                                     Future<StepResult> result)
            throws InterruptedException {
        try {
            StepResult stepResult = result.get();
            step.setResult(stepResult);
            context.merge(stepResult.getContext());
        }
        catch (ExecutionException e) {
            step.setResult(new StepResult(context, ExecutionStatus.FAILED, e));
        }
    }

    // ---- inner class: CallableStepAdapter --------------------------------

    public static class CallableStepAdapter
            implements Callable<StepResult>, Serializable {
        public CallableStepAdapter(Step step, ExecutionContext context) {
            m_step = step;
            m_context = context;
        }

        public StepResult call()
                throws Exception {
            ExecutionContext context = m_context;
            try {
                m_step.execute(context);
                return new StepResult(context, ExecutionStatus.COMPLETED);
            }
            catch (Throwable t) {
                return new StepResult(context, ExecutionStatus.FAILED, t);
            }
        }

        private final Step m_step;
        private final ExecutionContext m_context;
    }
}


text:
describe('angular-zoom-directive', function(){
  var expect = chai.expect;
  var $compile, $timeout, $scope, $document, body, container, transcludedScope, eleTarget;

  beforeEach(module('open-vts'))

  beforeEach(function(){

    inject(function(_$compile_, _$rootScope_, _$document_, _$timeout_) {
      $compile = _$compile_;
      $scope = _$rootScope_;
      $document = _$document_;
      $timeout = _$timeout_;
      body = angular.element(_$document_[0].body)
    });

  });

  beforeEach(function(){
    container = angular.element('

');
    eleZoomDirective = angular.element(
      '
' +
        '

' +
      '
'
    );
    eleTarget = angular.element('
');
    body.append(container);
    container.append(eleTarget);
    container.append(eleZoomDirective);
    $compile(eleZoomDirective)($scope);
    $scope.$digest()
    transcludedScope = angular.element(eleZoomDirective[0].querySelector('#controlTarget')).scope();
  });

  afterEach(function(){
    container.empty();
  });

  describe('zoom.in', function(){

    it('scales target upwards', function() {
      transcludedScope.zoom.in();
      transcludedScope.$digest();
      var transformStyle = eleTarget[0].style.transform;
      var step = parseFloat(transformStyle.substring(transformStyle.indexOf('(') + 1, transformStyle.indexOf(',')));
      expect(step).to.be.closeTo(2, 0.01);
    });

  });

  describe('zoom.out', function(){

    it('scales target downwards', function() {
      transcludedScope.zoom.out();
      transcludedScope.$digest();
      var transformStyle = eleTarget[0].style.transform;
      var step = parseFloat(transformStyle.substring(transformStyle.indexOf('(') + 1, transformStyle.indexOf(',')));
      expect(step).to.be.closeTo(0.64, 0.01);
    });

  });

  describe('zoom.isMaxedIn', function(){

    it('returns true when at lowest scale', function() {
      transcludedScope.zoom.in();
      transcludedScope.$digest();
      expect(transcludedScope.zoom.isMaxedIn()).to.be.true
    });

    it('returns false when not lowest scale', function() {
      transcludedScope.zoom.out();
      transcludedScope.$digest();
      expect(transcludedScope.zoom.isMaxedIn()).to.be.false
    });

  });

  describe('zoom.isMaxedout', function(){

    it('returns true when at hightest scale', function() {
      transcludedScope.zoom.out();
      transcludedScope.zoom.out();
      transcludedScope.zoom.out();
      transcludedScope.$digest();
      expect(transcludedScope.zoom.isMaxedOut()).to.be.true
    });

    it('returns false when not highest scale', function() {
      transcludedScope.zoom.in();
      transcludedScope.$digest();
      expect(transcludedScope.zoom.isMaxedOut()).to.be.false
    });

  });

});


text: class Portent < Event ;end


text:
package org.eigenbase.rel;

import java.util.List;

import org.eigenbase.relopt.*;

/**
 * UnionRel returns the union of the rows of its inputs, optionally
 * eliminating duplicates.
 */
public final class UnionRel extends UnionRelBase {
  //~ Constructors -----------------------------------------------------------

  public UnionRel(
      RelOptCluster cluster,
      List<RelNode> inputs,
      boolean all) {
    super(
        cluster,
        cluster.traitSetOf(Convention.NONE),
        inputs,
        all);
  }

  /**
   * Creates a UnionRel by parsing serialized output.
   */
  public UnionRel(RelInput input) {
    super(input);
  }

  //~ Methods ----------------------------------------------------------------

  public UnionRel copy(
      RelTraitSet traitSet, List<RelNode> inputs, boolean all) {
    assert traitSet.containsIfApplicable(Convention.NONE);
    return new UnionRel(
        getCluster(),
        inputs,
        all);
  }

  @Override
  public RelNode accept(RelShuttle shuttle) {
    return shuttle.visit(this);
  }
}

// End UnionRel.java


text:
package de.mfo.jsurf.algebra;

public class ToStringVisitor extends AbstractVisitor< String, Void >
{
    final static String LPAR = "(";
    final static String RPAR = ")";

    private boolean onlyExplicitParentheses;

    public ToStringVisitor()
    {
        this( false );
    }

    public ToStringVisitor( boolean onlyExplicitParentheses )
    {
        this.onlyExplicitParentheses = onlyExplicitParentheses;
    }

    protected boolean getOnlyExplicitParentheses() { return onlyExplicitParentheses; }

    String lp( PolynomialOperation pop )
    {
        return !onlyExplicitParentheses || pop.hasParentheses() ? LPAR : "";
    }

    String rp( PolynomialOperation pop )
    {
        return !onlyExplicitParentheses || pop.hasParentheses() ? RPAR : "";
    }

    public String visit( PolynomialOperation pop, Void param )
    {
        return lp(pop) + pop.toString() + rp(pop);
    }

    public String visit( PolynomialAddition pa, Void param )
    {
        return lp(pa) + pa.getFirstOperand().accept( this, ( Void ) null ) + "+" + pa.getSecondOperand().accept( this, ( Void ) null ) + rp(pa);
    }

    public String visit( PolynomialSubtraction ps, Void param )
    {
        return lp(ps) + ps.getFirstOperand().accept( this, ( Void ) null ) + "-" + ps.getSecondOperand().accept( this, ( Void ) null ) + rp(ps);
    }

    public String visit( PolynomialMultiplication pm, Void param )
    {
        return lp(pm) + pm.getFirstOperand().accept( this, ( Void ) null ) + "*" + pm.getSecondOperand().accept( this, ( Void ) null ) + rp(pm);
    }

    public String visit( PolynomialPower pp, Void param )
    {
        return lp(pp) + pp.getBase().accept( this, ( Void ) null ) + "^" + pp.getExponent() + rp(pp);
    }

    public String visit( PolynomialNegation pn, Void param )
    {
        return lp(pn) + "-" + pn.getOperand().accept( this, ( Void ) null ) + rp(pn);
    }

    public String visit( PolynomialDoubleDivision pdd, Void param )
    {
        return lp(pdd) + pdd.getDividend().accept( this,( Void ) null ) + "/" + pdd.getDivisor().accept( this,( Void ) null ) + rp(pdd);
    }

    public String visit( PolynomialVariable pv, Void param )
    {
        return lp(pv) + pv.getVariable().toString() + rp(pv);
    }

    public String visit( DoubleOperation dop, Void param )
    {
        return lp(dop) + dop.toString() + rp(dop);
    }

    public String visit( DoubleBinaryOperation dbop, Void param )
    {
        String lp = lp(dbop);
        String rp = lp(dbop);
        String firstOperand = dbop.getFirstOperand().accept( this, ( Void ) null );
        String secondOperand = dbop.getSecondOperand().accept( this, ( Void ) null );

        switch( dbop.getOperator() )
        {
            case add:
                return lp + firstOperand + "+" + secondOperand + rp;
            case sub:
                return lp + firstOperand + "-" + secondOperand + rp;
            case mult:
                return lp + firstOperand + "*" + secondOperand + rp;
            case div:
                return lp + firstOperand + "/" + secondOperand + rp;
            case pow:
                return lp + firstOperand + "^" + secondOperand + rp;
            default:
                throw new UnsupportedOperationException();
        }
    }

    public String visit( DoubleUnaryOperation duop, Void param )
    {
        String lp = lp(duop);
        String rp = lp(duop);
        String operand = duop.getOperand().accept( this, ( Void ) null );

        switch( duop.getOperator() )
        {
            case neg:
                return lp + "-" + operand + rp;
            case sin:
                return "sin" + lp + operand + rp;
            case cos:
                return "cos" + lp + operand + rp;
            case tan:
                return "tan" + lp + operand + rp;
            case asin:
                return "asin" + lp + operand + rp;
            case acos:
                return "acos" + lp + operand + rp;
            case atan:
                return "atan" + lp + operand + rp;
            case exp:
                return "exp" + lp + operand + rp;
            case log:
                return "log" + lp + operand + rp;
            case sqrt:
                return "sqrt" + lp + operand + rp;
            case ceil:
                return "ceil" + lp + operand + rp;
            case floor:
                return "floor" + lp + operand + rp;
            case abs:
                return "abs" + lp + operand + rp;
            case sign:
                return "signum" + lp + operand + rp;
            default:
                throw new UnsupportedOperationException();
        }
    }

    public String visit( DoubleValue dv, Void param )
    {
        return lp(dv) + dv.toString() + rp(dv);
    }

    public String visit( DoubleVariable dv, Void param )
    {
        return lp(dv) + dv.getName() + rp(dv);
    }
}


text:
<?php

declare(strict_types=1);

namespace DiContainerBenchmarks\Fixture\C;

class FixtureC41
{
    public function __construct(FixtureC40 $dependency)
    {
    }
}


text:
import NetRegexes from '../../../../../resources/netregexes';
import ZoneId from '../../../../../resources/zone_id';
import { OopsyData } from '../../../../../types/data';
import { OopsyTriggerSet } from '../../../../../types/oopsy';
import { playerDamageFields } from '../../../oopsy_common';

export type Data = OopsyData;

// O2N - Deltascape 2.0 Normal
const triggerSet: OopsyTriggerSet<Data> = {
  zoneId: ZoneId.DeltascapeV20,
  damageWarn: {
    'O2N Main Quake': '24A5', // Non-telegraphed circle AoE, Fleshy Member
    'O2N Erosion': '2590', // Small circle AoEs, Fleshy Member
  },
  shareWarn: {
    'O2N Paranormal Wave': '250E', // Instant tank cleave
  },
  triggers: [
    {
      // We could try to separate out the mistake that led to the player being petrified.
      // However, it's Normal mode, why overthink it?
      id: 'O2N Petrification',
      type: 'GainsEffect',
      netRegex: NetRegexes.gainsEffect({ effectId: '262' }),
      // The user might get hit by another petrifying ability before the effect ends.
      // There's no point in notifying for that.
      suppressSeconds: 10,
      mistake: (_data, matches) => {
        return {
          type: 'warn',
          blame: matches.target,
          reportId: matches.targetId,
          text: matches.effect,
        };
      },
    },
    {
      id: 'O2N Earthquake',
      type: 'Ability',
      netRegex: NetRegexes.abilityFull({ id: '2515', ...playerDamageFields }),
      // This deals damage only to non-floating targets.
      condition: (data, matches) => data.DamageFromMatches(matches) > 0,
      mistake: (_data, matches) => {
        return {
          type: 'warn',
          blame: matches.target,
          reportId: matches.targetId,
          text: matches.ability,
        };
      },
    },
  ],
};

export default triggerSet;


text:
"""
Filename: routes.py
Author: Brian Soe
Description: List and defines all functionality of routes.
Prerequisite: Flask server must be running.
"""

from flask import *
from flask.ext.mail import Message
from datetime import datetime
from dev import app, db, models, loader, mail
import zlib

@app.route('/')
def viewIndex():
    """ Renders homepage """
    Stories = models.Stories
    stories = Stories.query.filter(Stories.approval) \
        .order_by('date desc').all()
    return render_template('index.html',
                           endpoint="home",
                           stories=stories)

@app.route('/about')
def viewAbout():
    """ Renders About page """
    muiristas = loader.load('about_muiristas.tsv')  # load gallery image data
    sources = loader.load('about_sources.tsv')  # load gallery image data
    return render_template('about.html',
                           endpoint="about",
                           muiristas=muiristas,
                           sources=sources)

@app.route('/menu')
def viewMenu():
    """ Renders Menu page """
    return render_template('menu.html', endpoint="menu")

@app.route('/stories', methods=['GET', 'POST'])
def viewStories():
    Stories = models.Stories
    if request.method == 'POST':
        # text = request.form['q']
        # date = datetime.now().strftime('%m/%d/%Y')
        # story = Stories(date=datetime.now(), text=text, approval=True)
        # db.session.add(story)
        # db.session.commit()
        # print "Saved to Database"
        # #msg = Message("Hi 187B Graders",
        # #    sender="NoSLP",
        # #    recipients=["kirsh@ucsd.edu", "2flcastro@gmail.com", "adam@powe.rs", "huang.katie94@gmail.com"],
        # #    cc=["brian.soe003@gmail.com", "dhyee@ucsd.edu", "cvd001@ucsd.edu"])
        # #msg.html = 'We can tell that you are grading our project right now! Thank you for all your hard work, and have a great spring break!'
        # #mail.send(msg)
        # flash(u'Your story has been submitted.', 'success')
        return redirect('/stories')
    stories = Stories.query.filter(Stories.approval) \
        .order_by('date desc').all()
    return render_template('stories.html',
                           endpoint="stories",
                           stories=stories)

@app.route('/gallery')
def viewGallery():
    """ Renders Gallery page """
    photos = loader.load('gallery_photos.tsv')  # load gallery image data
    return render_template('gallery.html',
                           endpoint="gallery",
                           photos=photos)

@app.route('/approve')
def approveStory():
    stories = models.Stories.query.all()
    for story in stories:
        if story.id == int(request.form['id']):
            print story.approval
            story.approval = True
    db.session.commit()
    pass


text:
namespace Microsoft.Azure.Management.Security.Models
{

    /// <summary>
    /// Defines values for ValueType.
    /// </summary>
    public static class ValueType
    {
        /// <summary>
        /// An IP range in CIDR format (e.g. '192.168.0.1/8').
        /// </summary>
        public const string IpCidr = "IpCidr";
        /// <summary>
        /// Any string value.
        /// </summary>
        public const string String = "String";
    }
}


text:
"""
    celery.apps.beat
    ~~~~~~~~~~~~~~~~

    This module is the 'program-version' of :mod:`celery.beat`.

    It does everything necessary to run that module
    as an actual application, like installing signal handlers
    and so on.

"""
from __future__ import absolute_import

import socket
import sys

from celery import VERSION_BANNER, platforms, beat
from celery.utils.imports import qualname
from celery.utils.log import LOG_LEVELS, get_logger
from celery.utils.timeutils import humanize_seconds

__all__ = ['Beat']

STARTUP_INFO_FMT = """
Configuration ->
    . broker -> {conninfo}
    . loader -> {loader}
    . scheduler -> {scheduler}
{scheduler_info}
    . logfile -> {logfile}@%{loglevel}
    . maxinterval -> {hmax_interval} ({max_interval}s)
""".strip()

logger = get_logger('celery.beat')

class Beat(object):
    Service = beat.Service
    app = None

    def __init__(self, max_interval=None, app=None,
                 socket_timeout=30, pidfile=None, no_color=None,
                 loglevel=None, logfile=None, schedule=None,
                 scheduler_cls=None, redirect_stdouts=None,
                 redirect_stdouts_level=None, **kwargs):
        """Starts the beat task scheduler."""
        self.app = app = app or self.app
        self.loglevel = self._getopt('log_level', loglevel)
        self.logfile = self._getopt('log_file', logfile)
        self.schedule = self._getopt('schedule_filename', schedule)
        self.scheduler_cls = self._getopt('scheduler', scheduler_cls)
        self.redirect_stdouts = self._getopt(
            'redirect_stdouts', redirect_stdouts,
        )
        self.redirect_stdouts_level = self._getopt(
            'redirect_stdouts_level', redirect_stdouts_level,
        )

        self.max_interval = max_interval
        self.socket_timeout = socket_timeout
        self.no_color = no_color
        self.colored = app.log.colored(
            self.logfile,
            enabled=not no_color if no_color is not None else no_color,
        )
        self.pidfile = pidfile

        if not isinstance(self.loglevel, int):
            self.loglevel = LOG_LEVELS[self.loglevel.upper()]

    def _getopt(self, key, value):
        if value is not None:
            return value
        return self.app.conf.find_value_for_key(key, namespace='celerybeat')

    def run(self):
        print(str(self.colored.cyan(
            'celery beat v{0} is starting.'.format(VERSION_BANNER))))
        self.init_loader()
        self.set_process_title()
        self.start_scheduler()

    def setup_logging(self, colorize=None):
        if colorize is None and self.no_color is not None:
            colorize = not self.no_color
        self.app.log.setup(self.loglevel, self.logfile,
                           self.redirect_stdouts, self.redirect_stdouts_level,
                           colorize=colorize)

    def start_scheduler(self):
        c = self.colored
        if self.pidfile:
            platforms.create_pidlock(self.pidfile)
        beat = self.Service(app=self.app,
                            max_interval=self.max_interval,
                            scheduler_cls=self.scheduler_cls,
                            schedule_filename=self.schedule)

        print(str(c.blue('__    ', c.magenta('-'),
                  c.blue('    ... __   '), c.magenta('-'),
                  c.blue('        _\n'),
                  c.reset(self.startup_info(beat)))))
        self.setup_logging()
        if self.socket_timeout:
            logger.debug('Setting default socket timeout to %r',
                         self.socket_timeout)
            socket.setdefaulttimeout(self.socket_timeout)
        try:
            self.install_sync_handler(beat)
            beat.start()
        except Exception as exc:
            logger.critical('beat raised exception %s: %r',
                            exc.__class__, exc,
                            exc_info=True)

    def init_loader(self):
        # Run the worker init handler.
        # (Usually imports task modules and such.)
        self.app.loader.init_worker()
        self.app.finalize()

    def startup_info(self, beat):
        scheduler = beat.get_scheduler(lazy=True)
        return STARTUP_INFO_FMT.format(
            conninfo=self.app.connection().as_uri(),
            logfile=self.logfile or '[stderr]',
            loglevel=LOG_LEVELS[self.loglevel],
            loader=qualname(self.app.loader),
            scheduler=qualname(scheduler),
            scheduler_info=scheduler.info,
            hmax_interval=humanize_seconds(beat.max_interval),
            max_interval=beat.max_interval,
        )

    def set_process_title(self):
        arg_start = 'manage' in sys.argv[0] and 2 or 1
        platforms.set_process_title(
            'celery beat', info=' '.join(sys.argv[arg_start:]),
        )

    def install_sync_handler(self, beat):
        """Install a `SIGTERM` + `SIGINT` handler that saves
        the beat schedule."""

        def _sync(signum, frame):
            beat.sync()
            raise SystemExit()

        platforms.signals.update(SIGTERM=_sync, SIGINT=_sync)


text:
<?php

// autoload.php @generated by Composer

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit4b080006e366ad8b7b204c817c4bb660::getLoader();


text:
/**
 * Basic structure: TC_Class is the public class that is returned upon being called
 *
 * So, if you do
 *      var tc = $(".timer").TimeCircles();
 *
 * tc will contain an instance of the public TimeCircles class. It is important to
 * note that TimeCircles is not chained in the conventional way, check the
 * documentation for more info on how TimeCircles can be chained.
 *
 * After being called/created, the public TimerCircles class will then- for each element
 * within it's collection, either fetch or create an instance of the private class.
 * Each function called upon the public class will be forwarded to each instance
 * of the private classes within the relevant element collection
 **/
(function($) {
    /**
     * Converts hex color code into object containing integer values for the r,g,b use
     * This function (hexToRgb) originates from:
     * http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
     * @param {string} hex color code
     */
    function hexToRgb(hex) {
        // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
        var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
        hex = hex.replace(shorthandRegex, function(m, r, g, b) {
            return r + r + g + g + b + b;
        });

        var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
        return result ? {
            r: parseInt(result[1], 16),
            g: parseInt(result[2], 16),
            b: parseInt(result[3], 16)
        } : null;
    }

    /**
     * Function s4() and guid() originate from:
     * http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
     */
    function s4() {
        return Math.floor((1 + Math.random()) * 0x10000)
            .toString(16)
            .substring(1);
    }

    /**
     * Creates a unique id
     * @returns {String}
     */
    function guid() {
        return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
            s4() + '-' + s4() + s4() + s4();
    }

    var TC_Instance_List = {};

    var TC_Instance = function(element, options) {
        this.element = element;
        this.container;
        this.timer = null;
        this.data = {
            text_elements: {
                Days: null,
                Hours: null,
                Minutes: null,
                Seconds: null
            },
            attributes: {
                canvas: null,
                context: null,
                item_size: null,
                line_width: null,
                radius: null,
                outer_radius: null
            },
            state: {
                fading: {
                    Days: false,
                    Hours: false,
                    Minutes: false,
                    Seconds: false
                }
            }
        };
        this.listeners = [];
        this.config = null;
        this.setOptions(options);

        this.container = $("<div>");
        this.container.addClass('time_circles');
        this.container.appendTo(this.element);

        this.data.attributes.canvas = $("<canvas>");
        this.data.attributes.context = this.data.attributes.canvas[0].getContext('2d');

        var height = this.element.offsetHeight;
        var width = this.element.offsetWidth;
        if(height === 0 && width > 0) height = width / 4;
        else if(width === 0 && height > 0) width = height * 4;

        this.data.attributes.canvas[0].height = height;
        this.data.attributes.canvas[0].width = width;
        this.data.attributes.canvas.appendTo(this.container);

        this.data.attributes.item_size = Math.min(this.data.attributes.canvas[0].width / 4, this.data.attributes.canvas[0].height);
        this.data.attributes.line_width = this.data.attributes.item_size * this.config.fg_width;
        this.data.attributes.radius = ((this.data.attributes.item_size * 0.8) - this.data.attributes.line_width) / 2;
        this.data.attributes.outer_radius = this.data.attributes.radius + 0.5 * Math.max(this.data.attributes.line_width, this.data.attributes.line_width * this.config.bg_width);

        // Prepare Time Elements
        var i = 0;
        for (var key in this.data.text_elements) {
            var textElement = $("<div>");
            textElement.addClass('textDiv_' + key);
            textElement.css("top", Math.round(0.35 * this.data.attributes.item_size));
            textElement.css("left", Math.round(i++ * this.data.attributes.item_size));
            textElement.css("width", this.data.attributes.item_size);
            textElement.appendTo(this.container);

            var headerElement = $("<h4>");
            headerElement.text(this.config.time[key].text); // Options
            headerElement.css("font-size", Math.round(0.07 * this.data.attributes.item_size));
            headerElement.css("line-height", Math.round(0.07 * this.data.attributes.item_size) + "px");
            headerElement.appendTo(textElement);

            var numberElement = $("<span>");
            numberElement.css("font-size", Math.round(0.21 * this.data.attributes.item_size));
            numberElement.css("line-height", Math.round(0.07 * this.data.attributes.item_size) + "px");
            numberElement.appendTo(textElement);

            this.data.text_elements[key] = numberElement;
        }

        if (this.config.start)
            this.start();
    };

    TC_Instance.prototype.updateArc = function() {
        var diff, old_diff;

        var interval = (1000 * this.config.refresh_interval);
        var curDate = new Date();

        // Compare current time with reference
        if (this.config.count_past_zero) {
            var prevDate = curDate - interval;
            diff = Math.abs(curDate - this.data.attributes.ref_date) / 1000;
            old_diff = Math.abs(this.data.attributes.ref_date - prevDate) / 1000;
        }
        else {
            diff = Math.max(this.data.attributes.ref_date - curDate, 0) / 1000;
            old_diff = diff + (curDate > this.data.attributes.ref_date) ? 0 : interval;
        }

        var time = {
            Days: (diff / 60 / 60 / 24),
            Hours: (diff / 60 / 60) % 24,
            Minutes: (diff / 60) % 60,
            Seconds: diff % 60
        };
        var pct = {
            Days: time.Days / 365,
            Hours: time.Hours / 24,
            Minutes: time.Minutes / 60,
            Seconds: time.Seconds / 60
        };

        var old_time = {
            Days: (old_diff / 60 / 60 / 24),
            Hours: (old_diff / 60 / 60) % 24,
            Minutes: (old_diff / 60) % 60,
            Seconds: old_diff % 60
        };

        var i = 0;
        var lastKey = null;
        for (var key in time) {
            // Set the text value
            this.data.text_elements[key].text(Math.floor(time[key]));

            var x = (i * this.data.attributes.item_size) + (this.data.attributes.item_size / 2);
            var y = this.data.attributes.item_size / 2;
            var color = this.config.time[key].color;

            if(Math.floor(time[key]) !== Math.floor(old_time[key])) {
                this.notifyListeners(key, Math.floor(time[key]), Math.floor(diff));
            }
            // TODO: Check options for fading == true
            if (lastKey !== null) {
                if (Math.floor(time[lastKey]) > Math.floor(old_time[lastKey])) {
                    this.radialFade(x, y, color, 1, key);
                    this.data.state.fading[key] = true;
                }
                else if (Math.floor(time[lastKey]) < Math.floor(old_time[lastKey])) {
                    this.radialFade(x, y, color, 0, key);
                    this.data.state.fading[key] = true;
                }
            }
            if (!this.data.state.fading[key]) {
                this.drawArc(x, y, color, pct[key]);
            }
            lastKey = key;
            i++;
        }
    };

    TC_Instance.prototype.drawArc = function(x, y, color, pct) {
        var clear_radius = Math.max(this.data.attributes.outer_radius, this.data.attributes.item_size / 2);
        this.data.attributes.context.clearRect(
            x - clear_radius,
            y - clear_radius,
            clear_radius * 2,
            clear_radius * 2
            );

        if (this.config.use_background) {
            this.data.attributes.context.beginPath();
            this.data.attributes.context.arc(x, y, this.data.attributes.radius, 0, 2 * Math.PI, false);
            this.data.attributes.context.lineWidth = this.data.attributes.line_width * this.config.bg_width;

            // line color
            this.data.attributes.context.strokeStyle = this.config.circle_bg_color;
            this.data.attributes.context.stroke();
        }

        var startAngle = (-0.5 * Math.PI);
        var endAngle = (-0.5 * Math.PI) + (2 * pct * Math.PI);
        var counterClockwise = false;

        this.data.attributes.context.beginPath();
        this.data.attributes.context.arc(x, y, this.data.attributes.radius, startAngle, endAngle, counterClockwise);
        this.data.attributes.context.lineWidth = this.data.attributes.line_width;

        // line color
        this.data.attributes.context.strokeStyle = color;
        this.data.attributes.context.stroke();
    };

    TC_Instance.prototype.radialFade = function(x, y, color, from, key) {
        // TODO: Make fade_time option
        var rgb = hexToRgb(color);
        var _this = this; // We have a few inner scopes here that will need access to our instance

        var step = 0.2 * ((from === 1) ? -1 : 1);
        var i;
        for (i = 0; from <= 1 && from >= 0; i++) {
            // Create inner scope so our variables are not changed by the time the Timeout triggers
            (function() {
                var rgba = "rgba(" + rgb.r + ", " + rgb.g + ", " + rgb.b + ", " + (Math.round(from * 10) / 10) + ")";
                setTimeout(function() {
                    _this.drawArc(x, y, rgba, 1);
                }, 50 * i);
            }());
            from += step;
        }
        setTimeout(function() {
            _this.data.state.fading[key] = false;
        }, 50 * i);
    };

    TC_Instance.prototype.timeLeft = function() {
        var now = new Date();
        return ((this.data.attributes.ref_date - now) / 1000);
    };

    TC_Instance.prototype.start = function() {
        // Check if a date was passed in html attribute, if not, fall back to config
        var attr_data_date = $(this.element).data('date');
        if (typeof attr_data_date === "string") {
            if (attr_data_date.match(/^[0-9]{4}-[0-9]{2}-[0-9]{2}\s[0-9]{1,2}:[0-9]{2}:[0-9]{2}$/).length > 0) {
                attr_data_date = attr_data_date.replace(' ', 'T');
            }
            this.data.attributes.ref_date = Date.parse(attr_data_date);
        }
        else {
            var attr_data_timer = $(this.element).attr('data-timer');
            if (typeof attr_data_timer === "string") {
                this.data.attributes.timer = parseFloat(attr_data_timer);
                $(this.element).removeAttr('data-timer');
            }
            else if (typeof this.config.timer === "string") {
                this.data.attributes.timer = parseFloat(this.config.timer);
                this.config.timer = null;
            }
            else if (typeof this.config.timer === "number") {
                this.data.attributes.timer = _this.config.timer;
                this.config.timer = null;
            }

            if (typeof this.data.attributes.timer === "number") {
                this.data.attributes.ref_date = (new Date()).getTime() + (this.data.attributes.timer * 1000);
            }
            else {
                this.data.attributes.ref_date = this.config.ref_date;
            }
        }

        // Start running
        var _this = this;
        this.timer = setInterval(function() { _this.updateArc(); }, this.config.refresh_interval * 1000);
    };

    TC_Instance.prototype.stop = function() {
        if (typeof this.data.attributes.timer === "number") {
            this.data.attributes.timer = this.timeLeft(this);
        }
        // Stop running
        clearInterval(this.timer);
    };

    TC_Instance.prototype.destroy = function() {
        this.stop();
        this.container.remove();
        $(this.element).removeData('tc-id');
    };

    TC_Instance.prototype.setOptions = function(options) {
        if(this.config === null) {
            this.default_options.ref_date = new Date();
            this.config = $.extend(true, {}, this.default_options);
        }
        $.extend(true, this.config, options);
    };

    TC_Instance.prototype.addListener = function(f) {
        if(typeof f !== "function") return;
        this.listeners.push(f);
    };

    TC_Instance.prototype.notifyListeners = function(unit, value, total) {
        for(var i = 0; i < this.listeners.length; i++) {
            this.listeners[i](unit, value, total);
        }
    }

    TC_Instance.prototype.default_options = {
        ref_date: new Date(),
        start: true,
        refresh_interval: 0.1,
        count_past_zero: true,
        circle_bg_color: "#60686F",
        use_background: true,
        fg_width: 0.1,
        bg_width: 1.2,
        time: {
            Days: {
                show: true,
                text: "Days",
                color: "#FC6"
            },
            Hours: {
                show: true,
                text: "Hours",
                color: "#9CF"
            },
            Minutes: {
                show: true,
                text: "Minutes",
                color: "#BFB"
            },
            Seconds: {
                show: true,
                text: "Seconds",
                color: "#F99"
            }
        }
    };

    // Time circle class
    var TC_Class = function(elements, options) {
        this.elements = elements;
        this.options = options;
        this.foreach();
    };

    TC_Class.prototype.foreach = function(callback) {
        var _this = this;
        this.elements.each(function() {
            var instance;
            var cur_id = $(this).data("tc-id");
            if (typeof cur_id === "undefined") {
                cur_id = guid();
                $(this).data("tc-id", cur_id);
            }
            if (typeof TC_Instance_List[cur_id] === "undefined") {
                var element_options = $(this).data('options');
                var options = _this.options;
                if(typeof element_options === "object") {
                    options = $.extend(true, {}, _this.options, element_options);
                }
                instance = new TC_Instance(this, options);
                TC_Instance_List[cur_id] = instance;
            }
            else {
                instance = TC_Instance_List[cur_id];
                if (typeof _this.options !== "undefined") {
                    instance.setOptions(_this.options);
                }
            }

            if (typeof callback === "function") {
                callback(instance);
            }
        });
        return this;
    };

    TC_Class.prototype.start = function() {
        this.foreach(function(instance) {
            instance.start();
        });
        return this;
    };

    TC_Class.prototype.stop = function() {
        this.foreach(function(instance) {
            instance.stop();
        });
        return this;
    };

    TC_Class.prototype.addListener = function(f) {
        this.foreach(function(instance) {
            instance.addListener(f);
        });
        return this;
    };

    TC_Class.prototype.destroy = function() {
        this.foreach(function(instance) {
            instance.destroy();
        });
        return this;
    };

    TC_Class.prototype.end = function() {
        return this.elements;
    };

    $.fn.TimeCircles = function(options) {
        return new TC_Class(this, options);
    };
}(jQuery));


text:
package org.locationtech.geowave.core.store.spi;

import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.locationtech.geowave.core.index.SPIServiceRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/** These are the plugin index types that can be registered and used within Geowave. */
public class DimensionalityTypeRegistry {

  private static final Logger LOGGER = LoggerFactory.getLogger(DimensionalityTypeRegistry.class);

  private static Map<String, DimensionalityTypeProviderSpi> registeredDimensionalityTypes = null;

  private static synchronized void initDimensionalityTypeRegistry() {
    registeredDimensionalityTypes = new HashMap<>();
    final Iterator<DimensionalityTypeProviderSpi> dimensionalityTypesProviders =
        new SPIServiceRegistry(DimensionalityTypeRegistry.class).load(
            DimensionalityTypeProviderSpi.class);
    while (dimensionalityTypesProviders.hasNext()) {
      final DimensionalityTypeProviderSpi dimensionalityTypeProvider =
          dimensionalityTypesProviders.next();
      if (registeredDimensionalityTypes.containsKey(
          dimensionalityTypeProvider.getDimensionalityTypeName())) {
        LOGGER.warn(
            "Dimensionality type '"
                + dimensionalityTypeProvider.getDimensionalityTypeName()
                + "' already registered.  Unable to register type provided by "
                + dimensionalityTypeProvider.getClass().getName());
      } else {
        registeredDimensionalityTypes.put(
            dimensionalityTypeProvider.getDimensionalityTypeName(),
            dimensionalityTypeProvider);
      }
    }
  }

  public static Map<String, DimensionalityTypeProviderSpi> getRegisteredDimensionalityTypes() {
    if (registeredDimensionalityTypes == null) {
      initDimensionalityTypeRegistry();
    }
    return Collections.unmodifiableMap(registeredDimensionalityTypes);
  }

  public static DimensionalityTypeProviderSpi getSelectedDimensionalityProvider(
      final String dimensionalityType) {
    if (registeredDimensionalityTypes == null) {
      initDimensionalityTypeRegistry();
    }

    return registeredDimensionalityTypes.get(dimensionalityType);
  }
}


text:
"""
Test Salt MySQL state module across various MySQL variants
"""
import logging
import time

import pytest
from pytestshellutils.utils import format_callback_to_string
from saltfactories.utils.functional import StateResult

import salt.modules.mysql as mysqlmod
from tests.support.pytest.mysql import *  # pylint: disable=wildcard-import,unused-wildcard-import

log = logging.getLogger(__name__)

pytestmark = [
    pytest.mark.slow_test,
    pytest.mark.skip_if_binaries_missing("dockerd"),
    pytest.mark.skipif(
        mysqlmod.MySQLdb is None, reason="No python mysql client installed."
    ),
]

def _get_mysql_error(context):
    return context.pop("mysql.error", None)

class CallWrapper:
    def __init__(self, func, container, ctx):
        self.func = func
        self.container = container
        self.ctx = ctx

    def __call__(self, *args, **kwargs):
        kwargs.update(self.container.get_credentials(**kwargs))
        retry = 1
        retries = 3
        ret = None
        while True:
            ret = self.func(*list(args), **kwargs.copy())
            mysql_error = _get_mysql_error(self.ctx)
            if mysql_error is None:
                break

            retry += 1

            if retry > retries:
                break

            time.sleep(0.5)
            log.debug(
                "Retrying(%s out of %s) %s because of the following error: %s",
                retry,
                retries,
                format_callback_to_string(self.func, args, kwargs),
                mysql_error,
            )
        return ret

class StateSingleWrapper:
    def __init__(self, func, container, ctx):
        self.func = func
        self.container = container
        self.ctx = ctx

    def __call__(self, statefunc, *args, **kwargs):
        if statefunc.startswith("mysql_"):
            kwargs.update(self.container.get_credentials(**kwargs))
            retry = 1
            retries = 3
            ret = None
            while True:
                ret = self.func(statefunc, *list(args), **kwargs.copy())
                if ret.result:
                    break

                mysql_error = _get_mysql_error(self.ctx)
                if mysql_error is None:
                    break

                retry += 1
                if retry > retries:
                    break

                time.sleep(0.5)
                log.debug(
                    "Retrying(%s out of %s) %s because of the following return: %s",
                    retry,
                    retries,
                    format_callback_to_string(statefunc, args, kwargs),
                    ret,
                )
        else:
            # No retries for every other state function
            ret = self.func(statefunc, *args, **kwargs)
        if isinstance(ret, StateResult):
            # Sadly, because we're wrapping, we need to return the raw
            # attribute for a StateResult class to be recreated.
            return ret.raw
        return ret

@pytest.fixture(scope="module")
def mysql(modules, mysql_container, loaders):
    for name in list(modules):
        if name.startswith("mysql."):
            modules._dict[name] = CallWrapper(
                modules._dict[name],
                mysql_container,
                loaders.context,
            )
        if name == "state.single":
            modules._dict[name] = StateSingleWrapper(
                modules._dict[name],
                mysql_container,
                loaders.context,
            )
    return modules.mysql

@pytest.fixture(scope="module")
def mysql_states(mysql, states, mysql_container):
    # Just so we also have the container running
    return states

@pytest.fixture(scope="module")
def mysql_user(mysql_states):
    return mysql_states.mysql_user

@pytest.fixture(scope="module")
def mysql_query(mysql_states):
    return mysql_states.mysql_query

@pytest.fixture(scope="module")
def mysql_grants(mysql_states):
    return mysql_states.mysql_grants

@pytest.fixture(scope="module")
def mysql_database(mysql_states):
    return mysql_states.mysql_database

def test_database_present_absent(mysql_database):
    ret = mysql_database.present(name="test_database")
    assert ret.changes
    assert ret.changes == {"test_database": "Present"}
    assert ret.comment
    assert ret.comment == "The database test_database has been created"

    ret = mysql_database.absent(name="test_database")
    assert ret.changes
    assert ret.changes == {"test_database": "Absent"}
    assert ret.comment
    assert ret.comment == "Database test_database has been removed"

def test_grants_present_absent(mysql, mysql_grants):

    # Create the database
    ret = mysql.db_create("salt")
    assert ret

    # Create a user
    ret = mysql.user_create(
        "george",
        host="localhost",
        password="badpassword",
    )
    assert ret

    try:

        ret = mysql_grants.present(
            name="add_salt_grants",
            grant="select,insert,update",
            database="salt.*",
            user="george",
            host="localhost",
        )
        assert ret.changes
        assert ret.changes == {"add_salt_grants": "Present"}
        assert ret.comment
        assert (
            ret.comment
            == "Grant select,insert,update on salt.* to george@localhost has been added"
        )

        ret = mysql_grants.absent(
            name="delete_salt_grants",
            grant="select,insert,update",
            database="salt.*",
            user="george",
            host="localhost",
        )
        assert ret.changes
        assert ret.changes == {"delete_salt_grants": "Absent"}
        assert ret.comment
        assert (
            ret.comment
            == "Grant select,insert,update on salt.* for george@localhost has been revoked"
        )

    finally:
        # Remove the user
        ret = mysql.user_remove("george", host="localhost")
        assert ret

        # Remove the database
        ret = mysql.db_remove("salt")
        assert ret

def test_grants_present_absent_all_privileges(mysql, mysql_grants):

    # Create the database
    ret = mysql.db_create("salt_2_0")
    assert ret

    # Create a user
    ret = mysql.user_create(
        "george",
        host="localhost",
        password="badpassword",
    )
    assert ret

    try:
        ret = mysql_grants.present(
            name="add_salt_grants",
            grant="all privileges",
            database="salt_2_0.*",
            user="george",
            host="localhost",
        )

        assert ret.changes
        assert ret.changes == {"add_salt_grants": "Present"}

        assert ret.comment
        assert (
            ret.comment
            == "Grant all privileges on salt_2_0.* to george@localhost has been added"
        )

        ret = mysql_grants.absent(
            name="delete_salt_grants",
            grant="all privileges",
            database="salt_2_0.*",
            user="george",
            host="localhost",
        )

        assert ret.changes
        assert ret.changes == {"delete_salt_grants": "Absent"}

        assert ret.comment
        assert (
            ret.comment
            == "Grant all privileges on salt_2_0.* for george@localhost has been revoked"
        )

    finally:
        # Remove the user
        ret = mysql.user_remove("george", host="localhost")
        assert ret

        # Remove the database
        ret = mysql.db_remove("salt_2_0")
        assert ret

def test_user_present_absent(mysql_user):

    ret = mysql_user.present(
        name="george",
        host="localhost",
        password="password",
    )
    assert ret.changes
    assert ret.changes == {"george": "Present"}
    assert ret.comment
    assert ret.comment == "The user george@localhost has been added"

    ret = mysql_user.absent(
        name="george",
        host="localhost",
    )
    assert ret.changes
    assert ret.changes == {"george": "Absent"}
    assert ret.comment
    assert ret.comment == "User george@localhost has been removed"

def test_user_present_absent_passwordless(mysql_user):

    ret = mysql_user.present(
        name="george",
        host="localhost",
        allow_passwordless=True,
    )
    assert ret.changes
    assert ret.changes == {"george": "Present"}
    assert ret.comment
    assert (
        ret.comment
        == "The user george@localhost has been added with passwordless login"
    )

    ret = mysql_user.absent(
        name="george",
        host="localhost",
    )
    assert ret.changes
    assert ret.changes == {"george": "Absent"}
    assert ret.comment
    assert ret.comment == "User george@localhost has been removed"

def test_user_present_absent_unixsocket(mysql, mysql_user, mysql_container):

    # The auth_socket plugin on MariaDB is unavailable
    # on versions 10.1 - 10.3
    if "mariadb" in mysql_container.mysql_name:
        if mysql_container.mysql_version in ("10.1", "10.2", "10.3"):
            pytest.skip(
                "The auth_socket plugin is unavaiable "
                "for the {}:{} docker image.".format(
                    mysql_container.mysql_name, mysql_container.mysql_version
                )
            )

    # enable the auth_socket plugin on MySQL
    # already enabled on MariaDB > 10.3
    try:
        if "mariadb" not in mysql_container.mysql_name:
            ret = mysql.plugin_add("auth_socket")
            assert ret

        ret = mysql_user.present(
            name="george",
            host="localhost",
            unix_socket=True,
            allow_passwordless=False,
        )
        assert ret.changes
        assert ret.changes == {"george": "Present"}
        assert ret.comment
        assert (
            ret.comment == "The user george@localhost has been added using unix_socket"
        )

        ret = mysql_user.absent(
            name="george",
            host="localhost",
        )
        assert ret.changes
        assert ret.changes == {"george": "Absent"}
        assert ret.comment
        assert ret.comment == "User george@localhost has been removed"
    finally:
        if "mariadb" not in mysql_container.mysql_name:
            ret = mysql.plugin_remove("auth_socket")
            assert ret

def test_grants_present_absent_state_file(
    modules, mysql, mysql_grants, mysql_combo, state_tree
):

    content = """
    sbclient_2_0:
      mysql_user.present:
        - host: localhost
        - password: sbclient
        - connection_user: {mysql_user}
        - connection_pass: {mysql_pass}
        - connection_db: mysql
        - connection_port: {mysql_port}
      mysql_database.present:
        - connection_user: {mysql_user}
        - connection_pass: {mysql_pass}
        - connection_db: mysql
        - connection_port: {mysql_port}
      mysql_grants.present:
        - grant: ALL PRIVILEGES
        - user: sbclient_2_0
        - database: sbclient_2_0.*
        - host: localhost
        - connection_user: {mysql_user}
        - connection_pass: {mysql_pass}
        - connection_db: mysql
        - connection_port: {mysql_port}
    """.format(
        mysql_user=mysql_combo.mysql_root_user,
        mysql_pass=mysql_combo.mysql_root_passwd,
        mysql_port=mysql_combo.mysql_port,
    )

    try:
        with pytest.helpers.temp_file("manage_mysql.sls", content, state_tree):
            ret = modules.state.apply("manage_mysql")

            # Check user creation
            state = "mysql_user_|-sbclient_2_0_|-sbclient_2_0_|-present"
            assert state in ret
            assert "changes" in ret[state]
            assert ret[state].changes == {"sbclient_2_0": "Present"}

            # Check database creation
            state = "mysql_database_|-sbclient_2_0_|-sbclient_2_0_|-present"
            assert state in ret
            assert "changes" in ret[state]
            assert ret[state].changes == {"sbclient_2_0": "Present"}

            # Check grant creation
            state = "mysql_grants_|-sbclient_2_0_|-sbclient_2_0_|-present"
            assert state in ret
            assert "comment" in ret[state]
            assert (
                ret[state].comment
                == "Grant ALL PRIVILEGES on sbclient_2_0.* to sbclient_2_0@localhost has been added"
            )

        ret = mysql_grants.absent(
            name="delete_sbclient_grants",
            grant="all privileges",
            database="sbclient_2_0.*",
            user="sbclient_2_0",
            host="localhost",
        )
        assert ret.changes
        assert ret.changes == {"delete_sbclient_grants": "Absent"}

        assert ret.comment
        assert (
            ret.comment
            == "Grant all privileges on sbclient_2_0.* for sbclient_2_0@localhost has been revoked"
        )

    finally:
        # Remove the user
        ret = mysql.user_remove("sbclient_2_0", host="localhost")
        assert ret

        # Remove the database
        ret = mysql.db_remove("sbclient_2_0")
        assert ret


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

var buildExt = require('./build-ext');

buildExt(function(err) {
  if (err) {
    process.stderr.write(err + '\n');
    process.exit(1);
  } else {
    process.exit(0);
  }
});


text:
package org.wso2.carbon.apimgt.api.model;

import org.wso2.carbon.apimgt.api.APIProvider;
import org.wso2.carbon.apimgt.api.MonetizationException;
import org.wso2.carbon.apimgt.api.model.policy.SubscriptionPolicy;

import java.util.Map;

/**
 * Interface for monetization
 */

public interface Monetization {

    /**
     * Create billing plan for a policy
     *
     * @param subPolicy subscription policy
     * @return true if successful, false otherwise
     * @throws MonetizationException if the action failed
     */
    boolean createBillingPlan(SubscriptionPolicy subPolicy) throws MonetizationException;

    /**
     * Update billing plan of a policy
     *
     * @param subPolicy subscription policy
     * @return true if successful, false otherwise
     * @throws MonetizationException if the action failed
     */
    boolean updateBillingPlan(SubscriptionPolicy subPolicy) throws MonetizationException;

    /**
     * Delete a billing plan of a policy
     *
     * @param subPolicy subscription policy
     * @return true if successful, false otherwise
     * @throws MonetizationException if the action failed
     */
    boolean deleteBillingPlan(SubscriptionPolicy subPolicy) throws MonetizationException;

    /**
     * Enable monetization for a API
     *
     * @param tenantDomain           tenant domain
     * @param api                    API
     * @param monetizationProperties monetization properties map
     * @return true if successful, false otherwise
     * @throws MonetizationException if the action failed
     */
    boolean enableMonetization(String tenantDomain, API api,
                               Map<String, String> monetizationProperties) throws MonetizationException;

    /**
     * Disable monetization for a API
     *
     * @param tenantDomain           tenant domain
     * @param api                    API
     * @param monetizationProperties monetization properties map
     * @return true if successful, false otherwise
     * @throws MonetizationException if the action failed
     */
    boolean disableMonetization(String tenantDomain, API api,
                                Map<String, String> monetizationProperties) throws MonetizationException;

    /**
     * Get mapping of tiers and billing engine plans
     *
     * @param api API
     * @return tier to billing plan mapping
     * @throws MonetizationException if failed to get tier to billing plan mapping
     */
    Map<String, String> getMonetizedPoliciesToPlanMapping(API api) throws MonetizationException;

    /**
     * Get current usage for a subscription
     *
     * @param subscriptionUUID subscription UUID
     * @param apiProvider      API provider
     * @return current usage for a subscription
     * @throws MonetizationException if failed to get current usage for a subscription
     */
    Map<String, String> getCurrentUsageForSubscription(String subscriptionUUID, APIProvider apiProvider) throws MonetizationException;

    /**
     * Get total revenue for a given API from all subscriptions
     *
     * @param api API
     * @param apiProvider API provider
     * @return total revenue data for a given API from all subscriptions
     * @throws MonetizationException if failed to get total revenue data for a given API
     */
    Map<String, String> getTotalRevenue(API api, APIProvider apiProvider) throws MonetizationException;

    /**
     * Publish the usage for a subscription to the billing engine
     *
     * @return true if the job is successfull, and false otherwise
     * @throws MonetizationException if failed to get current usage for a subscription
     */
    boolean publishMonetizationUsageRecords(MonetizationUsagePublishInfo monetizationUsagePublishInfo)
            throws MonetizationException;

}


text:
/* eslint-disable promise/always-return */
import { runAuthenticatedQuery } from "schema/v2/test/utils"
import gql from "lib/gql"

describe("SaveArtworkMutation", () => {
  it("saves an artwork", () => {
    const mutation = gql`
      mutation {
        saveArtwork(input: { artworkID: "damon-zucconi-slow-verb" }) {
          artwork {
            date
            title
          }
        }
      }
    `

    const mutationResponse = {
      artwork_id: "hello",
    }

    const artwork = {
      date: "2015",
      title: "Slow Verb",
      artists: [],
    }

    const expectedArtworkData = {
      artwork: {
        date: "2015",
        title: "Slow Verb",
      },
    }

    const saveArtworkLoader = () => Promise.resolve(mutationResponse)
    const artworkLoader = () => Promise.resolve(artwork)

    expect.assertions(1)
    return runAuthenticatedQuery(mutation, {
      saveArtworkLoader,
      artworkLoader,
      deleteSavedArtworkLoader: jest.fn(),
    }).then(({ saveArtwork }) => {
      expect(saveArtwork).toEqual(expectedArtworkData)
    })
  })

  it("removes an artwork", () => {
    const mutation = gql`
      mutation {
        saveArtwork(
          input: { artworkID: "damon-zucconi-slow-verb", remove: true }
        ) {
          artwork {
            date
            title
          }
        }
      }
    `

    const mutationResponse = {
      artwork_id: "hello",
    }

    const artwork = {
      date: "2015",
      title: "Slow Verb",
      artists: [],
    }

    const expectedArtworkData = {
      artwork: {
        date: "2015",
        title: "Slow Verb",
      },
    }

    const deleteSavedArtworkLoader = () => Promise.resolve(mutationResponse)
    const artworkLoader = () => Promise.resolve(artwork)

    expect.assertions(1)
    return runAuthenticatedQuery(mutation, {
      deleteSavedArtworkLoader,
      artworkLoader,
      saveArtworkLoader: jest.fn(),
    }).then(({ saveArtwork }) => {
      expect(saveArtwork).toEqual(expectedArtworkData)
    })
  })
})


text:
/*
	author : mourad mourafiq
*/
#include "main.h"

// a sample exported function
void DLL_EXPORT SomeFunction(const LPCSTR sometext)
{
    MessageBoxA(0, sometext, "DLL Message", MB_OK | MB_ICONINFORMATION);
}

BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    switch (fdwReason)
    {
        case DLL_PROCESS_ATTACH:
            // attach to process
            // return FALSE to fail DLL load
            break;

        case DLL_PROCESS_DETACH:
            // detach from process
            break;

        case DLL_THREAD_ATTACH:
            // attach to thread
            break;

        case DLL_THREAD_DETACH:
            // detach from thread
            break;
    }
    return TRUE; // succesful
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<meta name="robots" content="noindex">
<title>time.h File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">

Main Page   Compound List   File List   Header Files   File Members

time.h File Reference
Sort of ANSI compliant time functions.
More...

Typedefs

typedef UINT16 	time_t

Functions

		clock_t 	clock (void) NONBANKED

			The clock() function returns an approximation of processor time used by the program. More...

time_t 	time (time_t *t)

Detailed Description

Sort of ANSI compliant time functions.

Function Documentation

clock_t clock (void)

The clock() function returns an approximation of processor time used by the program.

The value returned is the CPU time used so far as a clock_t; to get the number of seconds used, divide by CLOCKS_PER_SEC.

<address>Generated at Sat Aug 19 19:57:38 2000 for gbdk-lib by

 1.0.0 written by Dimitri van Heesch,
 © 1997-1999</address>


text:
window.addEventListener("load", function()
{
    let div = document.getElementById('buttons');

    let blogButton : HTMLElement = document.createElement('button');
    div.appendChild(blogButton);

    blogButton.innerHTML    = "Blog";
    blogButton.style.left   = "300px";
    blogButton.style.top    = "50px";
    blogButton.addEventListener('click', handleBlogClick);

    let shopButton : HTMLElement = document.createElement('button');
    div.appendChild(shopButton);

    shopButton.innerHTML    = "Shop";
    shopButton.style.left   = "500px";
    shopButton.style.top    = "50px";
    shopButton.addEventListener('click', handleShopClick);

});

function handleBlogClick(e) {
    removeCards();

}

function handleShopClick(e) {
    removeCards();

}

function removeCards() {
    let cards = document.getElementsByTagName('card');
    for (let i = 0, len = cards.length; i != len; ++i) {
        cards[0].parentNode.removeChild(cards[0]);
    }
}


text:
package com.weygo.weygophone.pages.goodDetail.model.response;

import com.weygo.weygophone.base.WGResponse;
import com.weygo.weygophone.pages.goodDetail.model.WGGoodDetail;

/**
 * Created by muma on 2017/6/3.
 */

public class WGGoodDetailResponse extends WGResponse {

    public WGGoodDetail data;

}


text:
<?php

namespace Doctrine\DBAL\Migrations\Tests\Configuration;

abstract class AbstractConfigurationTest extends \Doctrine\DBAL\Migrations\Tests\MigrationTestCase
{
    /**
     * @var \Doctrine\DBAL\Migrations\Configuration\Configuration
     */
    abstract public function loadConfiguration();

    public function testMigrationDirectory()
    {
        $config = $this->loadConfiguration();
        $this->assertEquals("/path/to/migrations/classes/DoctrineMigrations", $config->getMigrationsDirectory());
    }

    public function testMigrationNamespace()
    {
        $config = $this->loadConfiguration();
        $this->assertEquals("DoctrineMigrationsTest", $config->getMigrationsNamespace());
    }

    public function testMigrationName()
    {
        $config = $this->loadConfiguration();
        $this->assertEquals("Doctrine Sandbox Migrations", $config->getName());
    }

    public function testMigrationsTable()
    {
        $config = $this->loadConfiguration();
        $this->assertEquals('doctrine_migration_versions_test', $config->getMigrationsTableName());
    }
}


text:
<!DOCTYPE html>

	<title>Pattern Lab Pattern</title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width" />

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

Definition List

A number of connected items or names written or printed consecutively, typically one below the other.

This is a term.

This is the definition of that term, which both live in a dl.

Here is another term.

And it gets a definition too, which is this line.

Here is term that shares a definition with the term below.

And it gets a definition too, which is this line.


text:
  Caubon-Saint-Sauveur est
       un village
       géographiquement positionné dans le département de Lot-et-Garonne en Aquitaine. Elle comptait 235 habitants en 2008.

Le parc d'habitations, à Caubon-Saint-Sauveur, était réparti en 2011 en un appartements et 123 maisons soit
 un marché relativement équilibré.

À proximité de Caubon-Saint-Sauveur sont situées les communes de
Saint-Géraud à 3 km, 67 habitants,
Beaupuy située à 6 km, 1 294 habitants,
Saint-Vivien-de-Monségur à 5 km, 376 habitants,
Saint-Pierre-sur-Dropt localisée à 6 km, 254 habitants,
Castelnau-sur-Gupie située à 5 km, 786 habitants,
Taillecavat localisée à 6 km, 290 habitants,
 entre autres. De plus, Caubon-Saint-Sauveur est située à seulement dix km de Marmande.

Si vous pensez venir habiter à Caubon-Saint-Sauveur, vous pourrez aisément trouver une maison à vendre.