text:
namespace android.webkit
{
	[global::MonoJavaBridge.JavaClass()]
	public sealed partial class URLUtil : java.lang.Object
	{
		internal new static global::MonoJavaBridge.JniGlobalHandle staticClass;
		internal URLUtil(global::MonoJavaBridge.JNIEnv @__env) : base(@__env)
		{
		}
		private static global::MonoJavaBridge.MethodId _m0;
		public static byte[] decode(byte[] arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m0.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m0 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "decode", "([B)[B");
			return global::MonoJavaBridge.JavaBridge.WrapJavaArrayObject<byte>(@__env.CallStaticObjectMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m0, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as byte[];
		}
		private static global::MonoJavaBridge.MethodId _m1;
		public static global::java.lang.String guessUrl(java.lang.String arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m1.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m1 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "guessUrl", "(Ljava/lang/String;)Ljava/lang/String;");
			return global::MonoJavaBridge.JavaBridge.WrapJavaObjectSealedClass<java.lang.String>(@__env.CallStaticObjectMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m1, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as java.lang.String;
		}
		private static global::MonoJavaBridge.MethodId _m2;
		public static global::java.lang.String composeSearchUrl(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m2.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m2 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "composeSearchUrl", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;");
			return global::MonoJavaBridge.JavaBridge.WrapJavaObjectSealedClass<java.lang.String>(@__env.CallStaticObjectMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m2, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2))) as java.lang.String;
		}
		private static global::MonoJavaBridge.MethodId _m3;
		public static bool isAssetUrl(java.lang.String arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m3.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m3 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "isAssetUrl", "(Ljava/lang/String;)Z");
			return @__env.CallStaticBooleanMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m3, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m4;
		public static bool isCookielessProxyUrl(java.lang.String arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m4.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m4 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "isCookielessProxyUrl", "(Ljava/lang/String;)Z");
			return @__env.CallStaticBooleanMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m4, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m5;
		public static bool isFileUrl(java.lang.String arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m5.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m5 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "isFileUrl", "(Ljava/lang/String;)Z");
			return @__env.CallStaticBooleanMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m5, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m6;
		public static bool isAboutUrl(java.lang.String arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m6.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m6 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "isAboutUrl", "(Ljava/lang/String;)Z");
			return @__env.CallStaticBooleanMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m6, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m7;
		public static bool isDataUrl(java.lang.String arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m7.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m7 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "isDataUrl", "(Ljava/lang/String;)Z");
			return @__env.CallStaticBooleanMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m7, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m8;
		public static bool isJavaScriptUrl(java.lang.String arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m8.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m8 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "isJavaScriptUrl", "(Ljava/lang/String;)Z");
			return @__env.CallStaticBooleanMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m8, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m9;
		public static bool isHttpUrl(java.lang.String arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m9.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m9 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "isHttpUrl", "(Ljava/lang/String;)Z");
			return @__env.CallStaticBooleanMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m9, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m10;
		public static bool isHttpsUrl(java.lang.String arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m10.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m10 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "isHttpsUrl", "(Ljava/lang/String;)Z");
			return @__env.CallStaticBooleanMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m10, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m11;
		public static bool isNetworkUrl(java.lang.String arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m11.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m11 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "isNetworkUrl", "(Ljava/lang/String;)Z");
			return @__env.CallStaticBooleanMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m11, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m12;
		public static bool isContentUrl(java.lang.String arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m12.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m12 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "isContentUrl", "(Ljava/lang/String;)Z");
			return @__env.CallStaticBooleanMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m12, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m13;
		public static bool isValidUrl(java.lang.String arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m13.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m13 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "isValidUrl", "(Ljava/lang/String;)Z");
			return @__env.CallStaticBooleanMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m13, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
		}
		private static global::MonoJavaBridge.MethodId _m14;
		public static global::java.lang.String stripAnchor(java.lang.String arg0)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m14.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m14 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "stripAnchor", "(Ljava/lang/String;)Ljava/lang/String;");
			return global::MonoJavaBridge.JavaBridge.WrapJavaObjectSealedClass<java.lang.String>(@__env.CallStaticObjectMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m14, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as java.lang.String;
		}
		private static global::MonoJavaBridge.MethodId _m15;
		public static global::java.lang.String guessFileName(java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m15.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m15 = @__env.GetStaticMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "guessFileName", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;");
			return global::MonoJavaBridge.JavaBridge.WrapJavaObjectSealedClass<java.lang.String>(@__env.CallStaticObjectMethod(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m15, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2))) as java.lang.String;
		}
		private static global::MonoJavaBridge.MethodId _m16;
		public URLUtil() : base(global::MonoJavaBridge.JNIEnv.ThreadEnv)
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			if (global::android.webkit.URLUtil._m16.native == global::System.IntPtr.Zero)
				global::android.webkit.URLUtil._m16 = @__env.GetMethodIDNoThrow(global::android.webkit.URLUtil.staticClass, "<init>", "()V");
			global::MonoJavaBridge.JniLocalHandle handle = @__env.NewObject(android.webkit.URLUtil.staticClass, global::android.webkit.URLUtil._m16);
			Init(@__env, handle);
		}
		static URLUtil()
		{
			global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
			global::android.webkit.URLUtil.staticClass = @__env.NewGlobalRef(@__env.FindClass("android/webkit/URLUtil"));
		}
	}
}


text:
@implementation NSString (JL)

- (BOOL)isEmpty
{
    if ([self isKindOfClass:[NSString class]] && (self.length == 0 || self == nil)) {
        return YES;
    }
    return NO;
}

- (NSString *)stringByAppendingNameScale:(CGFloat)scale
{
    if (fabs(scale - 1) <= __FLT_EPSILON__ || self.length == 0 || [self hasSuffix:@"/"]) return self.copy;
    return [self stringByAppendingFormat:@"@%@x", @(scale)];
}

- (NSString *)stringByAppendingPathScale:(CGFloat)scale
{
    if (fabs(scale - 1) <= __FLT_EPSILON__ || self.length == 0 || [self hasSuffix:@"/"]) return self.copy;
    NSString *ext = self.pathExtension;
    NSRange extRange = NSMakeRange(self.length - ext.length, 0);
    if (ext.length > 0) extRange.location -= 1;
    NSString *scaleStr = [NSString stringWithFormat:@"@%@x", @(scale)];
    return [self stringByReplacingCharactersInRange:extRange withString:scaleStr];
}

@end

redpajama_set_name: RedPajamaGithub


text:
package nl.nn.adapterframework.batch;

import java.util.Map;

import nl.nn.adapterframework.configuration.ConfigurationException;
import nl.nn.adapterframework.util.LogUtil;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;

/**
 * The flow contains the handlers to handle records of a specific type.
 * Each flow is registered to a manager using the recordHandlerManagerRef.
 *
 *
Configuration:
 *

 *
attributes	description	default

 *
classname	nl.nn.adapterframework.batch.RecordHandlingFlow

 *
{@link #setRecordHandlerManagerRef(String) recordHandlerManagerRef}	Name of the manager to which this RecordHandlingFlow must be added

 *
{@link #setRecordKey(String) recordKey}	Key under which this RecordHandlingFlow must be registered in the manager

 *
{@link #setRecordHandlerRef(String) recordHandlerRef}	Name of the recordhandler to be used to transform records of the type specified in the key (optional)

 *
{@link #setResultHandlerRef(String) resultHandlerRef}	Name of the resulthandler to be used to handle the transformed result

 *
{@link #setNextRecordHandlerManagerRef(String) nextRecordHandlerManagerRef}	Name of the manager to be used after handling this record

 *
{@link #setOpenBlockBeforeLine(String) openBlockBeforeLine}	instructs the resultHandler to start a new block before the parsed line is processed

 *
{@link #setOpenBlockBeforeLineNumber(int) openBlockBeforeLineNumber}	when >0 the openBlockBeforeLine instruction is only performed when the current line number is a multiple of this value	0

 *
{@link #setCloseBlockBeforeLine(String) closeBlockBeforeLine}	instructs the resultHandler to end the specified block before the parsed line is processed

 *
{@link #setOpenBlockAfterLine(String) openBlockAfterLine}	instructs the resultHandler to start a new block after the parsed line is processed

 *
{@link #setCloseBlockAfterLine(String) closeBlockAfterLine}	instructs the resultHandler to end the specified block after the parsed line is processed

 *
{@link #setAutoCloseBlock(boolean) autoCloseBlock}	when true, any open block of this type (and other nested open 'autoclose' block) is closed before a new one of the same type is opened. At a forced close, nested blocks are closed too (since 4.9)	true

 *

 *

 *
 * @author  John Dekker
 * @version $Id$
 */
public final class RecordHandlingFlow {
	public static final String version = "$RCSfile: RecordHandlingFlow.java,v $  $Revision: 1.17 $ $Date: 2012-04-03 08:13:12 $";
	protected Logger log = LogUtil.getLogger(this);

	private String recordKey;
	private String recordHandlerRef;
	private String recordHandlerManagerRef;
	private String nextRecordHandlerManagerRef;
	private String resultHandlerRef;

	private String openBlockBeforeLine=null;
	private String closeBlockBeforeLine=null;
	private String openBlockAfterLine=null;
	private String closeBlockAfterLine=null;
	private boolean autoCloseBlock=true;
	private int openBlockBeforeLineNumber=0;

	private IRecordHandler recordHandler;
	private IRecordHandlerManager nextRecordHandlerManager;
	private IResultHandler resultHandler;

	public void configure(IRecordHandlerManager manager, Map registeredManagers, Map registeredRecordHandlers, Map registeredResultHandlers, IResultHandler defaultHandler) throws ConfigurationException {
		if (getOpenBlockBeforeLineNumber()>0 && StringUtils.isEmpty(getOpenBlockBeforeLine())) {
			    	throw new ConfigurationException("openBlockBeforeLine must be set when openBlockBeforeLineNumber > 0");
			}

		if (StringUtils.isNotEmpty(getRecordHandlerManagerRef()) &&
		    !getRecordHandlerManagerRef().equals(manager.getName())) {
		    	throw new ConfigurationException("recordHandlerManagerRef ["+getRecordHandlerManagerRef()+"] should be either equal to name of manager ["+manager.getName()+"], or left unspecified");
		}
		// obtain the named manager that is to be used after a specified record
		IRecordHandlerManager nextManager = null;
		if (StringUtils.isEmpty(getNextRecordHandlerManagerRef())) {
			nextManager = manager;
		} else {
			nextManager = (IRecordHandlerManager)registeredManagers.get(getNextRecordHandlerManagerRef());
			if (nextManager == null) {
				throw new ConfigurationException("cannot find nextRecordHandlerManager [" + getNextRecordHandlerManagerRef() + "] for flow of manager [" + getNextRecordHandlerManagerRef() + "], key ["+getRecordKey()+"]");
			}
		}
		setNextRecordHandlerManager(nextManager);

		// obtain the recordhandler
		if (StringUtils.isNotEmpty(getRecordHandlerRef())) {
			IRecordHandler recordHandler = (IRecordHandler)registeredRecordHandlers.get(getRecordHandlerRef());
			if (recordHandler!=null) {
				setRecordHandler(recordHandler);
			} else {
				throw new ConfigurationException("cannot find recordhandler ["+getRecordHandlerRef()+"] for flow of manager [" + getNextRecordHandlerManagerRef() + "], key ["+getRecordKey()+"]");
			}
		} else {
			log.debug("no recordhandler defined for flow of manager [" + getNextRecordHandlerManagerRef() + "], key ["+getRecordKey()+"]");
		}

		// obtain the named resulthandler
		IResultHandler resultHandler = (IResultHandler)registeredResultHandlers.get(getResultHandlerRef());
		if (resultHandler == null) {
			if (StringUtils.isEmpty(getResultHandlerRef())) {
				resultHandler = defaultHandler;
			} else {
				throw new ConfigurationException("ResultHandler [" + getResultHandlerRef() + "] not found");
			}
		}
		setResultHandler(resultHandler);
	}

