text:
"""
Tofbot can be enhanced via the use of plugins.

The interface is the Plugin class (defined in toflib.py).

An instance of each plugin is added to bot.plugins via load_plugins.

Basically, for each imported submodule of plugins, a class is a plugin class if
its name starts with "Plugin".

TL;DR : to add a plugin, create a file under plugins/ with a class starting with
"Plugin", and import it in bot.py.
"""


text:
<?php
namespace Gocobachi;

use ArrayIterator;

/**
 * A Collection class to manipulate the arrays with enriched routines
 * and the ability of executing them in chain
 *
 * @author Miguel Gocobachi <miguel@gocobachi.mx>
 */
class Collection extends ArrayIterator
{
    /**
     * Return an native array of this object and its items
     *
     * @return array
     */
    public function all(): array
    {
        return (array) $this;
    }

    /**
     * Return the first element of the array
     *
     * @return mixed
     */
    public function first()
    {
        return current($this->all());
    }

    /**
     * Walk thru the elements of the array and apply a function to each
     *
     * @return self
     */
    public function each(callable $callback)
    {
        foreach ($this->all() as $key => $value) {
            $callback($key, $value);
        }

        return $this;
    }

    /**
     * Applies the callback to the elements of the array
     *
     * @param callback $callback Callback function to run for each element
     *
     * @return self
     */
    public function map(callable $callback): self
    {
        return new static(
            array_map($callback, $this->all())
        );
    }

    /**
     * Filters elements of the array
     *
     * @param callback $callback The callback function to use
     *
     * @return self
     */
    public function filter(callable $callback): self
    {
        return new static(
            array_filter($this->all(), $callback)
        );
    }

    /**
     * Iteratively reduce the array to a single value
     *
     * @param callable $callback The function to be executed to reduce it
     * @param mixed    $initial  Will be used at the beginning of the process
     *
     * @return self
     */
    public function reduce(callable $callback, $initial = null): self
    {
        return new static(
          (array) array_reduce($this->all(), $callback, $initial)
        );
    }

    /**
     * Return an array with elements in reverse order
     *
     * @param bool $keep_keys If set to TRUE numeric keys are preserved
     *
     * @return self
     */
    public function reverse(callable $callback, bool $keep_keys = false): self
    {
        return new static(
            array_reverse($this->all(), $keep_keys)
        );
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>10</logradouro><bairro>Novo Maracanaú</bairro><cidade>Maracanaú</cidade><uf>CE</uf><cep>61905530</cep></feed>


text:
var assert = require("assert");
var authentication = require("../../node/model/Authentication.js");
var User = require("../../node/model/User.js");

/**
 * Tests for the login function that receives data from login database calls
 */
describe("login", function() {

  it("should fail if nothing was returned from the database", function(done) {

    // Check that the login function returns false if it gets no data
    var mockData = [];
    assert.equal(authentication.login(mockData, null), false);

    done();
  });

  it("should succeed and add to session if database returned valid data", function(done) {

    // Mock request & data to allow the function to add data to the session
    var mockUser = {
      email: "someEmail",
      password: "somePassword"
    };
    var mockRequest = {
      session: {}
    };
    var mockData = [mockUser];

    // Check that login returns true and that the user was added to the session
    assert.equal(authentication.login(mockData, mockRequest), true);
    assert.equal(mockRequest.session.user, mockUser);

    done();
  });

});

/**
 * Tests for the register function that receives data from login database calls
 */
describe("register", function() {

  // Mock request to provide to 'register'
  var mockUser = {
    email: "someEmail",
    password: "somePassword"
  };
  var mockRequest = {
    body: mockUser
  };

  it("should fail if data was recieved from database", function(done) {

    // Check that register fails if it receives user data
    var usersFound = [
      {}  // 'empty' user
    ];
    assert.equal(authentication.register(usersFound, mockRequest), false);

    done();
  });

  it("should succeed and add user if no data was received from database", function(done) {

    // Check that registration succeeds if it receives no data
    assert.equal(authentication.register([], mockRequest), true);

    // Fetch this data from the database
    User.getByEmailAndPassword(mockUser.email, mockUser.password)
      .then(function(data) {

        // Check we fetched some data & the user retrieved is our mock user
        assert.equal(data.length > 0, true);
        assert.equal(data[0].email, mockUser.email);

        done();

        // Remove this user
        User.destroy(data[0].id);
      });
  });
});


text:
#ifndef _WX_PRIVATE_OVERLAY_H_
#define _WX_PRIVATE_OVERLAY_H_

#include "wx/overlay.h"

#ifdef wxHAS_NATIVE_OVERLAY

#if defined(__WXMAC__)
    #include "wx/osx/carbon/private/overlay.h"
#elif defined(__WXDFB__)
    #include "wx/dfb/private/overlay.h"
#else
    #error "unknown native wxOverlay implementation"
#endif

#else // !wxHAS_NATIVE_OVERLAY

#include "wx/bitmap.h"

class WXDLLIMPEXP_FWD_CORE wxWindow;

// generic implementation of wxOverlay
class wxOverlayImpl
{
public:
    wxOverlayImpl();
    ~wxOverlayImpl();

    // clears the overlay without restoring the former state
    // to be done eg when the window content has been changed and repainted
    void Reset();

    // returns true if it has been setup
    bool IsOk();

    void Init(wxDC* dc, int x , int y , int width , int height);

    void BeginDrawing(wxDC* dc);

    void EndDrawing(wxDC* dc);

    void Clear(wxDC* dc);

private:
    wxBitmap m_bmpSaved ;
    int m_x ;
    int m_y ;
    int m_width ;
    int m_height ;
    wxWindow* m_window ;
};

#endif // wxHAS_NATIVE_OVERLAY/!wxHAS_NATIVE_OVERLAY

#endif // _WX_PRIVATE_OVERLAY_H_


text:
/**
 * @class Navy.ViewGroup.Button
 */
Navy.Class('Navy.ViewGroup.Button', Navy.ViewGroup.ViewGroup, {
  _imageView: null,
  _textView: null,
  _state: null,

  initialize: function($super, layout, callback) {
    $super(layout, callback);
  },

  _createExtraElement: function($super, layout) {
    $super(layout);

    this._element.addEventListener('touchstart', this._onTouchStart.bind(this));
    this._element.addEventListener('touchend', this._onTouchEnd.bind(this));
  },

  _loadExtraAsset: function($super, layout, callback) {
    $super(layout, callback);
  },

  _applyExtraLayout: function($super, layout, callback) {
    function cb() {
      var size = this._imageView.getSize();
      this._textView.setSizePolicy({width: this.SIZE_POLICY_FIXED, height: this.SIZE_POLICY_FIXED});
      this._textView.setSize(size);

      // TODO: TextViewのextraで設定できるようにする
      this._textView.getElement().style.lineHeight = size.height + 'px';
      this._textView.getElement().style.textAlign = 'center';

      $super(layout, callback);
    }

    if (this._imageView) {
      this.removeView(this._imageView);
    }

    if (this._textView) {
      this.removeView(this._textView);
    }

    var notify = new Navy.Notify(2, cb.bind(this));
    var pass = notify.pass.bind(notify);

    var imageLayout = {};
    imageLayout.id = 'image';
    imageLayout.visible = true;
    imageLayout.pos = {x: 0, y: 0};
    imageLayout.sizePolicy = {width: this.SIZE_POLICY_WRAP_CONTENT, height: this.SIZE_POLICY_WRAP_CONTENT};
    imageLayout.extra = this._cloneObject(layout.extra);
    imageLayout.extra.src = layout.extra.normal.src;
    this._imageView = new Navy.View.Image(imageLayout, pass);
    this.addView(this._imageView);

    var textLayout = {};
    textLayout.id = 'text';
    textLayout.visible = true;
    textLayout.pos = {x:0, y:0};
    textLayout.sizePolicy = {width: this.SIZE_POLICY_WRAP_CONTENT, height: this.SIZE_POLICY_WRAP_CONTENT};
    textLayout.extra = this._cloneObject(layout.extra);
    this._textView = new Navy.View.Text(textLayout, pass);
    this.addView(this._textView);
  },

  _onTouchStart: function(/* ev */) {
    if (!this._layout.extra.active.src) {
      return;
    }

    this.setState('_onTouchStartActive');
  },

  _onTouchEnd: function(/* ev */) {
    if (!this._layout.extra.normal.src) {
      return;
    }

    setTimeout(function(){
      // タップのイベントで外部から状態を変更された場合は、normalに戻さず、その状態を維持する.
      // 例えばタップされたdisabledにするような場合、touch start -> active -> touch end -> disabled -> normal
      // としてしまうと、外部からdisabledに設定したはずなのに強制的にnormalに戻ってしまうのはダメ.
      if (this._state === '_onTouchStartActive') {
        this.setState('normal');
      }
    }.bind(this), 100);
  },

  setState: function(state) {
    switch (state) {
    case 'normal':
      this._imageView.setSrc(this._layout.extra.normal.src);
      break;
    case 'active':
      this._imageView.setSrc(this._layout.extra.active.src);
      break;
    case 'disabled':
      this._imageView.setSrc(this._layout.extra.disabled.src);
      break;
    case '_onTouchStartActive':
      this._imageView.setSrc(this._layout.extra.active.src);
      break;
    default:
      throw new Error('unknown state. ' + state);
      break;
    }
    this._state = state;
  },

  getState: function() {
    return this._state;
  }
});


text:
'use strict';

const models = require('./index');

/**
 * Defines the identity of a resource.
 *
 * @extends models['ResponseBase']
 */
class Identifiable extends models['ResponseBase'] {
  /**
   * Create a Identifiable.
   * @member {string} [id] A String identifier.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of Identifiable
   *
   * @returns {object} metadata of Identifiable
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Identifiable',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: '_type',
          clientName: '_type'
        },
        uberParent: 'ResponseBase',
        className: 'Identifiable',
        modelProperties: {
          _type: {
            required: true,
            serializedName: '_type',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = Identifiable;


text:
package uk.co.exemel.disco.netutil.nio.connected;

import uk.co.exemel.disco.core.api.transcription.Transcribable;
import com.betfair.platform.virtualheap.updates.Update;

public interface UpdateAction extends Transcribable {
    Update getHeapRepresentation();
}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Bragantia racemosa Lour.

### Remarks
null


text:
<?php

namespace App\Http\Controllers;

use App\Cup;
use App\Season;
use App\Services\RankingService;
use Carbon\Carbon;
use Illuminate\Http\Request;

class PublicRankingSeasonController extends Controller
{
    private $ranking_service;

    public function __construct(RankingService $ranking_service)
    {
        $this->ranking_service = $ranking_service;
    }

    public function home(Request $request, $year)
    {
        return app()->call('App\Http\Controllers\RankingSeasonController@index', ['season' => $request->season]);
    }

    public function details(Request $request, $year, Cup $cup)
    {
        return app()->call('App\Http\Controllers\RankingSeasonController@ranking', ['request' => $request, 'season' => $request->season, 'cup' => $cup]);
    }
}


text:
/* crypto/ripemd/rmd_locl.h */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 * All rights reserved.
 *
 * This package is an SSL implementation written
 * by Eric Young (eay@cryptsoft.com).
 * The implementation was written so as to conform with Netscapes SSL.
 *
 * This library is free for commercial and non-commercial use as long as
 * the following conditions are aheared to.  The following conditions
 * apply to all code found in this distribution, be it the RC4, RSA,
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
 * included with this distribution is covered by the same copyright terms
 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
 *
 * Copyright remains Eric Young's, and as such any Copyright notices in
 * the code are not to be removed.
 * If this package is used in a product, Eric Young should be given attribution
 * as the author of the parts of the library used.
 * This can be in the form of a textual message at program startup or
 * in documentation (online or textual) provided with the package.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *    "This product includes cryptographic software written by
 *     Eric Young (eay@cryptsoft.com)"
 *    The word 'cryptographic' can be left out if the rouines from the library
 *    being used are not cryptographic related :-).
 * 4. If you include any Windows specific code (or a derivative thereof) from
 *    the apps directory (application code) you must include an acknowledgement:
 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
 *
 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * The licence and distribution terms for any publically available version or
 * derivative of this code cannot be changed.  i.e. this code cannot simply be
 * copied and put under another distribution licence
 * [including the GNU Public Licence.]
 */

#include <stdlib.h>
#include <string.h>
#include <openssl/opensslconf.h>
#include <openssl/ripemd.h>

/*
 * DO EXAMINE COMMENTS IN crypto/md5/md5_locl.h & crypto/md5/md5_dgst.c
 * FOR EXPLANATIONS ON FOLLOWING "CODE."
 *                                      <appro@fy.chalmers.se>
 */
#ifdef RMD160_ASM
# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__)
#  define ripemd160_block_data_order ripemd160_block_asm_data_order
# endif
#endif

void ripemd160_block_data_order(RIPEMD160_CTX *c, const void *p, size_t num);

#define DATA_ORDER_IS_LITTLE_ENDIAN

#define HASH_LONG               RIPEMD160_LONG
#define HASH_CTX                RIPEMD160_CTX
#define HASH_CBLOCK             RIPEMD160_CBLOCK
#define HASH_UPDATE             RIPEMD160_Update
#define HASH_TRANSFORM          RIPEMD160_Transform
#define HASH_FINAL              RIPEMD160_Final
#define HASH_MAKE_STRING(c,s)   do {    \
        unsigned long ll;               \
        ll=(c)->A; (void)HOST_l2c(ll,(s));      \
        ll=(c)->B; (void)HOST_l2c(ll,(s));      \
        ll=(c)->C; (void)HOST_l2c(ll,(s));      \
        ll=(c)->D; (void)HOST_l2c(ll,(s));      \
        ll=(c)->E; (void)HOST_l2c(ll,(s));      \
        } while (0)
#define HASH_BLOCK_DATA_ORDER   ripemd160_block_data_order

#include "internal/md32_common.h"

/*
 * Transformed F2 and F4 are courtesy of Wei Dai <weidai@eskimo.com>
 */
#define F1(x,y,z)       ((x) ^ (y) ^ (z))
#define F2(x,y,z)       ((((y) ^ (z)) & (x)) ^ (z))
#define F3(x,y,z)       (((~(y)) | (x)) ^ (z))
#define F4(x,y,z)       ((((x) ^ (y)) & (z)) ^ (y))
#define F5(x,y,z)       (((~(z)) | (y)) ^ (x))

#define RIPEMD160_A     0x67452301L
#define RIPEMD160_B     0xEFCDAB89L
#define RIPEMD160_C     0x98BADCFEL
#define RIPEMD160_D     0x10325476L
#define RIPEMD160_E     0xC3D2E1F0L

#include "rmdconst.h"

#define RIP1(a,b,c,d,e,w,s) { \
        a+=F1(b,c,d)+X(w); \
        a=ROTATE(a,s)+e; \
        c=ROTATE(c,10); }

