text:
package com.skcraft.plume.common.service.sql;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.skcraft.plume.common.UserId;
import com.skcraft.plume.common.service.party.Member;
import com.skcraft.plume.common.service.party.Party;
import com.skcraft.plume.common.service.party.PartyExistsException;
import com.skcraft.plume.common.service.party.Rank;
import org.junit.Before;
import org.junit.Test;
import uk.co.it.modular.hamcrest.date.DateMatchers;

import java.util.Map;
import java.util.UUID;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;

public class DatabasePartiesTest {

    private static final UserId LEISER_USER = new UserId(UUID.fromString("12345678-4321-1945-1111-223344556677"), "LeiserGeist");

    private MockDatabase db;

    @Before
    public void setUp() throws Exception {
        db = MockDatabase.getInstance();
    }

    private DatabaseParties createParties() {
        db.loadData();
        DatabaseManager manager = db.createDatabaseManager();
        DatabaseParties parties = new DatabaseParties(manager);
        parties.load();
        return parties;
    }

    @Test
    public void testAddParty_New() throws Exception {
        DatabaseParties partyManager = createParties();

        Party party = new Party();
        party.setName("noobs");
        party.setMembers(Sets.newHashSet(new Member(LEISER_USER, Rank.MEMBER), new Member(MockDatabase.VINCENT_USER, Rank.OWNER), new Member(MockDatabase.SK_USER, Rank.MEMBER)));
        party.setCreateTime(MockDatabase.parseDate("2012-01-02 11:12:13"));
        partyManager.addParty(party);

        Party addedParty = partyManager.findPartyByName("noobs");
        assertThat(party.getName(), equalTo("noobs"));
        assertThat(party.getCreateTime(), equalTo(MockDatabase.parseDate("2012-01-02 11:12:13")));

        assertThat(party.getMembers().size(), is(3));
        assertThat(party.getMembers(), containsInAnyOrder(new Member(MockDatabase.VINCENT_USER, Rank.OWNER), new Member(LEISER_USER, Rank.MEMBER), new Member(MockDatabase.SK_USER, Rank.MEMBER)));
    }

    @Test(expected = PartyExistsException.class)
    public void testAddParty_Existing() throws Exception {
        DatabaseParties partyManager = createParties();

        Party party = new Party();
        party.setName("friends");
        party.setMembers(Sets.newHashSet(new Member(MockDatabase.VINCENT_USER, Rank.OWNER), new Member(MockDatabase.SK_USER, Rank.MEMBER)));
        party.setCreateTime(MockDatabase.parseDate("2015-03-05 10:20:30"));

        partyManager.addParty(party);
    }

    @Test
    public void testFindPartiesByName() throws Exception {
        DatabaseParties partyManager = createParties();
        Map<String, Party> parties = partyManager.findPartiesByName(Lists.newArrayList("guests", "friends"));

        assertThat(parties.size(), is(2));
        assertThat(parties.get("guests").getCreateTime(), DateMatchers.sameSecond(MockDatabase.parseDate("2015-03-05 10:20:30")));
        assertThat(parties.get("friends").getCreateTime(), DateMatchers.sameSecond(MockDatabase.parseDate("2015-02-04 10:20:30")));
    }

    @Test
    public void testFindPartyByName() throws Exception {
        DatabaseParties partyManager = createParties();
        Party party = partyManager.findPartyByName("guests");

        assertThat(party.getName(), equalTo("guEsTs"));
        assertThat(party.getCreateTime(), DateMatchers.sameSecond(MockDatabase.parseDate("2015-03-05 10:20:30")));

        assertThat(party.getMembers().size(), is(2));
        assertThat(party.getMembers(), containsInAnyOrder(new Member(MockDatabase.VINCENT_USER, Rank.OWNER), new Member(MockDatabase.SK_USER, Rank.MEMBER)));
    }

    @Test
    public void testRefreshParty() throws Exception {
        DatabaseParties partyManager = createParties();
        Party party = partyManager.findPartyByName("guests");

        assertThat(partyManager.refreshParty(party), is(false));

        assertThat(partyManager.findPartyByName("guests").getCreateTime(), DateMatchers.sameSecond(MockDatabase.parseDate("2015-03-05 10:20:30")));
    }

    @Test
    public void testAddMembers() throws Exception {
        DatabaseParties partyManager = createParties();
        Party party = partyManager.findPartyByName("friends");

        assertThat(party.getMembers().size(), is(1));

        partyManager.addMembers("friends", Sets.newHashSet(new Member(MockDatabase.VINCENT_USER, Rank.MEMBER)));
        partyManager.refreshParty(party);

        assertThat(party.getMembers().size(), is(2));
        assertThat(party.getMembers(), containsInAnyOrder(
                new Member(MockDatabase.VINCENT_USER, Rank.OWNER),
                new Member(MockDatabase.SK_USER, Rank.MEMBER)
        ));
    }

    @Test
    public void testRemoveMembers() throws Exception {
        DatabaseParties partyManager = createParties();
        Party party = partyManager.findPartyByName("guests");

        assertThat(party.getMembers().size(), is(2));

        partyManager.removeMembers("guests", Sets.newHashSet(MockDatabase.SK_USER));
        partyManager.refreshParty(party);

        assertThat(party.getMembers().size(), is(1));

    }
}


text:
To Do List

                    <form id="frmtodo">

                            Task Title
                            <input type="text" id="todo_title" class=form-control name="todo_title" >

                            Task Date
                            <input id="basic-datepicker" type="text" name="tado_date" class="form-control">

                            Task Time

                                    <input id="minute-step-timepicker" name="todo_time" type="text" class="form-control">

                            <input type="button" class="btn btn-primary" name="submit" value="Add New Task" id="addbutton" >
                                <input type="button" class="btn btn-primary" name="submit" value="Close" id="closeform" >

                    </form>

                    <form><input class=form-control name=search placeholder="Search for todo ..."></form>

To Do List

<img src='<?php echo base_url().'assets/img/preloader.gif' ?>' width="64" height="64" />
Loading..

                <?php foreach ($todolist as $todo) { ?>
                <li class="todo-task-item <?php if($todo->todo_status=="0"){ echo "task-done"; } ?>" id="todo-task-item-id<?php echo $todo->todo_id; ?>">

<input type="checkbox" <?php if($todo->todo_status=="0"){ echo "checked=''"; } ?> value="<?php echo $todo->todo_id ?>" id="checkbox<?php echo $todo->todo_id ?>" class="taskstatus">

                        <?php echo $todo->todo_datetime; ?>

<?php echo $todo->todo_title; ?>

                        <button type=button class="label label-primary updateclick" value="<?php echo $todo->todo_id; ?>">Edit</button>
                        <button type=button class="close todo-close" value="<?php echo $todo->todo_id; ?>">×</button>

                <?php } ?>

redpajama_set_name: RedPajamaGithub


text:
agilezen-js is a small javascript wrapper for the AgileZen.com API http://dev.agilezen.com/

written by Kory Kirk agilezen-js is no way affiliated with AgileZen.com

The code can be used under either the MIT License or the GNU General Public License Version 2. The code base should come with a copy of both of these.

Requires JQuery


text:
using System;
using System.Windows.Forms;
namespace ICSharpCode.TextEditor.Util
{
	internal class MouseWheelHandler
	{
		private const int WHEEL_DELTA = 120;
		private int mouseWheelDelta;
		public int GetScrollAmount(MouseEventArgs e)
		{
			this.mouseWheelDelta += e.Delta;
			int num = Math.Max(SystemInformation.MouseWheelScrollLines, 1);
			int result = this.mouseWheelDelta * num / 120;
			this.mouseWheelDelta %= Math.Max(1, 120 / num);
			return result;
		}
	}
}


text:
package io.hekate.core.internal.util;

import io.hekate.HekateTestBase;
import org.junit.Test;

import static io.hekate.core.internal.util.StreamUtils.nullSafe;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static java.util.stream.Collectors.toList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

public class StreamUtilsTest extends HekateTestBase {
    @Test
    public void testNullSafe() {
        assertNotNull(nullSafe(null));
        assertNotNull(nullSafe(emptyList()));

        assertEquals(singletonList("non null"), nullSafe(asList(null, "non null", null)).collect(toList()));
    }

    @Test
    public void testUtilityClass() throws Exception {
        assertValidUtilityClass(StreamUtils.class);
    }
}


text:
require File.dirname(__FILE__) + '/../../spec_helper.rb'