	public void setRecordHandler(IRecordHandler handler) {
		recordHandler = handler;
	}
	public IRecordHandler getRecordHandler() {
		return recordHandler;
	}

	public void setResultHandler(IResultHandler handler) {
		resultHandler = handler;
	}
	public IResultHandler getResultHandler() {
		return resultHandler;
	}

	public void setNextRecordHandlerManager(IRecordHandlerManager manager) {
		nextRecordHandlerManager = manager;
	}
	public IRecordHandlerManager getNextRecordHandlerManager() {
		return nextRecordHandlerManager;
	}

	public void setRecordKey(String recordKey) {
		this.recordKey = recordKey;
	}
	public String getRecordKey() {
		return recordKey;
	}

	public void setNextRecordHandlerManagerRef(String nextRecordHandlerManagerName) {
		nextRecordHandlerManagerRef = nextRecordHandlerManagerName;
	}
	public String getNextRecordHandlerManagerRef() {
		return nextRecordHandlerManagerRef;
	}

	public void setRecordHandlerRef(String recordHandlerName) {
		recordHandlerRef = recordHandlerName;
	}
	public String getRecordHandlerRef() {
		return recordHandlerRef;
	}

	public void setRecordHandlerManagerRef(String recordHandlerManagerName) {
		recordHandlerManagerRef = recordHandlerManagerName;
	}
	public String getRecordHandlerManagerRef() {
		return recordHandlerManagerRef;
	}

	public void setResultHandlerRef(String resultHandlerName) {
		resultHandlerRef = resultHandlerName;
	}
	public String getResultHandlerRef() {
		return resultHandlerRef;
	}

	public void setOpenBlockBeforeLine(String blockName) {
		openBlockBeforeLine = blockName;
	}
	public String getOpenBlockBeforeLine() {
		return openBlockBeforeLine;
	}

	public void setCloseBlockBeforeLine(String blockName) {
		closeBlockBeforeLine = blockName;
	}
	public String getCloseBlockBeforeLine() {
		return closeBlockBeforeLine;
	}

	public void setOpenBlockAfterLine(String blockName) {
		openBlockAfterLine = blockName;
	}
	public String getOpenBlockAfterLine() {
		return openBlockAfterLine;
	}

	public void setCloseBlockAfterLine(String blockName) {
		closeBlockAfterLine = blockName;
	}
	public String getCloseBlockAfterLine() {
		return closeBlockAfterLine;
	}

	public void setAutoCloseBlock(boolean b) {
		autoCloseBlock = b;
	}
	public boolean isAutoCloseBlock() {
		return autoCloseBlock;
	}

	public void setOpenBlockBeforeLineNumber(int i) {
		openBlockBeforeLineNumber = i;
	}
	public int getOpenBlockBeforeLineNumber() {
		return openBlockBeforeLineNumber;
	}
}


text:
require 'chronic/repeaters/repeater_season.rb'

class Chronic::RepeaterSeasonName < Chronic::RepeaterSeason #:nodoc:
  SEASON_SECONDS = 7_862_400 # 91 * 24 * 60 * 60
  DAY_SECONDS = 86_400 # (24 * 60 * 60)

  def next(pointer)
    direction = pointer == :future ? 1 : -1
    find_next_season_span(direction, @type)
  end

  def this(pointer = :future)
    # super

    direction = pointer == :future ? 1 : -1

    today = Time.construct(@now.year, @now.month, @now.day)
    goal_ssn_start = today + direction * num_seconds_til_start(@type, direction)
    goal_ssn_end = today + direction * num_seconds_til_end(@type, direction)
    curr_ssn = find_current_season(@now.to_minidate)
    case pointer
    when :past
      this_ssn_start = goal_ssn_start
      this_ssn_end = (curr_ssn == @type) ? today : goal_ssn_end
    when :future
      this_ssn_start = (curr_ssn == @type) ? today + Chronic::RepeaterDay::DAY_SECONDS : goal_ssn_start
      this_ssn_end = goal_ssn_end
    when :none
      this_ssn_start = goal_ssn_start
      this_ssn_end = goal_ssn_end
    end

    Chronic::Span.new(this_ssn_start, this_ssn_end)
  end

  def offset(span, amount, pointer)
    Chronic::Span.new(offset_by(span.begin, amount, pointer), offset_by(span.end, amount, pointer))
  end

  def offset_by(time, amount, pointer)
    direction = pointer == :future ? 1 : -1
    time + amount * direction * Chronic::RepeaterYear::YEAR_SECONDS
  end

end


text:
<?php
/*
 * Autor       : Juan Carlos Ludeña Montesinos
 * Año         : Abril 2016
 * Descripción :
 *
 */
namespace Admin\Form;

use Admin\Model\Service\OrdenService;
use Zend\Form\Form;
use Zend\Form\Element;
use Zend\ServiceManager\ServiceLocatorInterface;

class DetalleOrdenBuscarForm extends Form
{
    protected $_sl = null;

    public function __construct(ServiceLocatorInterface $serviceLocator)
    {
        parent::__construct();

        $this->_sl = $serviceLocator;

        $this->_addForm();
        $this->_addElements();
    }

    protected function _addForm()
    {
        $this->setAttribute('id', 'formBuscar');
        $this->setAttribute('method', 'post');
    }

    protected function _addElements()
    {
        $txtBuscar = new Element\Text('txtBuscar');
        $txtBuscar->setAttributes(array(
                'id'        => 'txtBuscar',
                'maxlength' => '65',
            ));
        $this->add($txtBuscar);

        $filtrosBuscar = $this->getCarritoService()->getFiltrosBuscar();
        $cmbFiltro     = new Element\Select('cmbFiltro');
        $cmbFiltro->setAttributes(array('id' => 'cmbFiltro'));
        $cmbFiltro->setValueOptions($filtrosBuscar);
        $cmbFiltro->setEmptyOption('- Seleccione -');
        $cmbFiltro->setDisableInArrayValidator(true);
        $this->add($cmbFiltro);

        $filtroPagoEstado = $this->getOrdenService()->getPagoEstados();
        $cmbPagoEstado    = new Element\Select('cmbPagoEstado');
        $cmbPagoEstado->setAttributes(array('id' => 'cmbPagoEstado'));
        $cmbPagoEstado->setValueOptions($filtroPagoEstado);
        $cmbPagoEstado->setEmptyOption('- Seleccione -');
        $cmbPagoEstado->setDisableInArrayValidator(true);
        $this->add($cmbPagoEstado);

        $filtroEstado = $this->getOrdenService()->getEstados();
        $cmbEstado    = new Element\Select('cmbEstado');
        $cmbEstado->setAttributes(array('id' => 'cmbEstado'));
        $cmbEstado->setValueOptions($filtroEstado);
        $cmbEstado->setEmptyOption('- Seleccione -');
        $cmbEstado->setDisableInArrayValidator(true);
        $this->add($cmbEstado);

        $txtFechaIni = new Element\Text('txtFechaIni');
        $txtFechaIni->setAttributes(array(
            'id'        => 'txtFechaIni',
            'maxlength' => '15',
        ));
        $this->add($txtFechaIni);

        $txtFechaFin = new Element\Text('txtFechaFin');
        $txtFechaFin->setAttributes(array(
            'id'        => 'txtFechaFin',
            'maxlength' => '15',
        ));
        $this->add($txtFechaFin);

    }

    private function getCarritoService()
    {
        return $this->_sl->get('Admin\Model\Service\DetalleOrdenService');
    }

    /**
     * @return OrdenService
     */
    private function getOrdenService()
    {
        return $this->_sl->get('Admin\Model\Service\OrdenService');
    }
}


text:
name: Feature request
about: Suggest an idea for this project
---

Title: [Persona name] should (not) be able to [overarching action]

Business/User Value: As [persona] I want to [action by user] so that [value or need met]

Acceptance Criteria
GIVEN [necessary context and preconditions for story]
WHEN [action]
THEN [reaction]

**DEV NOTES**
None

**DESIGN Notes**
None

---other items that you may add to a story---

**NEEDS PM**
None

**NEEDS DESIGN**
None

**Related issues**
None

/label ~"story"


text:
title: OnClientResponseError
page_title: OnClientResponseError | RadTooltip for ASP.NET AJAX Documentation
description: OnClientResponseError
slug: tooltip/client-side-programming/events/tooltipmanager-specific/onclientresponseerror
tags: onclientresponseerror
published: True
position: 3
---

# OnClientResponseError

The **OnClientResponseError** event is fired when a server error occurs during the request. It allows the developer to choose the behavior if this happens. The event receives the following parameters:

1. The RadToolTipManager instance that fired the event. Note that this is not the tooltip that is being shown, this reference should be obtained via the static `getCurrent()` method of the class

1. Event arguments - this object exposes the `set_cancelErrorAlert()` method that can be used to prevent the alert with the error thrown from the server. It also has the `get_errorMessage()` method which holds only the message itself. This allows you to formulate a user friendly response or take an action accordingly without interrupting the workflow.

````ASP.NET
<script type="text/javascript">
    function OnClientResponseError(sender, args)
    {
        args.set_cancelErrorAlert(true);
        alert("There was an error while retrieving the data: " + args.get_errorMessage() + " . Please try again later.");
        var current = Telerik.Web.UI.RadToolTip.getCurrent();
        if (current)
        {
            current.hide();
        }
    }
</script>
<telerik:RadToolTipManager ID="RadToolTipManager1" OnClientResponseError="OnClientResponseError">
    <WebServiceSettings Method="GetToolTipData" Path="ToolTipWebService.asmx" />
</telerik:RadToolTipManager>
````


text:
//
// HtmlObject.cs
//

using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;

using WebSharpJs.Script;

namespace WebSharpJs.DOM
{

    public class HtmlObject : WebSharpObject
    {

        protected HtmlObject(ScriptObjectProxy scriptObject) : base()
        {
            ScriptObjectProxy = new DOMObjectProxy(scriptObject);
        }

        class EventHandlerBag : GrabBag<WebSharpHtmlEvent>
        { }

        EventHandlerBag EventHandlers = new EventHandlerBag();

        public async Task<bool> AttachEvent(string eventName, EventHandler<HtmlEventArgs> handler)
        {
            if (string.IsNullOrEmpty(eventName))
                throw new ArgumentNullException("eventName");

            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }

            var scriptAlias = eventName;
            var ei = InstanceType.GetTypeInfo().GetEvent(eventName, BindingFlags.Instance | BindingFlags.Public);

