text:
package com.dci.intellij.dbn.code.common.completion;

import gnu.trove.THashMap;

import java.util.Map;
import java.util.Set;

import org.jetbrains.annotations.NotNull;
import com.dci.intellij.dbn.code.common.completion.options.filter.CodeCompletionFilterSettings;
import com.dci.intellij.dbn.code.common.lookup.AliasLookupItemFactory;
import com.dci.intellij.dbn.code.common.lookup.LookupItemFactory;
import com.dci.intellij.dbn.code.common.lookup.VariableLookupItemFactory;
import com.dci.intellij.dbn.common.lookup.ConsumerStoppedException;
import com.dci.intellij.dbn.common.lookup.LookupConsumer;
import com.dci.intellij.dbn.common.util.NamingUtil;
import com.dci.intellij.dbn.connection.ConnectionHandler;
import com.dci.intellij.dbn.language.common.DBLanguageFile;
import com.dci.intellij.dbn.language.common.SqlLikeLanguage;
import com.dci.intellij.dbn.language.common.TokenType;
import com.dci.intellij.dbn.language.common.element.ElementType;
import com.dci.intellij.dbn.language.common.element.ElementTypeBundle;
import com.dci.intellij.dbn.language.common.element.IdentifierElementType;
import com.dci.intellij.dbn.language.common.element.LeafElementType;
import com.dci.intellij.dbn.language.common.element.TokenElementType;
import com.dci.intellij.dbn.language.common.element.impl.QualifiedIdentifierVariant;
import com.dci.intellij.dbn.language.common.element.path.ASTPathNode;
import com.dci.intellij.dbn.language.common.element.path.PathNode;
import com.dci.intellij.dbn.language.common.psi.BasePsiElement;
import com.dci.intellij.dbn.language.common.psi.IdentifierPsiElement;
import com.dci.intellij.dbn.language.common.psi.LeafPsiElement;
import com.dci.intellij.dbn.language.common.psi.PsiUtil;
import com.dci.intellij.dbn.language.common.psi.QualifiedIdentifierPsiElement;
import com.dci.intellij.dbn.language.common.psi.lookup.AliasDefinitionLookupAdapter;
import com.dci.intellij.dbn.language.common.psi.lookup.ObjectDefinitionLookupAdapter;
import com.dci.intellij.dbn.language.common.psi.lookup.PsiLookupAdapter;
import com.dci.intellij.dbn.language.common.psi.lookup.VariableDefinitionLookupAdapter;
import com.dci.intellij.dbn.object.DBSchema;
import com.dci.intellij.dbn.object.common.DBObject;
import com.dci.intellij.dbn.object.common.DBObjectBundle;
import com.dci.intellij.dbn.object.common.DBObjectType;
import com.dci.intellij.dbn.object.common.ObjectTypeFilter;
import com.intellij.codeInsight.completion.CompletionParameters;
import com.intellij.codeInsight.completion.CompletionProvider;
import com.intellij.codeInsight.completion.CompletionResultSet;
import com.intellij.psi.PsiComment;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.util.ProcessingContext;

public class CodeCompletionProvider extends CompletionProvider<CompletionParameters> {

    @Override
    protected void addCompletions(
            @NotNull CompletionParameters parameters,
            ProcessingContext processingContext,
            @NotNull CompletionResultSet result) {
        PsiFile originalFile = parameters.getOriginalFile();
        if (originalFile instanceof DBLanguageFile) {
            DBLanguageFile file = (DBLanguageFile) originalFile;

            CodeCompletionContext context = new CodeCompletionContext(file, parameters, result);
            CodeCompletionLookupConsumer consumer = new CodeCompletionLookupConsumer(context);
            SqlLikeLanguage language = context.getLanguage();

            int caretOffset = parameters.getOffset();
            if (file.findElementAt(caretOffset) instanceof PsiComment) return;

            LeafPsiElement leafBeforeCaret = PsiUtil.lookupLeafBeforeOffset(file, caretOffset);

            int invocationCount = parameters.getInvocationCount();
            if (invocationCount > 1) context.setExtended(true);

            if (leafBeforeCaret == null) {
                ElementTypeBundle elementTypeBundle = file.getElementTypeBundle();
                Set<LeafElementType> firstPossibleLeafs = elementTypeBundle.getRootElementType().getLookupCache().getFirstPossibleLeafs();
                for (LeafElementType firstPossibleLeaf : firstPossibleLeafs) {
                    if (firstPossibleLeaf instanceof TokenElementType) {
                        TokenElementType tokenElementType = (TokenElementType) firstPossibleLeaf;
                        TokenType tokenType = tokenElementType.getTokenType();
                        if (context.getCodeCompletionFilterSettings().acceptReservedWord(tokenType.getTokenTypeIdentifier())) {
                            LookupItemFactory lookupItemFactory = tokenElementType.getLookupItemFactory(language);
                            lookupItemFactory.createLookupItem(tokenElementType, consumer);
                        }
                    }
                }
            } else {
                leafBeforeCaret = (LeafPsiElement) leafBeforeCaret.getOriginalElement();
                try {
                    buildElementRelativeVariants(leafBeforeCaret, consumer);
                } catch (ConsumerStoppedException e) {

                }
            }
        }
    }

    private String getLeafUniqueKey(LeafElementType leaf) {
        if (leaf instanceof TokenElementType) {
            TokenElementType tokenElementType = (TokenElementType) leaf;
            return tokenElementType.getTokenType().getId();
        } else if (leaf instanceof IdentifierElementType){
            IdentifierElementType identifierElementType = (IdentifierElementType) leaf;
            return identifierElementType.getQualifiedObjectTypeName();
        }
        return null;
    }

    private void buildElementRelativeVariants(LeafPsiElement element, CodeCompletionLookupConsumer consumer) throws ConsumerStoppedException {

        CodeCompletionContext context = consumer.getContext();
        ConnectionHandler connectionHandler = context.getConnectionHandler();

        CodeCompletionFilterSettings filterSettings = context.getCodeCompletionFilterSettings();
        Map<String, LeafElementType> nextPossibleLeafs = new THashMap<String, LeafElementType>();
        DBObject parentObject = null;
        if (element.getParent() instanceof QualifiedIdentifierPsiElement) {
            QualifiedIdentifierPsiElement qualifiedIdentifier = (QualifiedIdentifierPsiElement) element.getParent();
            ElementType separator = qualifiedIdentifier.getElementType().getSeparatorToken();

            if (element.getElementType() == separator){
                BasePsiElement parentPsiElement = element.getPrevElement();
                if (parentPsiElement != null && parentPsiElement instanceof IdentifierPsiElement) {
                    IdentifierPsiElement identifierPsiElement = (IdentifierPsiElement) parentPsiElement;
                    parentObject = identifierPsiElement.resolveUnderlyingObject();

                    if (parentObject != null) {
                        for (QualifiedIdentifierVariant parseVariant : qualifiedIdentifier.getParseVariants()){
                            boolean match = parseVariant.matchesPsiElement(qualifiedIdentifier);
                            if (match) {
                                int index = qualifiedIdentifier.getIndexOf(identifierPsiElement);
                                LeafElementType leafElementType = parseVariant.getLeaf(index + 1);
                                if (leafElementType != null) {
                                    nextPossibleLeafs.put(getLeafUniqueKey(leafElementType), leafElementType);
                                }
                            }
                        }
                    }
                }
            }
        }

        if (nextPossibleLeafs.size() == 0) {
            LeafElementType elementType = (LeafElementType) element.getElementType();
            PathNode pathNode = new ASTPathNode(element.getNode());
            for (LeafElementType leafElementType : elementType.getNextPossibleLeafs(pathNode, filterSettings)) {
                String leafUniqueKey = getLeafUniqueKey(leafElementType);
                if (leafUniqueKey != null) {
                    nextPossibleLeafs.put(leafUniqueKey, leafElementType);
                }
            }
        }

        for (LeafElementType nextPossibleLeaf : nextPossibleLeafs.values()) {
            consumer.check();
            //boolean addParenthesis =
            //        nextPossibleLeaf.getLookupCache().getNextRequiredTokens().contains(
            //                element.getLanguage().getSharedTokenTypes().getLeftParenthesis());
            //consumer.setAddParenthesis(addParenthesis);

            if (nextPossibleLeaf instanceof TokenElementType) {
                TokenElementType tokenElementType = (TokenElementType) nextPossibleLeaf;
                TokenType tokenType = tokenElementType.getTokenType();
                //consumer.setAddParenthesis(addParenthesis && tokenType.isFunction());
                if (filterSettings.acceptReservedWord(tokenType.getTokenTypeIdentifier())) {
                    consumer.consume(tokenElementType);
                }
            }
            else if (nextPossibleLeaf instanceof IdentifierElementType) {
                IdentifierElementType identifierElementType = (IdentifierElementType) nextPossibleLeaf;
                if (identifierElementType.isReference()) {
                    DBObjectType objectType = identifierElementType.getObjectType();
                    if (identifierElementType.isObject()) {
                        PsiLookupAdapter lookupAdapter = new ObjectDefinitionLookupAdapter(null, objectType,  null);
                        Set<BasePsiElement> objectDefinitions = lookupAdapter.collectInParentScopeOf(element);
                        if (objectDefinitions != null) {
                            for (BasePsiElement psiElement : objectDefinitions) {
                                if (psiElement instanceof IdentifierPsiElement) {
                                    IdentifierPsiElement identifierPsiElement = (IdentifierPsiElement) psiElement;
                                    PsiElement referencedPsiElement = identifierPsiElement.resolve();
                                    if (referencedPsiElement instanceof DBObject) {
                                        DBObject object = (DBObject) referencedPsiElement;
                                        LookupItemFactory lookupItemFactory = object.getLookupItemFactory(identifierElementType.getLanguage());
                                        lookupItemFactory.createLookupItem(object, consumer);
                                    }
                                }
                            }
                        }

                        if (connectionHandler != null && !connectionHandler.isVirtual()) {
                            if (parentObject == null) {
                                BasePsiElement scope = element.getEnclosingScopePsiElement();
                                collectObjectMatchingScope(consumer, identifierElementType, filterSettings, scope, context);
                            } else {
                                for (DBObject object : parentObject.getChildObjects(identifierElementType.getObjectType())) {
                                    consumer.check();
                                    consumer.consume(object);
                                }
                            }
                        }

                    } else if (identifierElementType.isAlias()) {
                        PsiLookupAdapter lookupAdapter = new AliasDefinitionLookupAdapter(null, objectType,  null);
                        Set<BasePsiElement> aliasDefinitions = lookupAdapter.collectInParentScopeOf(element);
                        if (aliasDefinitions != null) {
                            for (PsiElement psiElement : aliasDefinitions) {
                                IdentifierPsiElement identifierPsiElement = (IdentifierPsiElement) psiElement;
                                AliasLookupItemFactory lookupItemFactory = new AliasLookupItemFactory(identifierPsiElement.getChars(), true);
                                lookupItemFactory.createLookupItem(identifierPsiElement, consumer);
                            }
                        }
                    } else if (identifierElementType.isVariable()) {
                        PsiLookupAdapter lookupAdapter = new VariableDefinitionLookupAdapter(null, objectType, null);
                        Set<BasePsiElement> aliasDefinitions = lookupAdapter.collectInParentScopeOf(element);
                        if (aliasDefinitions != null) {
                            for (BasePsiElement psiElement : aliasDefinitions) {
                                IdentifierPsiElement identifierPsiElement = (IdentifierPsiElement) psiElement;
                                VariableLookupItemFactory lookupItemFactory = new VariableLookupItemFactory(identifierPsiElement.getChars(), true);
                                lookupItemFactory.createLookupItem(identifierPsiElement, consumer);
                            }
                        }
                    }
                } else if (identifierElementType.isDefinition()) {
                    if (identifierElementType.isAlias()) {
                        String[] aliasNames = buildAliasDefinitionNames(element);
                        for (String aliasName : aliasNames) {
                            AliasLookupItemFactory lookupItemFactory = new AliasLookupItemFactory(aliasName, true);
                            lookupItemFactory.createLookupItem(aliasName, consumer);
                        }
                    }
                }
            }
        }
    }