#define RIP2(a,b,c,d,e,w,s,K) { \
        a+=F2(b,c,d)+X(w)+K; \
        a=ROTATE(a,s)+e; \
        c=ROTATE(c,10); }

#define RIP3(a,b,c,d,e,w,s,K) { \
        a+=F3(b,c,d)+X(w)+K; \
        a=ROTATE(a,s)+e; \
        c=ROTATE(c,10); }

#define RIP4(a,b,c,d,e,w,s,K) { \
        a+=F4(b,c,d)+X(w)+K; \
        a=ROTATE(a,s)+e; \
        c=ROTATE(c,10); }

#define RIP5(a,b,c,d,e,w,s,K) { \
        a+=F5(b,c,d)+X(w)+K; \
        a=ROTATE(a,s)+e; \
        c=ROTATE(c,10); }


text:
package org.apache.flink.runtime.executiongraph.failover.flip1;

import org.apache.flink.util.TestLogger;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

import static org.apache.flink.runtime.executiongraph.failover.flip1.StronglyConnectedComponentsComputeUtils.computeStronglyConnectedComponents;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

/**
 * Unit tests for {@link StronglyConnectedComponentsComputeUtils}.
 */
public class StronglyConnectedComponentsComputeUtilsTest extends TestLogger {

	@Test
	public void testWithCycles() {
		final List<List<Integer>> edges = Arrays.asList(
			Arrays.asList(2, 3),
			Arrays.asList(0),
			Arrays.asList(1),
			Arrays.asList(4),
			Collections.emptyList());

		final Set<Set<Integer>> result = computeStronglyConnectedComponents(5, edges);

		final Set<Set<Integer>> expected = new HashSet<>();
		expected.add(new HashSet<>(Arrays.asList(0, 1, 2)));
		expected.add(Collections.singleton(3));
		expected.add(Collections.singleton(4));

		assertThat(result, is(expected));
	}

	@Test
	public void testWithMultipleCycles() {
		final List<List<Integer>> edges = Arrays.asList(
			Arrays.asList(1),
			Arrays.asList(2),
			Arrays.asList(0),
			Arrays.asList(1, 2, 4),
			Arrays.asList(3, 5),
			Arrays.asList(2, 6),
			Arrays.asList(5),
			Arrays.asList(4, 6, 7));

		final Set<Set<Integer>> result = computeStronglyConnectedComponents(8, edges);

		final Set<Set<Integer>> expected = new HashSet<>();
		expected.add(new HashSet<>(Arrays.asList(0, 1, 2)));
		expected.add(new HashSet<>(Arrays.asList(3, 4)));
		expected.add(new HashSet<>(Arrays.asList(5, 6)));
		expected.add(Collections.singleton(7));

		assertThat(result, is(expected));
	}

	@Test
	public void testWithConnectedCycles() {
		final List<List<Integer>> edges = Arrays.asList(
			Arrays.asList(1),
			Arrays.asList(2, 4, 5),
			Arrays.asList(3, 6),
			Arrays.asList(2, 7),
			Arrays.asList(0, 5),
			Arrays.asList(6),
			Arrays.asList(5),
			Arrays.asList(3, 6));

		final Set<Set<Integer>> result = computeStronglyConnectedComponents(8, edges);

		final Set<Set<Integer>> expected = new HashSet<>();
		expected.add(new HashSet<>(Arrays.asList(0, 1, 4)));
		expected.add(new HashSet<>(Arrays.asList(2, 3, 7)));
		expected.add(new HashSet<>(Arrays.asList(5, 6)));

		assertThat(result, is(expected));
	}

	@Test
	public void testWithNoEdge() {
		final List<List<Integer>> edges = Arrays.asList(
			Collections.emptyList(),
			Collections.emptyList(),
			Collections.emptyList(),
			Collections.emptyList(),
			Collections.emptyList());

		final Set<Set<Integer>> result = computeStronglyConnectedComponents(5, edges);

		final Set<Set<Integer>> expected = new HashSet<>();
		expected.add(Collections.singleton(0));
		expected.add(Collections.singleton(1));
		expected.add(Collections.singleton(2));
		expected.add(Collections.singleton(3));
		expected.add(Collections.singleton(4));

		assertThat(result, is(expected));
	}

	@Test
	public void testWithNoCycle() {
		final List<List<Integer>> edges = Arrays.asList(
			Arrays.asList(1),
			Arrays.asList(2),
			Arrays.asList(3),
			Arrays.asList(4),
			Collections.emptyList());

		final Set<Set<Integer>> result = computeStronglyConnectedComponents(5, edges);

		final Set<Set<Integer>> expected = new HashSet<>();
		expected.add(Collections.singleton(0));
		expected.add(Collections.singleton(1));
		expected.add(Collections.singleton(2));
		expected.add(Collections.singleton(3));
		expected.add(Collections.singleton(4));

		assertThat(result, is(expected));
	}

	@Test
	public void testLargeGraph() {
		final int n = 100000;
		final List<List<Integer>> edges = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			edges.add(Collections.singletonList((i + 1) % n));
		}

		final Set<Set<Integer>> result = computeStronglyConnectedComponents(n, edges);

		final Set<Integer> singleComponent = IntStream.range(0, n).boxed().collect(Collectors.toSet());

		assertThat(result, is(Collections.singleton(singleComponent)));
	}
}


text:
<?php

namespace Systream\Mail\MailQueueItem;

use Systream\Mail\Formatters\MessageFormatterInterface;
use Systream\Mail\Message\MessageInterface;

interface MailQueueItemInterface
{
	/**
	 * @return MessageInterface
	 */
	public function getMessage();

	/**
	 * @return MessageFormatterInterface[]
	 */
	public function getMessageFormatters();

	/**
	 * @return \DateTimeInterface|null
	 */
	public function getScheduledSendingTime();

	/**
	 * @return int
	 */
	public function getPriority();

	/**
	 * @return string
	 */
	public function getId();

	/**
	 * @return array
	 */
	public function toArray();
}


text:
package client

import (
	"encoding/json"
	"fmt"
	"net/http"
	"strconv"

	"github.com/tsuru/gnuflag"
	"github.com/tsuru/tablecli"
	"github.com/tsuru/tsuru/cmd"
	apptypes "github.com/tsuru/tsuru/types/app"
	"k8s.io/apimachinery/pkg/api/resource"
)

type PlanList struct {
	bytes bool
	fs    *gnuflag.FlagSet
}

func (c *PlanList) Flags() *gnuflag.FlagSet {
	if c.fs == nil {
		c.fs = gnuflag.NewFlagSet("plan-list", gnuflag.ExitOnError)
		bytes := "bytesized units for memory and swap."
		c.fs.BoolVar(&c.bytes, "bytes", false, bytes)
		c.fs.BoolVar(&c.bytes, "b", false, bytes)
	}
	return c.fs
}

func (c *PlanList) Info() *cmd.Info {
	return &cmd.Info{
		Name:    "plan-list",
		Usage:   "plan list [--bytes]",
		Desc:    "List available plans that can be used when creating an app.",
		MinArgs: 0,
	}
}

func renderPlans(plans []apptypes.Plan, isBytes, showDefaultColumn bool) string {
	table := tablecli.NewTable()
	table.Headers = []string{"Name", "CPU", "Memory"}
	hasSwap := false

	for _, p := range plans {
		if p.Swap > 0 {
			hasSwap = true
		}
	}

	if hasSwap {
		table.Headers = append(table.Headers, "Swap")
	}

	if showDefaultColumn {
		table.Headers = append(table.Headers, "Default")
	}

	for _, p := range plans {
		var cpu, memory, swap string
		if isBytes {
			memory = fmt.Sprintf("%d", p.Memory)
			swap = fmt.Sprintf("%d", p.Swap)
		} else {
			memory = resource.NewQuantity(p.Memory, resource.BinarySI).String()
			swap = resource.NewQuantity(p.Swap, resource.BinarySI).String()
		}

		if p.Override.CPUMilli != nil {
			cpu = fmt.Sprintf("%g", float64(*p.Override.CPUMilli)/10) + "% (override)"
		} else if p.CPUMilli > 0 {
			cpu = fmt.Sprintf("%g", float64(p.CPUMilli)/10) + "%"
		} else {
			cpu = fmt.Sprintf("%d (CPU share)", p.CpuShare)
		}

		if p.Override.Memory != nil {
			memory = resource.NewQuantity(*p.Override.Memory, resource.BinarySI).String() + " (override)"
		}

		row := []string{
			p.Name,
			cpu,
			memory,
		}

		if hasSwap {
			row = append(row, swap)
		}

		if showDefaultColumn {
			row = append(row, strconv.FormatBool(p.Default))
		}
		table.AddRow(row)
	}
	return table.String()
}

func (c *PlanList) Run(context *cmd.Context, client *cmd.Client) error {
	url, err := cmd.GetURL("/plans")
	if err != nil {
		return err
	}
	request, err := http.NewRequest("GET", url, nil)
	if err != nil {
		return err
	}
	var plans []apptypes.Plan
	resp, err := client.Do(request)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	if resp.StatusCode == http.StatusNoContent {
		fmt.Fprintln(context.Stdout, "No plans available.")
		return nil
	}
	err = json.NewDecoder(resp.Body).Decode(&plans)
	if err != nil {
		return err
	}
	fmt.Fprintf(context.Stdout, "%s", renderPlans(plans, c.bytes, true))
	return nil
}


