text:
package com.lmax.angler.monitoring.network.monitor.socket.tcp;

import com.lmax.angler.monitoring.network.monitor.socket.SocketIdentifier;
import com.lmax.angler.monitoring.network.monitor.util.AsciiBytesToLongDecoder;
import com.lmax.angler.monitoring.network.monitor.util.HexToLongDecoder;
import com.lmax.angler.monitoring.network.monitor.util.TokenHandler;

import java.nio.ByteBuffer;
import java.util.function.Consumer;

import static java.nio.charset.StandardCharsets.UTF_8;

/**
 * TokenHandler for entries in /proc/net/udp.
 */
final class TcpColumnHandler implements TokenHandler
{
    private static final int TCP_SOCKET_IDENTIFIER_COLUMN =
            Integer.getInteger("angler.tcp.socketIdentifierColumn", 1);
    private static final short HEADER_ROW_FIRST_COLUMN_VALUE = ByteBuffer.wrap("sl".getBytes(UTF_8)).getShort();
    private final Consumer<TcpStatsEntry> bufferStatsEntryConsumer;
    private final TcpStatsEntry entry = new TcpStatsEntry();
    private int currentColumn = 0;
    private boolean headerRow;

    public TcpColumnHandler(final Consumer<TcpStatsEntry> bufferStatsEntryConsumer)
    {
        this.bufferStatsEntryConsumer = bufferStatsEntryConsumer;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void handleToken(final ByteBuffer src, final int startPosition, final int endPosition)
    {
        if(src.getShort(startPosition) == HEADER_ROW_FIRST_COLUMN_VALUE)
        {
            // header row
            headerRow = true;
        }

        if(!headerRow)
        {
            if (currentColumn == TCP_SOCKET_IDENTIFIER_COLUMN)
            {
                // do local address
                //00000000:4E50
                final long socketIpv4Address = HexToLongDecoder.UPPER_CASE.decodeHex(src, startPosition, startPosition + 8);
                final long socketPortNumber = HexToLongDecoder.UPPER_CASE.decodeHex(src, startPosition + 9, endPosition);
                entry.setSocketIdentifier(SocketIdentifier.fromLinuxKernelHexEncodedAddressAndPort(socketIpv4Address, socketPortNumber));

            }
            else if (currentColumn == 4)
            {
                // do tx/rx queue
                // hex
                //00000000:00000000
                final long transmitQueueDepth = HexToLongDecoder.UPPER_CASE.decodeHex(src, startPosition, startPosition + 8);
                final long receiveQueueDepth = HexToLongDecoder.UPPER_CASE.decodeHex(src, startPosition + 9, endPosition);
                entry.setTransmitQueueDepth(transmitQueueDepth);
                entry.setReceiveQueueDepth(receiveQueueDepth);

            }
            else if (currentColumn == 9)
            {
                // do inode
                final long inode = AsciiBytesToLongDecoder.decodeAscii(src, startPosition, endPosition);
                entry.setInode(inode);

            }
        }

        currentColumn++;
    }

    @Override
    public void complete()
    {
        if(!headerRow && currentColumn != 0)
        {
            bufferStatsEntryConsumer.accept(entry);
        }
        headerRow = false;
        currentColumn = 0;
        entry.reset();
    }

    @Override
    public void reset()
    {
        currentColumn = 0;
    }
}


text:
var fs = require('fs');
var indexFile = require('lodash')
  .template(fs.readFileSync('index.tpl'))(require('./credentials'))

fs.writeFileSync('./src/index.html',indexFile);
process.exit(0);

redpajama_set_name: RedPajamaGithub


text:
package io.micrometer.core.instrument.binder.cache;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.LoadingCache;
import io.micrometer.common.lang.NonNullApi;
import io.micrometer.common.lang.NonNullFields;
import io.micrometer.common.lang.Nullable;
import io.micrometer.core.instrument.*;

import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.function.ToLongFunction;

/**
 * @author Jon Schneider
 */
@NonNullApi
@NonNullFields
public class GuavaCacheMetrics<K, V, C extends Cache<K, V>> extends CacheMeterBinder<C> {

    private static final String DESCRIPTION_CACHE_LOAD = "The number of times cache lookup methods have successfully loaded a new value or failed to load a new value because an exception was thrown while loading";

    /**
     * Record metrics on a Guava cache. You must call {@link CacheBuilder#recordStats()}
     * prior to building the cache for metrics to be recorded.
     * @param registry The registry to bind metrics to.
     * @param cache The cache to instrument.
     * @param cacheName Will be used to tag metrics with "cache".
     * @param tags Tags to apply to all recorded metrics. Must be an even number of
     * arguments representing key/value pairs of tags.
     * @param <K> Cache key type.
     * @param <V> Cache value type.
     * @param <C> The cache type.
     * @return The instrumented cache, unchanged. The original cache is not wrapped or
     * proxied in any way.
     * @see com.google.common.cache.CacheStats
     */
    public static <K, V, C extends Cache<K, V>> C monitor(MeterRegistry registry, C cache, String cacheName,
            String... tags) {
        return monitor(registry, cache, cacheName, Tags.of(tags));
    }

    /**
     * Record metrics on a Guava cache. You must call {@link CacheBuilder#recordStats()}
     * prior to building the cache for metrics to be recorded.
     * @param registry The registry to bind metrics to.
     * @param cache The cache to instrument.
     * @param cacheName The name prefix of the metrics.
     * @param tags Tags to apply to all recorded metrics.
     * @param <K> Cache key type.
     * @param <V> Cache value type.
     * @param <C> The cache type.
     * @return The instrumented cache, unchanged. The original cache is not wrapped or
     * proxied in any way.
     * @see com.google.common.cache.CacheStats
     */
    public static <K, V, C extends Cache<K, V>> C monitor(MeterRegistry registry, C cache, String cacheName,
            Iterable<Tag> tags) {
        new GuavaCacheMetrics<>(cache, cacheName, tags).bindTo(registry);
        return cache;
    }

    public GuavaCacheMetrics(C cache, String cacheName, Iterable<Tag> tags) {
        super(cache, cacheName, tags);
    }

    @Override
    protected Long size() {
        return getOrDefault(Cache::size, null);
    }

    @Override
    protected long hitCount() {
        return getOrDefault(c -> c.stats().hitCount(), 0L);
    }

    @Override
    protected Long missCount() {
        return getOrDefault(c -> c.stats().missCount(), null);
    }

    @Override
    protected Long evictionCount() {
        return getOrDefault(c -> c.stats().evictionCount(), null);
    }

    @Override
    protected long putCount() {
        return getOrDefault(c -> c.stats().loadCount(), 0L);
    }

    @Override
    protected void bindImplementationSpecificMetrics(MeterRegistry registry) {
        C cache = getCache();
        if (cache instanceof LoadingCache) {
            // dividing these gives you a measure of load latency
            TimeGauge.builder("cache.load.duration", cache, TimeUnit.NANOSECONDS, c -> c.stats().totalLoadTime())
                    .tags(getTagsWithCacheName()).description("The time the cache has spent loading new values")
                    .register(registry);

            FunctionCounter.builder("cache.load", cache, c -> c.stats().loadSuccessCount()).tags(getTagsWithCacheName())
                    .tags("result", "success").description(DESCRIPTION_CACHE_LOAD).register(registry);

            FunctionCounter.builder("cache.load", cache, c -> c.stats().loadExceptionCount())
                    .tags(getTagsWithCacheName()).tags("result", "failure").description(DESCRIPTION_CACHE_LOAD)
                    .register(registry);
        }
    }

    @Nullable
    private Long getOrDefault(Function<Cache<?, ?>, Long> function, @Nullable Long defaultValue) {
        C ref = getCache();
        if (ref != null) {
            return function.apply(ref);
        }

        return defaultValue;
    }

    private long getOrDefault(ToLongFunction<Cache<?, ?>> function, long defaultValue) {
        C ref = getCache();
        if (ref != null) {
            return function.applyAsLong(ref);
        }

        return defaultValue;
    }

}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <link rel="stylesheet" href="jsPlugins/tether/css/tether.min.css"/>
    <link rel="stylesheet" href="jsPlugins/remodal/remodal-default-theme.css"/>
    <link rel="stylesheet" href="jsPlugins/remodal/remodal.css"/>
    <link rel="stylesheet" href="css/bootstrap.css"/>
    <link rel="stylesheet" href="jsPlugins/font-awesome-4.6.3/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="jsPlugins/star-rating/css/star-rating-svg.css"/>
    <link rel="stylesheet" href="css/custom.css"/>

          <form>
            <input type="text" placeholder="Search"/>
            <button type="submit"></button>
          </form>

LOG IN

SIGN UP

Creator: John Doe

                    150 people are interested

Improving rhyming skills

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ac tortor nec leo egestas eleifend id ut lectus. In vel laoreet erat, ac cursus metus. Donec tempor luctus turpis, in consectetur felis. Nulla dolor ligula, tincidunt vel lorem at, pellentesque hendrerit justo. Aenean porttitor eleifend quam vitae rutrum. Pellentesque et dolor justo. Fusce nec ex nec erat placerat tincidunt et in nisi. Donec eros quam, sollicitudin et tincidunt eget, tincidunt non velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae

book

write

how to write

                How to write?

                  Which fonts to use

                  Which fonts to use

                Recommended
                Topic 1
                Topic 2

                  Materials

                  Discussion

                  Quiz

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent ac tortor nec leo egestas eleifend id ut lectus. In vel laoreet erat, ac cursus metus. Donec tempor luctus turpis, in consectetur felis. Nulla dolor ligula, tincidunt vel lorem at, pellentesque hendrerit justo. Aenean porttitor eleifend quam vitae rutrum. Pellentesque et dolor justo. Fusce nec ex nec erat placerat tincidunt et in nisi. Donec eros quam, sollicitudin et tincidunt eget, tincidunt non velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vivamus neque quam, vehicula non tincidunt sed, vestibulum at ex. Duis finibus sem convallis bibendum facilisis. Donec pellentesque pellentesque aliquam. In tempor sapien non neque faucibus, at rutrum lorem gravida. Suspendisse at vehicula odio.

                      10

                        Aydın Aksoy

                      <button type="button" class="float-button button-green" title="Reply"></button>

İyi bir yazarda olması gereken özellikler nelerdir?

                        08.11.2016

                      10

                        Aydın Aksoy

                      <button type="button" class="float-button button-green" title="Reply"></button>

İyi bir yazarda olması gereken özellikler nelerdir?

                        08.11.2016

                      10

                        Aydın Aksoy

                      <button type="button" class="float-button button-green" title="Reply"></button>

İyi bir yazarda olması gereken özellikler nelerdir?

                        08.11.2016

                      10

                        Aydın Aksoy

                      <button type="button" class="float-button button-green" title="Reply"></button>

İyi bir yazarda olması gereken özellikler nelerdir?

                        08.11.2016

                      10

                        Aydın Aksoy

                      <button type="button" class="float-button button-green" title="Reply"></button>

İyi bir yazarda olması gereken özellikler nelerdir?

                        08.11.2016

                      10

                        Aydın Aksoy

                      <button type="button" class="float-button button-green" title="Reply"></button>

İyi bir yazarda olması gereken özellikler nelerdir?

                        08.11.2016

                      10

                        Aydın Aksoy

                      <button type="button" class="float-button button-green" title="Reply"></button>

İyi bir yazarda olması gereken özellikler nelerdir?

                        08.11.2016

                      10

                        Aydın Aksoy

                      <button type="button" class="float-button button-green" title="Reply"></button>

İyi bir yazarda olması gereken özellikler nelerdir?

                        08.11.2016

