text:
package com.buuz135.industrial.jei.category;

import com.buuz135.industrial.recipe.FluidExtractorRecipe;
import com.buuz135.industrial.utils.Reference;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.ingredient.IGuiFluidStackGroup;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.category.IRecipeCategory;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;

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

public class FluidExtractorCategory implements IRecipeCategory<FluidExtractorRecipe> {

    public static final ResourceLocation ID = new ResourceLocation(Reference.MOD_ID, "fluid_extractor");

    private IGuiHelper guiHelper;
    private IDrawable tankOverlay;

    public FluidExtractorCategory(IGuiHelper guiHelper) {
        this.guiHelper = guiHelper;
        this.tankOverlay = guiHelper.createDrawable(new ResourceLocation(Reference.MOD_ID, "textures/gui/jei.png"), 1, 207, 12, 48);
    }

    @Override
    public ResourceLocation getUid() {
        return ID;
    }

    @Override
    public Class<? extends FluidExtractorRecipe> getRecipeClass() {
        return FluidExtractorRecipe.class;
    }

    @Override
    public String getTitle() {
        return "Fluid Extractor";
    }

    @Override
    public IDrawable getBackground() {
        return guiHelper.drawableBuilder(new ResourceLocation(Reference.MOD_ID, "textures/gui/jei.png"), 0, 27, 76, 50).addPadding(0, 0, 0, 74).build();
    }

    @Override
    public IDrawable getIcon() {
        return null;
    }

    @Override
    public void setIngredients(FluidExtractorRecipe fluidExtractorRecipe, IIngredients ingredients) {
        ingredients.setInputs(VanillaTypes.ITEM, new ArrayList<>(fluidExtractorRecipe.input.getStacks()));
        ingredients.setOutput(VanillaTypes.FLUID, fluidExtractorRecipe.output);
        if (!new ItemStack(fluidExtractorRecipe.result).isEmpty())
            ingredients.setOutput(VanillaTypes.ITEM, new ItemStack(fluidExtractorRecipe.result));
    }

    @Override
    public void setRecipe(IRecipeLayout recipeLayout, FluidExtractorRecipe fluidExtractorRecipe, IIngredients ingredients) {
        IGuiItemStackGroup guiItemStackGroup = recipeLayout.getItemStacks();
        guiItemStackGroup.init(0, true, 0, 16);
        if (ingredients.getOutputs(VanillaTypes.ITEM).size() > 0) {
            guiItemStackGroup.init(1, false, 27, 34);
            guiItemStackGroup.setBackground(1, guiHelper.getSlotDrawable());
            guiItemStackGroup.set(1, ingredients.getOutputs(VanillaTypes.ITEM).get(0));
        }

        IGuiFluidStackGroup guiFluidStackGroup = recipeLayout.getFluidStacks();
        guiFluidStackGroup.init(1, false, 57, 1, 12, 48, Math.max(50, ingredients.getOutputs(VanillaTypes.FLUID).get(0).get(0).getAmount()), false, tankOverlay);

        guiItemStackGroup.set(0, ingredients.getInputs(VanillaTypes.ITEM).get(0));
        guiFluidStackGroup.set(1, ingredients.getOutputs(VanillaTypes.FLUID).get(0));
    }

    @Override
    public void draw(FluidExtractorRecipe recipe, double mouseX, double mouseY) {
        Minecraft.getInstance().fontRenderer.drawString(TextFormatting.DARK_GRAY + "Production: ", 80, 6, 0xFFFFFF);
        Minecraft.getInstance().fontRenderer.drawString(TextFormatting.DARK_GRAY + "" + recipe.output.getAmount() + "mb/12ticks", 80, 6 + (Minecraft.getInstance().fontRenderer.FONT_HEIGHT + 2) * 1, 0xFFFFFF);
        Minecraft.getInstance().fontRenderer.drawString(TextFormatting.DARK_GRAY + "" + "Average: ", 80, 6 + (Minecraft.getInstance().fontRenderer.FONT_HEIGHT + 2) * 2, 0xFFFFFF);
        Minecraft.getInstance().fontRenderer.drawString(TextFormatting.DARK_GRAY + "" + ((int) (8 / recipe.breakChance) * recipe.output.getAmount()) + "mb", 80, 6 + (Minecraft.getInstance().fontRenderer.FONT_HEIGHT + 2) * 3, 0xFFFFFF);
    }

    @Override
    public List<String> getTooltipStrings(FluidExtractorRecipe recipe, double mouseX, double mouseY) {
        if (mouseX >= 78 && mouseX <= 140 && mouseY >= 5 && mouseY <= 25) return Arrays.asList("Production rate");
        if (mouseX >= 78 && mouseX <= 120 && mouseY >= 25 && mouseY <= 45)
            return Arrays.asList("Average numbers aren't real numbers");
        return new ArrayList<>();
    }
}


text:
namespace legion
{

class PluginContext
{
public:
    PluginContext( optix::Context optix_context );

    void addAssetPath( const std::string& asset_path );

    optix::Context getOptiXContext();

    void openFile(
        const std::string&       filename,
        std::ifstream&           out,
        std::ios_base::openmode  mode = std::ios::in | std::ios::binary
        ) const;

private:
    typedef std::vector<std::string> Path;

    optix::Context  m_optix_context;
    Path            m_asset_path;
};

}

#endif // LEGION_CORE_PLUGIN_CONTEXT_H_

redpajama_set_name: RedPajamaGithub


text:
using System;

namespace GatoModWSNetCore.Models
{
    public class Model
    {
        public int Id { get;set; }
        public string Title { get;set; }
        public string Comments { get;set; }
        public string Brand { get;set; }
        public string Scale { get;set; }
        public DateTime Date { get;set; }
        public string Folder { get;set; }
        public int NbTotalPhoto { get;set; }
    }
}


text:
class CreateEntries < ActiveRecord::Migration
  def change
    create_table :entries do |t|
      t.text :content, :limit => 150
      t.belongs_to :user, index: true
      t.integer :audience, :default => 1
      t.timestamps
    end
  end
end


text:
package ch.rasc.extdirectspring.demo.bancha;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;

import javax.annotation.PostConstruct;
import javax.validation.Valid;

import org.springframework.stereotype.Service;
import org.springframework.validation.BindingResult;

import ch.ralscha.extdirectspring.annotation.ExtDirectMethod;
import ch.ralscha.extdirectspring.annotation.ExtDirectMethodType;
import ch.ralscha.extdirectspring.bean.ExtDirectFormPostResult;

@Service("banchaUserService")
public class UserService {

	private final static Map<Integer, User> userDb = new ConcurrentHashMap<>();

	private final static AtomicInteger maxId = new AtomicInteger(4);

	@PostConstruct
	public void init() {

		User user = new User();
		user.setId(1);
		user.setName("Joe");
		user.setLogin("joe");
		user.setCreated(LocalDateTime.of(2012, 7, 28, 8, 54, 20));
		user.setEmail("joe@test.com");
		user.setAvatar(null);
		user.setWeight(76);
		user.setHeight(187);
		userDb.put(1, user);

		user = new User();
		user.setId(2);
		user.setName("Dan");
		user.setLogin("dan");
		user.setCreated(LocalDateTime.of(2012, 7, 29, 11, 5, 20));
		user.setEmail("dan@test.com");
		user.setAvatar(null);
		user.setWeight(70);
		user.setHeight(230);
		userDb.put(2, user);

		user = new User();
		user.setId(3);
		user.setName("Ralph");
		user.setLogin("ralph");
		user.setCreated(LocalDateTime.of(2012, 7, 30, 16, 11, 44));
		user.setEmail("ralph@test.com");
		user.setAvatar(null);
		user.setWeight(72);
		user.setHeight(180);
		userDb.put(3, user);

		user = new User();
		user.setId(4);
		user.setName("Nils");
		user.setLogin("nils");
		user.setCreated(LocalDateTime.of(2012, 7, 31, 18, 0, 1));
		user.setEmail("nils@test.com");
		user.setAvatar(null);
		user.setWeight(82);
		user.setHeight(186);
		userDb.put(4, user);

	}

	@ExtDirectMethod(value = ExtDirectMethodType.STORE_READ, group = "bancha")
	public Collection<User> read() {
		return userDb.values();
	}

	@ExtDirectMethod(value = ExtDirectMethodType.STORE_MODIFY, group = "bancha")
	public List<User> create(List<User> newUsers) {
		List<User> result = new ArrayList<>();
		for (User user : newUsers) {
			user.setId(maxId.incrementAndGet());
			userDb.put(user.getId(), user);
			result.add(user);
		}
		return Collections.unmodifiableList(result);
	}

	@ExtDirectMethod(value = ExtDirectMethodType.STORE_MODIFY, group = "bancha")
	public List<User> update(List<User> updatedUsers) {
		for (User user : updatedUsers) {
			userDb.put(user.getId(), user);
		}
		return updatedUsers;
	}

	@ExtDirectMethod(value = ExtDirectMethodType.STORE_MODIFY, group = "bancha")
	public void destroy(List<User> destroyUsers) {
		for (User user : destroyUsers) {
			userDb.remove(user.getId());
		}
	}

	@ExtDirectMethod(value = ExtDirectMethodType.FORM_LOAD, group = "bancha")
	public User load(int id) {
		return userDb.get(id);
	}

	@ExtDirectMethod(value = ExtDirectMethodType.FORM_POST, group = "bancha")
	public ExtDirectFormPostResult submit(@Valid User user, BindingResult result) {
		if (!result.hasErrors()) {
			if (user.getId() > 0) {
				userDb.put(user.getId(), user);
			}
			else {
				user.setId(maxId.incrementAndGet());
				userDb.put(user.getId(), user);
			}
		}
		System.out.println(user);
		user.setAvatar(null);
		return new ExtDirectFormPostResult(result);
	}

}


text:
package com.be.android.library.worker.demo.ui.base;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.widget.Toast;

import com.be.android.library.worker.controllers.JobLoader;
import com.be.android.library.worker.controllers.JobLoaderManager;
import com.be.android.library.worker.controllers.JobManager;
import com.be.android.library.worker.handlers.JobEventDispatcher;
import com.be.android.library.worker.interfaces.Job;
import com.be.android.library.worker.util.JobProgressTracker;
import com.be.android.library.worker.util.JobSelector;

import java.util.List;

import rx.Subscription;
import rx.subscriptions.CompositeSubscription;

public class BaseFragment extends Fragment implements JobLoader.JobLoaderCallbacks  {

    private JobEventDispatcher mEventDispatcher;
    private JobProgressTracker mProgressTracker;
    private boolean mIsRegistered;
    private CompositeSubscription mSubscriptions;

    private final JobLoader.JobLoaderCallbacks mJobLoaderCallbacks =
            new JobLoader.JobLoaderCallbacks() {
        @Override
        public Job onCreateJob(String attachTag, Bundle data) {
            final Job job = BaseFragment.this.onCreateJob(attachTag, data);

            if (job == null) {
                return BaseFragment.this.onCreateJob(attachTag);
            }

            return job;
        }
    };