module Spec
  module Example
    ConfigurationSpec =
      describe Configuration, :shared => true do
        before(:each) do
          @config = Configuration.new
          @example_group = mock("example_group")
        end
      end

    describe Configuration, "#mock_with" do
      include ConfigurationSpec
      it "should default mock framework to rspec" do
        @config.mock_framework.should =~ /\/plugins\/mock_frameworks\/rspec$/
      end

      it "should let you set rspec mocking explicitly" do
        @config.mock_with(:rspec)
        @config.mock_framework.should =~ /\/plugins\/mock_frameworks\/rspec$/
      end

      it "should let you set mocha" do
        @config.mock_with(:mocha)
        @config.mock_framework.should =~ /\/plugins\/mock_frameworks\/mocha$/
      end

      it "should let you set flexmock" do
        @config.mock_with(:flexmock)
        @config.mock_framework.should =~ /\/plugins\/mock_frameworks\/flexmock$/
      end

      it "should let you set rr" do
        @config.mock_with(:rr)
        @config.mock_framework.should =~ /\/plugins\/mock_frameworks\/rr$/
      end

      it "should let you set an arbitrary adapter module" do
        adapter = Module.new
        @config.mock_with(adapter)
        @config.mock_framework.should == adapter
      end
    end

    describe Configuration, "#include" do
      include ConfigurationSpec

      before do
        @original_configuration = Spec::Runner.configuration
        spec_configuration = @config
        Spec::Runner.instance_eval {@configuration = spec_configuration}
        @example_group_class = Class.new(ExampleGroup) do
          class << self
            def this_class_has_special_methods
            end
          end
        end
        ExampleGroupFactory.register(:foobar, @example_group_class)
      end

      after do
        original_configuration = @original_configuration
        Spec::Runner.instance_eval {@configuration = original_configuration}
        ExampleGroupFactory.reset
      end

      it "should include the submitted module in ExampleGroup subclasses" do
        mod = Module.new
        @config.include mod
        Class.new(@example_group_class).included_modules.should include(mod)
      end

      it "should let you define modules to be included for a specific type" do
        mod = Module.new
        @config.include mod, :type => :foobar
        Class.new(@example_group_class).included_modules.should include(mod)
      end

      it "should not include modules in a type they are not intended for" do
        mod = Module.new
        @other_example_group_class = Class.new(ExampleGroup)
        ExampleGroupFactory.register(:baz, @other_example_group_class)

        @config.include mod, :type => :foobar

        Class.new(@other_example_group_class).included_modules.should_not include(mod)
      end

      it "should not extend the ExampleGroup baseclass (to enable the included hook to work properly)" do
        pending("need to figure out how to best express this one")
      end
    end

    ConfigurationCallbacksSpec =
      describe Configuration, "callbacks", :shared => true do
        before do
          @config = Configuration.new
          @special_example_group = Class.new(ExampleGroup)
          @special_child_example_group = Class.new(@special_example_group)
          @nonspecial_example_group = Class.new(ExampleGroup)
          ExampleGroupFactory.register(:special, @special_example_group)
          ExampleGroupFactory.register(:special_child, @special_child_example_group)
          ExampleGroupFactory.register(:non_special, @nonspecial_example_group)
          @example_group = @special_child_example_group.describe "Special Example Group"
          @unselected_example_group = Class.new(@nonspecial_example_group).describe "Non Special Example Group"
        end

        after do
          ExampleGroupFactory.reset
        end
      end

    describe Configuration, "#prepend_before" do
      include ConfigurationCallbacksSpec

      it "prepends the before block on all instances of the passed in type" do
        order = []
        @config.prepend_before(:all) do
          order << :prepend__before_all
        end
        @config.prepend_before(:all, :type => :special) do
          order << :special_prepend__before_all
        end
        @config.prepend_before(:all, :type => :special_child) do
          order << :special_child_prepend__before_all
        end
        @config.prepend_before(:each) do
          order << :prepend__before_each
        end
        @config.prepend_before(:each, :type => :special) do
          order << :special_prepend__before_each
        end
        @config.prepend_before(:each, :type => :special_child) do
          order << :special_child_prepend__before_each
        end
        @config.prepend_before(:all, :type => :non_special) do
          order << :special_prepend__before_all
        end
        @config.prepend_before(:each, :type => :non_special) do
          order << :special_prepend__before_each
        end
        @example_group.it "calls prepend_before" do
        end

        @example_group.run
        order.should == [
          :prepend__before_all,
          :special_prepend__before_all,
          :special_child_prepend__before_all,
          :prepend__before_each,
          :special_prepend__before_each,
          :special_child_prepend__before_each
        ]
      end
    end

    describe Configuration, "#append_before" do
      include ConfigurationCallbacksSpec

      it "calls append_before on the type" do
        order = []
        @config.append_before(:all) do
          order << :append_before_all
        end
        @config.append_before(:all, :type => :special) do
          order << :special_append_before_all
        end
        @config.append_before(:all, :type => :special_child) do
          order << :special_child_append_before_all
        end
        @config.append_before(:each) do
          order << :append_before_each
        end
        @config.append_before(:each, :type => :special) do
          order << :special_append_before_each
        end
        @config.append_before(:each, :type => :special_child) do
          order << :special_child_append_before_each
        end
        @config.append_before(:all, :type => :non_special) do
          order << :special_append_before_all
        end
        @config.append_before(:each, :type => :non_special) do
          order << :special_append_before_each
        end
        @example_group.it "calls append_before" do
        end

        @example_group.run
        order.should == [
          :append_before_all,
          :special_append_before_all,
          :special_child_append_before_all,
          :append_before_each,
          :special_append_before_each,
          :special_child_append_before_each
        ]
      end
    end

    describe Configuration, "#prepend_after" do
      include ConfigurationCallbacksSpec

      it "prepends the after block on all instances of the passed in type" do
        order = []
        @config.prepend_after(:all) do
          order << :prepend__after_all
        end
        @config.prepend_after(:all, :type => :special) do
          order << :special_prepend__after_all
        end
        @config.prepend_after(:all, :type => :special) do
          order << :special_child_prepend__after_all
        end
        @config.prepend_after(:each) do
          order << :prepend__after_each
        end
        @config.prepend_after(:each, :type => :special) do
          order << :special_prepend__after_each
        end
        @config.prepend_after(:each, :type => :special) do
          order << :special_child_prepend__after_each
        end
        @config.prepend_after(:all, :type => :non_special) do
          order << :special_prepend__after_all
        end
        @config.prepend_after(:each, :type => :non_special) do
          order << :special_prepend__after_each
        end
        @example_group.it "calls prepend_after" do
        end

        @example_group.run
        order.should == [
          :special_child_prepend__after_each,
          :special_prepend__after_each,
          :prepend__after_each,
          :special_child_prepend__after_all,
          :special_prepend__after_all,
          :prepend__after_all
        ]
      end
    end

    describe Configuration, "#append_after" do
      include ConfigurationCallbacksSpec

      it "calls append_after on the type" do
        order = []
        @config.append_after(:all) do
          order << :append__after_all
        end
        @config.append_after(:all, :type => :special) do
          order << :special_append__after_all
        end
        @config.append_after(:all, :type => :special_child) do
          order << :special_child_append__after_all
        end
        @config.append_after(:each) do
          order << :append__after_each
        end
        @config.append_after(:each, :type => :special) do
          order << :special_append__after_each
        end
        @config.append_after(:each, :type => :special_child) do
          order << :special_child_append__after_each
        end
        @config.append_after(:all, :type => :non_special) do
          order << :non_special_append_after_all
        end
        @config.append_after(:each, :type => :non_special) do
          order << :non_special_append_after_each
        end
        @example_group.it "calls append_after" do
        end

        @example_group.run
        order.should == [
          :special_child_append__after_each,
          :special_append__after_each,
          :append__after_each,
          :special_child_append__after_all,
          :special_append__after_all,
          :append__after_all
        ]
      end
    end
  end
end


text:
package de.tototec.sbuild

import java.io.File
import de.tototec.sbuild.internal.WithinTargetExecution
import de.tototec.sbuild.internal.I18n

object TargetRef {

  implicit def fromTarget(target: Target): TargetRef = TargetRef(target)
  implicit def fromString(name: String)(implicit project: Project): TargetRef = TargetRef(name)
  implicit def fromFile(file: File)(implicit project: Project): TargetRef = TargetRef(file)

  def apply(name: String)(implicit project: Project): TargetRef = new TargetRef(name)
  def apply(target: Target): TargetRef = new TargetRef(target.name)(target.project)
  def apply(file: File)(implicit project: Project): TargetRef = new TargetRef("file:" + file.getPath)

}

class TargetRef(val ref: String)(implicit project: Project) {

  private[this] def log = Logger[TargetRef]

  val (explicitProject: Option[File], name: String) = ref.split("::", 2) match {
    case Array(p, n) => (Some(Path(p)), n)
    case Array(n) => (None, n)
  }

  val explicitProto: Option[String] = name.split(":", 2) match {
    case Array(proto, name) => Some(proto)
    case Array(name) => None
  }

  def explicitNonStandardProto: Option[String] = explicitProto match {
    case Some(p) if p != "file" && p != "phony" => Some(p)
    case _ => None
  }

  val nameWithoutProto: String = name.split(":", 2) match {
    case Array(_, name) => name
    case _ => name
  }

  def nameWithoutStandardProto: String = name.split(":", 2) match {
    case Array(p, name) if p == "phony" || p == "file" => name
    case Array(_, _) => name
    case _ => name
  }

  def formatRelativeToProject: String = (name.split(":", 2) match {
    case Array("file", name) => Right(name)
    case Array("phony", name) => Left(name)
    case Array(_, _) => Left(name)
    case _ => Right(name)
  }) match {
    case Right(name) => new RichFile(Path(name)(project)).pathRelativeTo(project.projectDirectory) match {
      case Some(relative) if relative.isEmpty() => name
      case Some(relative) => relative
      case None => name
    }
    case Left(name) => name
  }

  override def toString: String = ref

  protected[sbuild] def targetProject: Option[Project] =
    if (explicitProject == None || project.projectFile == explicitProject.get)
      Some(project)
    else
      project.findModule(explicitProject.get.getPath)

  protected[sbuild] def safeTargetProject: Project =
    targetProject match {
      case Some(p) => p
      case _ =>
        val e = new TargetNotFoundException(s"""Project "${explicitProject.get}" not found.""")
        e.buildScript = Some(project.projectFile)
        throw e
    }

  /**
   * Get the files, this TargetRef is referencing or producing, if any.
   * Should only call from inside an execution block of a target.
   */
  def files: Seq[File] = {
    WithinTargetExecution.safeWithinTargetExecution("TargetRef.files", Some(project)) {
      withinTargetExec =>
        // Find the TargetContext of the already executed dependency, that matches this TargetRef

        // as all dependencies were already executed,
        // they all should have an associated Target instance, which we can search for.
        // So, we must find a target for the used TargetRef.
        // When not, the used TargetRef was not part of the dependencies

        project.findTarget(this, searchInAllProjects = true, includeImplicit = true) match {
          case None =>
            // No target found, so this TargetRef can not be part of the dependencies
            val msg = I18n.marktr("'TargetRef.files' is used for dependency \"{0}\", that is not declared with 'dependsOn'.")
            val ex = new ProjectConfigurationException(I18n.notr(msg, this.toString), null, I18n[TargetRef].tr(msg, this.toString))
            ex.buildScript = Some(project.projectFile)
            ex.targetName = Some(withinTargetExec.targetContext.name)
            throw ex

          case Some(referencedTarget) =>
            // search the associated TargetContext for that target

            withinTargetExec.directDepsTargetContexts.find { ctx => ctx.target == referencedTarget } match {
              case None =>
                // No target context found, so this TargetRef can not be part of the dependencies
                log.debug("referencedTarget = " + referencedTarget + "\ndirectDepsTargetContexts = " + withinTargetExec.directDepsTargetContexts.mkString(",\n  "))
                val msg = I18n.marktr("'TargetRef.files' is used for dependency \"{0}\", that is not declared with 'dependsOn'.")
                val ex = new ProjectConfigurationException(I18n.notr(msg, this.toString), null, I18n[TargetRef].tr(msg, this.toString))
                ex.buildScript = Some(project.projectFile)
                ex.targetName = Some(withinTargetExec.targetContext.name)
                throw ex

              case Some(foundDepCtx) =>
                foundDepCtx.targetFiles
            }
        }
    }
  }