                    <input type="text" placeholder="Your message" class="form-control">
                    <button class="button button-green send-button"></button>

Q1 Dayak nedir neden atılır ?

                          <button class="button">option 1</button>

                          <button class="button selected">option 2</button>

                          <button class="button">option 3</button>

                          <button class="button">option 4</button>


text:
/*!
 * inferno v0.7.1
 * (c) 2016 Dominic Gannaway
 * Released under the MPL-2.0 License.
 */
(function (global, factory) {
	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
	typeof define === 'function' && define.amd ? define(factory) :
	(global.Inferno = factory());
}(this, function () { 'use strict';

	var babelHelpers = {};
	babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
	  return typeof obj;
	} : function (obj) {
	  return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
	};

	babelHelpers.classCallCheck = function (instance, Constructor) {
	  if (!(instance instanceof Constructor)) {
	    throw new TypeError("Cannot call a class as a function");
	  }
	};

	babelHelpers.createClass = function () {
	  function defineProperties(target, props) {
	    for (var i = 0; i < props.length; i++) {
	      var descriptor = props[i];
	      descriptor.enumerable = descriptor.enumerable || false;
	      descriptor.configurable = true;
	      if ("value" in descriptor) descriptor.writable = true;
	      Object.defineProperty(target, descriptor.key, descriptor);
	    }
	  }

	  return function (Constructor, protoProps, staticProps) {
	    if (protoProps) defineProperties(Constructor.prototype, protoProps);
	    if (staticProps) defineProperties(Constructor, staticProps);
	    return Constructor;
	  };
	}();

	babelHelpers.extends = Object.assign || function (target) {
	  for (var i = 1; i < arguments.length; i++) {
	    var source = arguments[i];

	    for (var key in source) {
	      if (Object.prototype.hasOwnProperty.call(source, key)) {
	        target[key] = source[key];
	      }
	    }
	  }

	  return target;
	};

	babelHelpers;

	function isNullOrUndefined(obj) {
		return obj === void 0 || obj === null;
	}

	function isAttrAnEvent(attr) {
		return attr[0] === 'o' && attr[1] === 'n' && attr.length > 3;
	}

	function VNode(blueprint) {
		this.bp = blueprint;
		this.dom = null;
		this.instance = null;
		this.tag = null;
		this.children = null;
		this.style = null;
		this.className = null;
		this.attrs = null;
		this.events = null;
		this.hooks = null;
		this.key = null;
		this.clipData = null;
	}

	VNode.prototype = {
		setAttrs: function setAttrs(attrs) {
			this.attrs = attrs;
			return this;
		},
		setTag: function setTag(tag) {
			this.tag = tag;
			return this;
		},
		setStyle: function setStyle(style) {
			this.style = style;
			return this;
		},
		setClassName: function setClassName(className) {
			this.className = className;
			return this;
		},
		setChildren: function setChildren(children) {
			this.children = children;
			return this;
		},
		setHooks: function setHooks(hooks) {
			this.hooks = hooks;
			return this;
		},
		setEvents: function setEvents(events) {
			this.events = events;
			return this;
		},
		setKey: function setKey(key) {
			this.key = key;
			return this;
		}
	};

	function createVNode(bp) {
		return new VNode(bp);
	}

	function createBlueprint(shape, childrenType) {
		var tag = shape.tag || null;
		var tagIsDynamic = tag && tag.arg !== void 0 ? true : false;

		var children = !isNullOrUndefined(shape.children) ? shape.children : null;
		var childrenIsDynamic = children && children.arg !== void 0 ? true : false;

		var attrs = shape.attrs || null;
		var attrsIsDynamic = attrs && attrs.arg !== void 0 ? true : false;

		var hooks = shape.hooks || null;
		var hooksIsDynamic = hooks && hooks.arg !== void 0 ? true : false;

		var events = shape.events || null;
		var eventsIsDynamic = events && events.arg !== void 0 ? true : false;

		var key = shape.key !== void 0 ? shape.key : null;
		var keyIsDynamic = !isNullOrUndefined(key) && !isNullOrUndefined(key.arg);

		var style = shape.style || null;
		var styleIsDynamic = style && style.arg !== void 0 ? true : false;

		var className = shape.className !== void 0 ? shape.className : null;
		var classNameIsDynamic = className && className.arg !== void 0 ? true : false;

		var blueprint = {
			lazy: shape.lazy || false,
			dom: null,
			pools: {
				keyed: {},
				nonKeyed: []
			},
			tag: !tagIsDynamic ? tag : null,
			className: className !== '' && className ? className : null,
			style: style !== '' && style ? style : null,
			isComponent: tagIsDynamic,
			hasAttrs: attrsIsDynamic || (attrs ? true : false),
			hasHooks: hooksIsDynamic,
			hasEvents: eventsIsDynamic,
			hasStyle: styleIsDynamic || (style !== '' && style ? true : false),
			hasClassName: classNameIsDynamic || (className !== '' && className ? true : false),
			childrenType: childrenType === void 0 ? children ? 5 : 0 : childrenType,
			attrKeys: null,
			eventKeys: null,
			isSVG: shape.isSVG || false
		};

		return function () {
			var vNode = new VNode(blueprint);

			if (tagIsDynamic === true) {
				vNode.tag = arguments[tag.arg];
			}
			if (childrenIsDynamic === true) {
				vNode.children = arguments[children.arg];
			}
			if (attrsIsDynamic === true) {
				vNode.attrs = arguments[attrs.arg];
			} else {
				vNode.attrs = attrs;
			}
			if (hooksIsDynamic === true) {
				vNode.hooks = arguments[hooks.arg];
			}
			if (eventsIsDynamic === true) {
				vNode.events = arguments[events.arg];
			}
			if (keyIsDynamic === true) {
				vNode.key = arguments[key.arg];
			}
			if (styleIsDynamic === true) {
				vNode.style = arguments[style.arg];
			} else {
				vNode.style = blueprint.style;
			}
			if (classNameIsDynamic === true) {
				vNode.className = arguments[className.arg];
			} else {
				vNode.className = blueprint.className;
			}

			return vNode;
		};
	}

	// Runs only once in applications lifetime
	var isBrowser = typeof window !== 'undefined' && window.document;

	// Copy of the util from dom/util, otherwise it makes massive bundles
	function documentCreateElement(tag, isSVG) {
		var dom = void 0;

		if (isSVG === true) {
			dom = document.createElementNS('http://www.w3.org/2000/svg', tag);
		} else {
			dom = document.createElement(tag);
		}
		return dom;
	}

	function createUniversalElement(tag, attrs, isSVG) {
		if (isBrowser) {
			var dom = documentCreateElement(tag, isSVG);
			if (attrs) {
				createStaticAttributes(attrs, dom);
			}
			return dom;
		}
		return null;
	}

	function createStaticAttributes(attrs, dom) {
		var attrKeys = Object.keys(attrs);

		for (var i = 0; i < attrKeys.length; i++) {
			var attr = attrKeys[i];
			var value = attrs[attr];

			if (attr === 'className') {
				dom.className = value;
			} else {
				if (value === true) {
					dom.setAttribute(attr, attr);
				} else if (!isNullOrUndefined(value) && value !== false && !isAttrAnEvent(attr)) {
					dom.setAttribute(attr, value);
				}
			}
		}
	}

	var index = {
		createBlueprint: createBlueprint,
		createVNode: createVNode,
		universal: {
			createElement: createUniversalElement
		}
	};

	return index;

}));


text:
/*
* jQuery.splitter.js - animated splitter plugin
*
* version 1.0 (2010/01/02)
*
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
*/

/**
* jQuery.splitter() plugin implements a two-pane resizable animated window, using existing DIV elements for layout.
* For more details and demo visit: http://krikus.com/js/splitter
*
* @example $("#splitterContainer").splitter({splitVertical:true,A:$('#leftPane'),B:$('#rightPane'),closeableto:0});
* @desc Create a vertical splitter with toggle button
*
* @example $("#splitterContainer").splitter({minAsize:100,maxAsize:300,splitVertical:true,A:$('#leftPane'),B:$('#rightPane'),slave:$("#rightSplitterContainer"),closeableto:0});
* @desc Create a vertical splitter with toggle button, with minimum and maximum width for plane A and bind resize event to the slave element
*
* @name splitter
* @type jQuery
* @param Object options Options for the splitter ( required)
* @cat Plugins/Splitter
* @return jQuery
* @author Kristaps Kukurs (contact@krikus.com)
*/