            if (ei != null)
            {
                if (ei.IsDefined(typeof(ScriptableMemberAttribute), false))
                {
                    var att = ei.GetCustomAttribute<ScriptableMemberAttribute>(false);
                    scriptAlias = (att.ScriptAlias ?? scriptAlias);
                }
            }

            WebSharpHtmlEvent websharpEvent;
            var result = false;
            if (!EventHandlers.TryGetValue(scriptAlias, out websharpEvent))
            {

                websharpEvent = new WebSharpHtmlEvent(this, scriptAlias);
                if (ScriptObjectProxy != null)
                {
                    var eventCallback = new
                    {
                        handle = Handle,
                        onEvent = scriptAlias,
                        uid = websharpEvent.UID,
                        callback = websharpEvent.EventCallbackFunction,
                        handlerType = "HtmlEventArgs"
                    };

                    result = await WebSharp.Bridge.AddEventListener(eventCallback);
                }
                EventHandlers[scriptAlias] = websharpEvent;
            }
            websharpEvent.AddEventHandler(handler);
            return result;
        }

        public async Task<bool> AttachEvent<HtmlEventArgs>(string eventName)
        {
            if (string.IsNullOrEmpty(eventName))
                throw new ArgumentNullException("eventName");

            WebSharpHtmlEvent websharpEvent;

            var scriptAlias = eventName;
            var ei = InstanceType.GetTypeInfo().GetEvent(eventName, BindingFlags.Instance | BindingFlags.Public);

            if (ei == null)
                return false;

            if (ei.IsDefined(typeof(ScriptableMemberAttribute), false))
            {
                var att = ei.GetCustomAttribute<ScriptableMemberAttribute>(false);
                scriptAlias = (att.ScriptAlias ?? scriptAlias);
            }

            var result = false;

            if (!EventHandlers.TryGetValue(eventName, out websharpEvent))
            {
                websharpEvent = new WebSharpHtmlEvent(this, eventName);
                if (ScriptObjectProxy != null)
                {
                    var eventCallback = new
                    {
                        handle = Handle,
                        onEvent = scriptAlias,
                        uid = websharpEvent.UID,
                        callback = websharpEvent.EventCallbackFunction,
                        handlerType = "HtmlEventArgs"
                    };
                    result = await WebSharp.Bridge.AddEventListener(eventCallback);
                }
                EventHandlers[eventName] = websharpEvent;
            }
            return result;
        }

        public async Task<bool> DetachEvent(string eventName, EventHandler<HtmlEventArgs> handler)
        {
            if (string.IsNullOrEmpty(eventName))
                throw new ArgumentNullException("eventName");

            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }

            var scriptAlias = eventName;
            var ei = InstanceType.GetTypeInfo().GetEvent(eventName, BindingFlags.Instance | BindingFlags.Public);

            if (ei != null)
            {
                if (ei.IsDefined(typeof(ScriptableMemberAttribute), false))
                {
                    var att = ei.GetCustomAttribute<ScriptableMemberAttribute>(false);
                    scriptAlias = (att.ScriptAlias ?? scriptAlias);
                }
            }

            WebSharpHtmlEvent websharpEvent;
            var result = false;
            if (EventHandlers.TryGetValue(scriptAlias, out websharpEvent))
            {

                if (ScriptObjectProxy != null)
                {
                    var eventCallback = new
                    {
                        handle = Handle,
                        onEvent = scriptAlias,
                        uid = websharpEvent.UID,
                        callback = websharpEvent.EventCallbackFunction,
                        handlerType = "HtmlEventArgs"
                    };
                    result = await WebSharp.Bridge.RemoveEventListener(eventCallback);
                }
                EventHandlers.Remove(scriptAlias);
            }
            websharpEvent.RemoveEventHandler(handler);
            return result;
        }

        protected HtmlObject() : base() { }
        protected HtmlObject(object obj) : base(obj)
        {
            var dict = obj as IDictionary<string, object>;

            // The key `websharp_id` represents a wrapped proxy object
            if (dict != null && dict.ContainsKey("websharp_id"))
            {
                ScriptObjectProxy = new DOMObjectProxy(obj);
            }
        }
    }

}


text:
import {Header} from '../components';
import {connect} from 'react-redux';
import {clearHistory} from '../redux/modules/effectHistory';

const HeaderContainer = connect(
    (state) => ({}),
    {clearHistory}
)(Header);

export default HeaderContainer;


text:
#ifndef SENDFLUXDIALOG_H
#define SENDFLUXDIALOG_H

#include <QDialog>

namespace Ui {
    class SendFluxDialog;
}
class WalletModel;
class SendFluxEntry;
class SendFluxRecipient;

QT_BEGIN_NAMESPACE
class QUrl;
QT_END_NAMESPACE

/** Dialog for sending Fluxs */
class SendFluxDialog : public QDialog
{
    Q_OBJECT

public:
    explicit SendFluxDialog(QWidget *parent = 0);
    ~SendFluxDialog();

    void setModel(WalletModel *model);

    /** Set up the tab chain manually, as Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907).
     */
    QWidget *setupTabChain(QWidget *prev);

    void setAddress(const QString &address);
    void pasteEntry(const SendFluxRecipient &rv);
    bool handleURI(const QString &uri);

public slots:
    void clear();
    void reject();
    void accept();
    SendFluxEntry *addEntry();
    void updateRemoveEnabled();
    void setBalance(qint64 balance, qint64 unconfirmedBalance, qint64 immatureBalance);

private:
    Ui::SendFluxDialog *ui;
    WalletModel *model;
    bool fNewRecipientAllowed;

private slots:
    void on_sendButton_clicked();
    void removeEntry(SendFluxEntry* entry);
    void updateDisplayUnit();
};

#endif // SENDFLUXDIALOG_H


text:
/**
 * Listens to feature events and "forwards" them to the map model
 * when map's feature interactivity is enabled.
 * @param {Object} deps Dependencies
 */
var MapModelEventsManager = function (deps) {
  if (!deps.mapModel) throw new Error('mapModel is required');

  this._mapModel = deps.mapModel;
};

MapModelEventsManager.prototype.start = function (cartoDBLayerGroupView) {
  this._cartoDBLayerGroupView = cartoDBLayerGroupView;
  this._cartoDBLayerGroupView.on('featureOver', this._onFeatureOver, this);
  this._cartoDBLayerGroupView.on('featureClick', this._onFeatureClick, this);
  this._cartoDBLayerGroupView.on('featureOut', this._onFeatureOut, this);
  this._cartoDBLayerGroupView.on('featureError', this._onFeatureError, this);
};

MapModelEventsManager.prototype.stop = function () {
  if (this._cartoDBLayerGroupView) {
    this._cartoDBLayerGroupView.off('featureOver', this._onFeatureOver, this);
    this._cartoDBLayerGroupView.off('featureClick', this._onFeatureClick, this);
    this._cartoDBLayerGroupView.off('featureOut', this._onFeatureOut, this);
    this._cartoDBLayerGroupView.off('featureError', this._onFeatureError, this);
    delete this._cartoDBLayerGroupView;
  }
};

MapModelEventsManager.prototype._onFeatureOver = function (event) {
  if (this._mapModel.isFeatureInteractivityEnabled()) {
    this._mapModel.trigger('featureOver', event);
  }
};

MapModelEventsManager.prototype._onFeatureClick = function (event) {
  if (this._mapModel.isFeatureInteractivityEnabled()) {
    this._mapModel.trigger('featureClick', event);
  }
};

MapModelEventsManager.prototype._onFeatureOver = function (event) {
  if (this._mapModel.isFeatureInteractivityEnabled()) {
    this._mapModel.trigger('featureOver', event);
  }
};

MapModelEventsManager.prototype._onFeatureError = function (event) {
  if (this._mapModel.isFeatureInteractivityEnabled()) {
    this._mapModel.trigger('featureError', event);
  }
};

module.exports = MapModelEventsManager;


text:
package com.example.animation.Util;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AlertDialog;
import android.widget.Toast;

import com.example.animation.BuildConfig;
import com.example.animation.customSystem.bease.ApplicationVersion;

import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.QueryListener;

/**
 * Created by 刘通 on 2018/2/23.
 */

public class CheckUpdataApplication {

    public static void checkUpdata(final Context context, final int type){
        BmobQuery<ApplicationVersion> query = new BmobQuery<>();
        query.getObject("0d99ba836c", new QueryListener<ApplicationVersion>() {
            @Override
            public void done(final ApplicationVersion applicationVersion, BmobException e) {
                if(e==null){
                    if(BuildConfig.VERSION_CODE <applicationVersion.getVersionCode()){
                    AlertDialog.Builder builder = new AlertDialog.Builder(context);
                    builder.setTitle(applicationVersion.getVersionName());
                    builder.setMessage(applicationVersion.getUpdateMessage());
                    builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            dialog.dismiss();
                        }
                    });
                    builder.setPositiveButton("更新", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            dialog.dismiss();
                            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(applicationVersion.getApk().getUrl()));
                            context.startActivity(intent);
                        }
                    });
                    builder.show();
                }else {
                    if(type==1){
                        Toast.makeText(context,"暂无更新",Toast.LENGTH_SHORT).show();
                        }
                    }
                }else {
                    Toast.makeText(context,e.getMessage(),Toast.LENGTH_SHORT).show();
                }

            }
        });
    }
}


text:
struct JobItem
{
    int id;
    int type;
    eTextureConvertMode convertMode;
    const DAVA::TextureDescriptor* descriptor;

    JobItem()
        : id(0)
        , type(0)
        , convertMode(CONVERT_NOT_EXISTENT)
        , descriptor(NULL)
    {
    }
};

class JobStack
{
public:
    JobStack();
    ~JobStack();

    bool push(const JobItem& item);
    JobItem* pop();
    int size();

private:
    struct JobItemWrapper : public JobItem
    {
        JobItemWrapper(const JobItem& item);

        JobItemWrapper* next;
        JobItemWrapper* prev;
    };

    JobItemWrapper* head;

    int itemsCount;
};

class JobWatcher
{
public:
    using TJobFunction = DAVA::Function<TextureInfo(const JobItem*)>;
    using TReadyCallback = DAVA::Function<void(const TextureInfo&, const JobItem*)>;

    JobWatcher(DAVA::JobManager* manager);
    ~JobWatcher();

    void Init(const TJobFunction& convertFunction, const TReadyCallback& readyCallback);

    bool IsFinished() const;
    void RunJob(std::unique_ptr<JobItem>&& item);
    const JobItem* GetCurrentJobItem() const;

private:
    void OnConvert();
    void OnReady();

    JobItem* GetCurrentJobItemImpl();

private:
    class Impl;
    std::shared_ptr<Impl> impl;
    TJobFunction convertFunction;
    TReadyCallback readyCallback;
    DAVA::JobManager* manager = nullptr;
    std::unique_ptr<JobItem> jobItem = nullptr;
    TextureInfo result;
    bool isFinished = true;
    mutable DAVA::Mutex mutex;
};


text:
Run a function on triggers. The little brother to Hazel for OS X.

## What?

Runt is a Python3 module that hooks into the OS X File System Events API (and others) in order to run a Python module when a trigger occurs. It came about because I use Hazel for some awesome "if this, then that" actions but found it a bit too restrictive when it came to being selective and dealing with hidden items.