  @deprecated("When this kind of utility function is required, RichFile should provide it.", "0.6.0.9002")
  def filesRelativeTo(baseDir: File): Seq[String] = {
    val baseUri = baseDir.toURI()
    files.map { f =>
      val absFile = if (f.isAbsolute) f else new File(project.projectDirectory, f.getPath)
      baseUri.relativize(absFile.toURI).getPath
    }
  }

}


text:
class PagesController < ApplicationController
  protect_from_forgery with: :exception

  def view

  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#2C3E5E</color>
    <color name="colorPrimaryDark">#1F3151</color>
    <color name="colorAccent">#FCA311</color>
    <color name="windowBackground">#202E44</color>
    <color name="white">#FFFFFF</color>
    <color name="gray">#CCCCCC</color>
    <color name="whiteAlpha20">#33FFFFFF</color>
    <color name="whiteAlpha87">#DEFFFFFF</color>
    <color name="transparent">#00000000</color>
</resources>


text:
define(
    function (require) {
        var u = require('underscore');
        var moment = require('moment');
        var io = require('./io/serverIO');
        var util = {};

        util.genRequesters = function (url) {
            if (u.isString(url)) {
                // 只有一个URL,直接返回封装过的请求方法
                return function (data) {
                    return io.post(url, data);
                };
            }
            else if (u.isObject(url)) {
                // 是一个集合,那么每个项目都封装一下
                var map = u.clone(url);
                u.each(map, function (url, name) {
                    if (u.isString(url)) {
                        map[name] = function (data) {
                            return io.post(url, data);
                        };
                    }
                    // 如果不是string那可能封装过了
                });
                return map;
            }
        };

        util.getTimeRange = function (beginTime, endTime, options) {

            // 只有一个参数时,认为是options
            if (arguments.length === 1) {
                options = beginTime;
            }

            var defaults = {
                inputFormat: 'YYYYMMDDHHmmss',
                outputFormat: 'Date'
            };

            options = u.defaults(options || {}, defaults);

            var begin;
            var end;

            // 解析输入,没有则使用默认时间
            if (beginTime && endTime) {
                begin = moment(beginTime, options.inputFormat);
                end = moment(endTime, options.inputFormat);
            }
            else {
                var now = moment().startOf('day');

                // 默认前七天
                begin = now.clone().subtract('days', 7);
                end = now.clone().subtract('day', 1).endOf('day');
            }

            // 处理输出
            if (options.outputFormat.toLowerCase() === 'date') {
                begin = begin.toDate();
                end = end.toDate();
            }
            else {
                begin = begin.format(options.outputFormat);
                end = end.format(options.outputFormat);
            }
            return {
                begin: begin,
                end: end
            };
        };

        util.toMap = function (list, key, opt_converter) {
            var i, item, k,
                map = {},
                converter = opt_converter;

            for (i = list.length; i--;) {
                item = list[i];
                k = item[key];

                if (k != null) {
                    if (u.isFunction(converter)) {
                        var keyValue = converter(item);
                        map[keyValue.key] = keyValue.value;
                    } else if (u.isString(converter)) {
                        map[k] = item[converter];
                    } else {
                        map[k] = item;
                    }
                }
            }
            return map;
        };

        util.genListLink = function (link) {
            var defaults = {
                className: 'list-operation'
            };
            link = u.defaults(link, defaults);
            var attrs = {
                href: link.url,
                'class': link.className || 'list-operation'
            }
            if (link.target && link.target.toLowerCase() !== '_self') {
                attrs.target = link.target;
            }

            attrs = u.map(attrs, function (val, key) {
                return key + '="' + u.escape(val) + '"';
            });

            return ''
                + u.escape(link.text) + '';
        };

        util.genListCommand = function (command) {
            var defaults = {
                tagName: 'span',
                className: 'list-operation'
            };
            command = u.defaults(command, defaults);
            var attrs = {
                'class': command.className || 'list-operation',
                'data-command': command.type
            };

            if (command.index != null) {
                attrs['data-command-args'] = command.index;
            }

            attrs = u.map(attrs, function (val, key) {
                return key + '="' + u.escape(val) + '"';
            });

            var tagName = u.escape(command.tagName);
            return '<' + tagName + ' ' + attrs.join(' ') + '>'
                + u.escape(command.text) + '</' + tagName + '>';
        };

        util.genListOperations = function (operations, config) {
            config = config || {};
            var html = u.map(
                operations,
                function (operation) {
                    if (operation.url) {
                        return util.genListLink(operation);
                    }
                    else {
                        return util.genListCommand(operation);
                    }
                }
            );

            return html.join(config.separator || '|');
        };

        /**
         * 下载文件
         * @param {string} url 文件地址.
         */
        util.download = function (url) {
            var divId = '__DownloadContainer__';
            var formId = '__DownloadForm__';
            var iframeId = '__DownloadIframe__';
            var tpl = [
                '<form action="${url}" method="post" id="${formId}" ',
                    'name="${formId}" target="${iframeId}"></form>',
                '',
                ''
            ].join('');

            function getUrlWithAderId() {
                var URI = require('urijs');
                var user = require('./system/user');
                var aderId = user.ader && user.ader.id
                    || URI.parseQuery(document.location.search).aderId;
                var query = aderId ? { aderId: aderId } : {};
                return URI(url).addQuery(query).toString();
            }

            function getDownloadContainer() {
                var div = document.getElementById(divId);
                if (!div) {
                    div = document.createElement('div');
                    div.id = divId;
                    div.style.display = 'none';
                    document.body.appendChild(div);
                }
                return div;
            }

            var ctner = getDownloadContainer();
            var render = require('etpl').compile(tpl);
            ctner.innerHTML = render({
                url: getUrlWithAderId(url),
                formId: formId,
                iframeId: iframeId
            });
            document.getElementById(formId).submit();
        };

        return util;
    }
);


text:
using DotLiquid;
using System.IO;
using ZKWeb.Plugins.Common.Base.src.Components.GenericConfigs;
using ZKWeb.Plugins.Common.Base.src.Domain.Services;
using ZKWebStandard.Utils;

namespace ZKWeb.Plugins.Common.Base.src.UIComponents.TemplateTags {
	/// <summary>
	/// 描画页面关键词
	/// 如果有指定关键词时使用指定的关键词,否则使用网站设置中的关键词
	/// </summary>
	/// <example>
	/// {% render_meta_keywords %}
	/// </example>
	public class RenderMetaKeywords : Tag {
		/// <summary>
		/// 变量名
		/// </summary>
		public const string Key = "__meta_keywords";

		/// <summary>
		/// 描画页面关键词
		/// </summary>
		public override void Render(Context context, TextWriter result) {
			var keywords = (context[Key] ?? "").ToString();
			if (string.IsNullOrEmpty(keywords)) {
				var configManager = Application.Ioc.Resolve<GenericConfigManager>();
				var settings = configManager.GetData<WebsiteSettings>();
				keywords = settings.PageKeywords;
			}
			result.Write(string.Format("<meta name='keywords' content='{0}' />",
				HttpUtils.HtmlEncode(keywords)));
		}
	}
}


text:
{% extends "core/core_base.html" %}

{% block title %} Token Successfully Revoked {% endblock %}
{% block header %} Token Successfully Revoked {% endblock %}

{% block content %}
    The token has been revoked.
{% endblock %}


text:
import { assert } from 'chai';
import * as R from 'ramda';

import * as RA from '../src';
import args from './shared/arguments';
import Symbol from './shared/Symbol';

describe('isNotObj', function () {
  context('given non object value', function () {
    specify('should return true', function () {
      assert.isTrue(RA.isNotObj(null));
      assert.isTrue(RA.isNotObj(undefined));
    });
  });

  context('given object value', function () {
    specify('should return false', function () {
      assert.isFalse(RA.isNotObj({}));
      assert.isFalse(RA.isNotObj(Object(false)));
      assert.isFalse(RA.isNotObj(Object.create(null)));
      assert.isFalse(RA.isNotObj(args));
      assert.isFalse(RA.isNotObj([1, 2, 3]));
      assert.isFalse(RA.isNotObj(Object(false)));
      assert.isFalse(RA.isNotObj(new Date()));
      assert.isFalse(RA.isNotObj(new Error()));
      assert.isFalse(RA.isNotObj(RA));
      assert.isFalse(RA.isNotObj(Array.prototype.slice));
      assert.isFalse(RA.isNotObj({ a: 1 }));
      assert.isFalse(RA.isNotObj(Object(0)));
      assert.isFalse(RA.isNotObj(/x/));
      assert.isFalse(RA.isNotObj(Object('a')));

      if (Symbol !== 'undefined') {
        assert.isFalse(RA.isNotObj(Symbol));
      }
    });
  });

  it('should support placeholder to specify "gaps"', function () {
    const isNotObj = RA.isNotObj(R.__);

    assert.isTrue(isNotObj(null));
  });
});

describe('isNotObject', function () {
  it('should be an alias for isNotObject', function () {
    assert.strictEqual(RA.isNotObj, RA.isNotObject);
  });
});


text:
package org.apache.sqoop.json;

import org.json.simple.JSONArray;
import org.json.simple.JSONObject;

public class VersionBean implements JsonBean {

  public static final String VERSION = "version";
  public static final String REVISION = "revision";
  public static final String DATE = "date";
  public static final String USER = "user";
  public static final String URL = "url";
  public static final String PROTOCOLS = "protocols";