    private final JobProgressTracker.Callbacks mJobProgressTrackerCallbacks =
            new JobProgressTracker.Callbacks() {

        @Override
        public void onProgressStarted() {
            onJobProgressStarted();
        }

        @Override
        public void onProgressStopped() {
            onJobProgressStopped();
        }
    };

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mEventDispatcher = new JobEventDispatcher(getActivity());
        mEventDispatcher.restoreState(savedInstanceState);
        mProgressTracker = new JobProgressTracker(getJobManager());
    }

    @Override
    public void onPause() {
        if (mIsRegistered) {
            mEventDispatcher.unregister(this);
        }
        mProgressTracker.detach();
        mProgressTracker.setCallbacks(null);

        super.onPause();
    }

    @Override
    public void onResume() {
        super.onResume();

        registerEventDispatcher();
        mProgressTracker.attach();
        mProgressTracker.setCallbacks(mJobProgressTrackerCallbacks);
    }

    @Override
    public void onStop() {
        super.onStop();

        if (mSubscriptions != null) {
            mSubscriptions.clear();
            mSubscriptions.unsubscribe();
        }
    }

    protected void registerEventDispatcher() {
        mEventDispatcher.register(this);
        mIsRegistered = true;
    }

    protected void registerSubscription(Subscription subscription) {
        if (mSubscriptions == null) {
            mSubscriptions = new CompositeSubscription();
        }

        mSubscriptions.add(subscription);
    }

    public boolean handleBackPress() {
        return false;
    }

    protected JobEventDispatcher getJobEventDispatcher() {
        return mEventDispatcher;
    }

    protected JobProgressTracker getProgressTracker() {
        return mProgressTracker;
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);

        mEventDispatcher.saveState(outState);
    }

    protected void showToast(int stringId) {
        if (!isVisible()) return;

        showToast(stringId, Toast.LENGTH_SHORT);
    }

    protected void showToast(String text) {
        if (!isVisible()) return;

        showToast(text, Toast.LENGTH_SHORT);
    }

    protected void showToast(int stringId, int toastLength) {
        if (!isVisible()) return;

        Toast.makeText(getActivity(), stringId, toastLength).show();
    }

    protected void showToast(String text, int toastLength) {
        if (!isVisible()) return;

        Toast.makeText(getActivity(), text, toastLength).show();
    }

    protected int submitJob(Job job) {
        return mEventDispatcher.submitJob(job);
    }

    protected int requestLoad(String loaderAttachTag, JobLoader.JobLoaderCallbacks callbacks, Bundle data) {
        JobLoaderManager mgr = JobLoaderManager.getInstance();
        JobLoader loader = mgr.initLoader(mEventDispatcher, loaderAttachTag, callbacks);

        final int jobId = loader.requestLoad(data);

        onLoadRequested(loaderAttachTag, jobId);

        return jobId;
    }

    protected int requestLoad(String loaderAttachTag, Bundle data) {
        return requestLoad(loaderAttachTag, mJobLoaderCallbacks, data);
    }

    protected int requestLoad(String loaderAttachTag) {
        return requestLoad(loaderAttachTag, mJobLoaderCallbacks, null);
    }

    protected int requestReload(String loaderAttachTag,
                                JobLoader.JobLoaderCallbacks callbacks,
                                Bundle data,
                                boolean discardCallbacks) {

        final JobSelector selector = JobSelector.forJobTags(loaderAttachTag);
        if (discardCallbacks) {
            List<Job> jobs = JobManager.getInstance().findAll(selector);
            for (Job job : jobs) {
                mEventDispatcher.removePendingJob(job.getJobId());
                job.cancel();
            }
        } else {
            JobManager.getInstance().cancelAll(selector);
        }

        JobLoaderManager mgr = JobLoaderManager.getInstance();
        JobLoader loader = mgr.initLoader(mEventDispatcher, loaderAttachTag, callbacks);

        final int jobId = loader.requestLoad(data);

        onReloadRequested(loaderAttachTag, jobId);

        return jobId;
    }

    protected int requestReload(String loaderAttachTag, Bundle data) {
        return requestReload(loaderAttachTag, mJobLoaderCallbacks, data, false);
    }

    protected int requestReload(String loaderAttachTag) {
        return requestReload(loaderAttachTag, mJobLoaderCallbacks, null, false);
    }

    protected int requestReload(String loaderAttachTag, Bundle data, boolean discardCallbacks) {
        return requestReload(loaderAttachTag, mJobLoaderCallbacks, data, discardCallbacks);
    }

    protected int requestReload(String loaderAttachTag, boolean discardCallbacks) {
        return requestReload(loaderAttachTag, mJobLoaderCallbacks, null, discardCallbacks);
    }

    protected void onReloadRequested(String loaderAttachTag, int jobId) {
        mProgressTracker.registerJob(jobId);
    }

    protected void onLoadRequested(String loaderAttachTag, int jobId) {
        mProgressTracker.registerJob(jobId);
    }

    @Override
    public Job onCreateJob(String attachTag, Bundle data) {
        return null;
    }

    protected Job onCreateJob(String attachTag) {
        throw new UnsupportedOperationException("should implement onCreateJob");
    }

    public JobManager getJobManager() {
        return JobManager.getInstance();
    }

    protected void onJobProgressStarted() {
    }

    protected void onJobProgressStopped() {
    }
}


text:
// Copyright 2009 Google Inc.
//
// 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.
// ========================================================================
//
// BCJ encodes a file to increase its compressibility.

#include <windows.h>
#include <shellapi.h>

#include "base/basictypes.h"
#include "base/scoped_ptr.h"
#include "third_party/smartany/scoped_any.h"

extern "C" {
#include "third_party/lzma/v4_65/files/C/Bra.h"
}

int wmain(int argc, WCHAR* argv[], WCHAR* env[]) {
  UNREFERENCED_PARAMETER(env);

  if (argc < 3) {
    return 1;
  }

  // argv[1] is the input file, argv[2] is the output file.
  scoped_hfile file(::CreateFile(argv[1], GENERIC_READ, 0,
                                 NULL, OPEN_EXISTING, 0, NULL));
  if (!valid(file)) {
    return 2;
  }

  LARGE_INTEGER file_size_data;
  if (!::GetFileSizeEx(get(file), &file_size_data)) {
    return 3;
  }

  DWORD file_size = static_cast<DWORD>(file_size_data.QuadPart);
  scoped_array<uint8> buffer(new uint8[file_size]);
  DWORD bytes_read = 0;
  if (!::ReadFile(get(file), buffer.get(), file_size, &bytes_read, NULL) ||
      bytes_read != file_size) {
    return 4;
  }

  uint32 conversion_state;
  x86_Convert_Init(conversion_state);
  // processed might be less than bytes read. This is apparently OK, although
  // I don't understand why!
  uint32 processed = x86_Convert(buffer.get(),
                                 bytes_read,
                                 0,
                                 &conversion_state,
                                 1 /* encoding */);

  reset(file, ::CreateFile(argv[2], GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0,
                           NULL));
  if (!valid(file)) {
    return 6;
  }

  DWORD bytes_written = 0;
  if (!::WriteFile(get(file), buffer.get(), bytes_read, &bytes_written, NULL)) {
    return 7;
  }

  return 0;
}


text:
var mongoose  = require('mongoose');
var Schema    =  mongoose.Schema;
var ObjectId  = Schema.Types.ObjectId;

var versionSchema = new Schema({
  title: { type: String },
  description: { type: String },
  abstract: { type: String },
  content: { type: String },
  type: { type: String },
  pub: { type: ObjectId, ref: 'Pub' },
  style: { type: String },
  styleColor: { type: String },
  // assets: [ { type: ObjectId, ref: 'Asset' } ],
  assetTree: { type: String },
  dataSetsObject: { type: String },
  dataAnalysesObject: { type: String },
  dataVisualizationsObject: { type: String },
  authorsUsers: [{
  	  _id: { type: ObjectId },
	  username: { type: String },
	  name: { type: String },
	  image: { type: String }
  }],
  authorsGroups: [{
  	  _id: { type: ObjectId },
	  uniqueName: { type: String },
	  name: { type: String },
	  image: { type: String }
  }],
  references: [{
  			refName: { type: String},
  			_id: { type: ObjectId},
			title: { type: String },
			url: { type: String },
			author: { type: String },
			journal: { type: String },
			volume: { type: String },
			number: { type: String },
			pages: { type: String },
			date: { type: String },
			publisher: { type: String },
			note: { type: String },
			sourcePub: { type: ObjectId, ref: 'Pub' },
			version: { type: ObjectId, ref: 'Version' },
			sourceHighlight: { type: ObjectId, ref: 'Highlight' },

			clonedFromRef: { type: ObjectId, ref: 'Reference' },
			clonedFromPub: { type: ObjectId, ref: 'Pub' },

			usedInPubs: [{ type: ObjectId, ref: 'Pub' }],
			owner: { type: ObjectId, ref: 'User' },
			createDate: { type: Date },
			editDate: { type: Date }  }],
postDate: { type: Date }
})

module.exports = mongoose.model('Version', versionSchema);


text: run 'rails generate simple_form:install'


