text:
package csdn.shimiso.eim.service;

import java.util.Calendar;

import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.filter.MessageTypeFilter;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Packet;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
import csdn.shimiso.eim.R;
import csdn.shimiso.eim.activity.im.ChatActivity;
import csdn.shimiso.eim.comm.Constant;
import csdn.shimiso.eim.manager.MessageManager;
import csdn.shimiso.eim.manager.NoticeManager;
import csdn.shimiso.eim.manager.XmppConnectionManager;
import csdn.shimiso.eim.model.IMMessage;
import csdn.shimiso.eim.model.Notice;
import csdn.shimiso.eim.util.DateUtil;

/**
 *
 * 聊天服务.
 *
 * @author shimiso
 */
public class IMChatService extends Service {
	private Context context;
	private NotificationManager notificationManager;

	@Override
	public void onCreate() {
		context = this;
		super.onCreate();
		initChatManager();
	}

	@Override
	public int onStartCommand(Intent intent, int flags, int startId) {
		return super.onStartCommand(intent, flags, startId);
	}

	@Override
	public IBinder onBind(Intent intent) {
		return null;
	}

	@Override
	public void onDestroy() {
		super.onDestroy();
	}

	private void initChatManager() {
		notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
		XMPPConnection conn = XmppConnectionManager.getInstance()
				.getConnection();
		conn.addPacketListener(pListener, new MessageTypeFilter(
				Message.Type.chat));
	}

	PacketListener pListener = new PacketListener() {

		@Override
		public void processPacket(Packet arg0) {
			Message message = (Message) arg0;
			if (message != null && message.getBody() != null
					&& !message.getBody().equals("null")) {
				IMMessage msg = new IMMessage();
				// String time = (String)
				// message.getProperty(IMMessage.KEY_TIME);
				String time = DateUtil.date2Str(Calendar.getInstance(),
						Constant.MS_FORMART);
				msg.setTime(time);
				msg.setContent(message.getBody());
				if (Message.Type.error == message.getType()) {
					msg.setType(IMMessage.ERROR);
				} else {
					msg.setType(IMMessage.SUCCESS);
				}
				String from = message.getFrom().split("/")[0];
				msg.setFromSubJid(from);

				// 生成通知
				NoticeManager noticeManager = NoticeManager
						.getInstance(context);
				Notice notice = new Notice();
				notice.setTitle("会话信息");
				notice.setNoticeType(Notice.CHAT_MSG);
				notice.setContent(message.getBody());
				notice.setFrom(from);
				notice.setStatus(Notice.UNREAD);
				notice.setNoticeTime(time);

				// 历史记录
				IMMessage newMessage = new IMMessage();
				newMessage.setMsgType(0);
				newMessage.setFromSubJid(from);
				newMessage.setContent(message.getBody());
				newMessage.setTime(time);
				MessageManager.getInstance(context).saveIMMessage(newMessage);
				long noticeId = -1;

				noticeId = noticeManager.saveNotice(notice);

				if (noticeId != -1) {
					Intent intent = new Intent(Constant.NEW_MESSAGE_ACTION);
					intent.putExtra(IMMessage.IMMESSAGE_KEY, msg);
					intent.putExtra("notice", notice);
					sendBroadcast(intent);
					setNotiType(R.drawable.icon,
							getResources().getString(R.string.new_message),
							notice.getContent(), ChatActivity.class, from);

				}

			}

		}

	};

	/**
	 *
	 * 发出Notification的method.
	 *
	 * @param iconId
	 *            图标
	 * @param contentTitle
	 *            标题
	 * @param contentText
	 *            你内容
	 * @param activity
	 * @author shimiso
	 * @update 2012-5-14 下午12:01:55
	 */
	private void setNotiType(int iconId, String contentTitle,
			String contentText, Class activity, String from) {

		/*
		 * 创建新的Intent,作为点击Notification留言条时, 会运行的Activity
		 */
		Intent notifyIntent = new Intent(this, activity);
		notifyIntent.putExtra("to", from);
		// notifyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

		/* 创建PendingIntent作为设置递延运行的Activity */
		PendingIntent appIntent = PendingIntent.getActivity(this, 0,
				notifyIntent, 0);

		/* 创建Notication,并设置相关参数 */
		Notification myNoti = new Notification();
		// 点击自动消失
		myNoti.flags = Notification.FLAG_AUTO_CANCEL;
		/* 设置statusbar显示的icon */
		myNoti.icon = iconId;
		/* 设置statusbar显示的文字信息 */
		myNoti.tickerText = contentTitle;
		/* 设置notification发生时同时发出默认声音 */
		myNoti.defaults = Notification.DEFAULT_SOUND;
		/* 设置Notification留言条的参数 */
//		myNoti.setLatestEventInfo(this, contentTitle, contentText, appIntent);
		/* 送出Notification */
		notificationManager.notify(0, myNoti);
	}
}


text:
using System;
using System.Collections.Generic;
using System.Text;
using Arebis.Runtime.Aspects;
using System.Windows.Forms;

namespace ArebisTestApp
{
	internal class ConsoleLoggerAttribute : AdviceAttribute
	{
		public ConsoleLoggerAttribute()
			: base(true)
		{ }

		public override void BeforeCall(ICallContext callContext)
		{
			Console.WriteLine("> Entering {0}", callContext.Method.Name);
		}

		public override void AfterCall(ICallContext callContext)
		{
			Console.WriteLine("> Leaving {0}", callContext.Method.Name);
			if (callContext.CallFailed) {
				Console.WriteLine("  Exception: {0}", callContext.Exception);
			}
		}
	}

	internal class SampleExtendable : Advisable {

		public void SomeMethod1() {
			Console.WriteLine("...Running method one (no extension)...");
		}