  private String version;
  private String revision;
  private String date;
  private String user;
  private String url;
  private String[] protocols;

  // for "extract"
  public VersionBean(String version, String revision, String date,
      String user, String url, String[] protocols) {
    this.version = version;
    this.revision = revision;
    this.date = date;
    this.user = user;
    this.url = url;
    this.protocols = new String[protocols.length];
    System.arraycopy(protocols, 0, this.protocols, 0, protocols.length);
  }

  // for "restore"
  public VersionBean() {
  }

  @SuppressWarnings("unchecked")
  @Override
  public JSONObject extract() {
    JSONObject result = new JSONObject();
    result.put(VERSION, version);
    result.put(REVISION, revision);
    result.put(DATE, date);
    result.put(USER, user);
    result.put(URL, url);
    JSONArray protocolsArray = new JSONArray();
    for (String protocol : protocols) {
      protocolsArray.add(protocol);
    }
    result.put(PROTOCOLS, protocolsArray);
    return result;
  }

  @Override
  public void restore(JSONObject jsonObject) {
    this.version = (String)jsonObject.get(VERSION);
    this.revision = (String)jsonObject.get(REVISION);
    this.date = (String)jsonObject.get(DATE);
    this.user = (String)jsonObject.get(USER);
    this.url = (String)jsonObject.get(URL);
    JSONArray protocolsArray = (JSONArray) jsonObject.get(PROTOCOLS);
    int size = protocolsArray.size();
    this.protocols = new String[size];
    for (int i = 0; i<size; i++) {
      protocols[i] = (String) protocolsArray.get(i);
    }
  }

  public String getVersion() {
    return this.version;
  }

  public String getRevision() {
    return this.revision;
  }

  public String getDate() {
    return this.date;
  }

  public String getUser() {
    return this.user;
  }

  public String getUrl() {
    return this.url;
  }

  public String[] getProtocols() {
    return this.protocols;
  }

}


text:
'use strict';

Object.defineProperty(exports, '__esModule', {
  value: true
});
exports.default = normalize;

var _crypto;

function _load_crypto() {
  return (_crypto = _interopRequireDefault(require('crypto')));
}

var _glob;

function _load_glob() {
  return (_glob = _interopRequireDefault(require('glob')));
}

var _path;

function _load_path() {
  return (_path = _interopRequireDefault(require('path')));
}

var _jestValidate;

function _load_jestValidate() {
  return (_jestValidate = require('jest-validate'));
}

var _validatePattern;

function _load_validatePattern() {
  return (_validatePattern = _interopRequireDefault(
    require('./validatePattern')
  ));
}

var _jestUtil;

function _load_jestUtil() {
  return (_jestUtil = require('jest-util'));
}

var _chalk;

function _load_chalk() {
  return (_chalk = _interopRequireDefault(require('chalk')));
}

var _getMaxWorkers;

function _load_getMaxWorkers() {
  return (_getMaxWorkers = _interopRequireDefault(require('./getMaxWorkers')));
}

var _micromatch;

function _load_micromatch() {
  return (_micromatch = _interopRequireDefault(require('micromatch')));
}

var _jestResolve;

function _load_jestResolve() {
  return (_jestResolve = _interopRequireDefault(require('jest-resolve')));
}

var _jestRegexUtil;

function _load_jestRegexUtil() {
  return (_jestRegexUtil = require('jest-regex-util'));
}

var _utils;

function _load_utils() {
  return (_utils = require('./utils'));
}

var _constants;

function _load_constants() {
  return (_constants = require('./constants'));
}

var _ReporterValidationErrors;

function _load_ReporterValidationErrors() {
  return (_ReporterValidationErrors = require('./ReporterValidationErrors'));
}

var _Defaults;

function _load_Defaults() {
  return (_Defaults = _interopRequireDefault(require('./Defaults')));
}

var _Deprecated;

function _load_Deprecated() {
  return (_Deprecated = _interopRequireDefault(require('./Deprecated')));
}

var _setFromArgv;

function _load_setFromArgv() {
  return (_setFromArgv = _interopRequireDefault(require('./setFromArgv')));
}

var _ValidConfig;

function _load_ValidConfig() {
  return (_ValidConfig = _interopRequireDefault(require('./ValidConfig')));
}

function _interopRequireDefault(obj) {
  return obj && obj.__esModule ? obj : {default: obj};
}

function _toConsumableArray(arr) {
  if (Array.isArray(arr)) {
    for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++)
      arr2[i] = arr[i];
    return arr2;
  } else {
    return Array.from(arr);
  }
}

const ERROR = `${(_utils || _load_utils()).BULLET}Validation Error`;
const PRESET_EXTENSIONS = ['.json', '.js'];
const PRESET_NAME = 'jest-preset';

const createConfigError = message =>
  new (_jestValidate || _load_jestValidate()).ValidationError(
    ERROR,
    message,
    (_utils || _load_utils()).DOCUMENTATION_NOTE
  );

const mergeOptionWithPreset = (options, preset, optionName) => {
  if (options[optionName] && preset[optionName]) {
    options[optionName] = Object.assign(
      {},
      options[optionName],
      preset[optionName],
      options[optionName]
    );
  }
};

const setupPreset = (options, optionsPreset) => {
  let preset;
  const presetPath = (0, (_utils || _load_utils()).replaceRootDirInPath)(
    options.rootDir,
    optionsPreset
  );
  const presetModule = (
    _jestResolve || _load_jestResolve()
  ).default.findNodeModule(
    presetPath.startsWith('.')
      ? presetPath
      : (_path || _load_path()).default.join(presetPath, PRESET_NAME),
    {
      basedir: options.rootDir,
      extensions: PRESET_EXTENSIONS
    }
  );

  try {
    // Force re-evaluation to support multiple projects
    try {
      if (presetModule) {
        delete require.cache[require.resolve(presetModule)];
      }
    } catch (e) {}

    // $FlowFixMe
    preset = require(presetModule);
  } catch (error) {
    if (error instanceof SyntaxError) {
      throw createConfigError(
        `  Preset ${(_chalk || _load_chalk()).default.bold(
          presetPath
        )} is invalid:\n  ${error.message}`
      );
    }
    throw createConfigError(
      `  Preset ${(_chalk || _load_chalk()).default.bold(
        presetPath
      )} not found.`
    );
  }

  if (options.setupFiles) {
    options.setupFiles = (preset.setupFiles || []).concat(options.setupFiles);
  }
  if (options.modulePathIgnorePatterns && preset.modulePathIgnorePatterns) {
    options.modulePathIgnorePatterns = preset.modulePathIgnorePatterns.concat(
      options.modulePathIgnorePatterns
    );
  }
  mergeOptionWithPreset(options, preset, 'moduleNameMapper');
  mergeOptionWithPreset(options, preset, 'transform');

  return Object.assign({}, preset, options);
};

const setupBabelJest = options => {
  const transform = options.transform;
  let babelJest;
  if (transform) {
    const customJSPattern = Object.keys(transform).find(pattern => {
      const regex = new RegExp(pattern);
      return regex.test('a.js') || regex.test('a.jsx');
    });

    if (customJSPattern) {
      const customJSTransformer = transform[customJSPattern];

      if (customJSTransformer === 'babel-jest') {
        babelJest = require.resolve('babel-jest');
        transform[customJSPattern] = babelJest;
      } else if (customJSTransformer.includes('babel-jest')) {
        babelJest = customJSTransformer;
      }
    }
  } else {
    babelJest = require.resolve('babel-jest');
    options.transform = {
      [(_constants || _load_constants()).DEFAULT_JS_PATTERN]: babelJest
    };
  }

  return babelJest;
};

const normalizeCollectCoverageOnlyFrom = (options, key) => {
  const collectCoverageOnlyFrom = Array.isArray(options[key])
    ? options[key] // passed from argv
    : Object.keys(options[key]); // passed from options
  return collectCoverageOnlyFrom.reduce((map, filePath) => {
    filePath = (_path || _load_path()).default.resolve(
      options.rootDir,
      (0, (_utils || _load_utils()).replaceRootDirInPath)(
        options.rootDir,
        filePath
      )
    );
    map[filePath] = true;
    return map;
  }, Object.create(null));
};

const normalizeCollectCoverageFrom = (options, key) => {
  let value;
  if (!options[key]) {
    value = [];
  }

  if (!Array.isArray(options[key])) {
    try {
      value = JSON.parse(options[key]);
    } catch (e) {}

    Array.isArray(value) || (value = [options[key]]);
  } else {
    value = options[key];
  }

  if (value) {
    value = value.map(filePath =>
      filePath.replace(/^(!?)(<rootDir>\/)(.*)/, '$1$3')
    );
  }

  return value;
};

const normalizeUnmockedModulePathPatterns = (
  options,
  key
  // _replaceRootDirTags is specifically well-suited for substituting
  // <rootDir> in paths (it deals with properly interpreting relative path
  // separators, etc).
  //
  // For patterns, direct global substitution is far more ideal, so we
  // special case substitutions for patterns here.
) =>
  options[key].map(pattern =>
    (0, (_jestRegexUtil || _load_jestRegexUtil()).replacePathSepForRegex)(
      pattern.replace(/<rootDir>/g, options.rootDir)
    )
  );

const normalizePreprocessor = options => {
  if (options.scriptPreprocessor && options.transform) {
    throw createConfigError(`  Options: ${(
      _chalk || _load_chalk()
    ).default.bold('scriptPreprocessor')} and ${(
      _chalk || _load_chalk()
    ).default.bold('transform')} cannot be used together.
  Please change your configuration to only use ${(
    _chalk || _load_chalk()
  ).default.bold('transform')}.`);
  }

  if (options.preprocessorIgnorePatterns && options.transformIgnorePatterns) {
    throw createConfigError(`  Options ${(_chalk || _load_chalk()).default.bold(
      'preprocessorIgnorePatterns'
    )} and ${(_chalk || _load_chalk()).default.bold(
      'transformIgnorePatterns'
    )} cannot be used together.
  Please change your configuration to only use ${(
    _chalk || _load_chalk()
  ).default.bold('transformIgnorePatterns')}.`);
  }

  if (options.scriptPreprocessor) {
    options.transform = {
      '.*': options.scriptPreprocessor
    };
  }

  if (options.preprocessorIgnorePatterns) {
    options.transformIgnorePatterns = options.preprocessorIgnorePatterns;
  }

  delete options.scriptPreprocessor;
  delete options.preprocessorIgnorePatterns;
  return options;
};