text:
<?xml version="1.0"?>
<projectProfile type="default" version="1.12.1">
  <projectDirectory>
    <projectProfileFile filesystemName=".zfproject.xml"/>
    <applicationDirectory classNamePrefix="Application_">
      <configsDirectory>
        <applicationConfigFile type="ini"/>
      </configsDirectory>
      <controllersDirectory>
        <controllerFile controllerName="Index">
          <actionMethod actionName="index"/>
          <actionMethod actionName="about"/>
          <actionMethod actionName="fun"/>
        </controllerFile>
        <controllerFile controllerName="Error"/>
        <controllerFile controllerName="Account">
          <actionMethod actionName="index"/>
          <actionMethod actionName="login"/>
          <actionMethod actionName="register"/>
          <actionMethod actionName="edit"/>
          <actionMethod actionName="activate"/>
          <actionMethod actionName="forgotpassword"/>
          <actionMethod actionName="logout"/>
        </controllerFile>
        <controllerFile controllerName="User">
          <actionMethod actionName="index"/>
          <actionMethod actionName="edit"/>
        </controllerFile>
      </controllersDirectory>
      <formsDirectory>
        <formFile formName="Login"/>
        <formFile formName="Register"/>
        <formFile formName="Account"/>
        <formFile formName="Image"/>
        <formFile formName="Forgotpassword"/>
      </formsDirectory>
      <layoutsDirectory>
        <layoutScriptsDirectory>
          <layoutScriptFile layoutName="layout"/>
        </layoutScriptsDirectory>
      </layoutsDirectory>
      <modelsDirectory/>
      <modulesDirectory>
        <moduleDirectory moduleName="backoffice">
          <configsDirectory enabled="false"/>
          <controllersDirectory/>
          <formsDirectory enabled="false"/>
          <layoutsDirectory enabled="false">
            <layoutScriptsDirectory enabled="false"/>
          </layoutsDirectory>
          <modelsDirectory/>
          <servicesDirectory enabled="false"/>
          <viewsDirectory>
            <viewScriptsDirectory/>
            <viewHelpersDirectory/>
            <viewFiltersDirectory/>
          </viewsDirectory>
        </moduleDirectory>
        <moduleDirectory moduleName="api">
          <configsDirectory enabled="false"/>
          <controllersDirectory>
            <controllerFile controllerName="Index">
              <actionMethod actionName="index"/>
            </controllerFile>
            <controllerFile controllerName="Dataset">
              <actionMethod actionName="index"/>
            </controllerFile>
            <controllerFile controllerName="Error">
              <actionMethod actionName="index"/>
            </controllerFile>
            <controllerFile controllerName="User">
              <actionMethod actionName="index"/>
            </controllerFile>
          </controllersDirectory>
          <formsDirectory enabled="false"/>
          <layoutsDirectory enabled="false">
            <layoutScriptsDirectory enabled="false"/>
          </layoutsDirectory>
          <modelsDirectory/>
          <servicesDirectory enabled="false"/>
          <viewsDirectory>
            <viewScriptsDirectory>
              <viewControllerScriptsDirectory forControllerName="Index">
                <viewScriptFile forActionName="index"/>
              </viewControllerScriptsDirectory>
              <viewControllerScriptsDirectory forControllerName="Dataset">
                <viewScriptFile forActionName="index"/>
              </viewControllerScriptsDirectory>
              <viewControllerScriptsDirectory forControllerName="Error">
                <viewScriptFile forActionName="index"/>
              </viewControllerScriptsDirectory>
              <viewControllerScriptsDirectory forControllerName="User">
                <viewScriptFile forActionName="index"/>
              </viewControllerScriptsDirectory>
            </viewScriptsDirectory>
            <viewHelpersDirectory/>
            <viewFiltersDirectory/>
          </viewsDirectory>
        </moduleDirectory>
      </modulesDirectory>
      <servicesDirectory enabled="false"/>
      <viewsDirectory>
        <viewScriptsDirectory>
          <viewControllerScriptsDirectory forControllerName="Index">
            <viewScriptFile forActionName="index"/>
          </viewControllerScriptsDirectory>
          <viewControllerScriptsDirectory forControllerName="Error">
            <viewScriptFile forActionName="error"/>
          </viewControllerScriptsDirectory>
          <viewControllerScriptsDirectory forControllerName="Account">
            <viewScriptFile forActionName="index"/>
          </viewControllerScriptsDirectory>
          <viewControllerScriptsDirectory forControllerName="Account">
            <viewScriptFile forActionName="login"/>
          </viewControllerScriptsDirectory>
          <viewControllerScriptsDirectory forControllerName="Account">
            <viewScriptFile forActionName="register"/>
          </viewControllerScriptsDirectory>
          <viewControllerScriptsDirectory forControllerName="Account">
            <viewScriptFile forActionName="edit"/>
          </viewControllerScriptsDirectory>
          <viewControllerScriptsDirectory forControllerName="User">
            <viewScriptFile forActionName="index"/>
          </viewControllerScriptsDirectory>
          <viewControllerScriptsDirectory forControllerName="User">
            <viewScriptFile forActionName="edit"/>
          </viewControllerScriptsDirectory>
          <viewControllerScriptsDirectory forControllerName="Account">
            <viewScriptFile forActionName="activate"/>
          </viewControllerScriptsDirectory>
          <viewControllerScriptsDirectory forControllerName="Account">
            <viewScriptFile forActionName="forgotpassword"/>
          </viewControllerScriptsDirectory>
          <viewControllerScriptsDirectory forControllerName="Account">
            <viewScriptFile forActionName="logout"/>
          </viewControllerScriptsDirectory>
          <viewControllerScriptsDirectory forControllerName="Index">
            <viewScriptFile forActionName="about"/>
          </viewControllerScriptsDirectory>
          <viewControllerScriptsDirectory forControllerName="Index">
            <viewScriptFile forActionName="fun"/>
          </viewControllerScriptsDirectory>
        </viewScriptsDirectory>
        <viewHelpersDirectory/>
        <viewFiltersDirectory enabled="false"/>
      </viewsDirectory>
      <bootstrapFile filesystemName="Bootstrap.php"/>
    </applicationDirectory>
    <dataDirectory enabled="false">
      <cacheDirectory enabled="false"/>
      <searchIndexesDirectory enabled="false"/>
      <localesDirectory enabled="false"/>
      <logsDirectory enabled="false"/>
      <sessionsDirectory enabled="false"/>
      <uploadsDirectory enabled="false"/>
    </dataDirectory>
    <docsDirectory>
      <file filesystemName="README.txt"/>
    </docsDirectory>
    <libraryDirectory>
      <zfStandardLibraryDirectory enabled="false"/>
    </libraryDirectory>
    <publicDirectory>
      <publicStylesheetsDirectory enabled="false"/>
      <publicScriptsDirectory enabled="false"/>
      <publicImagesDirectory enabled="false"/>
      <publicIndexFile filesystemName="index.php"/>
      <htaccessFile filesystemName=".htaccess"/>
    </publicDirectory>
    <projectProvidersDirectory enabled="false"/>
    <temporaryDirectory enabled="false"/>
    <testsDirectory>
      <testPHPUnitConfigFile filesystemName="phpunit.xml"/>
      <testPHPUnitBootstrapFile filesystemName="bootstrap.php"/>
      <testApplicationDirectory>
        <testApplicationControllerDirectory>
          <testApplicationControllerFile forControllerName="Index"/>
        </testApplicationControllerDirectory>
      </testApplicationDirectory>
      <testLibraryDirectory/>
    </testsDirectory>
  </projectDirectory>
</projectProfile>


text:
@echo off

:: change to directory of this script
pushd %~dp0

:: clear results
call jacoco-aggregation-application\00_Clean.cmd
call jacoco-aggregation-library\00_Clean.cmd
call jacoco-application\00_Clean.cmd
call jacoco-library\00_Clean.cmd
call jacoco-test\00_Clean.cmd

:: restore directory
popd


text:
title: Landing
layout: landing
description: 'Lorem ipsum dolor sit amet nullam consequa
sed veroeros. tempus adipiscing nulla.'
image: assets/images/pic07.jpg
nav-menu: true
---

Sed amet aliquam

Nullam et orci eu lorem consequat tincidunt vivamus et sagittis magna sed nunc rhoncus condimentum sem. In efficitur ligula tate urna. Maecenas massa vel lacinia pellentesque lorem ipsum dolor. Nullam et orci eu lorem consequat tincidunt. Vivamus et sagittis libero. Nullam et orci eu lorem consequat tincidunt vivamus et sagittis magna sed nunc rhoncus condimentum sem. In efficitur ligula tate urna.

Orci maecenas

Nullam et orci eu lorem consequat tincidunt vivamus et sagittis magna sed nunc rhoncus condimentum sem. In efficitur ligula tate urna. Maecenas massa sed magna lacinia magna pellentesque lorem ipsum dolor. Nullam et orci eu lorem consequat tincidunt. Vivamus et sagittis tempus.

Learn more

Rhoncus magna

Nullam et orci eu lorem consequat tincidunt vivamus et sagittis magna sed nunc rhoncus condimentum sem. In efficitur ligula tate urna. Maecenas massa sed magna lacinia magna pellentesque lorem ipsum dolor. Nullam et orci eu lorem consequat tincidunt. Vivamus et sagittis tempus.

Learn more

Sed nunc ligula

Nullam et orci eu lorem consequat tincidunt vivamus et sagittis magna sed nunc rhoncus condimentum sem. In efficitur ligula tate urna. Maecenas massa sed magna lacinia magna pellentesque lorem ipsum dolor. Nullam et orci eu lorem consequat tincidunt. Vivamus et sagittis tempus.

Learn more

Massa libero

Nullam et orci eu lorem consequat tincidunt vivamus et sagittis libero. Mauris aliquet magna magna sed nunc rhoncus pharetra. Pellentesque condimentum sem. In efficitur ligula tate urna. Maecenas laoreet massa vel lacinia pellentesque lorem ipsum dolor. Nullam et orci eu lorem consequat tincidunt. Vivamus et sagittis libero. Mauris aliquet magna magna sed nunc rhoncus amet pharetra et feugiat tempus.

Get Started


text:
Function Enter-PSRemotely {
    [CmdletBinding()]
    param (
        # Specify this switch to get the PSSession object
        [Switch]$PassThru
    )

    DynamicParam {
        # Add a dynamic parameter 'NodeName' which discovers the PSRemotely nodes by looking at
        # the $PSRemotely global variable
        if ($Global:PSRemotely) {
                # only add this dynamic parameter if the $PSRemotely global var exists
                #create a new ParameterAttribute Object
                $NodeNameAttribute = New-Object System.Management.Automation.ParameterAttribute
                $NodeNameAttribute.Position = 1
                $NodeNameAttribute.Mandatory = $true
                $NodeNameAttribute.ParameterSetName = '__AllParameterSets'
                $NodeNameAttribute.HelpMessage = "Enter the remotely node name to connect to"

                #create an attributecollection object for the attribute we just created.
                $attributeCollection = new-object System.Collections.ObjectModel.Collection[System.Attribute]
                $AvailablePSRemotelyNodeNames = @($Global:PSRemotely.SessionHashTable.Keys)
                # add the PSRemotely node names to the attributecollection
                $attributeCollection.Add(
                    (New-Object -TypeName System.Management.Automation.ValidateSetAttribute(
                        $AvailablePSRemotelyNodeNames)
                    )
                )
                #add our custom attribute
                $attributeCollection.Add($NodeNameAttribute)

                #add our paramater specifying the attribute collection
                $NodeNameParam = New-Object System.Management.Automation.RuntimeDefinedParameter('NodeName', [String], $attributeCollection)

                #expose the name of our parameter
                $NodeNameDic  = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
                $NodeNameDic.Add('NodeName', $NodeNameParam)
                return $NodeNameDic
        }
    }
    Process {

        $SessionInfo = $Global:PSRemotely.SessionHashTable[$($PSBoundParameters.NodeName)]

        $Session = $Global:PSRemotely.SessionHashTable[$($PSBoundParameters.NodeName)].Session
        if ($Session){

            if ($Session.State -ne 'Opened'){
                # Re-connect to the node. Note the $Node variable populated earlier is now lost.
                CheckAndReconnect -SessionInfo $SessionInfo
                # since the session is re-connected, set the value back in the $session variable to use.
                $Session = $Global:PSRemotely.SessionHashTable[$($PSBoundParameters.NodeName)].Session
                # Reinitialize Session with the PSRemotely variable
                ReinitializeSession -SessionInfo $SessionInfo -ArgumentList @{PSRemotely=$PSRemotely}
            }

            $IsConfigurationDataUsed = Invoke-Command -Session $Session -ScriptBlock {return $Node} -ErrorAction SilentlyContinue
            if ($IsConfigurationDataUsed) {
                $PSRemotelyParameterSet= 'ConfigurationData'
            }
            else {
                $PSRemotelyParameterSet = 'NodeName'
            }
            Switch ($PSRemotelyParameterSet) {
                'ConfigurationData' {
                    $ScriptBlock = {
                        param(
                            [Parameter()]
                            $Node=$Node, # point this by default to $Node populated in remote session

                            [Parameter()]
                            $Path,

                            [Parameter()]
                            $PSRemotely= $Global:PSRemotely
                        )
                        try {
                        if (-not $Path){
                            $Path = "$($Global:PSRemotely.PSRemotelyNodePath)\*.ps1"
                        }
                            Set-Location -Path $PSRemotely.PSRemotelyNodePath
                            Invoke-Pester -Script @{Path=$Path;Parameters=@{Node=$Node}}
                        }
                        catch {
                            Write-Warning -Message "[Warning] $($PSItem.Exception.Message)"
                        }
                    }
                }
                'NodeName' {
                    $ScriptBlock = {
                        param()
                        try {
                            Invoke-Pester -Path "$($PSRemotely.PSRemotelyNodePath)\*.ps1" -ErrorAction Stop

                        }
                        catch {
                            Write-Warning -Message "[Warning] $($PSItem.Exception.Message)"
                        }
                    }
                }
            }
            # Inject the Invoke-PSRemotely function, based on whether the environment config data was specified or not.
            Invoke-Command -Session $Session -ScriptBlock {
                $null = New-Item -Path Function:\ -Name Invoke-PSRemotely -Value $Using:ScriptBlock -Force
                $null = Set-Location -Path $PSRemotely.PSRemotelyNodePath -ErrorAction SilentlyContinue
            }

            if ($PassThru.IsPresent) {
                Write-Output -InputObject $Session
            }
            else {

                # Enter the PSSession interactively
                Enter-PSSession -Session $Session
            }
        }

    }
}