text:
class ProjectController {
  	constructor($http, $stateParams, $interval, myConfig, AppService) {
    	"ngInject";
    	this.name = 'list';
    	this.$http = $http;
    	this.apiendpoint = myConfig.ApiEndpoint;
      this.AppService = AppService;
    	this.$stateParams = $stateParams;
    	this.organizationid = $stateParams.orgid;

    	this.setActive = function(index) {
      		this.activeIndex = index;
    	};

    	this.initProjects = function() {
    		this.AppService.getOrgProjects(this.$stateParams.orgid).then(data => this.projectList = data);
    	}

    	this.AppService.getOrgDetail($stateParams.orgid).then(data => this.orgDetail = data);
    	this.initProjects();

    	this.selectAction = function () {
      		console.log(this.deviceOption.value);
    	};
  	}

  	createProject() {
    	let _this = this;
    	var config = {
      		headers: {'Content-Type': 'application/x-www-form-urlencoded'}
    	}

    	var data = {"name": "" + this.appname + "", "deviceType": "" + this.deviceOption.value + "", "repository": "none"};
    	this.$http.post(this.apiendpoint + "/org/"+this.$stateParams.orgid+"/project", data, config)
      		.then(function (response) {
        	if (response.status == 201) {
          		_this.initProjects();
        	}
      	});
  	}

  	getDeviceCount(orgId) {
    	return this.$http.get(this.apiendpoint+"/device/" + orgId)
      	.then(response => response.data.length);
  	}

    deleteProject(orgId, projectId, name) {
      var r = confirm("Are you sure you want to delete " + name + "?");
      if (r == true) {
        let _this = this;
        this.$http.post(this.apiendpoint+"/org/"+orgId+"/delete/"+projectId)
        .then(function(response) {
          if (response.status == 200) {
            _this.initProjects();
          }
        })
      }
    };

}

export default ProjectController;


text:
package org.springframework.security.access.intercept;

import java.util.Collection;

import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.SpringSecurityCoreVersion;

/**
 * An immutable {@link org.springframework.security.core.Authentication} implementation
 * that supports {@link RunAsManagerImpl}.
 *
 * @author Ben Alex
 */
public class RunAsUserToken extends AbstractAuthenticationToken {

	private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;

	// ~ Instance fields
	// ================================================================================================

	private final Class<? extends Authentication> originalAuthentication;
	private final Object credentials;
	private final Object principal;
	private final int keyHash;

	// ~ Constructors
	// ===================================================================================================

	public RunAsUserToken(String key, Object principal, Object credentials,
			Collection<? extends GrantedAuthority> authorities,
			Class<? extends Authentication> originalAuthentication) {
		super(authorities);
		this.keyHash = key.hashCode();
		this.principal = principal;
		this.credentials = credentials;
		this.originalAuthentication = originalAuthentication;
		setAuthenticated(true);
	}

	// ~ Methods
	// ========================================================================================================

	@Override
	public Object getCredentials() {
		return this.credentials;
	}

	public int getKeyHash() {
		return this.keyHash;
	}

	public Class<? extends Authentication> getOriginalAuthentication() {
		return this.originalAuthentication;
	}

	@Override
	public Object getPrincipal() {
		return this.principal;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder(super.toString());
		String className = this.originalAuthentication == null ? null
				: this.originalAuthentication.getName();
		sb.append("; Original Class: ").append(className);

		return sb.toString();
	}
}


text:
@font-face {
    font-family: 'toadie';
    src: url('/static/fonts/toadie-is.ttf');
}

body {
    font-family: 'toadie';
    font-size: 25pt;
    padding: 10px;
    margin: 10px;
    background: white;
    max-height: 100%;
    max-width: 100%;
    overflow: visible;
}

section {
    position: relative;
    overflow: visible;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: inline-block;
}

section a {
    position: relative;
    font-size: 16pt;
    display: inline;
    outline: none;
    color: #afafaf;
    vertical-align: bottom;
    text-decoration: none;
    white-space: nowrap;
}

section button {
/*    width: 100%;
    height: 100%;*/
    position: relative;
    display: inline;
    outline: none;
    color: #afafaf;
    background:none!important;
    border:none;
    /*padding:0!important;*/
    font-size: 16pt;
    /*margin: 20px;*/
    vertical-align: bottom!important;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
}

section a::before,
section a::after {
    pointer-events: none;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    font-smoothing: antialiased;
}

section button::before,
section button::after {
    pointer-events: none;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    font-smoothing: antialiased;
}

.link-braces a {
    color: #afafaf;
    padding: 0 0.35em;
    font-weight: 400;
    -webkit-transition: color 0.2s;
    transition: color 0.2s;
}

.link-braces a:hover {
    color: #212121;
    font-weight: 600;
}

.link-braces a::before,
.link-braces a::after {
    position: absolute;
    top: 0;
    font-weight: 400;
    font-size: 120%;
    line-height: 1;
    opacity: 0;
    -webkit-transition: opacity 0.2s, -webkit-transform 0.2s;
    transition: opacity 0.2s, transform 0.2s;
}

.link-braces a::before {
    left: -0.1em;
/*    content: '[';*/
    -webkit-transform: translateX(-100%);
    transform: translateX(-100%);
}

.link-braces a::after {
    right: -0.1em;
/*    content: ']';*/
    -webkit-transform: translateX(100%);
    transform: translateX(100%);
}

.link-braces a:hover::before,
.link-braces a:hover::after {
    opacity: 1;
    -webkit-transform: translateX(0);
    transform: translateX(0);
}

/* Save button */
.link-braces button {
    color: #afafaf;
    padding: 0 0.35em;
    font-weight: 400;
    -webkit-transition: color 0.2s;
    transition: color 0.2s;
}

.link-braces button:hover {
    color: #212121;
    font-weight: 600;
}

.link-braces button::before,
.link-braces button::after {
    position: absolute;
    top: 0;
    font-weight: 400;
    font-size: 120%;
    line-height: 1;
    opacity: 0;
    -webkit-transition: opacity 0.2s, -webkit-transform 0.2s;
    transition: opacity 0.2s, transform 0.2s;
}

.link-braces button::before {
    left: -0.1em;
/*    content: '[';*/
    -webkit-transform: translateX(-100%);
    transform: translateX(-100%);
}

.link-braces button::after {
    right: -0.1em;
/*    content: ']';*/
    -webkit-transform: translateX(100%);
    transform: translateX(100%);
}

.link-braces button:hover::before,
.link-braces button:hover::after {
    opacity: 1;
    -webkit-transform: translateX(0);
    transform: translateX(0);
}

h1 {
    font-size: 25pt;
    margin: 10px;
    /*padding-bottom: 0px;*/
    display: inline;
    vertical-align: bottom;
}

svg {
    width: 100%;
    height: 100%;
    margin-left: 0px;
    padding: 0;
    display: inline;
    opacity: 1;
    overflow: visible;
}

#save-with-post {
    display: inline;
    margin: 10px;
    vertical-align: bottom;
    float: right !important;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16pt;
    overflow: visible;
}

#menu {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16pt;
    margin: 10px;
    display: inline;
    overflow: visible;
    vertical-align: bottom;
}

#save {
    display: none;
}

#pythonSVGWRITE {
    height: 650px;
    /*height: 50%;*/
    display: block;
    overflow: visible;
    border: transparent solid 30px;
}

#pythonSVGWRITE svg {
    height: 100%;
    overflow: visible;
    display: block;
}

.fa-random {
    text-color: blue!important;
}


text:
package com.intellij.vcs.log.graph.impl.print.elements;

import com.intellij.vcs.log.graph.SimplePrintElement;
import com.intellij.vcs.log.graph.api.elements.GraphElement;
import com.intellij.vcs.log.graph.api.printer.PrintElementsManager;
import org.jetbrains.annotations.NotNull;

public class SimplePrintElementImpl extends AbstractPrintElement implements SimplePrintElement {

  @NotNull
  private final Type myType;

  public SimplePrintElementImpl(int rowIndex,
                                int positionInCurrentRow,
                                @NotNull Type type,
                                @NotNull GraphElement graphElement,
                                @NotNull PrintElementsManager printElementsManager) {
    super(rowIndex, positionInCurrentRow, graphElement, printElementsManager);
    myType = type;
  }

  @NotNull
  @Override
  public Type getType() {
    return myType;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (!(o instanceof SimplePrintElement)) return false;

    SimplePrintElement that = (SimplePrintElement)o;

    if (myPositionInCurrentRow != that.getPositionInCurrentRow()) return false;
    if (myRowIndex != that.getRowIndex()) return false;
    if (myType != that.getType()) return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result = myRowIndex;
    result = 31 * result + myPositionInCurrentRow;
    result = 37 * result + myType.hashCode();
    return result;
  }

}


text:
#ifndef _RMT_METADATA_UTILS_H
#define _RMT_METADATA_UTILS_H

void metadata_extract(uint8_t *dst, uint8_t *hdr,
		      int *metadata_recirc);

void metadata_dump(uint8_t *hdr, uint8_t *src);

//:: for name, binding in metadata_name_map.items():
uint32_t metadata_get_${name}(uint8_t *metadata);

void metadata_set_${name}(uint8_t *metadata, uint32_t value);

//::   #endfor

//:: if enable_intrinsic :
//::   for name, binding in intrinsic_metadata_name_map.items():
uint32_t metadata_get_${name}(uint8_t *metadata);

void metadata_set_${name}(uint8_t *metadata, uint32_t value);

//::   #endfor
//:: #endif

//:: if enable_pre :
//::   for name, binding in pre_metadata_name_map.items():
uint32_t metadata_get_${name}(uint8_t *metadata);

void metadata_set_${name}(uint8_t *metadata, uint32_t value);

//::   #endfor
//:: #endif

//:: for name, binding in extra_metadata_name_map.items():
uint32_t metadata_get_${name}(uint8_t *metadata);

void metadata_set_${name}(uint8_t *metadata, uint32_t value);

//:: #endfor
#endif


text:
from pykeyboard import PyKeyboard

from integriot import *

kb = PyKeyboard()

def inject_key(key, msg):
    global kb
    if msg == "1":
        kb.press_key(key)
    else:
        kb.release_key(key)

def back_cb(msg):
    inject_key(kb.left_key, msg)

def forward_cb(msg):
    inject_key(kb.space, msg)

init("192.168.12.1")

prefix("remote1")
subscriber("forward").subscribe_change(callback=forward_cb)
subscriber("back").subscribe_change(callback=back_cb)

onboard_blue = switch_publisher("blue", init_state="off")

print("Keyboard injector started, press Ctrl-C to stop.")
run()


text:
@class MMDocument;

NS_ASSUME_NONNULL_BEGIN
@interface MMParser : NSObject

- (id)initWithExtensions:(MMMarkdownExtensions)extensions;

- (MMDocument *)parseMarkdown:(NSString *)markdown error:(NSError * __autoreleasing * _Nullable)error;

@end
NS_ASSUME_NONNULL_END


text:
package org.camunda.bpm.engine.rest.util.container;

import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.resolver.api.maven.PomEquippedResolveStage;

public class WinkTomcatServerBootstrap extends TomcatServerBootstrap {

  public WinkTomcatServerBootstrap(String webXmlPath) {
    super(webXmlPath);
  }