const normalizeMissingOptions = options => {
  if (!options.name) {
    options.name = (_crypto || _load_crypto()).default
      .createHash('md5')
      .update(options.rootDir)
      .digest('hex');
  }

  if (!options.setupFiles) {
    options.setupFiles = [];
  }

  return options;
};

const normalizeRootDir = options => {
  // Assert that there *is* a rootDir
  if (!options.hasOwnProperty('rootDir')) {
    throw createConfigError(
      `  Configuration option ${(_chalk || _load_chalk()).default.bold(
        'rootDir'
      )} must be specified.`
    );
  }
  options.rootDir = (_path || _load_path()).default.normalize(options.rootDir);
  return options;
};

const normalizeReporters = (options, basedir) => {
  const reporters = options.reporters;
  if (!reporters || !Array.isArray(reporters)) {
    return options;
  }

  (0,
  (_ReporterValidationErrors || _load_ReporterValidationErrors())
    .validateReporters)(reporters);
  options.reporters = reporters.map(reporterConfig => {
    const normalizedReporterConfig =
      typeof reporterConfig === 'string' // if reporter config is a string, we wrap it in an array
        ? // and pass an empty object for options argument, to normalize
          // the shape.
          [reporterConfig, {}]
        : reporterConfig;

    const reporterPath = (0, (_utils || _load_utils()).replaceRootDirInPath)(
      options.rootDir,
      normalizedReporterConfig[0]
    );

    if (
      reporterPath !== (_constants || _load_constants()).DEFAULT_REPORTER_LABEL
    ) {
      const reporter = (
        _jestResolve || _load_jestResolve()
      ).default.findNodeModule(reporterPath, {
        basedir: options.rootDir
      });
      if (!reporter) {
        throw new Error(
          `Could not resolve a module for a custom reporter.\n` +
            `  Module name: ${reporterPath}`
        );
      }
      normalizedReporterConfig[0] = reporter;
    }
    return normalizedReporterConfig;
  });

  return options;
};