text:
var Circle, PI, Point, Rect, abs, atan2, ceil, cos, fuzzyEqual, hypot, isNumber, max, min, round, roundTo, sin, sqrt, square, util;

sin = Math.sin, cos = Math.cos, atan2 = Math.atan2, sqrt = Math.sqrt, abs = Math.abs, max = Math.max, min = Math.min, PI = Math.PI, round = Math.round, ceil = Math.ceil;

Rect = require('./Rect');

util = require('./utilities');

isNumber = util.isNumber, fuzzyEqual = util.fuzzyEqual, hypot = util.hypot, roundTo = util.roundTo, square = util.square;

Point = require('./Point2d');

Circle = (function() {
  var defProp;

  defProp = util.defProp.bind(Circle);

  function Circle(center, radius) {
    this.radius = radius != null ? radius : 1;
    this.center = Point["new"](center);
  }

  Circle.prototype.pointAt = function(angle) {
    return new Point(this.center.x + this.radius * angle.cos, this.center.y + this.radius * angle.sin);
  };

  Circle.prototype.svgString = function() {
    return "M " + this.center + "\nm -" + this.radius + ", 0\na " + this.radius + "," + this.radius + " 0 1,0 " + (this.radius * 2) + ",0\na " + this.radius + "," + this.radius + " 0 1,0 -" + (this.radius * 2) + ",0";
  };

  Circle.prototype.envelope = function(offset) {
    if (offset == null) {
      offset = 0;
    }
    return Rect(this.center.x - this.radius - offset, this.center.y - this.radius - offset, this.center.x + this.radius + offset, this.center.y + this.radius + offset);
  };

  return Circle;

})();

module.exports = Circle;


text:
package org.spongepowered.common.command.parameter.managed.standard;

import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.spongepowered.api.ResourceKey;
import org.spongepowered.api.command.CommandCause;
import org.spongepowered.api.command.CommandCompletion;
import org.spongepowered.api.command.exception.ArgumentParseException;
import org.spongepowered.api.command.parameter.ArgumentReader;
import org.spongepowered.common.command.brigadier.argument.ResourceKeyedArgumentValueParser;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeParseException;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

public final class SpongeDateTimeValueParameter extends ResourceKeyedArgumentValueParser<LocalDateTime> {

    public SpongeDateTimeValueParameter(final ResourceKey key) {
        super(key);
    }

    @Override
    public List<CommandCompletion> complete(final @NonNull CommandCause context, final @NonNull String currentInput) {
        return Collections.emptyList();
    }

    @Override
    public @NonNull Optional<? extends LocalDateTime> parseValue(
            final @NonNull CommandCause cause, final ArgumentReader.@NonNull Mutable reader) throws ArgumentParseException {
        final String date = reader.parseString();
        try {
            return Optional.of(LocalDateTime.parse(date));
        } catch (final DateTimeParseException ex) {
            try {
                return Optional.of(LocalDateTime.of(LocalDate.now(), LocalTime.parse(date)));
            } catch (final DateTimeParseException ex2) {
                try {
                    return Optional.of(LocalDateTime.of(LocalDate.parse(date), LocalTime.MIDNIGHT));
                } catch (final DateTimeParseException ex3) {
                    throw reader.createException(Component.text("Invalid date-time!"));
                }
            }
        }
    }
}


text:
<!DOCTYPE html>

        <meta charset="utf-8" />
        <title>style.js demo :)</title>
        <link href="css/demo.css" media="all" rel="stylesheet" type="text/css" />

GitHub URL : https://github.com/dhilipsiva/style.js

Blog URL : http://dhilipsiva.com/2014/05/11/style-js.html

style.js demo :)

Now, its possible for non-techies to make css changes and send the desired values.

How cool is that?

Add any css property and its appropriate input-type to the config.


text:
    // Ask almond to synchronously require the module value for 'main' here and
    // return it as the value to use for the public API for the built file.
    return require('main');
}));


text:
<?PHP
// sybase database abstraction file for phorum (based on mysql file)

if ( !defined( "_DB_LAYER" ) ){
  define("_DB_LAYER", 1 );

class db {

  var $connect_id;
  var $type;

  function db($database_type="sybase") {
    $this->type=$database_type;
  }

  function open($database, $host, $user, $password) {
    $this->connect_id=sybase_pconnect($host, $user, $password);
    if ($this->connect_id) {
      $result=@sybase_select_db($database);
      if (!$result) {
        $this->connect_id=$result;
      }
      return $this->connect_id;
    }
    else{
      return 0;
    }
  }

  function drop_sequence($sequence){
    $esequence=$sequence."_seq";
    $sSQL="DROP TABLE $esequence";
    $query=new query($this, $sSQL);
    return $query->error();
  }

  function reset_sequence($sequence, $newval){
    $this->nextid($sequence);
    $esequence=$sequence."_seq";
    $sSQL="UPDATE $esequence SET nextval=$newval";
    $query=new query($this, $sSQL);
    return $query->error();
  }

  function nextid($sequence) {
    $esequence=ereg_replace("'","''",$sequence)."_seq";
    $query=new query($this, "BEGIN TRANSACTION");
    $query->query($this, "UPDATE $esequence SET nextval=nextval+1");
    if ($query->result) {
    	$query->query($this, "SELECT * from $esequence");
	$result=$query->field("nextval", 1);
	$query->query($this, "COMMIT TRANSACTION");
    } else {
      // sybase can't create tables within a transaction....
      $query->query($this, "COMMIT TRANSACTION");
      $query->query($this, "CREATE TABLE $esequence (nextval int)");
      $query->query($this, "INSERT INTO $esequence (nextval) VALUES(1)");
      $result=1;
    }
    return $result;
  }

  function close() {
  // frees any query results left. (does not close persistant db conn.)
    $query=new query($this, "commit");
    if ($this->query_id && is_array($this->query_id)) {
       while (list($key,$val)=each($this->query_id)) {
         @sybase_free_result($val);
      }
    }
    return 0;
  }

  function addquery($query_id) {
  // Function used by the constructor of query. Notifies the
  // this object of the existance of a query_result for later cleanup
  // internal function, don't use it yourself.

    $this->query_id[]=$query_id;
  }

};

/************************************** QUERY ***************************/

class query {

  var $result;
  var $row;
  var $querystring;
  var $was_error;

  function query(&$db, $query="") {
    $this->was_error=0;
    $this->querystring=$query;
    if(0) { // SQL trace
      $fh=fopen("/usr/local/apache/htdocs/phorum/db/db.txt","a");
      fwrite($fh,$query."\n");
      fclose($fh);
    }
    if($this->result=@sybase_query($query, $db->connect_id)) {
      $db->addquery($this->result);
    } else $this->was_error=1;
  }

  function getrow() {
    $this->was_error=0;
    if(!$this->row=@sybase_fetch_array($this->result)) $this->was_error=1;
    return $this->row;
  }

  function numrows() {
    $result=@sybase_num_rows($this->result);
    return $result;
  }

  function error() {
    if($this->was_error)
      $result="Oops! something went wrong somewhere whilst running this query: $this->querystring";
    else
      $result=0;
    return $result;
  }

  function field($field, $row="-1") {
  // get the value of the field with name $field
  // in the current row or in row $row if supplied

    if($row!=-1){
      $result=@sybase_result($this->result, $row-1, $field);
    }
    else{
      $result=$this->row[$field];
    }

    if(isset($result)){
      return $result;
    }
    else{
      return '0';
    }
  }

  function firstrow() {
    $result=@sybase_data_seek($this->result,0);
    if($result){
      $result=$this->getrow();
      return $this->row;
    }
    else{
      return 0;
    }
  }

  function seek($seek_row) {
    @sybase_data_seek($this->result,$seek_row);
  }

  function free() {
    return @sybase_free_result($this->result);
  }

}; // End class

function create_table(&$DB, $table, $table_name){
    GLOBAL $q;
    if($table=="main"){

    // numeric fields reduced to int- php always displays numerics as n.0
    // which stops article threading working  properly....
    $sSQL="CREATE TABLE $table_name (
	id int DEFAULT 0 NOT NULL PRIMARY KEY,
	datestamp varchar(19) DEFAULT '0000-00-00 00:00:00' NOT NULL,
	thread int DEFAULT 0 NOT NULL,
	parent int DEFAULT 0 NOT NULL,
	author varchar(37) DEFAULT '' NOT NULL,
	subject varchar(255) DEFAULT '' NOT NULL,
	email varchar(200) DEFAULT '' NOT NULL,
	attachment varchar(64) DEFAULT '' NOT NULL,
	host varchar(50) DEFAULT '' NOT NULL,
	email_reply char(1) DEFAULT 'N' NOT NULL,
	approved char(1) DEFAULT 'N' NOT NULL,
	msgid char(100) DEFAULT '' NOT NULL)";

    $q->query($DB, $sSQL);
    if(!$q->error()){
      $sSQL="CREATE INDEX ".$table_name."_author on $table_name(author)";
      $q->query($DB, $sSQL);
      $sSQL="CREATE INDEX ".$table_name."_datestamp on $table_name(datestamp)";
      $q->query($DB, $sSQL);
      $sSQL="CREATE INDEX ".$table_name."_subject on $table_name(subject)";
      $q->query($DB, $sSQL);
      $sSQL="CREATE INDEX ".$table_name."_thread on $table_name(thread)";
      $q->query($DB, $sSQL);
      $sSQL="CREATE INDEX ".$table_name."_parent on $table_name(parent)";
      $q->query($DB, $sSQL);
      $sSQL="CREATE INDEX ".$table_name."_approved on $table_name(approved)";
      $q->query($DB, $sSQL);
      $sSQL="CREATE INDEX ".$table_name."_msgid on $table_name(msgid)";
      $q->query($DB, $sSQL);

      $sSQL="CREATE TABLE ".$table_name."_bodies (
        id int DEFAULT 0 NOT NULL PRIMARY KEY,
        body text DEFAULT '' NOT NULL,
        thread int DEFAULT '0' NOT NULL)";

        $q->query($DB, $sSQL);
        if(!$q->error()){
          $sSQL="CREATE INDEX ".$table_name."_bodies_thread on ".$table_name."_bodies(thread)";
          $q->query($DB, $sSQL);
          return "";
	} else {
          $errormsg = $q->error();
          $sSQL="DROP TABLE ".$table_name;
          $q->query($DB, $sSQL);
          return $errormsg;
        }
      } else {
        return $q->error();
      }
    }
    elseif($table=="forums"){
      $sSQL="CREATE TABLE ".$table_name." (
        id int DEFAULT 0 NOT NULL PRIMARY KEY,
        name varchar(50) DEFAULT '' NOT NULL,
        active smallint DEFAULT 0 NOT NULL,
        description varchar(255) DEFAULT '' NOT NULL,
        config_suffix varchar(50) DEFAULT '' NOT NULL,
        folder tinyint DEFAULT 0 NOT NULL,
        parent int DEFAULT 0 NOT NULL,
        display int DEFAULT 0 NOT NULL,
        table_name varchar(50) DEFAULT '' NOT NULL,
        moderation char(1) DEFAULT 'n' NOT NULL,
        mod_email varchar(50) DEFAULT '' NOT NULL,
        mod_pass varchar(50) DEFAULT '' NOT NULL,
        email_list varchar(50) DEFAULT '' NOT NULL,
        email_return varchar(50) DEFAULT '' NOT NULL,
        email_tag varchar(50) DEFAULT '' NOT NULL,
        check_dup smallint DEFAULT 0 NOT NULL,
        multi_level smallint DEFAULT 0 NOT NULL,
        collapse smallint DEFAULT 0 NOT NULL,
        flat smallint DEFAULT 0 NOT NULL,
        staff_host varchar(50) DEFAULT '' NOT NULL,
        lang varchar(50) DEFAULT '' NOT NULL,
        html varchar(40) DEFAULT 'N' NOT NULL,
        table_width varchar(4) DEFAULT '' NOT NULL,
        table_header_color varchar(7) DEFAULT '' NOT NULL,
	table_header_font_color varchar(7) DEFAULT '' NOT NULL,
        table_body_color_1 varchar(7) DEFAULT '' NOT NULL,
        table_body_color_2 char(7) DEFAULT '' NOT NULL,
        table_body_font_color_1 varchar(7) DEFAULT '' NOT NULL,
        table_body_font_color_2 varchar(7) DEFAULT '' NOT NULL,
        nav_color varchar(7) DEFAULT '' NOT NULL,
        nav_font_color varchar(7) DEFAULT '' NOT NULL,
	allow_uploads char(1) DEFAULT 'N' NOT NULL
	)";

      $q->query($DB, $sSQL);
      if(!$q->error()) {
        $sSQL="CREATE INDEX ".$table_name."_parent on ".$table_name."(parent)";
        $q->query($DB, $sSQL);
        $sSQL="CREATE INDEX ".$table_name."_name on ".$table_name."(name)";
        $q->query($DB, $sSQL);
        $sSQL="CREATE INDEX ".$table_name."_active on ".$table_name."(active)";
        $q->query($DB, $sSQL);
      } else {
        return $q->error();
    }
  }
}

} // end if_defined