  @Override
  protected void addRuntimeSpecificLibraries(WebArchive wa,
      PomEquippedResolveStage resolver) {
    wa.addAsLibraries(resolver.resolve("org.apache.wink:wink-server:1.1.1-incubating").withTransitivity().asFile());
  }
}


text:
# PostCSS Vmin [![Build Status](https://travis-ci.org/iamvdo/postcss-vmin.svg)](https://travis-ci.org/iamvdo/postcss-vmin)

A simple [PostCSS] plugin to convert `vmin` to `vm` for IE9.

[PostCSS]: https://github.com/postcss/postcss

```css
/* Input example */
.foo {
  width: 50vmin;
}
```

```css
/* Output example */
.foo {
  width: 50vm;
  width: 50vmin;
}
```

## Usage

```js
postcss([ require('postcss-vmin') ])
```

See [PostCSS] docs for examples for your environment.


text:
<?php

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
define('CVS_REVISION', '$RCSfile$ - $Revision: 32878 $');

// #################### PRE-CACHE TEMPLATES AND DATA ######################
$phrasegroups = array('sql');
$specialtemplates = array();

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');

@set_time_limit(0);

// ######################## CHECK ADMIN PERMISSIONS #######################
if (!can_administer('canadminmaintain'))
{
	print_cp_no_permission();
}

// ############################# LOG ACTION ###############################
log_admin_action();

// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################

print_cp_header($vbphrase['repair_optimize_tables']);

if (empty($_REQUEST['do']))
{
	$_REQUEST['do'] = 'list';
}

// ###################### Start checktable #######################
function exec_sql_table_check($table)
{
	global $vbulletin, $vbphrase;

	$nooptimize = 0;
	$error = 0;

	if ($vbulletin->GPC['repairtables'])
	{
		$checkmsgs = $vbulletin->db->query_write("CHECK TABLE `$table`");
		while ($msg = $vbulletin->db->fetch_array($checkmsgs, DBARRAY_NUM))
		{
			if ($msg[2] == 'error')
			{
				if ($msg[3] == 'The handler for the table doesn\'t support check/repair') // nb: this is the MySQL error message, it does not need phrasing
				{
					$msg[2] = 'status';
					$msg[3] = $vbphrase['this_table_does_not_support_repair_optimize'];
					$nooptimize = 1;
				}
				else
				{
					$error = 1;
				}
			}

			$cells = array(
				$table,
				ucfirst($msg[1]),
				iif($error, '' . ucfirst($msg[2]) . '', ucfirst($msg[2])) . ': ' . $msg[3]
			);
			print_cells_row($cells, 0, '', -4);
		}

		if ($error)
		{
			$repairmsg = $vbulletin->db->query_first("REPAIR TABLE `$table`");
			if ($repairmsg[3]!='OK')
			{
				$error2 = 1;
			}
			else
			{
				$error2 = 0;
				$error = 0;
			}

			$cells = array(
				$table,
				ucfirst($msg[1]),
				iif($error2, '' . ucfirst($msg[2]) . '', ucfirst($msg[2])),
			);
			print_cells_row($cells);
		}
	} // end repairing

	if ($vbulletin->GPC['optimizetables'] AND !$error AND !$error2 AND !$nooptimize)
	{
		$opimizemsgs = $vbulletin->db->query_write("OPTIMIZE TABLE `$table`");
		while ($msg = $vbulletin->db->fetch_array($opimizemsgs, DBARRAY_NUM))
		{
			if ($msg[2] == 'error')
			{
				$error = 1;
			}

			$cells = array(
				$table,
				ucfirst($msg[1]),
				iif($error, '' . ucfirst($msg[2]) . '', ucfirst($msg[2])) . ': ' . $msg[3],
			);
			print_cells_row($cells, 0, '', -4);
		}
	} // end optimizing
}

// ######################### Start do repair #####################
if ($_POST['do'] == 'dorepair')
{
	$vbulletin->input->clean_array_gpc('p', array(
		'tableserial'    => TYPE_STR,
		'tablelist'      => TYPE_ARRAY_STR,
		'optimizetables' => TYPE_BOOL,
		'repairtables'   => TYPE_BOOL,
		'converttables'  => TYPE_BOOL,
		'isamtablelist'  => TYPE_ARRAY_STR,
	));

	// This will work on some servers, for what it's worth.
	echo '
' . $vbphrase['please_wait'] . '
';
	vbflush();

	if (!empty($vbulletin->GPC['tableserial']))
	{
		$vbulletin->GPC['tablelist'] = @unserialize(verify_client_string($vbulletin->GPC['tableserial']));
	}

	print_form_header('repair', 'dorepair');

	if ($vbulletin->GPC['converttables'] AND !empty($vbulletin->GPC['isamtablelist']))
	{
		$vbulletin->db->hide_errors();
		print_table_header(construct_phrase($vbphrase['convert_tables_from_x_to_y'], 'ISAM', 'MyISAM'));
		print_cells_row(array($vbphrase['table'], $vbphrase['status']), 1);
		foreach ($vbulletin->GPC['isamtablelist'] AS $index => $value)
		{
			$cells = array();
			$cells[] = construct_phrase($vbphrase['convert_x_from_y_to_z'], "$value", 'ISAM', 'MyISAM');
			$vbulletin->db->query_write("ALTER TABLE `$value` TYPE=MyISAM");
			if ($vbulletin->db->errno() == 0)
			{
				$cells[] = $vbphrase['okay'];
			}
			else
			{
				$cells[] = $vbulletin->db->errno() . ': ' . $vbulletin->db->error();
			}
			print_cells_row($cells);
		}
		$vbulletin->db->show_errors();
		print_table_break();
	}

	print_table_header($vbphrase['results'], 3);
	print_cells_row(array($vbphrase['table'], $vbphrase['action'], $vbphrase['message']), 1);

	if (!empty($vbulletin->GPC['tablelist']) AND ($vbulletin->GPC['optimizetables'] OR $vbulletin->GPC['repairtables']))
	{
		foreach ($vbulletin->GPC['tablelist'] AS $tablename)
		{
			exec_sql_table_check($tablename);
		}
	}
	else
	{
		print_description_row($vbphrase['nothing_to_do'], 0, 3);
	}

	construct_hidden_code('optimizetables', $vbulletin->GPC['optimizetables']);
	construct_hidden_code('repairtables', $vbulletin->GPC['repairtables']);
	construct_hidden_code('tableserial', sign_client_string(serialize($vbulletin->GPC['tablelist'])));

	print_submit_row($vbphrase['repeat_process'], '', 3);
}

// ######################### Start table list ####################
if ($_REQUEST['do'] == 'list')
{
	print_form_header('repair', 'dorepair', 0, 1, 'cpform');
	print_table_header($vbphrase['repair_optimize_tables'], 5);
	$headings = array();
	$headings[] = $vbphrase['table'];
	$headings[] = $vbphrase['data_length'];
	$headings[] = $vbphrase['index_length'];
	$headings[] = $vbphrase['overhead'];
	$headings[] = "<input type=\"checkbox\" name=\"allbox\" id=\"allbox\" title=\"$vbphrase[check_all]\" onclick=\"js_check_all(this.form);\" />$vbphrase[check_all]";
	print_cells_row($headings, 1);

	$mysqlversion = $db->query_first("SELECT VERSION() AS version");

	$tables = $db->query_write("SHOW TABLE STATUS");

	$isamtables = array();

	$nullcount = 0;

	while ($table = $db->fetch_array($tables))
	{
		$cells = array();
		$table['Engine'] = (!empty($table['Type']) ? $table['Type'] : $table['Engine']);
		if (!in_array(strtolower($table['Engine']), array('heap', 'memory')))
		{
			$cells[] = $table['Name'];
			$cells[] = vb_number_format($table['Data_length'], 0, true);
			$cells[] = vb_number_format($table['Index_length'], 0, true);
			$cells[] = vb_number_format($table['Data_free'], 0, true);
			$cells[] = "<input type=\"checkbox\" name=\"tablelist[$nullcount]\" id=\"tablelist_$nullcount\" title=\"$table[Name]\" value=\"$table[Name]\" />$vbphrase[yes]";
			print_cells_row($cells);
			$nullcount++;
			if ($table['Engine'] == 'ISAM')
			{
				$isamtables[] = $table['Name'];
			}
		}
	}

	if (!empty($isamtables))
	{
		$nullcount = 0;
		print_table_break('');
		print_table_header($vbphrase['isam_tables'], 0, 5);
		print_description_row('' . construct_phrase($vbphrase['you_are_running_mysql_version_x_convert_to_myisam'], $mysqlversion['version']) . '');
		foreach ($isamtables AS $index => $value)
		{
			print_checkbox_row($value, "isamtablelist[$nullcount]", false, $value);
			$nullcount++;
		}
	}

	print_table_break('');

	// can use REPAIR TABLE xxxx
	print_table_header($vbphrase['options']);
	if (isset($isamtables[0]))
	{
		print_yes_no_row(construct_phrase($vbphrase['convert_tables_from_x_to_y'], 'ISAM', 'MyISAM'), 'converttables', 1);
	}
	print_yes_no_row($vbphrase['optimize_tables'], 'optimizetables', 1);
	print_yes_no_row($vbphrase['repair_tables'], 'repairtables', 1);
	print_submit_row($vbphrase['continue']);

	echo ' ';

	print_form_header('repair', 'fixunique', 0, 1, 'bla');
	print_table_header($vbphrase['fix_unique_indexes']);
	print_description_row($vbphrase['fix_unique_indexes_intro']);
	print_submit_row($vbphrase['fix_unique_indexes'], false);
}