text:
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE.md) [![Haxelib Version](https://img.shields.io/github/tag/openfl/swf.svg?style=flat&label=haxelib)](http://lib.haxe.org/p/swf)

SWF
===

Provides SWF parsing and rendering for C++, Flash and HTML5

Usage
=====

First, make sure that `<haxelib name="swf" />` has been added to your project.

Then, you can add `<library path="to/your.swf" preload="true" />` to include a SWF library. This will be available at runtime using the file name of the SWF (minus the ".swf") or you can add 'id="my-unique-id"' to specify a custom name.

There is a (beta) option for 'generate="true"' to generate Haxe classes for each "Export for ActionScript" type in the SWF file. The 'preload' is also optional, but is recommended to simplify use.

You can create an "Export for ActionScript" clip from a SWF like this:

    var clip = Assets.getMovieClip ("my-swf:MyMovieClipName");

If you would prefer to create the whole timeline, use an empty clip name:

    var timeline = Assets.getMovieClip ("my-swf:");

If you use the 'generate' option, you would instead create a new instance like this:

    var clip = new MyMovieClipName ();

Installation
============

You can easily install SWF using haxelib:

    haxelib install swf

To add it to a Lime or OpenFL project, add this to your project file:

    <haxelib name="swf" />

Development Builds
==================

Clone the SWF repository:

    git clone https://github.com/openfl/swf

Tell haxelib where your development copy of SWF is installed:

    haxelib dev swf swf

To return to release builds:

    haxelib dev swf


text:
using Detached.Mappers.Model;
using Microsoft.EntityFrameworkCore;

namespace Detached.Mappers
{
    public interface IMapperCustomizer
    {
        void Customize(DbContext dbContext, MapperOptions mapperOptions);
    }
}


text:
#ifndef _I386_SYNC_BITOPS_H
#define _I386_SYNC_BITOPS_H

/*
 * These have to be done with inline assembly: that way the bit-setting
 * is guaranteed to be atomic. All bit operations return 0 if the bit
 * was cleared before the operation and != 0 if it was not.
 *
 * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1).
 */

#define ADDR (*(volatile long *) addr)

/**
 * sync_set_bit - Atomically set a bit in memory
 * @nr: the bit to set
 * @addr: the address to start counting from
 *
 * This function is atomic and may not be reordered.  See __set_bit()
 * if you do not require the atomic guarantees.
 *
 * Note: there are no guarantees that this function will not be reordered
 * on non-x86 architectures, so if you are writing portable code,
 * make sure not to rely on its reordering guarantees.
 *
 * Note that @nr may be almost arbitrarily large; this function is not
 * restricted to acting on a single-word quantity.
 */
static inline void sync_set_bit(int nr, volatile unsigned long * addr)
{
	__asm__ __volatile__("lock; btsl %1,%0"
			     :"+m" (ADDR)
			     :"Ir" (nr)
			     : "memory");
}

/**
 * sync_clear_bit - Clears a bit in memory
 * @nr: Bit to clear
 * @addr: Address to start counting from
 *
 * sync_clear_bit() is atomic and may not be reordered.  However, it does
 * not contain a memory barrier, so if it is used for locking purposes,
 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
 * in order to ensure changes are visible on other processors.
 */
static inline void sync_clear_bit(int nr, volatile unsigned long * addr)
{
	__asm__ __volatile__("lock; btrl %1,%0"
			     :"+m" (ADDR)
			     :"Ir" (nr)
			     : "memory");
}

/**
 * sync_change_bit - Toggle a bit in memory
 * @nr: Bit to change
 * @addr: Address to start counting from
 *
 * change_bit() is atomic and may not be reordered. It may be
 * reordered on other architectures than x86.
 * Note that @nr may be almost arbitrarily large; this function is not
 * restricted to acting on a single-word quantity.
 */
static inline void sync_change_bit(int nr, volatile unsigned long * addr)
{
	__asm__ __volatile__("lock; btcl %1,%0"
			     :"+m" (ADDR)
			     :"Ir" (nr)
			     : "memory");
}

/**
 * sync_test_and_set_bit - Set a bit and return its old value
 * @nr: Bit to set
 * @addr: Address to count from
 *
 * This operation is atomic and cannot be reordered.
 * It may be reordered on other architectures than x86.
 * It also implies a memory barrier.
 */
static inline int sync_test_and_set_bit(int nr, volatile unsigned long * addr)
{
	int oldbit;

	__asm__ __volatile__("lock; btsl %2,%1\n\tsbbl %0,%0"
			     :"=r" (oldbit),"+m" (ADDR)
			     :"Ir" (nr) : "memory");
	return oldbit;
}

/**
 * sync_test_and_clear_bit - Clear a bit and return its old value
 * @nr: Bit to clear
 * @addr: Address to count from
 *
 * This operation is atomic and cannot be reordered.
 * It can be reorderdered on other architectures other than x86.
 * It also implies a memory barrier.
 */
static inline int sync_test_and_clear_bit(int nr, volatile unsigned long * addr)
{
	int oldbit;

	__asm__ __volatile__("lock; btrl %2,%1\n\tsbbl %0,%0"
			     :"=r" (oldbit),"+m" (ADDR)
			     :"Ir" (nr) : "memory");
	return oldbit;
}

/**
 * sync_test_and_change_bit - Change a bit and return its old value
 * @nr: Bit to change
 * @addr: Address to count from
 *
 * This operation is atomic and cannot be reordered.
 * It also implies a memory barrier.
 */
static inline int sync_test_and_change_bit(int nr, volatile unsigned long* addr)
{
	int oldbit;

	__asm__ __volatile__("lock; btcl %2,%1\n\tsbbl %0,%0"
			     :"=r" (oldbit),"+m" (ADDR)
			     :"Ir" (nr) : "memory");
	return oldbit;
}

static __always_inline int sync_constant_test_bit(int nr, const volatile unsigned long *addr)
{
	return ((1UL << (nr & 31)) &
		(((const volatile unsigned int *)addr)[nr >> 5])) != 0;
}

static inline int sync_var_test_bit(int nr, const volatile unsigned long * addr)
{
	int oldbit;

	__asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
			     :"=r" (oldbit)
			     :"m" (ADDR),"Ir" (nr));
	return oldbit;
}

#define sync_test_bit(nr,addr)			\
	(__builtin_constant_p(nr) ?		\
	 sync_constant_test_bit((nr),(addr)) :	\
	 sync_var_test_bit((nr),(addr)))

#undef ADDR

#endif /* _I386_SYNC_BITOPS_H */


text:
#ifndef Vca_IBSProducerClient_Interface
#define Vca_IBSProducerClient_Interface

#ifndef Vca_IBSProducerClient
#define Vca_IBSProducerClient extern
#endif

/*********************
 *****  Library  *****
 *********************/

#include "Vca.h"

/************************
 *****  Components  *****
 ************************/

#include "Vca_IBSClient.h"

/**************************
 *****  Declarations  *****
 **************************/

/*************************
 *****  Definitions  *****
 *************************/

VINTERFACE_TEMPLATE_INSTANTIATIONS (Vca,IBSProducerClient)

namespace Vca {
    class VBSProducer;

    VINTERFACE_ROLE (IBSProducerClient, IBSClient)
    VINTERFACE_ROLE_END

    VcaINTERFACE (IBSProducerClient, IBSClient)
    VINTERFACE_END
}

#endif


text:
import * as VuePlugin from './vue-plugin'

export * from './vue-plugin'
export default VuePlugin


text:
<?xml version="1.0" encoding="UTF-8"?>
<table sqlname="auth_phone_transactions">
    <operation name="Insert">
        <sql>
            INSERT INTO auth_phone_transactions
                (auth_key_id, phone_number, code, code_expired, transaction_hash, sent_code_type, flash_call_pattern, next_code_type, state, api_id, api_hash, 	created_time)
            VALUES
                (:auth_key_id, :phone_number, :code, :code_expired, :transaction_hash, :sent_code_type, :flash_call_pattern, :next_code_type, :state, :api_id, :api_hash, :created_time)
        </sql>
    </operation>
    <operation name="SelectByPhoneCodeHash">
        <sql>
            SELECT
                id, code, code_expired, sent_code_type, flash_call_pattern, next_code_type, attempts, state
            FROM
                auth_phone_transactions
            WHERE
                auth_key_id = :auth_key_id AND phone_number = :phone_number AND transaction_hash = :transaction_hash
        </sql>
    </operation>
    <operation name="UpdateState">
        <sql>
            UPDATE auth_phone_transactions SET state = :state WHERE id = :id
        </sql>
    </operation>
    <operation name="Delete">
        <sql>
            UPDATE auth_phone_transactions SET state = :state
            WHERE
                auth_key_id = :auth_key_id AND phone_number = :phone_number AND transaction_hash = :transaction_hash
        </sql>
    </operation>
    <operation name="UpdateAttempts">
        <sql>
            UPDATE auth_phone_transactions SET attempts = attempts + 1 WHERE id = :id
        </sql>
    </operation>
</table>


text:
<?php

namespace lb\components;

use lb\BaseClass;
use lb\components\distribution\FlexiHash;

class LoadBalancer extends BaseClass
{
    public static function getTargetHost($hosts)
    {
        if (!is_array($hosts)) {
            if (strpos($hosts, ',') !== false) {
                $hosts = explode(',', $hosts);
            } else {
                return $hosts;
            }
        }

        return FlexiHash::component()->addServers($hosts)->lookup();
    }
}


text:
import { FieldSchema, StructureSchema } from '@ephox/boulder';
import { Optional } from '@ephox/katamari';

import { NamedConfiguredBehaviour } from '../api/behaviour/Behaviour';
import { Receiving } from '../api/behaviour/Receiving';
import { Sandboxing } from '../api/behaviour/Sandboxing';
import { AlloyComponent } from '../api/component/ComponentApi';
import * as AlloyTriggers from '../api/events/AlloyTriggers';
import * as SystemEvents from '../api/events/SystemEvents';
import * as Channels from '../api/messages/Channels';
import { ReceivingChannelSpec, ReceivingConfig, ReceivingConfigSpec } from '../behaviour/receiving/ReceivingTypes';

export interface RepositionReceivingDetail {
  doReposition: (sandbox: AlloyComponent) => void;
  fireEventInstead: Optional<{
    event: string;
  }>;
}

export interface RepositionReceivingSpec {
  doReposition: (sandbox: AlloyComponent) => void;
  fireEventInstead?: {
    event?: string;
  };
}

const schema = StructureSchema.objOfOnly([
  FieldSchema.optionObjOf('fireEventInstead', [
    FieldSchema.defaulted('event', SystemEvents.repositionRequested())
  ]),
  FieldSchema.requiredFunction('doReposition')
]);

const receivingConfig = (rawSpec: RepositionReceivingSpec): NamedConfiguredBehaviour<ReceivingConfigSpec, ReceivingConfig> => {
  const c = receivingChannel(rawSpec);
  return Receiving.config({
    channels: c
  });
};

const receivingChannel = (rawSpec: RepositionReceivingSpec): Record<string, ReceivingChannelSpec> => {
  const detail: RepositionReceivingDetail = StructureSchema.asRawOrDie('Reposition', schema, rawSpec);
  return {
    [Channels.repositionPopups()]: {
      onReceive: (sandbox: AlloyComponent) => {
        if (Sandboxing.isOpen(sandbox)) {
          detail.fireEventInstead.fold(
            () => detail.doReposition(sandbox),
            (fe) => AlloyTriggers.emit(sandbox, fe.event)
          );
        }
      }
    }
  };
};

export {
  receivingChannel,
  receivingConfig
};


text:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>lwres_getnameinfo</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.71.1">

Name

lwres_getnameinfo — lightweight resolver socket address structure to hostname and
      service name

Synopsis

#include <lwres/netdb.h>

int
lwres_getnameinfo(
const struct sockaddr *

<var class="pdparam">sa</var>,

size_t

<var class="pdparam">salen</var>,

char *

<var class="pdparam">host</var>,

size_t

<var class="pdparam">hostlen</var>,

char *

<var class="pdparam">serv</var>,

size_t

<var class="pdparam">servlen</var>,

int

<var class="pdparam">flags</var>);

DESCRIPTION

       This function is equivalent to the
      getnameinfo(3) function defined in RFC2133.
      lwres_getnameinfo() returns the
      hostname for the
      struct sockaddr sa which
      is
      salen bytes long.  The hostname is of
      length
      hostlen and is returned via
      *host. The maximum length of the
      hostname is
      1025 bytes: NI_MAXHOST.

 The name of the service associated with the port number in
      sa is returned in *serv.
      It is servlen bytes long.  The
      maximum length
      of the service name is NI_MAXSERV - 32
      bytes.

       The flags argument sets the
      following
      bits:

NI_NOFQDN

              A fully qualified domain name is not required for local hosts.
              The local part of the fully qualified domain name is returned
              instead.

NI_NUMERICHOST

              Return the address in numeric form, as if calling inet_ntop(),
              instead of a host name.

NI_NAMEREQD

              A name is required. If the hostname cannot be found in the DNS
              and
              this flag is set, a non-zero error code is returned.
              If the hostname is not found and the flag is not set, the
              address is returned in numeric form.

NI_NUMERICSERV

              The service name is returned as a digit string representing the
              port number.

NI_DGRAM

              Specifies that the service being looked up is a datagram
              service,  and causes getservbyport() to be called with a second
              argument of "udp" instead of its default of "tcp".  This is
              required
              for the few ports (512-514) that have different services for UDP
              and
              TCP.

RETURN VALUES

lwres_getnameinfo()
      returns 0 on success or a non-zero error code if an error occurs.

SEE ALSO

RFC2133,
      getservbyport(3),
      lwres(3),
      lwres_getnameinfo(3),
      lwres_getnamebyaddr(3).
      lwres_net_ntop(3).

BUGS

      RFC2133 fails to define what the nonzero return values of
      getnameinfo(3)
      are.


text:
package org.omg.PortableServer;

//
// IDL:omg.org/PortableServer/POA:2.3
//
/***/

public interface POAOperations
{
    //
    // IDL:omg.org/PortableServer/POA/create_POA:1.0
    //
    /***/

    POA
    create_POA(String adapter_name,
               POAManager a_POAManager,
               org.omg.CORBA.Policy[] policies)
        throws org.omg.PortableServer.POAPackage.AdapterAlreadyExists,
               org.omg.PortableServer.POAPackage.InvalidPolicy;

    //
    // IDL:omg.org/PortableServer/POA/find_POA:1.0
    //
    /***/

    POA
    find_POA(String adapter_name,
             boolean activate_it)
        throws org.omg.PortableServer.POAPackage.AdapterNonExistent;

    //
    // IDL:omg.org/PortableServer/POA/destroy:1.0
    //
    /***/

    void
    destroy(boolean etherealize_objects,
            boolean wait_for_completion);

    //
    // IDL:omg.org/PortableServer/POA/create_thread_policy:1.0
    //
    /***/

    ThreadPolicy
    create_thread_policy(ThreadPolicyValue value);

    //
    // IDL:omg.org/PortableServer/POA/create_lifespan_policy:1.0
    //
    /***/

    LifespanPolicy
    create_lifespan_policy(LifespanPolicyValue value);

    //
    // IDL:omg.org/PortableServer/POA/create_id_uniqueness_policy:1.0
    //
    /***/

    IdUniquenessPolicy
    create_id_uniqueness_policy(IdUniquenessPolicyValue value);

    //
    // IDL:omg.org/PortableServer/POA/create_id_assignment_policy:1.0
    //
    /***/

    IdAssignmentPolicy
    create_id_assignment_policy(IdAssignmentPolicyValue value);

    //
    // IDL:omg.org/PortableServer/POA/create_implicit_activation_policy:1.0
    //
    /***/

    ImplicitActivationPolicy
    create_implicit_activation_policy(ImplicitActivationPolicyValue value);

    //
    // IDL:omg.org/PortableServer/POA/create_servant_retention_policy:1.0
    //
    /***/

    ServantRetentionPolicy
    create_servant_retention_policy(ServantRetentionPolicyValue value);

    //
    // IDL:omg.org/PortableServer/POA/create_request_processing_policy:1.0
    //
    /***/

    RequestProcessingPolicy
    create_request_processing_policy(RequestProcessingPolicyValue value);

    //
    // IDL:omg.org/PortableServer/POA/the_name:1.0
    //
    /***/

    String
    the_name();

    //
    // IDL:omg.org/PortableServer/POA/the_parent:1.0
    //
    /***/

    POA
    the_parent();

    //
    // IDL:omg.org/PortableServer/POA/the_children:1.0
    //
    /***/

    POA[]
    the_children();

    //
    // IDL:omg.org/PortableServer/POA/the_POAManager:1.0
    //
    /***/

    POAManager
    the_POAManager();

    //
    // IDL:omg.org/PortableServer/POA/the_POAManagerFactory:1.0
    //
    /***/

    POAManagerFactory
    the_POAManagerFactory();

    //
    // IDL:omg.org/PortableServer/POA/id:1.0
    //
    /***/

    byte[]
    id();

    //
    // IDL:omg.org/PortableServer/POA/the_activator:1.0
    //
    /***/

    AdapterActivator
    the_activator();

    void
    the_activator(AdapterActivator val);

    //
    // IDL:omg.org/PortableServer/POA/get_servant_manager:1.0
    //
    /***/

    ServantManager
    get_servant_manager()
        throws org.omg.PortableServer.POAPackage.WrongPolicy;

    //
    // IDL:omg.org/PortableServer/POA/set_servant_manager:1.0
    //
    /***/

    void
    set_servant_manager(ServantManager imgr)
        throws org.omg.PortableServer.POAPackage.WrongPolicy;

    //
    // IDL:omg.org/PortableServer/POA/get_servant:1.0
    //
    /***/

    Servant
    get_servant()
        throws org.omg.PortableServer.POAPackage.NoServant,
               org.omg.PortableServer.POAPackage.WrongPolicy;

    //
    // IDL:omg.org/PortableServer/POA/set_servant:1.0
    //
    /***/

    void
    set_servant(Servant p_servant)
        throws org.omg.PortableServer.POAPackage.WrongPolicy;

    //
    // IDL:omg.org/PortableServer/POA/activate_object:1.0
    //
    /***/

    byte[]
    activate_object(Servant p_servant)
        throws org.omg.PortableServer.POAPackage.ServantAlreadyActive,
               org.omg.PortableServer.POAPackage.WrongPolicy;

    //
    // IDL:omg.org/PortableServer/POA/activate_object_with_id:1.0
    //
    /***/

    void
    activate_object_with_id(byte[] id,
                            Servant p_servant)
        throws org.omg.PortableServer.POAPackage.ServantAlreadyActive,
               org.omg.PortableServer.POAPackage.ObjectAlreadyActive,
               org.omg.PortableServer.POAPackage.WrongPolicy;

    //
    // IDL:omg.org/PortableServer/POA/deactivate_object:1.0
    //
    /***/

    void
    deactivate_object(byte[] oid)
        throws org.omg.PortableServer.POAPackage.ObjectNotActive,
               org.omg.PortableServer.POAPackage.WrongPolicy;

    //
    // IDL:omg.org/PortableServer/POA/create_reference:1.0
    //
    /***/

    org.omg.CORBA.Object
    create_reference(String intf)
        throws org.omg.PortableServer.POAPackage.WrongPolicy;

    //
    // IDL:omg.org/PortableServer/POA/create_reference_with_id:1.0
    //
    /***/

    org.omg.CORBA.Object
    create_reference_with_id(byte[] oid,
                             String intf);

    //
    // IDL:omg.org/PortableServer/POA/servant_to_id:1.0
    //
    /***/

    byte[]
    servant_to_id(Servant p_servant)
        throws org.omg.PortableServer.POAPackage.ServantNotActive,
               org.omg.PortableServer.POAPackage.WrongPolicy;

    //
    // IDL:omg.org/PortableServer/POA/servant_to_reference:1.0
    //
    /***/

    org.omg.CORBA.Object
    servant_to_reference(Servant p_servant)
        throws org.omg.PortableServer.POAPackage.ServantNotActive,
               org.omg.PortableServer.POAPackage.WrongPolicy;

    //
    // IDL:omg.org/PortableServer/POA/reference_to_servant:1.0
    //
    /***/

    Servant
    reference_to_servant(org.omg.CORBA.Object reference)
        throws org.omg.PortableServer.POAPackage.ObjectNotActive,
               org.omg.PortableServer.POAPackage.WrongAdapter,
               org.omg.PortableServer.POAPackage.WrongPolicy;

    //
    // IDL:omg.org/PortableServer/POA/reference_to_id:1.0
    //
    /***/

    byte[]
    reference_to_id(org.omg.CORBA.Object reference)
        throws org.omg.PortableServer.POAPackage.WrongAdapter,
               org.omg.PortableServer.POAPackage.WrongPolicy;

    //
    // IDL:omg.org/PortableServer/POA/id_to_servant:1.0
    //
    /***/

    Servant
    id_to_servant(byte[] oid)
        throws org.omg.PortableServer.POAPackage.ObjectNotActive,
               org.omg.PortableServer.POAPackage.WrongPolicy;

    //
    // IDL:omg.org/PortableServer/POA/id_to_reference:1.0
    //
    /***/

    org.omg.CORBA.Object
    id_to_reference(byte[] oid)
        throws org.omg.PortableServer.POAPackage.ObjectNotActive,
               org.omg.PortableServer.POAPackage.WrongPolicy;
}


text:
import RPi.GPIO as GPIO
from time import sleep
import serial

BAUDRATE = 9600
ser = None

# BCM to WiringPi pin numbers
P0 = 17 # not used
P1 = 18 # not used
P2 = 27 # not used - only for rev 2 pi
P3 = 22 # not used
P4 = 23 # not used
P5 = 24 # not used
p6 = 25 # rx enable
p7 = 4  # tx enable

def Init():
    GPIO.setwarnings(False) # suppress GPIO used message
    GPIO.setmode(GPIO.BCM) # use BCM pin numbers
    GPIO.setup(p6, GPIO.OUT)
    GPIO.setup(p7, GPIO.OUT)
    #Setup serial port
    DisableTX() #don't send to garbage on the bus
    EnableRX()
    global ser
    ser = serial.Serial("/dev/ttyAMA0",BAUDRATE)

def EnableRX():
    GPIO.output(p6, GPIO.LOW)
    sleep(0.1)

def DisableRX():
    GPIO.output(p6, GPIO.HIGH)

def EnableTX():
    GPIO.output(p7, GPIO.HIGH)

def DisableTX():
    sleep(0.1) #wait 100ms before disable
    #to prevent disabling before sending
    GPIO.output(p7, GPIO.LOW)

def SendMSG(dst, src="A", data=""):
    NUL = chr(0)
    LEN = len(data)
    if LEN > 99:
        raise Exception("data cannot be more than 99")
    msg = [NUL] #Preamble
    msg.append(dst) #Destination
    msg.append(src) #Source, RPi is first device (always A)
    lenStr = format(LEN, "02d") #Length must be a string
    msg.append(lenStr[0]) #ten
    msg.append(lenStr[1]) #unit
    msg = msg + list("".join(data)) #append data
    checkSum = 0 #compute checksum
    for char in msg[1:]:
        num = ord(char) #char to decimal
        checkSum+=num
    checkSum = checkSum & 0xFF #Keep under 256
    msg.append(chr(checkSum)) #Back to ASCII
    payload = "".join(msg) #List to string
    EnableTX()
    ser.write(payload) #send the string
    DisableTX()

#Return a str instead of sending on serial port
def SendMSG2(dst, src="A", data=""):
    NUL = "0"# chr(0)
    LEN = len(data)
    if LEN > 99:
        raise Exception("data cannot be more than 99")
    msg = [NUL] #Preamble
    msg.append(dst) #Destination
    msg.append(src) #Source, RPi is first device (always A)
    lenStr = format(LEN, "02d") #Length must be a string
    msg.append(lenStr[0]) #ten
    msg.append(lenStr[1]) #unit
    msg = msg + list("".join(data)) #append data
    checkSum = 0 #compute checksum
    for char in msg[1:]:
        num = ord(char) #char to decimal
        checkSum+=num
    checkSum = checkSum & 0xFF #Keep under 256
    msg.append(chr(checkSum)) #Back to ASCII
    payload = "".join(msg) #List to string
    return payload

def Poll(dst):
    SendMSG(dst)

def Store(dst, topic):
    SendMSG(dst, data="!"+topic)

def Fetch(dst, topic):
    SendMSG(dst, data="@"+topic)

def ReadMSG():
    EnableRX()
    NUL = chr(0)
    HEADER_LEN = 4
    OFFSET_LEN = 3
    char = NUL
    #Wait for beginning of data
    while char == NUL:
        char = ser.read(1)
    header = char + ser.read(HEADER_LEN-1)
    lenStr = header[OFFSET_LEN:HEADER_LEN+1]
    DATA_LEN = int(lenStr)
    data = ser.read(DATA_LEN+1) #include checksum
    payload = header+data
    checkSum = 0 #compute checksum
    for char in payload[:-1]:
        num = ord(char) #char to decimal
        checkSum+=num
    checkSum = checkSum & 0xFF #Keep under 256
    if checkSum != ord(payload[-1]):
        raise Exception("Checksum error in ReadMSG")
    #print checkSum
    DisableRX()
    return payload[:-1]

#Read from string instead of serial port
def ReadMSG2(payload):
    HEADER_LEN = 5
    OFFSET_LEN = 3
    header = payload[:HEADER_LEN]
    lenStr = header[OFFSET_LEN:HEADER_LEN]
    DATA_LEN = int(lenStr)
    data = payload[HEADER_LEN:HEADER_LEN+DATA_LEN+1]
    payload = header+data
    checkSum = 0 #compute checksum
    for char in payload[1:-1]:
        num = ord(char) #char to decimal
        checkSum+=num
    checkSum = checkSum & 0xFF #Keep under 256
    if checkSum != ord(payload[-1]):
        raise Exception("Checksum error in ReadMSG")
    else:
        print "OK"

if __name__ == "__main__":
    Init()
    Slave1 = "B"
    for _ in range(5):
        #Poll(Slave1)
        #EnableRX()
        Store(Slave1, "1111"*5)
        #print ReadMSG()
    #ser.flush()
    DisableTX()
    DisableRX()
    sleep(1)
    ser.close()


text:
Laravel Flysystem Upyun (又拍云)

:floppy_disk: 又拍云 Flysystem 实现,可直接用于 Laravel 项目。

# Requirement

- PHP >= 5.5.9

# 视频教程
> 视频使用教程(当然是免费的):https://www.codecasts.com/series/awesome-laravel-packages/episodes/8

# 安装

直接可以通过 composer 来安装:
```shell

$ composer require "jellybool/flysystem-upyun"
```

# 使用

## 1.在一般项目中使用

```php

use League\Flysystem\Filesystem;
use JellyBool\Flysystem\Upyun\UpyunAdapter;

$bucket = 'your-bucket-name';
$operator = 'oparator-name';
$password = 'operator-password';
$domain = 'xxxxx.b0.upaiyun.com'; // 或者 https://xxxx.b0.upaiyun.com

$adapter = new UpyunAdapter($bucket, $operator, $password, $domain);

$flysystem = new Filesystem($adapter);

```

## 2.在 Laravel 中使用

1.在 `config/app.php` 添加 `UpyunServiceProvider`:

```php

'providers' => [
    // Other service providers...
    JellyBool\Flysystem\Upyun\UpyunServiceProvider::class,
],
```
2.在 `config/filesystems.php` 的 `disks` 中添加下面的配置:

```php

return [
    //...
      'upyun' => [
                'driver'        => 'upyun',
                'bucket'        => 'your-bucket-name',// 服务名字
                'operator'      => 'oparator-name', // 操作员的名字
                'password'      => 'operator-password', // 操作员的密码
                'domain'        => 'xxxxx.b0.upaiyun.com', // 服务分配的域名
                'protocol'     => 'https', // 服务使用的协议,如需使用 http,在此配置 http
            ],
    //...
];

```

# API 和方法调用

```php

bool $flysystem->write('file.md', 'contents');

bool $flysystem->writeStream('file.md', fopen('path/to/your/local/file.jpg', 'r'));

bool $flysystem->update('file.md', 'new contents');

bool $flysystem->updateStram('file.md', fopen('path/to/your/local/file.jpg', 'r'));

bool $flysystem->rename('foo.md', 'bar.md');

bool $flysystem->copy('foo.md', 'foo2.md');

bool $flysystem->delete('file.md');

bool $flysystem->has('file.md');

string|false $flysystem->read('file.md');

array $flysystem->listContents();

array $flysystem->getMetadata('file.md');

int $flysystem->getSize('file.md');

string $flysystem->getUrl('file.md');

string $flysystem->getMimetype('file.md');

int $flysystem->getTimestamp('file.md');

```

# License

MIT


text:
import pytest

from api.base.settings.defaults import API_BASE
from osf_tests.factories import (
    AuthUserFactory,
    FlagFactory,
    SampleFactory,
    SwitchFactory
)

@pytest.mark.django_db
class TestWaffleList:

    @pytest.fixture()
    def user(self):
        return AuthUserFactory()

    @pytest.fixture()
    def inactive_flag(self):
        return FlagFactory(name='inactive_flag', everyone=False)

    @pytest.fixture()
    def active_flag(self):
        return FlagFactory(name='active_flag')

    @pytest.fixture()
    def inactive_switch(self):
        return SwitchFactory(name='inactive_switch', active=False)

    @pytest.fixture()
    def active_sample(self):
        return SampleFactory(name='active_sample')

    @pytest.fixture()
    def url(self):
        return '/{}_waffle/'.format(API_BASE)

    @pytest.fixture()
    def flag_url(self, url):
        return url + '?flags=active_flag'

    def test_waffle_flag_no_filter(self, app, user, url, inactive_flag, active_flag):
        res = app.get(url, auth=user.auth)
        assert res.status_code == 200
        assert len(res.json['data']) == 2

    def test_waffle_flag_filter_active(self, app, user, flag_url, active_flag):
        res = app.get(flag_url, auth=user.auth)
        assert res.status_code == 200
        assert len(res.json['data']) == 1
        assert res.json['data'][0]['attributes']['name'] == 'active_flag'
        assert res.json['data'][0]['attributes']['active'] is True

    def test_waffle_flag_filter_does_not_exist(self, app, user, url, inactive_flag, active_flag):
        res = app.get(url + '?flags=jibberish', auth=user.auth)
        assert res.status_code == 200
        assert len(res.json['data']) == 0

    def test_filter_waffle_samples_flags_and_switches(self, app, user, url, inactive_flag, active_flag, active_sample, inactive_switch):
        res = app.get(url + '?flags=active_flag&samples=active_sample&switches=inactive_switch', auth=user.auth)
        assert res.status_code == 200
        assert len(res.json['data']) == 3

    def test_waffle_switch_logged_out(self, app, user, url, inactive_switch):
        res = app.get(url + '?switches=inactive_switch')
        assert res.status_code == 200
        assert len(res.json['data']) == 1
        assert res.json['data'][0]['attributes']['name'] == 'inactive_switch'
        assert not res.json['data'][0]['attributes']['active']


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Bryologist 106(3): 419 (2003)

#### Original name
Cladonia fuscofunda S. Hammer

### Remarks
null


text:
<?php

namespace App\Library;

class Items
{
    public static function getItems()
    {
        $query = DB::$db->prepare('SELECT * FROM items ORDER BY id desc');
        $query->execute();
        $result = $query->fetchAll();

        return $result;
    }
    public static function getItemById($id)
    {
        $query = DB::$db->prepare('SELECT * FROM items WHERE id=?');
        $query->execute([$id]);
        $result = $query->fetchAll();

        return $result[0];
    }
    public static function putItem($request)
    {
        $query = DB::$db->prepare('INSERT INTO items (name, price, image, description, littledescription) VALUES (?, ?, ?, ?, ?)');
        $query->execute([$request->post['name'], $request->post['price'], $request->post['image'], $request->post['description'], $request->post['littledescription']]);
        $result = $query->fetch();

        return $result[0];
    }
    public static function validateItem($request)
    {
        $errors = [];
        if (!$request->hasPost('name') || !$request->hasPost('price') || !$request->hasPost('image') || !$request->hasPost('description') || !$request->hasPost('littledescription')) {
            $errors[] = 'Все поля обязательны';
        }
        if (!is_numeric($request->post['price'])) {
            $errors[] = 'Поле "Цена" должно быть в числовом формате';
        }

        return $errors;
    }
    public static function updateItem($request)
    {
        $query = DB::$db->prepare('UPDATE items SET name=?, price=?, image=?, description=?, littledescription=? WHERE id=?');
        $query->execute([$request->post['name'], $request->post['price'], $request->post['image'], $request->post['description'], $request->post['littledescription'], $request->params[0]]);
        $result = $query->fetch();

        return $result[0];
    }
    public static function deleteItemById($id)
    {
        $query = DB::$db->prepare('DELETE FROM items WHERE id=?');
        $query->execute([$id]);
        $result = $query->fetch();

        return $result;
    }
}


text:
import { describe, it } from 'mocha';
import { assert }       from 'chai';

import Tree from '../src/index';

describe('find', () => {

  it('should return key as the result of search', () => {
    const tree = new Tree();
    assert.equal(tree.find(1), null);
    assert.equal(tree.find(2), null);
    assert.equal(tree.find(3), null);
    tree.insert(1, 4);
    tree.insert(2, 5);
    tree.insert(3, 6);
    assert.equal(tree.find(1).data, 4);
    assert.equal(tree.find(2).data, 5);
    assert.equal(tree.find(3).data, 6);
    assert.isNull(tree.find(8));
  });
})


text:
Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.

------------------------------------------------------------------------------]]