?>


text:
// -----------------------------------------------------------------------------
// Name: /public/js/game/components/actor/character/camera.js
// Author: Adam Barreiro
// Description: Manages the camera.
// -----------------------------------------------------------------------------

/**
 * camera.js
 * @dependency /public/js/game/constants.js
 */
define (["../../../constants"], function(Constants) {

// -----------------------------------------------------------------------------
// Private
// -----------------------------------------------------------------------------

// -----------------------------------------------------------------------------
// Public
// -----------------------------------------------------------------------------

return {
    /**
     * Creates the component.
     */
    createComponent: function() {
        Crafty.c('Camera', {
            _cameraOldX: undefined,
            /**
             * Vertical scroll controller
             */
            verticalScroll: function() {
                Crafty.viewport.scroll('_y', -(this.y + (this.h / 2) - (Constants.getViewportSize('px').height / 2)));
            },
            /**
             * Horizontal scroll controller
             */
            horizontalScroll: function(from) {
                Crafty.viewport.scroll('_x', -(this.x + (this.w / 2) - (Crafty.viewport.width / 2)));
            },
            /**
             * Inits component
             */
            init: function() {
                this.requires("Character");
                /*this.bind("EnterFrame", function () {
                    this.verticalScroll();
                    Crafty.viewport._clamp();
                });
                this.bind('Moved', function(from) {
                    this.horizontalScroll(from);
                });*/
            }
        });
    }
};

});


text:
package org.apache.camel.component.stream;

import java.nio.charset.Charset;

import org.apache.camel.Component;
import org.apache.camel.Consumer;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultEndpoint;
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriPath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@UriEndpoint(scheme = "stream", title = "Stream", syntax = "stream:url", consumerClass = StreamConsumer.class, label = "file,system")
public class StreamEndpoint extends DefaultEndpoint {
    private static final Logger LOG = LoggerFactory.getLogger(StreamEndpoint.class);

    @UriPath @Metadata(required = "true")
    private String url;
    @UriParam
    private String fileName;
    @UriParam
    private boolean scanStream;
    @UriParam
    private boolean retry;
    @UriParam
    private boolean closeOnDone;
    @UriParam
    private long scanStreamDelay;
    @UriParam
    private long delay;
    @UriParam
    private String encoding;
    @UriParam
    private String promptMessage;
    @UriParam
    private long promptDelay;
    @UriParam(defaultValue = "2000")
    private long initialPromptDelay = 2000;
    @UriParam
    private int groupLines;
    @UriParam
    private int autoCloseCount;
    @UriParam
    private Charset charset;
    @UriParam
    private GroupStrategy groupStrategy = new DefaultGroupStrategy();

    public StreamEndpoint(String endpointUri, Component component) throws Exception {
        super(endpointUri, component);
    }

    @Deprecated
    public StreamEndpoint(String endpointUri) {
        super(endpointUri);
    }

    public Consumer createConsumer(Processor processor) throws Exception {
        StreamConsumer answer = new StreamConsumer(this, processor, getEndpointUri());
        configureConsumer(answer);
        return answer;
    }

    public Producer createProducer() throws Exception {
        return new StreamProducer(this, getEndpointUri());
    }

    public boolean isSingleton() {
        return true;
    }

    protected Exchange createExchange(Object body, long index, boolean last) {
        Exchange exchange = createExchange();
        exchange.getIn().setBody(body);
        exchange.getIn().setHeader(StreamConstants.STREAM_INDEX, index);
        exchange.getIn().setHeader(StreamConstants.STREAM_COMPLETE, last);
        return exchange;
    }

    // Properties
    //-------------------------------------------------------------------------

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public long getDelay() {
        return delay;
    }

    public void setDelay(long delay) {
        this.delay = delay;
    }

    public String getEncoding() {
        return encoding;
    }

    public void setEncoding(String encoding) {
        this.encoding = encoding;
    }

    public String getPromptMessage() {
        return promptMessage;
    }

    public void setPromptMessage(String promptMessage) {
        this.promptMessage = promptMessage;
    }

    public long getPromptDelay() {
        return promptDelay;
    }

    public void setPromptDelay(long promptDelay) {
        this.promptDelay = promptDelay;
    }

    public long getInitialPromptDelay() {
        return initialPromptDelay;
    }

    public void setInitialPromptDelay(long initialPromptDelay) {
        this.initialPromptDelay = initialPromptDelay;
    }

    public boolean isScanStream() {
        return scanStream;
    }

    public void setScanStream(boolean scanStream) {
        this.scanStream = scanStream;
    }

    public GroupStrategy getGroupStrategy() {
        return groupStrategy;
    }

    public void setGroupStrategy(GroupStrategy strategy) {
        this.groupStrategy = strategy;
    }

    public boolean isRetry() {
        return retry;
    }

    public void setRetry(boolean retry) {
        this.retry = retry;
    }

    public boolean isCloseOnDone() {
        return closeOnDone;
    }

    public void setCloseOnDone(boolean closeOnDone) {
        this.closeOnDone = closeOnDone;
    }

    public long getScanStreamDelay() {
        return scanStreamDelay;
    }

    public void setScanStreamDelay(long scanStreamDelay) {
        this.scanStreamDelay = scanStreamDelay;
    }

    public int getGroupLines() {
        return groupLines;
    }

    public void setGroupLines(int groupLines) {
        this.groupLines = groupLines;
    }

    public int getAutoCloseCount() {
        return autoCloseCount;
    }

    public void setAutoCloseCount(int autoCloseCount) {
        this.autoCloseCount = autoCloseCount;
    }

    public Charset getCharset() {
        return charset;
    }

    // Implementations
    //-------------------------------------------------------------------------

    protected void doStart() throws Exception {
        charset = loadCharset();
    }

    Charset loadCharset() {
        if (encoding == null) {
            encoding = Charset.defaultCharset().name();
            LOG.debug("No encoding parameter using default charset: {}", encoding);
        }
        if (!Charset.isSupported(encoding)) {
            throw new IllegalArgumentException("The encoding: " + encoding + " is not supported");
        }

        return Charset.forName(encoding);
    }
}


text:
using UnityEngine;

namespace Sonosthesia
{
    public class GeneratorFloatSignal : Signal<float>
    {
        [SerializeField] private Generator<float> _generator;

        private float? _startTime;

        protected void OnEnable() => _startTime ??= Time.time;

        protected void OnDisable() => _startTime = null;

        protected void Update()
        {
            if (_startTime.HasValue)
            {
                Broadcast(_generator.Evaluate(Time.time - _startTime.Value));
            }
        }
    }
}


text:
$.fn.ITS.lang = {

	select_image: "Select an image",
	change_image: "Change image",
	delete_image: "Delete image",
	yes: "Yes",
	no: "No",
	alert_delete_text: "Are you sure you want to delete this image?"

};


text:
module.exports = {
  arrowParens: "always",
  endOfLine: "lf",
  semi: false,
  trailingComma: "all"
}


text:
local adl = require 'audiodataload._base'
local Sequenceiterator = torch.class('adl.Sequenceiterator', 'adl.BaseDataloader', adl)

local mathmax = math.max
local mathceil = math.ceil

local initcheck = argcheck{
    pack=true,
    {
        name='wrappedmodule',
        type='adl.BaseDataloader',
        help="The module to wrap around",
    },
    {
        name='seqlen',
        type='number',
        help="Sequence length of an utterance, if this value is > 1 it forces the output tensor to be Seqlen X batchsize X framesize.",
        default=1,
        -- Only allow nonzero numbers
        check = function(num)
            if num > 0 then return true end
        end
    },
    {
        name='usemaxseqlength',
        type='boolean',
        default=false,
        help='If this parameter is set, seqlen is ignored and during utterance iteration, the tensor size will be maxseqlen x batchsize x framesize. This function is useful for cases zero-padded batches are needed during evaluation.'
    },
    {
        name='padding',
        help="Left or right padding for the given utterances, left meaning we append zeros at the beginning of a sequence, right means we append at the end",
        type='string',
        default = 'left',
        check = function (padtype)
            if padtype == 'left' or padtype == 'right' then return true else return false end
        end
    },

}

function Sequenceiterator:__init(...)
    local args = initcheck(...)
    for k,v in pairs(args) do
        self[k] =v
    end
    -- Copy the wrapped modules members
    for k,v in pairs(self.wrappedmodule) do
        self[k]=v
    end
    -- Get the samplelengths
    self.wrappedmodule:size()
    -- Overwrite seqlength
    if self.usemaxseqlength then
        local maxseqlen = self.wrappedmodule.samplelengths:max()
        if maxseqlen == 0 then
            error "Given framesize is too large for the dataset"
        end
        self.seqlen = maxseqlen
    end

    -- same size as samplelengths
    local onetensor = self.wrappedmodule.samplelengths:clone():fill(1)
    -- Do for each utterance the size calculation. When we sequence any utterance, it can be said that we just remove the last self.seqlen frames from this utterance
    local numsamples = torch.add(self.wrappedmodule.samplelengths,-self.seqlen)
    -- we have always at least 1 one seqence for each utterance
    numsamples = torch.cmax(onetensor,numsamples)

    self._nsamples = numsamples:sum()

    -- Wave data iterator has shift, otherwise set to dimension of the wrapped module
    if not self.shift then
        self.shift = self:dim()
    end

end