    public String[] buildAliasDefinitionNames(BasePsiElement aliasElement) {
        IdentifierPsiElement aliasedObject = PsiUtil.lookupObjectPriorTo(aliasElement, DBObjectType.ANY);
        if (aliasedObject != null && aliasedObject.isObject()) {
            String[] aliasNames = NamingUtil.createAliasNames(aliasedObject.getUnquotedText());

            BasePsiElement scope = aliasElement.getEnclosingScopePsiElement();

            for (int i = 0; i< aliasNames.length; i++) {
                while (true) {
                    PsiLookupAdapter lookupAdapter = new AliasDefinitionLookupAdapter(null, DBObjectType.ANY, aliasNames[i]);
                    boolean isExisting = lookupAdapter.findInScope(scope) != null;
                    boolean isKeyword = aliasElement.getLanguageVersion().isReservedWord(aliasNames[i]);
                    if (isKeyword || isExisting) {
                        aliasNames[i] = NamingUtil.getNextNumberedName(aliasNames[i], false);
                    } else {
                        break;
                    }
                }
            }
            return aliasNames;
        }
        return new String[0];
    }

    private void collectObjectMatchingScope(
            LookupConsumer consumer,
            IdentifierElementType identifierElementType,
            ObjectTypeFilter filter,
            BasePsiElement sourceScope,
            CodeCompletionContext context) throws ConsumerStoppedException {
        DBObjectType objectType = identifierElementType.getObjectType();
        PsiElement sourceElement = context.getElementAtCaret();
        ConnectionHandler connectionHandler = context.getConnectionHandler();

        if (connectionHandler != null ) {
            DBObjectBundle objectBundle = connectionHandler.getObjectBundle();
            if (sourceElement.getParent() instanceof QualifiedIdentifierPsiElement && sourceElement.getParent().getFirstChild() != sourceElement) {
                QualifiedIdentifierPsiElement qualifiedIdentifierPsiElement = (QualifiedIdentifierPsiElement) sourceElement.getOriginalElement().getParent();
                DBObject parentObject = qualifiedIdentifierPsiElement.lookupParentObjectFor(identifierElementType);
                if (parentObject != null) {
                    DBSchema currentSchema = PsiUtil.getCurrentSchema(sourceScope);
                    objectBundle.lookupChildObjectsOfType(
                            consumer,
                            parentObject,
                            objectType,
                            filter,
                            currentSchema);

                }
            } else if (!identifierElementType.isLocalReference()){
                Set<DBObject> parentObjects = LeafPsiElement.identifyPotentialParentObjects(objectType, filter, sourceScope, null);
                if (parentObjects != null && parentObjects.size() > 0) {
                    for (DBObject parentObject : parentObjects) {
                        DBSchema currentSchema = PsiUtil.getCurrentSchema(sourceScope);
                        objectBundle.lookupChildObjectsOfType(
                                consumer,
                                parentObject,
                                objectType,
                                filter,
                                currentSchema);
                    }
                } else {
                    if (filter.acceptsRootObject(objectType)) {
                        objectBundle.lookupObjectsOfType(
                                consumer,
                                objectType);
                    }
                }
            }
        }
    }
}


text:
/*
 *  Document   : readyInbox.js
 *  Author     : pixelcave
 */
var ReadyInbox = function () {
    return {
        init: function () {
            var t = "active";
            $("thead input:checkbox").click(function () {
                var c = $(this).prop("checked"),
                    s = $(this).closest("table");
                c ? $("tbody tr", s).addClass(t) : $("tbody tr", s).removeClass(t), $("tbody input:checkbox", s).each(function () {
                    $(this).prop("checked", c)
                })
            }), $("tbody input:checkbox").click(function () {
                var c = $(this).prop("checked"),
                    s = $(this).closest("tr");
                c ? s.addClass(t) : s.removeClass(t)
            }), $(".msg-fav-btn").click(function () {
                $(this).toggleClass("text-muted text-warning"), $("i", this).toggleClass("fa-star-o fa-star")
            }), $(".msg-read-btn").click(function () {
                $(this).toggleClass("text-muted text-success")
            })
        }
    }
}();

redpajama_set_name: RedPajamaGithub


text:
'use strict';
var ObjectManage = require('object-manage')
  , util = require('util')
  , File = require('./File')

/**
 * APX Request Constructor
 *
 * Takes an arbitrary number of parameters that get loaded data
 * @constructor
 */
var Request = function(){
  ObjectManage.apply(this,arguments)
}
util.inherits(Request,ObjectManage)

/**
 * Reference to an incoming file object should be set by the translator
 * @type {Array}
 */
Request.prototype.files = []

/**
 * Add file to the request by path
 * @param path
 */
Request.prototype.addFile = function(path){
  this.files.push(new File(path))
}

module.exports = Request


text:
layout: post
title: Membership
description: How to Join IEEE WIE
image: assets/images/pic03.jpg
nav-menu: true
---

To join, just be a member of IEEE WIE. Join at ieee.org. Contact wie@umn.edu or like our Facebook page (IEEE Women in Engineering Student Branch UMN) for more info.

Feel free to stop by any of our events or our room in Keller Hall - Room 2-117.


text:
<?php
	class InstallDB extends InstallerState{
		/**
		 * @access public
		 */
		public function updateState(){

		}

		/**
		 * @access public
		 */
		public function updateOutput(){

		}

		/**
		 *
		 */
		public function setInput($arrayInput){
			$this->arrayInput = $arrayInput;
		}
	}
?>


text:
package cn.edu.fudan.se.DataExtractor.codeAnalyze;

import org.junit.Ignore;
import org.junit.Test;

import java.util.LinkedList;

import cn.edu.fudan.se.DataExtractor.mybatisDao.CodeAnalyzeDao;
import cn.edu.fudan.se.DataExtractor.mybatisDao.DeleteDao;

public class InsertTest {

	@Test
	public void testField(){
		CodeField field = new CodeField();
		field.setFieldName("test");
		field.setClassId(2);
		field.setType(TYPE_VALUE.TYPE_CLASS);
		field.setInnerClassId(1);

		CodeAnalyzeDao.getInstance().insertField(field);
	}

	@Test
	public void testListField(){
		CodeField field = new CodeField();
		field.setFieldName("test");
		field.setClassId(2);
		field.setType(TYPE_VALUE.TYPE_CLASS);
		field.setInnerClassId(1);
		CodeField field1 = new CodeField();
		field1.setFieldName("test");
		field1.setClassId(2);
		field1.setType(TYPE_VALUE.TYPE_CLASS);
		field1.setInnerClassId(1);
		CodeField field2 = new CodeField();
		field2.setFieldName("test");
		field2.setClassId(2);
		field2.setType(TYPE_VALUE.TYPE_CLASS);
		field2.setInnerClassId(1);

		LinkedList<CodeField> fieldList = new LinkedList<CodeField>();
		fieldList.add(field);
		fieldList.add(field1);
		fieldList.add(field2);
		CodeAnalyzeDao.getInstance().insertField(fieldList);
	}

	@Ignore
	public void testParameter(){
		CodeParameter parameter = new CodeParameter();
		parameter.setCodeMethodId(1);
		parameter.setParameterType("sdads");
		CodeAnalyzeDao.getInstance().insertParameter(parameter);
	}

	@Test
	public void testParameterList(){
		CodeParameter parameter = new CodeParameter();
		parameter.setCodeMethodId(1);
		parameter.setParameterType("sdads");
		CodeParameter parameter1 = new CodeParameter();
		parameter.setCodeMethodId(1);
		parameter.setParameterType("sdads");
		CodeParameter parameter2 = new CodeParameter();
		parameter.setCodeMethodId(1);
		parameter.setParameterType("sdads");
		CodeParameter parameter3 = new CodeParameter();
		parameter.setCodeMethodId(1);
		parameter.setParameterType("sdads");

		LinkedList<CodeParameter> parameters = new LinkedList<CodeParameter>();
		parameters.add(parameter);
		parameters.add(parameter1);
		parameters.add(parameter2);
		parameters.add(parameter3);
		CodeAnalyzeDao.getInstance().insertParameters(parameters);
	}

	@Test
	public void testListParameter(){
		CodeParameter parameter = new CodeParameter();
		parameter.setCodeMethodId(1);
		parameter.setParameterType("sdads");
		CodeParameter parameter1 = new CodeParameter();
		parameter1.setCodeMethodId(2);
		parameter1.setParameterType("sdads");

		LinkedList<CodeParameter> parameterList = new LinkedList<CodeParameter>();
		parameterList.add(parameter);
		parameterList.add(parameter1);
		CodeAnalyzeDao.getInstance().insertParameters(parameterList);

	}

	@Test
	public void testCodeMethod(){
		CodeMethod method = new CodeMethod();
		method.setAccess("public");
		method.setCodeClassId(1);
		method.setMethodName("name");
		method.setMethodSignature("signature");
		CodeAnalyzeDao.getInstance().insertNewMethod(method);
	}

	@Test
	public void testImportNode(){
		CodeImport importNode = new CodeImport();
		importNode.setClassName("className");
		importNode.setCodeClassId(1);
		importNode.setPackageName("packageName");
		CodeAnalyzeDao.getInstance().insertImportNode(importNode);
	}

	@Test
	public void testImportNodeList(){
		CodeImport importNode = new CodeImport();
		importNode.setClassName("className");
		importNode.setCodeClassId(1);
		importNode.setPackageName("packageName");
		CodeImport importNode1 = new CodeImport();
		importNode.setClassName("className");
		importNode.setCodeClassId(1);
		importNode.setPackageName("packageName");
		CodeImport importNode2 = new CodeImport();
		importNode.setClassName("className");
		importNode.setCodeClassId(1);
		importNode.setPackageName("packageName");

		LinkedList<CodeImport> importList = new LinkedList<CodeImport>();
		importList.add(importNode);
		importList.add(importNode1);
		importList.add(importNode2);

		CodeAnalyzeDao.getInstance().insertImportNodeList(importList);
	}

	@Test
	public void testCodeClass(){
		CodeClass c = new CodeClass();
		c.setClassName("haha");
		c.setPackageName("package");
		c.setPath("path");
		c.setReleaseId(1);

		CodeAnalyzeDao.getInstance().insertCodeClass(c);
	}

	public static void main(String[] args){
		InsertTest test =new InsertTest();
		test.testCodeMethod();
	}
}


text:
package utils.cache;

import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;

import java.io.File;

import utils.cache.base.BaseImageLoaderConfig;
import utils.cache.base.OnLoadBitmapListener;
import utils.cache.base.OnLoadFileListener;
import utils.cache.base.RequestOptionManager;
import utils.utils.UIUtils;