local NoBackprop,parent = torch.class('nn.NoBackprop','nn.Container')

-- was lazy to finish CPU side
function NoBackprop:__init(inner)
   parent.__init(self)
   assert(inner)
   self.modules = {inner}
end

function NoBackprop:updateOutput(input)
   self.output = self.modules[1]:updateOutput(input)
   return self.output
end

function NoBackprop:updateGradInput(input, gradOutput)
   self.gradInput:resizeAs(input):zero()
   return self.gradInput
end

function NoBackprop:__tostring()
   return 'NoBackprop: ' .. tostring(self.modules[1])
end

-- bypass container original function
function NoBackprop:training()
   self:applyToModules(function(module) module:evaluate() end)
   parent.evaluate(self)
end

-- ugh, stupid temporary backwards-compatibility hack
NoBackprop.__version = 2
function NoBackprop:__read(file, version)
   -- do the normal read
   local var = file:readObject()
   for k, v in pairs(var) do
      self[k] = v
   end
   -- fixup module
   if version < 2 then
      self.modules = {self.inner}
      self.inner = nil
   end
end


text:
from distutils.core import setup
from setuptools import find_packages

setup(
    name='django-digitallabels',
    version='0.49',
    author=u'V&A Digital Media',
    author_email='webmaster@vam.ac.uk',
    packages=find_packages(),
    include_package_data=True,
    url='https://github.com/vanda/DigitalLabels',
    license='BSD licence, see LICENCE',
    description='Provides backend and interface for interactive museum labels',
    long_description=open('README.md').read(),
)


