text:
package co.aikar;

import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;

public class FixDoubleLogins extends JavaPlugin {
    @Override
    public void onEnable() {
        super.onEnable();
        Bukkit.getServer().getPluginManager().registerEvents(new Listener() {
            public void onPlayerPrelogin(AsyncPlayerPreLoginEvent event) throws ExecutionException, InterruptedException {
                final Player player = Bukkit.getPlayer(event.getUniqueId());
                if (player != null) {
                    Bukkit.getScheduler().callSyncMethod(FixDoubleLogins.this, new Callable<Object>() {
                        public Object call() throws Exception {
                            player.kickPlayer("You logged in from another location");
                            return null;
                        }
                    }).get();
                }
            }
        }, this);
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using IoTHs.Core;
using IoTHs.Core.Channels;
using IoTHs.Devices.Interfaces;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;

namespace IoTHs.Plugin.Twilio
{
	public class TwilioSmsDevice : DeviceBase
	{
		private string _accountSid;
		private string _authToken;
		private string _outgoingPhoneNumber;
		private string _receiverPhoneNumber;

		internal TwilioSmsDevice(string accountSid, string authToken, string outgoingPhoneNumber, string receiverPhoneNumber)
		{
			_accountSid = accountSid;
			_authToken = authToken;
			_outgoingPhoneNumber = outgoingPhoneNumber;
			_receiverPhoneNumber = receiverPhoneNumber;
		}

		public async Task<bool> NotifyAsync(string messageBody)
		{
			TwilioClient.Init(_accountSid, _authToken);

			var message = await MessageResource.CreateAsync(
				to: new PhoneNumber(_receiverPhoneNumber),
				@from: new PhoneNumber(_outgoingPhoneNumber),
				body: messageBody);

			return true;
		}
	}
}


text:
from django.conf.urls import patterns, url

urlpatterns = patterns(
    'chunks.views',
    url(r'^edit/(?P<key>\w+)/$', 'edit_view', name='edit'),
)


text:
//using Skybrud.Social.Google.Scopes;
//using Skybrud.Social.Umbraco.Constants;
//using Umbraco.Web.Mvc;
//using Umbraco.Web.WebApi;

//namespace Skybrud.Social.Umbraco.Controllers.Api {

//    [PluginController(SocialConstants.PluginController)]
//    public class GoogleController : UmbracoAuthorizedApiController {

//        public object GetScopes() {
//            return Json(GoogleScopeGroup.GetAll());
//        }

//    }

//}


text:
var xhr = require('xhr')
module.exports = loginFunction

function loginFunction (cb) {
  var logInInfo = {
    'email': ' ',
    'password': ' '
  }
  var token = ''
  var uid = ''
  logInInfo.email = document.getElementById('email').value
  logInInfo.password = document.getElementById('password').value
  xhr.post('/login', {json: logInInfo}, function (err, resp) {
    if (err) {
      console.log(err)
    }
    token = resp.body.token
    uid = resp.body.userid
    window.sessionStorage.setItem('token', token)
    window.sessionStorage.setItem('userid', uid)
    if (token !== undefined && uid !== undefined) {
      cb(null, '/thoughts')
    }
  })
  return
}


text:
<script>
window.location.hash='${buspath}';
</script>


text:
ICS3U6 project

A simple ecosystem simulation built for the OOP unit.

Thanks to @AdamMc331 for helping with efficiency and style feedback. You can see his suggestions [here](https://github.com/AdamMc331/ecosim).

# Features

### All animals
 * Have gender randomly determined at birth
 * Can mate, child spawns next to parent
    * If there's no room, the child won't spawn
 * Find mates and food nearby
    * Animals do not see the whole board at once
 * Have a maximum health
 * Do not eat when full

### Sheep
 * Prioritize mating over eating nearby plants

### Wolves
 * Fight other males nearby
 * Prioritize mating over fighting over eating

### Plants
 * Live for a maximum of 10 ticks
 * Have a parabolic function to determine health

### Display
 * Layered images for animal and gender images
 * Displays number of wolves, sheep, and plants

# Documentation for constants
All constants that can be tweaked are at the beginning of EcoSim.java

The default constants are the ones found to be the most balanced

### GRID_SIZE
Integer determining the size of one side of the square world grid. 10-100 recommended

### ITERATIONS
Integer determining the number of ticks the simulation runs for

### TICK_LENGTH
Integer determining the number of milliseconds between each tick

### WORLD_FILL_DENSITY
Percentage of world to be filled at the start. Expressed as a double between 0 and 1.

### WOLF_DENSITY
Percentage of filled world to spawn as wolves. Expressed as a double between 0 and 1.

### SHEEP_DENSITY
Percentage of filled world to spawn as sheep. Expressed as a double between 0 and 1.

### GROWTH_RATE
Chance that any given empty spot will sprout a new plant any given tick. Expressed as a double between 0 and 1.

### MAX_WOLF_HEALTH
Integer determining the maximum health for a wolf

### MAX_SHEEP_HEALTH
Integer determining the maximum health for a sheep

### MIN_MATE_HEALTH_SHEEP
Integer determining minimum health for a sheep to be eligible to mate

### MIN_MATE_HEALTH_WOLF
Integer determining minimum health for a wolf to be eligible to mate

### BABY_HEALTH_SHEEP
Integer determining the health of a newly spawned baby sheep. Damage penalty to parents is also calculated from this.

### BABY_HEALTH_WOLF
Integer determining the health of a newly spawned baby wolf. Damage penalty to parents is also calculated from this.

### STRUGGLE_CHANCE
Chance a wolf will be unable to attack a stronger sheep. Expressed as a double between 0 and 1.

### EATING_HEALTH_RATIO
Double determining how much of an eaten sheep's health the wolf absorbs. It is recommended this stay well below 1.

### FIGHT_DAMAGE_LOSER
Double determining the damage multiplier dealt to a losing wolf. Multiplied by health of the winner to determine damage

### FIGHT_DAMAGE_WINNER
Double determining the damage multiplier dealt to a winning wolf. Multiplied by health of the loser to determine damage


text:
package com.bladecoder.engineeditor.ui;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.reflect.Field;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.utils.Array;
import com.bladecoder.engine.actions.AbstractControlAction;
import com.bladecoder.engine.actions.AbstractIfAction;
import com.bladecoder.engine.actions.Action;
import com.bladecoder.engine.actions.ActorAnimationRef;
import com.bladecoder.engine.actions.CommentAction;
import com.bladecoder.engine.actions.DisableActionAction;
import com.bladecoder.engine.actions.EndAction;
import com.bladecoder.engine.actions.SceneActorRef;
import com.bladecoder.engine.model.Verb;
import com.bladecoder.engine.util.ActionUtils;
import com.bladecoder.engineeditor.Ctx;
import com.bladecoder.engineeditor.common.EditorLogger;
import com.bladecoder.engineeditor.common.ElementUtils;
import com.bladecoder.engineeditor.model.Project;
import com.bladecoder.engineeditor.ui.panels.CellRenderer;
import com.bladecoder.engineeditor.ui.panels.EditModelDialog;
import com.bladecoder.engineeditor.ui.panels.ModelList;
import com.bladecoder.engineeditor.ui.panels.ScopePanel;
import com.bladecoder.engineeditor.undo.UndoDeleteAction;

public class ActionList extends ModelList<Verb, Action> {
	private static final String CONTROL_ACTION_ID_ATTR = "caID";

	Skin skin;

	private ImageButton upBtn;
	private ImageButton downBtn;

	private ImageButton disableBtn;

	private String scope;

	private final List<Action> multiClipboard = new ArrayList<Action>();

	public ActionList(Skin skin) {
		super(skin, false);
		this.skin = skin;

		setCellRenderer(listCellRenderer);

		disableBtn = new ImageButton(skin);
		toolbar.addToolBarButton(disableBtn, "ic_eye", "Enable/Disable", "Enable/Disable");

		disableBtn.setDisabled(false);

		disableBtn.addListener(new ChangeListener() {
			@Override
			public void changed(ChangeEvent event, Actor actor) {
				toggleEnabled();
			}
		});

		upBtn = new ImageButton(skin);
		downBtn = new ImageButton(skin);

		toolbar.addToolBarButton(upBtn, "ic_up", "Move up", "Move up");
		toolbar.addToolBarButton(downBtn, "ic_down", "Move down", "Move down");
		toolbar.pack();

		list.addListener(new ChangeListener() {

			@Override
			public void changed(ChangeEvent event, Actor actor) {
				int pos = list.getSelectedIndex();

				toolbar.disableEdit(pos == -1);
				disableBtn.setDisabled(pos == -1);
				upBtn.setDisabled(pos == -1 || pos == 0);
				downBtn.setDisabled(pos == -1 || pos == list.getItems().size - 1);
			}
		});

		list.getSelection().setMultiple(true);

		upBtn.addListener(new ChangeListener() {

			@Override
			public void changed(ChangeEvent event, Actor actor) {
				up();
			}
		});

		downBtn.addListener(new ChangeListener() {
			@Override
			public void changed(ChangeEvent event, Actor actor) {
				down();
			}
		});

		Ctx.project.addPropertyChangeListener(Project.NOTIFY_ELEMENT_CREATED, new PropertyChangeListener() {
			@Override
			public void propertyChange(PropertyChangeEvent evt) {
				if (evt.getNewValue() instanceof Action && !(evt.getSource() instanceof EditActionDialog)) {
					addElements(parent, parent.getActions());
				}
			}
		});
	}

	private void toggleEnabled() {

		if (list.getSelection().size() <= 0)
			return;

		Array<Action> sel = new Array<Action>();

		for (Action a : list.getSelection().toArray()) {

			// CONTROL ACTIONS CAN'T BE DISABLED
			if (a == null || isControlAction(a))
				continue;

			Array<Action> items = list.getItems();
			int pos = items.indexOf(a, true);

			if (a instanceof DisableActionAction) {
				Action a2 = ((DisableActionAction) a).getAction();
				parent.getActions().set(pos, a2);
				items.set(pos, a2);
				sel.add(a2);
			} else {
				DisableActionAction a2 = new DisableActionAction();
				a2.setAction(a);
				parent.getActions().set(pos, a2);
				items.set(pos, a2);
				sel.add(a2);
			}
		}

		Ctx.project.setModified();
		list.getSelection().clear();
		list.getSelection().addAll(sel);
	}

	@Override
	protected EditModelDialog<Verb, Action> getEditElementDialogInstance(Action e) {
		EditActionDialog editActionDialog = new EditActionDialog(skin, parent, e, scope, list.getSelectedIndex());

		return editActionDialog;
	}

	public void setScope(String scope) {
		this.scope = scope;
	}

	@Override
	protected void create() {
		EditModelDialog<Verb, Action> dialog = getEditElementDialogInstance(null);
		dialog.show(getStage());
		dialog.setListener(new ChangeListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void changed(ChangeEvent event, Actor actor) {
				int pos = list.getSelectedIndex() + 1;

				Action e = ((EditModelDialog<Verb, Action>) actor).getElement();
				list.getItems().insert(pos, e);
				parent.getActions().add(pos, e);

				list.getSelection().choose(list.getItems().get(pos));

				if (isControlAction(e)) {
					insertEndAction(pos + 1, getOrCreateControlActionId((AbstractControlAction) e));

					if (e instanceof AbstractIfAction)
						insertEndAction(pos + 2, getOrCreateControlActionId((AbstractControlAction) e));
				}

				list.invalidateHierarchy();
			}
		});
	}

	private Action editedElement;

	@Override
	protected void edit() {

		Action e = list.getSelected();

		if (e == null || e instanceof EndAction || e instanceof DisableActionAction)
			return;

		editedElement = (Action) ElementUtils.cloneElement(e);

		EditModelDialog<Verb, Action> dialog = getEditElementDialogInstance(e);
		dialog.show(getStage());
		dialog.setListener(new ChangeListener() {
			@SuppressWarnings("unchecked")
			@Override
			public void changed(ChangeEvent event, Actor actor) {
				Action e = ((EditModelDialog<Verb, Action>) actor).getElement();
				int pos = list.getSelectedIndex();
				list.getItems().set(pos, e);
				parent.getActions().set(pos, e);

				Ctx.project.setModified();

				if (isControlAction(editedElement)) {
					if (!editedElement.getClass().getName().equals(e.getClass().getName())) {

						deleteControlAction(pos, (AbstractControlAction) editedElement);

						if (isControlAction(e)) {
							insertEndAction(pos + 1,
									getOrCreateControlActionId((AbstractControlAction) e));

							if (e instanceof AbstractIfAction)
								insertEndAction(pos + 2,
										getOrCreateControlActionId((AbstractControlAction) e));
						}
					} else {
						// insert previous caId
						try {
							ActionUtils.setParam(e, CONTROL_ACTION_ID_ATTR,
									getOrCreateControlActionId((AbstractControlAction) editedElement));
						} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e1) {
							EditorLogger.error(e1.getMessage());
						}
					}
				}
			}
		});
	}

	private String getOrCreateControlActionId(AbstractControlAction a) {
		String id = a.getControlActionID();

		if (id == null || id.isEmpty()) {
			id = Integer.toString(MathUtils.random(1, Integer.MAX_VALUE));
			try {
				ActionUtils.setParam(a, CONTROL_ACTION_ID_ATTR, id);
			} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
				EditorLogger.error(e.getMessage());
			}
		}

		return id;
	}