// ######################### Start fix unique indexes #####################
if ($_REQUEST['do'] == 'fixunique')
{
	$vbulletin->input->clean_array_gpc('r', array(
		'tableid' => TYPE_UINT
	));

	if (!file_exists(DIR . '/install/mysql-schema.php'))
	{
		print_stop_message('restore_mysql_schema');
	}

	require_once(DIR . '/install/mysql-schema.php');

	function fix_unique_index($tableid)
	{
		global $vbphrase, $db, $uniquetables;

		if (isset($uniquetables["$tableid"]))
		{
			$table =& $uniquetables["$tableid"];
		}
		else
		{
			return -1;
		}

		$unique_keys = array();
		$keys = array();
		$checkindexes = $db->query_write("SHOW KEYS FROM " . TABLE_PREFIX . "$table[name]");
		while ($checkindex = $db->fetch_array($checkindexes))
		{
			if ($checkindex['Non_unique'] == 0)
			{
				$unique_keys["$checkindex[Key_name]"][] = $checkindex['Column_name'];
			}
			$keys["$checkindex[Key_name]"][] = $checkindex['Column_name'];
		}
		$db->free_result($checkindexes);

		foreach ($unique_keys AS $keyname => $keyfields)
		{
			$unique_keys["$keyname"] = implode(', ', $keyfields);
		}

		$fields = implode(', ', $table['fields']);

		$gotunique = in_array($fields, $unique_keys);

		if ($gotunique)
		{
			echo "
" . construct_phrase($vbphrase['table_x_has_unique_index'], "$table[name]") . "
";
			$nexttableid = fix_unique_index($tableid + 1);
		}
		else
		{
			echo "
" . construct_phrase($vbphrase['replacing_unique_index_on_table_x'], "$table[name]") . "

";

			$fields = implode(', ', $table['fields']);

			$findquery = "SELECT $fields, COUNT(*) AS occurences
				FROM " . TABLE_PREFIX . "$table[name]
				GROUP BY $fields
				HAVING occurences > 1";
			$dupes = $db->query_write($findquery);

			if ($numdupes = $db->num_rows($dupes))
			{
				echo "
" . construct_phrase($vbphrase['found_x_duplicate_record_occurences'], "$numdupes") . "
";

				while ($dupe = $db->fetch_array($dupes))
				{
					$cond = array();

					foreach ($dupe AS $fieldname => $field)
					{
						if ($fieldname != 'occurences')
						{
							$cond[] = "$fieldname = " . iif(is_numeric($field), $field, "'" . $db->escape_string($field) . "'");
						}
					}

					$dupesquery = "DELETE FROM " . TABLE_PREFIX . "$table[name] WHERE " . implode(" AND ", $cond) . " ";

					if ($table['autoinc'])
					{
						$max = $db->query_first("
							SELECT MAX($table[autoinc]) AS maxid
							FROM " . TABLE_PREFIX . "$table[name]
							WHERE " . implode("\nAND ", $cond) . "
						");
						$dupesquery .= "AND $table[autoinc] <> $max[maxid]";
					}
					else
					{
						$dupesquery .= "LIMIT " . ($dupe['occurences'] - 1);
					}

					$db->query_write($dupesquery);
					echo "
$vbphrase[deleted_duplicate_occurence]
";
				}
				$db->free_result($dupes);

				echo "

";
			}

			if (isset($keys["$table[keyname]"]))
			{
				$killindexquery = "ALTER TABLE " . TABLE_PREFIX . "$table[name] DROP INDEX $table[keyname]";
				echo "
$vbphrase[dropping_non_unique_index] ";
				$db->query_write($killindexquery);
				echo "$vbphrase[done]
";
			}

			$createindexquery = "ALTER TABLE " . TABLE_PREFIX . "$table[name] ADD " . iif($table['name'] == 'access', 'PRIMARY', 'UNIQUE') . " KEY $table[keyname] ($fields)";
			echo "
$vbphrase[creating_unique_index] ";
			$db->query_write($createindexquery);
			echo "$vbphrase[done]
";

			echo "
";

			$nexttableid = $tableid + 1;
		}

		return $nexttableid;
	}

	$uniquetables = array();

	foreach ($schema['CREATE']['query'] AS $tablename => $query)
	{
		if (preg_match('#unique key (\w+)\s*\(([\w, ]+)\)#siU', $query, $regs) OR ($tablename == 'access' AND preg_match('#primary key (\w+)\s*\(([\w, ]+)\)#siU', $query, $regs)))
		{
			if (preg_match('#\t+(\w+id)\s+[\w- ]+AUTO_INCREMENT#iU', $query, $regs2))
			{
				$autoinc = $regs2[1];
			}
			else
			{
				$autoinc = false;
			}

			$uniquetables[] = array(
				'name'    => $tablename,
				'keyname' => $regs[1],
				'fields'  => preg_split('#\s*,\s*#si', $regs[2], -1, PREG_SPLIT_NO_EMPTY),
				'autoinc' => $autoinc
			);
		}
	}

	echo "
$vbphrase[fix_unique_indexes]
";

	//while ($nexttableid >= 0)
	//{
		$nexttableid = fix_unique_index($vbulletin->GPC['tableid']);
	//}

	if ($nexttableid >= 0)
	{
		print_form_header('repair', 'fixunique', 0, 1, 'cpform', '25%');
		construct_hidden_code('tableid', $nexttableid);
		print_table_header("
$vbphrase[fix_unique_indexes]
");
		print_submit_row($vbphrase['continue'], false);
	}
	else
	{
		print_form_header('repair', '', 0, 1, 'cpform', '65%');
		print_table_header($vbphrase['fix_unique_indexes']);
		print_description_row($vbphrase['all_unique_indexes_checked']);
		print_submit_row($vbphrase['proceed'], false);
	}

}

print_cp_footer();

/*======================================================================*\
|| ####################################################################
|| #
|| # CVS: $RCSfile$ - $Revision: 32878 $
|| ####################################################################
\*======================================================================*/
?>


text:
package com.siyeh.igtest.performance.arrays_as_list_with_one_argument;

import java.util.Arrays;

class ArraysAsListWithZeroOrOneArgument {{
  Arrays.asList();
  Arrays.asList("one");
  Arrays.asList("one", "two");
  Arrays.asList(new String[] {"asdf", "foo"});
}}


text:
package com.axellience.vuegwtexamples.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.TextResource;

public interface JsFilesResources extends ClientBundle {

  JsFilesResources INSTANCE = GWT.create(JsFilesResources.class);

  @Source("js-components.js")
  TextResource jsComponents();
}


text:
import * as util from './util.mjs';
import * as shared from './shared.mjs';
import {renderPosts, container} from './render.js';
import * as dbHelper from './firebaseHelper.mjs';

dbHelper.setApp(firebase.initializeApp(shared.firebaseConfig));

let _posts = [];
let _filteringBy = null;
let gsignin;

async function fetchPosts(url, maxResults = null) {
  try {
    url = new URL(url, location);
    if (maxResults) {
      url.searchParams.set('maxresults', maxResults);
    }
    const resp = await fetch(url.href);
    const json = await resp.json();
    if (!resp.ok || json.error) {
      throw Error(json.error);
    }
    return json;
  } catch (err) {
    throw err;
  }
}

function handleDelete(el, dateStr, url) {
  if (!confirm('Are you sure you want to delete this post?')) {
    return false;
  }

  gsignin.authenticated().then(token => {
    const date = new Date(dateStr);
    dateStr = date.toJSON();
    const [year, month, day] = dateStr.split('-');

    dbHelper.deletePost(year, month, url); // async
  });

  return false;
}

function filterBy(key, needle = null) {
  const filteringParams = ['domain', 'author'];

  if (key && !filteringParams.includes(key)) {
    return;
  }

  const currentURL = new URL(location.href);
  const params = currentURL.searchParams;
  const filterEl = document.querySelector('#filtering');
  const needleEl = filterEl.querySelector('.filtering-needle');

  filterEl.hidden = false;

  // Clear all previous filters.
  for (const key of params.keys()) {
    if (filteringParams.includes(key)) {
      params.delete(key);
    }
  }

  let filteredPosts = _posts;

  // TODO: support filtering on more than one thing.
  if (needle === _filteringBy) {
    params.delete(key);
    _filteringBy = null;
  } else {
    filteredPosts = filteredPosts.filter(post => post[key] && post[key].match(needle));
    params.set(key, needle);
    needleEl.textContent = needle;
    _filteringBy = needle;
  }

  setTimeout(() => filterEl.classList.toggle('on', _filteringBy !== null), 0);

  window.history.pushState(null, '', currentURL.href);
  renderPosts(filteredPosts, container);
}

function clearFilters() {
  _filteringBy = null
  filterBy(null, null);
  return false;
}

/**
 * @param {string} year Year to monitor updates for.
 */
function realtimeUpdatePosts(year) {
  const originalTitle = document.title;
  let numChanges = 0;

  // Subscribe to real-time db updates for current year.
  // TODO: setup monitoring changes for previous years. e.g. refresh UI if a
 //  previous year's post is deleted.
  dbHelper.monitorRealtimeUpdateToPosts(year, async changes => {
    if (document.hidden) {
      document.title = `(${++numChanges}) ${originalTitle}`;
    }

    const month = changes[0].oldIndex; // Index in collection maps to the month.

    _posts = _posts.filter(post => {
      const s = new Date(post.submitted);
      const inMonthAndYear = String(s.getFullYear()) === year && s.getMonth() === month;
      return !inMonthAndYear || (inMonthAndYear && post.submitter.bot);
    });

    // for (const change of changes) {
    //   const items = change.doc.data().items;
    // }
    const updatePosts = changes[0].doc.data().items;

    _posts = util.uniquePosts([...updatePosts, ..._posts]); // update cache.

    // TODO: only render deltas. Currently rendering the entire list.
    renderPosts(_posts, container);
  });

  // Show additions as they come in the tab title.
  document.addEventListener('visibilitychange', e => {
    if (!document.hidden && numChanges) {
      document.title = originalTitle;
      numChanges = 0;
    }
  });
}

function toggleHelp() {
  function handleOverlayClick(e) {
    const helpContent = document.querySelector('.help-content');
    if (!helpContent.contains(e.target)) {
      toggleHelp();
      help.removeEventListener('click', handleOverlayClick);
    }
  }

  function handleKeyDown(e) {
    if (e.keyCode === 27) {
      toggleHelp();
      document.body.removeEventListener('keyup', handleKeyDown);
    }
  }

  const help = document.querySelector('#help');
  help.classList.toggle('active');

  if (help.classList.contains('active')) {
    document.body.style.overflow = 'hidden';
    help.addEventListener('click', handleOverlayClick);
    document.body.addEventListener('keyup', handleKeyDown);
  } else {
    document.body.style.overflow = '';
    help.removeEventListener('click', handleOverlayClick);
    document.body.removeEventListener('keyup', handleKeyDown);
  }
  return false;
}

/**
 * Shares a post using the Web Share API.
 * @param {!HTMLElement} el Target element that trigger the event.
 * @param {!HTMLElement} url URL of the post to share.
 * @param {!HTMLElement} title Title of the post.
 * @return {boolean}
 */
function sharePost(el, url, title) {
  if (navigator.share) {
    navigator.share({title, url})
      .catch(err => console.err('Error with web sharing', err));
  }
  return false;
}

async function getPosts(forYear, includeTweets = false, uid = null) {
  const url = new URL(`/posts/${forYear}`, location);
  if (uid) {
    url.searchParams.set('uid', uid);
  }
  const thisYearsPosts = await fetchPosts(url.href);

  const posts = thisYearsPosts;
  if (includeTweets) {
    const tweets = await fetchPosts(`/tweets/ChromiumDev`);
    posts.push(...tweets);
  }

  // Ensure list of rendered posts is unique based on URL.
  return util.uniquePosts(posts);
}

async function initAuth() {
  const {GSignIn} = await import('./auth.js');
  gsignin = new GSignIn();

  const uid = await gsignin.init();
  if (uid) {
    container.classList.add('edit');
  }
  return uid;
}

// Add sharing icon if supported by the browser.
document.body.classList.toggle('supports-share', !!navigator.share);

(async() => {
  const PRE_RENDERED = container.querySelector('#posts'); // Already exists in DOM if we've SSR.

  let params = new URL(location.href).searchParams;
  const year = params.get('year') || util.currentYear;
  const includeTweets = params.has('tweets');

  const uid = await initAuth(); // Check user's auth state.

  // Populates client-side cache for future realtime updates.
  _posts = await getPosts(year, includeTweets, uid);

  // Posts markup is already in place if we're SSRing. Don't re-render DOM.
  if (!PRE_RENDERED) {
    renderPosts(_posts, container);
  }

  realtimeUpdatePosts(util.currentYear);  // Subscribe to realtime firestore updates for current year.

  // Filter list after data has been set.
  params = new URL(location.href).searchParams; // get params again since they may have changed since auth.
  for (const key of params.keys()) {
    filterBy(key, params.get(key));
  }
})();

window.handleDelete = handleDelete;
window.filterBy = filterBy;
window.clearFilters = clearFilters;
window.toggleHelp = toggleHelp;
window.sharePost = sharePost;


text:
.mw-10 {
	min-width: 100px;
}

.mw-20 {
	min-width: 200px;
}

.mw-30 {
	min-width: 300px;
}

.xw-30 {
	max-width: 300px;
}

.xw-40 {
	max-width: 400px;
}

.xw-50 {
	max-width: 500px;
}

.mh-10 {
	min-height: 100px;
}

.mh-20 {
	min-height: 200px;
}

.mh-30 {
	min-height: 300px;
}

.xh-30 {
	max-height: 300px;
}

.xh-40 {
	max-height: 400px;
}

.xh-50 {
	max-height: 500px;
}

.noresize {
	resize: none;
}

.vresize {
	resize: vertical;
}

.hresize {
	resize: horizontal;
}

.fs-1x {
	font-size: 1em;
}

.fs-2x {
	font-size: 2em;
}

.fs-3x {
	font-size: 3em;
}

.fs-4x {
	font-size: 4em;
}

.fs-5x {
	font-size: 5em;
}

.text-ellipsis {
	overflow: hidden;
	-ms-text-overflow: ellipsis;
	-o-text-overflow: ellipsis;
	text-overflow: ellipsis;
	display: block;
	white-space: nowrap;
}

.unselectable {
	-moz-user-select: none;
	-ms-user-select: none;
	-webkit-user-select: none;
	-webkit-user-drag: none;
	user-select: none;
	user-drag: none;
}

.radio,
.checkbox {
	font-weight: 400;
	display: block;
	line-height: normal !important;
	text-indent: initial !important;
	white-space: nowrap;
}

.radio .cr,
.checkbox .cr {
	position: relative !important;
	display: inline-block;
	border: 1px solid #a9a9a9;
	border-radius: .25em;
	width: 1.3em;
	height: 1.3em;
	float: left;
	margin-right: .5em;
}

.radio .cr {
	border-radius: 50%;
}

.radio .cr .cr-icon,
.checkbox .cr .cr-icon {
	position: absolute !important;
	font-size: .8em;
	line-height: 0;
	top: 50%;
	left: 20%;
}

.radio .cr .cr-icon {
	margin-left: 0.04em;
}

.radio.btn,
.checkbox.btn {
	border: 0;
	padding: 0;
	color: #333;
	background-color: #fff;
}

.checkbox.btn {
	padding-left: 27px;
	border: 1px solid #ccc;
	background-color: #eee;
}

.radio.btn .cr {
	display: none;
}

.checkbox.btn .cr {
	position: absolute !important;
	left: 5px;
	top: 0;
	border: 0;
}

.checkbox.btn-ms {
	padding-left: 32px;
}

.checkbox.btn-ms .cr {
	left: 7px;
	top: 7px;
	background-color: #fff;
	border: 1px solid #ccc;
}

.radio:after,
.checkbox:after {
	content: '';
	display: table;
	clear: both;
}

.radio:focus,
.checkbox:focus {
	border-color: #66afe9;
	outline: 0;
	-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, 0.6);
	box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, 0.6);
}