-- Iterator callback functions
function Sequenceiterator:getSample(labels,  classranges, ...)
    local _input = torch.zeros(self.seqlen,labels:size(1),self:dim())
    -- The Final framesize we gonna extract
    local framewindow = self:dim()
    -- Buffer for audiosample
    local sample
    -- Starting frame
    local framestart = 1
    -- ending frame, maximum is the full seqence
    local frameend = -1
    -- Get the current datalabel
    local curlabel

    for i=1,labels:size(1) do
        -- Parameter shift is hijacked from the wrapped module
        framestart = (classranges[i] - 1) * self.shift  + 1
        frameend = framestart+(self.seqlen*framewindow) - 1
        sample = self.wrappedmodule:loadAudioUtterance(labels[i],true)
        sample = sample:view(sample:nElement())
        if sample:size(1) < frameend then
            local zerotensor = torch.zeros(frameend)
            -- Apply padding from left or right
            if self.padding == 'left' then
                zerotensor[{{frameend-sample:size(1)+1,frameend}}]:copy(sample)
            else
                zerotensor[{{1,sample:size(1)}}]:copy(sample)
            end
            _input[{{},i}]:copy(zerotensor)
        else
            _input[{{},i}]:copy(sample[{{framestart,frameend}}])
        end
    end
    return _input
end

function Sequenceiterator:loadAudioUtterance(audiofilepaths,...)
    local audiofeat
    -- Final size of the output utterance
    local targetsize = self:dim() * self.seqlen
    local framewindow = self:dim()
    local buf = torch.zeros(self.seqlen,audiofilepaths:size(1),self:dim())
    for i=1,audiofilepaths:size(1) do
        audiofeat = self.wrappedmodule:loadAudioUtterance(audiofilepaths[i],true)
        local origaudiosize = audiofeat:nElement()
        -- The maximum size of fitting utterances so that no sequence will be mixed with nonzeros and zeros
        local modaudiosize = floor(origaudiosize/framewindow) * framewindow
        -- Try to fit only the seqlen utterances in a whole in
        modaudiosize = floor(modaudiosize/self.seqlen) * self.seqlen
        -- If we have more elements as target than in the utterance, we pad. Otherwise no padding is needed , but we truncate the loaded utterance
        if targetsize > modaudiosize then
            local seqtargetsize = floor(targetsize / framewindow)
            local seqmodaudiosize = floor(modaudiosize / framewindow)
            if self.padding == 'left' then
                buf[{{seqtargetsize-seqmodaudiosize + 1,seqtargetsize},{i}}]:copy(audiofeat:view(origaudiosize):sub(1,seqmodaudiosize* framewindow))
            else
                buf[{{1,seqmodaudiosize},{i}}]:copy(audiofeat:view(origaudiosize):sub(1,seqmodaudiosize*framewindow))
            end
        else
            buf[{{},{i}}]:copy(audiofeat:view(origaudiosize):sub(1,targetsize))
        end
    end

    return buf
end

function Sequenceiterator:sampletofeat(samplelengths)
    local runningindex = 0
    local numsamples = 0
    local sampletofeatid,sampletoclassrange = torch.LongTensor(self:size()),torch.LongTensor(self:size())
    local acc = 0
    for i=1,samplelengths:size(1) do
        -- use at least one sample ( zero pad it later)
        numsamples = mathmax(1,samplelengths[i] - self.seqlen)
        acc = acc + numsamples
        -- -- Fill in the target for each sample
        sampletofeatid[{{runningindex + 1, runningindex + numsamples}}]:fill(i)
        -- Fill in the internal range for each sample
        sampletoclassrange[{{runningindex + 1, runningindex + numsamples}}]:range(1,numsamples)

        runningindex = runningindex + numsamples
    end

    return sampletofeatid, sampletoclassrange
end

function Sequenceiterator:getNumAudioSamples(filename)
    return self.wrappedmodule:getNumAudioSamples(filename)
end

-- Number of utterances in the dataset
-- Just wrap it around the moduel
function Sequenceiterator:usize()
    return self.wrappedmodule:usize()
end

-- Returns the sample size of the dataset
function Sequenceiterator:size()
    return self._nsamples
end

-- Returns the data dimensions
function Sequenceiterator:dim()
    return self.wrappedmodule:dim()
end

function Sequenceiterator:nClasses()
    return self.wrappedmodule:nClasses()
end


text:
<?php
include "partials/header.php";
require_once "conf.php";
require_once "auth.php";

if (empty($_POST)) {
    echo "
Delete

    <form action='" . $_SERVER['PHP_SELF'] . "' method='post' accept-charset='utf-8'>

                <input class='input' type='text' name='short' placeholder='short url, e.g. me'>

                <input class='input' type='password' name='secret' placeholder='authorization code'>

            <button class='button is-medium is-primary' type='submit'>
                Delete
            </button>
  	</form>";
} else {
    try {
        if (empty($_POST["secret"]) || !Auth::isValidSecret($_POST["secret"])) {
            die ("Not authorized.");
        }
        if (empty($_POST["short"])) {
            die("No url to delete");
        }
        $shortUrl = $_POST["short"];
        require_once "db.php";
        $pdo = Database::connect();
        $stmt = $pdo->prepare("Delete from " . Conf::$dbTable . " where short = ?");
        $ret = $stmt->execute(array($shortUrl));
        Database::disconnect();
        if ($ret) {
            echo "Done!";
        }
        include "partials/footer.php";
    } catch (PDOException $e) {
        print 'Exception : ' . $e->getMessage();
    }
}
?>


text:
<?php

namespace Coyote\Services\Elasticsearch\Filters\Job;

use Coyote\Services\Elasticsearch\DslInterface;
use Coyote\Services\Elasticsearch\Filter;
use Coyote\Services\Elasticsearch\QueryBuilderInterface;
use Coyote\Services\Parser\Helpers;
use Illuminate\Support\Str;

class City extends Filter implements DslInterface
{
    /**
     * @var array
     */
    protected $cities = [];

    /**
     * City constructor.
     * @param $cities
     */
    public function __construct($cities = [])
    {
        $this->setCities($cities);
    }

    /**
     * @param $city
     */
    public function addCity($city)
    {
        if (is_array($city)) {
            foreach ($city as $value) {
                $this->addCity($value);
            }
        } else {
            $city = (new Helpers\City())->grab($city);
            $this->cities = array_merge($this->cities, $city);
        }
    }

    /**
     * @param $cities
     */
    public function setCities($cities)
    {
        if (!is_array($cities)) {
            $cities = [$cities];
        }

        $this->cities = $cities;
    }

    /**
     * @return array
     */
    public function getCities()
    {
        return $this->cities;
    }

    /**
     * @param QueryBuilderInterface $queryBuilder
     * @return mixed
     */
    public function apply(QueryBuilderInterface $queryBuilder)
    {
        if (empty($this->cities)) {
            return (object) [];
        }

        return [
            'nested' => [
                'path' => 'locations',
                'query' => [
                    'match' => [
                        'locations.label' => implode(' ', $this->cities)
                    ]
                ]
            ]
        ];
    }
}


text:
package org.majimena.petical.web.servlet.handler;

import cz.jirutka.spring.exhandler.messages.ErrorMessage;
import cz.jirutka.spring.exhandler.messages.ValidationErrorMessage;
import org.majimena.petical.common.exceptions.ApplicationException;
import org.majimena.petical.domain.errors.ErrorCode;
import org.springframework.context.MessageSource;
import org.springframework.http.HttpStatus;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by todoken on 2015/07/15.
 */
public class ApplicationExceptionRestExceptionHandler extends AbstractCustomRestExceptionHandler<ApplicationException> {

    public ApplicationExceptionRestExceptionHandler(MessageSource messageSource) {
        super(ApplicationException.class, HttpStatus.BAD_REQUEST);
        setMessageSource(messageSource);
    }

    @Override
    public ErrorMessage createBody(ApplicationException ex, HttpServletRequest req) {
        ErrorMessage original = super.createBody(ex, req);
        ValidationErrorMessage message = new ValidationErrorMessage(original);

        ErrorCode code = ex.getErrorCode();
        message.addError(getMessage(code.name(), req.getLocale()));

        return message;
    }
}


text:
namespace content {

GURL GetDevToolsPathAsURL();

class RenderViewHost;
class Shell;
class WebContents;

class ShellDevToolsFrontend : public WebContentsObserver,
                              public DevToolsFrontendHostDelegate {
 public:
  static ShellDevToolsFrontend* Show(WebContents* inspected_contents);
  void Activate();
  void Focus();
  void Close();

  Shell* frontend_shell() const { return frontend_shell_; }

 private:
  ShellDevToolsFrontend(Shell* frontend_shell, DevToolsAgentHost* agent_host);
  virtual ~ShellDevToolsFrontend();

  // WebContentsObserver overrides
  virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
  virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE;

  // DevToolsFrontendHostDelegate implementation
  virtual void DispatchOnEmbedder(const std::string& message) OVERRIDE {}

  virtual void InspectedContentsClosing() OVERRIDE;

  Shell* frontend_shell_;
  scoped_refptr<DevToolsAgentHost> agent_host_;
  scoped_ptr<DevToolsClientHost> frontend_host_;

  DISALLOW_COPY_AND_ASSIGN(ShellDevToolsFrontend);
};

}  // namespace content

#endif  // CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_


text:
package org.springframework.cglib.core;

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.springframework.asm.Attribute;
import org.springframework.asm.Type;

/**
 * @version $Id: ReflectUtils.java,v 1.30 2009/01/11 19:47:49 herbyderby Exp $
 */
public class ReflectUtils {
    private ReflectUtils() { }

    private static final Map primitives = new HashMap(8);
    private static final Map transforms = new HashMap(8);
    private static final ClassLoader defaultLoader = ReflectUtils.class.getClassLoader();
    private static Method DEFINE_CLASS;
    private static final ProtectionDomain PROTECTION_DOMAIN;

    private static final List<Method> OBJECT_METHODS = new ArrayList<Method>();

    static {
        PROTECTION_DOMAIN = getProtectionDomain(ReflectUtils.class);

        AccessController.doPrivileged(new PrivilegedAction() {
            public Object run() {
                try {
                    Class loader = Class.forName("java.lang.ClassLoader"); // JVM crash w/o this
                    DEFINE_CLASS = loader.getDeclaredMethod("defineClass",
                                                            new Class[]{ String.class,
                                                                         byte[].class,
                                                                         Integer.TYPE,
                                                                         Integer.TYPE,
                                                                         ProtectionDomain.class });
                    DEFINE_CLASS.setAccessible(true);
                } catch (ClassNotFoundException e) {
                    throw new CodeGenerationException(e);
                } catch (NoSuchMethodException e) {
                    throw new CodeGenerationException(e);
                }
                return null;
            }
        });
        Method[] methods = Object.class.getDeclaredMethods();
        for (Method method : methods) {
            if ("finalize".equals(method.getName())
                    || (method.getModifiers() & (Modifier.FINAL | Modifier.STATIC)) > 0) {
                continue;
            }
            OBJECT_METHODS.add(method);
        }
    }

    private static final String[] CGLIB_PACKAGES = {
        "java.lang",
    };

    static {
        primitives.put("byte", Byte.TYPE);
        primitives.put("char", Character.TYPE);
        primitives.put("double", Double.TYPE);
        primitives.put("float", Float.TYPE);
        primitives.put("int", Integer.TYPE);
        primitives.put("long", Long.TYPE);
        primitives.put("short", Short.TYPE);
        primitives.put("boolean", Boolean.TYPE);

        transforms.put("byte", "B");
        transforms.put("char", "C");
        transforms.put("double", "D");
        transforms.put("float", "F");
        transforms.put("int", "I");
        transforms.put("long", "J");
        transforms.put("short", "S");
        transforms.put("boolean", "Z");
    }