	private void insertEndAction(int pos, String id) {
		final Action e = new EndAction();

		try {
			ActionUtils.setParam(e, CONTROL_ACTION_ID_ATTR, id);
		} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e1) {
			EditorLogger.error(e1.getMessage());
		}

		list.getItems().insert(pos, e);
		parent.getActions().add(pos, e);
	}

	@Override
	protected void copy() {
		if (parent == null || list.getSelection().size() == 0)
			return;

		multiClipboard.clear();

		for (Action e : getSortedSelection()) {

			if (e == null || e instanceof EndAction)
				return;

			Action cloned = (Action) ElementUtils.cloneElement(e);
			multiClipboard.add(cloned);
			toolbar.disablePaste(false);

			// TRANSLATIONS
			if (scope.equals(ScopePanel.WORLD_SCOPE))
				Ctx.project.getI18N().putTranslationsInElement(cloned, true);
			else
				Ctx.project.getI18N().putTranslationsInElement(cloned, false);
		}
	}

	@Override
	protected void paste() {

		if (parent == null || multiClipboard.size() == 0)
			return;

		Array<Action> sel = new Array<Action>();

		for (int i = multiClipboard.size() - 1; i >= 0; i--) {
			Action newElement = (Action) ElementUtils.cloneElement(multiClipboard.get(i));

			int pos = list.getSelectedIndex() + 1;

			list.getItems().insert(pos, newElement);
			parent.getActions().add(pos, newElement);

			if (scope.equals(ScopePanel.WORLD_SCOPE))
				Ctx.project.getI18N().extractStrings(null, null, parent.getHashKey(), pos, newElement);
			else if (scope.equals(ScopePanel.SCENE_SCOPE))
				Ctx.project.getI18N().extractStrings(Ctx.project.getSelectedScene().getId(), null, parent.getHashKey(),
						pos, newElement);
			else
				Ctx.project.getI18N().extractStrings(Ctx.project.getSelectedScene().getId(),
						Ctx.project.getSelectedActor().getId(), parent.getHashKey(), pos, newElement);

			list.invalidateHierarchy();

			if (isControlAction(newElement)) {
				try {
					ActionUtils.setParam(newElement, CONTROL_ACTION_ID_ATTR, null);
				} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
					EditorLogger.error(e.getMessage());
				}

				insertEndAction(pos + 1, getOrCreateControlActionId((AbstractControlAction) newElement));

				if (newElement instanceof AbstractIfAction)
					insertEndAction(pos + 2, getOrCreateControlActionId((AbstractControlAction) newElement));
			}

			sel.add(newElement);
		}

		list.getSelection().clear();
		list.getSelection().addAll(sel);
		Ctx.project.setModified();
	}

	@Override
	protected void delete() {
		if (list.getSelection().size() == 0)
			return;

		multiClipboard.clear();

		int pos = list.getSelectedIndex();

		for (Action e : getSortedSelection()) {

			if (e instanceof EndAction)
				continue;

			int pos2 = list.getItems().indexOf(e, true);
			list.getItems().removeValue(e, true);

			int idx = parent.getActions().indexOf(e);

			parent.getActions().remove(e);

			multiClipboard.add(e);

			// TRANSLATIONS
			if (scope.equals(ScopePanel.WORLD_SCOPE))
				Ctx.project.getI18N().putTranslationsInElement(e, true);
			else
				Ctx.project.getI18N().putTranslationsInElement(e, false);

			// UNDO
			Ctx.project.getUndoStack().add(new UndoDeleteAction(parent, e, idx));

			if (isControlAction(e))
				deleteControlAction(pos2, (AbstractControlAction) e);

		}

		if (list.getItems().size == 0) {
			list.getSelection().clear();
		} else if (pos >= list.getItems().size) {
			list.getSelection().choose(list.getItems().get(list.getItems().size - 1));
		} else {
			list.getSelection().choose(list.getItems().get(pos));
		}

		toolbar.disablePaste(false);

		Ctx.project.setModified();
	}

	private Array<Action> getSortedSelection() {
		Array<Action> array = list.getSelection().toArray();

		array.sort(new Comparator<Action>() {

			@Override
			public int compare(Action arg0, Action arg1) {
				Integer i0 = list.getItems().indexOf(arg0, true);
				Integer i1 = list.getItems().indexOf(arg1, true);

				return i0.compareTo(i1);
			}

		});

		return array;
	}

	private boolean isControlAction(Action e) {
		return e instanceof AbstractControlAction;
	}

	private void deleteControlAction(int pos, final AbstractControlAction e) {
		final String id = getOrCreateControlActionId(e);

		if (e instanceof AbstractIfAction) {
			pos = deleteFirstActionNamed(pos, id);
		}

		deleteFirstActionNamed(pos, id);
	}

	private int deleteFirstActionNamed(int pos, String actionId) {
		while (!(list.getItems().get(pos) instanceof AbstractControlAction
				&& getOrCreateControlActionId((AbstractControlAction) list.getItems().get(pos)).equals(actionId)))
			pos++;

		Action e2 = list.getItems().removeIndex(pos);
		parent.getActions().remove(e2);

		return pos;
	}

	private void up() {
		if (parent == null || list.getSelection().size() == 0)
			return;

		Array<Action> sel = new Array<Action>();

		for (Action a : getSortedSelection()) {

			int pos = list.getItems().indexOf(a, true);

			if (pos == -1 || pos == 0)
				return;

			Array<Action> items = list.getItems();
			Action e = items.get(pos);
			Action e2 = items.get(pos - 1);

			sel.add(e);

			if (isControlAction(e) && isControlAction(e2)) {
				continue;
			}

			parent.getActions().set(pos - 1, e);
			parent.getActions().set(pos, e2);

			items.set(pos - 1, e);
			items.set(pos, e2);
		}

		list.getSelection().clear();
		list.getSelection().addAll(sel);
		upBtn.setDisabled(list.getSelectedIndex() == 0);
		downBtn.setDisabled(list.getSelectedIndex() == list.getItems().size - 1);

		Ctx.project.setModified();
	}

	private void down() {
		if (parent == null || list.getSelection().size() == 0)
			return;

		Array<Action> sel = new Array<Action>();

		Array<Action> sortedSelection = getSortedSelection();

		for (int i = sortedSelection.size - 1; i >= 0; i--) {

			int pos = list.getItems().indexOf(sortedSelection.get(i), true);

			Array<Action> items = list.getItems();

			if (pos == -1 || pos == items.size - 1)
				return;

			Action e = items.get(pos);
			Action e2 = items.get(pos + 1);

			sel.add(e);

			if (isControlAction(e) && isControlAction(e2)) {
				continue;
			}

			parent.getActions().set(pos + 1, e);
			parent.getActions().set(pos, e2);

			items.set(pos + 1, e);
			items.set(pos, e2);
		}

		list.getSelection().clear();
		list.getSelection().addAll(sel);
		upBtn.setDisabled(list.getSelectedIndex() == 0);
		downBtn.setDisabled(list.getSelectedIndex() == list.getItems().size - 1);

		Ctx.project.setModified();
	}

	// -------------------------------------------------------------------------
	// ListCellRenderer
	// -------------------------------------------------------------------------
	private final CellRenderer<Action> listCellRenderer = new CellRenderer<Action>() {

		@Override
		protected String getCellTitle(Action a) {
			boolean enabled = true;

			if (a instanceof CommentAction) {
				String comment = null;

				try {
					comment = ActionUtils.getStringValue(a, "comment");
				} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
					EditorLogger.error(e.getMessage());
				}

				if(comment == null)
					comment = "COMMENT";
				else if(comment.indexOf('\n') != -1) {
					comment = comment.substring(0, comment.indexOf('\n'));
				}

				return "[YELLOW]" + comment + "[]";
			}

			if (a instanceof DisableActionAction) {
				a = ((DisableActionAction) a).getAction();
				enabled = false;
			}

			String id = ActionUtils.getName(a.getClass());

			if (id == null)
				id = a.getClass().getCanonicalName();

			Field field = ActionUtils.getField(a.getClass(), "actor");
			String actor = null;

			if (field != null) {
				try {
					field.setAccessible(true);
					Object v = field.get(a);
					if (v != null)
						actor = v.toString();
				} catch (IllegalArgumentException | IllegalAccessException e) {
					EditorLogger.error(e.getMessage());
				}
			}

			boolean animationAction = id.equals("Animation");
			boolean controlAction = isControlAction(a);

			if (!enabled && !controlAction) {
				if (actor != null && !animationAction) {
					SceneActorRef sa = new SceneActorRef(actor);

					if (sa.getSceneId() != null)
						id = MessageFormat.format("[GRAY]{0} {1}.{2}[]", sa.getSceneId(), sa.getActorId(), id);
					else
						id = MessageFormat.format("[GRAY]{0}.{1}[]", sa.getActorId(), id);
				} else if (animationAction) {
					field = ActionUtils.getField(a.getClass(), "animation");
					String animation = null;

					if (field != null) {
						try {
							field.setAccessible(true);
							animation = field.get(a).toString();
						} catch (IllegalArgumentException | IllegalAccessException e) {
							EditorLogger.error(e.getMessage());
						}
					}

					ActorAnimationRef aa = new ActorAnimationRef(animation);

					if (aa.getActorId() != null)
						id = MessageFormat.format("[GRAY]{0}.{1} {2}[]", aa.getActorId(), id, aa.getAnimationId());
					else
						id = MessageFormat.format("[GRAY]{0} {1}[]", id, aa.getAnimationId());
				} else {
					id = MessageFormat.format("[GRAY]{0}[]", id);
				}

			} else if (actor != null && !animationAction && !controlAction) {
				SceneActorRef sa = new SceneActorRef(actor);

				if (sa.getSceneId() != null)
					id = MessageFormat.format("[GREEN]{0}[] {1}.{2}", sa.getSceneId(), sa.getActorId(), id);
				else
					id = MessageFormat.format("{0}.{1}", sa.getActorId(), id);
			} else if (animationAction) {
				field = ActionUtils.getField(a.getClass(), "animation");
				String animation = null;

				if (field != null) {
					try {
						field.setAccessible(true);
						animation = field.get(a).toString();
					} catch (IllegalArgumentException | IllegalAccessException e) {
						EditorLogger.error(e.getMessage());
					}
				}

				ActorAnimationRef aa = new ActorAnimationRef(animation);

				if (aa.getActorId() != null)
					id = MessageFormat.format("[GREEN]{0}.{1} {2}[]", aa.getActorId(), id, aa.getAnimationId());
				else
					id = MessageFormat.format("[GREEN]{0} {1}[]", id, aa.getAnimationId());
			} else if (controlAction) {
				if (a instanceof EndAction) {
					Action parentAction = findParentAction((EndAction) a);

					if (parentAction instanceof AbstractIfAction
							&& isElse((AbstractIfAction) parentAction, (EndAction) a)) {
						id = "Else";
					} else {
						id = "End" + ActionUtils.getName(parentAction.getClass());
					}
				}

				if (actor != null) {
					SceneActorRef sa = new SceneActorRef(actor);

					if (sa.getSceneId() != null)
						id = MessageFormat.format("[GREEN]{0}[] [BLUE]{1}.{2}[]", sa.getSceneId(), sa.getActorId(), id);
					else
						id = MessageFormat.format("[BLUE]{0}.{1}[BLUE]", sa.getActorId(), id);
				} else
					id = MessageFormat.format("[BLUE]{0}[]", id);
			}

			if(ActionUtils.isDeprecated(a.getClass()))
				id = "[RED]D[] " + id;

			return id;
		}

		private boolean isElse(AbstractIfAction parentAction, EndAction ea) {
			final String caID = ea.getControlActionID();
			ArrayList<Action> actions = parent.getActions();

			int idx = actions.indexOf(parentAction);

			for (int i = idx + 1; i < actions.size(); i++) {
				Action aa = actions.get(i);

				if (isControlAction(aa) && ((AbstractControlAction) aa).getControlActionID().equals(caID)) {
					if (aa == ea)
						return true;

					return false;
				}
			}

			return false;
		}

		private Action findParentAction(EndAction a) {
			final String caID = a.getControlActionID();
			ArrayList<Action> actions = parent.getActions();

			for (Action a2 : actions) {
				if (isControlAction(a2) && ((AbstractControlAction) a2).getControlActionID().equals(caID)) {
					return a2;
				}
			}

			return null;
		}

		@Override
		protected String getCellSubTitle(Action a) {
			if (a instanceof CommentAction)
				return "";

			if (a instanceof DisableActionAction)
				a = ((DisableActionAction) a).getAction();

			StringBuilder sb = new StringBuilder();

			String[] params = ActionUtils.getFieldNames(a);
			String actionName = ActionUtils.getName(a.getClass());

			for (String p : params) {

				if (p.equals("actor")
						|| (actionName != null && actionName.equals("Animation") && p.equals("animation")))
					continue;

				if(p.equals("caID"))
					continue;

				Field f = ActionUtils.getField(a.getClass(), p);

				try {
					final boolean accessible = f.isAccessible();
					f.setAccessible(true);
					Object o = f.get(a);
					if (o == null)
						continue;
					String v = o.toString();

					// Check world Scope for translations
					if (scope.equals(ScopePanel.WORLD_SCOPE))
						sb.append(p).append(": ")
								.append(Ctx.project.getI18N().getWorldTranslation(v).replace("\n", "|")).append(' ');
					else
						sb.append(p).append(": ").append(Ctx.project.translate(v).replace("\n", "|")).append(' ');

					f.setAccessible(accessible);
				} catch (IllegalArgumentException | IllegalAccessException e) {
					EditorLogger.error(e.getMessage());
				}
			}

			return sb.toString();
		}

		@Override
		protected boolean hasSubtitle() {
			return true;
		}
	};
}