/**
 * @author:heinigger 2018/10/31  9:50
 * @function:
 */
public class ImageLoadersImp extends ImageLoaders {
    public ImageLoadersImp(BaseImageLoaderConfig mConfig) {
        super(mConfig);
    }

    @Override
    public void display(ImageView mImageView, int uri) {
        Glide.with(mImageView).load(uri).into(mImageView);
    }

    @Override
    public void display(ImageView mImageView, String url) {
        try {
            Glide.with(mImageView)
                    .load(mConfig.modifyUrl(mImageView, url))
                    .apply(RequestOptionManager.getHolderOptions(0))
                    .into(mImageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void displayRound(ImageView mImageView, String url) {
        try {
            Glide.with(mImageView)
                    .load(mConfig.modifyUrl(mImageView, url))
                    .apply(RequestOptionManager.getCircleHolderOptions(0))
                    .into(mImageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void displayCorner(ImageView mImageView, String url, int radius) {
        try {
            Glide.with(mImageView)
                    .load(mConfig.modifyUrl(mImageView, url))
                    .apply(RequestOptionManager.getRoundedOption(0, radius))
                    .into(mImageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void display(Fragment mFragment, ImageView mImageView, String url, int drawableRes) {
        try {
            Glide.with(mFragment)
                    .load(mConfig.modifyUrl(mImageView, url))
                    .apply(RequestOptionManager.getHolderOptions(drawableRes))
                    .into(mImageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void displayRound(Fragment mFragment, ImageView mImageView, String url, int drawableRes) {
        try {
            Glide.with(mFragment)
                    .load(mConfig.modifyUrl(mImageView, url))
                    .apply(RequestOptionManager.getCircleHolderOptions(drawableRes))
                    .into(mImageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void displayCorner(Fragment mFragment, ImageView mImageView, String url, int radius, int drawableRes) {
        try {
            Glide.with(mFragment)
                    .load(mConfig.modifyUrl(mImageView, url))
                    .apply(RequestOptionManager.getRoundedOption(drawableRes, radius))
                    .into(mImageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void display(Activity mActivity, ImageView mImageView, String url, int drawableRes) {
        try {
            Glide.with(mActivity)
                    .load(mConfig.modifyUrl(mImageView, url))
                    .apply(RequestOptionManager.getHolderOptions(drawableRes))
                    .into(mImageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void displayRound(Activity mActivity, ImageView mImageView, String url, int drawableRes) {
        try {
            Glide.with(mActivity)
                    .load(mConfig.modifyUrl(mImageView, url))
                    .apply(RequestOptionManager.getCircleHolderOptions(drawableRes))
                    .into(mImageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void displayCorner(Activity mActivity, ImageView mImageView, String url, int radius, int drawableRes) {
        try {
            Glide.with(mActivity)
                    .load(mConfig.modifyUrl(mImageView, url))
                    .apply(RequestOptionManager.getRoundedOption(drawableRes, radius))
                    .into(mImageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void display(ImageView mImageView, String url, @DrawableRes int drawableRes) {
        try {
            Glide.with(mImageView)
                    .load(mConfig.modifyUrl(mImageView, url))
                    .apply(RequestOptionManager.getHolderOptions(drawableRes))
                    .into(mImageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void displayRound(ImageView mImageView, String url, @DrawableRes int drawableRes) {
        try {
            if (mImageView.getContext() instanceof Activity) {
                Activity mActivity = (Activity) mImageView.getContext();
                if (mActivity == null || mActivity.isFinishing()) {
                    return;
                }
            }
            Glide.with(mImageView)
                    .load(mConfig.modifyUrl(mImageView, url))
                    .apply(RequestOptionManager.getCircleHolderOptions(drawableRes))
                    .into(mImageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void displayCorner(ImageView mImageView, String url, int radius, @DrawableRes int drawableRes) {
        try {
            Glide.with(mImageView)
                    .load(mConfig.modifyUrl(mImageView, url))
                    .apply(RequestOptionManager.getRoundedOption(drawableRes, radius))
                    .into(mImageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void display(Fragment mFragment, ImageView mImageView, String url) {
        display(mFragment, mImageView, url, 0);
    }

    @Override
    public void displayRound(Fragment mFragment, ImageView mImageView, String url) {
        displayRound(mFragment, mImageView, url, 0);
    }

    @Override
    public void displayCorner(Fragment mFragment, ImageView mImageView, String url, int radius) {
        displayCorner(mFragment, mImageView, url, radius, 0);
    }

    @Override
    public void display(Activity mActivity, ImageView mImageView, String url) {
        display(mActivity, mImageView, url, 0);
    }

    @Override
    public void displayRound(Activity mActivity, ImageView mImageView, String url) {
        displayRound(mActivity, mImageView, url, 0);
    }

    @Override
    public void displayCorner(Activity mActivity, ImageView mImageView, String url, int radius) {
        displayCorner(mActivity, mImageView, url, radius, 0);
    }

    @Override
    public void displayWithDefault(ImageView mImageView, String url) {
        display(mImageView, url, mConfig.getDefaultDrawable());
    }

    @Override
    public void displayWithDefault(ImageView mImageView, Uri uri) {
        try {
            Glide.with(mImageView)
                    .load(uri)
                    .apply(RequestOptionManager.getHolderOptions(mConfig.getDefaultDrawable()))
                    .into(mImageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void displayRoundWithDefault(ImageView mImageView, String url) {
        displayRound(mImageView, url, mConfig.getRoundDefaultDrawable());
    }

    @Override
    public void displayCornerWithDefault(ImageView mImageView, String url, int radius) {
        displayCorner(mImageView, url, radius, mConfig.getDefaultDrawable());
    }

    @Override
    public void displayWithDefault(Activity mActivity, ImageView mImageView, String url) {
        display(mActivity, mImageView, url, mConfig.getDefaultDrawable());
    }

    @Override
    public void displayRoundWithDefault(Activity mActivity, ImageView mImageView, String url) {
        displayRound(mActivity, mImageView, url, mConfig.getRoundDefaultDrawable());
    }

    @Override
    public void displayCornerWithDefault(Activity mActivity, ImageView mImageView, String url, int radius) {
        displayCorner(mActivity, mImageView, url, radius, mConfig.getDefaultDrawable());
    }

    @Override
    public void displayWithDefault(Fragment mFramgent, ImageView mImageView, String url) {
        display(mFramgent, mImageView, url, mConfig.getDefaultDrawable());
    }

    @Override
    public void displayRoundWithDefault(Fragment mFramgent, ImageView mImageView, String url) {
        displayRound(mFramgent, mImageView, url, mConfig.getRoundDefaultDrawable());
    }

    @Override
    public void displayCornerWithDefault(Fragment mFramgent, ImageView mImageView, String url, int radius) {
        displayCorner(mFramgent, mImageView, url, radius, mConfig.getDefaultDrawable());
    }

    @Override
    public void displayBlurImage(ImageView mImageView, String url) {
        try {
            Glide.with(mImageView)
                    .asBitmap()
                    .load(mConfig.modifyUrl(mImageView, url))
                    .apply(RequestOptionManager.getBlurOptions(0, 16))
                    .into(mImageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void displayBlurImage(ImageView mImageView, String url, int radius) {
        try {
            Glide.with(mImageView)
                    .asBitmap()
                    .load(mConfig.modifyUrl(mImageView, url))
                    .apply(RequestOptionManager.getBlurOptions(0, radius))
                    .into(mImageView);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void displayWithTag(ImageView mImageView, String url, String tag) {
        display(mImageView, url, mConfig.getDrawableWithTag(tag));
    }

    @Override
    public void displayRoundWithTag(ImageView mImageView, String url, String tag) {
        displayRound(mImageView, url, mConfig.getDrawableWithTag(tag));
    }

    @Override
    public void displayCornerWithTag(ImageView mImageView, String url, String tag, int radius) {
        displayCorner(mImageView, url, radius, mConfig.getDrawableWithTag(tag));
    }

    @Override
    public void displayScreenWitdh(final ImageView mImageView, String url) {
        displayScrrenWidth(mImageView, url, 0);
    }

    @Override
    public void displayScreenWidthWithDefault(ImageView mImageView, String url) {
        displayScrrenWidth(mImageView, url, mConfig.getDefaultDrawable());
    }

    @Override
    public void displayScrrenWidth(final ImageView mImageView, String url, @DrawableRes int drawableRes) {
        if (drawableRes != 0) {
            ViewGroup.LayoutParams layoutParams = mImageView.getLayoutParams();
            layoutParams.width = layoutParams.height = UIUtils.getScreenWidth();
            mImageView.setImageResource(drawableRes);
            mImageView.requestLayout();
        }
        try {
            Glide.with(mImageView)
                    .load(mConfig.modifyUrl(mImageView, url))
                    .apply(RequestOptionManager.getHolderOptions(0))
                    .into(new SimpleTarget<Drawable>() {
                        @Override
                        public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
                            int[] imageTransInfo = UIUtils.getImageTransInfo(resource.getIntrinsicWidth(), resource.getIntrinsicHeight());
                            ViewGroup.LayoutParams layoutParams = mImageView.getLayoutParams();
                            layoutParams.width = imageTransInfo[0];
                            layoutParams.height = imageTransInfo[1];
                            mImageView.setImageDrawable(resource);
                            mImageView.requestLayout();
                        }
                    });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void loadBitmap(ImageView mImageView, String path, final OnLoadBitmapListener mListener) {
        loadBitmap(mImageView.getContext(), path, mListener);
    }

    @Override
    public void loadBitmap(Context mContext, String path, final OnLoadBitmapListener mListener) {
        try {
            Glide.with(mContext).asBitmap().load(mConfig.modifyUrl(path)).into(new SimpleTarget<Bitmap>() {
                @Override
                public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
                    if (mListener != null) {
                        mListener.loadBitmap(resource);
                    }
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void loadBitmapWithSize(Context mContext, String path, int size, final OnLoadBitmapListener mListener) {
        try {
            Glide.with(mContext).asBitmap().load(mConfig.modifyUrl(path)).into(new SimpleTarget<Bitmap>(size, size) {
                @Override
                public void onLoadCleared(@Nullable Drawable placeholder) {
                    if (mListener != null) {
                        mListener.onLoadCleared();
                    }
                }

                @Override
                public void onLoadFailed(@Nullable Drawable errorDrawable) {
                    if (mListener != null) {
                        mListener.onLoadFailed();
                    }
                }

                @Override
                public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
                    if (mListener != null) {
                        mListener.loadBitmap(resource);
                    }
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void loadFile(Context mContext, String path, OnLoadFileListener mListener) {
        Glide.with(mContext).downloadOnly().load(mConfig.modifyUrl(path)).into(new SimpleTarget<File>() {
            @Override
            public void onResourceReady(File resource, Transition<? super File> transition) {
                mListener.onLoadFile(resource);
            }

            @Override
            public void onLoadFailed(@Nullable Drawable errorDrawable) {
                super.onLoadFailed(errorDrawable);
//                ToastUtil.show("图片下载失败");
            }
        });
    }

}


text:
define(["exports"], function (exports) {
  "use strict";

  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.foo8 = foo8;
  var foo = exports.foo = 1;
  var foo2 = exports.foo2 = 1,
      bar = exports.bar = 2;
  var foo3 = exports.foo3 = function () {};
  var foo4 = exports.foo4 = undefined;
  let foo5 = exports.foo5 = 2;
  let foo6 = exports.foo6 = undefined;
  const foo7 = exports.foo7 = 3;
  function foo8() {}
  class foo9 {}
  exports.foo9 = foo9;
});


text:
import { is32BitInteger } from "../is-32-bit-integer"

const MAX_INT = 2147483647
const MIN_INT = -2147483648

describe(`is32BitInteger`, () => {
  it(`works with all kind of values`, () => {
    expect(is32BitInteger(MAX_INT)).toBe(true)
    expect(is32BitInteger(MIN_INT)).toBe(true)
    expect(is32BitInteger(MAX_INT + 1)).toBe(false)
    expect(is32BitInteger(MIN_INT - 1)).toBe(false)
    expect(is32BitInteger(2.4)).toBe(false)
    expect(is32BitInteger(`42`)).toBe(false)
    expect(is32BitInteger({})).toBe(false)
    expect(is32BitInteger([1])).toBe(false)
    expect(is32BitInteger(true)).toBe(false)
    expect(is32BitInteger(false)).toBe(false)
    expect(is32BitInteger(undefined)).toBe(false)
    expect(is32BitInteger(null)).toBe(false)
  })
})


text:
@class AMFastThumb;
@class AMPeer;
@class DKActorRef;
@class DKSyncKeyValue;
@class IOSLongArray;
@class ImActorModelModulesModules;
@class JavaUtilArrayList;
@protocol AMCommand;
@protocol DKListEngine;

@interface ImActorModelModulesMessages : ImActorModelModulesBaseModule

#pragma mark Public

- (instancetype)initWithImActorModelModulesModules:(ImActorModelModulesModules *)messenger;

- (id<AMCommand>)clearChatWithAMPeer:(AMPeer *)peer;

- (id<AMCommand>)deleteChatWithAMPeer:(AMPeer *)peer;

- (void)deleteMessagesWithAMPeer:(AMPeer *)peer
                   withLongArray:(IOSLongArray *)rids;

- (DKActorRef *)getConversationActorWithAMPeer:(AMPeer *)peer;

- (id<DKListEngine>)getConversationEngineWithAMPeer:(AMPeer *)peer;

- (DKActorRef *)getConversationHistoryActorWithAMPeer:(AMPeer *)peer;

- (DKSyncKeyValue *)getConversationPendingIn;

- (DKSyncKeyValue *)getConversationPendingOut;

- (DKSyncKeyValue *)getCursorStorage;

- (DKActorRef *)getDialogsActor;

- (id<DKListEngine>)getDialogsEngine;

- (DKActorRef *)getDialogsHistoryActor;

- (id<DKListEngine>)getMediaEngineWithAMPeer:(AMPeer *)peer;

- (DKActorRef *)getOwnReadActor;

- (DKActorRef *)getPlainReadActor;

- (DKActorRef *)getPlainReceiverActor;

- (DKActorRef *)getSendMessageActor;

- (NSString *)loadDraftWithAMPeer:(AMPeer *)peer;

- (void)loadMoreDialogs;

- (void)loadMoreHistoryWithAMPeer:(AMPeer *)peer;

- (jlong)loadReadStateWithAMPeer:(AMPeer *)peer;

- (void)onConversationOpenWithAMPeer:(AMPeer *)peer;

- (void)onMessageShownWithAMPeer:(AMPeer *)peer
                        withLong:(jlong)sortDate;

- (void)resetModule;

- (void)run;

- (void)saveDraftWithAMPeer:(AMPeer *)peer
               withNSString:(NSString *)draft;

- (void)saveReadStateWithAMPeer:(AMPeer *)peer
                       withLong:(jlong)lastReadDate;

- (void)sendDocumentWithAMPeer:(AMPeer *)peer
                  withNSString:(NSString *)fileName
                  withNSString:(NSString *)mimeType
               withAMFastThumb:(AMFastThumb *)fastThumb
                  withNSString:(NSString *)descriptor;

- (void)sendMessageWithAMPeer:(AMPeer *)peer
                 withNSString:(NSString *)message
                 withNSString:(NSString *)markDownText
        withJavaUtilArrayList:(JavaUtilArrayList *)mentions;

- (void)sendPhotoWithAMPeer:(AMPeer *)peer
               withNSString:(NSString *)fileName
                    withInt:(jint)w
                    withInt:(jint)h
            withAMFastThumb:(AMFastThumb *)fastThumb
               withNSString:(NSString *)descriptor;

- (void)sendVideoWithAMPeer:(AMPeer *)peer
               withNSString:(NSString *)fileName
                    withInt:(jint)w
                    withInt:(jint)h
                    withInt:(jint)duration
            withAMFastThumb:(AMFastThumb *)fastThumb
               withNSString:(NSString *)descriptor;

@end

J2OBJC_EMPTY_STATIC_INIT(ImActorModelModulesMessages)

FOUNDATION_EXPORT void ImActorModelModulesMessages_initWithImActorModelModulesModules_(ImActorModelModulesMessages *self, ImActorModelModulesModules *messenger);

FOUNDATION_EXPORT ImActorModelModulesMessages *new_ImActorModelModulesMessages_initWithImActorModelModulesModules_(ImActorModelModulesModules *messenger) NS_RETURNS_RETAINED;

J2OBJC_TYPE_LITERAL_HEADER(ImActorModelModulesMessages)

#endif // _ImActorModelModulesMessages_H_


text:
import Ember from "ember"; // Ember.run.bind
import mobileDetection from "./is-mobile";

/**
 * Prevent click events after a touchend.
 *
 * Inspired/copy-paste from this article of Google by Ryan Fioravanti
 * https://developers.google.com/mobile/articles/fast_buttons#ghost
 *
 * USAGE:
 * Prevent the click event for an certain element
 * ````
 *  PreventGhostClick($element);
 * ````
 *
 */
function makeGhostBuster() {
  var coordinates = [];
  var threshold = 25;
  var timeout = 2500;

  // no touch support
  if(!mobileDetection.is()) {
    return { add : function(){}, remove : function(){} };
  }

  /**
   * prevent clicks if they're in a registered XY region
   * @param {MouseEvent} event
   */
  function preventGhostClick(event) {

    var ev = event.originalEvent || event;
    //don't prevent fastclicks
    if (ev.fastclick) { return true; }

    for (var i = 0; i < coordinates.length; i++) {
      var x = coordinates[i][0];
      var y = coordinates[i][1];

      // within the range, so prevent the click
      if (Math.abs(ev.clientX - x) < threshold && Math.abs(ev.clientY - y) < threshold) {
        event.stopPropagation();
        event.stopImmediatePropagation();
        event.preventDefault();
        return false;
      }
    }

  }

  /**
   * reset the coordinates array
   */
  function resetCoordinates() {
    coordinates = [];
  }

  /**
   * remove the first coordinates set from the array
   */
  function popCoordinates() {
    coordinates.splice(0, 1);
  }

  /**
   * if it is an final touchend, we want to register it's place
   * @param {TouchEvent} event
   */
  function registerCoordinates(event) {
    var ev = event.originalEvent || event;

    // It seems that touchend is the cause for derived events like 'change' for
    // checkboxes. Since we're creating fastclicks, which will also cause 'change'
    // events to fire, we need to prevent default on touchend events, which has
    // the effect of not causing these derived events to be created. I am not
    // sure if this has any other negative consequences.
    ev.preventDefault();

    // touchend is triggered on every releasing finger
    // changed touches always contain the removed touches on a touchend
    // the touches object might contain these also at some browsers (firefox os)
    // so touches - changedTouches will be 0 or lower, like -1, on the final touchend
    if(ev.touches.length - ev.changedTouches.length <= 0) {
      var touch = ev.changedTouches[0];
      coordinates.push([touch.clientX, touch.clientY]);
      setTimeout(popCoordinates, timeout);
    }
  }

  /**
   * prevent click events for the given element
   * @param {EventTarget} $element jQuery object
   */
  return {
    add : Ember.run.bind(this, function ($element) {
      $element.on("touchstart.ghost-click-buster", resetCoordinates);
      $element.on("touchend.ghost-click-buster", registerCoordinates);
      // register the click buster on with the selector, '*', which will
      // cause it to fire on the first element that gets clicked on so that
      // if this is a ghost click it will get killed immediately.
      $element.on("click.ghost-click-buster", '*', preventGhostClick);
    }),
    remove : Ember.run.bind(this, function ($element) {
      $element.off('.ghost-click-buster');
    })
  };

}

var preventGhostClicks = makeGhostBuster;

export default preventGhostClicks;


text:
package io.dongyue.gitlabandroid.utils;

import android.net.Uri;

/**
 * Utility for doing various image related things
 * Created by Jawn on 9/20/2015.
 */
public class ImageUtil {

    public static Uri getAvatarUrl(String email, int size) {
        return Gravatar
                .init(email)
                .ssl()
                .size(size)
                .defaultImage(Gravatar.DefaultImage.IDENTICON)
                .build();
    }
}


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Slide Future</title>
	<link rel="stylesheet" type="text/css" href="assets/css/normalize.css">
	<link rel="stylesheet" type="text/css" href="assets/css/animate.css">
	<link rel="stylesheet" type="text/css" href="assets/css/slideFuture.css">
	<link rel="stylesheet" type="text/css" href="assets/css/style.css">


text:
<?php

namespace Phexcore\Plugin\Phextemplate;

use DOMNode;
use DOMDocument;
use Phexcore\Application;
use Phexcore\RequestInterface;

class XsltUtil
{
    /**
     * アプリケーション
     *
     * @var \Phexcore\Application
     */
    public static $application = null;

    /**
     * ノードセットからオーナードキュメントを取得する
     *
     * @param array $nodes
     * @throws \InvalidArgumentException
     * @return \DOMDocument
     */
    public static function getOwnerDocument(array $nodes)
    {
        $ownerDocument = null;
        if (array_key_exists(0, $nodes) && $nodes[0] instanceof DOMNode) {
            $node = $nodes[0];
            $ownerDocument = $node->ownerDocument;
            if (null === $ownerDocument && $node instanceof DOMDocument) {
                $ownerDocument = $node;
            }
        }
        if (null === $ownerDocument) {
            throw new \InvalidArgumentException('Owner document is not passed');
        }
        return $ownerDocument;
    }

    /**
     * 祖先ファイルを取得する
     *
     * @param array $nodes
     * @return \DOMElement
     */
    public static function getAncestorFiles(array $nodes)
    {
        $ownerDocument = self::getOwnerDocument($nodes);
        $request = self::$application->getRequest();
        $requestBase = $request->getBaseUri();
        $requestDir = $request->getDir();
        $requestFile = $request->getFile();
        $requestExtension = $request->getExtension();
        $dataDir = self::$application->getDataDir();

        $filesElem = $ownerDocument->createElement('files');
        $directoryIndexFile = RequestInterface::DIRECTORY_INDEX_FILE . '.' . Application::EXTENSION_CONTENT;
        $directoryIndexUri = RequestInterface::DIRECTORY_INDEX_FILE . '.' . $requestExtension;
        $depth = substr_count($requestDir, '/');
        $uri = '';

        for($i = 0, $o = 0; $i < $depth; $i++, $o++) {
            $path = '';
            for ($j = $i + 1; $j < $depth; $j++) {
                $path .= '../';
            }
            $o = strpos($requestDir, '/', $o);
            $uri = substr($requestDir, 0, $o + 1);
            $filePath = $dataDir . $uri . $directoryIndexFile;
            if (is_file($filePath)) {
                $fileElem = $ownerDocument->createElement('file');
                $pathElem = $ownerDocument->createElement('path', $path . $directoryIndexFile);
                if (RequestInterface::DIRECTORY_INDEX_EXTENSION === $requestExtension) {
                    $uriElem = $ownerDocument->createElement('uri', $requestBase . $uri);
                } else {
                    $uriElem = $ownerDocument->createElement('uri', $requestBase . $uri . $directoryIndexUri);
                }
                $lastModifiedElem = self::createLastModifiedElement($ownerDocument, $filePath);

                $fileElem->appendChild($pathElem);
                $fileElem->appendChild($uriElem);
                $fileElem->appendChild($lastModifiedElem);
                $filesElem->appendChild($fileElem);
            }
        }
        if (RequestInterface::DIRECTORY_INDEX_FILE !== $requestFile) {
            $filePath = $dataDir . $uri . $requestFile . '.' . Application::EXTENSION_CONTENT;
            if (is_file($filePath)) {
                $fileElem = $ownerDocument->createElement('file');
                $pathElem = $ownerDocument->createElement('path', $requestFile . '.' . Application::EXTENSION_CONTENT);
                $uriElem = $ownerDocument->createElement('uri', $requestBase . $uri . $requestFile . '.' . $requestExtension);
                $lastModifiedElem = self::createLastModifiedElement($ownerDocument, $filePath);

                $fileElem->appendChild($pathElem);
                $fileElem->appendChild($uriElem);
                $fileElem->appendChild($lastModifiedElem);
                $filesElem->appendChild($fileElem);
            }
        }
        return $filesElem;
    }

    /**
     * 兄弟ファイルを取得する
     *
     * @param array $nodes
     * @param string $skipFilePattern
     * @return \DOMElement
     */
    public static function getSiblingFiles(array $nodes, $skipFilePattern = '')
    {
        $ownerDocument = self::getOwnerDocument($nodes);
        $request = self::$application->getRequest();
        $requestBase = $request->getBaseUri();
        $requestDir = $request->getDir();
        $requestExtension = $request->getExtension();
        $dataDir = self::$application->getDataDir();

        $filesElem = $ownerDocument->createElement('files');
        $directoryIndex = RequestInterface::DIRECTORY_INDEX_FILE . '.' . RequestInterface::DIRECTORY_INDEX_EXTENSION;
        $baseDir = $dataDir . $requestDir;
        $contentFileSuffix = '.' . Application::EXTENSION_CONTENT;

        if (is_dir($baseDir)) {
            foreach (scandir($baseDir) as $file) {
                if ('.' !== $file && '..' !== $file && ('' === $skipFilePattern || 1 !== preg_match($skipFilePattern, $file))) {
                    $filePath = $baseDir . $file;
                    $extension = pathinfo($filePath, \PATHINFO_EXTENSION);
                    if (Application::EXTENSION_CONTENT === $extension && is_file($filePath)) {
                        $fileElem = $ownerDocument->createElement('file');
                        $pathElem = $ownerDocument->createElement('path', $file);
                        $uri = basename($file, $contentFileSuffix) . '.' . $requestExtension;
                        if ($directoryIndex === $uri) {
                            $uriElem = $ownerDocument->createElement('uri', $requestBase . $requestDir);
                        } else {
                            $uriElem = $ownerDocument->createElement('uri', $requestBase . $requestDir . $uri);
                        }
                        $lastModifiedElem = self::createLastModifiedElement($ownerDocument, $filePath);

                        $fileElem->appendChild($pathElem);
                        $fileElem->appendChild($uriElem);
                        $fileElem->appendChild($lastModifiedElem);
                        $filesElem->appendChild($fileElem);
                    }
                }
            }
        }
        return $filesElem;
    }

    /**
     * 子供ファイルを取得する
     *
     * @param array $nodes
     * @param string $requestUri
     * @return \DOMElement
     */
    public static function getChildFiles(array $nodes, $requestUri = '')
    {
        $ownerDocument = self::getOwnerDocument($nodes);
        $request = self::$application->getRequest();
        $requestBase = $request->getBaseUri();
        $requestDir = $request->getDir();
        $requestExtension = $request->getExtension();
        $dataDir = self::$application->getDataDir();

        $filesElem = $ownerDocument->createElement('files');
        $directoryIndexFile = RequestInterface::DIRECTORY_INDEX_FILE . '.' . Application::EXTENSION_CONTENT;
        $directoryIndexUri = RequestInterface::DIRECTORY_INDEX_FILE . '.' . $requestExtension;
        $baseDir = $dataDir . $requestDir;

        if (is_dir($baseDir)) {
            foreach (scandir($baseDir) as $dir) {
                if ('.' !== $dir && '..' !== $dir) {
                    $subDirPath = $baseDir . $dir;
                    $subDirIndex = $subDirPath . \DIRECTORY_SEPARATOR . $directoryIndexFile;
                    if (is_dir($subDirPath) && is_file($subDirIndex)) {
                        $fileElem = $ownerDocument->createElement('file');
                        $pathElem = $ownerDocument->createElement('path', $dir . '/' . $directoryIndexFile);
                        if (RequestInterface::DIRECTORY_INDEX_EXTENSION === $requestExtension) {
                            $uriElem = $ownerDocument->createElement('uri', $requestBase . $requestDir . $dir . '/');
                        } else {
                            $uriElem = $ownerDocument->createElement('uri', $requestBase . $requestDir . $dir . '/' . $directoryIndexUri);
                        }
                        $lastModifiedElem = self::createLastModifiedElement($ownerDocument, $subDirIndex);

                        $fileElem->appendChild($pathElem);
                        $fileElem->appendChild($uriElem);
                        $fileElem->appendChild($lastModifiedElem);
                        $filesElem->appendChild($fileElem);
                    }
                }
            }
        }
        return $filesElem;
    }

    /**
     * ファイルの更新日時を示す要素を作成する
     *
     * @param \DOMDocument $ownerDocument
     * @param string $filePath
     * @return \DOMElement
     */
    public static function createLastModifiedElement(DOMDocument $ownerDocument, $filePath)
    {
        $fileTime = filemtime($filePath);
        $lastModifiedElem = $ownerDocument->createElement('last-modified');
        $timestampElem = $ownerDocument->createElement('timestamp', $fileTime);
        $yearElem = $ownerDocument->createElement('year', date('Y', $fileTime));
        $monthElem = $ownerDocument->createElement('month', date('m', $fileTime));
        $dayElem = $ownerDocument->createElement('day', date('d', $fileTime));
        $hourElem = $ownerDocument->createElement('hour', date('H', $fileTime));
        $minuteElem = $ownerDocument->createElement('minute', date('i', $fileTime));
        $secondElem = $ownerDocument->createElement('second', date('s', $fileTime));

        $lastModifiedElem->appendChild($timestampElem);
        $lastModifiedElem->appendChild($yearElem);
        $lastModifiedElem->appendChild($monthElem);
        $lastModifiedElem->appendChild($dayElem);
        $lastModifiedElem->appendChild($hourElem);
        $lastModifiedElem->appendChild($minuteElem);
        $lastModifiedElem->appendChild($secondElem);
        return $lastModifiedElem;
    }
}


text:
<template name="ForumQuestionRight">

          {{author.profile.name}}

          Posted {{creationTime}}

              5 Faves

</template>


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>LiquidFun Programmer's Guide: Content License</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

LiquidFun Programmer's Guide

Content License

Portions of this documentation are modifications based on work created and shared by Erin Catto and used according to terms described in the Creative Commons 4.0 Attribution License

Copyright © 2007-2011 Erin Catto

Copyright © 2013-2014 Fun Propulsion Labs at Google


text:
'use strict';

const common = require('../common');
const fs = require('fs');
const path = require('path');

const bench = common.createBenchmark(main, {
  n: [10],
  dir: [ 'lib', 'test/parallel'],
  withFileTypes: ['true', 'false']
});

function main({ n, dir, withFileTypes }) {
  withFileTypes = withFileTypes === 'true';
  const fullPath = path.resolve(__dirname, '../../', dir);
  bench.start();
  (function r(cntr) {
    if (cntr-- <= 0)
      return bench.end(n);
    fs.readdir(fullPath, { withFileTypes }, () => {
      r(cntr);
    });
  }(n));
}


text:
namespace TokenAuthentication
{
    using System;
    using System.IdentityModel.Tokens.Jwt;
    using System.Security.Claims;

    public class TokenGenerator<TKey, TUser>
    {
        private readonly ITokenStore<TKey, TUser> _tokenStore;
        private readonly TokenAuthenticationOptions _tokenAuthenticationOptions;

        public TokenGenerator(ITokenStore<TKey, TUser> tokenStore, TokenAuthenticationOptions tokenAuthenticationOptions)
        {
            _tokenStore = tokenStore;
            _tokenAuthenticationOptions = tokenAuthenticationOptions;
        }

        public AccessToken New(TKey userId)
        {
            var now = DateTime.UtcNow;
            var nowUntill = now.Add(_tokenAuthenticationOptions.ExpiresIn);

            // Specifically add the jti (random nonce), iat (issued timestamp), and sub (subject/user) claims.
            // You can add other claims here, if you want:
            var claims = new[]
            {
                new Claim(JwtRegisteredClaimNames.Sub, userId.ToString()),
                new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
                new Claim(JwtRegisteredClaimNames.Iat, now.Ticks.ToString(), ClaimValueTypes.Integer64)
            };

            // Create the JWT and write it to a string
            var jwt = new JwtSecurityToken(
                issuer: _tokenAuthenticationOptions.Issuer,
                audience: _tokenAuthenticationOptions.Audience,
                claims: claims,
                notBefore: now,
                expires: nowUntill,
                signingCredentials: _tokenAuthenticationOptions.SigningCredentials);
            var encodedJwt = new JwtSecurityTokenHandler().WriteToken(jwt);

            var accessToken = new AccessToken
            {
                Token = encodedJwt,
                ExpiresOn = nowUntill
            };

            _tokenStore.Add(new Token<TKey, TUser>
            {
                Client = "Http Client",
                ClientVersion = "n/a",
                CreatedOn = DateTime.UtcNow,
                Platform = "n/a",
                PlatformVersion = "n/a",
                UserId = userId,
                ValidUntil = nowUntill,
                Value = encodedJwt
            });

            return accessToken;
        }
    }
}


text:
namespace embxx
{

namespace util
{

namespace log
{

/// @addtogroup util
/// @{

/// @brief Logging levels
enum Level
{
    Trace, ///< Use for tracing enter to and exit from functions.
    Debug, ///< Use for debugging information.
    Info, ///< Use for general informative output.
    Warning, ///< Use for warning about potential dangers.
    Error, ///< Use to report execution errors.
    NumOfLogLevels ///< Number of log levels, must be last
};

/// @}

}  // namespace log

}  // namespace util

}  // namespace embxx


text:
export const simplifyConstantDocs = {
  name: 'simplifyConstant',
  category: 'Algebra',
  syntax: [
    'simplifyConstant(expr)',
    'simplifyConstant(expr, options)'
  ],
  description: 'Replace constant subexpressions of node with their values.',
  examples: [
    'simplifyConatant("(3-3)*x")',
    'simplifyConstant(parse("z-cos(tau/8)"))'
  ],
  seealso: [
    'simplify', 'simplifyCore', 'evaluate'
  ]
}


text:
/*
 * TLSH is provided for use under two licenses: Apache OR BSD.
 * Users may opt to use either license depending on the license
 * restictions of the systems with which they plan to integrate
 * the TLSH code.
 */

/* ==============
 * Apache License
 * ==============
 * Copyright 2013 Trend Micro Incorporated
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* ===========
 * BSD License
 * ===========
 * Copyright (c) 2013, Trend Micro Incorporated
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.

 * 3. Neither the name of the copyright holder nor the names of its contributors
 *    may be used to endorse or promote products derived from this software without
 *    specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#if defined WINDOWS || defined MINGW
#include "tlsh_win_version.h"
#else
#include "tlsh_version.h"
#endif

#ifndef HEADER_TLSH_IMPL_H
#define HEADER_TLSH_IMPL_H

#define SLIDING_WND_SIZE  5

#define BUCKETS           256
#define Q_BITS            2    // 2 bits; quartile value 0, 1, 2, 3

// BUCKETS_256 & CHECKSUM_3B are compiler switches defined in CMakeLists.txt

#if defined BUCKETS_256
  #define EFF_BUCKETS         256
  #define CODE_SIZE           64   // 256 * 2 bits = 64 bytes
  #if defined CHECKSUM_3B
    #define INTERNAL_TLSH_STRING_LEN 138
    #define TLSH_CHECKSUM_LEN 3
    // defined in tlsh.h   #define TLSH_STRING_LEN   138  // 2 + 3 + 64 bytes = 138 hexidecimal chars
  #else
    #define INTERNAL_TLSH_STRING_LEN 134
    #define TLSH_CHECKSUM_LEN 1
    // defined in tlsh.h   #define TLSH_STRING_LEN   134  // 2 + 1 + 64 bytes = 134 hexidecimal chars
  #endif
#endif

#if defined BUCKETS_128
  #define EFF_BUCKETS         128
  #define CODE_SIZE           32   // 128 * 2 bits = 32 bytes
  #if defined CHECKSUM_3B
    #define INTERNAL_TLSH_STRING_LEN 74
    #define TLSH_CHECKSUM_LEN 3
    // defined in tlsh.h   #define TLSH_STRING_LEN   74   // 2 + 3 + 32 bytes = 74 hexidecimal chars
  #else
    #define INTERNAL_TLSH_STRING_LEN 70
    #define TLSH_CHECKSUM_LEN 1
    // defined in tlsh.h   #define TLSH_STRING_LEN   70   // 2 + 1 + 32 bytes = 70 hexidecimal chars
  #endif
#endif

#if defined BUCKETS_48
  #define INTERNAL_TLSH_STRING_LEN 33
  #define EFF_BUCKETS         48
  #define CODE_SIZE           12   // 48 * 2 bits = 12 bytes
  #define TLSH_CHECKSUM_LEN 1
  // defined in tlsh.h   #define TLSH_STRING_LEN   30   // 2 + 1 + 12 bytes = 30 hexidecimal chars
#endif

class TlshImpl
{
public:
    TlshImpl();
    ~TlshImpl();
public:
    void       update(const unsigned char* data, unsigned int len, int tlsh_option);
    void fast_update5(const unsigned char* data, unsigned int len, int tlsh_option);
    void final(int fc_cons_option = 0);
    void reset();
    const char* hash(int showvers) const;
    const char* hash(char *buffer, unsigned int bufSize, int showvers) const;  // saves allocating hash string in TLSH instance - bufSize should be TLSH_STRING_LEN + 1
    int compare(const TlshImpl& other) const;
    int totalDiff(const TlshImpl& other, bool len_diff=true) const;
    int Lvalue();
    int Q1ratio();
    int Q2ratio();
    int Checksum(int k);
    int BucketValue(int bucket);
    int HistogramCount(int bucket);
    int fromTlshStr(const char* str);
    bool isValid() const { return lsh_code_valid; }

private:
    unsigned int *a_bucket;
    unsigned char slide_window[SLIDING_WND_SIZE];
    unsigned int data_len;

    struct lsh_bin_struct {
        unsigned char checksum[TLSH_CHECKSUM_LEN];  // 1 to 3 bytes
        unsigned char Lvalue;                       // 1 byte
        union {
#if defined(__SPARC) || defined(_AIX)
		#pragma pack(1)
#endif
        unsigned char QB;
            struct{
#if defined(__SPARC) || defined(_AIX)
		unsigned char Q2ratio : 4;
		unsigned char Q1ratio : 4;
#else
                unsigned char Q1ratio : 4;
                unsigned char Q2ratio : 4;
#endif
            } QR;
        } Q;                                        // 1 bytes
        unsigned char tmp_code[CODE_SIZE];          // 32/64 bytes
    } lsh_bin;

    mutable char *lsh_code;       // allocated when hash() function without buffer is called - 70/134 bytes or 74/138 bytes
    bool lsh_code_valid;  // true iff final() or fromTlshStr complete successfully
};

#endif


text:
package org.springframework.boot.autoconfigure.elasticsearch;

import org.elasticsearch.client.RestClient;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * {@link EnableAutoConfiguration Auto-configuration} for Elasticsearch REST clients.
 *
 * @author Brian Clozel
 * @author Stephane Nicoll
 * @since 2.1.0
 */
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(RestClient.class)
@EnableConfigurationProperties(ElasticsearchRestClientProperties.class)
@Import({ ElasticsearchRestClientConfigurations.RestClientBuilderConfiguration.class,
		ElasticsearchRestClientConfigurations.RestHighLevelClientConfiguration.class,
		ElasticsearchRestClientConfigurations.RestClientFallbackConfiguration.class })
public class ElasticsearchRestClientAutoConfiguration {

}


text:
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.vfs.newvfs.persistent;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileAttributes;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vfs.VFileProperty;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.ex.temp.TempFileSystem;
import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
import com.intellij.openapi.vfs.newvfs.NewVirtualFileSystem;
import com.intellij.openapi.vfs.newvfs.events.ChildInfo;
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
import com.intellij.openapi.vfs.newvfs.impl.FakeVirtualFile;
import com.intellij.openapi.vfs.newvfs.impl.VirtualDirectoryImpl;
import com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.OpenTHashSet;
import com.intellij.util.containers.Queue;
import com.intellij.util.text.FilePathHashingStrategy;
import gnu.trove.TObjectHashingStrategy;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;

import static com.intellij.openapi.util.Pair.pair;
import static com.intellij.openapi.vfs.newvfs.persistent.VfsEventGenerationHelper.LOG;
import static com.intellij.util.containers.ContainerUtil.newTroveSet;

/**
 * @author max
 */
public class RefreshWorker {
  private final boolean myIsRecursive;
  private final Queue<Pair<NewVirtualFile, FileAttributes>> myRefreshQueue = new Queue<>(100);
  private final VfsEventGenerationHelper myHelper = new VfsEventGenerationHelper();
  private volatile boolean myCancelled;
  private final LocalFileSystemRefreshWorker myLocalFileSystemRefreshWorker;

  public RefreshWorker(@NotNull NewVirtualFile refreshRoot, boolean isRecursive) {
    boolean canUseNioRefresher = refreshRoot.isInLocalFileSystem() && !(refreshRoot.getFileSystem() instanceof TempFileSystem);
    myLocalFileSystemRefreshWorker = canUseNioRefresher && Registry.is("vfs.use.nio-based.local.refresh.worker") ?
                                     new LocalFileSystemRefreshWorker(refreshRoot, isRecursive) : null;
    myIsRecursive = isRecursive;
    myRefreshQueue.addLast(pair(refreshRoot, null));
  }

  @NotNull
  public List<VFileEvent> getEvents() {
    if (myLocalFileSystemRefreshWorker != null) return myLocalFileSystemRefreshWorker.getEvents();
    return myHelper.getEvents();
  }

  public void cancel() {
    if (myLocalFileSystemRefreshWorker != null) myLocalFileSystemRefreshWorker.cancel();
    myCancelled = true;
  }

  public void scan() {
    if (myLocalFileSystemRefreshWorker != null) {
      myLocalFileSystemRefreshWorker.scan();
      return;
    }

    NewVirtualFile root = myRefreshQueue.peekFirst().first;
    NewVirtualFileSystem fs = root.getFileSystem();
    if (root.isDirectory()) {
      fs = PersistentFS.replaceWithNativeFS(fs);
    }
    try {
      processQueue(fs, PersistentFS.getInstance());
    }
    catch (RefreshCancelledException e) {
      LOG.trace("refresh cancelled");
    }
  }

  private void processQueue(@NotNull NewVirtualFileSystem fs, @NotNull PersistentFS persistence) throws RefreshCancelledException {
    TObjectHashingStrategy<String> strategy = FilePathHashingStrategy.create(fs.isCaseSensitive());

    while (!myRefreshQueue.isEmpty()) {
      Pair<NewVirtualFile, FileAttributes> pair = myRefreshQueue.pullFirst();
      NewVirtualFile file = pair.first;
      if (!myHelper.checkDirty(file)) continue;

      checkCancelled(file);

      FileAttributes attributes = pair.second != null ? pair.second : fs.getAttributes(file);
      if (attributes == null) {
        myHelper.scheduleDeletion(file);
        file.markClean();
        continue;
      }

      NewVirtualFile parent = file.getParent();
      if (parent != null && checkAndScheduleFileTypeChange(fs, parent, file, attributes)) {
        // ignore everything else
        file.markClean();
        continue;
      }

      if (file.isDirectory()) {
        boolean fullSync = ((VirtualDirectoryImpl)file).allChildrenLoaded();
        if (fullSync) {
          fullDirRefresh(fs, persistence, strategy, (VirtualDirectoryImpl)file);
        }
        else {
          partialDirRefresh(fs, strategy, (VirtualDirectoryImpl)file);
        }
      }
      else {
        myHelper.checkContentChanged(file, persistence.getTimeStamp(file), attributes.lastModified,
                                     persistence.getLastRecordedLength(file), attributes.length);
      }

      myHelper.checkWritableAttributeChange(file, persistence.isWritable(file), attributes.isWritable());

      if (SystemInfo.isWindows) {
        myHelper.checkHiddenAttributeChange(file, file.is(VFileProperty.HIDDEN), attributes.isHidden());
      }

      if (attributes.isSymLink()) {
        myHelper.checkSymbolicLinkChange(file, file.getCanonicalPath(), fs.resolveSymLink(file));
      }

      if (myIsRecursive || !file.isDirectory()) {
        file.markClean();
      }
    }
  }

  private void fullDirRefresh(@NotNull NewVirtualFileSystem fs,
                              @NotNull PersistentFS persistence,
                              @NotNull TObjectHashingStrategy<String> strategy,
                              @NotNull VirtualDirectoryImpl dir) {
    while (true) {
      // obtaining directory snapshot
      Pair<String[], VirtualFile[]> result = LocalFileSystemRefreshWorker.getDirectorySnapshot(persistence, dir);
      if (result == null) return;
      String[] persistedNames = result.getFirst();
      VirtualFile[] children = result.getSecond();

      // reading children attributes
      String[] upToDateNames = VfsUtil.filterNames(fs.list(dir));
      Set<String> newNames = newTroveSet(strategy, upToDateNames);
      if (dir.allChildrenLoaded() && children.length < upToDateNames.length) {
        for (VirtualFile child : children) {
          newNames.remove(child.getName());
        }
      }
      else {
        ContainerUtil.removeAll(newNames, persistedNames);
      }

      Set<String> deletedNames = newTroveSet(strategy, persistedNames);
      ContainerUtil.removeAll(deletedNames, upToDateNames);

      OpenTHashSet<String> actualNames = fs.isCaseSensitive() ? null : new OpenTHashSet<>(strategy, upToDateNames);
      if (LOG.isTraceEnabled()) LOG.trace("current=" + Arrays.toString(persistedNames) + " +" + newNames + " -" + deletedNames);

      List<ChildInfo> newKids = new ArrayList<>(newNames.size());
      for (String newName : newNames) {
        checkCancelled(dir);
        ChildInfo record = childRecord(fs, dir, newName);
        if (record != null) {
          newKids.add(record);
        }
        else {
          if (LOG.isTraceEnabled()) LOG.trace("[+] fs=" + fs + " dir=" + dir + " name=" + newName);
        }
      }

      List<Pair<VirtualFile, FileAttributes>> updatedMap = new ArrayList<>(children.length);
      for (VirtualFile child : children) {
        checkCancelled(dir);
        if (deletedNames.contains(child.getName())) continue;
        updatedMap.add(pair(child, fs.getAttributes(child)));
      }

      // generating events unless a directory was changed in between
      boolean hasEvents = ReadAction.compute(() -> {
        if (!Arrays.equals(persistedNames, persistence.list(dir)) || !Arrays.equals(children, dir.getChildren())) {
          if (LOG.isTraceEnabled()) LOG.trace("retry: " + dir);
          return false;
        }

        for (String name : deletedNames) {
          VirtualFileSystemEntry child = dir.findChild(name);
          if (child != null) {
            myHelper.scheduleDeletion(child);
          }
        }

        for (ChildInfo record : newKids) {
          myHelper.scheduleCreation(dir, record.name, record.attributes, record.symLinkTarget);
        }

        for (Pair<VirtualFile, FileAttributes> pair : updatedMap) {
          VirtualFile child = pair.first;
          FileAttributes childAttributes = pair.second;
          if (childAttributes != null) {
            checkAndScheduleChildRefresh(fs, dir, child, childAttributes);
            checkAndScheduleFileNameChange(actualNames, child);
          }
          else {
            if (LOG.isTraceEnabled()) LOG.warn("[x] fs=" + fs + " dir=" + dir + " name=" + child.getName());
            myHelper.scheduleDeletion(child);
          }
        }

        return true;
      });

      if (hasEvents) break;
    }
  }

  private void partialDirRefresh(@NotNull NewVirtualFileSystem fs,
                                 @NotNull TObjectHashingStrategy<String> strategy,
                                 @NotNull VirtualDirectoryImpl dir) {
    while (true) {
      // obtaining directory snapshot
      Pair<List<VirtualFile>, List<String>> result =
        ReadAction.compute(() -> pair(dir.getCachedChildren(), dir.getSuspiciousNames()));

      List<VirtualFile> cached = result.getFirst();
      List<String> wanted = result.getSecond();

      OpenTHashSet<String> actualNames =
        fs.isCaseSensitive() || cached.isEmpty() ? null : new OpenTHashSet<>(strategy, VfsUtil.filterNames(fs.list(dir)));

      if (LOG.isTraceEnabled()) {
        LOG.trace("cached=" + cached + " actual=" + actualNames);
        LOG.trace("suspicious=" + wanted);
      }

      // reading children attributes
      List<Pair<VirtualFile, FileAttributes>> existingMap = new ArrayList<>(cached.size());
      for (VirtualFile child : cached) {
        checkCancelled(dir);
        existingMap.add(pair(child, fs.getAttributes(child)));
      }

      List<ChildInfo> newKids = new ArrayList<>(wanted.size());
      for (String name : wanted) {
        if (name.isEmpty()) continue;
        checkCancelled(dir);
        ChildInfo record = childRecord(fs, dir, name);
        if (record != null) {
          newKids.add(record);
        }
      }

      // generating events unless a directory was changed in between
      boolean hasEvents = ReadAction.compute(() -> {
        if (!cached.equals(dir.getCachedChildren()) || !wanted.equals(dir.getSuspiciousNames())) {
          if (LOG.isTraceEnabled()) LOG.trace("retry: " + dir);
          return false;
        }

        for (Pair<VirtualFile, FileAttributes> pair : existingMap) {
          VirtualFile child = pair.first;
          FileAttributes childAttributes = pair.second;
          if (childAttributes != null) {
            checkAndScheduleChildRefresh(fs, dir, child, childAttributes);
            checkAndScheduleFileNameChange(actualNames, child);
          }
          else {
            myHelper.scheduleDeletion(child);
          }
        }

        for (ChildInfo record : newKids) {
          myHelper.scheduleCreation(dir, record.name, record.attributes, record.symLinkTarget);
        }

        return true;
      });

      if (hasEvents) break;
    }
  }

  @Nullable
  private static ChildInfo childRecord(@NotNull NewVirtualFileSystem fs, @NotNull VirtualFile dir, @NotNull String name) {
    FakeVirtualFile file = new FakeVirtualFile(dir, name);
    FileAttributes attributes = fs.getAttributes(file);
    if (attributes == null) return null;
    boolean isEmptyDir = attributes.isDirectory() && !fs.hasChildren(file);
    String symlinkTarget = attributes.isSymLink() ? fs.resolveSymLink(file) : null;
    return new ChildInfo(-1, name, attributes, isEmptyDir ? ChildInfo.EMPTY_ARRAY : null, symlinkTarget);
  }

  private static class RefreshCancelledException extends RuntimeException { }

  private void checkCancelled(@NotNull NewVirtualFile stopAt) throws RefreshCancelledException {
    if (myCancelled || ourCancellingCondition != null && ourCancellingCondition.fun(stopAt)) {
      if (LOG.isTraceEnabled()) LOG.trace("cancelled at: " + stopAt);
      forceMarkDirty(stopAt);
      while (!myRefreshQueue.isEmpty()) {
        NewVirtualFile next = myRefreshQueue.pullFirst().first;
        forceMarkDirty(next);
      }
      throw new RefreshCancelledException();
    }
  }

  private static void forceMarkDirty(@NotNull NewVirtualFile file) {
    file.markClean();  // otherwise consequent markDirty() won't have any effect
    file.markDirty();
  }

  private void checkAndScheduleChildRefresh(@NotNull NewVirtualFileSystem fs,
                                            @NotNull VirtualFile parent,
                                            @NotNull VirtualFile child,
                                            @NotNull FileAttributes childAttributes) {
    if (!checkAndScheduleFileTypeChange(fs, parent, child, childAttributes)) {
      boolean upToDateIsDirectory = childAttributes.isDirectory();
      if (myIsRecursive || !upToDateIsDirectory) {
        myRefreshQueue.addLast(pair((NewVirtualFile)child, childAttributes));
      }
    }
  }

  private boolean checkAndScheduleFileTypeChange(@NotNull NewVirtualFileSystem fs,
                                                 @NotNull VirtualFile parent,
                                                 @NotNull VirtualFile child,
                                                 @NotNull FileAttributes childAttributes) {
    boolean currentIsDirectory = child.isDirectory();
    boolean currentIsSymlink = child.is(VFileProperty.SYMLINK);
    boolean currentIsSpecial = child.is(VFileProperty.SPECIAL);
    boolean upToDateIsDirectory = childAttributes.isDirectory();
    boolean upToDateIsSymlink = childAttributes.isSymLink();
    boolean upToDateIsSpecial = childAttributes.isSpecial();

    if (currentIsDirectory != upToDateIsDirectory || currentIsSymlink != upToDateIsSymlink || currentIsSpecial != upToDateIsSpecial) {
      myHelper.scheduleDeletion(child);
      String symlinkTarget = upToDateIsSymlink ? fs.resolveSymLink(child) : null;
      myHelper.scheduleCreation(parent, child.getName(), childAttributes, symlinkTarget);
      return true;
    }

    return false;
  }

  private void checkAndScheduleFileNameChange(@Nullable OpenTHashSet<String> actualNames, @NotNull VirtualFile child) {
    if (actualNames != null) {
      String currentName = child.getName();
      String actualName = actualNames.get(currentName);
      if (actualName != null && !currentName.equals(actualName)) {
        myHelper.scheduleAttributeChange(child, VirtualFile.PROP_NAME, currentName, actualName);
      }
    }
  }

  private static Function<? super VirtualFile, Boolean> ourCancellingCondition;

  @TestOnly
  public static void setCancellingCondition(@Nullable Function<? super VirtualFile, Boolean> condition) {
    assert ApplicationManager.getApplication().isUnitTestMode();
    LocalFileSystemRefreshWorker.setCancellingCondition(condition);
    ourCancellingCondition = condition;
  }
}


text:
import { moduleFor, test } from 'ember-qunit';

moduleFor('controller:hex-editor', 'Unit | Controller | hex editor', {
  // Specify the other units that are required for this test.
  // needs: ['controller:foo']
});

// Replace this with your real tests.
test('it exists', function(assert) {
  let controller = this.subject();
  assert.ok(controller);
});


text:
package edu.pjatk.inn.coffeemaker;

import edu.pjatk.inn.coffeemaker.impl.CoffeeMaker;
import edu.pjatk.inn.coffeemaker.impl.Inventory;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.sorcer.test.ProjectContext;
import org.sorcer.test.SorcerTestRunner;
import sorcer.service.ContextException;

import static org.junit.Assert.*;

/**
 * Created by ag on 26/01/2016
 */
@RunWith(SorcerTestRunner.class)
@ProjectContext("examples/coffeemaker")
public class CoffeeMakerAddInventoryTest {

    private CoffeeMaker coffeeMaker;

    private Inventory inventory;

    private int coffee, milk, sugar, chocolate;
    private int addCoffee, addMilk, addSugar, addChocolate;

    @Before
    public void setUp() throws ContextException {
        coffeeMaker = new CoffeeMaker();
        inventory = coffeeMaker.checkInventory();
    }

    @Test
    public void addInventory1() {

        coffee = inventory.getCoffee();
        milk = inventory.getMilk();
        sugar = inventory.getSugar();
        chocolate = inventory.getChocolate();

        addCoffee = 5;
        addMilk = 3;
        addSugar = 7;
        addChocolate = 2;

        coffeeMaker.addInventory(addCoffee, addMilk, addSugar, addChocolate);

        assertEquals(coffee + addCoffee, inventory.getCoffee());
        assertEquals(milk + addMilk, inventory.getMilk());
        assertEquals(sugar + addSugar, inventory.getSugar());
        assertEquals(chocolate + addChocolate, inventory.getChocolate());

    }

    // Cannot add inventory. Units of coffee can not be negative
    @Test
    public void addInventory2() {

        coffee = inventory.getCoffee();

        addCoffee = -1;
        addMilk = 0;
        addSugar = 0;
        addChocolate = 0;

        coffeeMaker.addInventory(addCoffee, addMilk, addSugar, addChocolate);

        assertNotEquals(coffee + addCoffee, inventory.getCoffee());

    }

    // Cannot add inventory. Units of milk can not be negative
    @Test
    public void addInventory3() {

        coffee = inventory.getCoffee();
        milk = inventory.getMilk();

        addCoffee = 5;
        addMilk = -1;
        addSugar = 0;
        addChocolate = 0;

        coffeeMaker.addInventory(addCoffee, addMilk, addSugar, addChocolate);

        assertNotEquals(coffee + addCoffee, inventory.getCoffee());
        assertNotEquals(milk + addMilk, inventory.getMilk());

    }

    // Cannot add inventory. Units of milk can not be negative
    @Test
    public void addInventory4() {

        coffee = inventory.getCoffee();
        milk = inventory.getMilk();
        sugar = inventory.getSugar();
        chocolate = inventory.getChocolate();

        addCoffee = 5;
        addMilk = 3;
        addSugar = -1;
        addChocolate = 0;

        coffeeMaker.addInventory(addCoffee, addMilk, addSugar, addChocolate);

        assertNotEquals(coffee + addCoffee, inventory.getCoffee());
        assertNotEquals(milk + addMilk, inventory.getMilk());
        assertNotEquals(sugar + addSugar, inventory.getSugar());

    }

    // Cannot add inventory. Units of chocolate can not be negative
    @Test
    public void addInventory5() {

        coffee = inventory.getCoffee();
        milk = inventory.getMilk();
        sugar = inventory.getSugar();
        chocolate = inventory.getChocolate();

        addCoffee = 5;
        addMilk = 3;
        addSugar = 7;
        addChocolate = -1;

        coffeeMaker.addInventory(addCoffee, addMilk, addSugar, addChocolate);

        assertNotEquals(coffee + addCoffee, inventory.getCoffee());
        assertNotEquals(milk + addMilk, inventory.getMilk());
        assertNotEquals(sugar + addSugar, inventory.getSugar());
        assertNotEquals(chocolate + addChocolate, inventory.getChocolate());

    }

    // Please input an integer.
    @Test(expected = NullPointerException.class)
    public void addInventory6() {

        coffee = inventory.getCoffee();
        milk = inventory.getMilk();
        sugar = inventory.getSugar();
        chocolate = inventory.getChocolate();

        addCoffee = Integer.getInteger("a");
        addMilk = 0;
        addSugar = 0;
        addChocolate = 0;

        coffeeMaker.addInventory(addCoffee, addMilk, addSugar, addChocolate);

        assertNotEquals(coffee + addCoffee, inventory.getCoffee());
        assertEquals(milk + addMilk, inventory.getMilk());
        assertEquals(sugar + addSugar, inventory.getSugar());
        assertEquals(chocolate + addChocolate, inventory.getChocolate());

    }

    // Please input an integer.
    @Test(expected = NullPointerException.class)
    public void addInventory7() {

        coffee = inventory.getCoffee();
        milk = inventory.getMilk();
        sugar = inventory.getSugar();
        chocolate = inventory.getChocolate();

        addCoffee = 5;
        addMilk = Integer.getInteger("a");
        addSugar = 0;
        addChocolate = 0;

        coffeeMaker.addInventory(addCoffee, addMilk, addSugar, addChocolate);

        assertEquals(coffee + addCoffee, inventory.getCoffee());
        assertNotEquals(milk + addMilk, inventory.getMilk());
        assertEquals(sugar + addSugar, inventory.getSugar());
        assertEquals(chocolate + addChocolate, inventory.getChocolate());

    }

    // Please input an integer.
    @Test(expected = NullPointerException.class)
    public void addInventory8() {

        coffee = inventory.getCoffee();
        milk = inventory.getMilk();
        sugar = inventory.getSugar();
        chocolate = inventory.getChocolate();

        addCoffee = 5;
        addMilk = 3;
        addSugar = Integer.getInteger("a");
        addChocolate = 0;

        coffeeMaker.addInventory(addCoffee, addMilk, addSugar, addChocolate);

        assertEquals(coffee + addCoffee, inventory.getCoffee());
        assertEquals(milk + addMilk, inventory.getMilk());
        assertNotEquals(sugar + addSugar, inventory.getSugar());
        assertEquals(chocolate + addChocolate, inventory.getChocolate());

    }

    // Please input an integer.
    @Test(expected = NullPointerException.class)
    public void addInventory9() {

        coffee = inventory.getCoffee();
        milk = inventory.getMilk();
        sugar = inventory.getSugar();
        chocolate = inventory.getChocolate();

        addCoffee = 5;
        addMilk = 3;
        addSugar = 7;
        addChocolate = Integer.getInteger("a");

        coffeeMaker.addInventory(addCoffee, addMilk, addSugar, addChocolate);

        assertEquals(coffee + addCoffee, inventory.getCoffee());
        assertEquals(milk + addMilk, inventory.getMilk());
        assertEquals(sugar + addSugar, inventory.getSugar());
        assertNotEquals(chocolate + addChocolate, inventory.getChocolate());

    }

    @Test
    public void checkInventory() {

        coffee = inventory.getCoffee();
        milk = inventory.getMilk();
        sugar = inventory.getSugar();
        chocolate = inventory.getChocolate();

        assertEquals(coffee, 15);
        assertEquals(milk, 15);
        assertEquals(sugar, 15);
        assertEquals(chocolate, 15);

    }

}


text:
<!DOCTYPE html>
	<html>
	<head lang="en">
        <title>Kite9</title>
          <meta property="og:url" content="https://www.kite9.com" />
          <meta property="og:site_name" content="Kite9" />
          <meta property="og:title" content="Kite9 Diagrams" />
          <meta property="og:description" content="Kite9 draws diagrams, automatically.  UML, Risk-First, Templated, SVG, Flow-Charts, System Diagrams." />
          <meta property="og:image" content="https://www.kite9.org/public/templates/admin/kite9-preview.png" />
          <meta property="og:image:type" content="image/png" />
          <meta property="og:image:width" content="718" />
          <meta property="og:image:height" content="372" />
          <meta property="twitter:site" content="@bobm_kite9" />
          <meta property="twitter:creator" content="@bobm_kite9" />
          <meta property="twitter:card" content="summary_large_image" />
          <meta property="twitter:title" content="Kite9" />
          <meta property="twitter:description" content="Kite9 draws diagrams, automatically.  UML, Risk-First, Templated, SVG, Flow-Charts, System Diagrams." />
          <meta property="twitter:image:src" content="https://www.kite9.org/public/templates/admin/kite9-preview.png" />
          <meta property="twitter:image:width" content="718" />
          <meta property="twitter:image:height" content="372" />
	      <meta charset="UTF-8" />
	      {headers}
	</head>
	<body>
		<div class="main">
			{content}
		</div>
	</body>
</html>


text:
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using Microsoft.Azure.WebJobs.Extensions.Timers;
using Xunit;

namespace Microsoft.Azure.WebJobs.Extensions.Tests.Timers
{
    public class TimerTriggerAttributeTests
    {
        [Fact]
        public void Constructor_ScheduleExpression()
        {
            TimerTriggerAttribute attribute = new TimerTriggerAttribute("00:00:15");
            Assert.Equal("00:00:15", attribute.ScheduleExpression);
            Assert.Null(attribute.ScheduleType);
            Assert.True(attribute.UseMonitor);
        }

        [Fact]
        public void Constructor_ScheduleType()
        {
            TimerTriggerAttribute attribute = new TimerTriggerAttribute(typeof(DailySchedule));
            Assert.Null(attribute.ScheduleExpression);
            Assert.Equal(typeof(DailySchedule), attribute.ScheduleType);
            Assert.True(attribute.UseMonitor);
        }
    }
}


text:
package io.daten.faster.io;

import io.daten.faster.PlatformUtil;
import java.io.Closeable;
import java.io.IOException;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.file.Path;
import sun.misc.Cleaner;
import sun.nio.ch.DirectBuffer;

public final class MmapFile implements Closeable {

    private final FileChannel channel;

    private final MappedByteBuffer buffer;

    public static MmapFile open(final Path path, final long size) throws IOException {
        return new MmapFile(path, size);
    }

    private MmapFile(final Path path, final long size) throws IOException {
        channel = FileChannel.open(path);
        buffer = channel.map(FileChannel.MapMode.READ_WRITE, 0L, size);
    }

    public void sync() {
        buffer.force();
    }

    @Override
    public void close() throws IOException {
        channel.close();
        if (PlatformUtil.IS_WINDOWS) {
            final Cleaner cleaner = ((DirectBuffer) this.buffer).cleaner();
            if (cleaner != null) {
                cleaner.clean();
            }
        }
    }
}


text:
@class BTListPost,BTListPostDynamic;
@interface BTListPostInfoVC : UIViewController <UITableViewDataSource,UITableViewDelegate>

@property (nonatomic, copy) NSString *extendId;

@property (nonatomic, strong) BTListPostDynamic *dynamic;

@property (nonatomic, assign) NSInteger indexPathRow;

@end


text:
<?xml version="1.0"?>
<package>
  <name>lbr_iiwa_description</name>
  <version>0.0.0</version>
  <description>The rrbot_description package</description>

  <maintainer email="robert.krug@oru.se">Robert Krug</maintainer>

  <license>BSD</license>

  <author email="robert.krug@oru.se">Robert Krug</author>

  <buildtool_depend>catkin</buildtool_depend>

  <export>
  </export>
</package>


text:
import svb

svb.key = "I LOVE BANKING"

# This is part of creating a bank account with SVB
# But is a good use case to show off mutating objects

awesome_address = svb.Address.create(
    street_line1="123 awesome ln",
    city="Jamesville",
    country="NG"
)

# Make sure we have the newest version
awesome_address.refresh()

# Oh yeah! We forgot the state
awesome_address.state = "Florida"

# Let's sync the local state with the server
awesome_address.save()

# Let's make sure server state is up to date
awesome_address.refresh()


text:
<?php

require "common.php";

if (isset($_GET["id"]) && !empty($_GET["id"])) {

  if (isset($_GET["delete"])) {

    $statement = "

      DELETE FROM " . DB_PREF . "content
      WHERE id = ?
      AND type = 1
    ";

    $Query = $Database->getHandle()->prepare($statement);

    // Prevent SQL injections.
    $Query->bindParam(1, $_GET["id"]);

    $Query->execute();

    if (!$Query) {

      $message = "failed to delete page";

      // Failed to delete page.
      header("Location: pages.php?code=0&message={$message}");

      exit();
    }

    $message = "page deleted successfully";

    // Page successfully deleted.
    header("Location: pages.php?code=1&message={$message}");

    exit();
  }

  $statement = "

    SELECT title
    FROM " . DB_PREF . "content
    WHERE id = ?
    AND type = 1
    ORDER BY id DESC
    LIMIT 1
  ";

  $Query = $Database->getHandle()->prepare($statement);

  // Prevent SQL injections.
  $Query->bindParam(1, $_GET["id"]);

  $Query->execute();

  if (!$Query) {

    // Something went wrong.
    $Utility->displayError("failed to select page title");
  }

  if ($Query->rowCount() == 0) {

    // This page does not exist.
    $body .= "

      There exists no page with an ID of " . $_GET["id"] . ".

      Return
    ";
  }
  else {

    // Get the page's name, and encode { and } to prevent them from being replaced by the output buffer.
    $page_name = str_replace(["{", "}"], ["{", "}"], $Query->fetch(PDO::FETCH_OBJ)->title);

    $body .= "

      Are you sure you want to delete the \"{$page_name}\" page?

      Yes
      No
    ";
  }
}
else {

  // No ID given.
  $body .= "

    No ID supplied.

    Return
  ";
}

$replace[] = "Delete Page";
$replace[] = $body;

echo str_replace($search, $replace, $theme);

echo $Buffer->flush();

?>