text:
require 'celluloid/io'

# TLS negociation error
class TLSError < Exception
end

# Main module
module FlightAware
  class Client
    include Celluloid::IO

    attr_reader :bytes
    attr_reader :pkts

    def initialize(config)
      @bytes = 0
      @pkts = 0
      @out = config.feed_one

      $stderr.puts("Connecting to #{config.site}:#{config.port} using TLS.")
      raw_socket = TCPSocket.new(config.site, config.port)
      begin
        $stderr.puts("  Initiating TLS negociation")
        @ssl = SSLSocket.new(raw_socket)
        @ssl.connect
      rescue => message
        raise TLSError, "TLS negociation failed: #{message}"
      end

      user = config.users[config.def_user]["user"]
      password = config.users[config.def_user]["password"]
      $stderr.puts("  Authenticating to FlightAware")
      @ssl.write("live version 4.0 username #{user} password #{config.password} events \"position\"\n")
      $stderr.puts("Init done.")
      async.run
    end

    # Read buffer, one line at a time
    #
    def run
      buf = @ssl.read
      @out.call(buf)
      @bytes += buf.size
      @pkts += 1
    end

    def wait
      sleep(1)
    end
  end
end


text:
#ifndef __cplusplus
#error This is a C++ include file and cannot be used from plain C
#endif