text:
package apple.struct;

import org.moe.natj.c.StructObject;
import org.moe.natj.c.ann.Structure;
import org.moe.natj.c.ann.StructureField;
import org.moe.natj.general.NatJ;
import org.moe.natj.general.Pointer;
import org.moe.natj.general.ann.Generated;

@Generated
@Structure()
public final class __darwin_arm_debug_state64 extends StructObject {
    private static long __natjCache;

    static {
        NatJ.register();
    }

    @Generated
    public __darwin_arm_debug_state64() {
        super(__darwin_arm_debug_state64.class);
    }

    @Generated
    protected __darwin_arm_debug_state64(Pointer peer) {
        super(peer);
    }

    @Generated
    @StructureField(order = 0, isGetter = true, count = 16)
    public native long __bvr(int field_idx);

    @Generated
    @StructureField(order = 0, isGetter = false, count = 16)
    public native void set__bvr(long value, int field_idx);

    @Generated
    @StructureField(order = 1, isGetter = true, count = 16)
    public native long __bcr(int field_idx);

    @Generated
    @StructureField(order = 1, isGetter = false, count = 16)
    public native void set__bcr(long value, int field_idx);

    @Generated
    @StructureField(order = 2, isGetter = true, count = 16)
    public native long __wvr(int field_idx);

    @Generated
    @StructureField(order = 2, isGetter = false, count = 16)
    public native void set__wvr(long value, int field_idx);

    @Generated
    @StructureField(order = 3, isGetter = true, count = 16)
    public native long __wcr(int field_idx);