;(function($){

	$.fn.splitter = function(args){
		args = args || {};
		return this.each(function() {
			var _ghost;		//splitbar  ghosted element
			var splitPos;	 // current splitting position
			var _splitPos;	 // saved splitting position
			var _initPos;	//initial mouse position
			var _ismovingNow=false;	// animaton state flag

			// Default opts
			var direction = (args.splitHorizontal? 'h':'v');
			var opts = $.extend({
			minAsize:0, //minimum width/height in PX of the first (A) div.
			maxAsize:0, //maximum width/height  in PX of the first (A) div.
			minBsize:0, //minimum width/height in PX of the second (B) div.
			maxBsize:0, //maximum width/height  in PX of the second (B) div.
			ghostClass: 'working',// class name for _ghosted splitter and hovered button
			invertClass: 'invert',//class name for invert splitter button
			animSpeed: 250 //animation speed in ms
			},{
			v:{ // Vertical
			moving:"left",sizing: "width", eventPos: "pageX",splitbarClass:"splitbarV",buttonClass: "splitbuttonV", cursor: "e-resize"
			},
			h: { // Horizontal
			moving:"top",sizing: "height", eventPos: "pageY",splitbarClass:"splitbarH",buttonClass: "splitbuttonH",  cursor: "n-resize"
			}
			}[direction], args);

			//setup elements
			var splitter = $(this);
			var mychilds =splitter.children(); //$(">*", splitter[0]);
			var A = args.A;	// left/top frame
			var B = args.B;// right/bottom frame
			var slave=args.slave;//optional, elemt forced to receive resize event
//Create splitbar
var C=$('

');
A.after(C);
C.attr({"class": opts.splitbarClass,unselectable:"on"}).css({"cursor":opts.cursor,"user-select": "none", "-webkit-user-select": "none","-khtml-user-select": "none", "-moz-user-select": "none"})
.bind("mousedown", startDrag);

if(opts.closeableto!=undefined){
var Bt=$('

').css("cursor",'pointer');
C.append(Bt);
Bt.attr({"class": opts.buttonClass, unselectable: "on"});
Bt.hover(function(){$(this).addClass(opts.ghostClass);},function(){$(this).removeClass(opts.ghostClass);});
Bt.mousedown(function(e){if(e.target != this)return;Bt.toggleClass(opts.invertClass).hide();splitTo((splitPos==opts.closeableto)?_splitPos:opts.closeableto,true);return false;});
}
//reset size to default.
var perc=(((C.position()[opts.moving]-splitter.offset()[opts.moving])/splitter[opts.sizing]())*100).toFixed(1);
splitTo(perc,false,true);
// resize  event handlers;
splitter.bind("resize",function(e, size){if(e.target!=this)return;splitTo(splitPos,false,true);});
$(window).bind("resize",function(){splitTo(splitPos,false,true);});

//C.onmousedown=startDrag
			function startDrag(e) {
			if(e.target != this)return;
		 _ghost = _ghost || C.clone(false).insertAfter(A);
				splitter._initPos=C.position();
				splitter._initPos[opts.moving]-=C[opts.sizing]();
_ghost.addClass(opts.ghostClass).css('position','absolute').css('z-index','250').css("-webkit-user-select", "none").width(C.width()).height(C.height()).css(opts.moving,splitter._initPos[opts.moving]);
mychilds.css("-webkit-user-select", "none");	// Safari selects A/B text on a move
A._posSplit = e[opts.eventPos];
$("iframe").hide();

$(document).bind("mousemove", performDrag).bind("mouseup", endDrag);
			}
//document.onmousemove=performDrag
			function performDrag(e) {
			if (!_ghost||!A) return;
				var incr = e[opts.eventPos]-A._posSplit;
				_ghost.css(opts.moving, splitter._initPos[opts.moving]+incr);
			}
//C.onmouseup=endDrag
			function endDrag(e){
				var p=_ghost.position();
				_ghost.remove(); _ghost = null;
				mychilds.css("-webkit-user-select", "text");// let Safari select text again
				$(document).unbind("mousemove", performDrag).unbind("mouseup", endDrag);
				var perc=(((p[opts.moving]-splitter.offset()[opts.moving])/splitter[opts.sizing]())*100).toFixed(1);
				splitTo(perc,(splitter._initPos[opts.moving]>p[opts.moving]),false);
				splitter._initPos=0;
				$("iframe").show();
			}
//Perform actual splitting and animate it;
	function splitTo(perc,reversedorder,fast) {
if(_ismovingNow||perc==undefined)return;//generally MSIE problem
_ismovingNow=true;
if(splitPos&&splitPos>10&&splitPos<90)//do not save accidental events
		_splitPos=splitPos;
splitPos=perc;

var barsize=C[opts.sizing]()+(2*parseInt(C.css('border-'+opts.moving+'-width')));//+ border. cehap&dirty
var splitsize=splitter[opts.sizing]();
if(opts.closeableto!=perc){
var percpx=Math.max(parseInt((splitsize/100)*perc),opts.minAsize);
if(opts.maxAsize)percpx=Math.min(percpx,opts.maxAsize);
}else{
var percpx=parseInt((splitsize/100)*perc,0);
}
if(opts.maxBsize){
if((splitsize-percpx)>opts.maxBsize)
percpx=splitsize-opts.maxBsize;
}
if(opts.minBsize){
if((splitsize-percpx)<opts.minBsize)
percpx=splitsize-opts.minBsize;
}
var sizeA=Math.max(0,(percpx-barsize));
var sizeB=Math.max(0,(splitsize-percpx));
splitsize=(splitsize-barsize);

//A.attr('title','- '+sizeA);  B.attr('title','- '+sizeB);
 if(fast){
					A.show().css(opts.sizing,sizeA+'px');
					B.show().css(opts.sizing,sizeB+'px');
					Bt.show();
					if (!$.browser.msie ){
					mychilds.trigger("resize");if(slave)slave.trigger("resize");
					}
				_ismovingNow=false;
				return true;
				}
	if(reversedorder){//reduces flickering if total percentage becomes more  than 100 (possible while animating)
					var anob={};
					anob[opts.sizing]=sizeA+'px';
					A.show().animate(anob,opts.animSpeed,function(){Bt.fadeIn('fast');if($(this)[opts.sizing]()<2){this.style.display='none';B.stop(true,true);B[opts.sizing](splitsize+'px');}});
					var anob2={};
					anob2[opts.sizing]=sizeB+'px';
					B.show().animate(anob2,opts.animSpeed,function(){Bt.fadeIn('fast');if($(this)[opts.sizing]()<2){this.style.display='none';A.stop(true,true);A[opts.sizing](splitsize+'px')}});
	}else{
					var anob={};
					anob[opts.sizing]=sizeB+'px';
					B.show().animate(anob,opts.animSpeed,function(){Bt.fadeIn('fast');if($(this)[opts.sizing]()<2){this.style.display='none';A.stop(true,true);A[opts.sizing](splitsize+'px')}});
					var anob={};
					anob[opts.sizing]=sizeA+'px';
					A.show().animate(anob,opts.animSpeed,function(){Bt.fadeIn('fast');if($(this)[opts.sizing]()<2){this.style.display='none';B.stop(true,true);B[opts.sizing](splitsize+'px');}});
}
//trigger resize evt
splitter.queue(function(){
setTimeout(function(){
splitter.dequeue();
_ismovingNow=false;
mychilds.trigger("resize");if(slave)slave.trigger("resize");
}, opts.animSpeed+5);
});

 }//end splitTo()

});//end each
	};//end splitter

})(jQuery);


text:
package io.pebbletemplates.pebble.loader;

import io.pebbletemplates.pebble.error.LoaderException;

import java.io.Reader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * This loader will delegate control to a list of children loaders. This is the default
 * implementation used by Pebble; it delegates to a classpath loader and a file loader to increase
 * the chances of finding templates with varying setups.
 *
 * @author mbosecke
 */
public class DelegatingLoader implements Loader<DelegatingLoaderCacheKey> {

  private String prefix;

  private String suffix;

  private String charset = "UTF-8";

  /**
   * Children loaders to delegate to. The loaders are used in order and as soon as one of them finds
   * a template, the others will not be given a chance to do so.
   */
  private final List<Loader<?>> loaders;

  /**
   * Constructor provided with a list of children loaders.
   *
   * @param loaders A list of loaders to delegate to
   */
  public DelegatingLoader(List<Loader<?>> loaders) {
    this.loaders = Collections.unmodifiableList(new ArrayList<>(loaders));
  }

  @Override
  public Reader getReader(DelegatingLoaderCacheKey cacheKey) {

    Reader reader = null;

    final int size = this.loaders.size();
    for (int i = 0; i < size; i++) {
      Loader<?> loader = this.loaders.get(i);
      Object delegatingKey = cacheKey.getDelegatingCacheKeys().get(i);
      try {
        reader = this.getReaderInner(loader, delegatingKey);
        if (reader != null) {
          break;
        }
      } catch (LoaderException e) {
        // do nothing
      }
    }
    if (reader == null) {
      throw new LoaderException(null,
          "Could not find template \"" + cacheKey.getTemplateName() + "\"");
    }

    return reader;
  }

  private <T> Reader getReaderInner(Loader<T> delegatingLoader, Object cacheKey) {

    // This unchecked cast is ok, because we ensure that the type of the
    // cache key corresponds to the loader when we create the key.
    @SuppressWarnings("unchecked")
    T castedKey = (T) cacheKey;

    return delegatingLoader.getReader(castedKey);
  }

  public String getSuffix() {
    return this.suffix;
  }

  @Override
  public void setSuffix(String suffix) {
    this.suffix = suffix;
    for (Loader<?> loader : this.loaders) {
      loader.setSuffix(suffix);
    }
  }

  public String getPrefix() {
    return this.prefix;
  }

  @Override
  public void setPrefix(String prefix) {
    this.prefix = prefix;
    for (Loader<?> loader : this.loaders) {
      loader.setPrefix(prefix);
    }
  }

  public String getCharset() {
    return this.charset;
  }

  @Override
  public void setCharset(String charset) {
    this.charset = charset;
    for (Loader<?> loader : this.loaders) {
      loader.setCharset(charset);
    }
  }

  @Override
  public String resolveRelativePath(String relativePath, String anchorPath) {
    if (relativePath == null) {
      return null;
    }
    for (Loader<?> loader : this.loaders) {
      String path = loader.resolveRelativePath(relativePath, anchorPath);
      if (path != null) {
        return path;
      }
    }
    return null;
  }

  @Override
  public DelegatingLoaderCacheKey createCacheKey(String templateName) {

    List<Object> keys = new ArrayList<>();
    for (Loader<?> loader : this.loaders) {
      keys.add(loader.createCacheKey(templateName));
    }

    return new DelegatingLoaderCacheKey(keys, templateName);
  }

  @Override
  public boolean resourceExists(String templateName) {
    for (Loader<?> loader : this.loaders) {
      if (loader.resourceExists(templateName)) {
        return true;
      }
    }
    return false;
  }
}


text:
var rFS = require('fs').readFileSync;
// External dependencies
var ld = require('lodash');
var passport = require('passport');
var jwt = require('jsonwebtoken');
var express;
var testMode = false;
try {
  // Normal case : when installed as a plugin
  express = require('../ep_etherpad-lite/node_modules/express');
}
catch (e) {
  // Testing case : we need to mock the express dependency
  testMode = true;
  express = require('express');
}
var bodyParser = require('body-parser');
// Local dependencies
var conf = require('./configuration.js');
var mail = require('./mail.js');
var user = require('./model/user.js');
var group = require('./model/group.js');
var pad = require('./model/pad.js');
var auth = require('./auth.js');
var perm = require('./perm.js');

module.exports = (function () {
  'use strict';

  var api = {};
  api.initialRoute = '/mypads/api/';

  /**
  * `init` is the first function that takes an Express app as argument.
  * It initializes authentication, permissions and also all API requirements,
  * particularly mypads routes.
  *
  * It needs to be fast to finish *before* YAJSML plugin (which takes over all
  * requests otherwise and refuse anything apart GET and HEAD HTTP methods.
  * That's why api.init is used without any callback and is called before
  * storage initialization.
  */

  api.init = function (app, callback) {
    // Use this for .JSON storage
    app.use(bodyParser.json());
    app.use('/mypads', express.static(__dirname + '/static'));
    if (testMode) {
      // Only allow functional testing in testing mode
      app.use('/mypads/functest', express.static(__dirname + '/spec/frontend'));
    }
    var rFSOpts = { encoding: 'utf8' };
    api.l10n = {
      mail: {
        en: JSON.parse(rFS(__dirname + '/templates/mail_en.json', rFSOpts)),
        fr: JSON.parse(rFS(__dirname + '/templates/mail_fr.json', rFSOpts)),
      }
    };
    auth.init(app);
    authAPI(app);
    configurationAPI(app);
    userAPI(app);
    groupAPI(app);
    padAPI(app);
    perm.init(app);

    /**
    * `index.html` is a simple lodash template
    */
    var idxTpl = ld.template(rFS(__dirname + '/templates/index.html', rFSOpts));
    var idxHandle = function (req, res) {
      return res.send(idxTpl({ HTMLExtraHead: conf.get('HTMLExtraHead') }));
    };
    app.get('/mypads/index.html', idxHandle);
    app.get('/mypads/', idxHandle);

    callback(null);
  };

  /**
  * ## Internal functions helpers
  *
  * These functions are not private like with closures, for testing purposes,
  * but they are expected be used only internally by other MyPads functions.
  */

  var fn = {};

  /**
  * `get` internal takes a mandatory `module` argument to call its `get` method.
  * It will use `req.params.key` to get the database record and returns an
  * according response. By the way, an optional `cond`ition can be passed. It
  * is a function that takes the result of the module.get and *true* or
  * *false*. If *false*, an error will be returned.
  */

  fn.get = function (module, req, res, next, cond) {
    try {
      module.get(req.params.key, function (err, val) {
        if (err) {
          return res.status(404).send({
            error: err.message,
            key: req.params.key
          });
        }
        if (cond && !cond(val)) {
          return fn.denied(res, 'BACKEND.ERROR.AUTHENTICATION.DENIED_RECORD');
        } else {
          return res.send({ key: req.params.key, value: val });
        }
      });
    }
    catch (e) {
      res.status(400).send({ error: e.message });
    }
  };

  /**
  * `set` internal takes :
  *
  * - a `setFn` bounded function targetted the original `set` from the module
  *   used in the case of this public API
  * - `key` and `value` that has been given to the `setFn` function
  * - `req` and `res` express request and response
  */

  fn.set = function (setFn, key, value, req, res) {
    try {
      setFn(function (err, data) {
        if (err) { return res.status(400).send({ error: err.message }); }
        res.send({ success: true, key: key || data._id, value: data || value });
      });
    }
    catch (e) {
      res.status(400).send({ error: e.message });
    }
  };

  /**
  * `del` internal takes four arguments :
  *
  * - `delFn` bounded function targetted the original `del` method from the
  *   module used
  * - classical `req` and `res` express parameters, with mandatory
  *   *req.params.key*.
  */

  fn.del = function (delFn, req, res) {
    var key = req.params.key;
    delFn(key, function (err) {
      if (err) { return res.status(404).send({ error: err.message }); }
      res.send({ success: true, key: key });
    });
  };

  /**
  * `denied` is an internal helper that just takes `res` express response and
  * an `errorCode` string. It returns an unothorized status.
  */

  fn.denied = function (res, errCode) {
    return res
    .status(401)
    .send({ error: errCode });
  };

  /**
  * `mailMessage` is an internal helper that computed email templates. It takes
  * the `tpl` key of the template and the `data` needed. Optionally, a
  * `lang`uage can be defined.
  * It returns the computed template.
  */

  fn.mailMessage = function (tpl, data, lang) {
    lang = lang || conf.get('defaultLanguage');
    tpl = ld.template(api.l10n.mail[lang][tpl]);
    return tpl(data);
  };

  /**
  * `ensureAuthenticated` internal is an Express middleware takes `req`,
  * `res` and `next`. It returns error or lets the next middleware go.
  * It relies on `passport.authenticate` with default strategy : *jwt*.
  */

  fn.ensureAuthenticated = passport.authenticate('jwt', { session: false });

  /**
  * `isAdmin` internal is a function that checks if current connnected user is
  * an Etherpad instance admin or not. It returns a boolean.
  */

  fn.isAdmin = function (req) {
    var token = req.query.auth_token || req.body.auth_token;
    if (!token) { return false; }
    try {
      var jwt_payload = jwt.verify(token, auth.secret);
      var admin = auth.adminTokens[jwt_payload.login];
      return (admin && (admin.key === jwt_payload.key));
    }
    catch (e) { return false; }
  };

  /**
  * `ensureAdmin` internal is an Express middleware that takes classic `req`,
  * `res` and `next`. It returns an error if the connected user is not
  * an Etherpad instance admin.
  */

  fn.ensureAdmin = function (req, res, next) {
    if (!fn.isAdmin(req)) {
      return fn.denied(res, 'BACKEND.ERROR.AUTHENTICATION.ADMIN');
    } else {
      return next();
    }
  };

  /**
  * `ensureAdminOrSelf` internal Express middleware takes the classic `req`,
  * `res` and `next`. It returns an error if the connected user tries to manage
  * users other than himself and he is not an Etherpad logged admin.
  */

  fn.ensureAdminOrSelf = function (req, res, next) {
    var isAdmin = fn.isAdmin(req);

    var token = (req.body.auth_token || req.query.auth_token);
    var login = req.params.key;
    var u = auth.fn.getUser(token);
    var isSelf = (u && login === u.login);
    if (isSelf) { req.mypadsLogin = u.login; }

    if (!isAdmin && !isSelf) {
      return fn.denied(res, 'BACKEND.ERROR.AUTHENTICATION.DENIED');
    } else {
      return next();
    }
  };

  /**
  * ## Authentication API
  */

  var authAPI = function (app) {
    var authRoute = api.initialRoute + 'auth';

    /**
    * POST method : check, method returning success or error if given *login*
    * and *password* do not match to what is stored into database
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/auth/check
    */

    app.post(authRoute + '/check', fn.ensureAuthenticated,
      function (req, res) {
        auth.fn.localFn(req.body.login, req.body.password, function (err, u) {
          if (err) { return res.status(400).send({ error: err.message }); }
          if (!u) {
            var emsg = 'BACKEND.ERROR.AUTHENTICATION.PASSWORD_INCORRECT';
            return res.status(400).send({ error: emsg });
          }
          res.status(200).send({ success: true });
        });
      }
    );

    /**
    * POST method : login, method returning user object minus password if auth
    * is a success, plus fixes a `login` session.
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/auth/login
    */

    app.post(authRoute + '/login', function (req, res) {
      auth.fn.JWTFn(req, req.body, false, function (err, u, info) {
        if (err) { return res.status(400).send({ error: err.message }); }
        if (!u) { return res.status(400).send({ error: info.message }); }
        if (u.active) {
          var token = {
            login: u.login,
            key: auth.tokens[u.login].key
          };
          return res.status(200).send({
            success: true,
            user: ld.omit(u, 'password'),
            token: jwt.sign(token, auth.secret)
          });
        } else {
          var msg = 'BACKEND.ERROR.AUTHENTICATION.ACTIVATION_NEEDED';
          return fn.denied(res, msg);
        }
      });
    });

    /**
    * GET method : logout, method that destroy current cached token
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/auth/logout
    */

    app.get(authRoute + '/logout', fn.ensureAuthenticated, function (req, res) {
      delete auth.tokens[req.mypadsLogin];
      res.status(200).send({ success: true });
    });

    /**
    * POST method : admin login, method that checks credentials and create
    * admin token in case of success
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/auth/admin/login
    */

    app.post(authRoute + '/admin/login', function (req, res) {
      auth.fn.JWTFn(req, req.body, true, function (err, u, info) {
        if (err) { return res.status(400).send({ error: err.message }); }
        if (!u) { return res.status(400).send({ error: info.message }); }
        var token = {
          login: u.login,
          key: auth.adminTokens[u.login].key
        };
        return res.status(200).send({
          success: true,
          token: jwt.sign(token, auth.secret)
        });
      });
    });

    /**
    * GET method : admin logout, method that destroy current admin token
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/auth/admin/logout
    */

    app.get(authRoute + '/admin/logout', fn.ensureAdmin, function (req, res) {
      delete auth.adminTokens[req.mypadsLogin];
      return res.status(200).send({ success: true });
    });

  };

  /**
  * ## Configuration API
  */

  var configurationAPI = function (app) {
    var confRoute = api.initialRoute + 'configuration';

    /**
    * GET method : get all configuration plus user info if logged, else config
    * public fields.
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/configuration
    */

    app.get(confRoute, function (req, res) {
      var u = auth.fn.getUser(req.query.auth_token);
      var isAdmin = fn.isAdmin(req);
      var action = isAdmin ? 'all' : 'public';
      var value = conf[action]();
      var resp = { value: value };
      resp.auth = (isAdmin ? true : !!u);
      if (u) { resp.user = u; }
      res.send(resp);
    });

    /**
    * GET method : `configuration.get` key
    * Reserved to Etherpad administrators
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/configuration/something
    */

    app.get(confRoute + '/:key', fn.ensureAdmin, function (req, res) {
      var value = conf.get(req.params.key);
      if (ld.isUndefined(value)) {
        return res.status(404).send({
          error: 'BACKEND.ERROR.CONFIGURATION.KEY_NOT_FOUND',
          key: req.params.key
        });
      }
      res.send({ key: req.params.key, value: value });
    });

    /**
    * POST/PUT methods : `configuration.set` key and value on initial
    * Reserved to Etherpad administrators
    *
    * Sample URL for POST:
    * http://etherpad.ndd/mypads/api/configuration
    * for PUT
    * http://etherpad.ndd/mypads/api/configuration/something
    */

    var _set = function (req, res) {
      var key = (req.method === 'POST') ? req.body.key : req.params.key;
      var value = req.body.value;
      var setFn = ld.partial(conf.set, key, value);
      fn.set(setFn, key, value, req, res);
    };

    app.post(confRoute, fn.ensureAdmin, _set);
    app.put(confRoute + '/:key', fn.ensureAdmin, _set);

    /**
    * DELETE method : `configuration.del` key
    * Reserved to Etherpad administrators
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/configuration/something
    */

    app.delete(confRoute + '/:key', fn.ensureAdmin,
      ld.partial(fn.del, conf.del));
  };

  /**
  *  ## User API
  *
  * Most methods need `fn.ensureAdminOrSelf`
  */

  var userAPI = function (app) {
    var userRoute = api.initialRoute + 'user';
    var userlistRoute = api.initialRoute + 'userlist';

    /**
    * GET method : `user.userlist` with crud fixed to *get* and current login.
    * Returns user userlists
    * ensureAuthenticated needed
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/userlist
    */

    app.get(userlistRoute, fn.ensureAuthenticated,
      function (req, res) {
        var opts = { crud: 'get', login: req.mypadsLogin };
        user.userlist(opts, function (err, u) {
          if (err) { return res.status(400).send({ error: err.message }); }
          res.send({ value: u.userlists });
        });
      }
    );

    /**
    * POST method : `user.userlist` creation with crud fixed to *add*, current
    * login and userlist parameters, name and optionnally user logins
    * ensureAuthenticated needed
    *
    * Sample URL :
    * http://etherpad.ndd/mypads/api/userlist
    */

    app.post(userlistRoute, fn.ensureAuthenticated,
      function (req, res) {
        try {
          var users = { absent: [], present: [] };
          var lm = req.body.loginsOrEmails;
          if (lm) { users = user.fn.getIdsFromLoginsOrEmails(lm); }
          var opts = {
            crud: 'add',
            login: req.mypadsLogin,
            name: req.body.name
          };
          if (users.uids) { opts.uids = users.uids; }
          user.userlist(opts, function (err, u) {
            if (err) { return res.status(400).send({ error: err.message }); }
            return res.send({
              success: true,
              value: u.userlists,
              present: users.present,
              absent: users.absent
            });
          });
        }
        catch (e) { return res.status(400).send({ error: e.message }); }
      }
    );

    /**
    * PUT method : `user.userlist` update with crud fixed to *set*, current
    * login, mandatory `ulistid` via request parameter and userlist arguments,
    * `name` or user `logins`
    * ensureAuthenticated needed
    *
    * Sample URL :
    * http://etherpad.ndd/mypads/api/userlist/xxx
    */

    app.put(userlistRoute + '/:key', fn.ensureAuthenticated,
      function (req, res) {
        try {
          var users = { absent: [], present: [] };
          var lm = req.body.loginsOrEmails;
          if (lm) { users = user.fn.getIdsFromLoginsOrEmails(lm); }
          var opts = {
            crud: 'set',
            login: req.mypadsLogin,
            ulistid: req.params.key,
            name: req.body.name
          };
          if (users.uids) { opts.uids = users.uids; }
          user.userlist(opts, function (err, u) {
            if (err) { return res.status(400).send({ error: err.message }); }
            return res.send({
              success: true,
              value: u.userlists,
              present: users.present,
              absent: users.absent
            });
          });
        }
        catch (e) { return res.status(400).send({ error: e.message }); }
      }
    );

    /**
    * DELETE method : `user.userlist` removal with crud fixed to *del*, current
    * login, mandatory `ulistid` via request parameter
    * ensureAuthenticated needed
    *
    * Sample URL :
    * http://etherpad.ndd/mypads/api/userlist/xxx
    */

    app.delete(userlistRoute + '/:key', fn.ensureAuthenticated,
      function (req, res) {
        try {
          var opts = {
            crud: 'del',
            login: req.mypadsLogin,
            ulistid: req.params.key
          };
          user.userlist(opts, function (err, u) {
            if (err) { return res.status(400).send({ error: err.message }); }
            res.send({ success: true, value: u.userlists });
          });
        }
        catch (e) { return res.status(400).send({ error: e.message }); }
      }
    );

    /**
    * GET method : `user.get` login (key)
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/user/someone
    */

    app.get(userRoute + '/:key', fn.ensureAdminOrSelf,
      ld.partial(fn.get, user));

    // `set` for POST and PUT, see below
    var _set = function (req, res) {
      var key;
      var value = req.body;
      var stop;
      if (req.method === 'POST') {
        key = req.body.login;
        if (conf.get('checkMails')) {
          var token = mail.genToken({ login: key, action: 'accountconfirm' });
          var url = conf.get('rootUrl') +
            '/mypads/index.html?/accountconfirm/' + token;
          console.log(url);
          var lang = (function () {
            if (ld.includes(ld.keys(conf.cache.languages), req.body.lang)) {
              return req.body.lang;
            } else {
              return conf.get('defaultLanguage');
            }
          })();
          var subject = fn.mailMessage('ACCOUNT_CONFIRMATION_SUBJECT', {
            title: conf.get('title') });
          var message = fn.mailMessage('ACCOUNT_CONFIRMATION', {
            login: key,
            title: conf.get('title'),
            url: url,
            duration: conf.get('tokenDuration')
          }, lang);
          mail.send(req.body.email, subject, message, function (err) {
            if (err) {
              stop = true;
              return res.status(501).send({ error: err });
            }
          }, lang);
        }
      } else {
        key = req.params.key;
        value.login = req.body.login || key;
        value._id = user.logins[key];
      }
      // Update needed session values
      if (!stop) {
        var u = auth.fn.getUser(req.body.auth_token);
        if (u) {
          auth.tokens[u.login].color = req.body.color || u.color;
          if (!ld.isUndefined(req.body.useLoginAndColorInPads)) {
            auth.tokens[u.login].useLoginAndColorInPads =
              req.body.useLoginAndColorInPads;
          }
        }
        if (fn.isAdmin(req)) {
          user.get(value.login, function (err, u) {
            if (err) { return res.status(400).send({ error: err.message }); }
            ld.assign(u, value);
            var setFn = ld.partial(user.fn.set, u);
            fn.set(setFn, key, u, req, res);
          });
        } else {
          var setFn = ld.partial(user.set, value);
          fn.set(setFn, key, value, req, res);
        }
      }
    };

    /**
    * POST method : `user.set` with user value for user creation
    * Only method without permission verification
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/user
    */

    app.post(userRoute, _set);

    /**
    * PUT method : `user.set` with user key/login plus value for existing user
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/user/someone
    */

    app.put(userRoute + '/:key', fn.ensureAdminOrSelf, _set);

    /**
    * DELETE method : `user.del` with user key/login
    * Destroy session if self account removal
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/user/someone
    */

    app.delete(userRoute + '/:key', fn.ensureAdminOrSelf, function (req, res) {
      var isSelf = (req.params.key === req.mypadsLogin);
      if (isSelf) { delete auth.tokens[req.mypadsLogin]; }
      fn.del(user.del, req, res);
    });

    /**
    * POST method : `user.mark` with user session login, bookmark type and key
    * Only need ensureAuthenticated because use own login for marking
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/usermark
    */

    app.post(userRoute + 'mark', fn.ensureAuthenticated,
      function (req, res) {
        try {
          user.mark(req.mypadsLogin, req.body.type, req.body.key,
            function (err) {
              if (err) { return res.status(404).send({ error: err.message }); }
              res.send({ success: true });
            }
          );
        }
        catch (e) { res.status(400).send({ error: e.message }); }
      }
    );

    /**
    * POST method : special password recovery with mail sending.
    * Need to have the email address into the body
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/passrecover
    */

    app.post(api.initialRoute + 'passrecover', function (req, res) {
      var email = req.body.email;
      var err;
      if (!ld.isEmail(email)) {
        err = 'BACKEND.ERROR.TYPE.MAIL';
        return res.status(400).send({ error: err });
      }
      if (!user.emails[email]) {
        err = 'BACKEND.ERROR.USER.NOT_FOUND';
        return res.status(404).send({ error: err });
      }
      if (conf.get('rootUrl').length === 0) {
        err = 'BACKEND.ERROR.CONFIGURATION.ROOTURL_NOT_CONFIGURED';
        return res.status(501).send({ error: err });
      }
      user.get(email, function (err, u) {
        if (err) { return res.status(400).send({ error: err }); }
        var token = mail.genToken({ login: u.login, action: 'passrecover' });
        console.log(conf.get('rootUrl') + '/mypads/index.html?/passrecover/' +
          token);
        var subject = fn.mailMessage('PASSRECOVER_SUBJECT', {
          title: conf.get('title') }, u.lang);
        var message = fn.mailMessage('PASSRECOVER', {
          login: u.login,
          title: conf.get('title'),
          url: conf.get('rootUrl') + '/mypads/index.html?/passrecover/' + token,
          duration: conf.get('tokenDuration')
        }, u.lang);
        mail.send(u.email, subject, message, function (err) {
          if (err) { return res.status(501).send({ error: err }); }
          return res.send({ success: true });
        });
      });
    });

    /**
    * PUT method : password recovery with token and new password
    * Need to have the login into the body
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/passrecover
    */

    app.put(api.initialRoute + 'passrecover/:token', function (req, res) {
      var val = mail.tokens[req.params.token];
      var err;
      var badLogin = (!val || !val.login || !user.logins[val.login]);
      var badAction = (!val || !val.action || (val.action !== 'passrecover'));
      if (badLogin || badAction) {
        err = 'BACKEND.ERROR.TOKEN.INCORRECT';
        return res.status(400).send({ error: err });
      }
      if (!mail.isValidToken(req.params.token)) {
        err = 'BACKEND.ERROR.TOKEN.EXPIRED';
        return res.status(400).send({ error: err });
      }
      var pass = req.body.password;
      var passC = req.body.passwordConfirm;
      if (!pass || (pass !== passC)) {
        err = 'USER.ERR.PASSWORD_MISMATCH';
        return res.status(400).send({ error: err });
      }
      user.get(val.login, function (err, u) {
        if (err) { return res.status(400).send({ error: err.message }); }
        u.password = pass;
        if (!u.active) { u.active = true; }
        user.set(u, function (err) {
          if (err) { return res.status(400).send({ error: err.message }); }
          res.send({ success: true, login: val.login });
        });
      });
    });

    /**
    * POST method : account confirmation with token on body
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/accountconfirm
    */

    app.post(api.initialRoute + 'accountconfirm', function (req, res) {
      var val = mail.tokens[req.body.token];
      var err;
      if (!val || !val.action || (val.action !== 'accountconfirm')) {
        err = 'BACKEND.ERROR.TOKEN.INCORRECT';
        return res.status(400).send({ error: err });
      }
      if (!mail.isValidToken(req.body.token)) {
        err = 'BACKEND.ERROR.TOKEN.EXPIRED';
        return res.status(400).send({ error: err });
      }
      user.get(val.login, function (err, u) {
        if (err) { return res.status(400).send({ error: err.message }); }
        u.active = true;
        user.fn.set(u, function (err) {
          if (err) { return res.status(400).send({ error: err.message }); }
          res.send({ success: true, login: val.login });
        });
      });
    });

  };

  /**
  * ## Group API
  *
  * All methods except creation need special permissions.
  */

  var groupAPI = function (app) {
    var groupRoute = api.initialRoute + 'group';

    /**
    * GET method : `group.getByUser` via user login. passwords are omitted
    * Returns all groups and pads, filtered from sensitive data.
    *
    * Only for authenticated users.
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/group
    */

    app.get(groupRoute, fn.ensureAuthenticated,
      function (req, res) {
        user.get(req.mypadsLogin, function (err, u) {
          if (err) { return res.status(400).send({ error: err }); }
          try {
            group.getByUser(u, true, function (err, data) {
              if (err) {
                return res.status(404).send({
                  error: err.message
                });
              }
              data.groups = ld.transform(data.groups,
                function (memo, val, key) {
                  memo[key] = ld.omit(val, 'password');
                }
              );
              data.pads = ld.transform(data.pads,
                function (memo, val, key) {
                  memo[key] = ld.omit(val, 'password');
                }
              );
              data.users = ld.transform(data.users, function (memo, val, key) {
                memo[key] = ld.pick(val, '_id', 'login', 'firstname',
                  'lastname', 'email');
              });
              data.admins = ld.transform(data.admins,
                function (memo, val, key) {
                  memo[key] = ld.pick(val, '_id', 'login', 'firstname',
                    'lastname', 'email');
                }
              );
              res.send({ value: data });
            });
          }
          catch (e) {
            res.status(400).send({ error: e.message });
          }
        });
      }
    );

    /**
    * GET method : `group.getWithPads` unique id
    * Returns pads too because usefull for public groups and unauth users.
    *
    * Sample URL:
    * http://etherpad.ndd/mypemailads/api/group/xxxx
    */

    app.get(groupRoute + '/:key', function (req, res) {
      try {
        var key = req.params.key;
        group.getWithPads(key, function (err, g, pads) {
          if (err) {
            return res.status(404).send({ key: key, error: err.message });
          }
          var u = auth.fn.getUser(req.query.auth_token);
          var isAdmin = fn.isAdmin(req);
          var isUser = (u && ld.includes(ld.union(g.admins, g.users), u._id));
          var isAllowedForPublic = (g.visibility === 'public');
          if (isAllowedForPublic && !isAdmin && !isUser) {
            pads = ld.transform(pads, function (memo, p, key) {
              if (!p.visibility || p.visibility === g.visibility) {
                memo[key] = p;
              }
            });
          }
          if (isAdmin || isUser || isAllowedForPublic) {
            return res.send({ key: key, value: g, pads: pads });
          }
          var isPrivate = (g.visibility === 'private');
          if (isPrivate) {
            if (req.query.password) {
              auth.fn.isPasswordValid(g, req.query.password,
                function (err, valid) {
                  if (!err && !valid) {
                    err = { message: 'BACKEND.ERROR.PERMISSION.UNAUTHORIZED' };
                  }
                  if (err) {
                    return res.status(401)
                      .send({ key: key, error: err.message });
                  }
                  if (isPrivate && !isAdmin && !isUser) {
                    pads = ld.transform(pads, function (memo, p, key) {
                      if (!p.visibility || p.visibility === g.visibility) {
                        memo[key] = p;
                      }
                    });
                  }
                  return res.send({ key: key, value: g, pads: pads });
                }
              );
            } else {
              var value = ld.pick(g, 'name', 'visibility');
              return res.send({ key: req.params.key, value: value });
            }
          } else {
            return fn.denied(res, 'BACKEND.ERROR.AUTHENTICATION.DENIED_RECORD');
          }
        });
      }
      catch (e) { res.status(400).send({ error: e.message }); }
    });

    /**
    * `canEdit` is an asynchronous internal group helper to check common
    * permissions for edit methods used here (set && delete ones). It ensures
    * that the current user is either an Etherpad admin or a group admin.
    *
    * It takes the `req` and `res` request and response Express objects, and a
    * `successFn` function, called if the user is allowed. Otherwise, it uses
    * response to return statusCode and Error messages.
    */

    var canEdit = function (req, res, successFn) {
      var isAdmin = fn.isAdmin(req);
      if (isAdmin) { return successFn(); }
      var u = auth.fn.getUser(req.body.auth_token);
      if (!u) {
        return fn.denied(res, 'BACKEND.ERROR.AUTHENTICATION.NOT_AUTH');
      }
      group.get(req.params.key, function (err, g) {
        if (err) { return res.status(400).send({ error: err.message }); }
        var isAllowed = ld.includes(g.admins, auth.tokens[u.login]._id);
        if (isAllowed) {
          return successFn();
        } else {
          return fn.denied(res,
            'BACKEND.ERROR.AUTHENTICATION.DENIED_RECORD_EDIT');
        }
      });
    };

    // `set` for POST and PUT, see below
    var _set = function (req, res) {
      var setFn = ld.partial(group.set, req.body);
      fn.set(setFn, req.body._id, req.body, req, res);
    };

    /**
    * POST method : `group.set` with user value for group creation
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/group
    */

    app.post(groupRoute, function (req, res) {
      var isAdmin = fn.isAdmin(req);
      var u = auth.fn.getUser(req.body.auth_token);
      if (!u && !isAdmin) {
        return fn.denied(res, 'BACKEND.ERROR.AUTHENTICATION.NOT_AUTH');
      }
      if (!isAdmin) { req.body.admin = u._id; }
      _set(req, res);
    });

    /**
    * PUT method : `group.set` with group id plus value for existing group
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/group/xxx
    */

    app.put(groupRoute + '/:key', function (req, res) {
      canEdit(req, res, ld.partial(_set, req, res));
    });

    /**
    * DELETE method : `group.del` with group id
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/group/xxxx
    */

    app.delete(groupRoute + '/:key', function (req, res) {
        canEdit(req, res, ld.partial(fn.del, group.del, req, res));
      }
    );

    /**
    * POST method : `group.inviteOrShare` with gid group id, array of all
    * concerned loginsOrEmails and invite boolean
    * This method is open to all authenticated users.
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/group/invite
    */

    app.post(groupRoute + '/invite', function (req, res) {
      if (!req.body.gid) {
        return res.status(400)
          .send({ error: 'BACKEND.ERROR.TYPE.PARAMS_REQUIRED' });
      }
      req.params.key = req.body.gid;
      var successFn = ld.partial(function (req, res) {
        try {
          group.inviteOrShare(req.body.invite, req.body.gid,
            req.body.loginsOrEmails, function (err, g, uids) {
              if (err) {
                return res.status(401).send({ error: err.message });
              }
              return res.send(ld.assign({ success: true, value: g }, uids));
          });
        }
        catch (e) { res.status(400).send({ error: e.message }); }
      }, req, res);
      canEdit(req, res, successFn);
    });

    /**
    * POST method : `group.resign` with gid group id and current session uid.
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/group/resign
    */

    app.post(groupRoute + '/resign', fn.ensureAuthenticated,
      function (req, res) {
        try {
          group.resign(req.body.gid, auth.tokens[req.mypadsLogin]._id,
            function (err, g) {
              if (err) { return res.status(400).send({ error: err.message }); }
              return res.send({ success: true, value: g });
            }
          );
        }
        catch (e) { return res.status(400).send({ error: e.message }); }
      }
    );

  };

  /**
  * ## Pad API
  *
  * All methods needs special permissions
  */

  var padAPI = function (app) {
    var padRoute = api.initialRoute + 'pad';

    /**
    * `canAct` is a pad internal fucntion that checks permissions to allow or
    * not interaction with the pad object.
    *
    * It takes :
    *
    * - `edit` boolean, if the pad should be only read or updated
    * - `successFn` functional, to be called if allowed, that takes req, res
    *   and value
    * - classic `req`uest and `res`ponse Express objects
    */

    var canAct = function (edit, successFn, req, res) {
      pad.get(req.params.key, function (err, p) {
        var key = req.params.key;
        if (err) { return res.status(404).send({ error: err.message }); }
        var isAdmin = fn.isAdmin(req);
        if (isAdmin) { return successFn(req, res, p); }
        if (!edit && (p.visibility === 'public')) {
          return successFn(req, res, p);
        }
        if (!edit && (p.visibility === 'private')) {
          auth.fn.isPasswordValid(p, req.query.password, function (err, valid) {
            if (!err && !valid) {
              err = { message: 'BACKEND.ERROR.PERMISSION.UNAUTHORIZED' };
            }
            if (err) {
              return res.status(401).send({ key: key, error: err.message });
            }
            return successFn(req, res, p);
          });
        } else {
          group.get(p.group, function (err, g) {
            if (err) { return res.status(400).send({ error: err.message }); }
            if (!edit && (g.visibility === 'public')) {
              return successFn(req, res, p);
            } else if (!edit && (g.visibility === 'private')) {
              auth.fn.isPasswordValid(g, req.query.password,
                function (err, valid) {
                  if (!err && !valid) {
                    err = { message: 'BACKEND.ERROR.PERMISSION.UNAUTHORIZED' };
                  }
                  if (err) {
                    return res.status(401)
                      .send({ key: key, error: err.message });
                  }
                  return successFn(req, res, p);
                }
              );
            } else {
              var token = req.body.auth_token || req.query.auth_token;
              var u = auth.fn.getUser(token);
              if (!u) {
                return fn.denied(res, 'BACKEND.ERROR.AUTHENTICATION.MUST_BE');
              }
              var users = edit ? g.admins : ld.union(g.admins, g.users);
              var uid = auth.tokens[u.login]._id;
              var isAllowed = ld.includes(users, uid);
              if (isAllowed) {
                return successFn(req, res, p);
              } else {
                var msg = edit ? 'DENIED_RECORD_EDIT' : 'DENIED_RECORD';
                return fn.denied(res, 'BACKEND.ERROR.AUTHENTICATION.' + msg);
              }
            }
          });
        }
      });
    };

    /**
    * GET method : `pad.get` unique id
    * Only for group admin or users, and global admin
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/pad/xxxx
    */

    // TODO: + admin, no pass needed...
    app.get(padRoute + '/:key',
      ld.partial(canAct, false, function (req, res, val) {
        return res.send({ key: req.params.key, value: val });
      }));

    // `set` for POST and PUT, see below
    var _set = function (req, res) {
      var setFn = ld.partial(pad.set, req.body);
      fn.set(setFn, req.body._id, req.body, req, res);
    };

    /**
    * POST method : `pad.set` with user value for pad creation
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/pad
    */

    app.post(padRoute, function (req, res) {
      var isAdmin = fn.isAdmin(req);
      var u;
      if (!isAdmin) { u = auth.fn.getUser(req.body.auth_token); }
      if (!isAdmin && !u) {
        return fn.denied(res, 'BACKEND.ERROR.AUTHENTICATION.NOT_AUTH');
      }
      _set(req, res);
    });

    /**
    * PUT method : `pad.set` with group id plus value for existing pad
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/pad/xxx
    */

    app.put(padRoute + '/:key', ld.partial(canAct, true, _set));

    /**
    * DELETE method : `pad.del` with pad id
    *
    * Sample URL:
    * http://etherpad.ndd/mypads/api/pad/xxxx
    */

    app.delete(padRoute + '/:key', function (req, res) {
      var isAdmin = fn.isAdmin(req);
      var u;
      if (!isAdmin) { u = auth.fn.getUser(req.body.auth_token); }
      if (!isAdmin && !u) {
        return fn.denied(res, 'BACKEND.ERROR.AUTHENTICATION.NOT_AUTH');
      }
      canAct(true, ld.partial(fn.del, pad.del), req, res);
    });

  };

  return api;

}).call(this);


text:
module Footballify

  class Team < ActiveRecord::Base

    attr_accessible :name

    belongs_to :championship
    has_many :team1_scores, class_name: 'Score', foreign_key: :team1_id
    has_many :team2_scores, class_name: 'Score', foreign_key: :team2_id

    validates :name, presence: true, length: { maximum: 100 }
    validates :championship, presence: true

  end

end


text:
package de.nx42.maps4cim.map.relief;

import static de.nx42.maps4cim.util.math.MathExt.rounds;

import java.io.File;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;

import org.slf4j.LoggerFactory;

import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams;
import com.google.common.io.Files;

import de.nx42.maps4cim.config.Config;
import de.nx42.maps4cim.config.relief.SrtmDef;
import de.nx42.maps4cim.map.ReliefMap;
import de.nx42.maps4cim.map.ex.ReliefProcessingException;
import de.nx42.maps4cim.map.relief.srtm.TileDownloadUSGS;
import de.nx42.maps4cim.util.Compression;
import de.nx42.maps4cim.util.arr2d.Arrays2D;
import de.nx42.maps4cim.util.arr2d.GapInterpolator;
import de.nx42.maps4cim.util.arr2d.ImageJInterpolation;
import de.nx42.maps4cim.util.gis.Area;
import de.nx42.maps4cim.util.math.MathExt;

/**
 *
 * @author Sebastian Straub <sebastian-straub@gmx.net>
 */
public class SRTM extends ReliefMap {

    /*
     * SRTM spec:
     * - The names of individual data tiles refer to the longitude and latitude
     *   of the lower-left (southwest) corner of the tile.
     * - To be more exact, these coordinates refer to the geometric center
     *   of the lower left sample, which in the case of SRTM3 data will be about
     *   90 meters in extent.
     * - SRTM3 data are sampled at three arc-seconds and contain 1201 lines with
     *   each 1201 samples
     * - The rows at the north and south edges as well as the columns at the
     *   east and west edges of each cell overlap and are identical to the edge
     *   rows and columns in the adjacent cell.
     *
     * File Format:
     * - The DEM is provided as 16-bit signed integer data in a simple binary
     *   raster. There are no header or trailer bytes embedded in the file.
     * - Byte order is Motorola ("big-endian") standard with the most
     *   significant byte first.
     * - Since they are signed integers elevations can range from -32767 to
     *   32767 meters, encompassing the range of elevation to be found on the
     *   Earth.
     * - Voids are flagged with the value -32768
     *
     * Source: http://dds.cr.usgs.gov/srtm/version2_1/Documentation/SRTM_Topo.pdf
     *
     */

    private static org.slf4j.Logger log = LoggerFactory.getLogger(SRTM.class);

    public static final int srtm1length = 3601;
    public static final int srtm3length = 1201;
    public static final int srtm1maxIndex = srtm1length - 1;
    public static final int srtm3maxIndex = srtm3length - 1;
    public static short gap = Short.MIN_VALUE;

    protected static final GapInterpolator gip = new GapInterpolator(gap);

    protected Area bounds;
    protected boolean heightOffsetAuto = true;
    protected float heightOffset = 0;
    protected boolean heightScaleAuto = true;
    protected float heightScale = 1.0f;
    // currently only srtm3 accepted
    protected int srtmLength = srtm3length;
    protected int srtmMaxIndex = srtm3maxIndex;

    public SRTM(Config conf) {
        this((SrtmDef) conf.getReliefTrans(), Area.of(conf.getBoundsTrans()));
    }

    public SRTM(SrtmDef def, Area bounds) {
        log.debug("Using SRTM as source for the map's relief");

        // read configuration settings
        this.bounds = bounds;

        // height offset
        this.heightOffsetAuto = def.isHeightOffsetAuto();
        if(heightOffsetAuto) {
            this.heightOffset = 32767;  // max value -> reduce later
        } else {
            this.heightOffset = (float) def.getHeightOffset();
        }

        // height scale
        this.heightScaleAuto = def.isHeighScaleAuto();
        if(heightScaleAuto) {
            this.heightScale = (float) (8.0 / bounds.getWidthKm());
        } else {
            this.heightScale = (float) def.getHeightScale();
        }

    }

    @Override
    public float[][] generateRelief() throws ReliefProcessingException {
        try {
            return fromBounds();
        } catch (SocketTimeoutException e) {
            log.error("Could not download the required source data, the connection timed out. Usually, this is a problem with your network connection or firewall configuration.");
            throw new ReliefProcessingException(e);
        } catch (UnknownHostException e) {
            log.error("The URL of the SRTM-Server {} could not be resolved. Are you connected to the internet?", e.getMessage());
            throw new ReliefProcessingException(e);
        } catch (IOException e) {
            log.error("I/O Exception while processing the relief.", e);
            throw new ReliefProcessingException(e);
        }
    }

    protected float[][] fromBounds() throws IOException, SocketTimeoutException, UnknownHostException {

        // get some basic metadata and log a note
        double worldWidthKM = bounds.getWidthKm();
        double worldHeightKM = bounds.getHeightKm();

        log.info("The relief map will be generated for an area of {}x{}km, " +
        		"with the center at ({}). The virtual zero height {} and all " +
        		"elevations are scaled {}.",
        		rounds(worldWidthKM), rounds(worldHeightKM), bounds.getCenter().toString(),
        		heightOffsetAuto ?
        		        "will be set to the highest possible value" :
        		        "is set to " + heightOffset,
        		!MathExt.equalsDouble(heightScale, 1.0, 0.001) ?
        		        "by factor " + rounds(heightScale) :
        		        "1:1");

        // keep ratio: do not stretch the map!
        double widthToHeight = worldWidthKM / worldHeightKM;
        int validMapWidth = widthToHeight >= 1.0 ? edgeLength : (int) Math.round(edgeLength * widthToHeight);
        int validMapHeight = widthToHeight <= 1.0 ? edgeLength : (int) Math.round(edgeLength / widthToHeight);

        // valid map indices
        int minX = (edgeLength - validMapWidth) / 2;
        int maxX = validMapWidth + minX;
        int minY = (edgeLength - validMapHeight) / 2;
        int maxY = validMapHeight + minY;

        // get source data (cache or download)
        log.debug("Retrieving SRTM data.");
        short[][] srtm = retrieveSRTMdata(bounds);
        int srtmHeight = srtm.length;
        int srtmWidth = srtm[0].length;

        // rotate, fill gaps and convert to basic 2d-float-array
        float[][] srtmClean = new float[srtmHeight][srtmWidth];
        for (int y = 0; y < srtm.length; y++) {
            for (int x = 0; x < srtm[y].length; x++) {
                float val = srtm[srtm.length-1-y][x];
                if(val == gap) {
                    val = gip.star(srtm, x, srtm.length-1-y);
                }
                if(val == 0) {
                    // drown the water ;)
                    val = -40;
                }
                srtmClean[y][x] = val;
            }
        }

        // calcualte bounds
        int srtmLatMin = (int) Math.floor(bounds.getMinLat());
        int srtmLatMax = (int) Math.ceil(bounds.getMaxLat());
        int srtmLonMin = (int) Math.floor(bounds.getMinLon());
        int srtmLonMax = (int) Math.ceil(bounds.getMaxLon());
        int srtmLatSize = srtmLatMax - srtmLatMin;
        int srtmLonSize = srtmLonMax - srtmLonMin;

        float minLat = (float) ((Math.abs(bounds.getMinLat() - srtmLatMin) / srtmLatSize) * srtmHeight);
        float maxLat = (float) ((Math.abs(bounds.getMaxLat() - srtmLatMin) / srtmLatSize) * srtmHeight);
        float minLon = (float) ((Math.abs(bounds.getMinLon() - srtmLonMin) / srtmLonSize) * srtmWidth);
        float maxLon = (float) ((Math.abs(bounds.getMaxLon() - srtmLonMin) / srtmLonSize) * srtmWidth);

        // interpolate with ImageJ
        log.debug("SRTM data will be cropped and scaled to correct size using bicubic interpolation");
        float[][] scaled = ImageJInterpolation.cropAndResize(srtmClean, validMapWidth, validMapHeight,
                minLon, minLat, maxLon, maxLat);

        log.debug("Final conversion and filtering of scaled SRTM data");
        float[][] heightmap = new float[edgeLength][edgeLength];
        for (int y = 0; y < scaled.length; y++) {
            for (int x = 0; x < scaled.length; x++) {
                if(x >= minX && x < maxX && y >= minY && y < maxY) {
                    float val = scaled[y-minY][x-minX];
                    if(heightOffsetAuto && val>=0 && val < this.heightOffset) {
                        this.heightOffset = val;
                    }
                    heightmap[y][x] = val;
                }
            }
        }

        // apply height offset and scale (in-place)
        if(heightOffsetAuto) {
        	if(heightOffset < 1) {
        		heightOffset = 0;
        	}
            log.debug("The virtual zero height has been set to {}", heightOffset);
        }

        if(heightOffset != 0.0f || heightScale != 1.0f) {
        	for (int y = 0; y < heightmap.length; y++) {
                for (int x = 0; x < heightmap.length; x++) {
                    if(heightmap[y][x] > 0) {
                        heightmap[y][x] = (heightmap[y][x] - heightOffset) * heightScale;
                    }
                }
            }
        }

        return heightmap;
    }

    // helpers

    protected float getValue(short[][] srtm, int x, int y) {
        if(srtm[srtmMaxIndex-y][x] < -50)
            return 0;
        return (srtm[srtmMaxIndex-y][x] - heightOffset) * heightScale;
    }

	protected short[][] retrieveSRTMdata(Area ar) throws SocketTimeoutException, IOException, UnknownHostException {
		// get source
	    TileDownloadUSGS td = new TileDownloadUSGS();
		File[][] files = td.getTiles(ar);

		// transform to single short array
		if(files.length == 1 && files[0].length == 1) {
			// just one tile -> return
			byte[] rawTile = readArchiveSRTM(files[0][0]);
			return getNativeSRTM(rawTile);
		} else {
			// multiple tiles, need to be combined
		    log.debug("combining {} tiles.", files.length * files[0].length);
			short[][][][] source = unpackSRTMTiles(files);
			return Arrays2D.combine(source, 1, false);
		}
	}

	protected short[][][][] unpackSRTMTiles(File[][] files) throws IOException {

		short[][][][] unpacked = new short[files.length][files[0].length][srtmLength][srtmLength];

		for (int y = 0; y < files.length; y++) {
			for (int x = 0; x < files[y].length; x++) {
				byte[] rawTile = readArchiveSRTM(files[files.length - 1 - y][x]);
				short[][] srtm = getNativeSRTM(rawTile);
				unpacked[y][x] = srtm;
			}
		}

		return unpacked;
	}

    protected short[][] getNativeSRTM(File input) throws IOException {
        byte[] raw = Files.toByteArray(input);
        return getNativeSRTM(raw);
    }

    protected short[][] getNativeSRTM(byte[] input) throws IOException {
        if(input == null || input.length == 0) {
            return getWaterSRTMTile();
        }

        ByteArrayDataInput badi = ByteStreams.newDataInput(input);

        // write native srtm values in 16bit signed integer array
        short[][] srtm = new short[srtmLength][srtmLength];
        for (int y = 0; y < srtmLength; y++) {
            for (int x = 0; x < srtmLength; x++) {
                // convert the floats (meter) to integers (millimeter)
                srtm[y][x] = badi.readShort();
            }
        }

        return srtm;
    }

    protected static byte[] readArchiveSRTM(File zipFile) throws IOException {
        if(zipFile == null || !zipFile.exists()) {
            return null;
        }
        return Compression.readFirstZipEntry(zipFile);
    }

    protected short[][] getFlatSRTMTile() {
        return getEmptySRTMTile((short) 1);
    }

    protected short[][] getWaterSRTMTile() {
        return getEmptySRTMTile((short) -40);
    }

    protected short[][] getEmptySRTMTile(short value) {
        short[][] srtm = new short[srtmLength][srtmLength];
        for (int y = 0; y < srtmLength; y++) {
            for (int x = 0; x < srtmLength; x++) {
                srtm[y][x] = value;
            }
        }
        return srtm;
    }

}


text:
require 'spec_helper'

class Stubba
  include Redistry::List
end

describe "#list" do
  let(:klass) { Stubba }

  context "without specified class" do
    before do
      klass.send(:list, :items)
    end

    describe "#items" do

      describe "#klass" do
        it "should be parent class" do
          klass.items.klass.should == klass
        end
      end

      describe "#key" do
        it "should be <class>-<items_name>" do
          klass.items.key.should == "#{klass.name}-items"
        end
      end

      describe "#all" do
        context "when empty" do
          it "should return []" do
            klass.items.all.should == []
          end
        end

        context "when not empty" do
          before do
            @objs = [
              {"hello" => "world"},
              {"hello2" => "world2"} ]
            klass.items.add(@objs)
          end

          after do
            klass.items.clear
          end

          it "should return objects" do
            klass.items.all.should == @objs
          end
        end
      end

      describe "#add" do
        context "with one obj" do
          before do
            @obj = {"hello" => "world"}
          end

          it "should left push serialized obj onto Redis items" do
            Redistry.client.should_receive(:lpush).with(klass.items.key,
              @obj.to_json)
            klass.items.add(@obj)
          end
        end

        context "with multiple objs" do
          before do
            @objs = [
              {"hello" => "world"},
              {"hello2" => "world2"} ]
          end

          it "should left push each serialized obj onto Redis items" do
            @objs.each do |obj|
              Redistry.client.should_receive(:lpush).with(klass.items.key,
                obj.to_json)
            end
            klass.items.add(@objs)
          end
        end
      end

      describe "#clear" do
        it "should call DEL on Redis key" do
          Redistry.client.should_receive(:del).with(klass.items.key)
          klass.items.clear
        end
      end
    end

    context "with specified class" do
      before do
        klass.send(:list, :items, :class => Hash)
      end

      describe "#klass" do
        it "should use specified class" do
          klass.items.klass.should == Hash
        end
      end
    end
  end

end


text:
package be.cegeka.batchers.taxcalculator.application.config;

import be.cegeka.batchers.taxcalculator.application.ApplicationInitializer;
import be.cegeka.batchers.taxcalculator.application.domain.generation.EmployeeGenerator;
import be.cegeka.batchers.taxcalculator.infrastructure.config.PersistenceConfig;
import be.cegeka.batchers.taxcalculator.infrastructure.config.PropertyPlaceHolderConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.*;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

@Configuration
@EnableTransactionManagement
@Import({PersistenceConfig.class, PropertyPlaceHolderConfig.class})
@ComponentScan(basePackages = {"be.cegeka.batchers.taxcalculator.application"})
@PropertySource("classpath:taxcalculator-application.properties")
public class EmployeeGeneratorConfig {
    public static final String JNDI_SMTP_USERNAME = "java:comp/env/smtp_username";
    public static final String JNDI_SMTP_PASSWORD = "java:comp/env/smtp_password";
    public static final String JNDI_SMTP_PORT = "java:comp/env/smtp_port";
    public static final String JNDI_SMTP_SERVER = "java:comp/env/smtp_server";

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

    @Autowired
    protected EmployeeGenerator employeeGenerator;

    @Bean
    @Profile("!remotePartitioningSlave")
    public ApplicationInitializer applicationInitializer() {
        ApplicationInitializer applicationInitializer = new ApplicationInitializer();
        applicationInitializer.setGenerateEmployees(true);
        applicationInitializer.setEmployeeGenerator(employeeGenerator);
        return applicationInitializer;
    }

    @Bean
    public String smtp_username() {
        return lookupValue(JNDI_SMTP_USERNAME);
    }

    @Bean
    public String smtp_password() {
        return lookupValue(JNDI_SMTP_PASSWORD);
    }

    @Bean
    public String smtp_port() {
        return lookupValue(JNDI_SMTP_PORT);
    }

    @Bean
    public String smtp_server() {
        return lookupValue(JNDI_SMTP_SERVER);
    }

    private String lookupValue(String key) {
        try {
            Context context = new InitialContext();
            return (String) context.lookup(key);
        } catch (NamingException e) {
            LOG.error("Value for {} is not defined in context.xml of your server", key);
        }
        return null;
    }

}


text:
using namespace Toast;

static BuiltInAccelerometer *accel;

void tick_itf_accel() {
	Concurrent::IPCMutex *mtx = Memory::shared_mutex()->onboard_accel;
	Memory::Shared::IO::OnboardAccel *mem = Memory::shared()->onboard_accel();
	MTX_LOCK(mtx, 0);
	if (mem->get_init()) {
		if (!mem->get_bootstrap()) {
			accel = new BuiltInAccelerometer();
			mem->set_bootstrap(true);
		}
		if (mem->get_range_update()) {
			Memory::Shared::IO::AccelRange _range = mem->get_range();
			accel->SetRange((Accelerometer::Range)(int)_range);
			mem->set_range_update(false);
		}
		mem->set_x(accel->GetX());
		mem->set_y(accel->GetY());
		mem->set_z(accel->GetZ());
	}
	MTX_UNLOCK(mtx, 0);
}


text:
package org.kie.server.api.model.cases;

import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "case-role-assignment")
public class CaseRoleAssignment {

    @XmlElement(name = "name")
    private String name;
    @XmlElement(name = "users")
    private List<String> users;
    @XmlElement(name = "groups")
    private List<String> groups;

    public CaseRoleAssignment() {

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<String> getUsers() {
        return users;
    }

    public void setUsers(List<String> users) {
        this.users = users;
    }

    public List<String> getGroups() {
        return groups;
    }

    public void setGroups(List<String> groups) {
        this.groups = groups;
    }

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {

        private CaseRoleAssignment adHocFragment = new CaseRoleAssignment();

        public CaseRoleAssignment build() {
            return adHocFragment;
        }

        public Builder users(List<String> users) {
            adHocFragment.setUsers(users);
            return this;
        }

        public Builder groups(List<String> groups) {
            adHocFragment.setGroups(groups);
            return this;
        }

        public Builder name(String name) {
            adHocFragment.setName(name);
            return this;
        }
    }

    @Override
    public String toString() {
        return "CaseRoleAssignment{" +
                "name='" + name + '\'' +
                ", users=" + users +
                ", groups=" + groups +
                '}';
    }
}


text:
package info.fotm.domain

case class CharacterId(name: String, realmSlug: String)


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2018.06.05 at 08:50:12 PM SAMT
//

package ru.fsrar.wegais.repinformf1reg;

import javax.xml.bind.annotation.XmlRegistry;

/**
 * This object contains factory methods for each
 * Java content interface and Java element interface
 * generated in the ru.fsrar.wegais.repinformf1reg package.
 *
An ObjectFactory allows you to programatically
 * construct new instances of the Java representation
 * for XML content. The Java representation of XML
 * content can consist of schema derived interfaces
 * and classes representing the binding of schema
 * type definitions, element declarations and model
 * groups.  Factory methods for each of these are
 * provided in this class.
 *
 */
@XmlRegistry
public class ObjectFactory {

    /**
     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: ru.fsrar.wegais.repinformf1reg
     *
     */
    public ObjectFactory() {
    }

    /**
     * Create an instance of {@link RepPIInformF1RegType }
     *
     */
    public RepPIInformF1RegType createRepPIInformF1RegType() {
        return new RepPIInformF1RegType();
    }

    /**
     * Create an instance of {@link InformF1PositionType }
     *
     */
    public InformF1PositionType createInformF1PositionType() {
        return new InformF1PositionType();
    }

    /**
     * Create an instance of {@link RepPIInformF1RegType.Header }
     *
     */
    public RepPIInformF1RegType.Header createRepPIInformF1RegTypeHeader() {
        return new RepPIInformF1RegType.Header();
    }

    /**
     * Create an instance of {@link RepPIInformF1RegType.Content }
     *
     */
    public RepPIInformF1RegType.Content createRepPIInformF1RegTypeContent() {
        return new RepPIInformF1RegType.Content();
    }

}


text:
<?php

namespace Drupal\Tests\ga;

use Drupal\ga\AnalyticsCommand\PrioritizedTrait;
use Drupal\ga\AnalyticsCommand\SettingItemInterface;

/**
 * Simple command for testing.
 */
class BasicCommand implements SettingItemInterface {
  use PrioritizedTrait;

  protected $command;

  /**
   * BasicCommand constructor.
   *
   * @param string $command
   *   Command name.
   */
  public function __construct($command) {
    $this->command = $command;
  }

  /**
   * {@inheritdoc}
   */
  public function getSettingCommand() {
    return [$this->command];
  }

}


text:
<?php

namespace Drupal\Tests\simpletest\FunctionalJavascript;

use Drupal\FunctionalJavascriptTests\JavascriptTestBase;

/**
 * Tests if we can execute JavaScript in the browser.
 *
 * @group javascript
 */
class BrowserWithJavascriptTest extends JavascriptTestBase {

  public function testJavascript() {
    $this->drupalGet('<front>');
    $session = $this->getSession();

    $session->resizeWindow(400, 300);
    $javascript = <<<JS
    (function(){
        var w = window,
        d = document,
        e = d.documentElement,
        g = d.getElementsByTagName('body')[0],
        x = w.innerWidth || e.clientWidth || g.clientWidth,
        y = w.innerHeight || e.clientHeight|| g.clientHeight;
        return x == 400 && y == 300;
    }());
JS;
    $this->assertJsCondition($javascript);
  }

  public function testAssertJsCondition() {
    $this->drupalGet('<front>');
    $session = $this->getSession();

    $session->resizeWindow(500, 300);
    $javascript = <<<JS
    (function(){
        var w = window,
        d = document,
        e = d.documentElement,
        g = d.getElementsByTagName('body')[0],
        x = w.innerWidth || e.clientWidth || g.clientWidth,
        y = w.innerHeight || e.clientHeight|| g.clientHeight;
        return x == 400 && y == 300;
    }());
JS;

    // We expected the following assertion to fail because the window has been
    // re-sized to have a width of 500 not 400.
    $this->setExpectedException(\PHPUnit_Framework_AssertionFailedError::class);
    $this->assertJsCondition($javascript, 100);
  }

}


text:
import { Engine } from "./references";
import tl = require('vsts-task-lib');

class Main{
    run(){
        // let webServiceUrl = tl.getInput('webserviceUrl', true);
        let httpVerb = tl.getInput('httpVerb', true);
        let body = tl.getInput('body', false);

        let saveResponseToFile = tl.getBoolInput('saveResponseToFile', false);
        let outputFilePath:string;
        if(saveResponseToFile){
            outputFilePath = tl.getPathInput("outputFilePath", false);
        }

        let allowInvalidSSLCertificate = tl.getBoolInput('allowInvalidSSLCertificate', true)
        let webServiceEndpoint = tl.getInput('webserviceEndpoint', true);
        let relativeUrl = tl.getInput('relativeUrl', false);
        let webServiceEndpointUrl = tl.getEndpointUrl(webServiceEndpoint, false);
        let webServiceEndpointUsername = tl.getEndpointAuthorizationParameter(webServiceEndpoint, "username", true);
        let webServiceEndpointPassword = tl.getEndpointAuthorizationParameter(webServiceEndpoint, "password", true);
        let useBasicAuthentication = false;
        if(webServiceEndpointUsername != null || webServiceEndpointPassword != null){
            useBasicAuthentication = true;
            if(webServiceEndpointUsername == null){
                // PAT is set into password var
                webServiceEndpointUsername = "";
            }
        }

        let finalUrl = webServiceEndpointUrl;
        if(relativeUrl != null){
            finalUrl = finalUrl.concat(relativeUrl);
        }

        let timeout = tl.getInput('timeout', false);
        let timeoutValue:number;
        if(timeout == null){
            timeoutValue = 120000; // default timeout set to 2 minutes
        }
        else{
            timeoutValue = parseInt(timeout);
        }

        let contentType = tl.getInput('contentType', true);

        let headers = tl.getInput('headers', false);

        // This might throw if invalid JSON.
        try {
            headers = JSON.parse(headers);
        } catch (e) {
            throw new Error("Invalid headers JSON format.");
        }

        new Engine.RestCall(saveResponseToFile, outputFilePath).call(finalUrl, httpVerb, body, useBasicAuthentication, webServiceEndpointUsername, webServiceEndpointPassword, contentType, timeoutValue, allowInvalidSSLCertificate, headers);
    }
}

new Main().run();


text:
import { ReactNode } from 'react'
import NextLink from 'next/link'
import { Link, LinkProps, SimpleGrid, Text, Icon } from '@chakra-ui/react'
import { IoChevronBack, IoChevronForward } from 'react-icons/io5'
import { RouteItem } from '@utils/getRouteContext'

interface IPaginationLinkProps extends LinkProps {
  label: string
  href: string
  children: ReactNode
}

export const PaginationLink = (props: IPaginationLinkProps) => {
  const { label, href, children, ...rest } = props

  return (
    <NextLink href={href} passHref>
      <Link
        _hover={{
          textDecor: 'none'
        }}
        flex='1'
        borderRadius='md'
        {...rest}
      >
        <Text fontSize='sm' px='2'>
          {label}
        </Text>
        <Text mt='1' fontSize='lg' fontWeight='bold' color='red.400'>
          {children}
        </Text>
      </Link>
    </NextLink>
  )
}

interface IPaginationProps {
  previous: RouteItem
  next: RouteItem
}

export const Pagination = ({ previous, next, ...rest }: IPaginationProps) => {
  return (
    <SimpleGrid
      as='nav'
      aria-label='Pagination'
      spacing='40px'
      my='64px'
      columns={2}
      {...rest}
    >
      {previous
        ? (
          <PaginationLink
            textAlign='left'
            label='Previous'
            href={previous.path}
            rel='prev'
          >
            <Icon as={IoChevronBack} mr='1' fontSize='1.2em' />
            {previous.title}
          </PaginationLink>
          )
        :

      }
      {next
        ? (
            <PaginationLink
              textAlign='right'
              label='Next'
              href={next.path}
              rel='next'
            >
              {next.title}
              <Icon as={IoChevronForward} ml='1' fontSize='1.2em' />
            </PaginationLink>
          )
        :

      }
    </SimpleGrid>
  )
}

export default Pagination


text:
function kern = ndsimKernExpandParam(kern, params)

% NDSIMKERNEXPANDPARAM Create kernel structure from NDSIM kernel's parameters.
% FORMAT
% DESC returns a single input motif kernel structure with zero
% decay, filled with the
% parameters in the given vector. This is used as a helper function to
% enable parameters to be optimised in, for example, the NETLAB
% optimisation functions.
% ARG kern : the kernel structure in which the parameters are to be
% placed.
% ARG param : vector of parameters which are to be placed in the
% kernel structure.
% RETURN kern : kernel structure with the given parameters in the
% relevant locations.
%
% SEEALSO : ndsimKernParamInit, ndsimKernExtractParam, kernExpandParam
%
% COPYRIGHT : Neil D. Lawrence, 2006
%
% COPYRIGHT : Jaakko Peltonen, 2011

% GPMAT

kern.inverseWidth = params(1);
%fprintf(1,'NDSIM kern.inverseWidth=%f\n',kern.inverseWidth);

if isfield(kern, 'isNegativeS') && kern.isNegativeS
  kern.sensitivity = params(2);
  kern.variance = kern.sensitivity*kern.sensitivity;
else
  kern.variance = params(2);
end
if isfield(kern, 'gaussianInitial') && kern.gaussianInitial,
  kern.initialVariance = params(3);
end


text:
.remote_needs_data {
  border: 5px palevioletred solid;
  background: whitesmoke;
  margin: 0px;
  padding: 0px 10px 0px 10px;
  position: relative; }
  .remote_needs_data .close {
    background: palevioletred;
    border-top: 1px gainsboro solid;
    border-left: 1px gainsboro solid;
    border-bottom: 1px grey solid;
    border-right: 1px grey solid;
    color: navy;
    cursor: pointer;
    height: 16px;
    margin: 3px;
    position: absolute;
    right: 0px;
    text-align: center;
    top: 0px;
    width: 17px; }