.radio input[type="radio"],
.checkbox input[type="checkbox"] {
	display: none !important;
}

.radio input[type="radio"]+.cr>.cr-icon,
.checkbox input[type="checkbox"]+.cr>.cr-icon {
	transform: scale(3) rotateZ(-20deg);
	opacity: 0;
	transition: all .3s ease-in;
	color: #797979;
}

.radio.btn input[type="radio"]+.cr>.cr-icon,
.checkbox.btn input[type="checkbox"]+.cr>.cr-icon {
	transform: scale(0) rotateZ(-50deg);
}

.radio.btn input[type="radio"]+.cr+span,
.checkbox.btn input[type="checkbox"]+.cr+span {
	border: 1px solid #ccc;
	display: block;
	padding: 3px 7px;
	border-radius: 3px;
	color: #333;
	background-color: #fff;
	font-size: 12px;
	line-height: 1;
}

.radio.btn-ms input[type="radio"]+.cr+span,
.checkbox.btn-ms input[type="checkbox"]+.cr+span {
	padding: 7px 12px;
	font-size: 14px;
	line-height: 18px;
	border-radius: 4px;
}

.checkbox.btn input[type="checkbox"]+.cr+span {
	border: 0;
	border-left: 1px solid #ccc;
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
}

.radio input[type="radio"]:checked+.cr>.cr-icon,
.checkbox input[type="checkbox"]:checked+.cr>.cr-icon {
	transform: scale(1) rotateZ(0deg);
	opacity: 1;
}

.radio.btn input[type="radio"]:checked+.cr+span {
	color: #fff;
	background-color: #337ab7;
	border-color: #2e6da4;
}

.radio input[type="radio"]:disabled+.cr,
.radio.btn input[type="radio"]:disabled+.cr+span,
.checkbox input[type="checkbox"]:disabled+.cr {
	opacity: .7;
	background-color: #ddd;
	cursor: not-allowed;
	color: #333;
}

.radio.btn,
.checkbox.btn,
label:not([class="radio"]):not([class="checkbox"])+.radio,
label:not([class="radio"]):not([class="checkbox"])+.checkbox {
	margin-top: 0;
}

.radio.btn,
.radio.inline,
.checkbox.btn,
.checkbox.inline {
	display: inline-block !important;
}

.radio.btn+.radio,
.radio.inline+.radio,
.checkbox.btn+.checkbox,
.checkbox.inline+.checkbox {
	margin-left: .5em;
}

.input-group .radio,
.input-group .checkbox {
	display: table-cell !important;
	line-height: initial !important;
	width: auto;
}

.uploader-group .btn-file {
	position: relative !important;
	white-space: nowrap;
	display: table-cell !important;
	padding: 6px 16px;
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
	vertical-align: middle;
	width: 1%;
}

.uploader-group .btn-file>.glyphicon:before {
	margin-right: 10px;
}

.uploader-group .btn-file>input[type=file] {
	position: absolute !important;
	top: 0;
	right: 0;
	min-width: 100%;
	min-height: 100%;
	text-align: right;
	opacity: 0;
	background: none repeat scroll 0 0 transparent;
	cursor: inherit;
	display: block;
}

.uploader-group .file-caption {
	display: inline-block;
	overflow: hidden;
	word-break: break-all;
	color: #aaa;
	height: 34px;
}

.uploader-group+.uploader-group {
	margin-top: 10px;
}

.uploader-group .file-item {
	position: relative !important;
	top: 0;
	left: -5px;
	width: 100%;
	height: 100%;
	margin: 0 0;
	border: 1px solid transparent;
	border-radius: 4px;
	cursor: pointer;
	padding: 0;
	display: inline-block;
	font-style: normal;
	font-weight: 400;
	line-height: 1;
	font-size: 14px;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.uploader-group .file-item:before {
	font-family: 'Glyphicons Halflings';
	font-size: 16px;
	content: "\e022";
	padding-right: 5px;
	vertical-align: middle;
}

.uploader-group .file-item[data-type^=image]:before {
	content: "\e060";
}

.uploader-group .file-item[data-type^=video]:before {
	content: "\e009";
}

.uploader-group .file-item[data-type^=audio]:before {
	content: "\e002";
}

.uploader-group.file-list .file-item:before {
	padding-right: 0;
}

.uploader-group.file-list .file-item:hover {
	border: 1px solid #ccc;
}

.uploader-group.file-list .file-item {
	margin: 0;
	padding: 3px;
	width: 24px;
	height: 22px;
}

.uploader-group.file-list .file-item+.file-item {
	margin-left: 3px;
}

.btn-file::-ms-browse {
	/* IE 10 fix */
	width: 100%;
	height: 100%;
}

.modal.vertical-center {
	text-align: center;
	padding: 0 !important;
}

.modal.vertical-center:before {
	content: '';
	display: inline-block;
	height: 100%;
	vertical-align: middle;
	margin-right: -4px;
}

.modal.vertical-center .modal-dialog {
	display: inline-block;
	text-align: left;
	vertical-align: middle;
}

.af_waiting_message {
	position: fixed !important;
	top: 10px;
	left: 10px;
	z-index: 99998;
}

.af_waiting_message .progress {
	margin: 10px 0 0;
}

/* ========================================================================
* http://bootsnipp.com/
* ======================================================================== */

.gly-rotate-90 {
	filter: progid: DXImageTransform.Microsoft.BasicImage(rotation=1);
	-webkit-transform: rotate(90deg);
	-moz-transform: rotate(90deg);
	-ms-transform: rotate(90deg);
	-o-transform: rotate(90deg);
	transform: rotate(90deg);
}

.gly-rotate-180 {
	filter: progid: DXImageTransform.Microsoft.BasicImage(rotation=2);
	-webkit-transform: rotate(180deg);
	-moz-transform: rotate(180deg);
	-ms-transform: rotate(180deg);
	-o-transform: rotate(180deg);
	transform: rotate(180deg);
}

.gly-rotate-270 {
	filter: progid: DXImageTransform.Microsoft.BasicImage(rotation=3);
	-webkit-transform: rotate(270deg);
	-moz-transform: rotate(270deg);
	-ms-transform: rotate(270deg);
	-o-transform: rotate(270deg);
	transform: rotate(270deg);
}

.gly-flip-horizontal {
	filter: progid: DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);
	-webkit-transform: scale(-1, 1);
	-moz-transform: scale(-1, 1);
	-ms-transform: scale(-1, 1);
	-o-transform: scale(-1, 1);
	transform: scale(-1, 1);
}

.gly-flip-vertical {
	filter: progid: DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);
	-webkit-transform: scale(1, -1);
	-moz-transform: scale(1, -1);
	-ms-transform: scale(1, -1);
	-o-transform: scale(1, -1);
	transform: scale(1, -1);
}

.gly-fast-right-spin {
	-webkit-animation: gly-spin-r 1s infinite linear;
	animation: gly-spin-r 1s infinite linear;
}

.gly-normal-right-spin {
	-webkit-animation: gly-spin-r 2s infinite linear;
	animation: gly-spin-r 2s infinite linear;
}

.gly-slow-right-spin {
	-webkit-animation: gly-spin-r 3s infinite linear;
	animation: gly-spin-r 3s infinite linear;
}

.gly-fast-left-spin {
	-webkit-animation: gly-spin-l 1s infinite linear;
	animation: gly-spin-l 1s infinite linear;
}

.gly-normal-left-spin {
	-webkit-animation: gly-spin-l 2s infinite linear;
	animation: gly-spin-l 2s infinite linear;
}

.gly-slow-left-spin {
	-webkit-animation: gly-spin-l 3s infinite linear;
	animation: gly-spin-l 3s infinite linear;
}

@-webkit-keyframes gly-spin-r {
	0% {
		-webkit-transform: rotate(0deg);
		transform: rotate(0deg);
	}
	100% {
		-webkit-transform: rotate(359deg);
		transform: rotate(359deg);
	}
}

@keyframes gly-spin-r {
	0% {
		-webkit-transform: rotate(0deg);
		transform: rotate(0deg);
	}
	100% {
		-webkit-transform: rotate(359deg);
		transform: rotate(359deg);
	}
}