    @Generated
    @StructureField(order = 3, isGetter = false, count = 16)
    public native void set__wcr(long value, int field_idx);

    /**
     * Bit 0 is SS (Hardware Single Step)
     */
    @Generated
    @StructureField(order = 4, isGetter = true)
    public native long __mdscr_el1();

    /**
     * Bit 0 is SS (Hardware Single Step)
     */
    @Generated
    @StructureField(order = 4, isGetter = false)
    public native void set__mdscr_el1(long value);
}


text:
<?php

namespace Magento\Framework\Composer;

use Composer\Console\Application;
use Magento\Framework\App\Filesystem\DirectoryList;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;

/**
 * A class to check if there are any dependency to package(s) that exists in the codebase, regardless of package type
 */
class DependencyChecker
{
    /**
     * @var Application
     */
    private $composerApp;

    /**
     * @var DirectoryList
     */
    private $directoryList;

    /**
     * Constructor
     *
     * @param Application $composerApp
     * @param DirectoryList $directoryList
     */
    public function __construct(Application $composerApp, DirectoryList $directoryList)
    {
        $this->composerApp = $composerApp;
        $this->directoryList = $directoryList;
    }

    /**
     * Checks dependencies to package(s), returns array of dependencies in the format of
     * 'package A' => [array of package names depending on package A]
     * If $excludeSelf is set to true, items in $packages will be excluded in all
     * "array of package names depending on package A"
     *
     * @param string[] $packages
     * @param bool $excludeSelf
     * @return string[]
     */
    public function checkDependencies(array $packages, $excludeSelf = false)
    {
        $this->composerApp->setAutoExit(false);
        $dependencies = [];
        foreach ($packages as $package) {
            $buffer = new BufferedOutput();
            $this->composerApp->resetComposer();
            $this->composerApp->run(
                new ArrayInput(
                    ['command' => 'depends', '--working-dir' => $this->directoryList->getRoot(), 'package' => $package]
                ),
                $buffer
            );
            $dependingPackages = $this->parseComposerOutput($buffer->fetch());
            if ($excludeSelf === true) {
                $dependingPackages = array_values(array_diff($dependingPackages, $packages));
            }
            $dependencies[$package] = $dependingPackages;
        }
        return $dependencies;
    }

    /**
     * Parse output from running composer remove command into an array of depending packages
     *
     * @param string $output
     * @return string[]
     */
    private function parseComposerOutput($output)
    {
        $rawLines = explode(PHP_EOL, $output);
        $packages = [];
        foreach ($rawLines as $rawLine) {
            $parts = explode(' ', $rawLine);
            if (count(explode('/', $parts[0])) == 2) {
                if (strpos($parts[0], 'magento/project-') === false) {
                    $packages[] = $parts[0];
                }
            }
        }
        return $packages;
    }
}


text:
package com.rmd.personal.projecteuler.p20to39;

import com.rmd.personal.projecteuler.AbstractProblemTestBase;
import org.junit.Test;

import static org.junit.Assert.*;

public class P020Test extends AbstractProblemTestBase<P020> {

    public P020Test() {
        super(new P020());
    }

    @Test
    public void runReturnsCorrectlyForProvided() {
        // Arrange
        final int n = 10;
        this.getProblem().setN(n);

        // Act
        long returned = Long.valueOf(this.getProblem().run());

        // Assert
        final long expected = 27;
        assertEquals(expected, returned);
    }

    @Test
    public void runReturnsCorrectlyForDefault() {
        // Act
        long returned = Long.valueOf(this.getProblem().run());

        // Assert
        final long expected = 648;
        assertEquals(expected, returned);
    }
}


text:
**Related issue (if applicable):** fixes #<plaso issue number here>