#include "bulkDataCallback.h"
#include "bulkDataReceiverImpl.h"

/** @class BulkDataServer_StreamEndPoint
 *  Defines the server callback.
 */
class BulkDataReceiver : public BulkDataCallback
{

  public:
    BulkDataReceiver();

    ~BulkDataReceiver()
	{
	}

    virtual int cbStart(ACE_Message_Block * userParam_p = 0);
    virtual int cbReceive(ACE_Message_Block * frame_p);
    virtual int cbStop();

  private:
};


text:
Semiconductor
=============


text:
module states {

    export class GameState extends Phaser.State {
        //background: Phaser.Sprite;
        music: Phaser.Sound;
        board: Board;
        api: ApiDelegate;
        lwGame: states.Game;
        gameTimer: WaitingForSomeoneToJoinTimer;

        constructor() {
            super();
        }

        create() {
            //this.background = this.add.sprite(0, 0, "sky");
            this.game.stage.backgroundColor = 'black'
            this.music = this.add.audio("vso", 1, false);
            //            this.music.play();
            this.api = new ApiDelegate();
            this.board = null;
            let d = new Date();
            this.joinGame("tetio"+d.getMilliseconds(), "CA", this);
        }

        update() {
            if (this.board !== null) {
                this.board.update();
            } else if (this.lwGame && this.lwGame.state === "KO" ) {
                // TODO no game partner found
            } else {
                // TODO SPINNIG BALL OF DEATH
            }
        }

        joinGame(username: string, language: string, tgs: GameState) {
            this.api.username = username;
            this.api.joinGame(username, 2, language, (aGame: Game, isOk: boolean) => {
                if (game !== null && isOk) {
                    tgs.lwGame = aGame;
                    tgs.api.gameId = aGame._id;
                    tgs.api.username = username;
                    tgs.board = new BoardTimer(this.game, this.api);
                    tgs.board.setTiles(aGame.board);
                } else {
                    this.api.createNewGame(username, 2, language, (newGame: Game) => {
                        tgs.lwGame = newGame;
                        tgs.api.gameId = newGame._id;
                    let self = this;
                        // TODO NOW TIMER FOR WAITING TO SOMEONE TO JOIN IN
                        this.gameTimer = new WaitingForSomeoneToJoinTimer(this.game, newGame._id, this.api, () => {
                            this.api.findGameById(newGame._id, (aGame: Game, isOk: boolean) => {
                                if (isOk && aGame.state === 'READY') {
                                    this.gameTimer.stop();
                                    tgs.lwGame.state = "READY";
                                    tgs.board = new BoardTimer(this.game, this.api);
                                    tgs.board.setTiles(newGame.board);
                                }
                            });

                        });
                    });
                }
            });
        }

    }
}


text:
import * as assert from 'assert';
import { getDocumentContext } from '../utils/documentContext';

suite('HTML Document Context', () => {

	test('Context', function (): any {
		const docURI = 'file:///users/test/folder/test.html';
		const rootFolders = [{ name: '', uri: 'file:///users/test/' }];

		let context = getDocumentContext(docURI, rootFolders);
		assert.equal(context.resolveReference('/', docURI), 'file:///users/test/');
		assert.equal(context.resolveReference('/message.html', docURI), 'file:///users/test/message.html');
		assert.equal(context.resolveReference('message.html', docURI), 'file:///users/test/folder/message.html');
		assert.equal(context.resolveReference('message.html', 'file:///users/test/'), 'file:///users/test/message.html');
	});
});


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.06.22 at 06:43:31 PM WEST
//

package eu.scape_project.core.toolspec_objects.from_schema;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;