const buildTestPathPattern = argv => {
  const patterns = [];

  if (argv._) {
    patterns.push.apply(patterns, _toConsumableArray(argv._));
  }
  if (argv.testPathPattern) {
    patterns.push.apply(patterns, _toConsumableArray(argv.testPathPattern));
  }

  const replacePosixSep = pattern => {
    if ((_path || _load_path()).default.sep === '/') {
      return pattern;
    }
    return pattern.replace(/\//g, '\\\\');
  };

  const testPathPattern = patterns.map(replacePosixSep).join('|');
  if (
    (0, (_validatePattern || _load_validatePattern()).default)(testPathPattern)
  ) {
    return testPathPattern;
  } else {
    showTestPathPatternError(testPathPattern);
    return '';
  }
};

const showTestPathPatternError = testPathPattern => {
  (0, (_jestUtil || _load_jestUtil()).clearLine)(process.stdout);

  console.log(
    (_chalk || _load_chalk()).default.red(
      `  Invalid testPattern ${testPathPattern} supplied. ` +
        `Running all tests instead.`
    )
  );
};

function normalize(options, argv) {
  var _validate = (0, (_jestValidate || _load_jestValidate()).validate)(
    options,
    {
      comment: (_utils || _load_utils()).DOCUMENTATION_NOTE,
      deprecatedConfig: (_Deprecated || _load_Deprecated()).default,
      exampleConfig: (_ValidConfig || _load_ValidConfig()).default,
      recursiveBlacklist: [
        'collectCoverageOnlyFrom',
        // 'coverageThreshold' allows to use 'global' and glob strings on the same
        // level, there's currently no way we can deal with such config
        'coverageThreshold',
        'globals',
        'moduleNameMapper',
        'transform'
      ]
    }
  );

  const hasDeprecationWarnings = _validate.hasDeprecationWarnings;

  options = normalizePreprocessor(
    normalizeReporters(
      normalizeMissingOptions(
        normalizeRootDir(
          (0, (_setFromArgv || _load_setFromArgv()).default)(options, argv)
        )
      )
    )
  );

  if (options.preset) {
    options = setupPreset(options, options.preset);
  }

  if (options.testEnvironment) {
    options.testEnvironment = (0, (_utils || _load_utils()).getTestEnvironment)(
      options
    );
  }

  if (!options.roots && options.testPathDirs) {
    options.roots = options.testPathDirs;
    delete options.testPathDirs;
  }
  if (!options.roots) {
    options.roots = [options.rootDir];
  }

  if (!options.testRunner || options.testRunner === 'jasmine2') {
    options.testRunner = require.resolve('jest-jasmine2');
  }

  if (!options.coverageDirectory) {
    options.coverageDirectory = (_path || _load_path()).default.resolve(
      options.rootDir,
      'coverage'
    );
  }

  const babelJest = setupBabelJest(options);
  const newOptions = Object.assign({}, (_Defaults || _load_Defaults()).default);
  // Cast back to exact type
  options = options;

  if (options.resolver) {
    newOptions.resolver = (0, (_utils || _load_utils()).resolve)(null, {
      filePath: options.resolver,
      key: 'resolver',
      rootDir: options.rootDir
    });
  }

  Object.keys(options).reduce((newOptions, key) => {
    // The resolver has been resolved separately; skip it
    if (key === 'resolver') {
      return newOptions;
    }
    let value;
    switch (key) {
      case 'collectCoverageOnlyFrom':
        value = normalizeCollectCoverageOnlyFrom(options, key);
        break;
      case 'setupFiles':
      case 'snapshotSerializers':
        value =
          options[key] &&
          options[key].map(filePath =>
            (0, (_utils || _load_utils()).resolve)(newOptions.resolver, {
              filePath: filePath,
              key: key,
              rootDir: options.rootDir
            })
          );
        break;
      case 'modulePaths':
      case 'roots':
        value =
          options[key] &&
          options[key].map(filePath =>
            (_path || _load_path()).default.resolve(
              options.rootDir,
              (0, (_utils || _load_utils()).replaceRootDirInPath)(
                options.rootDir,
                filePath
              )
            )
          );
        break;
      case 'collectCoverageFrom':
        value = normalizeCollectCoverageFrom(options, key);
        break;
      case 'cacheDirectory':
      case 'coverageDirectory':
        value =
          options[key] &&
          (_path || _load_path()).default.resolve(
            options.rootDir,
            (0, (_utils || _load_utils()).replaceRootDirInPath)(
              options.rootDir,
              options[key]
            )
          );
        break;
      case 'globalSetup':
      case 'globalTeardown':
      case 'moduleLoader':
      case 'runner':
      case 'setupTestFrameworkScriptFile':
      case 'testResultsProcessor':
      case 'testRunner':
      case 'filter':
        value =
          options[key] &&
          (0, (_utils || _load_utils()).resolve)(newOptions.resolver, {
            filePath: options[key],
            key: key,
            rootDir: options.rootDir
          });
        break;
      case 'prettierPath':
        // We only want this to throw if "prettierPath" is explicitly passed
        // from config or CLI, and the requested path isn't found. Otherwise we
        // set it to null and throw an error lazily when it is used.
        value =
          options[key] &&
          (0, (_utils || _load_utils()).resolve)(newOptions.resolver, {
            filePath: options[key],
            key: key,
            optional:
              options[key] === (_Defaults || _load_Defaults()).default[key],
            rootDir: options.rootDir
          });
        break;
      case 'moduleNameMapper':
        const moduleNameMapper = options[key];
        value =
          moduleNameMapper &&
          Object.keys(moduleNameMapper).map(regex => {
            const item = moduleNameMapper && moduleNameMapper[regex];
            return (
              item && [
                regex,
                (0, (_utils || _load_utils())._replaceRootDirTags)(
                  options.rootDir,
                  item
                )
              ]
            );
          });
        break;
      case 'transform':
        const transform = options[key];
        value =
          transform &&
          Object.keys(transform).map(regex => [
            regex,
            (0, (_utils || _load_utils()).resolve)(newOptions.resolver, {
              filePath: transform[regex],
              key: key,
              rootDir: options.rootDir
            })
          ]);
        break;
      case 'coveragePathIgnorePatterns':
      case 'modulePathIgnorePatterns':
      case 'testPathIgnorePatterns':
      case 'transformIgnorePatterns':
      case 'watchPathIgnorePatterns':
      case 'unmockedModulePathPatterns':
        value = normalizeUnmockedModulePathPatterns(options, key);
        break;
      case 'haste':
        value = Object.assign({}, options[key]);
        if (value.hasteImplModulePath != null) {
          value.hasteImplModulePath = (0, (_utils || _load_utils()).resolve)(
            newOptions.resolver,
            {
              filePath: (0, (_utils || _load_utils()).replaceRootDirInPath)(
                options.rootDir,
                value.hasteImplModulePath
              ),
              key: 'haste.hasteImplModulePath',
              rootDir: options.rootDir
            }
          );
        }
        break;
      case 'projects':
        value = (options[key] || [])
          .map(
            project =>
              typeof project === 'string'
                ? (0, (_utils || _load_utils())._replaceRootDirTags)(
                    options.rootDir,
                    project
                  )
                : project
          )
          .reduce((projects, project) => {
            // Project can be specified as globs. If a glob matches any files,
            // We expand it to these paths. If not, we keep the original path
            // for the future resolution.
            const globMatches =
              typeof project === 'string'
                ? (_glob || _load_glob()).default.sync(project)
                : [];
            return projects.concat(globMatches.length ? globMatches : project);
          }, []);
        break;
      case 'moduleDirectories':
      case 'testMatch':
        value = (0, (_utils || _load_utils())._replaceRootDirTags)(
          (0, (_utils || _load_utils()).escapeGlobCharacters)(options.rootDir),
          options[key]
        );
        break;
      case 'testRegex':
        value =
          options[key] &&
          (0, (_jestRegexUtil || _load_jestRegexUtil()).replacePathSepForRegex)(
            options[key]
          );
        break;
      case 'automock':
      case 'bail':
      case 'browser':
      case 'cache':
      case 'changedSince':
      case 'changedFilesWithAncestor':
      case 'clearMocks':
      case 'collectCoverage':
      case 'coverageReporters':
      case 'coverageThreshold':
      case 'detectLeaks':
      case 'detectOpenHandles':
      case 'displayName':
      case 'errorOnDeprecated':
      case 'expand':
      case 'globals':
      case 'findRelatedTests':
      case 'forceCoverageMatch':
      case 'forceExit':
      case 'lastCommit':
      case 'listTests':
      case 'logHeapUsage':
      case 'mapCoverage':
      case 'moduleFileExtensions':
      case 'name':
      case 'noStackTrace':
      case 'notify':
      case 'notifyMode':
      case 'onlyChanged':
      case 'outputFile':
      case 'passWithNoTests':
      case 'replname':
      case 'reporters':
      case 'resetMocks':
      case 'resetModules':
      case 'restoreMocks':
      case 'rootDir':
      case 'runTestsByPath':
      case 'silent':
      case 'skipFilter':
      case 'skipNodeResolution':
      case 'testEnvironment':
      case 'testEnvironmentOptions':
      case 'testFailureExitCode':
      case 'testLocationInResults':
      case 'testNamePattern':
      case 'testURL':
      case 'timers':
      case 'useStderr':
      case 'verbose':
      case 'watch':
      case 'watchAll':
      case 'watchman':
        value = options[key];
        break;
      case 'watchPlugins':
        value = (options[key] || []).map(watchPlugin => {
          if (typeof watchPlugin === 'string') {
            return {
              config: {},
              path: (0, (_utils || _load_utils()).resolve)(
                newOptions.resolver,
                {
                  filePath: watchPlugin,
                  key: key,
                  rootDir: options.rootDir
                }
              )
            };
          } else {
            return {
              config: watchPlugin[1] || {},
              path: (0, (_utils || _load_utils()).resolve)(
                newOptions.resolver,
                {
                  filePath: watchPlugin[0],
                  key: key,
                  rootDir: options.rootDir
                }
              )
            };
          }
        });
        break;
    }
    newOptions[key] = value;
    return newOptions;
  }, newOptions);

  newOptions.nonFlagArgs = argv._;
  newOptions.testPathPattern = buildTestPathPattern(argv);
  newOptions.json = argv.json;

  newOptions.testFailureExitCode = parseInt(newOptions.testFailureExitCode, 10);

  for (const key of [
    'lastCommit',
    'changedFilesWithAncestor',
    'changedSince'
  ]) {
    if (newOptions[key]) {
      newOptions.onlyChanged = true;
    }
  }

  if (argv.all) {
    newOptions.onlyChanged = false;
  } else if (newOptions.testPathPattern) {
    // When passing a test path pattern we don't want to only monitor changed
    // files unless `--watch` is also passed.
    newOptions.onlyChanged = newOptions.watch;
  }

  newOptions.updateSnapshot =
    argv.ci && !argv.updateSnapshot
      ? 'none'
      : argv.updateSnapshot
        ? 'all'
        : 'new';

  newOptions.maxWorkers = (0,
  (_getMaxWorkers || _load_getMaxWorkers()).default)(argv);

  if (babelJest) {
    const regeneratorRuntimePath = (
      _jestResolve || _load_jestResolve()
    ).default.findNodeModule('regenerator-runtime/runtime', {
      basedir: options.rootDir,
      resolver: newOptions.resolver
    });

    if (regeneratorRuntimePath) {
      newOptions.setupFiles.unshift(regeneratorRuntimePath);
    }
  }

  if (options.testRegex && options.testMatch) {
    throw createConfigError(
      `  Configuration options ${(_chalk || _load_chalk()).default.bold(
        'testMatch'
      )} and` +
        ` ${(_chalk || _load_chalk()).default.bold(
          'testRegex'
        )} cannot be used together.`
    );
  }

  if (options.testRegex && !options.testMatch) {
    // Prevent the default testMatch conflicting with any explicitly
    // configured `testRegex` value
    newOptions.testMatch = [];
  }

  // If argv.json is set, coverageReporters shouldn't print a text report.
  if (argv.json) {
    newOptions.coverageReporters = (newOptions.coverageReporters || []).filter(
      reporter => reporter !== 'text'
    );
  }

  // If collectCoverage is enabled while using --findRelatedTests we need to
  // avoid having false negatives in the generated coverage report.
  // The following: `--findRelatedTests '/rootDir/file1.js' --coverage`
  // Is transformed to: `--findRelatedTests '/rootDir/file1.js' --coverage --collectCoverageFrom 'file1.js'`
  // where arguments to `--collectCoverageFrom` should be globs (or relative
  // paths to the rootDir)
  if (newOptions.collectCoverage && argv.findRelatedTests) {
    let collectCoverageFrom = argv._.map(filename => {
      filename = (0, (_utils || _load_utils()).replaceRootDirInPath)(
        options.rootDir,
        filename
      );
      return (_path || _load_path()).default.isAbsolute(filename)
        ? (_path || _load_path()).default.relative(options.rootDir, filename)
        : filename;
    });

    // Don't override existing collectCoverageFrom options
    if (newOptions.collectCoverageFrom) {
      collectCoverageFrom = collectCoverageFrom.reduce((patterns, filename) => {
        if (
          !(0, (_micromatch || _load_micromatch()).default)(
            [
              (_path || _load_path()).default.relative(
                options.rootDir,
                filename
              )
            ],
            newOptions.collectCoverageFrom
          ).length
        ) {
          return patterns;
        }
        return [].concat(_toConsumableArray(patterns), [filename]);
      }, newOptions.collectCoverageFrom);
    }

    newOptions.collectCoverageFrom = collectCoverageFrom;
  }

  return {
    hasDeprecationWarnings: hasDeprecationWarnings,
    options: newOptions
  };
}


text:
<?php
namespace Pure\Bases;

/**
 * Classe básica de Exception do Framework
 *
 * Serve como base para outras exceptions lançadas ao longo
 * da execução do programa.
 *
 * @abstract
 * @version 1.0
 * @author Marcelo Gomes Martins
 */
abstract class Exception extends \Exception
{
	/**
	 * Construtor da exception.
	 * Chama método pai.
	 * @param string $message
	 * @param int $code
	 * @param \Throwable $previous
	 */
	public function __construct($message = '', $code = 0, \Throwable $previous = NULL)
	{
		parent::__construct($message, $code, $previous);
	}

	/**
	 * Representação textual da exception lançada.
	 * @return string mensagem
	 */
	public function __toString()
	{
		return __CLASS__ . ': ' . $this->message . ' ';
	}

}


text:
local Config, GPU, yGPU, GPUVars, DevKit = ...
--luacheck: pop

local lg = love.graphics

local SharedVars = GPUVars.Shared
local PaletteVars = GPUVars.Palette
local ImageDataVars = GPUVars.ImageData

--==Varss Constants==--
local _ImageTransparent = PaletteVars.ImageTransparent
local _ColorSet = PaletteVars.ColorSet
local _GetColorID = PaletteVars.GetColorID
local colorTo1 = SharedVars.colorTo1
local colorTo255 = SharedVars.colorTo255

--==Localized Lua Library==--
local mathFloor = math.floor
local strFormat = string.format

--==Variables==--
local weakMetatable = { __mode = "k" } --Weak keys
local weakImageData = setmetatable({}, weakMetatable)
ImageDataVars.weakImageData = weakImageData

--==Helper Functions==--

--Convert from LIKO12 palette to real colors.
local function _ExportImage(_,_, r)
  r = mathFloor(r*255)
  if _ImageTransparent[r+1] == 0 then return 0,0,0,0 end
  return colorTo1(_ColorSet[r])
end

--Convert from LIKO-12 palette to real colors ignoring transparent colors.
local function _ExportImageOpaque(_,_, r)
  return colorTo1(_ColorSet[mathFloor(r*255)])
end

--Convert from real colors to LIKO-12 palette
local function _ImportImage(_,_, r,g,b,a)
  return _GetColorID(colorTo255(r,g,b,a))/255,0,0,1
end

--==GPU Imagedata API==--

--Shared values between imagedata objects
local sharedImageDataObject = {}
local imagedataMetadata = { __index = sharedImageDataObject, __metatable = false }
do
  function sharedImageDataObject:size()
    local imageData = weakImageData[self]; if not imageData then return error("Use : instead of . when calling imagedata object methods!") end
    return imageData:getDimensions() end
  function sharedImageDataObject:getPixel(x,y)
    local imageData = weakImageData[self]; if not imageData then return error("Use : instead of . when calling imagedata object methods!") end
    if not x then return error("Must provide X") end
    if not y then return error("Must provide Y") end
    x,y = mathFloor(x), mathFloor(y)
    if x < 0 or x > self:width()-1 or y < 0 or y > self:height()-1 then
      return false, "Pixel position out from the image region"
    end
    local r = imageData:getPixel(x,y)
    return mathFloor(r*255)
  end
  function sharedImageDataObject:setPixel(x,y,c)
    local imageData = weakImageData[self]; if not imageData then return error("Use : instead of . when calling imagedata object methods!") end
    if type(c) ~= "number" then return error("Color must be a number, provided "..type(c)) end
    if not x then return error("Must provide X") end
    if not y then return error("Must provide Y") end
    x,y = mathFloor(x), mathFloor(y)
    if x < 0 or x > self:width()-1 or y < 0 or y > self:height()-1 then
      return false, "Pixel position out from the image region"
    end
    c = mathFloor(c) if c < 0 or c > 15 then return error("Color out of range ("..c..") expected [0,15]") end
    imageData:setPixel(x,y,c/255,0,0,1)
    return self
  end
  function sharedImageDataObject:map(mf)
    local imageData = weakImageData[self]; if not imageData then return error("Use : instead of . when calling imagedata object methods!") end
    imageData:mapPixel(
    function(x,y,r,g,b,a)
      local c = mf(x,y,mathFloor(r*255))
      if c and type(c) ~= "number" then return error("Color must be a number, provided "..type(c)) elseif c then c = mathFloor(c) end
      if c and (c < 0 or c > 15) then return error("Color out of range ("..c..") expected [0,15]") end
      if c then return c/255,0,0,1 else return r,g,b,a end
    end)
    return self
  end
  function sharedImageDataObject:height()
    local imageData = weakImageData[self]; if not imageData then return error("Use : instead of . when calling imagedata object methods!") end
    return imageData:getHeight() end
  function sharedImageDataObject:width()
    local imageData = weakImageData[self]; if not imageData then return error("Use : instead of . when calling imagedata object methods!") end
    return imageData:getWidth() end

  function sharedImageDataObject:paste(imgData,dx,dy,sx,sy,sw,sh)
    local imageData = weakImageData[self]; if not imageData then return error("Use : instead of . when calling imagedata object methods!") end
    if type(imgData) ~= "table" then return error("ImageData must be an imagedata, got '"..type(imageData).."'") end
    local PasteImage = weakImageData[imgData]; if not PasteImage then return error("Invalid ImageData Object!") end
    imageData:paste(PasteImage,dx or 0,dy or 0,sx or 0,sy or 0,sw or PasteImage:getWidth(), sh or PasteImage:getHeight())
    return self
  end

  function sharedImageDataObject:quad(x,y,qw,qh)
    local imageData = weakImageData[self]; if not imageData then return error("Use : instead of . when calling imagedata object methods!") end
    return lg.newQuad(x,y,qw or self:width(),qh or self:height(),self:width(),self:height()) end
  function sharedImageDataObject:image()
    local imageData = weakImageData[self]; if not imageData then return error("Use : instead of . when calling imagedata object methods!") end
    return GPU.image(imageData) end

  function sharedImageDataObject:export()
    local imageData = weakImageData[self]; if not imageData then return error("Use : instead of . when calling imagedata object methods!") end
    local expData = love.image.newImageData(self:width(),self:height())
    expData:mapPixel(function(x,y) return _ExportImage(x,y, imageData:getPixel(x,y)) end)
    return expData:encode("png"):getString()
  end

  function sharedImageDataObject:exportOpaque()
    local imageData = weakImageData[self]; if not imageData then return error("Use : instead of . when calling imagedata object methods!") end
    local expData = love.image.newImageData(self:width(),self:height())
    expData:mapPixel(function(x,y) return _ExportImageOpaque(x,y, imageData:getPixel(x,y)) end)
    return expData:encode("png"):getString()
  end

  function sharedImageDataObject:enlarge(scale)
    local imageData = weakImageData[self]; if not imageData then return error("Use : instead of . when calling imagedata object methods!") end
    scale = mathFloor(scale or 1)
    if scale <= 0 then scale = 1 end --Protection
    if scale == 1 then return self end
    local newData = GPU.imagedata(self:width()*scale,self:height()*scale)
    self:map(function(x,y,c)
      for iy=0, scale-1 do for ix=0, scale-1 do
        newData:setPixel(x*scale + ix,y*scale + iy,c)
      end end
    end)
    return newData
  end

  function sharedImageDataObject:encode() --Export to .lk12 format
    local imageData = weakImageData[self]; if not imageData then return error("Use : instead of . when calling imagedata object methods!") end
    local data = {strFormat("LK12;GPUIMG;%dx%d;",self:width(),self:height())}
    local datalen = 2
    self:map(function(x,_,c)
      if x == 0 then
        data[datalen] = "\n"
        datalen = datalen + 1
      end
      data[datalen] = strFormat("%X",c)
      datalen = datalen + 1
    end)
    return table.concat(data)
  end

  function sharedImageDataObject:type() return "GPU.imageData" end
  function sharedImageDataObject:typeOf(t) if t == "GPU" or t == "imageData" or t == "GPU.imageData" or t == "LK12" then return true end end
end

function GPU.imagedata(w,h)
  local imageData
  if h and tonumber(w) then
    imageData = love.image.newImageData(w,h)
    imageData:mapPixel(function() return 0,0,0,1 end)
  elseif type(w) == "string" then --Load specialized liko12 image format
    if w:sub(0,12) == "LK12;GPUIMG;" then
      w = w:gsub("\n","")
      --luacheck: push ignore 422
      local w,h,data = string.match(w,"LK12;GPUIMG;(%d+)x(%d+);(.+)")
      --luacheck: pop
      imageData = love.image.newImageData(w,h)
      local nextColor = string.gmatch(data,"%x")
      imageData:mapPixel(function()
        return tonumber(nextColor() or "0",16)/255,0,0,1
      end)
    else
      local ok1, fdata = pcall(love.filesystem.newFileData,w,"image.png")
      if not ok1 then return error("Invalid image data") end
      local ok2, img = pcall(love.image.newImageData,fdata)
      if not ok2 then return error("Invalid image data") end
      local ok3, err = pcall(img.mapPixel,img,_ImportImage)
      if not ok3 then print("Invalid image data",err) return error("Invalid image data") end
      imageData = img
    end
  elseif type(w) == "userdata" and w.typeOf and w:typeOf("ImageData") then
    imageData = w
  else
    return error("Invalid arguments")
  end

  local id = setmetatable({}, imagedataMetadata)
  weakImageData[id] = imageData
  return id
end


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package medrun;

import org.newdawn.slick.SlickException;
import org.newdawn.slick.tiled.TiledMap;

/**
 * A Block object is usually a building that the player can traverce trough out
 * the game. It has a multitude of parameters that decides how it looks and
 * where it should be rendered.
 *
 * @author Tom Axblad
 */
public class Block implements Renderable {

    public static final int X = 0;
    public static final int Y = 1;

    public static final int TILEWIDTH = 32;
    public static final int TILEHEIGHT = 32;

    public static final int STARTBLOCK = 0;
    public static final int REGULARCUBE = 1;
    public static final int SLIDEBLOCK = 2;
    public static final int LONGBLOCK = 3;
    public static final int WIERDBLOCK = 4;
    public static final int BIGBLOCK = 5;
    public static final int RANDOMBLOCK = 6;
    public static final int HARDBLOCK = 7;

    TiledMap tiledMap;
    int type;
    int x;
    int y;

    public Block(String ref) throws SlickException {
        this.x = 0;
        this.y = 0;
        this.type = 0;
        this.tiledMap = new TiledMap(ref);
    }

    /**
     * The constructor for the Block Class.
     *
     * @param type Depending on what type that is inputed, the block will look
     * diffentently.
     * @param x The x value that the block should have and be rendered on.
     * @param y The y value that the block should have and be rendered on.
     * @throws SlickException
     */
    public Block(int type, int x, int y) throws SlickException {
        this.x = x;
        this.y = y;
        this.type = type;
        if (type == STARTBLOCK) {
            tiledMap = new TiledMap("data/sprites/blocks/start.tmx");
        } else if (type == REGULARCUBE) {
            tiledMap = new TiledMap("data/sprites/blocks/regular.tmx");
        } else if (type == SLIDEBLOCK) {
            tiledMap = new TiledMap("data/sprites/blocks/slide.tmx");
        } else if (type == LONGBLOCK) {
            tiledMap = new TiledMap("data/sprites/blocks/long.tmx");
        } else if (type == WIERDBLOCK) {
            tiledMap = new TiledMap("data/sprites/blocks/regular.tmx");
        } else if (type == BIGBLOCK) {
            tiledMap = new TiledMap("data/sprites/blocks/regular.tmx");
        } else if (type == RANDOMBLOCK) {
            tiledMap = new TiledMap("data/sprites/blocks/regular.tmx");
        } else if (type == HARDBLOCK) {
            tiledMap = new TiledMap("data/sprites/blocks/regular.tmx");
        } else {
            System.out.println("invalid blocktype! " + type);
            tiledMap = new TiledMap("data/sprites/blocks/long.tmx");
        }
    }

    /**
     * The render function for a block object, draws the block object on the set
     * x and y values.
     */
    @Override
    public void render() {
        tiledMap.render((int) x, (int) y, 0);
    }

    /**
     * @return Returns the integer type of the block.
     */
    public int getType() {
        return type;
    }

    /**
     * @return Returns the integer x of the block.
     */
    public float getX() {
        return x;
    }

    /**
     * @return Returns the integer y of the block.
     */
    public float getY() {
        return y;
    }

    /**
     * @return Returns the static tile width.
     */
    public int getTiledWidth() {
        return tiledMap.getWidth();
    }

    /**
     * @return Returns the static tile HEIGHT.
     */
    public int getTiledHeight() {
        return tiledMap.getHeight();
    }

    /**
     * Returns the width of the block in pixels.
     *
     * @return an int representing the width.
     */
    public int getWidth() {
        //System.out.println(this.tiledMap.getWidth());
        return tiledMap.getWidth() * TILEWIDTH;
    }

    /**
     * Returns the height of the block in pixels.
     * @return an int representing the height.
     */
    public int getHeight() {
        return tiledMap.getHeight() * TILEHEIGHT;
    }

    /**
     * Returns true if the position inputed is inside the block.
     * @param pos the position to check.
     * @return
     */
    public boolean inBlock(float[] pos) {
        return (pos[X] > this.x && pos[X] < this.x + this.getWidth() && pos[Y] > this.y && pos[Y] < this.y + this.getHeight()); // pos[X] is the x value for the input, pos[Y] is the y value. If all is true, you're in the block.
    }

    /**
     * Returns true if the tile that the inputed position represents is a collision tile and hasn't got another collision block to the left.
     * @param pos the position to represent the tile. It has to be inside the tile to represent it.
     * @return
     */
    public boolean isLeftmostTile(float[] pos) { // returns true if the tile to the left of this one isn't a cloission block.
        int[] tilePos = getTileMapPos(getTilePixelPos(pos));
        if (tilePos[X] == 0) {
            return true;
        } else {
            return this.tiledMap.getTileId(tilePos[X] - 1, tilePos[Y], this.tiledMap.getLayerIndex("Collision")) != 1;
        }
    }

    /**
     * Returns true if the tile that the inputed position represents is a collision tile and hasn't got another collision block to the right.
     * @param pos the position to represent the tile. It has to be inside the tile to represent it.
     * @return
     */
    public boolean isRightmostTile(float[] pos) { // returns true if the tile to the right of this one isn't a cloission block.
        int[] tilePos = getTileMapPos(getTilePixelPos(pos));
        if (tilePos[X] == this.tiledMap.getWidth()) {
            return true;
        } else {
            try {
                return this.tiledMap.getTileId(tilePos[X] + 1, tilePos[Y], this.tiledMap.getLayerIndex("Collision")) != 1;
            } catch (ArrayIndexOutOfBoundsException e) {
                System.out.println("Error in Block.java at row 120, exception type: ArrayIndexOutOfBoundsException");
                return true;
            }
        }
    }

    /**
     * Returns true if the tile that the inputed position represents is a collision tile and hasn't got another collision block over it
     * @param pos the position to represent the tile. It has to be inside the tile to represent it.
     * @return
     */
    public boolean isTopTile(float[] pos) { // returns true if the tile above this one isn't a cloission block.
        int[] tilePos = getTileMapPos(getTilePixelPos(pos));
        if (tilePos[Y] == 0) {
            return true;
        } else {
            try {
                return this.tiledMap.getTileId(tilePos[X], tilePos[Y] - 1, this.tiledMap.getLayerIndex("Collision")) != 1;
            } catch (ArrayIndexOutOfBoundsException e) {
                System.out.println("Error in Block.java at row 134, exception type: ArrayIndexOutOfBoundsException");
                return true;
            }
        }
    }

    /**
     * Returns true if the tile that the inputed position represents is a collision tile and hasn't got another collision under it.
     * @param pos the position to represent a tile. It has to be inside the tile to represent it.
     * @return
     */
    public boolean isBottomTile(float[] pos) { // returns true if the tile below a cloission block.
        int[] tilePos = getTileMapPos(getTilePixelPos(pos));
        if (tilePos[Y] == this.tiledMap.getHeight()) {
            return true;
        } else {
            try {
                return this.tiledMap.getTileId(tilePos[X], tilePos[Y] + 1, this.tiledMap.getLayerIndex("Collision")) != 1;
            } catch (ArrayIndexOutOfBoundsException e) {
                System.out.println("Error in Block.java at row 148, exception type: ArrayIndexOutOfBoundsException");
                return true;
            }
        }
    }

    /**
     * Returns true if the tile that the input position is in is a collision tile.
     * @param pos the position to represent a tile. It has to be inside the tile to represent it.
     * @return
     */
    public boolean isColliding(float[] pos) {
        int[] block = {
            (int) ((pos[X] - (float) this.x - (pos[X] - (float) this.x) % (float) TILEWIDTH) / (float) TILEWIDTH),
            /* the input x position subtracted with the blocks x position subtracted with the distance to the nearest tiles' x value.
            This becomes the x position of the nearest tile in pixels, lastly we divide by the pixel width of one tile to get an int index representing the tile in the x-axis. */
            (int) ((pos[Y] - (float) this.y - (pos[Y] - (float) this.y) % (float) TILEHEIGHT) / (float) TILEHEIGHT)
            // the same as above, but with the y positions.
        };
        if (block[X] < 0 || block[X] > this.tiledMap.getWidth() - 1 || block[Y] < 0 || block[Y] > this.tiledMap.getHeight() - 1) {
            return false;
        } else {
            return tiledMap.getTileId(block[X], block[Y], this.tiledMap.getLayerIndex("collision")) == 1;
        }
    }

    /**
     *  Returns an array containing two floats representing the pixel position of a tile that the input position resides in.
     * @param pos the position to represent a tile. It has to be inside the tile to represent it.
     * @return the array to represent the position of the tile.
     */
    public float[] getTilePixelPos(float[] pos) {
        return new float[]{
            (pos[X] - (pos[X] - (float) this.x) % (float) this.tiledMap.getTileWidth()),
            (pos[Y] - (pos[Y] - (float) this.y) % (float) this.tiledMap.getTileHeight())
        };
    }

    public int[] getTileMapPos(float[] pos) {
        return new int[]{
            (int) pos[X] - this.x % TILEWIDTH,
            (int) pos[Y] - this.y % TILEHEIGHT
        };
    }

    /**
     * Returns true if the x-value of the input position is within the position of this block.
     * @param pos The input position that we check.
     * @return a boolean representing the answer.
     */
    public boolean inXRangeOfBlock(float[] pos) {
        return pos[X] > this.x && pos[X] < this.x + this.getWidth();
    }
}


text:
module HQueue.Queue where

import Control.Concurrent.STM (atomically)
import Control.Concurrent.STM.TQueue (newTQueueIO, writeTQueue)

-- | Init the queue, we use TQueue with IO actions inside
initQueue = newTQueueIO

-- | IO action for pushing stuff into queue
pushToQueue queue job = atomically . (writeTQueue queue) $ job


text:
import os
import hashlib
import uuid
import subprocess

class BaseAnalyser(object):

    SHAMEAN_BIN = '/usr/local/bin/shamean'

    @classmethod
    def get_file_properties(cls, file_obj):
        file_obj.properties['id'] = uuid.uuid4()
        file_obj.properties['g_path'] = file_obj.path
        file_obj.properties['g_file_name'] = file_obj.path.split('/')[-1]
        file_obj.properties['g_directory'] = '/'.join(file_obj.path.split('/')[0:-1])
        file_obj.properties['g_mime_type'] = file_obj.mime_type
        file_obj.properties['g_file_type'] = file_obj.__class__.__name__

        file_obj.properties['g_shamean'] = cls.get_shamean(file_obj) if not file_obj.is_virtual else None

        file_obj.properties['g_size'] = file_obj.size

        file_obj.properties['g_extension'] = (
            file_obj.properties['g_file_name'].split('.')[-1]
            if '.' in file_obj.properties['g_file_name'] else '')

    @staticmethod
    def get_shamean(file_obj):
        return subprocess.check_output([BaseAnalyser.SHAMEAN_BIN, file_obj.path]).strip()

    @staticmethod
    def get_checksums(file_obj):
        block_size = 2**20
        sha512 = hashlib.sha512()
        sha1 = hashlib.sha1()
        with file_obj.get_file_handle() as fh_:
            while True:
                data = fh_.read(block_size)
                if not data:
                    break
                sha512.update(data)
                sha1.update(data)
        return sha1.hexdigest(), sha512.hexdigest()

    @classmethod
    def check_match(cls, file_obj):
        """Base method to determine if file is applicable to analyser.
        Only non-inheritted analyser classes should return True."""
        # Base class is always applicable to standard files
        if cls is BaseAnalyser:
            return True

        raise NotImplementedError

class BaseFile(object):

    @classmethod
    def get_file_properties(cls, file_obj):
        file_obj.properties['g_size'] = int(os.path.getsize(file_obj.path))

    @classmethod
    def check_match(cls, file_obj):
        """Base method to determine if file is applicable to analyser.
        Only non-inheritted analyser classes should return True."""
        # Base class is always applicable to standard files
        return file_obj.__class__.__name__ == 'File'


text:
package pl.panryba.mc.recipes;

import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.inventory.ItemStack;

import java.util.logging.Level;

/**
 * @author PanRyba.pl
 */
public class PlayerListener implements Listener {

    private final PluginApi api;

    public PlayerListener(PluginApi api) {
        this.api = api;
    }

    @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
    public void onBlockPlace(BlockPlaceEvent event)
    {
        api.blockPlaced(event.getItemInHand(), event.getBlockPlaced());
    }

    @EventHandler
    private void onCraft(PrepareItemCraftEvent event) {
        ItemStack stack = event.getRecipe().getResult();

        if(stack.getType() != Material.COBBLESTONE) {
            return;
        }

        for(ItemStack contentItem : event.getInventory().getMatrix()) {
            if(contentItem != null && (contentItem.getType() != Material.COBBLESTONE || contentItem.getAmount() != 64)) {
                event.getInventory().setResult(new ItemStack(Material.AIR));
                return;
            }
        }

        event.getInventory().setMatrix(new ItemStack[10]);

        Player player = (Player)event.getView().getPlayer();
        player.updateInventory();

        ItemStack item = api.getRandomItem();
        Bukkit.getLogger().log(Level.INFO, "COBBLE: {0}", item);
        if(item != null) {
            event.getInventory().setResult(item);
        }
    }
}


text:
module PiggybakTaxonomy
  class NavigationController < ApplicationController
    def show
      paths = params[:path].split('/')
      nodes = recursive_path(paths, [])
      if nodes.empty?
        redirect_to main_app.root_url, :status => 301
      elsif nodes.size != params[:path].split('/').size
        redirect_to piggybak_taxonomy_url(:path => nodes.last.nav_path), :status => 301
      end
      @node = nodes.last
    end

    def recursive_path(paths, nodes)
      return nodes if paths.empty?
      first = paths.shift
      node = NavigationNode.where(slug: first).first
      if node && (nodes.empty? || node.parent == nodes.last) && !(nodes.empty? && !node.parent.nil?)
        nodes << node
        nodes = recursive_path(paths, nodes)
      end
      return nodes
    end
  end
end


text:
<!DOCTYPE html>

<title>Canvas test: 2d.line.width.invalid</title>

<link rel="stylesheet" href="../tests.css">
<link rel="prev" href="minimal.2d.line.width.valid.html" title="2d.line.width.valid">
<link rel="next" href="minimal.2d.line.cap.butt.html" title="2d.line.cap.butt">

Pass

Fail

These images should be identical:

<canvas id="c" class="output" width="100" height="50">
FAIL (fallback content)
</canvas>


text:
package org.rulesdsl.predicates.comparables;

/**
 * @author Roman Kashitsyn
 */
public class LesserThanSelector<T extends Comparable<? super T>> extends AbstractComparableSelector<T> {

    public LesserThanSelector(T value) {
        super(value);
    }

    @Override
    protected boolean matches(int comparisonResult) {
        return comparisonResult > 0;
    }

    @Override
    public String toString() {
        return "lesserThan(" + compareWith() + ")";
    }
}