@-webkit-keyframes gly-spin-l {
	0% {
		-webkit-transform: rotate(359deg);
		transform: rotate(359deg);
	}
	100% {
		-webkit-transform: rotate(0deg);
		transform: rotate(0deg);
	}
}

@keyframes gly-spin-l {
	0% {
		-webkit-transform: rotate(359deg);
		transform: rotate(359deg);
	}
	100% {
		-webkit-transform: rotate(0deg);
		transform: rotate(0deg);
	}
}


text:
package org.wso2.carbon.registry.core.test.performance;

import org.wso2.carbon.registry.core.Collection;
import org.wso2.carbon.registry.core.Registry;
import org.wso2.carbon.registry.core.RegistryConstants;
import org.wso2.carbon.registry.core.Resource;
import org.wso2.carbon.registry.core.exceptions.RegistryException;

import java.util.HashMap;
import java.util.Map;

public class Worker3 extends Worker {

    public static final String QUERY_PATH = "/qs/q";

    public Worker3(String threadName, int iterations, Registry registry) {
        super(threadName, iterations, registry);

        try {
            String sql1 = "SELECT RT.REG_RATING_ID FROM REG_RESOURCE_RATING RT, REG_RESOURCE R " +
                    "WHERE (R.REG_VERSION=RT.REG_VERSION OR " +
                    "(R.REG_PATH_ID=RT.REG_PATH_ID AND R.REG_NAME=RT.REG_RESOURCE_NAME)) " +
                    "AND R.REG_DESCRIPTION LIKE ?";
            Resource q1 = registry.newResource();
            q1.setContent(sql1);
            q1.setMediaType(RegistryConstants.SQL_QUERY_MEDIA_TYPE);
            q1.addProperty(RegistryConstants.RESULT_TYPE_PROPERTY_NAME,
                    RegistryConstants.RATINGS_RESULT_TYPE);
            registry.put(QUERY_PATH, q1);
        } catch (RegistryException e) {
            e.printStackTrace();
        }
    }

    public void run() {

        long time1 = System.nanoTime();

        try {
            for (int i = 0; i < iterations; i++) {

                System.out.println("Iteration number: " + i);

                Resource r1 = registry.newResource();
                r1.setContent("test content for custom queries".getBytes());
                r1.setDescription("production ready.");

                long putStart = System.nanoTime();
                //*****************************//
                registry.put(basePath + i + "/s1/a1", r1);
                //*****************************//
                long putEnd = System.nanoTime();
                long putTime = putEnd - putStart;
                System.out.println("CSV," + threadName + "," + "put," + putTime / 1000000);
                r1.discard();

                long queryStart = System.nanoTime();
                //*****************************//
                Map<String, String> params = new HashMap<String, String>();
                params.put("1", "%production%");
                Collection r2 = registry.executeQuery(QUERY_PATH, params);

                //*****************************//
                long queryEnd = System.nanoTime();
                long queryTime = queryEnd - queryStart;
                System.out.println("CSV," + threadName + "," + "query," + queryTime / 1000000);

                r2.discard();

                long deleteStart = System.nanoTime();
                //*****************************//
                registry.delete(basePath + i + "/s1/a1");
                //*****************************//
                long deleteEnd = System.nanoTime();
                long deleteTime = deleteEnd - deleteStart;
                System.out.println("CSV," + threadName + "," + "delete," + deleteTime / 1000000);

            }

        } catch (RegistryException e) {
            //log.error("Error occurred while running the performance test. Thread: " +
            //        threadName + ", Iterations: " + iterations, e);
            e.printStackTrace();
        }

        long time2 = System.nanoTime();

        long elapsedTime = time2 - time1;
        System.out.println("============= Thread: " + threadName + ". Time taken for test: " +
                elapsedTime + "  =============");
    }
}


text:
<?php

namespace common\sammaye;

use Yii;
use yii\base\Behavior;
use yii\db\ActiveRecord;

class LoggableBehavior extends Behavior
{
	private $_oldattributes = array();

	public $allowed = array();
	public $ignored = array();
	public $ignoredClasses = array('common\models\Constants','common\models\CustomScoreLog');

	public $dateFormat = 'Y-m-d H:i:s';
	public $userAttribute = null;

	public $storeTimestamp = false;
	public $skipNulls = true;

	public function events()
	{
		return [
			ActiveRecord::EVENT_AFTER_FIND => 'afterFind',
			ActiveRecord::EVENT_AFTER_INSERT => 'afterInsert',
			ActiveRecord::EVENT_AFTER_UPDATE => 'afterUpdate',
			ActiveRecord::EVENT_AFTER_DELETE => 'afterDelete',
		];
	}

	public function afterDelete($event)
	{
		$this->leaveTrail('DELETE');
	}

	public function afterFind($event)
	{
		$this->setOldAttributes($this->owner->getAttributes());
	}

	public function afterInsert($event)
	{
		$this->audit(true);
	}

	public function afterUpdate($event)
	{
		$this->audit(false);
	}

	public function audit($insert)
	{
		$allowedFields = $this->allowed;
		$ignoredFields = $this->ignored;
		$ignoredClasses = $this->ignoredClasses;

		$newattributes = $this->owner->getAttributes();
		$oldattributes = $this->getOldAttributes();

		// Lets check if the whole class should be ignored
		if(sizeof($ignoredClasses) > 0){
			if(array_search(get_class($this->owner), $ignoredClasses) !== false) return;
		}

		// Lets unset fields which are not allowed
		if(sizeof($allowedFields) > 0){
			foreach($newattributes as $f => $v){
				if(array_search($f, $allowedFields) === false) unset($newattributes[$f]);
			}

			foreach($oldattributes as $f => $v){
				if(array_search($f, $allowedFields) === false) unset($oldattributes[$f]);
			}
		}

		// Lets unset fields which are ignored
		if(sizeof($ignoredFields) > 0){
			foreach($newattributes as $f => $v){
				if(array_search($f, $ignoredFields) !== false) unset($newattributes[$f]);
			}

			foreach($oldattributes as $f => $v){
				if(array_search($f, $ignoredFields) !== false) unset($oldattributes[$f]);
			}
		}

		// If no difference then WHY?
		// There is some kind of problem here that means "0" and 1 do not diff for array_diff so beware: stackoverflow.com/questions/12004231/php-array-diff-weirdness :S
		if(count(array_diff_assoc($newattributes, $oldattributes)) <= 0) return;

		// If this is a new record lets add a CREATE notification
		if ($insert){
			$this->leaveTrail('CREATE');
		}

		// Now lets actually write the attributes
		$this->auditAttributes($insert, $newattributes, $oldattributes);

		// Reset old attributes to handle the case with the same model instance updated multiple times
		$this->setOldAttributes($this->owner->getAttributes());
	}

	public function auditAttributes($insert, $newattributes, $oldattributes = array())
	{
                       $oldValueArray=array();
                       $newValueArray=array();
                       $nameArray=array();
		foreach ($newattributes as $name => $value) {
			$old = isset($oldattributes[$name]) ? $oldattributes[$name] : '';

			// If we are skipping nulls then lets see if both sides are null
			if($this->skipNulls && empty($old) && empty($value)){
				continue;
			}

			// If they are not the same lets write an audit log

			if ($value != $old) {
				$oldValueArray[$name]=$old;
                                $newValueArray[$name]=$value;
                                $nameArray[]=$name;
                               // $this->leaveTrail($insert ? 'SET' : 'CHANGE', $name, $value, $old);

			}

		}

                //\Yii::trace(print_r($oldValueArray,true),__METHOD__);
                //\Yii::trace(print_r($newValueArray,true),__METHOD__);

                if(count($oldValueArray)>0)
                {
                 //$this->leaveTrail($insert ? 'SET' : 'CHANGE', $name, $value, $old);
                 $this->leaveTrail($insert ? 'SET' : 'CHANGE', serialize($nameArray), serialize($newValueArray), serialize($oldValueArray));
                }

	}

	public function leaveTrail($action, $name = null, $value = null, $old_value = null)
	{
		$log			= new AuditTrail();
		$log->old_value = $old_value;
		$log->new_value = $value;
		$log->action	= $action;
		$log->model		= $this->owner->className(); // Gets a plain text version of the model name
		$log->model_id	= (string)$this->getNormalizedPk();
		$log->field		= $name;
		$log->stamp		= $this->storeTimestamp ? time() : date($this->dateFormat); // If we are storing a timestamp lets get one else lets get the date
		$log->user_id	= (string)$this->getUserId(); // Lets get the user id
		return $log->save();
	}

	public function getOldAttributes()
	{
		return $this->_oldattributes;
	}

	public function setOldAttributes($value)
	{
		$this->_oldattributes=$value;
	}

	public function getUserId()
	{
		if(isset($this->userAttribute)){
			$data = $this->owner->getAttributes();
			return isset($data[$this->userAttribute]) ? $data[$this->userAttribute] : null;
		}else{
			try {
				$userid = Yii::$app->user->id;
				return empty($userid) ? null : $userid;
			} catch(Exception $e) { //If we have no user object, this must be a command line program
				return null;
			}
		}
	}

	protected function getNormalizedPk()
	{
		$pk = $this->owner->getPrimaryKey();
		return is_array($pk) ? json_encode($pk) : $pk;
	}
}


text:
require 'three_scale_api/clients/default'
require 'three_scale_api/clients/application_plan_limit'
require 'three_scale_api/clients/method'
require 'three_scale_api/resources/metric'

module ThreeScaleApi
  module Clients
    # Metric resource manager wrapper for the metric entity received by REST API
    class MetricClient < DefaultClient

      def entity_name
        'metric'
      end

      # Base path for the REST call
      #
      # @return [String] Base URL for the REST call
      def url
        resource.url + '/metrics'
      end
    end
  end
end


text:
Movie trailer website for Udacity's Full Stack Web Developer Nanodegree

## Quickstart
### From Source Code
1. Clone the repo or simply download `fresh_tomatoes.py`
2. Make sure that [Python](https://www.python.org/downloads/) is installed and on the system PATH variable.
3. From the directory containing `fresh_tomatoes.py`, run: `python fresh_tomatoes.py`
4. Enjoy the beautiful website that pops up! :movie_camera:

### From HTML file
A copy of the webpage generated is available in the repo as `fresh_tomatoes.html`. Simply open this in the browser of your choice.


text:
run 'commands/admin'
run 'commands/basic'
run 'commands/cross'
run 'commands/joinpart'
run 'commands/help'
run 'commands/perms'


text:
import { AuthenticationService } from './../authentication.service';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { RegisterComponent } from './register.component';
import { ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { RouterTestingModule } from '@angular/router/testing';

describe('RegisterComponent', () => {
  let component: RegisterComponent;
  let fixture: ComponentFixture<RegisterComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ RegisterComponent ],
      imports: [ReactiveFormsModule, HttpModule, RouterTestingModule],
      providers: [AuthenticationService]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(RegisterComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});


text:
An `exportPathMap` path was matched to an API route. `next export` will not prerender API routes to HTML.

#### Possible Ways to Fix It

Remove any paths using API routes from your `exportPathMap` in `next.config.js`.

### Useful Links

- [Static HTML export](https://nextjs.org/docs#static-html-export)