/**
 * Declares an operating system dependency.
 *
 *
Java class for OperatingSystemDependency complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="OperatingSystemDependency">
 *   <simpleContent>
 *     <extension base="<http://www.w3.org/2001/XMLSchema>string">
 *       <attribute name="operatingSystemName" use="required" type="{http://scape-project.eu/tool}OperatingSystemName" />
 *       <attribute name="otherOperatingSystemName" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="operatingSystemVersion" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="format" type="{http://scape-project.eu/tool}DependencyFormat" />
 *       <attribute name="otherFormat" type="{http://www.w3.org/2001/XMLSchema}string" />
 *     </extension>
 *   </simpleContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "OperatingSystemDependency", propOrder = {
    "value"
})
public class OperatingSystemDependency {

    @XmlValue
    protected String value;
    @XmlAttribute(required = true)
    protected OperatingSystemName operatingSystemName;
    @XmlAttribute
    protected String otherOperatingSystemName;
    @XmlAttribute
    protected String operatingSystemVersion;
    @XmlAttribute
    protected DependencyFormat format;
    @XmlAttribute
    protected String otherFormat;

    /**
     * Gets the value of the value property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getValue() {
        return value;
    }

    /**
     * Sets the value of the value property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setValue(String value) {
        this.value = value;
    }

    /**
     * Gets the value of the operatingSystemName property.
     *
     * @return
     *     possible object is
     *     {@link OperatingSystemName }
     *
     */
    public OperatingSystemName getOperatingSystemName() {
        return operatingSystemName;
    }

    /**
     * Sets the value of the operatingSystemName property.
     *
     * @param value
     *     allowed object is
     *     {@link OperatingSystemName }
     *
     */
    public void setOperatingSystemName(OperatingSystemName value) {
        this.operatingSystemName = value;
    }

    /**
     * Gets the value of the otherOperatingSystemName property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getOtherOperatingSystemName() {
        return otherOperatingSystemName;
    }

    /**
     * Sets the value of the otherOperatingSystemName property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setOtherOperatingSystemName(String value) {
        this.otherOperatingSystemName = value;
    }

    /**
     * Gets the value of the operatingSystemVersion property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getOperatingSystemVersion() {
        return operatingSystemVersion;
    }

    /**
     * Sets the value of the operatingSystemVersion property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setOperatingSystemVersion(String value) {
        this.operatingSystemVersion = value;
    }

    /**
     * Gets the value of the format property.
     *
     * @return
     *     possible object is
     *     {@link DependencyFormat }
     *
     */
    public DependencyFormat getFormat() {
        return format;
    }

    /**
     * Sets the value of the format property.
     *
     * @param value
     *     allowed object is
     *     {@link DependencyFormat }
     *
     */
    public void setFormat(DependencyFormat value) {
        this.format = value;
    }

    /**
     * Gets the value of the otherFormat property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getOtherFormat() {
        return otherFormat;
    }

    /**
     * Sets the value of the otherFormat property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setOtherFormat(String value) {
        this.otherFormat = value;
    }

}


text:
<?php

namespace JumpLink\Slideshow\Updates;

use Schema;
use October\Rain\Database\Updates\Migration;

class BuilderTableUpdateJumpLinkSlideshowSlides extends Migration
{
    public function up()
    {
        Schema::table('jumplink_slideshow_slides', function ($table) {
            $table->boolean('is_published')->default(0);
            $table->dateTime('published_at')->nullable()->default(null);
            $table->dateTime('unpublished_at')->nullable()->default(null);
        });
    }

    public function down()
    {
        Schema::table('jumplink_slideshow_slides', function ($table) {
            $table->dropColumn('is_published');
            $table->dropColumn('published_at');
            $table->dropColumn('unpublished_at');
        });
    }
}


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

#if SYSTEM_WINDOWS_VECTOR
using VECTOR = System.Windows.Vector;
using FLOAT = System.Double;
#elif SYSTEM_NUMERICS_VECTOR
using VECTOR = System.Numerics.Vector2;
using FLOAT = System.Single;
#elif UNITY || UNITY_5_4_OR_NEWER
using VECTOR = UnityEngine.Vector2;
using FLOAT = System.Single;
#else
#error Unknown vector type -- must define one of SYSTEM_WINDOWS_VECTOR, SYSTEM_NUMERICS_VECTOR or UNITY
#endif

namespace burningmime.curves
{
    /// <summary>
    /// Implements a least-squares bezier curve fitting routine based on http://tog.acm.org/resources/GraphicsGems/gems/FitCurves.c with a few
    /// optimizations made by me. You can read the article here: http://read.pudn.com/downloads141/ebook/610086/Graphics_Gems_I.pdf page 626.
    /// To use, call the <see cref="Fit"/> static function and wait for magic to happen.
    /// </summary>
    public sealed class CurveFit : CurveFitBase
    {

#if !(UNITY || UNITY_5_4_OR_NEWER)
        /// <summary>
        /// Use a thread-static instance to prevent multithreading issues without needing to re-allocate on each run.
        /// </summary>
        [ThreadStatic] private static CurveFit _instance;

        private static CurveFit GetInstance()
        {
            return _instance ?? (_instance = new CurveFit());
        }
#else
        private static CurveFit GetInstance()
        {
            // Unity doesn't like [ThreadStatic] according to http://docs.unity3d.com/Manual/Attributes.html
            return new CurveFit();
        }
#endif

        /// <summary>
        /// Private constructor so it can't be constructed externally.
        /// </summary>
        private CurveFit() { }

        /// <summary>
        /// Curves we've found so far.
        /// </summary>
        private readonly List<CubicBezier> _result = new List<CubicBezier>(16);

        /// <summary>
        /// Shared zero-curve array.
        /// </summary>
        private static readonly CubicBezier[] NO_CURVES = new CubicBezier[0];

        /// <summary>
        /// Attempts to fit a set of Bezier curves to the given data. It returns a set of curves that form a
        /// http://en.wikipedia.org/wiki/Composite_B%C3%A9zier_curve with C1 continuity (that is, each curve's start
        /// point is coincident with the previous curve's end point, and the tangent vectors of the start and end
        /// points are going in the same direction, so the curves will join up smoothly). Returns an empty array
        /// if less than two points in input.
        ///
        /// Input data MUST not contain repeated points (that is, the same point twice in succession). The best way to
        /// ensure this is to call any one of the methods in <see cref="CurvePreprocess" />, since all three pre-processing
        /// methods will remove duplicate points. If repeated points are encountered, unexpected behavior can occur.
        /// </summary>
        /// <param name="points">Set of points to fit to.</param>
        /// <param name="maxError">Maximum distance from any data point to a point on the generated curve.</param>
        /// <returns>Fitted curves or an empty list if it could not fit.</returns>
        public static CubicBezier[] Fit(List<VECTOR> points, FLOAT maxError)
        {
            if(maxError < EPSILON)
                throw new InvalidOperationException("maxError cannot be negative/zero/less than epsilon value");
            if(points == null)
                throw new ArgumentNullException("points");
            if(points.Count < 2)
                return NO_CURVES; // need at least 2 points to do anything

            CurveFit instance = GetInstance();
            try
            {
                // should be cleared after each run
                Debug.Assert(instance._pts.Count == 0 && instance._result.Count == 0 &&
                    instance._u.Count == 0 && instance._arclen.Count == 0);

                // initialize arrays
                instance._pts.AddRange(points);
                instance.InitializeArcLengths();
                instance._squaredError = maxError * maxError;

                // Find tangents at ends
                int last = points.Count - 1;
                VECTOR tanL = instance.GetLeftTangent(last);
                VECTOR tanR = instance.GetRightTangent(0);

                // do the actual fit
                instance.FitRecursive(0, last, tanL, tanR);
                return instance._result.ToArray();
            }
            finally
            {
                instance._pts.Clear();
                instance._result.Clear();
                instance._arclen.Clear();
                instance._u.Clear();
            }
        }

        /// <summary>
        /// Main fit function that attempts to fit a segment of curve and recurses if unable to.
        /// </summary>
        private void FitRecursive(int first, int last, VECTOR tanL, VECTOR tanR)
        {
            int split;
            CubicBezier curve;
            if(FitCurve(first, last, tanL, tanR, out curve, out split))
            {
                _result.Add(curve);
            }
            else
            {
                // If we get here, fitting failed, so we need to recurse
                // first, get mid tangent
                VECTOR tanM1 = GetCenterTangent(first, last, split);
                VECTOR tanM2 = -tanM1;

                // our end tangents might be based on points outside the new curve (this is possible for mid tangents too
                // but since we need to maintain C1 continuity, it's too late to do anything about it)
                if(first == 0 && split < END_TANGENT_N_PTS)
                    tanL = GetLeftTangent(split);
                if(last == _pts.Count - 1 && split > (_pts.Count - (END_TANGENT_N_PTS + 1)))
                    tanR = GetRightTangent(split);

                // do actual recursion
                FitRecursive(first, split, tanL, tanM1);
                FitRecursive(split, last, tanM2, tanR);
            }
        }
    }
}


text:
package com.sqli.jsg.amiennemis.client.model;

import java.awt.Point;
import java.util.ArrayList;
import java.util.List;

import com.sqli.jsg.amiennemis.client.LocalEndpoint;

public enum GameImpl implements Game {

	INSTANCE;

	protected Field field;
	protected Personnage personnage;
	protected List<Personnage> others = new ArrayList<Personnage>();

	private GameImpl() {
		this.personnage = new Poursuivant(Integer.parseInt(System.getProperty("id")), new Point(Integer.parseInt(System.getProperty("x")), Integer.parseInt(System.getProperty("y"))));
		LocalEndpoint.getInstance().setGame(this);
		this.field = new Field();
		this.field.generateField();
	}

	@Override
	public Sprite[][] getGrille() {
		return this.field.getField();
	}

	@Override
	public void move(Move move) {
		this.personnage.move(move, this.field);
		this.field.updateField(personnage);
		LocalEndpoint.getInstance().broadcastPosition(personnage);
	}

	@Override
	public void updatePersonnage(int id, int x, int y) {
		boolean persoExists = false;
		for (Personnage perso : others) {
			if(perso.id == id) {
				perso.setPosition(new Point(x, y));
				this.field.updateField(perso);
				persoExists = true;
			}
		}
		if(!persoExists) {
			Poursuivant nouveau = new Poursuivant(id, new Point(x, y));
			this.field.updateField(nouveau);
			others.add(nouveau);
		}
	}

}


text:
@interface MLOneViewController : UITableViewController

@end


text:
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { fetchPad, fetchUser, fetchUsers, fetchPads, editPad, createPad, resetEditState, resetPadState } from 'actions';
import { each, findWhere, union, intersection, size, isEqual } from 'lodash';
import classNames from 'classnames';
import g11n from 'utils/g11n';

import EditorTitle from 'components/EditorTitle';
import EditorContent from 'components/EditorContent';
import EditorCooperate from 'components/EditorCooperate';
import EditorTags from 'components/EditorTags';
import EditorPreview from 'components/EditorPreview';

export default class Editor extends Component {

  static contextTypes = {
      history: PropTypes.object
  };

  constructor() {
    super();
    this.state = {
      cooperator: [],
      tags: [],
      content: ''
    };
    this.isEditMode = false;
    this.isLogged = false;
    this.isRequesting = false;
  }

  componentWillMount() {
    const {authState: { result: isLogged } } = this.props;
    this.isLogged = isLogged;
  }

  componentDidMount() {
    this.fetchCurrentPad(this.props);
  }

  componentWillReceiveProps(nextProps) {
    const { location: { pathname } } = this.props;
    const { location: { pathname: nextPathname } } = nextProps;
    this.isEditMode = nextPathname.match(/edit/);

    // 網址切換時
    if (pathname !== nextPathname) {
      this.fetchCurrentPad(nextProps);
    }

    const { fetchPadResult, padData, usersState, editorState, authState: { result: isLogged } } = nextProps;
    const data = this.getCurrentPadData(nextProps, this.isEditMode);

    // 送出結果成功,前往 pad
    if (editorState.result && this.isRequesting) {
      const padId = (this.isEditMode) ? padData.id : editorState.data.id;
      const path = '/show/' + padId;
      this.context.history.pushState(null, path);
    }

    const cooperatorList = [];
    const fetchQueue = [];

    const fetchingCooperator = (data.cooperator) ? data.cooperator.length !== this.state.cooperator.length : false;
    const isStillFetching = fetchPadResult && fetchingCooperator;
    const noCooperator = fetchPadResult && data.cooperator.length === 0;
    const noSuchPad = data.id === undefined;

    // 如果仍在 fetching user (防止 queue 重複堆疊),或根本沒有 cooperator,或根本沒有這個 Pad
    if (isStillFetching || noCooperator || noSuchPad) {
      const { cooperator, tags } = data;
      each(cooperator, (value) => {
        const currentUser = findWhere(usersState.data, { 'id': value });
        if (currentUser) {
          cooperatorList.push(currentUser);
        } else {
          fetchQueue.push(value);
        }
      });

      if (fetchQueue.length) {
        this.props.fetchUser({useridArray: fetchQueue});
      }

      this.setState({
        cooperator: cooperatorList,
        tags: (tags) ? tags : [],
        content: ''
      });
    }

    this.isLogged = isLogged;
  }

  shouldComponentUpdate(nextProps) {
    return isEqual(this.props.deleteState, nextProps.deleteState);
  }

  componentWillUnmount() {
    this.isRequesting = false;
    this.props.resetEditState();
  }

  onClickSubmit() {
    const { padData: { id: padId, version } } = this.props;
    const titleState = this.refs.EditorTitle.getState();
    const contentState = this.refs.EditorContent.getState();
    const cooperatorState = this.refs.EditorCooperate.getState();
    const tagsState = this.refs.EditorTags.getState();

    const contents = {
      title: (titleState.title) ? titleState.title : 'Untitled',
      content: (contentState.content) ? contentState.content : '',
      tags: tagsState.tags,
      cooperator: cooperatorState.cooperatorId
    };

    let parameter = {};
    if (this.isEditMode) {
      parameter = {
        padid: padId,
        version: version,
        title: contents.title,
        content: contents.content,
        tags: contents.tags,
        cooperator: contents.cooperator
      };
    }

    if (titleState.isChanged || !titleState.title) { parameter.title = contents.title; }
    if (contentState.isChanged || !contentState.content) { parameter.content = contents.content; }
    if (tagsState.isChanged) { parameter.tags = contents.tags; }
    if (cooperatorState.isChanged) { parameter.cooperator = contents.cooperator; }

    if (this.isEditMode) {
      this.props.editPad({pid: padId, parameter: JSON.stringify(parameter)});
    } else {
      this.props.createPad(JSON.stringify(parameter));
    }

    this.isRequesting = true;
  }

  onClickPreview() {
    const contentState = this.refs.EditorContent.getState();
    this.setState({
      content: contentState.content
    })
  }

  onClickCancel() {
    const { padData: { id: padId } } = this.props;
    if (padId) {
      const path = '/show/' + padId;
      this.context.history.pushState(null, path);
    } else {
      this.context.history.pushState(null, '/');
    }
  }

  getCurrentPadData(props) {
    const { padData, editorState } = props;
    let data = {
      title: '',
      content: '',
      cooperator: [],
      tags: []
    };

    if (editorState.requestData) {
      data = JSON.parse(editorState.requestData);
    } else {
      if (this.isEditMode && size(padData) > 0) {
        data = padData;
      }
    }

    return data;
  }

  getMessage(...params) {
    const [ isAuthorized, fetchResult, isFetching, editorState ] = params;
    let message = '';
    switch (true) {
      case !this.isLogged:
        message = g11n.t('editor.responseResults')[1];
        break;
      case (this.isEditMode && !fetchResult) && !isFetching:
        message = g11n.t('editor.responseResults')[2];
        break;
      case !isAuthorized && fetchResult:
        message = g11n.t('editor.responseResults')[3];
        break;
      case (editorState.data.code === 0):
        // Success
        break;
      default:
        if (editorState.errorStatus) {
          message = g11n.t('error', {':errCode': editorState.errorStatus});
        } else {
          message = g11n.t('editor.responseResults')[editorState.data.code] || '';
        }
    }
    return message;
  }

  fetchCurrentPad(props) {
    const { location: { pathname }, params } = props;
    this.props.resetPadState();
    this.props.resetEditState();
    if (pathname.match(/edit/)) {
      this.props.fetchPad(params);
    }
    this.isEditMode = (pathname.match(/edit/)) ? true : false;
  }

  render() {
    const { fetchPadResult, isFetching, authState, padData: { user: ownerId, cooperator }, editorState } = this.props;

    const authorityCheck = () => {
      if (!this.isEditMode) { return true; }
      if (authState.result) {
        const userId = authState.data.id;
        return intersection([userId], union([ownerId], cooperator)).length > 0;
      }
      return false;
    };

    // 沒有編輯權限 = 沒登入,是編輯模式&沒有fetch成功,非合法編輯者
    const isUneditable = !this.isLogged || (this.isEditMode && !fetchPadResult) || !authorityCheck();
    const isAuthorized = this.isLogged && ((this.isEditMode && fetchPadResult) || !this.isEditMode) && authorityCheck();
    const isRequesting = editorState.isRequesting;
    const isOwner = (isAuthorized) && ownerId === authState.data.id;
    const isPreviewActive = this.state.content.length > 0;

    const data = this.getCurrentPadData(this.props);
    const message = this.getMessage(isAuthorized, fetchPadResult, isFetching, editorState);

    return (

            { g11n.t('editor.form.title') }
            <EditorTitle
              ref="EditorTitle"
              data={ data }
              { ...this.props }
              authority={ isAuthorized } />

            { g11n.t('editor.form.content') }
            <EditorContent
              ref="EditorContent"
              data={ data }
              { ...this.props }
              authority={ isAuthorized } />

              { g11n.t('editor.form.cooperator') }
              <EditorCooperate
                ref="EditorCooperate"
                data={ data }
                { ...this.props }
                cooperator={ this.state.cooperator }
                authority={ isOwner || !this.isEditMode } />

              { g11n.t('editor.form.tags') }
              <EditorTags
                ref="EditorTags"
                data={ data }
                { ...this.props }
                tags={ this.state.tags } />

                { isRequesting && g11n.t('editor.button.sending') || g11n.t('editor.button.submit') }

              { g11n.t('editor.button.preview') }
              { g11n.t('general.button.cancel') }

              { message }

        { isPreviewActive && <EditorPreview content={ this.state.content }/> }

    );
  }
}

Editor.propTypes = {
  isFetching: PropTypes.bool.isRequired,
  fetchPadResult: PropTypes.bool,
  location: PropTypes.object.isRequired,
  padData: PropTypes.object.isRequired,
  authState: PropTypes.object.isRequired,
  usersState: PropTypes.object.isRequired,
  editorState: PropTypes.object.isRequired,
  padsState: PropTypes.object.isRequired,
  deleteState: PropTypes.object.isRequired,

  fetchPad: PropTypes.func.isRequired,
  fetchUser: PropTypes.func.isRequired,
  fetchUsers: PropTypes.func.isRequired,
  fetchPads: PropTypes.func.isRequired,
  editPad: PropTypes.func.isRequired,
  createPad: PropTypes.func.isRequired,
  resetPadState: PropTypes.func.isRequired,
  resetEditState: PropTypes.func.isRequired
};

function mapStateToProps(state) {
  const {
    isFetching,
    result: fetchPadResult,
    data: padData
  } = state.pad;

  return {
    isFetching: isFetching,
    fetchPadResult: fetchPadResult,
    padData: padData,
    authState: state.auth,
    usersState: state.users,
    editorState: state.editor,
    padsState: state.pads,
    deleteState: state.del
  };
}

export default connect(
  mapStateToProps,
  { fetchPad, fetchUser, fetchUsers, fetchPads, editPad, createPad, resetEditState, resetPadState }
)(Editor);


text:
import { Component, OnInit } from '@angular/core';
import { Router }    from '@angular/router';
import { Title, Meta } from '@angular/platform-browser';
import { MatSnackBar } from '@angular/material/snack-bar';
import { AngularFireDatabase } from '@angular/fire/database';
import { AngularFireAuth } from '@angular/fire/auth';
import { Observable } from 'rxjs';
import * as firebase from 'firebase/app';
import { GlobalService } from '../../services/global.service';
import { LocalCartService } from '../../services/localcart.service';

@Component({
  selector: 'cart',
  templateUrl: './cart.component.html',
  styleUrls: ['./cart.component.scss']
})
export class CartComponent implements OnInit {
  globalCart: any;
  cartArray: any;
  cartTotal: Number;
  user: Observable<firebase.default.User>;
  currentShopper: any;
  review: boolean;

  constructor(
    public db: AngularFireDatabase,
    public afAuth: AngularFireAuth,
    public router: Router,
    public snackBar: MatSnackBar,
    public globalService: GlobalService,
    public localCart: LocalCartService,
    private title: Title,
    private meta: Meta
  ) {
    this.user = afAuth.authState;
    this.cartArray = [];
    this.cartTotal = 0;
    this.review = false;

    globalService.cart.subscribe((cart) => {
      this.cartArray = [];
      this.cartTotal = 0;
      this.globalCart = cart;
      if (this.globalCart) {
        this.cartArray = (<any>Object).values(this.globalCart);
        for (let i = 0; i < this.cartArray.length; i++) {
          this.cartTotal += this.cartArray[i].total;
        }
        globalService.order.next({items: this.cartArray, shipping: {}, billing: {}, total: this.cartTotal});
      }
    });
  }

  ngOnInit() {
    this.title.setTitle('Cart');
    this.meta.updateTag({ content: 'View and edit the shopping cart' }, "name='description'");

    if (this.router.url.includes('review')) {
      this.review = true;
    }
  }

  updateCart(item) {
    this.globalCart[item.entityKey] = item;
    this.globalCart[item.entityKey]['total'] = (item.quantity * item.price);
    this.globalService.cart.next(this.globalCart);
  }

  removeItem(item) {
    delete this.globalCart[item.entityKey];
    this.globalService.cart.next(this.globalCart);

    this.user.subscribe((currentShopper) => {
      if (Object.keys(this.globalCart).length === 0) {
        this.localCart.clearCart();
        if (currentShopper) {
          this.db.object('/users/' + currentShopper.uid).update({
            cart: null
          });
        }
      }
    });

    let snackBarRef = this.snackBar.open('Item removed', 'OK!', {
      duration: 3000
    });
  }
}


text:
require 'rails_helper'

RSpec.describe Stadium, type: :model do
  pending "add some examples to (or delete) #{__FILE__}"
end


text:
package VMOMI::CreateTaskAction;
use parent 'VMOMI::Action';

use strict;
use warnings;

our @class_ancestors = (
    'Action',
    'DynamicData',
);

our @class_members = (
    ['taskTypeId', undef, 0, ],
    ['cancelable', 'boolean', 0, ],
);

sub get_class_ancestors {
    return @class_ancestors;
}

sub get_class_members {
    my $class = shift;
    my @super_members = $class->SUPER::get_class_members();
    return (@super_members, @class_members);
}

1;


text:
// Copyright (C) 2013 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package net.codemirror.lib;

import com.google.gwt.core.client.JavaScriptObject;

/** {left, right, top, bottom} objects used within CodeMirror. */
public class Rect extends JavaScriptObject {
  public final native double left() /*-{ return this.left }-*/;