## Notes:
All contributions to Plaso undergo [code
review](https://github.com/log2timeline/l2tdocs/blob/main/process/Code%20review%20process.asciidoc). This makes sure
that the code has appropriate test coverage and conforms to the Plaso [style
guide](https://plaso.readthedocs.io/en/latest/sources/developer/Style-guide.html).

One of the maintainers will examine your code, and may request changes. Check off the items below in
order, and then a maintainer will review your code.

## Checklist:
  - [ ] Automated checks (Travis, Codecov, Codefactor )pass
  - [ ] No new [new dependencies](https://plaso.readthedocs.io/en/latest/sources/developer/Adding-a-new-dependency.html) are required or l2tdevtools has been updated
  - [ ] Reviewer assigned


text:
This is a PyTorch implementation of PAAC from ["Efficient Parallel Methods for Deep Reinforcement Learning"](https://arxiv.org/abs/1705.04862)

![BeamReider](./assets/BeamRider.gif)  ![Breakout](./assets/Breakout.gif)  ![Pong](./assets/Pong.gif)  ![Qbert](./assets/Qbert.gif)

# Environments
- Ubuntu 16.04
- python 3.5.2
- PyTorch 0.2.0
- NumPy 1.13.1
- gym 0.9.2
- matplotlib

# Usage
- You can train the agent by:

```
python main.py --env-name BreakoutDeterministic-v4 --num-workers 4
```

- You can play the game by:
```
python play.py --env-name BreakoutDeterministic-v4
```

# Results

# Notes

# References

- [origin paper's open source](https://github.com/Alfredvc/paac)
- [openai's universe-starter-agent](https://github.com/openai/universe-starter-agent)
- [pytorch-a3c](https://github.com/ikostrikov/pytorch-a3c)


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>simple index for exericse 3</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

Text Area CSV to HTML Table

Table should be between the two hr tags.

<form>
<textarea id='src' rows=10 cols=60>
vendor, date, amount, comment
HyVee, 11/19/2016, 7.86, breakfast
Amazon, 11/19/2016, 31.77, jQuery book
</textarea>
<button id="btnToTable">Parse to Table!</button>
</form>


text:
package com.intellij.internal.statistic.collectors.fus;

import com.intellij.internal.statistic.beans.UsageDescriptor;
import com.intellij.internal.statistic.service.fus.collectors.ApplicationUsagesCollector;
import com.intellij.openapi.application.Experiments;
import com.intellij.openapi.util.registry.Registry;
import org.jetbrains.annotations.NotNull;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;

public class RegistryApplicationUsagesCollector extends ApplicationUsagesCollector {
  private static final String GROUP_ID = "statistics.platform.registry.application";

  @NotNull
  @Override
  public Set<UsageDescriptor> getUsages() {
    return getChangedValuesUsages();
  }

  @NotNull
  static Set<UsageDescriptor> getChangedValuesUsages() {
    Set<UsageDescriptor> registry = Registry.getAll().stream()
      .filter(key -> key.isChangedFromDefault())
      .map(key -> new UsageDescriptor(key.getKey()))
      .collect(Collectors.toSet());

    Set<UsageDescriptor> experiments = Arrays.stream(Experiments.EP_NAME.getExtensions())
      .filter(f -> Experiments.isFeatureEnabled(f.id))
      .map(f -> new UsageDescriptor(f.id))
      .collect(Collectors.toSet());

    HashSet<UsageDescriptor> result = new HashSet<>(registry);
    result.addAll(experiments);
    return result;
  }

  @NotNull
  @Override
  public String getGroupId() {
    return GROUP_ID;
  }
}


text:
<?php
/**
 * Created by Szymon Szymański <szymon.szymanski@hotmail.com>
 * Date: 02.05.2017
 * Time: 23:22
 */

namespace Tests\Szyku\NLTK\Util;

use Szyku\NLTK\Util\PhraseNormalization;

class PhraseNormalizationTest extends \PHPUnit_Framework_TestCase
{

    /**
     * @dataProvider stringProvider
     */
    public function testStringNormalization($in, $expected)
    {
        $actual = PhraseNormalization::normalizeForApi($in);
        $this->assertSame($expected, $actual, 'The normalization is incorrect.');
    }

    public function stringProvider()
    {
        return [
            ['look', 'look',],
            ['lock in', 'lock_in',],
            ['    space    ', 'space',],
            ['cat-o\'-nine-tails', 'cat-o\'-nine-tails',],
        ];
    }

    /**
     * @expectedException Szyku\NLTK\Exception\NltkClientAssertionException
     */
    public function testIfReactsWithExceptionOnIncorrectDataToNormalize()
    {
        PhraseNormalization::normalizeForApi(1233);
    }
}


text:
/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */

package in.srain.cube.views.ptr;

public final class R {
    public static final class attr {
        /**
Must be a reference to another resource, in the form "@[+][package:]type:name"
or to a theme attribute in the form "?[package:][type:]name".
         */
        public static int ptr_content=0x7f010002;
        /**
Must be an integer value, such as "100".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
         */
        public static int ptr_duration_to_close=0x7f010005;
        /**
Must be an integer value, such as "100".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
         */
        public static int ptr_duration_to_close_header=0x7f010006;
        /**
Must be a reference to another resource, in the form "@[+][package:]type:name"
or to a theme attribute in the form "?[package:][type:]name".
         */
        public static int ptr_header=0x7f010001;
        /**
Must be a boolean value, either "true" or "false".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
         */
        public static int ptr_keep_header_when_refresh=0x7f010008;
        /**
Must be a boolean value, either "true" or "false".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
         */
        public static int ptr_pull_to_fresh=0x7f010007;
        /**
Must be a floating point value, such as "1.2".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
         */
        public static int ptr_ratio_of_header_height_to_refresh=0x7f010004;
        /**
Must be a floating point value, such as "1.2".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
         */
        public static int ptr_resistance=0x7f010003;
        /**
Must be an integer value, such as "100".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
         */
        public static int ptr_rotate_ani_time=0x7f010000;
    }
    public static final class drawable {
        public static int ptr_rotate_arrow=0x7f020000;
    }
    public static final class id {
        public static int ptr_classic_header_rotate_view=0x7f050003;
        public static int ptr_classic_header_rotate_view_header_last_update=0x7f050002;
        public static int ptr_classic_header_rotate_view_header_text=0x7f050000;
        public static int ptr_classic_header_rotate_view_header_title=0x7f050001;
        public static int ptr_classic_header_rotate_view_progressbar=0x7f050004;
    }
    public static final class layout {
        public static int cube_ptr_classic_default_header=0x7f030000;
        public static int cube_ptr_simple_loading=0x7f030001;
    }
    public static final class string {
        public static int cube_ptr_hours_ago=0x7f040000;
        public static int cube_ptr_last_update=0x7f040001;
        public static int cube_ptr_minutes_ago=0x7f040002;
        public static int cube_ptr_pull_down=0x7f040003;
        public static int cube_ptr_pull_down_to_refresh=0x7f040004;
        public static int cube_ptr_refresh_complete=0x7f040005;
        public static int cube_ptr_refreshing=0x7f040006;
        public static int cube_ptr_release_to_refresh=0x7f040007;
        public static int cube_ptr_seconds_ago=0x7f040008;
    }
    public static final class styleable {
        /** Attributes that can be used with a PtrClassicHeader.

Includes the following attributes:

           <colgroup align="left" />
           <colgroup align="left" />

Attribute	Description

{@link #PtrClassicHeader_ptr_rotate_ani_time in.srain.cube.views.ptr:ptr_rotate_ani_time}

           @see #PtrClassicHeader_ptr_rotate_ani_time
         */
        public static final int[] PtrClassicHeader = {
            0x7f010000
        };
        /**

This symbol is the offset where the {@link in.srain.cube.views.ptr.R.attr#ptr_rotate_ani_time}
          attribute's value can be found in the {@link #PtrClassicHeader} array.

Must be an integer value, such as "100".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
          @attr name in.srain.cube.views.ptr:ptr_rotate_ani_time
        */
        public static int PtrClassicHeader_ptr_rotate_ani_time = 0;
        /** Attributes that can be used with a PtrFrameLayout.

Includes the following attributes:

           <colgroup align="left" />
           <colgroup align="left" />

Attribute	Description

{@link #PtrFrameLayout_ptr_content in.srain.cube.views.ptr:ptr_content}

{@link #PtrFrameLayout_ptr_duration_to_close in.srain.cube.views.ptr:ptr_duration_to_close}

{@link #PtrFrameLayout_ptr_duration_to_close_header in.srain.cube.views.ptr:ptr_duration_to_close_header}

{@link #PtrFrameLayout_ptr_header in.srain.cube.views.ptr:ptr_header}

{@link #PtrFrameLayout_ptr_keep_header_when_refresh in.srain.cube.views.ptr:ptr_keep_header_when_refresh}

{@link #PtrFrameLayout_ptr_pull_to_fresh in.srain.cube.views.ptr:ptr_pull_to_fresh}

{@link #PtrFrameLayout_ptr_ratio_of_header_height_to_refresh in.srain.cube.views.ptr:ptr_ratio_of_header_height_to_refresh}

{@link #PtrFrameLayout_ptr_resistance in.srain.cube.views.ptr:ptr_resistance}

           @see #PtrFrameLayout_ptr_content
           @see #PtrFrameLayout_ptr_duration_to_close
           @see #PtrFrameLayout_ptr_duration_to_close_header
           @see #PtrFrameLayout_ptr_header
           @see #PtrFrameLayout_ptr_keep_header_when_refresh
           @see #PtrFrameLayout_ptr_pull_to_fresh
           @see #PtrFrameLayout_ptr_ratio_of_header_height_to_refresh
           @see #PtrFrameLayout_ptr_resistance
         */
        public static final int[] PtrFrameLayout = {
            0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004,
            0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008
        };
        /**

This symbol is the offset where the {@link in.srain.cube.views.ptr.R.attr#ptr_content}
          attribute's value can be found in the {@link #PtrFrameLayout} array.

Must be a reference to another resource, in the form "@[+][package:]type:name"
or to a theme attribute in the form "?[package:][type:]name".
          @attr name in.srain.cube.views.ptr:ptr_content
        */
        public static int PtrFrameLayout_ptr_content = 1;
        /**

This symbol is the offset where the {@link in.srain.cube.views.ptr.R.attr#ptr_duration_to_close}
          attribute's value can be found in the {@link #PtrFrameLayout} array.

Must be an integer value, such as "100".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
          @attr name in.srain.cube.views.ptr:ptr_duration_to_close
        */
        public static int PtrFrameLayout_ptr_duration_to_close = 4;
        /**

This symbol is the offset where the {@link in.srain.cube.views.ptr.R.attr#ptr_duration_to_close_header}
          attribute's value can be found in the {@link #PtrFrameLayout} array.

Must be an integer value, such as "100".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
          @attr name in.srain.cube.views.ptr:ptr_duration_to_close_header
        */
        public static int PtrFrameLayout_ptr_duration_to_close_header = 5;
        /**

This symbol is the offset where the {@link in.srain.cube.views.ptr.R.attr#ptr_header}
          attribute's value can be found in the {@link #PtrFrameLayout} array.

Must be a reference to another resource, in the form "@[+][package:]type:name"
or to a theme attribute in the form "?[package:][type:]name".
          @attr name in.srain.cube.views.ptr:ptr_header
        */
        public static int PtrFrameLayout_ptr_header = 0;
        /**

This symbol is the offset where the {@link in.srain.cube.views.ptr.R.attr#ptr_keep_header_when_refresh}
          attribute's value can be found in the {@link #PtrFrameLayout} array.

Must be a boolean value, either "true" or "false".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
          @attr name in.srain.cube.views.ptr:ptr_keep_header_when_refresh
        */
        public static int PtrFrameLayout_ptr_keep_header_when_refresh = 7;
        /**

This symbol is the offset where the {@link in.srain.cube.views.ptr.R.attr#ptr_pull_to_fresh}
          attribute's value can be found in the {@link #PtrFrameLayout} array.

Must be a boolean value, either "true" or "false".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
          @attr name in.srain.cube.views.ptr:ptr_pull_to_fresh
        */
        public static int PtrFrameLayout_ptr_pull_to_fresh = 6;
        /**

This symbol is the offset where the {@link in.srain.cube.views.ptr.R.attr#ptr_ratio_of_header_height_to_refresh}
          attribute's value can be found in the {@link #PtrFrameLayout} array.

Must be a floating point value, such as "1.2".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
          @attr name in.srain.cube.views.ptr:ptr_ratio_of_header_height_to_refresh
        */
        public static int PtrFrameLayout_ptr_ratio_of_header_height_to_refresh = 3;
        /**

This symbol is the offset where the {@link in.srain.cube.views.ptr.R.attr#ptr_resistance}
          attribute's value can be found in the {@link #PtrFrameLayout} array.

Must be a floating point value, such as "1.2".

This may also be a reference to a resource (in the form
"@[package:]type:name") or
theme attribute (in the form
"?[package:][type:]name")
containing a value of this type.
          @attr name in.srain.cube.views.ptr:ptr_resistance
        */
        public static int PtrFrameLayout_ptr_resistance = 2;
    };
}


text: console.log('Hey in b')


text:
package com.yahoo.athenz.auth.oauth.token;

import static org.testng.Assert.*;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

public class OAuthJwtAccessTokenTest {

    @Test(dataProvider = "instances")
    public void testGetScopes(OAuthJwtAccessToken instance, List<String> expected) {
        assertEquals(instance.getScopes(), expected);
    }
    @DataProvider(name = "instances")
    public static Object[][] instances() {
        List<Object[]> testCases = new ArrayList<>();

        // null scope
        testCases.add(new Object[]{
            new OAuthJwtAccessToken() {
                public String getScope() { return null; }
                public String getSubject() { return null; }
                public String getIssuer() { return null; }
                public String getAudience() { return null; }
                public List<String>  getAudiences() { return null; }
                public String getClientId() { return null; }
                public String getCertificateThumbprint() { return null; }
                public long getIssuedAt() { return 0L; }
                public long getExpiration() { return 0L; }
                public String getSignature() { return null; }
            },
            null
        });
        // empty scope
        testCases.add(new Object[]{
            new OAuthJwtAccessToken() {
                public String getScope() { return ""; }
                public String getSubject() { return null; }
                public String getIssuer() { return null; }
                public String getAudience() { return null; }
                public List<String>  getAudiences() { return null; }
                public String getClientId() { return null; }
                public String getCertificateThumbprint() { return null; }
                public long getIssuedAt() { return 0L; }
                public long getExpiration() { return 0L; }
                public String getSignature() { return null; }
            },
            Arrays.asList("")
        });
        // 2 scopes
        testCases.add(new Object[]{
            new OAuthJwtAccessToken() {
                public String getScope() { return "scope_1 scope_2"; }
                public String getSubject() { return null; }
                public String getIssuer() { return null; }
                public String getAudience() { return null; }
                public List<String>  getAudiences() { return null; }
                public String getClientId() { return null; }
                public String getCertificateThumbprint() { return null; }
                public long getIssuedAt() { return 0L; }
                public long getExpiration() { return 0L; }
                public String getSignature() { return null; }
            },
            Arrays.asList("scope_1", "scope_2")
        });
        // trailing delimiter
        testCases.add(new Object[]{
            new OAuthJwtAccessToken() {
                public String getScope() { return "scope_3 scope_4 "; }
                public String getSubject() { return null; }
                public String getIssuer() { return null; }
                public String getAudience() { return null; }
                public List<String>  getAudiences() { return null; }
                public String getClientId() { return null; }
                public String getCertificateThumbprint() { return null; }
                public long getIssuedAt() { return 0L; }
                public long getExpiration() { return 0L; }
                public String getSignature() { return null; }
            },
            Arrays.asList("scope_3", "scope_4")
        });

        return testCases.toArray(new Object[testCases.size()][]);
    }

}


text:
Parsing trees.

Where I come from, it means "tree" (from lat. "arbor").

Aabro is a [PEG parser](http://en.wikipedia.org/wiki/Parsing_expression_grammar) library. Nothing fancy here.

## License

MIT (see [LICENSE.txt](LICENSE.txt))


text:
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP #-}

-- |
-- Module     : Data.Conduit.JSON.NewlineDelimited
-- License    : MIT
-- Maintainer : Sam Rijs <srijs@airpost.net>

module Data.Conduit.JSON.NewlineDelimited
  ( -- * Serialization
    serializer
  , valueSerializer
    -- * Parsing
  , parser
  , maybeParser
  , eitherParser
  , valueParser
  , maybeValueParser
  , eitherValueParser
  , resultValueParser
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as A
import Data.Attoparsec.ByteString
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as B (toChunks)
import qualified Data.ByteString.Builder as B
import Data.Conduit
import Data.Monoid

carriage = fromIntegral $ fromEnum '\r'
newline = fromIntegral $ fromEnum '\n'

await' f = await >>= maybe (return ()) f

-- | Consumes a stream of serializable values, and provides a stream of bytestrings.
serializer :: (Monad m, A.ToJSON a) => Conduit a m B.ByteString
serializer = mapInput A.toJSON (const Nothing) valueSerializer

-- | Consumes a stream of aeson values, and provides a stream of bytestrings.
valueSerializer :: Monad m => Conduit A.Value m B.ByteString
valueSerializer = await' $ (>> valueSerializer) . yieldBuilder . build
  where yieldBuilder = mapM_ yield . B.toChunks . B.toLazyByteString
        build a = B.lazyByteString (A.encode a) <> B.word8 carriage <> B.word8 newline

-- | Consumes a stream of bytestrings, and provides a stream of parsed values,
--   ignoring all parse errors.
parser :: (Monad m, A.FromJSON a) => Conduit B.ByteString m a
parser = mapOutputMaybe (>>= A.parseMaybe A.parseJSON) maybeValueParser

-- | Consumes a stream of bytestrings, and provides a stream of just parsed values,
--   or nothing on parse error.
maybeParser :: (Monad m, A.FromJSON a) => Conduit B.ByteString m (Maybe a)
maybeParser = mapOutput (>>= A.parseMaybe A.parseJSON) maybeValueParser

-- | Consumes a stream of bytestrings, and provides a stream of right parsed values,
--   or left strings describing the parse error.
eitherParser :: (Monad m, A.FromJSON a) => Conduit B.ByteString m (Either String a)
eitherParser = mapOutput (>>= A.parseEither A.parseJSON) eitherValueParser

-- | Consumes a stream of bytestrings, and provides a stream of aeson values,
--   ignoring all parse errors.
valueParser :: Monad m => Conduit B.ByteString m A.Value
valueParser = mapOutputMaybe maybeResult resultValueParser

-- | Consumes a stream of bytestrings, and provides a stream of just aeson values,
--   or nothing on parse error.
maybeValueParser :: Monad m => Conduit B.ByteString m (Maybe A.Value)
maybeValueParser = mapOutput maybeResult resultValueParser

-- | Consumes a stream of bytestrings, and provides a stream of right aeson values,
--   or left strings describing the parse error.
eitherValueParser :: Monad m => Conduit B.ByteString m (Either String A.Value)
eitherValueParser = mapOutput eitherResult resultValueParser

-- | Consumes a stream of bytestrings, and provides a stream of parse results.
resultValueParser :: Monad m => Conduit B.ByteString m (Result A.Value)
resultValueParser = go (parse A.json B.empty)
  where go r = await' $ (>>= go) . proc . split
          where proc [] = return r
                proc [c] = return (feed r c)
                proc (c:cs) = do
                  yield (feed r c)
                  mapM_ yield (map (parse A.json) (init cs))
                  return (parse A.json (last cs))
        split = B.split newline . B.filter (/=carriage)


text:
node_modules/mocha/bin/mocha --recursive --reporter mocha-html-reporter $@  | cat test/head.html - test/tail.html  > public/test.html
wait ${!}
echo html_written


text:
package com.JoomlaDay;

public class Noticias {

	private String title;
	private String description;
	private String author;
	private String link;
	private String image;
	private String date;

	public Noticias(String title, String description, String author,
			String link, String image, String date) {
		setTitle(title);
		setDescription(description);
		setAuthor(author);
		setLink(link);
		setImage(image);
		setDate(date);
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

}


text:
require_relative '../test_helper'

describe Deltacloud::Client::StorageVolume do

  before do
    VCR.insert_cassette(__name__)
    @client = new_client
  end

  after do
    VCR.eject_cassette
  end

  it 'supports #blobs' do
    b = @client.bucket('bucket1')
    b.must_respond_to :blobs
    b.blobs.wont_be_empty
    b.blobs.first.must_be_instance_of Deltacloud::Client::Blob
  end

end


text:
package com.miguelbcr.ui.rx_paparazzo2.sample;

import androidx.test.espresso.matcher.BoundedMatcher;
import android.view.View;
import android.widget.ImageView;

import org.hamcrest.Description;

class IsImageViewMatcher extends BoundedMatcher<View, ImageView> {

    public IsImageViewMatcher() {
        super(ImageView.class);
    }

    @Override
    public void describeTo(Description description) {
        description.appendText("has drawable");
    }

    @Override
    public boolean matchesSafely(ImageView imageView) {
        return imageView.getDrawable() != null;
    }
}


text:
from setuptools import setup

PACKAGE = "severities_extension"
VERSION = "0.1"

setup(
    name=PACKAGE,
    version=VERSION,
    description="En extension to add severities to reviews in ReviewBoard",
    author="Taller Technologies",
    packages=["severities"],
    entry_points={
        'reviewboard.extensions':
            '%s = severities.extension:SeverityExtension' % PACKAGE,
    },
)


text:
package Hard;

import org.testng.Assert;
import org.testng.annotations.Test;

/**
 *
 * Created by Elliott Chen on 7/3/17.
 */
public class Median_of_Two_Sorted_ArraysTest {
    @Test
    public void testFindMedianSortedArrays() throws Exception {
        Median_of_Two_Sorted_Arrays MTSA = new Median_of_Two_Sorted_Arrays();

        int[] num1 = {1, 3}, num2 = {2};
        Assert.assertEquals(MTSA.findMedianSortedArrays(num1, num2), 2.0);

        num1 = new int[]{1, 2};
        num2 = new int[]{3, 4};
        Assert.assertEquals(MTSA.findMedianSortedArrays(num1, num2), 2.5);

        num1 = new int[]{1, 2, 8, 9};
        num2 = new int[]{3, 4, 5, 6, 7};
        Assert.assertEquals(MTSA.findMedianSortedArrays(num1, num2), 5.0);

    }

}


text:
var mongoose = require('mongoose');

//Mongo Models
//Should be compiled once
var galerySchema = mongoose.Schema({
  title: String,
  desc: String,
  thumb: String
});

var Galery = mongoose.model('Galery', galerySchema);


text:
echo -n "PostgreSQL Database? "
read INPUT

DATABASE=$INPUT

echo -n "PostgreSQL Login Name? "
read INPUT

NAME=$INPUT

echo -n "PostgreSQL Host? "
read INPUT

HOST=$INPUT

DIR=`dirname $0`
DIR=$DIR/..

for x in $DIR/bin $DIR/lib/*
do
	export CLASSPATH=$CLASSPATH:$x
done

psql -U $NAME -h $HOST $DATABASE < $DIR/sql/postgresql.sql

cd $DIR/jakarta-tomcat-5.0.28/webapps/notification
java net.reliableresponse.notification.util.InitializeDB


text:
#ifndef BlynkEthernet_h
#define BlynkEthernet_h

#ifndef BLYNK_INFO_CONNECTION
#define BLYNK_INFO_CONNECTION "W5000"
#endif

#ifdef BLYNK_USE_SSL
  #define BLYNK_SERVER_PORT BLYNK_DEFAULT_PORT_SSL
#else
  #define BLYNK_SERVER_PORT BLYNK_DEFAULT_PORT
#endif

#include <BlynkApiArduino.h>
#include <Blynk/BlynkProtocol.h>
#include <Adapters/BlynkArduinoClient.h>

class BlynkEthernet
    : public BlynkProtocol<BlynkArduinoClient>
{
    typedef BlynkProtocol<BlynkArduinoClient> Base;
public:
    BlynkEthernet(BlynkArduinoClient& transp)
        : Base(transp)
    {}

    void config(const char* auth,
                const char* domain = BLYNK_DEFAULT_DOMAIN,
                uint16_t    port   = BLYNK_SERVER_PORT)
    {
        Base::begin(auth);
        this->conn.begin(domain, port);
    }

    void config(const char* auth,
                IPAddress   ip,
                uint16_t    port = BLYNK_SERVER_PORT)
    {
        Base::begin(auth);
        this->conn.begin(ip, port);
    }

    // DHCP with domain
    void begin( const char* auth,
                const char* domain = BLYNK_DEFAULT_DOMAIN,
                uint16_t port      = BLYNK_SERVER_PORT,
                const byte mac[]   = NULL)
    {
        BLYNK_LOG1(BLYNK_F("Getting IP..."));
        if (!Ethernet.begin(SelectMacAddress(auth, mac))) {
            BLYNK_FATAL(BLYNK_F("DHCP Failed!"));
        }
        // give the Ethernet shield a second to initialize:
        BlynkDelay(1000);
        IPAddress myip = Ethernet.localIP();
        BLYNK_LOG_IP("IP:", myip);

        config(auth, domain, port);
        while(this->connect() != true) {}
    }

    // Static IP with domain
    void begin( const char* auth,
                const char* domain,
                uint16_t port,
                IPAddress local,
                IPAddress dns,
                const byte mac[] = NULL)
    {
        BLYNK_LOG1(BLYNK_F("Using static IP"));
        Ethernet.begin(SelectMacAddress(auth, mac), local, dns);
        // give the Ethernet shield a second to initialize:
        BlynkDelay(1000);
        IPAddress myip = Ethernet.localIP();
        BLYNK_LOG_IP("IP:", myip);

        config(auth, domain, port);
        while(this->connect() != true) {}
    }

    // Static IP with domain, gateway, etc
    void begin( const char* auth,
                const char* domain,
                uint16_t port,
                IPAddress local,
                IPAddress dns,
                IPAddress gateway,
                IPAddress subnet,
                const byte mac[] = NULL)
    {
        BLYNK_LOG1(BLYNK_F("Using static IP"));
        Ethernet.begin(SelectMacAddress(auth, mac), local, dns, gateway, subnet);
        // give the Ethernet shield a second to initialize:
        BlynkDelay(1000);
        IPAddress myip = Ethernet.localIP();
        BLYNK_LOG_IP("IP:", myip);

        config(auth, domain, port);
        while(this->connect() != true) {}
    }

    // DHCP with server IP
    void begin( const char* auth,
                IPAddress addr,
                uint16_t port    = BLYNK_SERVER_PORT,
                const byte mac[] = NULL)
    {
        BLYNK_LOG1(BLYNK_F("Getting IP..."));
        if (!Ethernet.begin(SelectMacAddress(auth, mac))) {
            BLYNK_FATAL(BLYNK_F("DHCP Failed!"));
        }
        // give the Ethernet shield a second to initialize:
        BlynkDelay(1000);
        IPAddress myip = Ethernet.localIP();
        BLYNK_LOG_IP("IP:", myip);

        config(auth, addr, port);
        while(this->connect() != true) {}
    }

    // Static IP with server IP
    void begin( const char* auth,
                IPAddress addr,
                uint16_t port,
                IPAddress local,
                const byte mac[] = NULL)
    {
        BLYNK_LOG1(BLYNK_F("Using static IP"));
        Ethernet.begin(SelectMacAddress(auth, mac), local);
        // give the Ethernet shield a second to initialize:
        BlynkDelay(1000);
        IPAddress myip = Ethernet.localIP();
        BLYNK_LOG_IP("IP:", myip);

        config(auth, addr, port);
        while(this->connect() != true) {}
    }

    // Static IP with server IP, DNS, gateway, etc
    void begin( const char* auth,
                IPAddress addr,
                uint16_t port,
                IPAddress local,
                IPAddress dns,
                IPAddress gateway,
                IPAddress subnet,
                const byte mac[] = NULL)
    {
        BLYNK_LOG1(BLYNK_F("Using static IP"));
        Ethernet.begin(SelectMacAddress(auth, mac), local, dns, gateway, subnet);
        // give the Ethernet shield a second to initialize:
        BlynkDelay(1000);
        IPAddress myip = Ethernet.localIP();
        BLYNK_LOG_IP("IP:", myip);

        config(auth, addr, port);
        while(this->connect() != true) {}
    }

private:

    byte* SelectMacAddress(const char* token, const byte mac[])
    {
        if (mac != NULL) {
            return (byte*)mac;
        }

        macAddress[0] = 0xFE;
        macAddress[1] = 0xED;
        macAddress[2] = 0xBA;
        macAddress[3] = 0xFE;
        macAddress[4] = 0xFE;
        macAddress[5] = 0xED;

        int len = strlen(token);
        int mac_index = 1;
        for (int i=0; i<len; i++) {
            macAddress[mac_index++] ^= token[i];

            if (mac_index > 5) { mac_index = 1; }
        }
        /* BLYNK_LOG("MAC: %02X-%02X-%02X-%02X-%02X-%02X",
                  macAddress[0], macAddress[1],
                  macAddress[2], macAddress[3],
                  macAddress[4], macAddress[5]);
        */
        return macAddress;
    }

private:
    byte macAddress[6];

};

#endif


text:
import json

from mock import patch
from nose.tools import eq_, ok_
from test_utils import RequestFactory

from addons.models import AddonUser
from amo.tests import app_factory, ESTestCase, TestCase
from amo.urlresolvers import reverse
from users.models import UserProfile

import mkt
from mkt.api.tests import BaseAPI
from mkt.api.tests.test_oauth import RestOAuth
from mkt.fireplace.api import FireplaceAppSerializer
from mkt.webapps.models import Webapp
from mkt.site.fixtures import fixture
from mkt.webapps.models import Installed

# https://bugzilla.mozilla.org/show_bug.cgi?id=958608#c1 and #c2.
FIREPLACE_EXCLUDED_FIELDS = (
    'absolute_url', 'app_type', 'created', 'default_locale', 'payment_account',
    'regions', 'resource_uri', 'summary', 'supported_locales', 'versions',
    'weekly_downloads', 'upsold', 'tags')

class TestAppDetail(BaseAPI):
    fixtures = fixture('webapp_337141')

    def setUp(self):
        super(TestAppDetail, self).setUp()
        self.url = reverse('fireplace-app-detail', kwargs={'pk': 337141})

    def test_get(self):
        res = self.client.get(self.url)
        data = json.loads(res.content)
        eq_(data['id'], 337141)
        for field in FIREPLACE_EXCLUDED_FIELDS:
            ok_(not field in data, field)
        for field in FireplaceAppSerializer.Meta.fields:
            ok_(field in data, field)

    def test_get_slug(self):
        Webapp.objects.get(pk=337141).update(app_slug='foo')
        res = self.client.get(reverse('fireplace-app-detail',
                                      kwargs={'pk': 'foo'}))
        data = json.loads(res.content)
        eq_(data['id'], 337141)

    def test_others(self):
        url = reverse('fireplace-app-list')
        self._allowed_verbs(self.url, ['get'])
        self._allowed_verbs(url, [])

class TestFeaturedSearchView(ESTestCase):
    fixtures = fixture('webapp_337141')

    def setUp(self):
        super(TestFeaturedSearchView, self).setUp()
        self.webapp = Webapp.objects.get(pk=337141)
        self.reindex(Webapp, 'webapp')
        self.url = reverse('fireplace-featured-search-api')

    def test_get(self):
        res = self.client.get(self.url)
        objects = json.loads(res.content)['objects']
        eq_(len(objects), 1)
        data = objects[0]
        eq_(data['id'], 337141)
        for field in FIREPLACE_EXCLUDED_FIELDS:
            ok_(not field in data, field)
        for field in FireplaceAppSerializer.Meta.fields:
            ok_(field in data, field)

class TestConsumerInfoView(RestOAuth, TestCase):
    fixtures = fixture('user_2519')

    def setUp(self):
        super(TestConsumerInfoView, self).setUp()
        self.request = RequestFactory().get('/')
        self.url = reverse('fireplace-consumer-info')
        self.user = UserProfile.objects.get(pk=2519)

    @patch('mkt.regions.middleware.RegionMiddleware.region_from_request')
    def test_no_user_just_region(self, region_from_request):
        region_from_request.return_value = mkt.regions.UK
        res = self.anon.get(self.url)
        data = json.loads(res.content)
        eq_(data['region'], 'uk')
        ok_(not 'developed' in data)
        ok_(not 'installed' in data)
        ok_(not 'purchased' in data)

    @patch('mkt.regions.middleware.RegionMiddleware.region_from_request')
    def test_with_user_developed(self, region_from_request):
        region_from_request.return_value = mkt.regions.BR
        developed_app = app_factory()
        AddonUser.objects.create(user=self.user, addon=developed_app)
        self.client.login(username=self.user.email, password='password')
        res = self.client.get(self.url)
        data = json.loads(res.content)
        eq_(data['region'], 'br')
        eq_(data['installed'], [])
        eq_(data['developed'], [developed_app.pk])
        eq_(data['purchased'], [])

    @patch('mkt.regions.middleware.RegionMiddleware.region_from_request')
    def test_with_user_installed(self, region_from_request):
        region_from_request.return_value = mkt.regions.BR
        installed_app = app_factory()
        Installed.objects.create(user=self.user, addon=installed_app)
        self.client.login(username=self.user.email, password='password')
        res = self.client.get(self.url)
        data = json.loads(res.content)
        eq_(data['region'], 'br')
        eq_(data['installed'], [installed_app.pk])
        eq_(data['developed'], [])
        eq_(data['purchased'], [])

    @patch('users.models.UserProfile.purchase_ids')
    @patch('mkt.regions.middleware.RegionMiddleware.region_from_request')
    def test_with_user_purchased(self, region_from_request, purchase_ids):
        region_from_request.return_value = mkt.regions.BR
        purchased_app = app_factory()
        purchase_ids.return_value = [purchased_app.pk]
        self.client.login(username=self.user.email, password='password')
        res = self.client.get(self.url)
        data = json.loads(res.content)
        eq_(data['region'], 'br')
        eq_(data['installed'], [])
        eq_(data['developed'], [])
        eq_(data['purchased'], [purchased_app.pk])


text: #{name}


text:
//
// Created by Jiang Lu on 6/2/15.
//

#ifndef DUKV8_VALUE_H
#define DUKV8_VALUE_H

#include <duktape.h>
#include "base.h"
#include "data.h"

namespace v8 {

int DukObjectRetain(void *heapptr);

void DukObjectRelease(int index);

class HeapObject {
public:
    HeapObject() :
            duk_obj_index_(0),
            duk_obj_heapptr_(NULL) {
    }

    void *GetHeapPtr() {
        return duk_obj_heapptr_;
    }

    int duk_obj_index_;
    void *duk_obj_heapptr_;
};

class Value : public Data {
public:
    RTTI_DECLARE();

    /**
     * Returns true if this value is the undefined value.  See ECMA-262
     * 4.3.10.
     */
    V8EXPORT bool IsUndefined() const;

    /**
     * Returns true if this value is the null value.  See ECMA-262
     * 4.3.11.
     */
    V8EXPORT bool IsNull() const;

    /**
    * Returns true if this value is true.
    */
    V8EXPORT bool IsTrue() const;

    /**
     * Returns true if this value is false.
     */
    V8EXPORT bool IsFalse() const;

    /**
     * Returns true if this value is an instance of the String type.
     * See ECMA-262 8.4.
     */
    V8EXPORT bool IsString() const;

    /**
     * Returns true if this value is a function.
     */
    V8EXPORT bool IsFunction() const;

    /**
     * Returns true if this value is an array.
     */
    V8EXPORT bool IsArray() const;

    /**
     * Returns true if this value is an object.
     */
    V8EXPORT bool IsObject() const;

    /**
     * Returns true if this value is boolean.
     */
    V8EXPORT bool IsBoolean() const;

    /**
     * Returns true if this value is a number.
     */
    V8EXPORT bool IsNumber() const;

    /**
     * Returns true if this value is external.
     */
    V8EXPORT bool IsExternal() const;

    /**
     * Returns true if this value is a 32-bit signed integer.
     */
    V8EXPORT bool IsInt32() const;

    /**
     * Returns true if this value is a 32-bit unsigned integer.
     */
    V8EXPORT bool IsUint32() const;

    /**
     * Returns true if this value is a Date.
     */
    V8EXPORT bool IsDate() const;

    /**
     * Returns true if this value is a Boolean object.
     */
    V8EXPORT bool IsBooleanObject() const;

    /**
     * Returns true if this value is a Number object.
     */
    V8EXPORT bool IsNumberObject() const;

    /**
     * Returns true if this value is a String object.
     */
    V8EXPORT bool IsStringObject() const;

    /**
     * Returns true if this value is a NativeError.
     */
    V8EXPORT bool IsNativeError() const;

    /**
     * Returns true if this value is a RegExp.
     */
    V8EXPORT bool IsRegExp() const;

    V8EXPORT Local<Boolean> ToBoolean() const;
    V8EXPORT Local<Number> ToNumber() const;
    V8EXPORT Local<String> ToString() const;
    V8EXPORT Local<String> ToDetailString() const;
    V8EXPORT Local<Object> ToObject() const;
    V8EXPORT Local<Integer> ToInteger() const;
    V8EXPORT Local<Uint32> ToUint32() const;
    V8EXPORT Local<Int32> ToInt32() const;

    /**
     * Attempts to convert a string to an array index.
     * Returns an empty handle if the conversion fails.
     */
    V8EXPORT Local<Uint32> ToArrayIndex() const;

    V8EXPORT bool BooleanValue() const;
    V8EXPORT double NumberValue() const;
    V8EXPORT int64_t IntegerValue() const;
    V8EXPORT uint32_t Uint32Value() const;
    V8EXPORT int32_t Int32Value() const;

    /** JS == */
    V8EXPORT bool Equals(Handle<Value> that) const;
    V8EXPORT bool StrictEquals(Handle<Value> that) const;

    virtual void Push() const = 0;

    inline DukContextRef GetDukContext() const {
        return duk_ctx_;
    }

    static Handle<Value> FromStack(DukContextRef ctx, int index);

protected:
    Value *Init(DukContextRef duk_ctx);

    virtual void Deinit();

    virtual ~Value() { };

protected:
    duk_context *duk_ctx_;
};

}

#endif //DUKV8_VALUE_H


text:
$.stickr = function(options) {
  var o = $.extend({
        afterOpen: null,
        beforeClose: null,
        classes: '',
        closingDuration: 0,  // in milliseconds (ms)
        group: 'jq-stickrs',
        maxCount: 5,  // maximum number of concurrently displayed stickers
        message: '',
        ttl: 0,       // in milliseconds (ms)
        withCloseButton: true
      }, options),

      $stickers = o.group instanceof jQuery ? o.group : $('#' + o.group),
      $sticker = $('

'),

      isClosing = false,
      close = function($sticker) {
        if ($sticker.data('isClosing')) {
          return;
        }
        $sticker.data('isClosing', true);
        if (typeof o.beforeClose === 'function') {
          o.beforeClose($sticker);
        }
        setTimeout(function() {
          $sticker.remove();
        }, o.closingDuration);
      };

  if (!$stickers.length && !(o.group instanceof jQuery)) {
    $stickers = $('

')
        .appendTo('body');
  }

  $sticker.html(o.message);
  if (o.classes) {
    $sticker.addClass(o.classes)
  }
  if (o.withCloseButton) {
    $sticker
        .addClass('jq-stickr--closable')
        .prepend(
            $('<button class="jq-stickr__close"></button>')
                .click(function() {
                  close($sticker);
                }));
  }
  if (o.ttl > 0) {
    setTimeout(function() {
      close($sticker);
    }, o.ttl);
  }

  $stickers.append($sticker);
  if ($stickers.children().length > o.maxCount) {
    close($stickers.children().first());
  }

  if (typeof o.afterOpen === 'function') {
    // Dirty hack to be sure that browser has rendered $sticker element.
    // It is 5ms, because setTimeout(function() {}, 0) produces races and
    // sometimes timeout fires before $sticker element is rendered.
    // Also, window.requestAnimationFrame() solution is not used
    // due to bad browsers support at the moment.
    setTimeout(function() {
      o.afterOpen($sticker);
    }, 5);
  }

  return $sticker;
};


text:
from .health_evaluation import HealthEvaluation

class ApplicationHealthEvaluation(HealthEvaluation):
    """Represents health evaluation for an application, containing information
    about the data and the algorithm used by the health store to evaluate
    health.

    :param aggregated_health_state: Possible values include: 'Invalid', 'Ok',
     'Warning', 'Error', 'Unknown'
    :type aggregated_health_state: str or :class:`enum
     <azure.servicefabric.models.enum>`
    :param description: Description of the health evaluation, which represents
     a summary of the evaluation process.
    :type description: str
    :param kind: Polymorphic Discriminator
    :type kind: str
    :param application_name:
    :type application_name: str
    :param unhealthy_evaluations:
    :type unhealthy_evaluations: list of :class:`HealthEvaluationWrapper
     <azure.servicefabric.models.HealthEvaluationWrapper>`
    """

    _validation = {
        'kind': {'required': True},
    }

    _attribute_map = {
        'aggregated_health_state': {'key': 'AggregatedHealthState', 'type': 'str'},
        'description': {'key': 'Description', 'type': 'str'},
        'kind': {'key': 'Kind', 'type': 'str'},
        'application_name': {'key': 'ApplicationName', 'type': 'str'},
        'unhealthy_evaluations': {'key': 'UnhealthyEvaluations', 'type': '[HealthEvaluationWrapper]'},
    }

    def __init__(self, aggregated_health_state=None, description=None, application_name=None, unhealthy_evaluations=None):
        super(ApplicationHealthEvaluation, self).__init__(aggregated_health_state=aggregated_health_state, description=description)
        self.application_name = application_name
        self.unhealthy_evaluations = unhealthy_evaluations
        self.kind = 'Application'


text:
<?php

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration,
    Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your need!
 */
class Version20120806165106 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        // this up() migration is autogenerated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");

        $this->addSql("CREATE TABLE book_would_borrow (book_id INT NOT NULL, user_id INT NOT NULL, INDEX IDX_7ED804D216A2B381 (book_id), INDEX IDX_7ED804D2A76ED395 (user_id), PRIMARY KEY(book_id, user_id)) ENGINE = InnoDB");
        $this->addSql("CREATE TABLE book_would_buy (book_id INT NOT NULL, user_id INT NOT NULL, INDEX IDX_67D6BB5216A2B381 (book_id), INDEX IDX_67D6BB52A76ED395 (user_id), PRIMARY KEY(book_id, user_id)) ENGINE = InnoDB");
        $this->addSql("ALTER TABLE book_would_borrow ADD CONSTRAINT FK_7ED804D216A2B381 FOREIGN KEY (book_id) REFERENCES books (id) ON DELETE CASCADE");
        $this->addSql("ALTER TABLE book_would_borrow ADD CONSTRAINT FK_7ED804D2A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE");
        $this->addSql("ALTER TABLE book_would_buy ADD CONSTRAINT FK_67D6BB5216A2B381 FOREIGN KEY (book_id) REFERENCES books (id) ON DELETE CASCADE");
        $this->addSql("ALTER TABLE book_would_buy ADD CONSTRAINT FK_67D6BB52A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE");
    }

    public function down(Schema $schema)
    {
        // this down() migration is autogenerated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql");

        $this->addSql("DROP TABLE book_would_borrow");
        $this->addSql("DROP TABLE book_would_buy");
    }
}