		[ConsoleLogger]
		public void SomeMethod2()
		{
			Console.WriteLine("...Running method two (with extension)...");
			if (MessageBox.Show("Raise exception ?", "SomeMethod2 - Extension sample", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) {
				throw new ApplicationException("User requested exception.");
			}
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML>

  <title>Test for Form History Autocomplete</title>

  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />

Form History test: form field autocomplete

  <form id="form1" onsubmit="return false;">
    <input  type="text" name="field1">
    <button type="submit">Submit</button>
  </form>

  <form id="form2" onsubmit="return false;">
    <input  type="text" name="field2">
    <button type="submit">Submit</button>
  </form>

  <form id="form3" onsubmit="return false;">
    <input  type="text" name="field2" autocomplete="off">
    <button type="submit">Submit</button>
  </form>

  <form id="form4" autocomplete="off" onsubmit="return false;">
    <input  type="text" name="field2">
    <button type="submit">Submit</button>
  </form>

  <form id="form5" onsubmit="return false;">
    <input  type="text" name="field3">
    <button type="submit">Submit</button>
  </form>

  <form id="form6" onsubmit="return false;">
    <input  type="text" name="field4">
    <button type="submit">Submit</button>
  </form>

  <form id="form7" onsubmit="return false;">
    <input  type="text" name="field5" maxlength="10">
    <button type="submit">Submit</button>
  </form>

  <form id="form8" onsubmit="return false;">
    <input  type="email" name="field6">
    <button type="submit">Submit</button>
  </form>

  <form id="form9" onsubmit="return false;">
    <input  type="tel" name="field7">
    <button type="submit">Submit</button>
  </form>

  <form id="form10" onsubmit="return false;">
    <input  type="url" name="field8">
    <button type="submit">Submit</button>
  </form>

  <form id="form11" onsubmit="return false;">
    <input  type="search" name="field9">
    <button type="submit">Submit</button>
  </form>

  <form id="form12" onsubmit="return false;">
    <input  type="number" name="field10">
    <button type="submit">Submit</button>
  </form>

  <form id="form13" onsubmit="return false;">
    <input  type="text" name="searchbar-history">
    <button type="submit">Submit</button>
  </form>


text:
package com.asana.errors;

import com.google.api.client.http.HttpResponseException;

public class NotFoundError extends AsanaError {
    final public static String MESSAGE = "Not Found";
    final public static int STATUS = 404;

    public NotFoundError(HttpResponseException exception) {
        super(MESSAGE, STATUS, exception);
    }
}


text:
#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmjpls/djdecode.h"
#include "dcmtk/dcmdata/dccodec.h"  /* for DcmCodecStruct */
#include "dcmtk/dcmjpls/djcparam.h"
#include "dcmtk/dcmjpls/djcodecd.h"

// initialization of static members
OFBool DJLSDecoderRegistration::registered_                            = OFFalse;
DJLSCodecParameter *DJLSDecoderRegistration::cp_                       = NULL;
DJLSLosslessDecoder *DJLSDecoderRegistration::losslessdecoder_         = NULL;
DJLSNearLosslessDecoder *DJLSDecoderRegistration::nearlosslessdecoder_ = NULL;

void DJLSDecoderRegistration::registerCodecs(
    JLS_UIDCreation uidcreation,
    JLS_PlanarConfiguration planarconfig,
    OFBool ignoreOffsetTable)
{
  if (! registered_)
  {
    cp_ = new DJLSCodecParameter(uidcreation, planarconfig, ignoreOffsetTable);
    if (cp_)
    {
      losslessdecoder_ = new DJLSLosslessDecoder();
      if (losslessdecoder_) DcmCodecList::registerCodec(losslessdecoder_, NULL, cp_);

      nearlosslessdecoder_ = new DJLSNearLosslessDecoder();
      if (nearlosslessdecoder_) DcmCodecList::registerCodec(nearlosslessdecoder_, NULL, cp_);
      registered_ = OFTrue;
    }
  }
}

void DJLSDecoderRegistration::cleanup()
{
  if (registered_)
  {
    DcmCodecList::deregisterCodec(losslessdecoder_);
    DcmCodecList::deregisterCodec(nearlosslessdecoder_);
    delete losslessdecoder_;
    delete nearlosslessdecoder_;
    delete cp_;
    registered_ = OFFalse;
#ifdef DEBUG
    // not needed but useful for debugging purposes
    losslessdecoder_ = NULL;
    nearlosslessdecoder_ = NULL;
    cp_      = NULL;
#endif
  }
}

OFString DJLSDecoderRegistration::getLibraryVersionString()
{
    return DCMJPLS_CHARLS_VERSION_STRING;
}


text:
Swing GUI implementation of the launcher interface.

	@author Andras Belicza


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

module.exports = {
    root:       path.resolve(process.cwd()) + path.sep,
    mozaikRoot: path.resolve(path.join(__dirname, '..')) + path.sep,
    src:        path.resolve(path.join(process.cwd(), 'src')) + path.sep,
    mozaikSrc:  path.resolve(path.join(__dirname, '..', 'src')) + path.sep,
    dest:       path.resolve(path.join(process.cwd(), 'build')) + path.sep,
    mozaikLib:  path.resolve(path.join(__dirname, '..', 'lib')) + path.sep,
};


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

namespace NuGet.Resolver
{
    public class NullProjectManager : IProjectManager
    {
        IPackageRepository _localRepository;
        IProjectSystem _project;

        public NullProjectManager(IPackageManager packageManager)
        {
            _localRepository = new VirtualRepository(repo: null);
            _project = new NullProjectSystem();
            PackageManager = packageManager;
        }

        public IPackageRepository LocalRepository
        {
            get { return _localRepository; }
        }

        public IPackageManager PackageManager
        {
            get;
            private set;
        }

        public ILogger Logger
        {
            get;
            set;
        }

        public IProjectSystem Project
        {
            get { return _project; }
        }

        public IPackageConstraintProvider ConstraintProvider
        {
            get { return NullConstraintProvider.Instance; }
            set
            {
                // no-op
            }
        }

        // Disable warnings that those events are never used since this is intentional.
#pragma warning disable 0067
        public event EventHandler<PackageOperationEventArgs> PackageReferenceAdded;

        public event EventHandler<PackageOperationEventArgs> PackageReferenceAdding;

        public event EventHandler<PackageOperationEventArgs> PackageReferenceRemoved;

        public event EventHandler<PackageOperationEventArgs> PackageReferenceRemoving;
#pragma warning restore 0067

        public void Execute(PackageOperation operation)
        {
            // no-op
        }
    }

    class NullProjectSystem : IProjectSystem
    {
        public System.Runtime.Versioning.FrameworkName TargetFramework
        {
            get { return null; }
        }

        public string ProjectName
        {
            get { return "NullProject"; }
        }

        public void AddReference(string referencePath)
        {
            throw new NotImplementedException();
        }

        public void AddFrameworkReference(string name)
        {
            throw new NotImplementedException();
        }

        public bool ReferenceExists(string name)
        {
            throw new NotImplementedException();
        }

        public void RemoveReference(string name)
        {
            throw new NotImplementedException();
        }

        public bool IsSupportedFile(string path)
        {
            throw new NotImplementedException();
        }

        public string ResolvePath(string path)
        {
            throw new NotImplementedException();
        }

        public bool IsBindingRedirectSupported
        {
            get { return false; }
        }

        public void AddImport(string targetFullPath, ProjectImportLocation location)
        {
            throw new NotImplementedException();
        }

        public void RemoveImport(string targetFullPath)
        {
            throw new NotImplementedException();
        }

        public bool FileExistsInProject(string path)
        {
            throw new NotImplementedException();
        }

        public ILogger Logger
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public string Root
        {
            get { throw new NotImplementedException(); }
        }

        public void DeleteDirectory(string path, bool recursive)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<string> GetFiles(string path, string filter, bool recursive)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<string> GetDirectories(string path)
        {
            throw new NotImplementedException();
        }

        public string GetFullPath(string path)
        {
            throw new NotImplementedException();
        }

        public void DeleteFile(string path)
        {
            throw new NotImplementedException();
        }

        public void DeleteFiles(IEnumerable<IPackageFile> files, string rootDir)
        {
            throw new NotImplementedException();
        }

        public bool FileExists(string path)
        {
            throw new NotImplementedException();
        }

        public bool DirectoryExists(string path)
        {
            throw new NotImplementedException();
        }

        public void AddFile(string path, Stream stream)
        {
            throw new NotImplementedException();
        }

        public void AddFile(string path, Action<Stream> writeToStream)
        {
            throw new NotImplementedException();
        }

        public void AddFiles(IEnumerable<IPackageFile> files, string rootDir)
        {
            throw new NotImplementedException();
        }

        public void MakeFileWritable(string path)
        {
            throw new NotImplementedException();
        }

        public void MoveFile(string source, string destination)
        {
            throw new NotImplementedException();
        }

        public Stream CreateFile(string path)
        {
            throw new NotImplementedException();
        }

        public Stream OpenFile(string path)
        {
            throw new NotImplementedException();
        }

        public DateTimeOffset GetLastModified(string path)
        {
            throw new NotImplementedException();
        }

        public DateTimeOffset GetCreated(string path)
        {
            throw new NotImplementedException();
        }

        public DateTimeOffset GetLastAccessed(string path)
        {
            throw new NotImplementedException();
        }

        public dynamic GetPropertyValue(string propertyName)
        {
            throw new NotImplementedException();
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.staschum"
          android:versionCode="1"
          android:versionName="1.0">
</manifest>


text:
package sample.actuator.noweb;

import org.junit.Test;
import org.junit.runner.RunWith;

import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * Basic integration tests for service demo application.
 *
 * @author Dave Syer
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class SampleActuatorNoWebApplicationTests {

	@Test
	public void contextLoads() {

	}

}


text: dotnet pack StatsSharp\StatsSharp.csproj -c Release


text:
/**
 * Lazy loading functionality.
 *
 * @since 3.0
 */

( function() {
    'use strict';

    WP_Smush.Lazyload = {
        lazyloadEnableButton: document.getElementById('smush-enable-lazyload'),
        lazyloadDisableButton: document.getElementById('smush-cancel-lazyload'),

        init: function () {
            const self = this;

            /**
             * Handle "Activate" button click on disabled Lazy load page.
             */
            if ( this.lazyloadEnableButton ) {
                this.lazyloadEnableButton.addEventListener('click', (e) => {
                    e.currentTarget.classList.add('sui-button-onload');

                    // Force repaint of the spinner.
                    const loader = e.currentTarget.querySelector('.sui-icon-loader');
                    loader.style.display = 'none';
                    loader.offsetHeight;
                    loader.style.display = 'flex';

                    this.toggle_lazy_load(true);
                });
            }

            /**
             * Handle "Deactivate' button click on Lazy load page.
             */
            if ( this.lazyloadDisableButton ) {
                this.lazyloadDisableButton.addEventListener('click', (e) => {
                    e.preventDefault();
                    this.toggle_lazy_load(false);
                });
            }

            /**
             * Handle "Remove icon" button click on Lazy load page.
             *
             * This removes the image from the upload placeholder.
             *
             * @since 3.2.2
             */
            const removeSpinner = document.getElementById('smush-remove-spinner');
            if ( removeSpinner ) {
                removeSpinner.addEventListener('click', (e) => {
                    e.preventDefault();
                    this.removeLoaderIcon();
                });
            }
            const removePlaceholder = document.getElementById('smush-remove-placeholder');
            if ( removePlaceholder ) {
                removePlaceholder.addEventListener('click', (e) => {
                    e.preventDefault();
                    this.removeLoaderIcon('placeholder');
                });
            }

            /**
             * Handle "Remove" icon click.
             *
             * This removes the select icon from the list (not same as above functions).
             *
             * @since 3.2.2
             */
            const items = document.querySelectorAll( '.smush-ll-remove' );
            if ( items && 0 < items.length ) {
                items.forEach(function ( el ) {
                    el.addEventListener('click', (e) => {
                        e.preventDefault();
                        e.target.closest('li').style.display = 'none';
                        self.remove(e.target.dataset.id, e.target.dataset.type);
                    })
                })
            }

        },

        /**
         * Toggle lazy loading.
         *
         * @since 3.2.0
         *
         * @param enable
         */
        toggle_lazy_load: function ( enable ) {
            const nonceField = document.getElementsByName('wp_smush_options_nonce');

            const xhr = new XMLHttpRequest();
            xhr.open('POST', ajaxurl+'?action=smush_toggle_lazy_load', true);
            xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
            xhr.onload = () => {
                if (200 === xhr.status ) {
                    const res = JSON.parse(xhr.response);
                    if ( 'undefined' !== typeof res.success && res.success ) {
                        location.reload();
                    } else if ( 'undefined' !== typeof res.data.message ) {
                        this.showNotice( res.data.message );
                    }
                } else {
                    console.log('Request failed.  Returned status of ' + xhr.status);
                }
            };
            xhr.send('param='+enable+'&_ajax_nonce='+nonceField[0].value);
        },

        /**
         * Show message (notice).
         *
         * @since 3.0
         *
         * @param {string} message
         */
        showNotice: function ( message ) {
            if ( 'undefined' === typeof message ) {
                return;
            }

            const notice = document.getElementById('wp-smush-ajax-notice');

            notice.classList.add('sui-notice-error');
            notice.innerHTML = `<p>${message}</p>`;

            if ( this.cdnEnableButton ) {
                this.cdnEnableButton.classList.remove('sui-button-onload');
            }

            notice.style.display = 'block';
            setTimeout( () => { notice.style.display = 'none' }, 5000 );
        },

        /**
         * Add lazy load spinner icon.
         *
         * @since 3.2.2
         * @param {string} type  Accepts: spinner, placeholder.
         */
        addLoaderIcon: function(type = 'spinner') {
            let frame;

            // If the media frame already exists, reopen it.
            if ( frame ) {
                frame.open();
                return;
            }

            // Create a new media frame
            frame = wp.media({
                title: 'Select or upload an icon',
                button: {
                    text: 'Select icon'
                },
                multiple: false  // Set to true to allow multiple files to be selected
            });

            // When an image is selected in the media frame...
            frame.on( 'select', function() {
                // Get media attachment details from the frame state
                const attachment = frame.state().get('selection').first().toJSON();

                // Send the attachment URL to our custom image input field.
                const imageIcon = document.getElementById('smush-'+type+'-icon-preview');
                imageIcon.style.backgroundImage = 'url("'+attachment.url+'")';
                imageIcon.style.display = 'block';

                // Send the attachment id to our hidden input
                document.getElementById('smush-'+type+'-icon-file').setAttribute('value', attachment.id);

                // Hide the add image link
                document.getElementById('smush-upload-'+type).style.display = 'none';

                // Unhide the remove image link
                const removeDiv = document.getElementById('smush-remove-'+type);
                removeDiv.querySelector('span').innerHTML = attachment.filename;
                removeDiv.style.display = 'block';
            });

            // Finally, open the modal on click
            frame.open();
        },

        /**
         * Remove lazy load spinner icon.
         *
         * @since 3.2.2
         * @param {string} type  Accepts: spinner, placeholder.
         */
        removeLoaderIcon: (type = 'spinner') => {
            // Clear out the preview image
            const imageIcon = document.getElementById('smush-'+type+'-icon-preview');
            imageIcon.style.backgroundImage = '';
            imageIcon.style.display = 'none';

            // Un-hide the add image link
            document.getElementById('smush-upload-'+type).style.display = 'block';

            // Hide the delete image link
            document.getElementById('smush-remove-'+type).style.display = 'none';

            // Delete the image id from the hidden input
            document.getElementById('smush-'+type+'-icon-file').setAttribute('value', '');
        },

        /**
         * Remove item.
         *
         * @param {Number} id    Image ID.
         * @param {string} type  Accepts: spinner, placeholder.
         */
        remove: (id, type = 'spinner') => {
            const nonceField = document.getElementsByName('wp_smush_options_nonce');
            const xhr = new XMLHttpRequest();
            xhr.open('POST', ajaxurl+'?action=smush_remove_icon', true);
            xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
            xhr.send('id='+id+'&type='+type+'&_ajax_nonce='+nonceField[0].value);
        }
    };

    WP_Smush.Lazyload.init();

}());


text:
(function () {
    'use strict';

    var ostring = Object.prototype.toString;
    var slice = Array.prototype.slice;
    function noop() {
    }
    function head(indexed) {
        return (!indexed || indexed.length < 1) ? undefined : indexed[0];
    }
    function isArray(a) {
        return !isString(a) && isNumber(a.length);
    }
    function isDefined(a) {
        return a !== undefined && a !== null && a !== '';
    }
    function isFunction(a) {
        return ostring.call(a) === '[object Function]';
    }
    function isNumber(a) {
        return typeof a === 'number';
    }
    function isString(a) {
        return typeof a === 'string';
    }
    function toArray(indexed) {
        return slice.call(indexed, 0);
    }
    function each(items, fn) {
        for (var i = 0, len = items.length; i < len; i++) {
            fn(items[i]);
        }
    }
    function max(items, propertyName) {
        var max = '';
        for (var i = 0, len = items.length; i < len; i++) {
            var item = items[i];
            var prop = item[propertyName];
            if (max < prop) {
                max = prop;
            }
        }
        return max;
    }
    function map(items, fn) {
        var results = [];
        for (var i = 0, len = items.length; i < len; i++) {
            var result = fn(items[i]);
            if (result !== undefined) {
                results.push(result);
            }
        }
        return results;
    }
    function extend(target) {
        var sources = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            sources[_i - 1] = arguments[_i];
        }
        for (var i = 1, len = arguments.length; i < len; i++) {
            var source = arguments[i];
            for (var propName in source) {
                target[propName] = source[propName];
            }
        }
        return target;
    }
    function multiapply(targets, fnName, args, cb) {
        var errors = [];
        var results = [];
        for (var i = 0, len = targets.length; i < len; i++) {
            try {
                var target = targets[i];
                var result = void 0;
                if (fnName) {
                    result = target[fnName].apply(target, args);
                }
                else {
                    result = target.apply(undefined, args);
                }
                if (result !== undefined) {
                    results.push(result);
                }
            }
            catch (err) {
                errors.push(err);
            }
        }
        if (isFunction(cb)) {
            cb(errors);
        }
        return results;
    }

    var x = 0;
    var y = 1;
    var z = 2;
    function replaceCamelCased(match, p1, p2) {
        return p1 + p2.toUpperCase();
    }
    function animationTransformer(a) {
        var keyframes = map(a.keyframes, keyframeTransformer);
        return {
            keyframes: normalizeKeyframes(keyframes),
            name: a.name,
            timings: extend({}, a.timings)
        };
    }
    function normalizeKeyframes(keyframes) {
        var len = keyframes.length;
        if (len < 2) {
            return keyframes;
        }
        var first = keyframes[0];
        var last = keyframes[len - 1];
        for (var i = 1; i < len; i++) {
            var keyframe = keyframes[i];
            for (var prop in keyframe) {
                if (prop === 'offset' || isDefined(first[prop])) {
                    continue;
                }
                first[prop] = keyframe[prop];
            }
        }
        for (var i = len - 2; i > -1; i--) {
            var keyframe = keyframes[i];
            for (var prop in keyframe) {
                if (prop === 'offset' || isDefined(last[prop])) {
                    continue;
                }
                last[prop] = keyframe[prop];
            }
        }
        return keyframes;
    }
    function keyframeTransformer(keyframe) {
        var scale = new Array(3);
        var skew = new Array(2);
        var translate = new Array(3);
        var output = {};
        var transform = '';
        for (var prop in keyframe) {
            var value = keyframe[prop];
            if (value === undefined || value === null || value === '') {
                continue;
            }
            switch (prop) {
                case 'scale3d':
                    if (isArray(value)) {
                        var arr = value;
                        if (arr.length !== 3) {
                            throw Error('scale3d requires x, y, & z');
                        }
                        scale[x] = arr[x];
                        scale[y] = arr[y];
                        scale[z] = arr[z];
                        continue;
                    }
                    if (isNumber(value)) {
                        scale[x] = value;
                        scale[y] = value;
                        scale[z] = value;
                        continue;
                    }
                    throw Error('scale3d requires a number or number[]');
                case 'scale':
                    if (isArray(value)) {
                        var arr = value;
                        if (arr.length !== 2) {
                            throw Error('scale requires x & y');
                        }
                        scale[x] = arr[x];
                        scale[y] = arr[y];
                        continue;
                    }
                    if (isNumber(value)) {
                        scale[x] = value;
                        scale[y] = value;
                        continue;
                    }
                    throw Error('scale requires a number or number[]');
                case 'scaleX':
                    if (isNumber(value)) {
                        scale[x] = value;
                        continue;
                    }
                    throw Error('scaleX requires a number');
                case 'scaleY':
                    if (isNumber(value)) {
                        scale[y] = value;
                        continue;
                    }
                    throw Error('scaleY requires a number');
                case 'scaleZ':
                    if (isNumber(value)) {
                        scale[z] = value;
                        continue;
                    }
                    throw Error('scaleZ requires a number');
                case 'skew':
                    if (isArray(value)) {
                        var arr = value;
                        if (arr.length !== 2) {
                            throw Error('skew requires x & y');
                        }
                        skew[x] = arr[x];
                        skew[y] = arr[y];
                        continue;
                    }
                    if (isNumber(value)) {
                        skew[x] = value;
                        skew[y] = value;
                        continue;
                    }
                    throw Error('skew requires a number, string, string[], or number[]');
                case 'skewX':
                    if (isString(value)) {
                        skew[x] = value;
                        continue;
                    }
                    throw Error('skewX requires a number or string');
                case 'skewY':
                    if (isString(value)) {
                        skew[y] = value;
                        continue;
                    }
                    throw Error('skewY requires a number or string');
                case 'rotate3d':
                    if (isArray(value)) {
                        var arr = value;
                        if (arr.length !== 4) {
                            throw Error('rotate3d requires x, y, z, & a');
                        }
                        transform += " rotate3d(" + arr[0] + "," + arr[1] + "," + arr[2] + "," + arr[3] + ")";
                        continue;
                    }
                    throw Error('rotate3d requires an []');
                case 'rotateX':
                    if (isString(value)) {
                        transform += " rotate3d(1, 0, 0, " + value + ")";
                        continue;
                    }
                    throw Error('rotateX requires a string');
                case 'rotateY':
                    if (isString(value)) {
                        transform += " rotate3d(0, 1, 0, " + value + ")";
                        continue;
                    }
                    throw Error('rotateY requires a string');
                case 'rotate':
                case 'rotateZ':
                    if (isString(value)) {
                        transform += " rotate3d(0, 0, 1, " + value + ")";
                        continue;
                    }
                    throw Error('rotateZ requires a string');
                case 'translate3d':
                    if (isArray(value)) {
                        var arr = value;
                        if (arr.length !== 3) {
                            throw Error('translate3d requires x, y, & z');
                        }
                        translate[x] = arr[x];
                        translate[y] = arr[y];
                        translate[z] = arr[z];
                        continue;
                    }
                    if (isString(value) || isNumber(value)) {
                        translate[x] = value;
                        translate[y] = value;
                        translate[z] = value;
                        continue;
                    }
                    throw Error('translate3d requires a number, string, string[], or number[]');
                case 'translate':
                    if (isArray(value)) {
                        var arr = value;
                        if (arr.length !== 2) {
                            throw Error('translate requires x & y');
                        }
                        translate[x] = arr[x];
                        translate[y] = arr[y];
                        continue;
                    }
                    if (isString(value) || isNumber(value)) {
                        translate[x] = value;
                        translate[y] = value;
                        continue;
                    }
                    throw Error('translate requires a number, string, string[], or number[]');
                case 'translateX':
                    if (isString(value) || isNumber(value)) {
                        translate[x] = value;
                        continue;
                    }
                    throw Error('translateX requires a number or string');
                case 'translateY':
                    if (isString(value) || isNumber(value)) {
                        translate[y] = value;
                        continue;
                    }
                    throw Error('translateY requires a number or string');
                case 'translateZ':
                    if (isString(value) || isNumber(value)) {
                        translate[z] = value;
                        continue;
                    }
                    throw Error('translateZ requires a number or string');
                case 'transform':
                    transform += ' ' + value;
                    break;
                default:
                    var prop2 = prop.replace(/([a-z])-([a-z])/ig, replaceCamelCased);
                    output[prop2] = value;
                    break;
            }
        }
        var isScaleX = scale[x] !== undefined;
        var isScaleY = scale[y] !== undefined;
        var isScaleZ = scale[z] !== undefined;
        if (isScaleX && isScaleZ || isScaleY && isScaleZ) {
            var scaleString = scale.map(function (s) { return s || '1'; }).join(',');
            transform += " scale3d(" + scaleString + ")";
        }
        else if (isScaleX && isScaleY) {
            transform += " scale(" + (scale[x] || 1) + ", " + (scale[y] || 1) + ")";
        }
        else if (isScaleX) {
            transform += " scaleX(" + scale[x] + ")";
        }
        else if (isScaleY) {
            transform += " scaleX(" + scale[y] + ")";
        }
        else if (isScaleZ) {
            transform += " scaleX(" + scale[z] + ")";
        }
        else {
        }
        var isskewX = skew[x] !== undefined;
        var isskewY = skew[y] !== undefined;
        if (isskewX && isskewY) {
            transform += " skew(" + (skew[x] || 1) + ", " + (skew[y] || 1) + ")";
        }
        else if (isskewX) {
            transform += " skewX(" + skew[x] + ")";
        }
        else if (isskewY) {
            transform += " skewX(" + skew[y] + ")";
        }
        else {
        }
        var istranslateX = translate[x] !== undefined;
        var istranslateY = translate[y] !== undefined;
        var istranslateZ = translate[z] !== undefined;
        if (istranslateX && istranslateZ || istranslateY && istranslateZ) {
            var translateString = translate.map(function (s) { return s || '1'; }).join(',');
            transform += " translate3d(" + translateString + ")";
        }
        else if (istranslateX && istranslateY) {
            transform += " translate(" + (translate[x] || 1) + ", " + (translate[y] || 1) + ")";
        }
        else if (istranslateX) {
            transform += " translateX(" + translate[x] + ")";
        }
        else if (istranslateY) {
            transform += " translateX(" + translate[y] + ")";
        }
        else if (istranslateZ) {
            transform += " translateX(" + translate[z] + ")";
        }
        else {
        }
        if (transform) {
            output['transform'] = transform;
        }
        return output;
    }

    var easings = {
        easeInBack: 'cubic-bezier(0.600, -0.280, 0.735, 0.045)',
        easeInCirc: 'cubic-bezier(0.600, 0.040, 0.980, 0.335)',
        easeInCubic: 'cubic-bezier(0.550, 0.055, 0.675, 0.190)',
        easeInExpo: 'cubic-bezier(0.950, 0.050, 0.795, 0.035)',
        easeInOutBack: 'cubic-bezier(0.680, -0.550, 0.265, 1.550)',
        easeInOutCirc: 'cubic-bezier(0.785, 0.135, 0.150, 0.860)',
        easeInOutCubic: 'cubic-bezier(0.645, 0.045, 0.355, 1.000)',
        easeInOutExpo: 'cubic-bezier(1.000, 0.000, 0.000, 1.000)',
        easeInOutQuad: 'cubic-bezier(0.455, 0.030, 0.515, 0.955)',
        easeInOutQuart: 'cubic-bezier(0.770, 0.000, 0.175, 1.000)',
        easeInOutQuint: 'cubic-bezier(0.860, 0.000, 0.070, 1.000)',
        easeInOutSine: 'cubic-bezier(0.445, 0.050, 0.550, 0.950)',
        easeInQuad: 'cubic-bezier(0.550, 0.085, 0.680, 0.530)',
        easeInQuart: 'cubic-bezier(0.895, 0.030, 0.685, 0.220)',
        easeInQuint: 'cubic-bezier(0.755, 0.050, 0.855, 0.060)',
        easeInSine: 'cubic-bezier(0.470, 0.000, 0.745, 0.715)',
        easeOutBack: 'cubic-bezier(0.175,  0.885, 0.320, 1.275)',
        easeOutCirc: 'cubic-bezier(0.075, 0.820, 0.165, 1.000)',
        easeOutCubic: 'cubic-bezier(0.215, 0.610, 0.355, 1.000)',
        easeOutExpo: 'cubic-bezier(0.190, 1.000, 0.220, 1.000)',
        easeOutQuad: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
        easeOutQuart: 'cubic-bezier(0.165, 0.840, 0.440, 1.000)',
        easeOutQuint: 'cubic-bezier(0.230, 1.000, 0.320, 1.000)',
        easeOutSine: 'cubic-bezier(0.390, 0.575, 0.565, 1.000)',
        elegantSlowStartEnd: 'cubic-bezier(0.175, 0.885, 0.320, 1.275)'
    };

    function resolveElements(source) {
        if (!source) {
            throw Error('source is undefined');
        }
        if (isString(source)) {
            var nodeResults = document.querySelectorAll(source);
            return toArray(nodeResults);
        }
        if (source instanceof Element) {
            return [source];
        }
        if (isFunction(source)) {
            var provider = source;
            var result = provider();
            return resolveElements(result);
        }
        if (isArray(source)) {
            var elements_1 = [];
            each(source, function (i) {
                var innerElements = resolveElements(i);
                elements_1.push.apply(elements_1, innerElements);
            });
            return elements_1;
        }
        return [];
    }

    var ElementAnimator = (function () {
        function ElementAnimator(manager, keyframesOrName, el, timings) {
            var _this = this;
            if (!keyframesOrName) {
                return;
            }
            var keyframes;
            if (isString(keyframesOrName)) {
                var definition = manager.findAnimation(keyframesOrName);
                keyframes = definition.keyframes;
                timings = extend({}, definition.timings, timings);
            }
            else {
                keyframes = normalizeKeyframes(map(keyframesOrName, keyframeTransformer));
            }
            if (timings && timings.easing) {
                var easing = easings[timings.easing];
                if (easing) {
                    timings.easing = easing;
                }
            }
            this.duration = timings.duration;
            var elements = resolveElements(el);
            this._animators = multiapply(elements, 'animate', [keyframes, timings]);
            if (this._animators.length > 0) {
                this._animators[0].onfinish = function () {
                    _this.finish();
                };
            }
        }
        Object.defineProperty(ElementAnimator.prototype, "playbackRate", {
            get: function () {
                var first = head(this._animators);
                return first ? first.playbackRate : 0;
            },
            set: function (val) {
                each(this._animators, function (a) { return a.playbackRate = val; });
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(ElementAnimator.prototype, "currentTime", {
            get: function () {
                return max(this._animators, 'currentTime') || 0;
            },
            set: function (elapsed) {
                each(this._animators, function (a) { return a.currentTime = elapsed; });
            },
            enumerable: true,
            configurable: true
        });
        ElementAnimator.prototype.finish = function (fn) {
            var _this = this;
            multiapply(this._animators, 'finish', [], fn);
            if (this.playbackRate < 0) {
                each(this._animators, function (a) { return a.currentTime = 0; });
            }
            else {
                each(this._animators, function (a) { return a.currentTime = _this.duration; });
            }
            if (isFunction(this.onfinish)) {
                this.onfinish(this);
            }
            return this;
        };
        ElementAnimator.prototype.play = function (fn) {
            multiapply(this._animators, 'play', [], fn);
            return this;
        };
        ElementAnimator.prototype.pause = function (fn) {
            multiapply(this._animators, 'pause', [], fn);
            return this;
        };
        ElementAnimator.prototype.reverse = function (fn) {
            multiapply(this._animators, 'reverse', [], fn);
            return this;
        };
        ElementAnimator.prototype.cancel = function (fn) {
            multiapply(this._animators, 'cancel', [], fn);
            each(this._animators, function (a) { return a.currentTime = 0; });
            if (isFunction(this.oncancel)) {
                this.oncancel(this);
            }
            return this;
        };
        return ElementAnimator;
    }());

    var SequenceAnimator = (function () {
        function SequenceAnimator(manager, options) {
            var steps = map(options.steps, function (step) {
                if (step.command || !step.name) {
                    return step;
                }
                var definition = manager.findAnimation(step.name);
                var timings = extend({}, definition.timings);
                if (step.timings) {
                    timings = extend(timings, step.timings);
                }
                return {
                    el: step.el,
                    keyframes: definition.keyframes,
                    timings: definition.timings
                };
            });
            this.onfinish = noop;
            this._currentIndex = -1;
            this._manager = manager;
            this._steps = steps;
            if (options.autoplay === true) {
                this.play();
            }
        }
        Object.defineProperty(SequenceAnimator.prototype, "currentTime", {
            get: function () {
                var currentIndex = this._currentIndex;
                var len = this._steps.length;
                if (currentIndex === -1 || currentIndex === len) {
                    return 0;
                }
                var isReversed = this.playbackRate === -1;
                var beforeTime = 0;
                var afterTime = 0;
                var currentTime;
                for (var i = 0; i < len; i++) {
                    var step = this._steps[i];
                    if (i < currentIndex) {
                        beforeTime += step.timings.duration;
                        continue;
                    }
                    if (i > currentIndex) {
                        afterTime += step.timings.duration;
                        continue;
                    }
                    if (isReversed) {
                        currentTime = this.duration - step.animator.currentTime;
                        continue;
                    }
                    currentTime = step.animator.currentTime;
                }
                return currentTime + (isReversed ? afterTime : beforeTime);
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(SequenceAnimator.prototype, "duration", {
            get: function () {
                return this._steps.reduce(function (c, n) { return c + (n.timings.duration || 0); }, 0);
            },
            enumerable: true,
            configurable: true
        });
        SequenceAnimator.prototype.finish = function (fn) {
            this._errorCallback = fn;
            this._currentIndex = -1;
            for (var x = 0; x < this._steps.length; x++) {
                var step = this._steps[x];
                if (step.animator !== undefined) {
                    step.animator.cancel(fn);
                }
            }
            if (isFunction(this.onfinish)) {
                this.onfinish(this);
            }
            return this;
        };
        SequenceAnimator.prototype.play = function (fn) {
            this._errorCallback = fn;
            this.playbackRate = 1;
            this._playThisStep();
            return this;
        };
        SequenceAnimator.prototype.pause = function (fn) {
            this._errorCallback = fn;
            if (!this._isInEffect()) {
                return this;
            }
            var animator = this._getAnimator();
            animator.pause(fn);
            return this;
        };
        SequenceAnimator.prototype.reverse = function (fn) {
            this._errorCallback = fn;
            this.playbackRate = -1;
            this._playThisStep();
            return this;
        };
        SequenceAnimator.prototype.cancel = function (fn) {
            this._errorCallback = fn;
            this.playbackRate = undefined;
            this._currentIndex = -1;
            for (var x = 0; x < this._steps.length; x++) {
                var step = this._steps[x];
                if (step.animator !== undefined) {
                    step.animator.cancel(fn);
                }
            }
            if (isFunction(this.oncancel)) {
                this.oncancel(this);
            }
            return this;
        };
        SequenceAnimator.prototype._isInEffect = function () {
            return this._currentIndex > -1 && this._currentIndex < this._steps.length;
        };
        SequenceAnimator.prototype._getAnimator = function () {
            var it = this._steps[this._currentIndex];
            if (it.animator) {
                return it.animator;
            }
            it.animator = this._manager.animate(it.keyframes, it.el, it.timings);
            return it.animator;
        };
        SequenceAnimator.prototype._playNextStep = function (evt) {
            if (this.playbackRate === -1) {
                this._currentIndex--;
            }
            else {
                this._currentIndex++;
            }
            if (this._isInEffect()) {
                this._playThisStep();
            }
            else {
                this.onfinish(evt);
            }
        };
        SequenceAnimator.prototype._playThisStep = function () {
            var _this = this;
            if (!this._isInEffect()) {
                if (this.playbackRate === -1) {
                    this._currentIndex = this._steps.length - 1;
                }
                else {
                    this._currentIndex = 0;
                }
            }
            var animator = this._getAnimator();
            animator.onfinish = function (evt) {
                _this._playNextStep(evt);
            };
            animator.play(this._errorCallback);
        };
        return SequenceAnimator;
    }());

    var animationPadding = 1.0 / 30;
    var TimelineAnimator = (function () {
        function TimelineAnimator(manager, options) {
            var duration = options.duration;
            if (duration === undefined) {
                throw Error('Duration is required');
            }
            this.playbackRate = 0;
            this.duration = options.duration;
            this.currentTime = 0;
            this._events = map(options.events, function (evt) { return new TimelineEvent(manager, duration, evt); });
            this._isPaused = false;
            this._manager = manager;
            this._tick = this._tick.bind(this);
            if (options.autoplay) {
                this.play();
            }
        }
        TimelineAnimator.prototype.finish = function (fn) {
            this._isFinished = true;
            return this;
        };
        TimelineAnimator.prototype.play = function (fn) {
            this.playbackRate = 1;
            this._isPaused = false;
            if (this._isInEffect) {
                return this;
            }
            if (this.playbackRate < 0) {
                this.currentTime = this.duration;
            }
            else {
                this.currentTime = 0;
            }
            window.requestAnimationFrame(this._tick);
            return this;
        };
        TimelineAnimator.prototype.pause = function (fn) {
            if (this._isInEffect) {
                this._isPaused = true;
            }
            return this;
        };
        TimelineAnimator.prototype.reverse = function (fn) {
            this.playbackRate = -1;
            this._isPaused = false;
            if (this._isInEffect) {
                return this;
            }
            if (this.currentTime <= 0) {
                this.currentTime = this.duration;
            }
            window.requestAnimationFrame(this._tick);
            return this;
        };
        TimelineAnimator.prototype.cancel = function (fn) {
            this.playbackRate = 0;
            this._isCanceled = true;
            return this;
        };
        TimelineAnimator.prototype._tick = function () {
            var _this = this;
            if (this._isCanceled) {
                this._triggerCancel();
                return;
            }
            if (this._isFinished) {
                this._triggerFinish();
                return;
            }
            if (this._isPaused) {
                this._triggerPause();
                return;
            }
            if (!this._isInEffect) {
                this._isInEffect = true;
            }
            var thisTick = performance.now();
            var lastTick = this._lastTick;
            if (lastTick !== undefined) {
                var delta = (thisTick - lastTick) * this.playbackRate;
                this.currentTime += delta;
            }
            this._lastTick = thisTick;
            if (this.currentTime > this.duration || this.currentTime < 0) {
                this._triggerFinish();
                return;
            }
            each(this._events, function (evt) {
                var startTimeMs = _this.playbackRate < 0 ? evt.startTimeMs : evt.startTimeMs + animationPadding;
                var endTimeMs = _this.playbackRate >= 0 ? evt.endTimeMs : evt.endTimeMs - animationPadding;
                var shouldBeActive = startTimeMs <= _this.currentTime && _this.currentTime < endTimeMs;
                if (!shouldBeActive) {
                    evt.isInEffect = false;
                    return;
                }
                evt.animator.playbackRate = _this.playbackRate;
                evt.isInEffect = true;
                evt.animator.play();
            });
            window.requestAnimationFrame(this._tick);
        };
        TimelineAnimator.prototype._triggerFinish = function () {
            this._reset();
            each(this._events, function (evt) { return evt.animator.finish(); });
            if (isFunction(this.onfinish)) {
                this.onfinish(this);
            }
        };
        TimelineAnimator.prototype._triggerCancel = function () {
            this._reset();
            each(this._events, function (evt) { return evt.animator.cancel(); });
            if (isFunction(this.oncancel)) {
                this.oncancel(this);
            }
        };
        TimelineAnimator.prototype._triggerPause = function () {
            this._isPaused = true;
            this._isInEffect = false;
            this._lastTick = undefined;
            this.playbackRate = 0;
            each(this._events, function (evt) {
                evt.isInEffect = false;
                evt.animator.pause();
            });
        };
        TimelineAnimator.prototype._reset = function () {
            this.currentTime = 0;
            this._lastTick = undefined;
            this._isCanceled = false;
            this._isFinished = false;
            this._isPaused = false;
            this._isInEffect = false;
            each(this._events, function (evt) {
                evt.isInEffect = false;
            });
        };
        return TimelineAnimator;
    }());
    var TimelineEvent = (function () {
        function TimelineEvent(manager, timelineDuration, evt) {
            var keyframes;
            var timings;
            var el;
            if (evt.name) {
                var definition = manager.findAnimation(evt.name);
                var timings2 = extend({}, definition.timings);
                if (evt.timings) {
                    timings = extend(timings2, evt.timings);
                }
                keyframes = definition.keyframes;
                timings = timings2;
                el = evt.el;
            }
            else {
                keyframes = evt.keyframes;
                timings = evt.timings;
                el = evt.el;
            }
            var startTime = timelineDuration * evt.offset;
            var endTime = startTime + timings.duration;
            var isClipped = endTime > timelineDuration;
            if (isClipped) {
                endTime = timelineDuration;
            }
            this.el = el;
            this.isClipped = isClipped;
            this.isInEffect = false;
            this.endTimeMs = endTime;
            this.keyframes = keyframes;
            this.offset = evt.offset;
            this.startTimeMs = startTime;
            this.timings = timings;
            this._manager = manager;
        }
        Object.defineProperty(TimelineEvent.prototype, "animator", {
            get: function () {
                if (this._animator === undefined) {
                    this._animator = this._manager.animate(this.keyframes, this.el, this.timings);
                    this._animator.pause();
                }
                return this._animator;
            },
            enumerable: true,
            configurable: true
        });
        return TimelineEvent;
    }());

    var DEFAULT_ANIMATIONS = [];
    var JustAnimate = (function () {
        function JustAnimate() {
            var _this = this;
            this._registry = {};
            each(DEFAULT_ANIMATIONS, function (a) { return _this._registry[a.name] = a; });
        }
        JustAnimate.inject = function (animations) {
            Array.prototype.push.apply(DEFAULT_ANIMATIONS, map(animations, animationTransformer));
        };
        JustAnimate.prototype.animate = function (keyframesOrName, el, timings) {
            return new ElementAnimator(this, keyframesOrName, el, timings);
        };
        JustAnimate.prototype.animateSequence = function (options) {
            return new SequenceAnimator(this, options);
        };
        JustAnimate.prototype.animateTimeline = function (options) {
            return new TimelineAnimator(this, options);
        };
        JustAnimate.prototype.findAnimation = function (name) {
            return this._registry[name] || undefined;
        };
        JustAnimate.prototype.register = function (animationOptions) {
            this._registry[animationOptions.name] = animationTransformer(animationOptions);
            return this;
        };
        return JustAnimate;
    }());

    if (typeof angular !== 'undefined') {
        angular.module('just.animate', []).service('just', JustAnimate);
    }
    var animationManager = undefined;
    function getManager() {
        if (animationManager === undefined) {
            animationManager = new JustAnimate();
        }
        return animationManager;
    }
    var just = {
        animate: function (keyframesOrName, el, timings) {
            return getManager().animate(keyframesOrName, el, timings);
        },
        animateSequence: function (options) {
            return getManager().animateSequence(options);
        },
        animateTimeline: function (options) {
            return getManager().animateTimeline(options);
        },
        findAnimation: function (name) {
            return getManager().findAnimation(name);
        },
        inject: function (animations) {
            if (animationManager !== undefined) {
                console.warn('Animations must be injected prior to using Just.*');
            }
            JustAnimate.inject(animations);
        },
        register: function (animationOptions) {
            return getManager().register(animationOptions);
        }
    };
    window.Just = just;

}());


text:
<link rel="import" href="core_dropdown_menu_nodart.html">
<link rel="import" href="core_a11y_keys.html">
<link rel="import" href="core_dropdown_base.html">
<link rel="import" href="core_focusable.html">
<link rel="import" href="core_icon.html">
<link rel="import" href="core_icons.html">

<script type="application/dart" src="core_dropdown_menu.dart"></script>


text:
"""Test of interactive features, including a button widget."""

import matplotlib
matplotlib.use('module://mplh5canvas.backend_h5canvas')
from pylab import *
import time

def onclick(ev):
    """Callback when mouse button is released."""
    print "Received click. X: %i, Y: %i" % (ev.x, ev.y)
    if ev.inaxes is not None:
        print "Data X: %f, Data Y: %f" % (ev.xdata, ev.ydata)
    else:
        print "Click was not over active axes."

def next_data(ax):
    """Shift data along x-axis."""
    t = ax.lines[0].get_xdata() + 0.2
    s = sin(2*pi*t)
    ax.lines[0].set_xdata(t)
    ax.lines[0].set_ydata(s)
    ax.set_xlim(t[0], t[-1])

t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
plot(t, s, linewidth=1.0)
xlabel('time (s)')
ylabel('voltage (mV)')
title('Interactive widgets')
f = gcf()
f.canvas.mpl_connect('button_release_event', onclick)
ax = f.gca()

next_target_button = matplotlib.widgets.Button(axes([0.1, 0.05, 0.06, 0.04]), 'Next')
def next_target_callback(event):
    next_data(ax)
    f.canvas.draw()
    print "Next was called..."
next_target_button.on_clicked(next_target_callback)

show()


text:
/* $Id$ */

/*
 * This file is part of the RTF library of the FOP project, which was originally
 * created by Bertrand Delacretaz bdelacretaz@codeconsult.ch and by other
 * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to
 * the FOP project.
 */

package org.apache.fop.render.rtf.rtflib.testdocs;

import java.io.IOException;

import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfList;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfListItem;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow;

/**  Generates a simple RTF test document for the jfor rtflib package.
 */

class ListInTable extends TestDocument {
    /** generate the body of the test document */
    protected void generateDocument(RtfDocumentArea rda, RtfSection sect)
    throws IOException {
        sect.newParagraph().newText("There must be a table below where the "
                + "second cell contains a bulleted list mixed with normal paragraphs");

        final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo());
        final RtfTableRow row = tbl.newTableRow();
        row.newTableCell(RtfTableCell.DEFAULT_CELL_WIDTH).newParagraph().newText("cell A, simple");

        final RtfTableCell c = row.newTableCell(RtfTableCell.DEFAULT_CELL_WIDTH);
        c.newParagraph().newText("cell B, contains this paragraph followed by "
                + "a list and another paragraph");
        fillList(c.newList(null), 1, 3);
        c.newParagraph().newText("Normal paragraph, follows the list.");

        row.newTableCell(RtfTableCell.DEFAULT_CELL_WIDTH).newParagraph().newText("cell C, simple");
    }

    private void fillList(RtfList list, int listIndex, int nItems)
    throws IOException {
        for (int i = 0; i < nItems; i++) {
            final RtfListItem item = list.newListItem();
            for (int j = 0; j <= i; j++) {
                final RtfParagraph para = item.newParagraph();
                para.newText("List " + listIndex + ", item " + i + ", paragraph " + j);
                if (i == 0 && j == 0) {
                    final String txt = "This item takes more than one line to check word-wrapping.";
                    para.newText(". " + "This list must have " + nItems
                            + " items. " + txt + " " + txt + " " + txt);
                }
            }
        }
    }
}


text:
import java.io._

object Io {

  def useReaderWriter[R](arguments: Array[String])(block: (BufferedReader, PrintWriter) => R) = {
    use(
      new BufferedReader(
        if (arguments.length == 0) new InputStreamReader(System.in)
        else new FileReader(arguments(0))),
      new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))))(block)
  }

  def use[A <: Closeable, B <: Closeable, R](resourceA: A, resourceB: B)(block: (A, B) => R): R = {
    try {
      block(resourceA, resourceB)
    } finally {
      if (resourceA != null) resourceA.close()
      if (resourceB != null) resourceB.close()
    }
  }
}

object Solution {
  private final val AlphabetSize = 26

  private [this] def run(reader: BufferedReader, writer: PrintWriter) {
    val lineA = reader.readLine()
    val lineB = reader.readLine()
    val countA = new Array[Int](AlphabetSize)
    val countB = new Array[Int](AlphabetSize)

    for (c <- lineA) {
      countA(c - 'a') += 1
    }

    for (c <- lineB) {
      countB(c - 'a') += 1
    }

    var count = 0

    for (i <- 0 until AlphabetSize) {
      count += math.abs(countA(i) - countB(i))
    }

    writer.println(count)
  }
  def main(arguments: Array[String]) {
    Io.useReaderWriter(arguments)(run)
  }
}


text:
<?php

namespace CHMS\Common\Auth;

use Illuminate\Contracts\Auth\Guard as GuardContract;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Gate;
use Zend\Permissions\Acl\Acl as AclRules;
use CHMS\Common\Auth\Contexts\Guest as GuestContext;
use CHMS\Common\Auth\Contexts\RoleSet as RoleSetContext;
use CHMS\Common\Contracts\Acl as AclContract;
use CHMS\Common\Contracts\AclContext as AclContextContract;
use Zend\Permissions\Acl\Role\GenericRole as Role;
use Zend\Permissions\Acl\Exception\InvalidArgumentException;
use Cache;
use Auth;
use Laravel\Lumen\Application;

abstract class Acl implements AclContract
{
    const RESOURCE_ROUTE_PREFIX = 'r:';
    const ROUTE_PRIVILEGE = 'access';
    const RESOURCE_MODEL_PREFIX = 'm:';
    const RESOURCE_FIELD_PREFIX = 'f:';

    /**
     * @var Application
     */
    private $app;

    /**
     * @var array
     */
    private $config;

    /**
     * Registered contexts
     * @var array
     */
    private $contexts = [];

    /**
     * Current context
     * @var string
     */
    private $currentContext;

    /**
     * @var GuardContract
     */
    private $guard;

    /**
     * @var AclRules
     */
    private $aclRulesCache;

    /**
     * Constructor
     * @param Application $app
     * @param array       $config
     */
    public function __construct(Application $app, array $config)
    {
        $this->app = $app;
        $this->config = $config;
    }
    /**
     * Returns the Role model calss
     * @return string
     */
    abstract protected function getRoleModel();

    /**
     * @inheritdoc
     */
    public function setupRoles()
    {
        $roleModelClass = $this->getRoleModel();
        foreach ($this->config['roles'] as $roleId => $role) {
            if (!empty($role['virtual'])) {
                continue;
            }
            $roleModel = $roleModelClass::where('system_id', $roleId)->first();
            if (empty($roleModel)) {
                $roleModel = new $roleModelClass;
                $roleModel->system_id = $roleId;
                $roleModel->name = isset($role['name']) ? $role['name'] : $roleId;
                $roleModel->context = isset($role['context']) ? $role['context'] : 'system';
                if (!$roleModel->save()) {
                    return false;
                }
            }
        }
        return true;
    }

    /**
     * Check for access to a route
     *
     * @param  string $routeAlias
     * @return boolean
     */
    public function canAccessRoute($routeAlias)
    {
        return $this->isAllowed($this->routeResourceGenerator($routeAlias), static::ROUTE_PRIVILEGE);
    }

    /**
     * Check for access to a model
     *
     * @param  string $modelClass
     * @param  string|array $privilege
     * @return boolean
     */
    public function isAllowedModel($modelClass, $privilege = null)
    {
        return $this->isAllowed($this->modelResourceGenerator($modelClass), $privilege);
    }

    /**
     * Check for access to a model's field
     *
     * @param  string $modelClass
     * @param  string $fieldName
     * @param  string|array $privilege
     * @return boolean
     */
    public function isAllowedField($modelClass, $fieldName, $privilege = null)
    {
        return $this->isAllowed($this->fieldResourceGenerator($modelClass, $fieldName), $privilege);
    }

    /**
     * Check for a access to a resource
     *
     * @param  Zend\Permissions\Acl\Resource\ResourceInterface|string    $resource
     * @param  string|array                                              $privilege
     * @return boolean
     */
    public function isAllowed($resource = null, $privilege = null)
    {
        if (is_array($privilege)) {
            foreach ($privilege as $privilegeSingular) {
                if ($this->isAllowed($resource, $privilegeSingular)) {
                    return true;
                }
            }
            return false;
        }
        try {
            $result = $this->getContextualAcl()->isAllowed($this->getContextId(), $resource, $privilege);
        } catch (InvalidArgumentException $e) {
            return false;
        }
        return $result;
    }

    /**
     * Set up ACL rules with the current context
     *
     * @return AclRules
     */
    public function getContextualAcl()
    {
        $acl = $this->getRules();
        if (!$acl->hasRole($this->getContextId())) {
            $contextRoles = $this->getContext()->getRoles();
            if ($contextRoles instanceof RoleBucket) {
                $contextRoles = $contextRoles->toArray();
            }
            $acl->addRole(new Role($this->getContextId()), $contextRoles);
        }
        return $acl;
    }

    /**
     * Switch to a protected object context
     * @param  Model  $modelObject
     * @return AclContextContract
     */
    public function switchObjectContext(Model $modelObject = null)
    {
        return $this->initiateContext($modelObject);
    }

    /**
     * Switch to a explicit role (used in testing)
     *
     * @param  array|string|RoleBucket $roles
     * @return AclContextContract
     */
    public function switchRoleContext($roles)
    {
        if (is_string($roles)) {
            $roles = [$roles];
        }
        if (is_array($roles)) {
            $roleBucket = new RoleBucket($this);
            foreach ($roles as $role) {
                $roleBucket->add($role);
            }
        } else {
            $roleBucket = $roles;
        }
        $context = new RoleSetContext($roleBucket);
        $this->registerContext($context);
        $this->currentContext = $context->getId();
        return $context;
    }

    /**
     * Get the current context
     * @return AclContextContract
     */
    public function getContext()
    {
        if (!isset($this->currentContext)) {
            $this->initiateContext();
        }
        return $this->contexts[$this->currentContext];
    }

    /**
     * Register a context
     * @param  AclContextContract $context
     * @return self
     */
    public function registerContext(AclContextContract $context)
    {
        $this->contexts[$context->getId()] = $context;
        return $this;
    }

    /**
     * Initiate a context
     * @param  Model $modelObject Optional protected model
     * @return AclContextContract
     */
    private function initiateContext(Model $modelObject = null)
    {
        $context = $this->getContextFromAuth($modelObject);
        $this->registerContext($context);
        $this->currentContext = $context->getId();
        //\dump($context->getRoles()->toArray());exit;
        return $context;
    }

    /**
     * Get context from auth
     * @param  Model $modelObject Optional protected model
     * @return AclContextContract
     */
    protected function getContextFromAuth(Model $modelObject = null)
    {
        return new GuestContext(null, $modelObject);
    }

    /**
     * Get the current context's ID
     * @return string
     */
    public function getContextId()
    {
        return $this->getContext()->getId();
    }

    /**
     * Used by `RoleBucket` to determine role level
     * @param  string $id
     * @return int
     */
    public function getRoleLevel($id)
    {
        if (isset($this->config['roles'][$id]['level'])) {
            return $this->config['roles'][$id]['level'];
        }
        return 99999;
    }

    /**
     * Get the ACL object; use cache when possible
     *
     * @param  boolean $useCache
     * @return AclRules
     */
    public function getRules($useCache = true)
    {
        if (!$useCache) { //  || env('APP_ENV') !== 'production'
            return $this->loadRules();
        }
        if ($this->aclRulesCache === null) {
            $hash = sha1(serialize($this->config));
            $key = md5(__CLASS__.__FUNCTION__);
            $value = Cache::get($key, false);
            if ($value === false || $value['hash'] !== $hash) {
                $value = [
                    'hash' => $hash,
                    'acl' => $this->loadRules()
                ];
                Cache::forever($key, $value);
            }
            $this->aclRulesCache = $value['acl'];
        }
        return $this->aclRulesCache;
    }

    /**
     * Generate the ACL rules
     *
     * @return AclRules
     */
    private function loadRules()
    {
        $generator = new AclGenerator($this->config, $this->getGeneratorConfig());
        return $generator();
    }

    /**
     * Configuration for ACL generator
     * @return array
     */
    private function getGeneratorConfig()
    {
        return [
            'modelResourceGenerator' => [$this, 'modelResourceGenerator'],
            'fieldResourceGenerator' => [$this, 'fieldResourceGenerator'],
            'routeResourceGenerator' => [$this, 'routeResourceGenerator'],
            'routePrivilege' => static::ROUTE_PRIVILEGE
        ];
    }

    public function modelResourceGenerator($modelClass)
    {
        return static::RESOURCE_MODEL_PREFIX . substr(md5($modelClass), 0, 8);
    }

    public function fieldResourceGenerator($modelClass, $fieldName)
    {
        return static::RESOURCE_FIELD_PREFIX . substr(md5($modelClass . $fieldName), 0, 8);
    }

    public function routeResourceGenerator($routeClass)
    {
        return static::RESOURCE_ROUTE_PREFIX . substr(md5($routeClass), 0, 8);
    }

    /**
     * Set the Auth Guard
     * @param GuardContract $guard
     */
    public function setGuard(GuardContract $guard)
    {
        $this->guard = $guard;
        return $this;
    }

    /**
     * Get the Auth Guard
     * @return GuardContract
     */
    public function getGuard()
    {
        if (isset($this->guard)) {
            return $this->guard;
        }
        return Auth::guard();
    }

}


text: Short url service to open respective mobile app from browser to store (using Google app engine)


text: <!-- How the galery will look like -->


text:
--------------------------------
-- @module BatchNode
-- @extend Node
-- @parent_module ccs

--------------------------------
-- js NA
-- @function [parent=#BatchNode] init
-- @param self
-- @return bool#bool ret (return value: bool)

--------------------------------
--
-- @function [parent=#BatchNode] create
-- @param self
-- @return BatchNode#BatchNode ret (return value: ccs.BatchNode)

--------------------------------
-- @overload self, cc.Node, int, string
-- @overload self, cc.Node, int, int
-- @function [parent=#BatchNode] addChild
-- @param self
-- @param #cc.Node pChild
-- @param #int zOrder
-- @param #int tag
-- @return BatchNode#BatchNode self (return value: ccs.BatchNode)

--------------------------------
--
-- @function [parent=#BatchNode] draw
-- @param self
-- @param #cc.Renderer renderer
-- @param #mat4_table transform
-- @param #unsigned int flags
-- @return BatchNode#BatchNode self (return value: ccs.BatchNode)

--------------------------------
--
-- @function [parent=#BatchNode] removeChild
-- @param self
-- @param #cc.Node child
-- @param #bool cleanup
-- @return BatchNode#BatchNode self (return value: ccs.BatchNode)

return nil