  public final native double right() /*-{ return this.right }-*/;

  public final native double top() /*-{ return this.top }-*/;

  public final native double bottom() /*-{ return this.bottom }-*/;

  protected Rect() {}
}


text:
#include <Cg/half.hpp>
#include <Cg/fixed.hpp>
#include <Cg/double.hpp>
#include <Cg/normalize.hpp>

namespace Cg {

float1 normalize(float1 v)
{
    return normalize<float,1>(v);
}

float2 normalize(float2 v)
{
    return normalize<float,2>(v);
}

float3 normalize(float3 v)
{
    return normalize<float,3>(v);
}

float4 normalize(float4 v)
{
    return normalize<float,4>(v);
}

double1 normalize(double1 v)
{
    return normalize<double,1>(v);
}

double2 normalize(double2 v)
{
    return normalize<double,2>(v);
}

double3 normalize(double3 v)
{
    return normalize<double,3>(v);
}

double4 normalize(double4 v)
{
    return normalize<double,4>(v);
}

half1 normalize(half1 v)
{
    return normalize<half,1>(v);
}

half2 normalize(half2 v)
{
    return normalize<half,2>(v);
}

half3 normalize(half3 v)
{
    return normalize<half,3>(v);
}

half4 normalize(half4 v)
{
    return normalize<half,4>(v);
}

fixed1 normalize(fixed1 v)
{
    return normalize<fixed,1>(v);
}

fixed2 normalize(fixed2 v)
{
    return normalize<fixed,2>(v);
}

fixed3 normalize(fixed3 v)
{
    return normalize<fixed,3>(v);
}

fixed4 normalize(fixed4 v)
{
    return normalize<fixed,4>(v);
}

} // namespace Cg


text:
'use strict'
describe('utils', function() {
  var utils = require('./utils')

  describe('#merge', function () {
    it('merges objects', function () {
      var defaultOptions = {foo: '',bar: ''}
      var options = {bar: 'overwritten'}
      var mergedOptions = utils.merge(defaultOptions, options)

      expect( mergedOptions.foo ).toEqual( defaultOptions.foo )
      expect( mergedOptions.bar ).toEqual( options.bar )
    })
  })

  describe('#isJSON', function () {
    it('returns true if is JSON object', function () {
      expect( utils.isJSON({foo:'bar'}) ).toBe( true )
    })
  })
})


text:
package tempconv

import "fmt"

type Celsius float64
type Fahrenheit float64
type Kelvin float64

const (
	AbsoluteZeroC Celsius = -273.15
	ZeroK         Kelvin  = -273.15
	FreezingC     Celsius = 0
	BoilingC      Celsius = 100
)

func (c Celsius) String() string    { return fmt.Sprintf("%g°C", c) }
func (f Fahrenheit) String() string { return fmt.Sprintf("%g°F", f) }
func (k Kelvin) String() string     { return fmt.Sprintf("%g°K", k) }

//!-


text:
<!DOCTYPE html>

<link rel="stylesheet" type="text/css" th:href="@{/css/registration.css}" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

    <meta charset="UTF-8">
    <title>Title</title>

    ${registerForm}

        <form autocomplete="off" action="#" th:action="@{/register}"
              th:object="${registerForm}" method="post" class="form-horizontal"
              role="form">

Registration Form

                    <input type="text" th:field="*{firstName}" placeholder="Name"
                           class="form-control" th:errorclass="fieldError" />

                    <input type="text" th:field="*{email}" placeholder="Email"
                           class="form-control" th:errorclass="fieldError" />

                    <input type="password" th:field="*{password}"
                           placeholder="Password" class="form-control" th:errorclass="fieldError" />

                    <button type="submit" class="btn btn-primary btn-block">Register User</button>

        </form>


text:
It is a proof of concept HTML5 Animation editor. I have two purposes to put it here:

1. if you find any piece of this code usefull, just use it as you wish
2. I've spent several hours from my spare time to put it all together. It is a fun project for me, with a clear vision about what could it be. So if you know someone who is interested in putting some money into it, just drop me a message :)

# Acknowledgment
YAM uses several libraries:

1. [PixiJS](http://www.pixijs.com) - the fastest, most flexible 2D WebGL renderer
2. [TweenJS](http://www.createjs.com/tweenjs) - powerful JavaScript library for tweening and animating HTML5 and JavaScript properties
3. [Vue](https://vuejs.org) - The Progressive JavaScript Framework

# WARNING :)
Be aware that this repo contains some large test data, for example a test mp4 and some image. You've been warned :D

## Description
YAM is a browser based animation editor with support for video and key frame based animations, implemented in HTML5 and JavaScript. YAM is Yet (another) Animation Manager.

Using YAM the user is able to create animations, then include them in any web page, including mobile web.

The editor contains the following features:

1. video background: it is possible to add video files as background, there is a built in editor to select snippets from a video file.
2. image editor: user is able to resize/rotate/crop images. Also there are several filter effects to apply.
3. text effects: the editor includes a text effect editor to add special fill, outline and shadow effects (gradient and cut-out modes) to and there is a wide variety of font faces including Chinese, Japanese and Hieroglyphic fonts.
4. key frame based animation: the editor supports key frame based animation editing. Any item (image, shape, text) can be moved, scaled, rotated. There are options to tint and fade items too. The animation timing can be controlled by tweens.
5. shapes: basic shapes can be added to the animation, including: line, triangle, rectangle and circle. Similarly to the text effects, shapes can have special fill, outline and drop shadow properties.
6. embedding: when an animation is published, then it can be embedded to any other web page. Embedding should look like the following snippets:
```html
<div style="width:100%; height:550px;">
	<iframe width="100%" height="100%" frameborder="0" src="player/17c668ab-2a7c-412e-9d7f-0c707f0ef61e"></iframe>
</div>
```

## Browser compatibility
The YAM Editor works well on Chrome and Safari browsers. Firefox is almost there, probably with some tweaks it can work. MS browsers (Edge, IE) are not compatible.
The YAM Player (embedded to play the animation) is tested on Safari, Chrome, Firefox and on MS Edge.

## Take a look
Please note that the server is running on a very limited VPS machine [ArubaCloud almost free solution](https://www.arubacloud.com/vps/technical-specs-virtual-private-server.aspx)

1. [Two animations embedded into a page](http://gettheyam.com:7777/yam_host.html)
2. [YAM Editor](http://gettheyam.com:7777/editor_shell.html) I am really sorry, but this editor deployment is just for try out purposes. You cannot add your own images, however you can use what is provided in the sticker library.

## In Action
(click on images to view the videos)

		(Image Editor)

		(TextFx)

		(Animation Editor)

## Installation

To process video files YAM Server requires the following tools to operate:
# fonts
## Ubuntu
```
sudo apt-get install fontconfig
```
# ffmpeg
## Ubuntu (16.04 LTS)
```
sudo add-apt-repository ppa:jonathonf/ffmpeg-3
sudo apt update && sudo apt install ffmpeg libav-tools x264 x265
```
## OSX
```
sudo port install ffmpeg +gpl +postproc +lame +theora +libogg +vorbis +nonfree
```
# GraphicsMagick
## Ubuntu
```
sudo apt-get install graphicsmagick
```
## OSX
```
sudo port install graphicsmagick
```
## Steps needed to deploy the YAM Server from the scratch

1. checkout the repo
2. cd yam
3. npm i
4. mkdir uploads; mkdir published; mkdir yam_templates
5. node server/init_yam_db.js
6. node server.js

Then locate the editor at http://localhost:7777/editor_shell.html