text:
namespace FPL.Data.Migrations
{
    using System;
    using System.Data.Entity.Migrations;

    public partial class AddedExplainFixtureExpailRelation4 : DbMigration
    {
        public override void Up()
        {
            DropIndex("dbo.ExplainFixtures", new[] { "FantasyPremierLeagueId" });
        }

        public override void Down()
        {
            CreateIndex("dbo.ExplainFixtures", "FantasyPremierLeagueId", unique: true);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace Nitrogen.Client.DataExplorer.Path
{
    public partial class PathView
    {
        public PathView()
        {
            InitializeComponent();
        }
    }
}


text:
<?php
/**
 * A user interacting with a page.
 *
 * @see    http://schema.org/UserInteraction
*/
abstract class TypeUserInteraction extends TypeEvent
{
	/**
	 * The Schema.org Type Scope
	 *
	 * @var string
	 */
	protected static $scope = 'https://schema.org/UserInteraction';
}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Baseline;
using Marten.Linq.Fields;

namespace Marten.Linq.Parsing
{
    public class TargetObject
    {
        public Type Type { get; }
        private readonly IList<SetterBinding> _setters = new List<SetterBinding>();

        public TargetObject(Type type)
        {
            Type = type;
        }

        public SelectedField StartBinding(string bindingName)
        {
            var setter = new SetterBinding(bindingName);
            _setters.Add(setter);

            return setter.Field;
        }

        public string ToSelectField(IFieldMapping mapping)
        {
            var jsonBuildObjectArgs = _setters.Select(x => x.ToJsonBuildObjectPair(mapping)).Join(", ");
            return $"jsonb_build_object({jsonBuildObjectArgs})";
        }

        private class SetterBinding
        {
            public SetterBinding(string name)
            {
                Name = name;
            }

            private string Name { get; }
            public SelectedField Field { get; } = new SelectedField();

            public string ToJsonBuildObjectPair(IFieldMapping mapping)
            {
                var field = mapping.FieldFor(Field.ToArray());
                var locator = field.RawLocator ?? field.TypedLocator;

                return $"'{Name}', {locator}";
            }
        }
    }

    public class SelectedField: IEnumerable<MemberInfo>
    {
        private readonly Stack<MemberInfo> _members = new Stack<MemberInfo>();

        public void Add(MemberInfo member)
        {
            _members.Push(member);
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }

        public IEnumerator<MemberInfo> GetEnumerator()
        {
            return _members.GetEnumerator();
        }
    }
}


text:
package gov.nasa.jpf.jdart.bytecode;

import gov.nasa.jpf.constraints.expressions.CastExpression;
import gov.nasa.jpf.constraints.types.BuiltinTypes;
import gov.nasa.jpf.jdart.ConcolicInstructionFactory;
import gov.nasa.jpf.jdart.ConcolicUtil;
import gov.nasa.jpf.vm.Instruction;
import gov.nasa.jpf.vm.StackFrame;
import gov.nasa.jpf.vm.ThreadInfo;

/**
 * Convert int to float
 * ..., value  =>..., result
 */
public class I2F extends gov.nasa.jpf.jvm.bytecode.I2F {

  @Override
  public Instruction execute (ThreadInfo ti) {
    StackFrame sf = ti.getTopFrame();

    if(sf.getOperandAttr() == null) {
      return super.execute(ti);
    }

    ConcolicUtil.Pair<Integer> val = ConcolicUtil.popInt(sf);

    int i = val.conc;
    CastExpression<Integer,Float> cast = CastExpression.create(
            val.symb, BuiltinTypes.FLOAT);

    ConcolicUtil.Pair<Float> result = new ConcolicUtil.Pair<Float>( (float)i, cast);
    ConcolicUtil.pushFloat(result, sf);

    if (ConcolicInstructionFactory.DEBUG) ConcolicInstructionFactory.logger.finest("Execute I2F: " + result);
    return getNext(ti);
  }
}


text:
import React from 'react';
import styles from '../../main.css';

import { problem, solution, customer, testing, justification } from "./aboutText";
export function About() {
  return (

About Social Pulse

The idea behind the project.

Problem

 {problem}

Solution

 {solution}

Customer

 {customer}

Testing

 {testing}

Justification

 {justification}

      Social Pulse proposal provided by Brett Oberg

  );
}

export default About;


text:
package org.wildfly.extras.creaper.commands.elytron.mapper;

import java.util.Map;

import org.wildfly.extension.elytron.Configurable;
import org.wildfly.security.authz.AuthorizationIdentity;
import org.wildfly.security.authz.RoleDecoder;
import org.wildfly.security.authz.Roles;

public class AddCustomRoleDecoderImpl implements RoleDecoder, Configurable {

    @Override
    public Roles decodeRoles(AuthorizationIdentity authorizationIdentity) {
        return Roles.of("anyRole");
    }

    @Override
    public void initialize(Map<String, String> configuration) {
        if (configuration.containsKey("throwException")) {
            throw new IllegalStateException("Only test purpose. This exception was thrown on demand.");
        }
    }

}


text:
package org.apache.catalina.realm;

import java.security.NoSuchAlgorithmException;

import org.junit.Assert;
import org.junit.Test;

import org.apache.tomcat.util.security.ConcurrentMessageDigest;

public class TestMessageDigestCredentialHandler {

    private static final String[] DIGESTS = new String[] {"MD5", "SHA-1", "SHA-512"};

    private static final String PWD = "password";

    static {
        try {
            ConcurrentMessageDigest.init("SHA-512");
        } catch (NoSuchAlgorithmException e) {
            throw new IllegalArgumentException(e);
        }
    }

    @Test
    public void testGeneral() throws Exception {
        for (String digest : DIGESTS) {
            for (int saltLength = 0; saltLength < 20; saltLength++) {
                for (int iterations = 1; iterations < 100; iterations += 10)
                doTest(digest, saltLength, iterations);
            }
        }
    }

    private void doTest(String digest, int saltLength, int iterations) throws NoSuchAlgorithmException {
        MessageDigestCredentialHandler mdch = new MessageDigestCredentialHandler();
        mdch.setAlgorithm(digest);
        mdch.setIterations(iterations);
        mdch.setSaltLength(saltLength);
        String storedCredential = mdch.mutate(PWD);
        Assert.assertTrue(mdch.matches(PWD, storedCredential));
    }
}


text:
package com.github.polok.localify.module;

import android.support.annotation.RawRes;

import java.util.concurrent.Executor;

import com.github.polok.localify.LocalifyCallback;
import com.github.polok.localify.api.Localify;
import com.github.polok.localify.api.LocalifyAsync;
import com.github.polok.localify.api.LocalifyRx;
import com.github.polok.localify.utils.RxUtils;
import rx.Observable;

/**
 * BaseModule.
 */
abstract class BaseModule extends AbsModule<BaseModule.ExtAsync, BaseModule.ExtRxJava> implements Localify {

    /**
     *
     * @param executor
     */
    public BaseModule(Executor executor) {
        super(executor);
    }

    @Override
    ExtAsync createAsyncExtension() {
        return new ExtAsync();
    }

    @Override
    ExtRxJava createRxJavaExtension() {
        return new ExtRxJava();
    }

    /**
     *
     */
    public class ExtAsync extends AbsModule.Async implements LocalifyAsync<String> {
        @Override
        public void loadAssetsFile(String fileName, LocalifyCallback<String> callback) {
            RxUtils.subscribe(executor, rx().loadAssetsFile(fileName), callback);
        }

        @Override
        public void loadRawFile(@RawRes int fileNameRawId, LocalifyCallback<String> callback) {
            RxUtils.subscribe(executor, rx().loadRawFile(fileNameRawId), callback);
        }
    }

    /**
     *
     */
    public class ExtRxJava extends AbsModule.Rx implements LocalifyRx {
        @Override
        public Observable<String> loadAssetsFile(final String fileName) {
            return RxUtils.defer(new RxUtils.DefFunc<String>() {
                @Override
                public String method() {
                    return BaseModule.this.loadAssetsFile(fileName);
                }
            });
        }

        @Override
        public Observable<String> loadRawFile(@RawRes final int fileNameRawId) {
            return RxUtils.defer(new RxUtils.DefFunc<String>() {
                @Override
                public String method() {
                    return BaseModule.this.loadRawFile(fileNameRawId);
                }
            });
        }
    }

}


text:
require 'fog/arubacloud/service'
require 'fog/arubacloud/error'
require 'benchmark'

module Fog
  module ArubaCloud
    class Compute
      class Real
        # Apply a snapshot on a VM
        def delete_snapshot(data)
          (service.servers).all.each do |server|
            id = server.id if (server.name).include? data[:name]
          end
          body = self.body('SetEnqueueServerSnapshot').merge(
              {
                  :Snapshot => {
                      :ServerId => id,
                      :SnapshotOperationTypes => 'Delete'
                  }
              }
          )
          options = {
              :http_method => :post,
              :method => 'SetEnqueueServerSnapshot',
              :body => Fog::JSON.encode(body)
          }
          response = nil
          time = Benchmark.realtime {
            response = request(options)
          }
          Fog::Logger.debug("SetEnqueueServerSnapshot time: #{time}")
          if response['Success']
            response
          else
            raise Fog::ArubaCloud::Errors::RequestError.new(response)
          end
        end #Apply
      end #Real
      class Mock
        def delete_snapshot
          response = Excon::Response.new
          response.status = 200
          response.body = {
              'ExceptionInfo' => nil,
              'ResultCode' => 0,
              'ResultMessage' => nil,
              'Success' => true
          }
          response.body
        end
      end
    end # ArubaCloud
  end # Compute
end # Fog


text:
/* jslint browser: true */
/* global app, Textual */

/* Defined in: "Textual.app -> Contents -> Resources -> JavaScript -> API -> core.js" */

/* Theme-wide preferences, as per milky's request */
var Equinox = {
  fadeNicks: true,            // fade out nicknames when they appear multiple times in a row
  fadeNicksFreq: 10,          // how frequently to display a nick if they have fadeNickCounts lines in a row
  showDateChanges: true,      // show date changes
  squashModes: true,          // if a duplicate mode gets posted to the channel, squash it
  squashTopics: true          // if a duplicate topic gets posted to the channel, squash it
};

/* Set the default statuses for everything tracked in the roomState */
var mappedSelectedUsers = [];
var rs                  = { // room state
  date: {
    year: 0,
    month: 0,
    day: 0
  },
  mode: {
    mode: undefined
  },
  nick: {
    count: 1,
    delete: false,
    id: undefined,
    nick: undefined
  },
  topic: {
    delete: false,
    topic: undefined
  }
};

var NickColorGenerator = (function () {
  'use strict';

  function NickColorGenerator(message) {
    var i, inlineNicks, nick;

    // Start alternative nick colouring procedure
    var selectNick = message.querySelector('.sender');
    selectNick.removeAttribute('colornumber');
    var nickcolor = this.generateColorFromNickname(selectNick.getAttribute('nickname'));

    selectNick.style.color = nickcolor;

    inlineNicks = message.querySelectorAll('.inline_nickname');

    if (message.getAttribute('ltype') === 'action') {
      message.querySelector('.message').style.color = nickcolor;
    }

    for (i = 0; i < inlineNicks.length; i++) {
      inlineNicks[i].removeAttribute('colornumber');
      nick = inlineNicks[i].textContent;
      if (inlineNicks[i].getAttribute('mode').length > 0) {
        nick = nick.replace(inlineNicks[i].getAttribute('mode'), '');
      }
      inlineNicks[i].style.color = this.generateColorFromNickname(nick);
    }
  }

  // NickColorGenerator.prototype.generateHashFromNickname = function (nick) {
  //   var hash = 5381, i;

  //   /* First, sanitize the nickname */
  //   nick = nick.toLowerCase();          // make them lowercase (so that April and april produce the same color)
  //   nick = nick.replace(/[`_-]+$/, ''); // typically `, _, and - are used on the end of a nick
  //   nick = nick.replace(/|.*$/, '');    // remove |<anything> from the end

  //   // Courtesy of https://github.com/darkskyapp/string-hash/
  //   i = nick.length;
  //   while (i) {
  //     hash = (hash * 33) ^ nick.charCodeAt(--i);
  //   }

  //   return hash >>> 0;
  // };

  NickColorGenerator.prototype.generateColorFromNickname = function (nick) {
    // First, sanitize the nicknames
    nick = nick.toLowerCase();          // make them lowercase (so that April and april produce the same color)
    nick = nick.replace(/[`_-]+$/, ''); // typically `, _, and - are used on the end of a nick
    nick = nick.replace(/|.*$/, '');    // remove |<anything> from the end

    // Generate the hashes
    var hhash = app.nicknameColorStyleHash(nick, 'HSL-dark');
    var shash = hhash >>> 1;
    var lhash = hhash >>> 2;

    var h           = hhash % 360;
    var s           = shash % 50 + 45;   // 50 - 95
    var l           = lhash % 36 + 45;   // 45 - 81

    // give the pinks a wee bit more lightness
    if (h >= 280 && h < 335) {
      l = lhash % 36 + 50; // 50 - 86
    }

    // Give the blues a smaller (but lighter) range
    if (h >= 210 && h < 280) {
      l = lhash % 25 + 65; // 65 - 90
    }

    // Give the reds a bit less saturation
    if (h <= 25 || h >= 335) {
      s = shash % 33 + 45; // 45 - 78
    }

    // Give the yellows and greens a bit less saturation as well
    if (h >= 50 && h <= 150) {
      s = shash % 50 + 40; // 40 - 90
    }

    return 'hsl(' + String(h) + ',' + String(s) + '%,' + String(l) + '%)';
  };

  return NickColorGenerator;
})();

function isMessageInViewport(elem) {
  'use strict';

  if (!elem.getBoundingClientRect) {
    return true;
  }

  // Have to use Math.floor() because sometimes the getBoundingClientRect().bottom is a fraction of a pixel (!!!)
  return (Math.floor(elem.getBoundingClientRect().bottom) <= Math.floor(document.documentElement.clientHeight));
}

function toggleSelectionStatusForNicknameInsideElement(e) {
  'use strict';
  /* e is nested as the .sender so we have to go three parents
   up in order to reach the parent div that owns it. */
  var parentSelector = e.parentNode.parentNode.parentNode.parentNode;

  parentSelector.classList.toggle('selectedUser');
}

function updateNicknameAssociatedWithNewMessage(e) {
  'use strict';
  /* We only want to target plain text messages. */
  var acceptedElementTypes = ['privmsg', 'action', 'notice'], elementType = e.getAttribute('ltype'), nickname, senderSelector;

  if (acceptedElementTypes.indexOf(elementType) !== -1) {
    /* Get the nickname information. */
    senderSelector = e.querySelector('.sender');
    if (senderSelector) {
      /* Is this a mapped user? */
      nickname = senderSelector.getAttribute('nickname');

      /* If mapped, toggle status on for new message. */
      if (mappedSelectedUsers.indexOf(nickname) > -1) {
        toggleSelectionStatusForNicknameInsideElement(senderSelector);
      }
    }
  }
}

/* Insert a date, if the date has changed from the previous message */
function dateChange(e) {
  'use strict';
  var timestamp, datetime, year, month, day, id, ltype;
  var MAXTIMEOFFSET = 30000;  // 30 seconds

  // Only show date changes if the option is enabled
  if (!Equinox.showDateChanges) {
    return;
  }

  timestamp = parseFloat(e.getAttribute('timestamp')) * 1000;
  datetime = new Date(timestamp);

  year = datetime.getFullYear();
  month = datetime.getMonth();
  day = datetime.getDate();
  id = 'date-' + String(year) + '-' + String(month + 1) + '-' + String(day);

  // Occasionally when replaying, Textual will post messages in the future, and then jump backwards
  // As such, we'll ignore all joins, modes, and topics, if they're more than MAXTIMEOFFSET milliseconds
  // from the current time
  ltype = e.getAttribute('ltype');
  if (ltype !== 'privmsg') {
    if (Date.now() - timestamp > MAXTIMEOFFSET) {
      return;
    }
  }

  // If the date is the same, then there's nothing to do here
  if (year === rs.date.year && month === rs.date.month && day === rs.date.day) {
    return;
  }

  var deleteLastlineDate = function (ll) {
    if (ll) {
      if ((ll.id === 'mark') || (ll.className === 'date')) {
        ll.parentNode.removeChild(ll);
      }
    }
  };

  // First, let's get the last line posted
  var lastline = e.previousSibling;

  if (lastline) {
    // And if it's a mark or a previous date entry, let's remove it, we can use css + selectors for marks that follow
    deleteLastlineDate(lastline);

    // If the last line is the historic_messages div and its last child or previous sibling is a date, remove that too
    if (lastline.id === 'historic_messages') {
      deleteLastlineDate(lastline.lastChild);
      deleteLastlineDate(lastline.previousSibling);
    }
  }

  // Create the date element:

...

  var div = document.createElement('div');
  var span = document.createElement('span');
  div.className = 'date';
  div.id = id;
  div.appendChild(document.createElement('hr'));
  div.appendChild(span);
  div.appendChild(document.createElement('hr'));

  // Set the span's content to the current date (Friday, October 14th)
  span.textContent = datetime.toLocaleDateString();

  // Insert the date before the newly posted message
  e.parentElement.insertBefore(div, e);

  // Update the previous state
  rs.date = {
    year: year,
    month: month,
    day: day
  };

  // Reset the nick count back to 1, so the nick always shows up after a date change
  rs.nick.count = 1;
  rs.nick.nick = undefined;
}

/* When you join a channel, delete all the old disconnected messages */
Textual.handleEvent = function (event) {
  'use strict';
  var i, messages;

  if (event === 'channelJoined') {
    messages = document.querySelectorAll('div[command="-100"]');
    for (i = 0; i < messages.length; i++) {
      if (app.channelIsJoined() && (messages[i].getElementsByClassName('message')[0].textContent.search('Disconnect') !== -1)) {
        messages[i].parentNode.removeChild(messages[i]);
      }
    }
  }
};

Textual.newMessagePostedToView = function (line) {
  'use strict';
  var message = document.getElementById('line-' + line);
  var clone, elem, getEmbeddedImages, i, mode, messageText, sender, topic;

  // reset the message count and previous nick, when you rejoin a channel
  if (message.getAttribute('ltype') !== 'privmsg') {
    rs.nick.count = 1;
    rs.nick.nick = undefined;
  }

  // if it's a private message, colorize the nick and then track the state and fade away the nicks if needed
  if (message.getAttribute('ltype') === 'privmsg' || message.getAttribute('ltype') === 'action') {
    sender = message.getElementsByClassName('sender')[0];
    new NickColorGenerator(message); // colorized the nick

    // Delete (ie, make foreground and background color identical) the previous line's nick, if it was set to be deleted
    if (rs.nick.delete === true) {
      elem = document.getElementById(rs.nick.id).getElementsByClassName('sender')[0];
      elem.className += ' f';
      elem.style.color = window.getComputedStyle(elem).backgroundColor;
    }

    // Track the nicks that submit messages, so that we can space out everything
    if ((rs.nick.nick === sender.textContent) && (rs.nick.count < Equinox.fadeNicksFreq)
      && (message.getAttribute('ltype') !== 'action') && (Equinox.fadeNicks === true)) {
      rs.nick.delete = true;
      rs.nick.count += 1;
    } else {
      rs.nick.nick = sender.textContent;
      rs.nick.count  = 1;
      rs.nick.delete = false;
    }

    // Track the previous message's id
    rs.nick.id = message.getAttribute('id');

    // Copy the message into the hidden history
    clone = message.cloneNode(true);
    clone.removeAttribute('id');
    rs.history.appendChild(clone);

    // Remove old messages, if the history is longer than three messages
    if (rs.history.childElementCount > 2) {
      rs.history.removeChild(rs.history.childNodes[0]);

      // Hide the first nick in the hidden history, if it's the same as the second
      if ((rs.nick.count > 1) && (message.getAttribute('ltype') !== 'action')) {
        rs.history.getElementsByClassName('sender')[0].style.visibility = 'hidden';
      }
    }
  }

  /* Let's kill topics that appear where they had already been set before
     This happens when you join a room (like a reconnect) that you had been in and seen the topic before */
  if (Equinox.squashTopics === true && message.getAttribute('ltype') === 'topic') {
    topic = message.getElementsByClassName('message')[0].textContent.replace('Topic is ', '').replace(/\s+/, '');

    if (message.getAttribute('command') === '332') { // an actual topic change
      // hide the topic if it's the same topic again
      if (topic === rs.topic.topic) {
        message.parentNode.removeChild(message);
        rs.topic.delete = true;
      }

      rs.topic.topic = topic;
    }

    if ((message.getAttribute('command') === '333') && (rs.topic.delete === true)) {
      message.parentNode.removeChild(message);
      rs.topic.delete = false;
    }
  }

  // much like we suppress duplicate topics, we want to suppress duplicate modes
  if (Equinox.squashModes === true && message.getAttribute('ltype') === 'mode') {
    mode = message.getElementsByClassName('message')[0].textContent.replace(/\s+/, '');

    if (mode === rs.mode.mode) {
      message.parentNode.removeChild(message);
    } else {
      rs.mode.mode = mode;
    }
  }

  // hide messages about yourself joining
  if ((message.getAttribute('ltype') === 'join') || (message.getAttribute('ltype') === 'part')) {
    if (message.getElementsByClassName('message')[0].getElementsByTagName('b')[0].textContent === app.localUserNickname()) {
      message.parentNode.removeChild(message);
    }
  }

  /* clear out all the old disconnect messages, if you're currently connected to the channel
     note that normally Textual.handleEvent will catch this, but if you reload a theme, they will reappear */
  if ((message.getAttribute('ltype') === 'debug') && (message.getAttribute('command') === '-100')) {
    if (app.channelIsJoined() &&
        (message.getElementsByClassName('message')[0].textContent.search('Disconnect') !== -1)) {
      message.parentNode.removeChild(message);
    }
  } else {
    // call the dateChange() function, for any message with a timestamp that's not a debug message
    if (message.getAttribute('timestamp')) {
      dateChange(message);
    }
  }

  if (message.getAttribute('encrypted') === 'true') {
    messageText = message.querySelector('.innerMessage');
    if (messageText.innerText.indexOf('+OK') !== -1) {
      message.setAttribute('encrypted', 'failed');
    }
  }

  getEmbeddedImages = message.querySelectorAll('img');
  if (getEmbeddedImages) {
    for (i = 0; i < getEmbeddedImages.length; i++) {
      getEmbeddedImages[i].onload = function (e) {
        setTimeout(function () {
          if (e.target.offsetHeight > (window.innerHeight - 150)) {
            e.target.style.height = (window.innerHeight - 150);
          }
        }, 1000);
      };
    }
  }

  updateNicknameAssociatedWithNewMessage(message);
};

/* This is called when a .sender is clicked */
Textual.nicknameSingleClicked = function (e) {
  'use strict';
  var allLines, documentBody, i, sender;
  var nickname = e.getAttribute('nickname');
  var mappedIndex = mappedSelectedUsers.indexOf(nickname);

  if (mappedIndex === -1) {
    mappedSelectedUsers.push(nickname);
  } else {
    mappedSelectedUsers.splice(mappedIndex, 1);
  }

  /* Gather basic information. */
  documentBody = document.getElementById('body_home');

  allLines = documentBody.querySelectorAll('div[ltype="privmsg"], div[ltype="action"]');

  /* Update all elements of the DOM matching conditions. */
  for (i = 0; i < allLines.length; i++) {
    sender = allLines[i].querySelectorAll('.sender');

    if (sender.length > 0) {
      if (sender[0].getAttribute('nickname') === nickname) {

        /* e is nested as the .sender so we have to go three parents
         up in order to reach the parent div that owns it. */
        toggleSelectionStatusForNicknameInsideElement(sender[0]);
      }
    }
  }
};

/* Don't jump back to the bottom of the window when the view becomes visible */
Textual.notifyDidBecomeVisible = function () {
  'use strict';
  window.getSelection().empty();
};

Textual.viewBodyDidLoad = function () {
  'use strict';
  Textual.fadeOutLoadingScreen(1.00, 0.95);

  setTimeout(function () {
    Textual.scrollToBottomOfView();
  }, 500);
};

Textual.viewInitiated = function () {
  'use strict';

  /* When the view is loaded, create a hidden history div which we display if there is scrollback */
  var body = document.getElementById('body_home'), div = document.createElement('div');
  div.id = 'scrolling_history';
  document.getElementsByTagName('body')[0].appendChild(div);
  rs.history = div;

  /* setup the scrolling event to display the hidden history if the bottom element isn't in the viewport
     also hide the topic bar when scrolling */
  window.onscroll = function () {
    var line, lines;
    var topic = document.getElementById('topic_bar');

    lines = body.getElementsByClassName('line');
    if (lines.length < 2) {
      return;
    }
    line = lines[lines.length - 1];

    if (isMessageInViewport(line) === false) {
      // scrollback
      rs.history.style.display = 'inline';
      if (topic) { topic.style.visibility = 'hidden'; }
    } else {
      // at the bottom
      rs.history.style.display = 'none';
      if (topic) { topic.style.visibility = 'visible'; }
    }
  };
};


text:
bower update --config.directory=tranny/static/vendor
grunt build


text:
var logForDebugging = false;
function log(message) {
  if (logForDebugging)
    console.log(message);
}
navigator.serviceWorker.register('/sw.js').then(function(registration) {
  log('ServiceWorker registration successful with scope: ',
      registration.scope);
  // This resolves once there's an active worker at this scope.
  return navigator.serviceWorker.ready;
}).then(function() {
  chrome.test.sendMessage('registered');
}).catch(function(err) {
  // registration failed :(
  var errorMsg = err.name + ': ' + err.message;
  log('ServiceWorker registration failed: ' + errorMsg);
});


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>net.sulea.cristian</groupId>
    <artifactId>jatoo</artifactId>
<!--     <relativePath>../jatoo/pom.xml</relativePath> -->
    <version>5</version>
  </parent>

  <artifactId>jatoo-image</artifactId>
  <packaging>jar</packaging>

  <version>5.0</version>

  <name>JaToo Image</name>
  <description>A Java™ Open Source library created to ease the work with images.</description>
  <url>http://cristian.sulea.net/projects/jatoo-image/</url>

  <inceptionYear>2014</inceptionYear>

  <developers>
    <developer>
      <id>cristian.sulea</id>
      <name>Cristian Sulea</name>
      <email>cristian.sulea.79@gmail.com</email>
      <url>http://cristian.sulea.net</url>
      <timezone>Europe/Bucharest</timezone>
      <roles>
        <role>owner</role>
        <role>architect</role>
        <role>developer</role>
      </roles>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git@github.com:cristian-sulea/jatoo-image.git</connection>
    <developerConnection>scm:git:git@github.com:cristian-sulea/jatoo-image.git</developerConnection>
    <url>https://github.com/cristian-sulea/jatoo-image</url>
  </scm>

  <properties>
    <skip.plugin.checkstyle>true</skip.plugin.checkstyle>
    <skip.plugin.findbugs>true</skip.plugin.findbugs>
    <skip.plugin.pmd>true</skip.plugin.pmd>
  </properties>

</project>


text:
#ifndef SIM_MATH_ODE_SOLVER_H_
#define SIM_MATH_ODE_SOLVER_H_

#include <stdint.h>

#include <gsl/gsl_errno.h>
#include <gsl/gsl_odeiv2.h>

#include <vector>

namespace sim {

// Enumeration for return codes.
enum class OdeSolverStatus { kSuccess, kError, kOutOfPhysics };

// Interface representing a system of ordinary differential equations.
class OdeSystem {
 public:
  virtual ~OdeSystem() {}

  // Get the number of states for the ODE.
  virtual int32_t num_states() const = 0;

  // Calculate the state derivative for a given time and state.
  virtual void CalcDerivatives(double t, const std::vector<double> &x,
                               std::vector<double> *dx) const = 0;
};

// Interface for ODE solvers.
class OdeSolver {
 public:
  virtual ~OdeSolver() {}

  // Integrate the ODE with initial condition x0 at time t0 until time tf.
  //
  // Args:
  //   t0: Initial time.
  //   tf: Final time (>= t0).
  //   x0: Initial state.
  //   t_int: Null pointer or output time at which the integrator terminated.
  //   x: Terminal state.  It should be safe to reuse x0 as x.
  //
  // Returns:
  //   kSuccess on success (indicating *t_int = tf) and kError otherwise.
  virtual OdeSolverStatus Integrate(double t0, double tf,
                                    const std::vector<double> &x0,
                                    double *t_int, std::vector<double> *x) = 0;
};

}  // namespace sim

#endif  // SIM_MATH_ODE_SOLVER_H_


text:
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Bindables;
using osu.Framework.Timing;
using osu.Game.Screens.Play;

namespace osu.Game.Tests.NonVisual
{
    [TestFixture]
    public class GameplayClockTest
    {
        [TestCase(0)]
        [TestCase(1)]
        public void TestTrueGameplayRateWithZeroAdjustment(double underlyingClockRate)
        {
            var framedClock = new FramedClock(new ManualClock { Rate = underlyingClockRate });
            var gameplayClock = new TestGameplayClock(framedClock);

            gameplayClock.MutableNonGameplayAdjustments.Add(new BindableDouble());

            Assert.That(gameplayClock.TrueGameplayRate, Is.EqualTo(0));
        }

        private class TestGameplayClock : GameplayClock
        {
            public List<Bindable<double>> MutableNonGameplayAdjustments { get; } = new List<Bindable<double>>();

            public override IEnumerable<Bindable<double>> NonGameplayAdjustments => MutableNonGameplayAdjustments;

            public TestGameplayClock(IFrameBasedClock underlyingClock)
                : base(underlyingClock)
            {
            }
        }
    }
}


text:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/

#include "AnalogInternal.h"

#include "ChipObject.h"
#include "HAL/AnalogInput.h"
#include "HAL/cpp/priority_mutex.h"
#include "PortsInternal.h"

namespace hal {
priority_recursive_mutex analogRegisterWindowMutex;
std::unique_ptr<tAI> analogInputSystem;
std::unique_ptr<tAO> analogOutputSystem;

IndexedHandleResource<HAL_AnalogInputHandle, hal::AnalogPort, kNumAnalogInputs,
                      HAL_HandleEnum::AnalogInput>
    analogInputHandles;

static uint32_t analogNumChannelsToActivate = 0;

bool analogSystemInitialized = false;

/**
 * Initialize the analog System.
 */
void initializeAnalog(int32_t* status) {
  std::lock_guard<priority_recursive_mutex> sync(analogRegisterWindowMutex);
  if (analogSystemInitialized) return;
  analogInputSystem.reset(tAI::create(status));
  analogOutputSystem.reset(tAO::create(status));
  setAnalogNumChannelsToActivate(kNumAnalogInputs);
  HAL_SetAnalogSampleRate(kDefaultSampleRate, status);
  analogSystemInitialized = true;
}

/**
 * Return the number of channels on the module in use.
 *
 * @return Active channels.
 */
uint32_t getAnalogNumActiveChannels(int32_t* status) {
  uint32_t scanSize = analogInputSystem->readConfig_ScanSize(status);
  if (scanSize == 0) return 8;
  return scanSize;
}

/**
 * Get the number of active channels.
 *
 * This is an internal function to allow the atomic update of both the
 * number of active channels and the sample rate.
 *
 * When the number of channels changes, use the new value.  Otherwise,
 * return the curent value.
 *
 * @return Value to write to the active channels field.
 */
uint32_t getAnalogNumChannelsToActivate(int32_t* status) {
  if (analogNumChannelsToActivate == 0)
    return getAnalogNumActiveChannels(status);
  return analogNumChannelsToActivate;
}

/**
 * Set the number of active channels.
 *
 * Store the number of active channels to set.  Don't actually commit to
 * hardware
 * until SetSampleRate().
 *
 * @param channels Number of active channels.
 */
void setAnalogNumChannelsToActivate(uint32_t channels) {
  analogNumChannelsToActivate = channels;
}
}  // namespace hal


text:
'use strict'

const autocannon = require('../autocannon')
const exampleResult = require('./fixtures/example-result.json')
const crossArgv = require('cross-argv')

let opts = null

if (process.argv.length > 2) {
  const args = crossArgv(process.argv.slice(2))
  opts = autocannon.parseArguments(args)
}

const resultStr = autocannon.printResult(exampleResult, opts)
process.stderr.write(resultStr)


text:
#import "PA2Codable.h"

@interface PA2ConfirmRecoveryCodeRequest : NSObject <PA2Encodable>

@property (nonnull, nonatomic, strong) NSString * recoveryCode;

@end


text:
const System = imports.system;

System.exit(0);


text:
<?php
/**
 * Controls the main event query.  Allows for recurring events.
 */

// Don't load directly
if ( ! defined( 'ABSPATH' ) ) {
	die( '-1' );
}

if ( ! class_exists( 'Tribe__Events__Query' ) ) {
	class Tribe__Events__Query {

		/**
		 * Initialize The Events Calendar query filters and post processing.
		 *
		 * @return void
		 */
		public static function init() {

			// if tribe event query add filters
			add_action( 'parse_query', array( __CLASS__, 'parse_query' ), 50 );
			add_action( 'pre_get_posts', array( __CLASS__, 'pre_get_posts' ), 50 );

			if ( is_admin() ) {
				$cleanup = new Tribe__Events__Recurring_Event_Cleanup();
				$cleanup->toggle_recurring_events();
				unset( $cleanup );
			}
		}

		/**
		 * determines whether a date field can be injected into various parts of a query
		 *
		 * @param $query WP_Query Query object
		 *
		 * @return boolean
		 */
		public static function can_inject_date_field( $query ) {
			$can_inject = true;

			if ( 'ids' === $query->query_vars['fields'] ) {
				$can_inject = false;
			}

			if ( 'id=>parent' === $query->query_vars['fields'] ) {
				$can_inject = false;
			}

			return apply_filters( 'tribe_query_can_inject_date_field', $can_inject );
		}

		/**
		 * Set any query flags
		 *
		 * @param WP_Query $query
		 *
		 * @return void
		 **/
		public static function parse_query( $query ) {
			// set paged
			if ( $query->is_main_query() && isset( $_GET['tribe_paged'] ) ) {
				$query->set( 'paged', $_REQUEST['tribe_paged'] );
			}

			// Add tribe events post type to tag queries
			if ( $query->is_tag && (array) $query->get( 'post_type' ) != array( Tribe__Events__Main::POSTTYPE ) ) {
				$types = $query->get( 'post_type' );
				if ( empty( $types ) ) {
					$types = array( 'post' );
				}
				if ( is_array( $types ) ) {
					$types[] = Tribe__Events__Main::POSTTYPE;
				} else {
					if ( is_string( $types ) ) {
						$types = array( $types, Tribe__Events__Main::POSTTYPE );
					} else {
						if ( $types != 'any' ) {
							$types = array( 'post', Tribe__Events__Main::POSTTYPE );
						}
					}
				}
				$query->set( 'post_type', $types );
			}

			$types = ( ! empty( $query->query_vars['post_type'] ) ? (array) $query->query_vars['post_type'] : array() );

			// check if any possiblity of this being an event query
			$query->tribe_is_event = ( in_array( Tribe__Events__Main::POSTTYPE, $types ) && count( $types ) < 2 )
				? true // it was an event query
				: false;

			$query->tribe_is_multi_posttype = ( in_array( Tribe__Events__Main::POSTTYPE, $types ) && count( $types ) >= 2 || in_array( 'any', $types ) )
				? true // it's a query for multiple post types, events post type included
				: false;

			if ( 'default' === $query->get( 'eventDisplay' ) ) {
				$query->set( 'eventDisplay', Tribe__Events__Main::instance()->default_view() );
			}

			// check if any possiblity of this being an event category
			$query->tribe_is_event_category = ! empty ( $query->query_vars[ Tribe__Events__Main::TAXONOMY ] )
				? true // it was an event category
				: false;

			$query->tribe_is_event_venue = ( in_array( Tribe__Events__Main::VENUE_POST_TYPE, $types ) )
				? true // it was an event venue
				: false;

			$query->tribe_is_event_organizer = ( in_array( Tribe__Events__Main::ORGANIZER_POST_TYPE, $types ) )
				? true // it was an event organizer
				: false;

			$query->tribe_is_event_query = ( $query->tribe_is_event
			                                 || $query->tribe_is_event_category
			                                 || $query->tribe_is_event_venue
			                                 || $query->tribe_is_event_organizer )
				? true // this is an event query of some type
				: false; // move along, this is not the query you are looking for

			// is the query pulling posts from the past
			if ( $query->is_main_query() && ! empty( $_REQUEST['tribe_event_display'] ) && $_REQUEST['tribe_event_display'] == 'past' ) {
				$query->tribe_is_past = true;
			} elseif ( tribe_is_ajax_view_request() && $query->get( 'eventDisplay' ) == 'past' ) {
				$query->tribe_is_past = true;
			} elseif ( $query->get( 'tribe_is_past' ) ) {
				$query->tribe_is_past = true;
			} else {
				$query->tribe_is_past = isset( $query->tribe_is_past ) ? $query->tribe_is_past : false;
			}

			// never allow 404 on month view
			if ( $query->is_main_query() && $query->get( 'eventDisplay' ) == 'month' && ! $query->is_tax && ! $query->tribe_is_event_category ) {
				$query->is_post_type_archive = true;
				$query->queried_object       = get_post_type_object( Tribe__Events__Main::POSTTYPE );
				$query->queried_object_id    = 0;
			}

			// check if is_event_query === true and hook filter
			if ( $query->tribe_is_event_query ) {
				// fixing is_home param
				$query->is_home = ! empty( $query->query_vars['is_home'] ) ? $query->query_vars['is_home'] : false;
				do_action( 'tribe_events_parse_query', $query );
			}
		}

		/**
		 * Is hooked by init() filter to parse the WP_Query arguments for main and alt queries.
		 *
		 * @param object $query WP_Query object args supplied or default
		 *
		 * @return object $query (modified)
		 */
		public static function pre_get_posts( $query ) {
			$admin_helpers = Tribe__Events__Admin__Helpers::instance();

			if ( $query->is_main_query() && is_home() ) {
				// check option for including events in the main wordpress loop, if true, add events post type
				if ( tribe_get_option( 'showEventsInMainLoop', false ) ) {
					$query->query_vars['post_type']   = isset( $query->query_vars['post_type'] ) ? ( array ) $query->query_vars['post_type'] : array( 'post' );
					$query->query_vars['post_type'][] = Tribe__Events__Main::POSTTYPE;
					$query->tribe_is_multi_posttype   = true;
				}
			}

			if ( $query->tribe_is_multi_posttype ) {
				do_action( 'log', 'multi_posttype', 'default', $query->tribe_is_multi_posttype );
				add_filter( 'posts_fields', array( __CLASS__, 'multi_type_posts_fields' ), 10, 2 );
				add_filter( 'posts_join', array( __CLASS__, 'posts_join' ), 10, 2 );
				add_filter( 'posts_join', array( __CLASS__, 'posts_join_orderby' ), 10, 2 );
				add_filter( 'posts_distinct', array( __CLASS__, 'posts_distinct' ) );
				add_filter( 'posts_orderby', array( __CLASS__, 'posts_orderby' ), 10, 2 );
				do_action( 'tribe_events_pre_get_posts', $query );

				return;
			}

			if ( $query->tribe_is_event || $query->tribe_is_event_category ) {

				if ( ! ( $query->is_main_query() && 'month' === $query->get( 'eventDisplay' ) ) ) {
					add_filter( 'posts_fields', array( __CLASS__, 'posts_fields' ), 10, 2 );
					add_filter( 'posts_join', array( __CLASS__, 'posts_join' ), 10, 2 );
					add_filter( 'posts_join', array( __CLASS__, 'posts_join_orderby' ), 10, 2 );
					add_filter( 'posts_where', array( __CLASS__, 'posts_where' ), 10, 2 );
					add_filter( 'posts_distinct', array( __CLASS__, 'posts_distinct' ) );
				} else {

					// reduce number of queries triggered by main WP_Query on month view
					$query->set( 'posts_per_page', 1 );
					$query->set( 'no_found_rows', true );
					$query->set( 'cache_results', false );
					$query->set( 'update_post_meta_cache', false );
					$query->set( 'update_post_term_cache', false );
					//JER added back
					$query->set(
						'meta_query', array(
							array(
								'key'  => '_EventStartDate',
								'type' => 'DATETIME'
							)
						)
					);
					do_action( 'tribe_events_pre_get_posts', $query );

					return $query;
				}

				// if a user selects a date in the event bar we want it to persist as long as possible
				if ( ! empty( $_REQUEST['tribe-bar-date'] ) ) {
					$query->set( 'eventDate', $_REQUEST['tribe-bar-date'] );
					do_action( 'log', 'changed eventDate to tribe-bar-date', 'tribe-events-query', $_REQUEST['tribe-bar-date'] );
				}

				// if a user provides a search term we want to use that in the search params
				if ( ! empty( $_REQUEST['tribe-bar-search'] ) ) {
					$query->query_vars['s'] = $_REQUEST['tribe-bar-search'];
				}

				$query->query_vars['eventDisplay'] = ! empty( $query->query_vars['eventDisplay'] ) ? $query->query_vars['eventDisplay'] : Tribe__Events__Main::instance()->displaying;

				//@todo stop calling EOD cutoff transformations all over the place

				if ( ! empty( $query->query_vars['eventDisplay'] ) ) {
					switch ( $query->query_vars['eventDisplay'] ) {
						case 'custom':
							// if the eventDisplay is 'custom', all we're gonna do is make sure the start and end dates are formatted
							$start_date = $query->get( 'start_date' );
							if ( $start_date ) {
								$query->set( 'start_date', date_i18n( Tribe__Events__Date_Utils::DBDATETIMEFORMAT, strtotime( $start_date ) ) );
							}
							$end_date = $query->get( 'end_date' );
							if ( $end_date ) {
								$query->set( 'end_date', date_i18n( Tribe__Events__Date_Utils::DBDATETIMEFORMAT, strtotime( $end_date ) ) );
							}
							break;
						case 'month':
							// make sure start and end date are set
							if ( $query->get( 'start_date' ) == '' ) {
								$event_date = ( $query->get( 'eventDate' ) != '' )
									? $query->get( 'eventDate' )
									: date_i18n( Tribe__Events__Date_Utils::DBDATETIMEFORMAT );
								$query->set( 'start_date', tribe_event_beginning_of_day( $event_date ) );
							}

							if ( $query->get( 'end_date' == '' ) ) {
								$query->set( 'end_date', tribe_event_end_of_day( $query->get( 'start_date' ) ) );
							}
							$query->set( 'hide_upcoming', true );

							break;
						case 'day':
							$event_date = $query->get( 'eventDate' ) != '' ? $query->get( 'eventDate' ) : Date( 'Y-m-d', current_time( 'timestamp' ) );
							$query->set( 'eventDate', $event_date );
							$beginning_of_day = strtotime( tribe_event_beginning_of_day( $event_date ) ) + 1;
							$query->set( 'start_date', date_i18n( Tribe__Events__Date_Utils::DBDATETIMEFORMAT, $beginning_of_day ) );
							$query->set( 'end_date', tribe_event_end_of_day( $event_date ) );
							$query->set( 'posts_per_page', - 1 ); // show ALL day posts
							$query->set( 'hide_upcoming', true );
							$query->set( 'order', self::set_order( 'ASC', $query ) );
							break;
						case 'single-event':
							if ( $query->get( 'eventDate' ) != '' ) {
								$query->set( 'start_date', $query->get( 'eventDate' ) );
								$query->set( 'eventDate', $query->get( 'eventDate' ) );
							}
							break;
						case 'all':
						case 'list':
						default: // default display query
							$query->set( 'posts_per_page', - 1 ); // show ALL //JER added
							$event_date = ( $query->get( 'eventDate' ) != '' )
								? $query->get( 'eventDate' )
								: date_i18n( Tribe__Events__Date_Utils::DBDATETIMEFORMAT );
							if ( ! $query->tribe_is_past ) {
								$query->set( 'start_date', ( '' != $query->get( 'eventDate' ) ? tribe_event_beginning_of_day( $event_date ) : tribe_event_format_date( current_time( 'timestamp' ), true, 'Y-m-d H:i:s' ) ) );
								$query->set( 'end_date', '' );
								$query->set( 'order', self::set_order( 'ASC', $query ) );
							} else {
								// on past view, set the passed date as the end date
								$query->set( 'start_date', '' );
								$query->set( 'end_date', tribe_event_end_of_day( $event_date ) );
								$query->set( 'order', self::set_order( 'DESC', $query ) );
							}
							$query->set( 'orderby', self::set_orderby( null, $query ) );
							$query->set( 'hide_upcoming', true );
							break;
					}
				} else {
					$query->set( 'hide_upcoming', true );
					$query->set( 'start_date', date_i18n( Tribe__Events__Date_Utils::DBDATETIMEFORMAT ) );
					$query->set( 'orderby', self::set_orderby( null, $query ) );
					$query->set( 'order', self::set_order( null, $query ) );
				}

				// eventCat becomes a standard taxonomy query - will need to deprecate and update views eventually
				if ( ! in_array( $query->get( Tribe__Events__Main::TAXONOMY ), array( '', '-1' ) ) ) {
					$tax_query[] = array(
						'taxonomy'         => Tribe__Events__Main::TAXONOMY,
						'field'            => is_numeric( $query->get( Tribe__Events__Main::TAXONOMY ) ) ? 'id' : 'slug',
						'terms'            => $query->get( Tribe__Events__Main::TAXONOMY ),
						'include_children' => apply_filters( 'tribe_events_query_include_children', true ),
					);
				}

				// Only add the postmeta hack if it's not the main admin events list
				// Because this method filters out drafts without EventStartDate.
				// For this screen we're doing the JOIN manually in Tribe__Events__Admin_List

				$screen = null;

				if ( function_exists( 'get_current_screen' ) ) {
					$screen = ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ? null : get_current_screen();
				}

				if ( empty( $screen ) || 'edit-tribe_events' !== $screen->id ) {
					$event_start_key = Tribe__Events__Timezones::is_mode( 'site' )
						? '_EventStartDateUTC'
						: '_EventStartDate';

					$meta_query[] = array(
						'key'  => $event_start_key,
						'type' => 'DATETIME',
					);
				}
			}

			// filter by Venue ID
			if ( $query->tribe_is_event_query && $query->get( 'venue' ) != '' ) {
				$meta_query[] = array(
					'key'   => '_EventVenueID',
					'value' => $query->get( 'venue' )
				);
			}

			// filter by Organizer ID
			if ( $query->tribe_is_event_query && $query->get( 'organizer' ) != '' ) {
				$meta_query[] = array(
					'key'   => '_EventOrganizerID',
					'value' => $query->get( 'organizer' )
				);
			}

			// enable pagination setup
			if ( $query->tribe_is_event_query && $query->get( 'posts_per_page' ) == '' ) {
				$query->set( 'posts_per_page', (int) tribe_get_option( 'postsPerPage', 10 ) );
			}

			// hide upcoming events from query (only not in admin)
			if ( $query->tribe_is_event_query && $query->get( 'hide_upcoming' ) && ! $query->get( 'suppress_filters' ) ) {
				$hide_upcoming_ids = self::getHideFromUpcomingEvents();
				if ( ! empty( $hide_upcoming_ids ) ) {
					$query->set( 'post__not_in', $hide_upcoming_ids );
				}
			}

			if ( $query->tribe_is_event_query && ! empty( $meta_query ) ) {
				// setup default relation for meta queries
				$meta_query['relation'] = 'AND';
				$meta_query_combined    = array_merge( (array) $meta_query, (array) $query->get( 'meta_query' ) );
				$query->set( 'meta_query', $meta_query_combined );
			}

			if ( $query->tribe_is_event_query && ! empty( $tax_query ) ) {
				// setup default relation for tax queries
				$tax_query_combined = array_merge( (array) $tax_query, (array) $query->get( 'tax_query' ) );
				$query->set( 'tax_query', $tax_query_combined );
			}

			if ( $query->tribe_is_event_query ) {
				add_filter( 'posts_orderby', array( __CLASS__, 'posts_orderby' ), 10, 2 );
			}

			// if is in the admin remove the event date & upcoming filters, unless is an ajax call
			if (
				is_admin()
				&& $query->tribe_is_event_query
				&& $admin_helpers->is_screen( 'edit-' . Tribe__Events__Main::POSTTYPE )
			) {
				if ( ( ! defined( 'DOING_AJAX' ) ) || ( defined( 'DOING_AJAX' ) && ! ( DOING_AJAX ) ) ) {

					remove_filter( 'posts_where', array( __CLASS__, 'posts_where' ), 10, 2 );
					remove_filter( 'posts_fields', array( __CLASS__, 'posts_fields' ) );
					$query->set( 'post__not_in', '' );

					// set the default order for posts within admin lists
					if ( ! isset( $query->query['order'] ) ) {
						$query->set( 'order', 'DESC' );
					} else {
						// making sure we preserve the order supplied by the query string even if it is overwritten above
						$query->set( 'order', $query->query['order'] );
					}
				}
			}

			if ( $query->tribe_is_event_query ) {
				do_action( 'tribe_events_pre_get_posts', $query );
			}

			return $query;
		}

		/**
		 * Adds DISTINCT to the query.
		 *
		 * @param string $distinct The current DISTINCT statement.
		 *
		 * @return string The modified DISTINCT statement.
		 */
		public static function posts_distinct( $distinct ) {
			return "DISTINCT";
		}

		/**
		 * Adds the proper fields to the FIELDS statement in the query.
		 *
		 * @param string   $field_sql The current/original FIELDS statement.
		 * @param WP_Query $query     The current query object.
		 *
		 * @return string The modified FIELDS statement.
		 */
		public static function posts_fields( $field_sql, $query ) {
			if (
				(
					! empty( $query->tribe_is_event )
					|| ! empty( $query->tribe_is_event_category )
				)
				&& self::can_inject_date_field( $query )
			) {
				$postmeta_table             = self::postmeta_table( $query );
				$fields                     = array();
				$fields['event_start_date'] = "MIN({$postmeta_table}.meta_value) as EventStartDate";
				$fields['event_end_date']   = "MIN(tribe_event_end_date.meta_value) as EventEndDate";
				$fields                     = apply_filters( 'tribe_events_query_posts_fields', $fields, $query );

				return $field_sql . ', ' . implode( ', ', $fields );
			} else {
				return $field_sql;
			}
		}

		/**
		 * Adds the proper fields to the FIELDS statement in the query.
		 *
		 * @param string   $field_sql The current/original FIELDS statement.
		 * @param WP_Query $query     The current query object.
		 *
		 * @return string The modified FIELDS statement.
		 */
		public static function multi_type_posts_fields( $field_sql, $query ) {
			if (
				! empty( $query->tribe_is_multi_posttype )
				&& self::can_inject_date_field( $query )
			) {
				global $wpdb;
				$postmeta_table = self::postmeta_table( $query );
				$fields         = array();
				$fields[]       = "IF ({$wpdb->posts}.post_type = 'tribe_events', $postmeta_table.meta_value, {$wpdb->posts}.post_date) AS post_date";
				$fields         = apply_filters( 'tribe_events_query_posts_fields', $fields, $query );

				return $field_sql . ', ' . implode( ', ', $fields );
			} else {
				return $field_sql;
			}
		}

		/**
		 * Custom SQL join for event end date
		 *
		 * @param string   $join_sql
		 * @param wp_query $query
		 *
		 * @return string
		 */
		public static function posts_join( $join_sql, $query ) {
			global $wpdb;
			$joins = array();

			$postmeta_table = self::postmeta_table( $query );

			$event_start_key = '_EventStartDate';
			$event_end_key   = '_EventEndDate';

			if ( Tribe__Events__Timezones::is_mode( 'site' ) ) {
				$event_start_key .= 'UTC';
				$event_end_key   .= 'UTC';
			}

			// if it's a true event query then we want create a join for where conditions
			if ( $query->tribe_is_event || $query->tribe_is_event_category || $query->tribe_is_multi_posttype ) {
				if ( $query->tribe_is_multi_posttype ) {
					// if we're getting multiple post types, we don't need the end date, just get the start date
					// for events-only post type queries, the start date postmeta join is already added by the main query args
					$joins['event_start_date'] = " LEFT JOIN {$wpdb->postmeta} as {$postmeta_table} on {$wpdb->posts}.ID = {$postmeta_table}.post_id AND {$postmeta_table}.meta_key = '$event_start_key'";
				} else {
					// for events-only post type queries, we should also get the end date for display
					$joins['event_end_date'] = " LEFT JOIN {$wpdb->postmeta} as tribe_event_end_date ON ( {$wpdb->posts}.ID = tribe_event_end_date.post_id AND tribe_event_end_date.meta_key = '$event_end_key' ) ";
				}
				$joins = apply_filters( 'tribe_events_query_posts_joins', $joins, $query );

				return $join_sql . implode( '', $joins );
			}

			return $join_sql;
		}

		/**
		 * Custom SQL join for orderby
		 *
		 * @param string   $join_sql
		 * @param wp_query $query
		 *
		 * @return string
		 */
		public static function posts_join_orderby( $join_sql, $query ) {
			global $wpdb;
			switch ( $query->get( 'orderby' ) ) {
				case 'venue':
					$join_sql .= " LEFT JOIN {$wpdb->postmeta} tribe_order_by_venue_meta ON {$wpdb->posts}.ID = tribe_order_by_venue_meta.post_id AND tribe_order_by_venue_meta.meta_key='_EventVenueID' LEFT JOIN {$wpdb->posts} tribe_order_by_venue ON tribe_order_by_venue_meta.meta_value = tribe_order_by_venue.ID ";
					break;
				case 'organizer':
					$join_sql .= " LEFT JOIN {$wpdb->postmeta} tribe_order_by_organizer_meta ON {$wpdb->posts}.ID = tribe_order_by_organizer_meta.post_id AND tribe_order_by_organizer_meta.meta_key='_EventOrganizerID' LEFT JOIN {$wpdb->posts} tribe_order_by_organizer ON tribe_order_by_organizer_meta.meta_value = tribe_order_by_organizer.ID ";
					break;
				default:
					break;
			}

			return apply_filters( 'tribe_events_query_posts_join_orderby', $join_sql );
		}

		/**
		 * Custom SQL conditional for event duration meta field
		 *
		 * @param string   $where_sql
		 * @param wp_query $query
		 *
		 * @return string
		 */
		public static function posts_where( $where_sql, $query ) {
			global $wpdb;

			// if it's a true event query then we to setup where conditions
			if ( $query->tribe_is_event || $query->tribe_is_event_category ) {

				$postmeta_table = self::postmeta_table( $query );

				$start_date = $query->get( 'start_date' );
				$end_date   = $query->get( 'end_date' );
				$use_utc    = Tribe__Events__Timezones::is_mode( 'site' );
				$site_tz    = $use_utc ? Tribe__Events__Timezones::wp_timezone_string() : null;

				// Sitewide timezone mode: convert the start date - if set - to UTC
				if ( $use_utc && ! empty( $start_date ) ) {
					$start_date = Tribe__Events__Timezones::to_utc( $start_date, $site_tz );
				}

				// Sitewide timezone mode: convert the end date - if set - to UTC
				if ( $use_utc && ! empty( $end_date ) ) {
					$end_date = Tribe__Events__Timezones::to_utc( $end_date, $site_tz );
				}

				// we can't store end date directly because it messes up the distinct clause
				$event_end_date = apply_filters( 'tribe_events_query_end_date_column', 'tribe_event_end_date.meta_value' );

				// event start date
				$event_start_date = "{$postmeta_table}.meta_value";

				// build where conditionals for events if date range params are set
				if ( $start_date != '' && $end_date != '' ) {
					$start_clause  = $wpdb->prepare( "($event_start_date >= %s AND $event_start_date <= %s)", $start_date, $end_date );
					$end_clause    = $wpdb->prepare( "($event_end_date >= %s AND $event_start_date <= %s )", $start_date, $end_date );
					$within_clause = $wpdb->prepare( "($event_start_date < %s AND $event_end_date >= %s )", $start_date, $end_date );
					$where_sql .= " AND ($start_clause OR $end_clause OR $within_clause)";
				} else {
					if ( $start_date != '' ) {
						$start_clause  = $wpdb->prepare( "{$postmeta_table}.meta_value >= %s", $start_date );
						$within_clause = $wpdb->prepare( "({$postmeta_table}.meta_value <= %s AND $event_end_date >= %s )", $start_date, $start_date );
						$where_sql .= " AND ($start_clause OR $within_clause)";
						if ( $query->is_singular() && $query->get( 'eventDate' ) ) {
							$tomorrow        = date( 'Y-m-d', strtotime( $query->get( 'eventDate' ) . ' +1 day' ) );
							$tomorrow_clause = $wpdb->prepare( "{$postmeta_table}.meta_value < %s", $tomorrow );
							$where_sql .= " AND $tomorrow_clause";
						}
					} else {
						if ( $end_date != '' ) {
							$where_sql .= " AND " . $wpdb->prepare( "$event_end_date < %s", $end_date );
						}
					}
				}
			}

			return $where_sql;
		}

		/**
		 * Internal method for properly setting a curated orderby value to $wp_query
		 * Internal method for properly setting a currated orderby value to $wp_query.
		 *
		 * If optional param $default is not provided it will default to 'event_date' - unless a custom
		 * orderby param was specified (via tribe_get_events() for example) - in which case that value
		 * will be used.
		 *
		 * @param string   $default
		 * @param WP_Query $query
		 *
		 * @return string
		 */
		public static function set_orderby( $default = null, $query = null ) {
			// What should $default be?
			if ( null === $default && isset( $query->query['orderby'] ) ) {
				$default = $query->query['orderby'];
			} elseif ( null === $default ) {
				$default = 'event_date';
			}

			$url_param = ! empty( $_GET['orderby'] ) ? $_GET['orderby'] : null;
			$url_param = ! empty( $_GET['tribe-orderby'] ) ? $_GET['tribe-orderby'] : $url_param;
			$url_param = strtolower( $url_param );

			switch ( $url_param ) {
				case 'tribe_sort_ecp_venue_filter':
					$orderby = 'venue';
					break;
				case 'tribe_sort_ecp_organizer_filter':
					$orderby = 'organizer';
					break;
				case 'title':
					$orderby = $url_param;
					break;
				default:
					$orderby = $default;
					break;
			}

			return $orderby;
		}

		/**
		 * Internal method for properly setting a currated order value to $wp_query.
		 *
		 * If optional param $default is not provided it will default to 'ASC' - unless a custom order
		 * was specified (via tribe_get_events() for example) - in which case that value will be used.
		 *
		 * @param string   $default
		 * @param WP_Query $query
		 *
		 * @return string
		 */
		public static function set_order( $default = null, $query = null ) {
			// What should $default be?
			if ( null === $default && isset( $query->query['order'] ) ) {
				$default = $query->query['order'];
			} elseif ( null === $default ) {
				$default = 'ASC';
			}

			$url_param = ! empty( $_GET['order'] ) ? $_GET['order'] : null;
			$url_param = ! empty( $_GET['tribe-order'] ) ? $_GET['tribe-order'] : $url_param;
			$url_param = strtoupper( $url_param );

			$order = in_array( $url_param, array( 'ASC', 'DESC' ) ) ? $url_param : $default;

			return $order;
		}

		/**
		 * Custom SQL order by statement for Event Start Date result order.
		 *
		 * @param string   $order_sql
		 * @param wp_query $query
		 *
		 * @return string
		 */
		public static function posts_orderby( $order_sql, $query ) {
			global $wpdb;
			$postmeta_table = self::postmeta_table( $query );

			if ( $query->tribe_is_event || $query->tribe_is_event_category ) {
				$order   = ( isset( $query->order ) && ! empty( $query->order ) ) ? $query->order : $query->get( 'order' );
				$orderby = ( isset( $query->orderby ) && ! empty( $query->orderby ) ) ? $query->orderby : $query->get( 'orderby' );

//				$order_sql = "DATE(MIN({$postmeta_table}.meta_value)) {$order}, TIME({$postmeta_table}.meta_value) {$order}";
				if ( self::can_inject_date_field( $query ) ) {
					$order_sql = "EventStartDate {$order}";
				}

				do_action( 'log', 'orderby', 'default', $orderby );

				switch ( $orderby ) {
					case 'venue':
						$order_sql = "tribe_order_by_venue.post_title {$order}, " . $order_sql;
						break;
					case 'organizer':
						$order_sql = "tribe_order_by_organizer.post_title {$order}, " . $order_sql;
						break;
					case 'title':
						$order_sql = "{$wpdb->posts}.post_title {$order}, " . $order_sql;
						break;
					case 'menu_order':
						$order_sql = "{$wpdb->posts}.menu_order ASC, " . $order_sql;
						break;
					case 'event_date':
						// we've already setup $order_sql
						break;
					case 'rand':
						$order_sql = 'RAND()';
						break;
				}

				// trim trailing characters
				$order_sql = trim( $order_sql, ", \t\n\r\0\x0B" );
			} else {
				if ( $query->tribe_is_multi_posttype && self::can_inject_date_field( $query ) ) {
					if ( $query->get( 'orderby' ) == 'date' || $query->get( 'orderby' ) == '' ) {
						$order_sql = str_replace( "$wpdb->posts.post_date", 'post_date', $order_sql );
					}
				}
			}

			$order_sql = apply_filters( 'tribe_events_query_posts_orderby', $order_sql, $query );

			return $order_sql;
		}

		/**
		 * Custom SQL to retrieve post_id list of events marked to be hidden from upcoming lists.
		 *
		 * @return array
		 */
		public static function getHideFromUpcomingEvents() {
			global $wpdb;

			$cache     = new Tribe__Events__Cache();
			$cache_key = 'tribe-hide-from-upcoming-events';
			$found     = $cache->get( $cache_key, 'save_post' );
			if ( is_array( $found ) ) {
				return $found;
			}

			// custom sql to get ids of posts that hide_upcoming_ids
			$hide_upcoming_ids = $wpdb->get_col( "SELECT {$wpdb->postmeta}.post_id FROM {$wpdb->postmeta} WHERE {$wpdb->postmeta}.meta_key = '_EventHideFromUpcoming' AND {$wpdb->postmeta}.meta_value = 'yes'" );
			$hide_upcoming_ids = apply_filters( 'tribe_events_hide_from_upcoming_ids', $hide_upcoming_ids );
			$cache->set( $cache_key, $hide_upcoming_ids, HOUR_IN_SECONDS, 'save_post' );

			return $hide_upcoming_ids;
		}

		/**
		 * Gets the event counts for individual days.
		 *
		 * @param array $args
		 *
		 * @return array The counts array.
		 */
		public static function getEventCounts( $args = array() ) {
			_deprecated_function( __METHOD__, '3.10.1' );
			global $wpdb;
			$date     = date( 'Y-m-d' );
			$defaults = array(
				'post_type'         => Tribe__Events__Main::POSTTYPE,
				'start_date'        => tribe_event_beginning_of_day( $date ),
				'end_date'          => tribe_event_end_of_day( $date ),
				'display_type'      => 'daily',
				'hide_upcoming_ids' => null,
			);
			$args     = wp_parse_args( $args, $defaults );

			$args['posts_per_page'] = - 1;
			$args['fields']         = 'ids';

			// remove empty args and sort by key, this increases chance of a cache hit
			$args = array_filter( $args, array( __CLASS__, 'filter_args' ) );
			ksort( $args );

			$cache     = new Tribe__Events__Cache();
			$cache_key = 'daily_counts_and_ids_' . serialize( $args );
			$found     = $cache->get( $cache_key, 'save_post' );
			if ( $found ) {

				return $found;
			}

			$cache_key = 'month_post_ids_' . serialize( $args );
			$found     = $cache->get( $cache_key, 'save_post' );
			if ( $found && is_array( $found ) ) {
				$post_ids = $found;
			} else {
				$post_id_query = new WP_Query();
				$post_ids      = $post_id_query->query( $args );
				$cache->set( $cache_key, $post_ids, Tribe__Events__Cache::NON_PERSISTENT, 'save_post' );
			}

			$counts    = array();
			$event_ids = array();
			if ( ! empty( $post_ids ) ) {
				switch ( $args['display_type'] ) {
					case 'daily':
					default :
						global $wp_query;
						$output_date_format = '%Y-%m-%d %H:%i:%s';
						$raw_counts = $wpdb->get_results(
							$wpdb->prepare(
								"
							SELECT 	tribe_event_start.post_id as ID,
									tribe_event_start.meta_value as EventStartDate,
									DATE_FORMAT( tribe_event_end_date.meta_value, '%1\$s') as EventEndDate,
									{$wpdb->posts}.menu_order as menu_order
							FROM $wpdb->postmeta AS tribe_event_start
									LEFT JOIN $wpdb->posts ON (tribe_event_start.post_id = {$wpdb->posts}.ID)
							LEFT JOIN $wpdb->postmeta as tribe_event_end_date ON ( tribe_event_start.post_id = tribe_event_end_date.post_id AND tribe_event_end_date.meta_key = '_EventEndDate' )
							WHERE tribe_event_start.meta_key = '_EventStartDate'
							AND tribe_event_start.post_id IN ( %5\$s )
							AND ( (tribe_event_start.meta_value >= '%3\$s' AND  tribe_event_start.meta_value <= '%4\$s')
								OR (tribe_event_start.meta_value <= '%3\$s' AND tribe_event_end_date.meta_value >= '%3\$s')
								OR ( tribe_event_start.meta_value >= '%3\$s' AND  tribe_event_start.meta_value <= '%4\$s')
							)
							ORDER BY menu_order ASC, DATE(tribe_event_start.meta_value) ASC, TIME(tribe_event_start.meta_value) ASC;",
								$output_date_format,
								$output_date_format,
								$post_id_query->query_vars['start_date'],
								$post_id_query->query_vars['end_date'],
								implode( ',', array_map( 'intval', $post_ids ) )
							)
						);
						$start_date = new DateTime( $post_id_query->query_vars['start_date'] );
						$end_date   = new DateTime( $post_id_query->query_vars['end_date'] );
						$days       = Tribe__Events__Date_Utils::date_diff( $start_date->format( 'Y-m-d' ), $end_date->format( 'Y-m-d' ) );
						$term_id    = isset( $wp_query->query_vars[ Tribe__Events__Main::TAXONOMY ] ) ? $wp_query->query_vars[ Tribe__Events__Main::TAXONOMY ] : null;
						$terms = array();
						if ( is_int( $term_id ) ) {
							$terms[0] = $term_id;
						} elseif ( is_string( $term_id ) ) {
							$term = get_term_by( 'slug', $term_id, Tribe__Events__Main::TAXONOMY );
							if ( $term ) {
								$terms[0] = $term->term_id;
							}
						}
						if ( ! empty( $terms ) && is_tax( Tribe__Events__Main::TAXONOMY ) ) {
							$terms = array_merge( $terms, get_term_children( $terms[0], Tribe__Events__Main::TAXONOMY ) );
						}
						for ( $i = 0, $date = $start_date; $i <= $days; $i ++, $date->modify( '+1 day' ) ) {
							$formatted_date = $date->format( 'Y-m-d' );
							$count          = 0;
							$_day_event_ids = array();
							foreach ( $raw_counts as $record ) {

								$event = new stdClass;
								$event->EventStartDate = $record->EventStartDate;
								$event->EventEndDate = $record->EventEndDate;

								$per_day_limit = apply_filters( 'tribe_events_month_day_limit', tribe_get_option( 'monthEventAmount', '3' ) );

								if ( tribe_event_is_on_date( $formatted_date, $event ) ) {
									if ( ! empty ( $terms ) ) {
										if ( ! has_term( $terms, Tribe__Events__Main::TAXONOMY, $record->ID ) ) {
											continue;
										}
									}
									if ( count( $_day_event_ids ) < $per_day_limit ) {
										$_day_event_ids[] = $record->ID;
									}
									$count ++;
								}
							}
							$event_ids[ $formatted_date ] = $_day_event_ids;
							$counts[ $formatted_date ]    = $count;
						}
						break;
				}

				// get a unique list of the event IDs that will be displayed, and update all their postmeta and term caches at once
				$final_event_ids = call_user_func_array( 'array_merge', $event_ids );
				$final_event_ids = array_unique( $final_event_ids );
				update_object_term_cache( $final_event_ids, Tribe__Events__Main::POSTTYPE );
				update_postmeta_cache( $final_event_ids );
			}
			// return IDs per day and total counts per day
			$return    = array( 'counts' => $counts, 'event_ids' => $event_ids );
			$cache     = new Tribe__Events__Cache;
			$cache_key = 'daily_counts_and_ids_' . serialize( $args );
			$cache->set( $cache_key, $return, Tribe__Events__Cache::NON_PERSISTENT, 'save_post' );

			return $return;
		}

		/**
		 * Customized WP_Query wrapper to setup event queries with default arguments.
		 *
		 * @param array $args
		 * @param bool  $full
		 *
		 * @return array|WP_Query
		 */
		public static function getEvents( $args = array(), $full = false ) {
			$defaults = array(
				'post_type'            => Tribe__Events__Main::POSTTYPE,
				'orderby'              => 'event_date',
				'order'                => 'ASC',
				'posts_per_page'       => tribe_get_option( 'postsPerPage', 10 ),
				'tribe_render_context' => 'default',
			);
			$args     = wp_parse_args( $args, $defaults );

			// remove empty args and sort by key, this increases chance of a cache hit
			$args = array_filter( $args, array( __CLASS__, 'filter_args' ) );
			ksort( $args );

			$cache     = new Tribe__Events__Cache();
			$cache_key = 'get_events_' . serialize( $args );

			$result = $cache->get( $cache_key, 'save_post' );
			if ( $result && $result instanceof WP_Query ) {
				do_action( 'log', 'cache hit', 'tribe-events-cache', $args );
			} else {
				do_action( 'log', 'no cache hit', 'tribe-events-cache', $args );
				$result = new WP_Query( $args );
				$cache->set( $cache_key, $result, Tribe__Events__Cache::NON_PERSISTENT, 'save_post' );
			}

			if ( ! empty( $result->posts ) ) {
				if ( $full ) {
					return $result;
				} else {
					$posts = $result->posts;

					return $posts;
				}
			} else {
				if ( $full ) {
					return $result;
				} else {
					return array();
				}
			}
		}

		/**
		 * Determine what postmeta table should be used,
		 * to avoid conflicts with previous postmeta joins
		 *
		 * @return string
		 **/
		private static function postmeta_table( $query ) {

			global $wpdb;

			if ( ! $query->tribe_is_multi_posttype ) {
				return $wpdb->postmeta;
			}

			$qv = $query->query_vars;

			// check if are any meta queries
			if ( ! empty( $qv['meta_key'] ) ) {
				$postmeta_table = 'tribe_event_postmeta';
			} else {
				if ( isset( $qv['meta_query'] ) ) {
					if (
						( is_array( $qv['meta_query'] ) && ! empty( $qv['meta_query'] ) ) ||
						( $qv['meta_query'] instanceof WP_Meta_Query && ! empty( $qv['meta_query']->queries ) )
					) {
						$postmeta_table = 'tribe_event_postmeta';
					}
				} else {
					$postmeta_table = $wpdb->postmeta;
				}
			}

			return $postmeta_table;

		}

		/**
		 * Remove empty values from the query args
		 *
		 * @param mixed $arg
		 *
		 * @return bool
		 **/
		private static function filter_args( $arg ) {
			if ( empty( $arg ) && $arg !== false ) {
				return false;
			}

			return true;
		}

	}
}


text:
<link rel="import" href="../lib/polymer/polymer.html">
<link rel="import" href="../lib/paper-tabs/paper-tabs.html">
<link rel="import" href="../lib/paper-tabs/paper-tab.html">
<link rel="import" href="../lib/core-pages/core-pages.html">
<link rel="import" href="../lib/core-icon/core-icon.html">

<polymer-element name="cmnodes-tabctrl" attributes="items">

    <template>
        <paper-tabs id="tctrl" noink selected="{{selected}}" on-core-select="{{selectTab}}">
            <template repeat="{{ item in items}}">
                <paper-tab>

{{item.name}}

                    <core-icon icon="cancel" on-click="{{closeTab}}" style="pointer-events:all;"></core-icon>
                </paper-tab>
            </template>
        </paper-tabs>
        <core-pages selected="{{selected}}">
            <template repeat="{{ item in items}}">

{{item.content}}

            </template>
        </core-pages>
    </template>

</polymer-element>


text:
package com.aaront.exercise.jvm.constant;

import com.aaront.exercise.jvm.utils.string.ByteUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author tonyhui
 * @since 17/6/23
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class IntegerConstant extends AbstractConstant {

    private int value;
    private byte[] content;

    public IntegerConstant(int tag, ConstantPool pool, byte[] content) {
        super(tag, pool);
        this.content = content;
        this.value = ByteUtils.byte2Int(this.content);
    }
}


text:
var Decimal = require("decimal.js");

var keyframing = require("./keyframing");

function addMidDelays(i, beginKey, dur, extendedBegin, extendedDur, extendedInitial, extendedKeys, extendedTween, instance, perFrameStep, resolution)
{
	// TODO :: check if not fill="freeze"
	if (i > 0)
	{
		var prevAfterDur = extendedBegin.sequence[i-1].begin + dur;
		var prevValue = extendedKeys[extendedKeys.length-1].value;

		if (prevAfterDur > beginKey.begin && extendedTween)
		{
			error.incompatible("Interrupted animation", "https://github.com/stevenvachon/smil2css/wiki/Interrupted-animations", instance);
		}

		if (prevAfterDur < beginKey.begin)
		{
			prevAfterDur = keyframing.relate(prevAfterDur, extendedDur, resolution);
			var current  = keyframing.relate(beginKey.begin, extendedDur, resolution);

			// See test/keyframing/begin-syncbase.end/not-looping2.svg
			// See test/keyframing/begin-syncbase.end/not-looping3.svg
			// See test/keyframing/begin-syncbase.end/not-looping4.svg
			// See test/keyframing/begin-syncbase.end/not-looping5.svg
			// See test/keyframing/begin-syncbase.end/not-looping6.svg
			keyframing.preserveBefore(prevAfterDur, prevValue, false, extendedKeys, perFrameStep, resolution);
			keyframing.at(prevAfterDur, extendedInitial, true, extendedKeys, perFrameStep, resolution);
			keyframing.preserveBefore(current, extendedInitial, true, extendedKeys, perFrameStep, resolution);
		}
	}
}

function addPostDelay(dur, extendedBegin, extendedDur, extendedInitial, extendedKeys, extendedTween, perFrameStep, resolution)
{
	// Related to sibling animations
	var postDelay = extendedDur - extendedBegin.duration + extendedBegin.postDelay;

	if (postDelay > 0)
	{
		var lastKey = extendedKeys[extendedKeys.length-1];
		var postDelayStart = lastKey.time;

		if (!extendedTween)
		{
			var lastKeyDuration = new Decimal(dur).dividedBy(extendedDur);

			postDelayStart = lastKeyDuration.plus(lastKey.time);
		}

		// Clean up any repeating decimals
		postDelayStart = keyframing.resolute(postDelayStart, resolution);

		if (!extendedTween)
		{
			keyframing.preserveAt(postDelayStart, lastKey.value, false, extendedKeys, perFrameStep, resolution);
		}

		keyframing.after(postDelayStart, extendedInitial, true, extendedKeys, perFrameStep, resolution);
	}
}

function addPreDelay(dur, extendedBegin, extendedDur, extendedInitial, extendedKeys, keyTimes, perFrameStep, resolution)
{
	var firstBeginKey = extendedBegin.sequence[0];

	if (firstBeginKey.begin > 0)
	{
		keyframing.at(0, extendedInitial, true, extendedKeys);

		// keyTimes[0] can be 1 (for discrete animations)
		var firstKeyTime = relateKeyTime(keyTimes[0], firstBeginKey.begin, dur, extendedDur, resolution);

		keyframing.preserveBefore(firstKeyTime, extendedInitial, true, extendedKeys, perFrameStep, resolution);
	}
}

function addSubKeys(beginKey, dur, extendedDur, extendedKeys, extendedTween, keyTimes, perFrameStep, repeatCount, resolution, values)
{
	// Avoid indefinite loops
	repeatCount = Math.max(1, repeatCount);

	for (var i=0; i<repeatCount; i++)
	{
		var iterationStart = beginKey.begin + dur*i;

		keyTimes.forEach( function(keyTime, j)
		{
			var time = relateKeyTime(keyTime, iterationStart, dur, extendedDur, resolution);

			// Previous keyTime
			if (j>0 && !extendedTween)
			{
				// Avoid a pointless frame
				if (values[j-1] != values[j])
				{
					keyframing.preserveBefore(time, values[j-1], false, extendedKeys, perFrameStep, resolution);
				}
			}

			// Current keyTime
			keyframing.at(time, values[j], false, extendedKeys);
		});
	}
}

function parse($animationElements, instance)
{
	$animationElements.each( function()
	{
		instance.$currentElement = instance.$(this);

		var dur             = instance.$currentElement.data("dur");
		var extendedBegin   = instance.$currentElement.data("extendedBegin");
		var extendedDur     = instance.$currentElement.data("extendedDur");
		var extendedInitial = instance.$currentElement.data("extendedInitial");
		var extendedTween   = instance.$currentElement.data("extendedTween");
		var keyTimes        = instance.$currentElement.data("keyTimes");
		var repeatCount     = instance.$currentElement.data("repeatCount");
		var values          = instance.$currentElement.data("values");

		var extendedKeys = [];
		var perFrameStep = keyframing.step(instance.$currentElement);
		var resolution   = keyframing.resolution(instance.$currentElement);

		if (extendedBegin.sequence.length)
		{
			addPreDelay(dur, extendedBegin, extendedDur, extendedInitial, extendedKeys, keyTimes, perFrameStep, resolution);

			extendedBegin.sequence.forEach( function(beginKey, i)
			{
				// Previous beginKey
				addMidDelays(i, beginKey, dur, extendedBegin, extendedDur, extendedInitial, extendedKeys, extendedTween, instance, perFrameStep, resolution);

				// Actual animation keyframes
				addSubKeys(beginKey, dur, extendedDur, extendedKeys, extendedTween, keyTimes, perFrameStep, repeatCount, resolution, values);
			});

			addPostDelay(dur, extendedBegin, extendedDur, extendedInitial, extendedKeys, extendedTween, perFrameStep, resolution);

			//console.log(extendedBegin)
			//console.log(extendedKeys)

			// TODO :: optimize keys by removing unnecessary frames (with identical values)? looping3_expect.svg is perfect

			// Convert from array to object
			extendedKeys = reformat(extendedKeys);
		}

		instance.$currentElement.data("extendedKeys", extendedKeys);
	});
}

function reformat(keys)
{
	var newKeys = {};

	keys.forEach( function(key)
	{
		newKeys[key.time] = key.value;
	});

	return newKeys;
}

function relateKeyTime(keyTime, begin, dur, extendedDur, resolution)
{
	// Relative to animation sequence in milliseconds
	var time = new Decimal(keyTime).times(dur).plus(begin);

	// Relative to sibling animations as a decimal percent (ready for CSS stringify)
	time = keyframing.relate(time, extendedDur, resolution);

	return time;
}

module.exports = parse;


text:
package orange.spring4.transaction.dao;

import orange.spring4.transaction.domain.OrderItem;

/**
 * ${DESCRIPTION}
 *
 * @author Ricky Fung
 * @create 2017-01-12 00:17
 */
public interface GoodsItemDao {

    int insert(OrderItem item);

    int updateStock(Long pid, int amount);
}


text:
// Type: Highsoft.Web.Mvc.Stocks.PlotOptionsColumnDataLabelsVerticalAlign

namespace Highsoft.Web.Mvc.Stocks
{
    public enum PlotOptionsColumnDataLabelsVerticalAlign
    {
        Null,
        Top,
        Middle,
        Bottom,
    }
}


text:
package com.xplenty.api.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Watcher extends XplentyObject<Watcher>{

    @JsonProperty("id")
    private Long id;

    @JsonProperty("display_name")
    private String name;

    public Watcher(){
        super(Watcher.class);
    }

    public Long getId() {
        return id;
    }
    @SuppressWarnings("unused")
    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }
    @SuppressWarnings("unused")
    public void setName(String name) {
        this.name = name;
    }
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<svrl:schematron-output xmlns:xs="http://www.w3.org/2001/XMLSchema"
                        xmlns:svrl="http://purl.oclc.org/dsdl/svrl"
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xmlns:schold="http://www.ascc.net/xml/schematron"
                        xmlns:sch="http://www.ascc.net/xml/schematron"
                        xmlns:iso="http://purl.oclc.org/dsdl/schematron"
                        xmlns:dash="urn:mpeg:dash:schema:mpd:2011"
                        xmlns:xlink="http://www.w3.org/1999/xlink"
                        title="Schema for validating MPDs"
                        schemaVersion="ISO19757-3"><!--

		 --><svrl:ns-prefix-in-attribute-values uri="urn:mpeg:dash:schema:mpd:2011" prefix="dash"/>
   <svrl:ns-prefix-in-attribute-values uri="http://www.w3.org/1999/xlink" prefix="xlink"/>
   <svrl:ns-prefix-in-attribute-values uri="http://www.w3.org/2001/XMLSchema-instance" prefix="xsi"/>
   <svrl:active-pattern/>
   <svrl:fired-rule context="dash:MPD"/>
   <svrl:failed-assert test="if (@type = 'dynamic' and not(@publishTime)) then false() else true()"
                       location="/*[local-name()='MPD' and namespace-uri()='urn:mpeg:dash:schema:mpd:2011']">
      <svrl:text>If MPD is of type "dynamic" publishTime shall be defined.</svrl:text>
   </svrl:failed-assert>
   <svrl:active-pattern/>
   <svrl:fired-rule context="dash:Period"/>
   <svrl:active-pattern/>
   <svrl:fired-rule context="dash:AdaptationSet"/>
   <svrl:active-pattern/>
   <svrl:active-pattern/>
   <svrl:fired-rule context="dash:Representation"/>
   <svrl:active-pattern/>
   <svrl:active-pattern/>
   <svrl:active-pattern/>
   <svrl:fired-rule context="dash:SegmentList"/>
   <svrl:active-pattern/>
   <svrl:active-pattern/>
   <svrl:fired-rule context="dash:SegmentTimeline"/>
   <svrl:failed-assert test="if ((if (ancestor::dash:*[1]/@timescale) then (child::dash:S/@d div ancestor::dash:*[1]/@timescale) else child::dash:S/@d) > (years-from-duration(ancestor::dash:MPD/@maxSegmentDuration) + months-from-duration(ancestor::dash:MPD/@maxSegmentDuration) + days-from-duration(ancestor::dash:MPD/@maxSegmentDuration) + hours-from-duration(ancestor::dash:MPD/@maxSegmentDuration) + minutes-from-duration(ancestor::dash:MPD/@maxSegmentDuration) + seconds-from-duration(ancestor::dash:MPD/@maxSegmentDuration))) then false() else true()"
                       location="/*[local-name()='MPD' and namespace-uri()='urn:mpeg:dash:schema:mpd:2011']/*[local-name()='Period' and namespace-uri()='urn:mpeg:dash:schema:mpd:2011']/*[local-name()='AdaptationSet' and namespace-uri()='urn:mpeg:dash:schema:mpd:2011']/*[local-name()='Representation' and namespace-uri()='urn:mpeg:dash:schema:mpd:2011']/*[local-name()='SegmentList' and namespace-uri()='urn:mpeg:dash:schema:mpd:2011']/*[local-name()='SegmentTimeline' and namespace-uri()='urn:mpeg:dash:schema:mpd:2011']">
      <svrl:text>The d attribute of a SegmentTimeline shall not exceed the value give bei the MPD maxSegmentDuration attribute.</svrl:text>
   </svrl:failed-assert>
   <svrl:active-pattern/>
   <svrl:active-pattern/>
   <svrl:active-pattern/>
   <svrl:active-pattern/>
   <svrl:active-pattern/>
   <svrl:active-pattern/>
   <svrl:active-pattern/>
   <svrl:active-pattern/>
   <svrl:active-pattern/>
</svrl:schematron-output>


text:
import xarray as _xr
import numpy as _np
import atmPy.aerosols.size_distribution.sizedistribution as _sizedist
import pandas as _pd

def read_netCDF(fname):
    # fname = '/Volumes/HTelg_4TB_Backup/arm_data/OLI/uhsas/oliaosuhsasM1.a1.20170401.000008.nc'

    if type(fname) == str:
        fname = [fname]

    sds = []
    for fn in fname:
        data = _xr.open_dataset(fn)

        if data.sampling_interval.split()[1] != 'seconds':
            raise ValueError('This should be seconds, but it is {}.'.format(data.sampling_interval.split()[1]))

        if not _np.all((data.upper_size_limit.data[:-1] - data.lower_size_limit.data[1:]) == 0):
            raise ValueError('Something is wrong with the bins')

        # flow rate variable name changed at some point
        if 'sample_flow_rate' in data.variables.keys():
            flowrate = data.sample_flow_rate
        elif 'sampling_volume' in data.variables.keys():
            flowrate = data.sampling_volume

        if flowrate.units not in ['sccm', 'cc/min']:
            raise ValueError('units has to be sccm, but is {}.'.format(flowrate.units))

        sd = data.size_distribution.to_pandas()

        # normalize total numbers to numbers/(cc)
        ## normalize to integration interval
        sd /= float(data.sampling_interval.split()[0])  # normalize to integration interval

        ## normalize to flow rate
        flowrate = flowrate.values / 60.
        sd = sd.divide(flowrate, axis=0)

        sds.append(sd)

    sd = _pd.concat(sds).sort_index()

    binedges = _np.append(data.lower_size_limit.data, data.upper_size_limit.data[-1])
    sdts = _sizedist.SizeDist_TS(sd, binedges, 'numberConcentration')
    sdts._data_period = float(data.sampling_interval.split()[0])
    sdts = sdts.convert2dNdlogDp()
    return sdts


text:
<?php

namespace Sylius\Bundle\WebBundle\Controller\Frontend;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Gecko\LegemdaryBundle\Entity\LegemdaryPost;
use Sylius\Bundle\CartBundle\Event\CartEvent;
use Sylius\Component\Cart\SyliusCartEvents;
use Symfony\Component\HttpFoundation\JsonResponse;
use Sylius\Bundle\WebBundle\Form\ContactFormType;

/**
 * Frontend homepage controller.
 *
 * @author Paweł Jędrzejewski <pjedrzejewski@diweb.pl>
 */
class HomepageController extends Controller
{
    /**
     * Store front page.
     *
     * @return Response
     */
    public function mainAction()
    {
        return $this->render('SyliusWebBundle:Frontend/Homepage:main.html.twig');
    }

    public function comingSoonAction()
    {
    	return $this->render('SyliusWebBundle:Frontend/Homepage:comingSoon.html.twig');
    }

    public function bidRequestAction()
    {
    	$currentCart = $this->container->get('sylius.cart_provider')->getCart();
    	$eventDispatcher = $this->container->get('event_dispatcher');
    	$eventDispatcher->dispatch(SyliusCartEvents::CART_CLEAR_INITIALIZE, new CartEvent($currentCart));

    	return $this->render('SyliusWebBundle:Frontend/Homepage:bidRequest.html.twig');
    }

    public function diamondEducationAction(Request $request)
    {
		return $this->render('SyliusWebBundle:Frontend/Homepage:diamondEducation.html.twig');
	}

	public function diamondGradingAction(Request $request)
	{
		return $this->render('SyliusWebBundle:Frontend/Homepage:diamondGrading.html.twig');
	}

	public function ringStylesAction(Request $request)
	{
		return $this->render('SyliusWebBundle:Frontend/Homepage:ringStyles.html.twig');
	}

	public function diamondCertificatesAction(Request $request)
	{
		return $this->render('SyliusWebBundle:Frontend/Homepage:diamondCertificates.html.twig');
	}

	public function helpAction(Request $request)
	{
		return $this->render('SyliusWebBundle:Frontend/Homepage:help.html.twig');
	}

	public function howItWorksAction(Request $request)
	{
		return $this->render('SyliusWebBundle:Frontend/Homepage:howItWorks.html.twig');
	}

	public function ourStoryAction(Request $request)
	{
		return $this->render('SyliusWebBundle:Frontend/Homepage:ourStory.html.twig');
	}

	public function ourSocialCommitmentAction(Request $request)
	{
		return $this->render('SyliusWebBundle:Frontend/Homepage:ourSocialCommitment.html.twig');
	}

	public function ringSizerAction(Request $request)
	{
		return $this->render('SyliusWebBundle:Frontend/Homepage:ringSizer.html.twig');
	}

	public function contactAction(Request $request)
	{
		$form = $this->createForm(new ContactFormType());

		if ($request->isMethod('POST'))
		{
			$form->bind($request);

			if ($form->isValid())
			{
				$this->get('legem.send.mailer')->sendContactEmail($form->getData());

				$request->getSession()->getFlashBag()->add('success', 'Your email has been sent succesfully!');
				return $this->redirect($this->generateUrl('sylius_contact'));
			}
		}

		return $this->render('SyliusWebBundle:Frontend/Homepage:contact.html.twig', array(
			'form' => $form->createView()
		));
	}

    public function getPricingMatrixAction()
    {
    	$repository = $this->getDoctrine()->getRepository('GeckoLegemdaryBundle:DiamondPrice');
    	$prices = $repository->findAll();

    	$pricingMatrix = array();
    	foreach($prices as $price)
    	{
    		$ctKey = 'ct'.$price->getCaratTable();
    		$clKey = $price->getClarity();
    		$coKey = $price->getColor();

    		if(!isset($pricingMatrix[$ctKey]))
    			$pricingMatrix[$ctKey] = array();

    		if(!isset($pricingMatrix[$ctKey][$clKey]))
    			$pricingMatrix[$ctKey][$clKey] = array();

    		$pricingMatrix[$ctKey][$clKey][$coKey] = $price->getPriceGuidance();
    	}

    	return JsonResponse::create($pricingMatrix);
    }

    public function blogAction()
    {
    	$repository = $this->getDoctrine()->getRepository('GeckoLegemdaryBundle:LegemdaryPost');

    	$posts = $repository->findAll();

    	return $this->render('SyliusWebBundle:Frontend/Blog:blog.html.twig', array(
    		'posts' => $posts
    	));
    }

    public function blogPostAction($id)
    {
    	$repository = $this->getDoctrine()->getRepository('GeckoLegemdaryBundle:LegemdaryPost');

    	$post = $repository->find($id);

    	return $this->render('SyliusWebBundle:Frontend/Blog:blogPost.html.twig', array(
    		'post' => $post
    	));
    }
}