    public static ProtectionDomain getProtectionDomain(final Class source) {
    	if(source == null) {
    		return null;
    	}
        return (ProtectionDomain)AccessController.doPrivileged(new PrivilegedAction() {
            public Object run() {
                return source.getProtectionDomain();
            }
        });
    }

    public static Type[] getExceptionTypes(Member member) {
        if (member instanceof Method) {
            return TypeUtils.getTypes(((Method)member).getExceptionTypes());
        } else if (member instanceof Constructor) {
            return TypeUtils.getTypes(((Constructor)member).getExceptionTypes());
        } else {
            throw new IllegalArgumentException("Cannot get exception types of a field");
        }
    }

    public static Signature getSignature(Member member) {
        if (member instanceof Method) {
            return new Signature(member.getName(), Type.getMethodDescriptor((Method)member));
        } else if (member instanceof Constructor) {
            Type[] types = TypeUtils.getTypes(((Constructor)member).getParameterTypes());
            return new Signature(Constants.CONSTRUCTOR_NAME,
                                 Type.getMethodDescriptor(Type.VOID_TYPE, types));

        } else {
            throw new IllegalArgumentException("Cannot get signature of a field");
        }
    }

    public static Constructor findConstructor(String desc) {
        return findConstructor(desc, defaultLoader);
    }

    public static Constructor findConstructor(String desc, ClassLoader loader) {
        try {
            int lparen = desc.indexOf('(');
            String className = desc.substring(0, lparen).trim();
            return getClass(className, loader).getConstructor(parseTypes(desc, loader));
        } catch (ClassNotFoundException e) {
            throw new CodeGenerationException(e);
        } catch (NoSuchMethodException e) {
            throw new CodeGenerationException(e);
        }
    }

    public static Method findMethod(String desc) {
        return findMethod(desc, defaultLoader);
    }

    public static Method findMethod(String desc, ClassLoader loader) {
        try {
            int lparen = desc.indexOf('(');
            int dot = desc.lastIndexOf('.', lparen);
            String className = desc.substring(0, dot).trim();
            String methodName = desc.substring(dot + 1, lparen).trim();
            return getClass(className, loader).getDeclaredMethod(methodName, parseTypes(desc, loader));
        } catch (ClassNotFoundException e) {
            throw new CodeGenerationException(e);
        } catch (NoSuchMethodException e) {
            throw new CodeGenerationException(e);
        }
    }

    private static Class[] parseTypes(String desc, ClassLoader loader) throws ClassNotFoundException {
        int lparen = desc.indexOf('(');
        int rparen = desc.indexOf(')', lparen);
        List params = new ArrayList();
        int start = lparen + 1;
        for (;;) {
            int comma = desc.indexOf(',', start);
            if (comma < 0) {
                break;
            }
            params.add(desc.substring(start, comma).trim());
            start = comma + 1;
        }
        if (start < rparen) {
            params.add(desc.substring(start, rparen).trim());
        }
        Class[] types = new Class[params.size()];
        for (int i = 0; i < types.length; i++) {
            types[i] = getClass((String)params.get(i), loader);
        }
        return types;
    }

    private static Class getClass(String className, ClassLoader loader) throws ClassNotFoundException {
        return getClass(className, loader, CGLIB_PACKAGES);
    }

    private static Class getClass(String className, ClassLoader loader, String[] packages) throws ClassNotFoundException {
        String save = className;
        int dimensions = 0;
        int index = 0;
        while ((index = className.indexOf("[]", index) + 1) > 0) {
            dimensions++;
        }
        StringBuffer brackets = new StringBuffer(className.length() - dimensions);
        for (int i = 0; i < dimensions; i++) {
            brackets.append('[');
        }
        className = className.substring(0, className.length() - 2 * dimensions);

        String prefix = (dimensions > 0) ? brackets + "L" : "";
        String suffix = (dimensions > 0) ? ";" : "";
        try {
            return Class.forName(prefix + className + suffix, false, loader);
        } catch (ClassNotFoundException ignore) { }
        for (int i = 0; i < packages.length; i++) {
            try {
                return Class.forName(prefix + packages[i] + '.' + className + suffix, false, loader);
            } catch (ClassNotFoundException ignore) { }
        }
        if (dimensions == 0) {
            Class c = (Class)primitives.get(className);
            if (c != null) {
                return c;
            }
        } else {
            String transform = (String)transforms.get(className);
            if (transform != null) {
                try {
                    return Class.forName(brackets + transform, false, loader);
                } catch (ClassNotFoundException ignore) { }
            }
        }
        throw new ClassNotFoundException(save);
    }

    public static Object newInstance(Class type) {
        return newInstance(type, Constants.EMPTY_CLASS_ARRAY, null);
    }

    public static Object newInstance(Class type, Class[] parameterTypes, Object[] args) {
        return newInstance(getConstructor(type, parameterTypes), args);
    }

    public static Object newInstance(final Constructor cstruct, final Object[] args) {

        boolean flag = cstruct.isAccessible();
        try {
            cstruct.setAccessible(true);
            Object result = cstruct.newInstance(args);
            return result;
        } catch (InstantiationException e) {
            throw new CodeGenerationException(e);
        } catch (IllegalAccessException e) {
            throw new CodeGenerationException(e);
        } catch (InvocationTargetException e) {
            throw new CodeGenerationException(e.getTargetException());
        } finally {
            cstruct.setAccessible(flag);
        }

    }

    public static Constructor getConstructor(Class type, Class[] parameterTypes) {
        try {
            Constructor constructor = type.getDeclaredConstructor(parameterTypes);
            constructor.setAccessible(true);
            return constructor;
        } catch (NoSuchMethodException e) {
            throw new CodeGenerationException(e);
        }
    }

    public static String[] getNames(Class[] classes)
    {
        if (classes == null)
            return null;
        String[] names = new String[classes.length];
        for (int i = 0; i < names.length; i++) {
            names[i] = classes[i].getName();
        }
        return names;
    }

    public static Class[] getClasses(Object[] objects) {
        Class[] classes = new Class[objects.length];
        for (int i = 0; i < objects.length; i++) {
            classes[i] = objects[i].getClass();
        }
        return classes;
    }

    public static Method findNewInstance(Class iface) {
        Method m = findInterfaceMethod(iface);
        if (!m.getName().equals("newInstance")) {
            throw new IllegalArgumentException(iface + " missing newInstance method");
        }
        return m;
    }

    public static Method[] getPropertyMethods(PropertyDescriptor[] properties, boolean read, boolean write) {
        Set methods = new HashSet();
        for (int i = 0; i < properties.length; i++) {
            PropertyDescriptor pd = properties[i];
            if (read) {
                methods.add(pd.getReadMethod());
            }
            if (write) {
                methods.add(pd.getWriteMethod());
            }
        }
        methods.remove(null);
        return (Method[])methods.toArray(new Method[methods.size()]);
    }

    public static PropertyDescriptor[] getBeanProperties(Class type) {
        return getPropertiesHelper(type, true, true);
    }

    public static PropertyDescriptor[] getBeanGetters(Class type) {
        return getPropertiesHelper(type, true, false);
    }

    public static PropertyDescriptor[] getBeanSetters(Class type) {
        return getPropertiesHelper(type, false, true);
    }

    private static PropertyDescriptor[] getPropertiesHelper(Class type, boolean read, boolean write) {
        try {
            BeanInfo info = Introspector.getBeanInfo(type, Object.class);
            PropertyDescriptor[] all = info.getPropertyDescriptors();
            if (read && write) {
                return all;
            }
            List properties = new ArrayList(all.length);
            for (int i = 0; i < all.length; i++) {
                PropertyDescriptor pd = all[i];
                if ((read && pd.getReadMethod() != null) ||
                    (write && pd.getWriteMethod() != null)) {
                    properties.add(pd);
                }
            }
            return (PropertyDescriptor[])properties.toArray(new PropertyDescriptor[properties.size()]);
        } catch (IntrospectionException e) {
            throw new CodeGenerationException(e);
        }
    }

    public static Method findDeclaredMethod(final Class type,
                                            final String methodName, final Class[] parameterTypes)
    throws NoSuchMethodException {

        Class cl = type;
        while (cl != null) {
            try {
                return cl.getDeclaredMethod(methodName, parameterTypes);
            } catch (NoSuchMethodException e) {
                cl = cl.getSuperclass();
            }
        }
        throw new NoSuchMethodException(methodName);

    }

    public static List addAllMethods(final Class type, final List list) {

        if (type == Object.class) {
            list.addAll(OBJECT_METHODS);
        } else
            list.addAll(java.util.Arrays.asList(type.getDeclaredMethods()));

        Class superclass = type.getSuperclass();
        if (superclass != null) {
            addAllMethods(superclass, list);
        }
        Class[] interfaces = type.getInterfaces();
        for (int i = 0; i < interfaces.length; i++) {
            addAllMethods(interfaces[i], list);
        }

        return list;
    }

    public static List addAllInterfaces(Class type, List list) {
        Class superclass = type.getSuperclass();
        if (superclass != null) {
            list.addAll(Arrays.asList(type.getInterfaces()));
            addAllInterfaces(superclass, list);
        }
        return list;
    }

    public static Method findInterfaceMethod(Class iface) {
        if (!iface.isInterface()) {
            throw new IllegalArgumentException(iface + " is not an interface");
        }
        Method[] methods = iface.getDeclaredMethods();
        if (methods.length != 1) {
            throw new IllegalArgumentException("expecting exactly 1 method in " + iface);
        }
        return methods[0];
    }

    public static Class defineClass(String className, byte[] b, ClassLoader loader) throws Exception {
        return defineClass(className, b, loader, PROTECTION_DOMAIN);
    }

    public static Class defineClass(String className, byte[] b, ClassLoader loader, ProtectionDomain protectionDomain) throws Exception {
        Object[] args = new Object[]{className, b, new Integer(0), new Integer(b.length), protectionDomain };
        Class c = (Class)DEFINE_CLASS.invoke(loader, args);
        // Force static initializers to run.
        Class.forName(className, true, loader);
        return c;
    }

    public static int findPackageProtected(Class[] classes) {
        for (int i = 0; i < classes.length; i++) {
            if (!Modifier.isPublic(classes[i].getModifiers())) {
                return i;
            }
        }
        return 0;
    }

    public static MethodInfo getMethodInfo(final Member member, final int modifiers) {
        final Signature sig = getSignature(member);
        return new MethodInfo() {
            private ClassInfo ci;
            public ClassInfo getClassInfo() {
                if (ci == null)
                    ci = ReflectUtils.getClassInfo(member.getDeclaringClass());
                return ci;
            }
            public int getModifiers() {
                return modifiers;
            }
            public Signature getSignature() {
                return sig;
            }
            public Type[] getExceptionTypes() {
                return ReflectUtils.getExceptionTypes(member);
            }
            public Attribute getAttribute() {
                return null;
            }
        };
    }

    public static MethodInfo getMethodInfo(Member member) {
        return getMethodInfo(member, member.getModifiers());
    }

    public static ClassInfo getClassInfo(final Class clazz) {
        final Type type = Type.getType(clazz);
        final Type sc = (clazz.getSuperclass() == null) ? null : Type.getType(clazz.getSuperclass());
        return new ClassInfo() {
            public Type getType() {
                return type;
            }
            public Type getSuperType() {
                return sc;
            }
            public Type[] getInterfaces() {
                return TypeUtils.getTypes(clazz.getInterfaces());
            }
            public int getModifiers() {
                return clazz.getModifiers();
            }
        };
    }

    // used by MethodInterceptorGenerated generated code
    public static Method[] findMethods(String[] namesAndDescriptors, Method[] methods)
    {
        Map map = new HashMap();
        for (int i = 0; i < methods.length; i++) {
            Method method = methods[i];
            map.put(method.getName() + Type.getMethodDescriptor(method), method);
        }
        Method[] result = new Method[namesAndDescriptors.length / 2];
        for (int i = 0; i < result.length; i++) {
            result[i] = (Method)map.get(namesAndDescriptors[i * 2] + namesAndDescriptors[i * 2 + 1]);
            if (result[i] == null) {
                // TODO: error?
            }
        }
        return result;
    }
}


text:
var Promise = require('bluebird'),
    fs      = Promise.promisifyAll(require('fs')),
    util    = require('util'),
    tar     = require('tar'),
    request = require('request'),
    zlib    = require('zlib'),
    _       = require('lodash'),
    debug   = require('debug')('configurated-sample-generator'),
    temp    = Promise.promisifyAll(require('temp')),
    path    = require('path'),
    streamToPromise = require('stream-to-promise'),
    archiver = require('archiver');

// Initializations
temp.track();

function Packer(configuration, options) {
  this.validate(options);
  this.organization = options.organization || configuration.organization;
  this.repo = options.repository || configuration.repository;
  this.branch = options.gitBranch || configuration.gitBranch;
  this.path = options.examplePath || configuration.examplePath || '.';
  this.type = options.sampleType ||  configuration.sampleType || 'noop' ;
  this.filePath = options.configurationFilePath || configuration.configurationFilePath || this.path;
  this.contextInformation = options.contextInformation;
  this.config = configuration;
}

Packer.prototype.validate = function(options) {
  if (options.examplePath) {
    if (options.examplePath.indexOf('.') === 0 ||
      options.examplePath.indexOf('/') === 0 ||
      options.examplePath.indexOf('..') > -1) {
      throw new Error("The path you have entered is invalid");
    }
  }
}

Packer.prototype.create = function() {
  debug("Calling create function");
  return this.download()
    .then(this.config.infoLoader.bind(this.cofig))
    .then(this.config.types[this.type].bind(this.config))
    .then(this.zip.bind(this))
    .finally(function() {
      temp.cleanup();
    });
};

Packer.GITHUB_URL = 'https://github.com/%s/%s/archive/%s.tar.gz';

Packer.prototype.download = function() {
  var _this = this;
  var url = util.format(Packer.GITHUB_URL, this.organization, this.repo, this.branch);

  debug("Downloading file from URL", url);

  return temp.mkdirAsync('githubdownload')
    .then(function(dirPath) {
      debug("Temp dir created", dirPath);
      var examplePath = path.join(dirPath, _this.repo + '-' + _this.branch, _this.path);
      var filePath = path.join(dirPath, _this.repo + '-' + _this.branch, _this.filePath);

      return streamToPromise(
        request(url)
          .pipe(zlib.Unzip())
          .pipe(tar.Extract({path: dirPath})))
        .then(function() {
          debug("Converted download stream to promise");
          return _.extend({
              examplePath: examplePath,
              configurationFilePath: filePath
            }, _this.contextInformation);

        });
    });
};

Packer.prototype.zip = function(context) {
  debug("Zipping file");

  var archive = archiver('zip');

  archive.bulk([
    { expand: true, cwd: context.examplePath, src: ['**'], dot: true }
  ]);

  archive.finalize();

  return streamToPromise(archive)
    .then(function(data) {
      debug("Zip created");
      return data;
    });
};

module.exports = Packer;


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Codeer.Friendly.Windows;
using System.Diagnostics;
using Codeer.Friendly.Windows.Grasp;
using System.Collections.Generic;

namespace Codeer.Friendly.Dynamic.Test
{
    [TestClass]
    public class Demo
    {
        WindowsAppFriend _app;
        Process _process;

        [TestInitialize]
        public void TestInitialize()
        {
            _app = new WindowsAppFriend(Process.Start(TargetPath.TestTargetPath), "4.0");
            _process = Process.GetProcessById(_app.ProcessId);
        }

        [TestCleanup]
        public void TestCleanup()
        {
            _app.Dispose();
            _process.CloseMainWindow();
        }

        [TestMethod]
        public void Old()
        {
            //フォームの取得
            AppVar form = _app["System.Windows.Forms.Control.FromHandle"](_process.MainWindowHandle);

            //テキストの変更と取得
            form["Text"]("abc");
            string text = (string)form["Text"]().Core;
            Assert.AreEqual("abc", text);

            //リストを生成して、それの操作
            AppVar list = _app.Dim(new List<int>());
            list["Add"](1);
            list["[]"](0, 100);
            int value = (int)list["[]"](0).Core;
            Assert.AreEqual(100, value);
        }

        [TestMethod]
        public void New()
        {
            //フォームの取得
            dynamic form = _app.Type().System.Windows.Forms.Control.FromHandle(_process.MainWindowHandle);

            //テキストの変更と取得
            form.Text = "abc";
            string text = form.Text;
            Assert.AreEqual("abc", text);

            //リストを生成して、それの操作
            dynamic list = _app.Copy(new List<int>());
            list.Add(1);
            list[0] = 100;
            int value = list[0];
            Assert.AreEqual(100, value);
        }
    }
}


text:
<?php

namespace Platformsh\Cli\Command\Variable;

use Platformsh\ConsoleForm\Form;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class VariableUpdateCommand extends VariableCommandBase
{
    /** @var Form */
    private $form;

    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this
            ->setName('variable:update')
            ->setDescription('Update a variable')
            ->addArgument('name', InputArgument::REQUIRED, 'The variable name');
        $this->addLevelOption();
        $fields = $this->getFields();
        unset($fields['name'], $fields['prefix'], $fields['environment'], $fields['level']);
        $this->form = Form::fromArray($fields);
        $this->form->configureInputDefinition($this->getDefinition());
        $this->addProjectOption()
            ->addEnvironmentOption()
            ->addWaitOptions();
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $level = $this->getRequestedLevel($input);
        $this->validateInput($input, $level === self::LEVEL_PROJECT);

        $name = $input->getArgument('name');
        $variable = $this->getExistingVariable($name, $level);
        if (!$variable) {
            return 1;
        }

        $values = [];
        $fields = $this->form->getFields();
        foreach ($variable->getProperties() as $property => $value) {
            if (isset($fields[$property])) {
                $newValue = $fields[$property]->getValueFromInput($input);
                if ($newValue !== null && $newValue !== $value) {
                    $values[$property] = $newValue;
                }
            }
        }

        // Handle sensitive variables' value (it isn't exposed in the API).
        if (!$variable->hasProperty('value') && $variable->is_sensitive) {
            $newValue = $fields['value']->getValueFromInput($input);
            if ($newValue !== null) {
                $values['value'] = $newValue;
            }
        }

        // Validate the is_json setting against the value.
        if ((isset($variable->value) || isset($values['value']))
            && (!empty($values['is_json']) || $variable->is_json)) {
            $value = isset($values['value']) ? $values['value'] : $variable->value;
            if (json_decode($value) === null && json_last_error()) {
                $this->stdErr->writeln('The value is not valid JSON: <error>' . $value . '</error>');

                return 1;
            }
        }

        if (!$values) {
            $this->stdErr->writeln('No changes were provided.');

            return 1;
        }

        $result = $variable->update($values);
        $this->stdErr->writeln("Variable <info>{$variable->name}</info> updated");

        $this->displayVariable($variable);

        $success = true;
        if (!$result->countActivities()) {
            $this->redeployWarning();
        } elseif ($this->shouldWait($input)) {
            /** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */
            $activityMonitor = $this->getService('activity_monitor');
            $success = $activityMonitor->waitMultiple($result->getActivities(), $this->getSelectedProject());
        }

        return $success ? 0 : 1;
    }
}


text:
package org.drools.io.impl;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.List;

import org.drools.builder.ResourceType;
import org.drools.core.util.StringUtils;
import org.drools.io.Resource;
import org.drools.io.internal.InternalResource;

public class ByteArrayResource extends BaseResource
    implements
    InternalResource {

    private byte[] bytes;

    public ByteArrayResource(byte[] bytes) {
        if ( bytes == null || bytes.length == 0 ) {
            throw new IllegalArgumentException( "bytes cannot be null" );
        }
        this.bytes = bytes;
    }

    public InputStream getInputStream() throws IOException {
        return new ByteArrayInputStream( this.bytes );
    }

    public Reader getReader() throws IOException {
        return new InputStreamReader( getInputStream() );
    }

    public boolean hasURL() {
        return false;
    }

    public URL getURL() throws IOException {
        throw new FileNotFoundException( "byte[] cannot be resolved to URL" );
    }

    public long getLastModified() {
        throw new IllegalStateException( "reader does have a modified date" );
    }

    public long getLastRead() {
        throw new IllegalStateException( "reader does have a modified date" );
    }

    public boolean isDirectory() {
        return false;
    }

    public Collection<Resource> listResources() {
        throw new RuntimeException( "This Resource cannot be listed, or is not a directory" );
    }

    public boolean equals(Object object) {
        return (object == this || (object instanceof ByteArrayResource
                && Arrays.equals( ((ByteArrayResource) object).bytes, this.bytes )));
    }

    public int hashCode() {
        return Arrays.hashCode(this.bytes);
    }

    public String toString() {
        return "[ByteArrayResource resource=" + this.bytes + "]";
    }

}


text:
// <copyright file="IAssemblyWeavingStatistics.cs" company="Cui Ziqiang">
// Copyright (c) 2017 Cui Ziqiang
// </copyright>

namespace CrossCutterN.Weaver.Statistics
{
    using System;
    using System.Collections.Generic;

    /// <summary>
    /// Assembly weaving statistics.
    /// </summary>
    public interface IAssemblyWeavingStatistics
    {
        /// <summary>
        /// Gets name of the assembly.
        /// </summary>
        string AssemblyName { get; }

        /// <summary>
        /// Gets count of weaved modules.
        /// </summary>
        int WeavedModuleCount { get; }

        /// <summary>
        /// Gets count of weaved classes.
        /// </summary>
        int WeavedClassCount { get; }

        /// <summary>
        /// Gets count of weaved methods.
        /// </summary>
        int WeavedMethodCount { get; }

        /// <summary>
        /// Gets count of weaved properties.
        /// </summary>
        int WeavedPropertyCount { get; }

        /// <summary>
        /// Gets sum of count of weaved methods and properties.
        /// </summary>
        int WeavedMethodPropertyCount { get; }

        /// <summary>
        /// Gets count of join points injected into methods.
        /// </summary>
        int MethodJoinPointCount { get; }

        /// <summary>
        /// Gets count of join points injected to property getters.
        /// </summary>
        int PropertyGetterJoinPointCount { get; }

        /// <summary>
        /// Gets count of join points injected into property setters.
        /// </summary>
        int PropertySetterJoinPointCount { get; }

        /// <summary>
        /// Gets count of join points injected to properties.
        /// </summary>
        int PropertyJoinPointCount { get; }

        /// <summary>
        /// Gets count of injected aspect switches.
        /// </summary>
        int WeavedSwitchCount { get; }

        /// <summary>
        /// Gets exception happened during weaving.
        /// </summary>
        Exception Exception { get; }

        /// <summary>
        /// Gets weaving statistics for modules inside the assembly.
        /// </summary>
        IReadOnlyCollection<IModuleWeavingStatistics> ModuleWeavingStatistics { get; }
    }
}