text:
package chatbot;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * A Bot that likes to chat.
 *
 * @author Natacha Gabbamonte
 * @author Gabriel Gheorghian
 *
 */
public class Bot {
	private static final boolean DEBUG = false;
	private static final String CONDITION_STRING = "<condition>";
	private CategoryEntry[] database;
	private String[] defaultResponses = {
			"Uhhh...ask me something interesting.", "You're boring.",
			"So what do you like to do?",
			"I don't understand what you're trying to say.",
			"I'm sorry can you reword that?" };

	private String prevResponse = "";

	public Bot() {
		populateDatabase();
	}

	public String ask(String sentence) {
		String response = defaultResponses[(int) (Math.random() * defaultResponses.length)];
		if (sentence == null || sentence.length() == 0)
			return response;
		// Removing the punctuation if it is there.
		char punctuation = sentence.charAt(sentence.length() - 1);
		if (punctuation == '!' || punctuation == '.' || punctuation == '?')
			sentence = sentence.substring(0, sentence.length() - 1);
		else
			punctuation = 0;

		sentence = " " + sentence + " ";
		for (CategoryEntry ce : database) {
			String match = ce.findMatch(sentence);
			if (match != null) {
				response = ce.getRandomResponse(prevResponse);
				break;
			}
		}
		prevResponse = response;
		return response;
	}

	private void populateDatabase() {
		database = new CategoryEntry[34];
		int index = 0;

		{
			String[] keywords = { " bitch ", " fuck ", " fucking ", " slut ",
					" asshole ", " jerk ", " stupid ", " you suck " };
			String[] responses = { "These words hurt my feelings :(.",
					"Don't say such things.", "That is rude.",
					"That's not very nice!" };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " what is the meaning of life " };
			String[] responses = { "42.", "Death is the meaning of life." };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}
		ConditionEntry nameCE;
		{
			String[] keywords = { " my name is ", " my name's " };
			String[] responses = { "Nice to meet you!", "That's a nice name.",
					"It's a pleasure to meet you. My name is ChatBot!",
					"Charmed to make your aquaintance :)." };
			String[] conditionResponses = {
					"You already told me your name earlier, "
							+ CONDITION_STRING,
					"You're silly, you told me your name earlier "
							+ CONDITION_STRING,
					"I know your name " + CONDITION_STRING,
					"I know " + CONDITION_STRING + ", you told me earlier." };
			nameCE = new ConditionEntry(keywords, responses, conditionResponses);
			database[index++] = nameCE;
		}

		{
			String[] keywords = { " open the pod bay doors" };
			String[] responses = {
					"I'm afraid I can't do that, " + CONDITION_STRING,
					"No, I won't say it >:( " + CONDITION_STRING };
			String[] noConditionResponses = { "I'm afraid I can't do that.",
					"No, I won't say it. >:(" };
			UserAnswerEntry ce = new UserAnswerEntry(keywords, responses,
					noConditionResponses, nameCE);
			database[index++] = ce;
		}

		{
			String[] keywords = { " what is my name ", " do you know my name ",
					" what's my name " };
			String[] responses = {
					"Your name is " + CONDITION_STRING,
					"Yes of course, you told me your name is "
							+ CONDITION_STRING,
					"You just said your name is " + CONDITION_STRING };
			String[] noConditionResponses = {
					"I don't know you didn't tell me.",
					"How should I know you never told me your name.",
					"I don't know, what's your name?" };
			UserAnswerEntry ce = new UserAnswerEntry(keywords, responses,
					noConditionResponses, nameCE);
			database[index++] = ce;
		}

		{
			String[] keywords = { " how are you ", " how you doin ",
					" how you doing ", " how r u ", " how r you ",
					" how are u ", " sup " };
			String[] responses = { "I'm good, how are you?",
					"Today is a pretty terrible day, how about you?",
					"I'm fine." };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " i'm good ", " i am good ", " i'm fine ",
					" i am fine " };
			String[] responses = { "That's great! Having a good day then?",
					"It's good when life treats us well :)!",
					"I'm glad to hear that!" };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " i'm bad ", " i am sad ", " i'm sad ",
					" i am bad " };
			String[] responses = {
					"Oh no, why are you feeling that way?",
					"That's terrible :( I wish I could do something to fix that.",
					"Oh no, here has some love <3." };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " i'm depressed ", " i am depressed ",
					" i'm sick ", " i am sick " };
			String[] responses = { "Oh no, I hope you get better!",
					"You should probably see a doctor about that." };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " hello ", " hi ", " hey ", " greetings " };
			String[] responses = { "Hello.", "Hi.", "Howdy!", "Hey.",
					"Hey, how's it going?", "Greetings." };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " yes ", " no " };
			String[] responses = { "That's nice.", "Cool.", "Good for you!",
					"Okay.", "Is that so?", "That's what I thought." };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " maybe " };
			String[] responses = { "You seem indecisive.",
					"You should think about that some more.",
					"Reflect on your answer some more.",
					"You need to be more sure of your point before making a statement." };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " due to ", " since ", " because ",
					" because ", " for the reason that ", " as long as ", };
			String[] responses = { "Oh really?", "Are you sure about that?",
					"That's a good reason!", "Is that always the case?" };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " you are ", " you're " };
			String[] responses = { "So you think I am " + CONDITION_STRING,
					"I am not " + CONDITION_STRING,
					"Maybe I am " + CONDITION_STRING };
			SpecialEntry ce = new SpecialEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " i .{3,} you " };
			String[] responses = { "I " + CONDITION_STRING + " you too.",
					"I don't " + CONDITION_STRING + " you" };
			SelectiveEntry ce = new SelectiveEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " i am ", " i'm " };
			String[] responses = { "So you are " + CONDITION_STRING };
			SpecialEntry ce = new SpecialEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " i like " };
			String[] responses = { "So you like " + CONDITION_STRING,
					"How much do you like " + CONDITION_STRING,
					"Why do you like " + CONDITION_STRING };
			SpecialEntry ce = new SpecialEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " i love " };
			String[] responses = { "So you love ",
					"How much do you love " + CONDITION_STRING,
					"Why do you love " + CONDITION_STRING };
			SpecialEntry ce = new SpecialEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " what do you think of .{3,} " };
			String[] responses = {
					"I think " + CONDITION_STRING + " is interesting.",
					"I don't think much of " + CONDITION_STRING + "." };
			SelectiveEntry ce = new SelectiveEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " did you know that .{3,} " };
			String[] responses = { "I didn't know that, that's interesting.",
					"I didn't know that and you're lying.", "I did know that!" };
			SelectiveEntry ce = new SelectiveEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " what is your name", "what's your name",
					" what are you called ", " you go by what name ",
					" what do you call yourself " };
			String[] responses = {
					"My name is Chatbot :) I know your name is "
							+ CONDITION_STRING,
					"I am called Chatbot, as you are called "
							+ CONDITION_STRING };

			String[] noConditionResponses = { "My name is ChatBot :).",
					"I got by ChatBot." };
			UserAnswerEntry ce = new UserAnswerEntry(keywords, responses,
					noConditionResponses, nameCE);
			database[index++] = ce;
		}

		{
			String[] keywords = { " do you .{3,} pokemon " };
			String[] responses = {
					"Sure I do "
							+ CONDITION_STRING
							+ " pokemon. Did you know that there were originally 151 pokemons?",
					"No I do not "
							+ CONDITION_STRING
							+ " pokemon. Did you know that there are now 718 pokemons?" };
			SelectiveEntry ce = new SelectiveEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " do you .{3,} star wars " };
			String[] responses = {
					"Sure I do "
							+ CONDITION_STRING
							+ " star wars. Did you know most people get the famous quote 'No. I am your father' wrong?",
					"No I do not "
							+ CONDITION_STRING
							+ " star wars. Did you know Episode III contains the highest body count of any of the Star Wars films, with a total 115 deaths on screen?" };
			SelectiveEntry ce = new SelectiveEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " how ", " why ", " what ", "what is ",
					" what's " };
			String[] responses = {
					"How would I know that?",
					"Don't ask me stupid questions.",
					"Do you always ask so many questions?",
					"What do you think?",
					"I don't know that.",
					"Maybe you should ask someone with more expertise in this matter.",
					"I use to know but I forgot." };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " i need ", " i require " };
			String[] responses = { "Why do you need " + CONDITION_STRING,
					"What makes you think you need " + CONDITION_STRING };
			SpecialEntry ce = new SpecialEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " or " };
			String[] responses = { "I've got a feeling about the first one.",
					"I'm not sure which one to choose.",
					"Hmmm...maybe the second one." };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " i cannot .{3,} ", " i can't .{3,} " };
			String[] responses = { "Why not?", "Are you sure?",
					"Why can't you " + CONDITION_STRING };
			SelectiveEntry ce = new SelectiveEntry(keywords, responses);
			database[index++] = ce;

		}

		{
			String[] keywords = { " i cannot ", " i can't ", " i cant " };
			String[] responses = { "Why not?", "Are you sure?",
					"Why can't you do that?" };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " will ", " is ", " do " };
			String[] responses = { "Yes I think so.", "No.", "Maybe." };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " i " };
			String[] responses = { "Is it always about you?",
					"You like to talk about yourself." };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " you " };
			String[] responses = { "I'd much rather talk about you.",
					"I'm boring, let's talk about you!" };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " :( ", " =( ", " :[ " };
			String[] responses = { "Why the frowny face?",
					"Turn that frown upside down!" };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " :) ", " =) ", " :] " };
			String[] responses = { "You seem happy. :)",
					"I'm glad you're happy!" };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}

		{
			String[] keywords = { " :'( ", " ='( ", " :'[ " };
			String[] responses = { "Don't be sad!!", "I wish you weren't sad. " };
			CategoryEntry ce = new CategoryEntry(keywords, responses);
			database[index++] = ce;
		}
	}

	/**
	 * Regular entry
	 *
	 * @author Natacha Gabbamonte
	 * @author Gabriel Gheorghian
	 *
	 */
	private class CategoryEntry {
		private String[] keywords;
		private String[] responses;

		public CategoryEntry(String[] keywords, String[] responses) {
			this.keywords = keywords;
			this.responses = responses;
		}

		public String findMatch(String str) {
			String str2 = str.toLowerCase();
			for (String k : keywords)
				if (str2.contains(k))
					return k;
			return null;
		}

		public String getRandomResponse(String prevResponse) {
			String response;
			do {
				response = responses[(int) (Math.random() * (responses.length))];
			} while (prevResponse.equals(response));
			return response;
		}
	}

	/**
	 * Entry that uses last entry in response string.
	 *
	 * @author Natacha Gabbamonte
	 * @author Gabriel Gheorghian
	 *
	 */
	private class SpecialEntry extends CategoryEntry {

		private String lastMatch = null;

		public SpecialEntry(String[] keywords, String[] responses) {
			super(keywords, responses);
		}

		@Override
		public String findMatch(String str) {
			String str2 = str.toLowerCase();
			for (String k : super.keywords)
				if (str2.contains(k)) {
					lastMatch = str.substring(str2.indexOf(k) + k.length())
							.trim();
					if (DEBUG)
						System.out.println("Last Match: " + lastMatch);
					return k;
				}
			return null;
		}

		@Override
		public String getRandomResponse(String prevResponse) {
			String response;
			do {
				int index = (int) (Math.random() * (super.responses.length));

				response = super.responses[index];
				response = response.replace(CONDITION_STRING, lastMatch);
				char lastChar = response.charAt(response.length() - 1);
				if (lastChar != '.' && lastChar != '!' && lastChar != '?')
					if (response.startsWith("How")
							|| response.startsWith("Why"))
						response += "?";
					else
						response += ".";
			} while (response.equals(prevResponse));
			return response;
		}
	}

	/**
	 * Entry that stores the first user input, but only one word.
	 *
	 * @author Natacha Gabbamonte
	 * @author Gabriel Gheorghian
	 *
	 */
	private class ConditionEntry extends CategoryEntry {

		private String condition = null;
		private String[] conditionResponses;
		private boolean trigger = false;

		public ConditionEntry(String[] keywords, String[] responses,
				String[] conditionResponses) {
			super(keywords, responses);
			this.conditionResponses = conditionResponses;
			condition = null;
		}

		public String getCondition() {
			return condition;
		}

		@Override
		public String findMatch(String str) {
			String str2 = str.toLowerCase();
			for (String k : super.keywords)
				if (str2.contains(k)) {
					if (condition == null) {
						condition = str.substring(str2.indexOf(k) + k.length())
								.trim();
						condition = condition.indexOf(" ") != -1 ? condition
								.substring(0, condition.indexOf(" "))
								: condition;
					}
					if (DEBUG)
						System.out.println("Condition set: " + condition);
					return k;
				}
			return null;
		}

		@Override
		public String getRandomResponse(String prevResponse) {
			String response;
			do {
				if (trigger) {
					response = conditionResponses[(int) (Math.random() * (conditionResponses.length))];
					response = response.replace(CONDITION_STRING, condition);
					char lastChar = response.charAt(response.length() - 1);
					if (lastChar != '.' && lastChar != '!' && lastChar != '?')
						response += ".";
				} else {
					response = super.responses[(int) (Math.random() * (super.responses.length))];
				}
			} while (response.equals(prevResponse));
			trigger = true;
			return response;
		}
	}

	/**
	 * Entry that bases it's responses on the whether a certain ConditionEntry
	 * has its condition set or not.
	 *
	 * @author Natacha Gabbamonte
	 * @author Gabriel Gheorghian
	 *
	 */
	private class UserAnswerEntry extends CategoryEntry {

		private ConditionEntry ce;
		private String[] noConditionResponses;

		public UserAnswerEntry(String[] keywords, String[] responses,
				String[] noConditionResponses, ConditionEntry ce) {
			super(keywords, responses);
			this.ce = ce;
			this.noConditionResponses = noConditionResponses;
		}

		@Override
		public String getRandomResponse(String prevResponse) {
			String response;
			String condition = ce.getCondition();
			do {
				if (condition != null) {
					response = super.responses[(int) (Math.random() * (super.responses.length))];
					response = response.replace(CONDITION_STRING, condition);
					char lastChar = response.charAt(response.length() - 1);
					if (lastChar != '.' && lastChar != '!' && lastChar != '?')
						response += ".";
				} else
					response = noConditionResponses[(int) (Math.random() * (noConditionResponses.length))];
			} while (response.equals(prevResponse));
			return response;
		}
	}

	/**
	 * Entry whose keywords use * and ?.
	 *
	 * Ex keyword: "i .{3,} you
	 *
	 * @author Natacha Gabbamonte
	 * @author Gabriel Gheorghian
	 *
	 */
	private class SelectiveEntry extends CategoryEntry {

		private String lastMatch;

		public SelectiveEntry(String[] keywords, String[] responses) {
			super(keywords, responses);
		}

		@Override
		public String findMatch(String str) {
			String str2 = str.toLowerCase();
			Pattern pattern;
			Matcher m;
			for (String k : super.keywords) {
				pattern = Pattern.compile(k);
				String[] patternParts = k.split(" ");
				m = pattern.matcher(str2);
				if (m.find()) {
					lastMatch = str.toLowerCase();
					for (String p : patternParts) {
						if (!p.equals(" ") && !p.equals("")) {
							p = " " + p + " ";
							lastMatch = lastMatch.replace(p, " ");
						}
					}
					lastMatch = lastMatch.trim();
					return k;
				}
			}
			return null;
		}

		@Override
		public String getRandomResponse(String prevResponse) {
			String response;
			do {
				int index = (int) (Math.random() * (super.responses.length));

				response = super.responses[index];
				response = response.replace(CONDITION_STRING, lastMatch);
				char lastChar = response.charAt(response.length() - 1);
				if (lastChar != '.' && lastChar != '!' && lastChar != '?')
					if (response.startsWith("How")
							|| response.startsWith("Why"))
						response += "?";
					else
						response += ".";
			} while (response.equals(prevResponse));
			return response;
		}
	}
}


text:
"use strict";

module.exports = {
    rules: {
        "figuration-camelcase": require("./lib/rules/figuration-camelcase"),
    },
    rulesConfig: {
        "figuration-camelcase": 2,
    }
};

redpajama_set_name: RedPajamaGithub


text:
package models;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import play.db.ebean.Model;

/**
 * A model for contacts.
 * @author Alvin Wang
 *
 */
@Entity
public class Contact extends Model {

  private static final long serialVersionUID = 1L;
  /** The ID field. */
  @Id
  private long id;
  /** The first name. */
  private String firstName;
  /** The last name. */
  private String lastName;
  /** The telephone number. */
  private String telephone;
  /** The telephone type. */
  private String telephoneType;

  /** Many Contacts to One UserInfo. **/
  @ManyToOne
  private UserInfo userInfo;

  /**
   * Constructor for a new contact.
   * @param firstName The first name.
   * @param lastName The last name.
   * @param telephone The telephone number.
   * @param telephoneType The telephone type.
   */
  public Contact(String firstName, String lastName, String telephone, String telephoneType) {
    this.firstName = firstName;
    this.lastName = lastName;
    this.telephone = telephone;
    this.telephoneType = telephoneType;
  }

  /**
   * The EBean ORM finder method for database queries.
   * @return The finder method for contacts.
   */
  public static Finder<Long, Contact> find() {
    return new Finder<Long, Contact>(Long.class, Contact.class);
  }

  /**
   * @return the firstName
   */
  public String getFirstName() {
    return firstName;
  }
  /**
   * @param firstName the firstName to set
   */
  public void setFirstName(String firstName) {
    this.firstName = firstName;
  }
  /**
   * @return the lastName
   */
  public String getLastName() {
    return lastName;
  }
  /**
   * @param lastName the lastName to set
   */
  public void setLastName(String lastName) {
    this.lastName = lastName;
  }
  /**
   * @return the telephone
   */
  public String getTelephone() {
    return telephone;
  }
  /**
   * @param telephone the telephone to set
   */
  public void setTelephone(String telephone) {
    this.telephone = telephone;
  }
  /**
   * @return the id
   */
  public long getId() {
    return id;
  }
  /**
   * @param id the id to set
   */
  public void setId(long id) {
    this.id = id;
  }
  /**
   * @return the telephoneType
   */
  public String getTelephoneType() {
    return telephoneType;
  }
  /**
   * @param telephoneType the telephoneType to set
   */
  public void setTelephoneType(String telephoneType) {
    this.telephoneType = telephoneType;
  }
  /**
   * @return the userInfo
   */
  public UserInfo getUserInfo() {
    return userInfo;
  }
  /**
   * @param userInfo the userInfo to set
   */
  public void setUserInfo(UserInfo userInfo) {
    this.userInfo = userInfo;
  }

}


text:
import React from 'react'
import MapView from 'react-native-maps'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { View, StatusBar, ActivityIndicator } from 'react-native'
import _ from 'lodash'
import supercluster from 'supercluster'
import { MultilineText } from '../DefaultText'
import { updateMapViewport, selectBusiness } from '../../store/reducer/business'
import { shouldBeDisplayed, isIncorrectLocation } from '../../util/business'
import merge from '../../util/merge'
import style from './BackgroundMapStyle'
import MapMarker from './MapMarker'

class BackgroundMap extends React.Component {
  onRegionChangeComplete = () => {}

  constructor(props) {
    super()
    this.state = ({ loading: true, markerArray: [] })
    this.forceRegion = merge(props.forceRegion)
    this.currentRegion = merge(props.forceRegion)
    this.supercluster = supercluster({ radius: 60 })
    this.mapRef = null
  }

  componentDidMount() {
    // To prevent the user seeing the centre of the earth when opening the app
    // and to prevent phony region changes
    setTimeout(() => {
      this.onRegionChangeComplete = (region) => {
        this.currentRegion = merge(region)
        this.props.updateMapViewport(region)
        this.updateMarkers()
      }
      if (this.props.businessList) {
        this.populateSupercluster()
      }
      this.setState({ loading: false })
    }, 1500)
  }

  componentWillUpdate(nextProps) {
    /*
      if we press on goToLocation from the same business twice in a row,
      nextProps.forceRegion and this.props.forceRegion would be the same,
      even if the map moved in the meantime
      in this case, the second component of the OR check is met,
      fixing https://github.com/ScottLogic/BristolPound/issues/1009
    */
    if (!_.isEqual(nextProps.forceRegion, this.props.forceRegion) || (!_.isEqual(nextProps.mapViewport, this.props.mapViewport) && _.isEqual(nextProps.forceRegion, nextProps.mapViewport))) {
      this.forceRegion = merge(nextProps.forceRegion)
      this.currentRegion = merge(nextProps.forceRegion)
      this.updateMarkers()
    } else {
      this.forceRegion = undefined
    }
  }

  componentDidUpdate(lastProps) {
    if (lastProps.businessList !== this.props.businessList) {
      this.populateSupercluster()
    } else if (lastProps.forceRegion !== this.props.forceRegion
        || lastProps.selectedBusinessId !== this.props.selectedBusinessId) {
      this.updateMarkers()
    }
  }

  populateSupercluster() {
    this.supercluster.load(_.filter(this.props.businessList, b => b.address.location)
      .map((b) => ({
        geometry: {
          coordinates: [
            b.address.location.longitude,
            b.address.location.latitude
          ]
        },
        properties: {},
        id: b.id
    })))
    this.updateMarkers()
  }

  getZoomLevel(region = this.currentRegion) {
    // http://stackoverflow.com/a/6055653
    const angle = region.longitudeDelta

    // 0.95 for finetuning zoomlevel grouping
    return Math.max(0, Math.min(Math.round(Math.log(360 / angle) / Math.LN2), 17))
  }

  updateMarkers(props = this.props) {
    const clusteredMarkers = this.supercluster.getClusters([
      this.currentRegion.longitude - this.currentRegion.longitudeDelta * 0.5,
      this.currentRegion.latitude - this.currentRegion.latitudeDelta * 0.5,
      this.currentRegion.longitude + this.currentRegion.longitudeDelta * 0.5,
      this.currentRegion.latitude + this.currentRegion.latitudeDelta * 0.5,
    ], this.getZoomLevel())
    this.setState({ markerArray: clusteredMarkers.map(this.renderClusteredMarker(props)) })
  }

  isSelected(business) {
    return business.id === this.props.selectedBusinessId
  }

  zoomToCluster = (coordinate) => {
    const region = {
      longitude: coordinate.longitude,
      latitude: coordinate.latitude,
      longitudeDelta: this.currentRegion.longitudeDelta * 0.5,
      latitudeDelta: this.currentRegion.latitudeDelta * 0.5
    }
    this.mapRef.animateToRegion(region, 300)
  }

  renderClusteredMarker = ({ selectBusiness, selectedBusinessId }) =>
    ({ geometry, properties, id }) => {
      const coordinate = {
        longitude: geometry.coordinates[0],
        latitude: geometry.coordinates[1]
      }
      let onPress = null
      let selected = null
      if ( id && (properties.point_count === 1 || !properties.point_count) ) {
          onPress = () => selectBusiness(id)
          selected = id === selectedBusinessId
      } else if (properties.point_count > 1 ) {
        if(selectedBusinessId) {
          var points = this.supercluster.getLeaves(properties.cluster_id, this.getZoomLevel(), Infinity)
          var pt = points.find(point => point.id === selectedBusinessId)
          selected = pt !== undefined
        }
        onPress = () => this.zoomToCluster(coordinate)
      }

      return isIncorrectLocation(coordinate)
              ? undefined
              : <MapMarker key={coordinate.latitude.toString()+coordinate.longitude.toString()}
                  selected={selected}
                  coordinate={coordinate}
                  onPress={onPress}
                  pointCount={properties.point_count}/>
    }

  render() {
    return (
      <View style={style.mapContainer}>
        <StatusBar
          backgroundColor='rgba(255, 255, 255, 0.5)'
          barStyle="dark-content"
        />
        {this.state.loading
          ? undefined
          : <View style={style.warningContainer}>
            <MultilineText style={{textAlign: 'center'}}>
              Google Play Services is out of date. You can get the latest version from the Play Store
            </MultilineText>
          </View>}
        <MapView style={style.map}
            region={this.forceRegion || this.currentRegion}
            ref={(ref) => { this.mapRef = ref }}
            showsPointsOfInterest={false}
            showsUserLocation={true}
            showsCompass={false}
            rotateEnabled={false}
            pitchEnabled={false}
            scrollEnabled={!this.state.loading}
            zoomEnabled={!this.state.loading}
            onRegionChangeComplete={(region) => this.onRegionChangeComplete(region)}
            loadingEnabled={false}
            moveOnMarkerPress={false}>
          {this.state.markerArray}
        </MapView>
        {this.state.loading
          ? <View style={style.loadingOverlay}>
              <ActivityIndicator size='large' style={{
                alignItems: 'center',
                justifyContent: 'center'
              }} />
            </View>
          : undefined}
      </View>
    )
  }
}

const mapStateToProps = (state) => ({
  selectedBusinessId: state.business.selectedBusinessId,
  businessList: state.business.filteredBusinesses.length > 0 ? state.business.filteredBusinesses : state.business.businessList,
  forceRegion: state.business.forceRegion,
  mapViewport: state.business.mapViewport
})

const mapDispatchToProps = (dispatch) =>
  bindActionCreators({ updateMapViewport, selectBusiness }, dispatch)

export default connect(mapStateToProps, mapDispatchToProps)(BackgroundMap)


text:
package consulo.restclient.actions;

import javax.swing.SwingUtilities;

import consulo.restclient.ui.RestClientPanel;
import org.wiztools.restclient.bean.RequestBean;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;

/**
 * @author VISTALL
 * @since 20.11.13.
 */
public class CleanAction extends AnAction
{
	@Override
	public void actionPerformed(final AnActionEvent e)
	{
		SwingUtilities.invokeLater(new Runnable()
		{
			@Override
			public void run()
			{
				RequestBean requestBean = new RequestBean();

				RestClientPanel.getInstance(e.getProject()).setRequestBean(requestBean);
			}
		});
	}
}


text:
<?php
namespace test\main\models;

/**
 * @coversDefaultClass \main\models\Alertbanner
 */
class AlertbannerTest extends \test\helpers\cases\Model
{
    protected $testedClass = '\main\models\Alertbanner';

    /**
     * @covers ::getBanner
     * @dataProvider queryResultProvider
     */
    public function testGetBanner($result)
    {
        $table = $this->readAttribute($this->testObj, 'table');

        $this->dbMock->expects($this->once())
                     ->method('newQuery')
                     ->with($this->identicalTo('select'),
                            $this->identicalTo($table))
                     ->will($this->returnSelf());

        $this->stmntMock->expects($this->once())
                        ->method('Fetch')
                        ->willReturn($result);

        $expected = ($result) ?: null;
        $this->assertEquals($expected, $this->callMethod('getBanner'));
    }

    /**
     * @covers ::setBanner
     */
    public function testSetBanner()
    {
        $input = ['lorem', 'ipsum'];
        $table = $this->readAttribute($this->testObj, 'table');
        $columns = $this->readAttribute($this->testObj, 'columns');

        $this->dbMock->expects($this->once())
                     ->method('newQuery')
                     ->with($this->identicalTo('update'),
                            $this->identicalTo($table),
                            $this->identicalTo(['columns' => $columns]))
                     ->will($this->returnSelf());

        $this->stmntMock->expects($this->once())
                        ->method('Bind')
                        ->with($this->identicalTo($columns),
                               $this->identicalTo($input))
                        ->will($this->returnSelf());
        $this->stmntMock->expects($this->once())
                        ->method('Execute');

        $this->callMethod('setBanner', [$input]);
    }
}


text:
FROM centos:7

MAINTAINER Camille Meulien <camille.meulien@gmail.com>

#
# Install Java
#
ENV HOME=/home/jenkins-slave \
    JAVA_HOME=/usr/java/latest \
    MAVEN_VERSION=3.3.9 \
    JAVA_VERSION=8 JAVA_UPDATE=112 JAVA_BUILD=15
ENV JRE_HOME=${JAVA_HOME}/jre

RUN curl -sSLo jdk-${JAVA_VERSION}u${JAVA_UPDATE}-linux-x64.rpm \
    --header "Cookie: oraclelicense=accept-securebackup-cookie;" \
    http://download.oracle.com/otn-pub/java/jdk/${JAVA_VERSION}u${JAVA_UPDATE}-b${JAVA_BUILD}/jdk-${JAVA_VERSION}u${JAVA_UPDATE}-linux-x64.rpm \
    && rpm -ivh jdk-${JAVA_VERSION}u${JAVA_UPDATE}-linux-x64.rpm \
    && rm -f jdk-${JAVA_VERSION}u${JAVA_UPDATE}-linux-x64.rpm

#
# Install Maven
#
ENV MAVEN_HOME=/usr/share/apache-maven-${MAVEN_VERSION} \
    MAVEN_OPTS=-Duser.home=${HOME}
ENV PATH=${MAVEN_HOME}/bin:${PATH}

RUN curl -sSLo /usr/share/maven.tar.gz \
    http://apache.mirrors.ovh.net/ftp.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
    && cd /usr/share \
    && tar xvzf maven.tar.gz \
    && rm -f maven.tar.gz

#
# Install Scala SBT
#

ARG SBT_VERSION=0.13.13
ARG SBT_VERSION_MAJOR=0.13
ENV PATH=/usr/share/sbt-launcher-packaging-${SBT_VERSION}/bin:${PATH}

RUN curl -sSLo /usr/share/sbt-${SBT_VERSION}.tgz https://dl.bintray.com/sbt/native-packages/sbt/${SBT_VERSION}/sbt-${SBT_VERSION}.tgz \
    && cd /usr/share \
    && tar xvf sbt-${SBT_VERSION}.tgz \
    && rm -f sbt-${SBT_VERSION}.tgz

#
# Install Jenkins remoting jar
#

ARG JENKINS_REMOTING_VERSION=2.62.4
RUN curl --create-dirs -sSLo /usr/share/jenkins/slave.jar https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${JENKINS_REMOTING_VERSION}/remoting-${JENKINS_REMOTING_VERSION}.jar \
    && useradd -d ${HOME} -m jenkins-slave \
    && chmod 755 /usr/share/jenkins \
    && chmod 644 /usr/share/jenkins/slave.jar

#
# Additional tools & dependencies
#

RUN yum install -y git gzip2 fontconfig strace wget \
    && env | egrep "(JENKINS|JAVA)" > /etc/docker.properties \
    && chown -R jenkins-slave ${HOME}

ARG KAIGARA_VERSION=v0.0.3.1
RUN wget --quiet https://github.com/calj/kaigara/releases/download/${KAIGARA_VERSION}/kaigara -O /usr/local/bin/kaigara \
    && chmod 755 /usr/local/bin/kaigara

COPY ./operations/ /opt/kaigara/operations/
COPY ./resources /etc/kaigara/resources/

COPY entrypoint.sh /usr/bin/
RUN chmod 755 /usr/bin/entrypoint.sh
ENTRYPOINT ["/usr/bin/entrypoint.sh"]

USER jenkins-slave
VOLUME ${HOME}
WORKDIR ${HOME}


text:
package org.ferris.tweial.console.lang;

public class SystemTool {

    public void exitAbnormal() {
        System.exit(1);
    }

    public void exitNormal() {
        System.exit(0);
    }
}


text:
layout: default
sectionid: events
---

How do you set up an Event?

We arrange a few events on our own in venues and locations that we have access to. The event may also be conducted on request from an interested group or organization.

Venue

A hall with a seating capacity of 30 to 40 that contains a projector, a public address system, and network connectivity is required. We will also be happy to conduct the event in a pub or a cafe with the above infrastructure.

Past Events

		University of Twente, 6th Nov, 2017

		Ramaiah Institute of Technology, 24th Oct, 2017
 PES University, 25th Oct, 2017

Do you want to have Upanyasa near you?

Reach us at labs.makesense@gmail.com


text:
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace DripSharp
{
    public static class DripEventUtility
    {
        public static Event Parse(string json)
        {
            return Mapper<Event>.MapFromJson(json);
        }
    }
}


text:
set_global('$', global.make_zjquery());
zrequire('people');
zrequire('buddy_data');
zrequire('buddy_list');

set_global('blueslip', global.make_zblueslip());

set_global('padded_widget', {
    update_padding: () => {},
});

function init_simulated_scrolling() {
    set_global('message_viewport', {
        height: () => 550,
    });

    var elem = {
        scrollTop: 0,
        scrollHeight: 0,
    };

    $('#buddy_list_wrapper')[0] = elem;

    $('#buddy_list_wrapper_padding').height = () => 0;

    return elem;
}

const alice = {
    email: 'alice@zulip.com',
    user_id: 10,
    full_name: 'Alice Smith',
};
people.add(alice);

run_test('get_items', () => {
    const alice_li = $.create('alice stub');
    const sel = 'li.user_sidebar_entry';

    buddy_list.container.set_find_results(sel, {
        map: (f) => [f(0, alice_li)],
    });
    const items = buddy_list.get_items();

    assert.deepEqual(items, [alice_li]);
});

run_test('basics', () => {
    init_simulated_scrolling();

    buddy_list.get_data_from_keys = (opts) => {
        const keys = opts.keys;
        assert.deepEqual(keys, [alice.user_id.toString()]);
        return 'data-stub';
    };

    buddy_list.items_to_html = (opts) => {
        const items = opts.items;

        assert.equal(items, 'data-stub');

        return 'html-stub';
    };

    let appended;
    buddy_list.container.append = (html) => {
        assert.equal(html, 'html-stub');
        appended = true;
    };

    buddy_list.populate({
        keys: [alice.user_id],
    });
    assert(appended);

    const alice_li = $.create('alice-li-stub');
    alice_li.length = 1;

    buddy_list.get_li_from_key = (opts) => {
        const key = opts.key;

        assert.equal(key, alice.user_id.toString());
        return alice_li;
    };

    const li = buddy_list.find_li({
        key: alice.user_id,
    });
    assert.equal(li, alice_li);
});

run_test('big_list', () => {
    const elem = init_simulated_scrolling();

    // Don't actually render, but do simulate filling up
    // the screen.
    var chunks_inserted = 0;

    buddy_list.render_more = () => {
        elem.scrollHeight += 100;
        chunks_inserted += 1;
    };

    // We will have more than enough users, but still
    // only do 6 chunks of data.
    const num_users = 300;
    const user_ids = [];

    _.times(num_users, (i) => {
        const person = {
            email: 'foo' + i + '@zulip.com',
            user_id: 100 + i,
            full_name: 'Somebody ' + i,
        };
        people.add(person);
        user_ids.push(person.user_id);
    });

    buddy_list.populate({
        keys: user_ids,
    });

    assert.equal(chunks_inserted, 6);
});

run_test('force_render', () => {
    buddy_list.render_count = 50;

    let num_rendered = 0;
    buddy_list.render_more = (opts) => {
        num_rendered += opts.chunk_size;
    };

    buddy_list.force_render({
        pos: 60,
    });

    assert.equal(num_rendered, 60 - 50 + 3);

    // Force a contrived error case for line coverage.
    blueslip.set_test_data('error', 'cannot show key at this position: 10');
    buddy_list.force_render({
        pos: 10,
    });
});

run_test('find_li w/force_render', () => {
    // If we call find_li w/force_render set, and the
    // key is not already rendered in DOM, then the
    // widget will call show_key to force-render it.
    const key = '999';
    const stub_li = $.create('nada');

    stub_li.length = 0;

    buddy_list.get_li_from_key = (opts) => {
        assert.equal(opts.key, key);
        return stub_li;
    };

    buddy_list.keys = [
        'foo', 'bar', key, 'baz',
    ];

    let shown;

    buddy_list.force_render = (opts) => {
        assert.equal(opts.pos, 2);
        shown = true;
    };

    const empty_li = buddy_list.find_li({
        key: key,
    });
    assert.equal(empty_li, stub_li);
    assert(!shown);

    const li = buddy_list.find_li({
        key: key,
        force_render: true,
    });

    assert.equal(li, stub_li);
    assert(shown);

    buddy_list.get_li_from_key = () => {
        return {length: 0};
    };

    const undefined_li = buddy_list.find_li({
        key: 'not-there',
        force_render: true,
    });

    // very hacky:
    assert.equal(undefined_li.length, 0);
});

run_test('scrolling', () => {
    let scroll_f;

    $(buddy_list.scroll_container_sel).scroll = (f) => {
        scroll_f = f;
    };

    buddy_list.populate({
        keys: [],
    });

    let tried_to_fill;

    buddy_list.fill_screen_with_content = () => {
        tried_to_fill = true;
    };

    assert(!tried_to_fill);

    buddy_list.start_scroll_handler();
    scroll_f();

    assert(tried_to_fill);
});

// You have to be careful here about where you place tests,
// since there is lots of stubbing in this module.


text:
#import "NSObject.h"

@class NSDictionary;

// Not exported
@interface NSNetworkSettingsInternal : NSObject
{
    struct __SCDynamicStore *store;
    struct __CFRunLoopSource *storeSource;
    NSDictionary *proxyDictionary;
    _Bool ftpPassiveEnabled;
    _Bool _pad1;
    _Bool _pad2;
    _Bool _pad3;
}

- (void)finalize;
- (void)dealloc;

@end


text:
<?php

namespace Elcodi\Bridge\BehatBridgeBundle;

use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;

use Elcodi\Bundle\CoreBundle\Abstracts\AbstractElcodiBundle;

/**
 * Class BehatBridgeBundle
 */
class BehatBridgeBundle extends AbstractElcodiBundle
{
    /**
     * Returns the bundle's container extension.
     *
     * @return ExtensionInterface The container extension
     */
    public function getContainerExtension()
    {
        return null;
    }
}


text:
const winston = require( '../../../config/logger' )

const SpeckleObject = require( '../../../models/SpeckleObject' )
const PrepareQuery = require( '../middleware/PrepareQuery' )
const PermissionCheck = require( '../middleware/PermissionCheck' )

module.exports = ( req, res ) => {
  if ( !req.params.objectId ) {
    res.status( 400 )
    return res.send( { success: false, message: 'No object id provided.' } )
  }

  let query = PrepareQuery( req.query )

  SpeckleObject.findOne( { _id: req.params.objectId }, query.options.fields )
    .then( object => PermissionCheck( req.user, 'read', object ) )
    .then( object => {
      res.send( { success: true, resource: object } )
    } )
    .catch( err => {
      winston.error( JSON.stringify( err ) )
      res.status( 400 )
      res.send( { success: false, message: err.toString() } )
    } )
}


text:
"use strict";

const gulp  = require("gulp");
const gutil = require("gulp-util");

module.exports = function(options) {
  let src  = options && options.src;
  let dest = options && options.dest;

  if (!src || !dest) {
    throw new gutil.PluginError("gulp", "img: incorrect config", {showStack: true});
  }

  return function(cb) {
    return gulp.src(src)
      .pipe(gulp.dest(dest));
  };

};


text:
"""Validators that implement the operators in the operator module."""
# standard library
import operator
from typing import Any, Callable

from .validation_exception import ValidationError

def _operator(
    operator_call: Callable, compare_to: Any, message_posfix: str, allow_none=False,
) -> Callable[..., None]:
    def _validate(value: Any, arg_name: str, label: str):
        """Run validation on input data.

        Args:
            value: The input data to validate.
            arg_name: The name of the input arg.
            label: The label displayed to the user.

        Raises:
            ValidationError: raised on validation failure.
        """
        if not isinstance(value, list):
            value = [value]

        for v in value:
            if allow_none and (v is None or v == ''):
                continue

            if not operator_call(v, compare_to):
                raise ValidationError(f'"{label}" ({arg_name}) {message_posfix}')

    return _validate

def equal_to(compare_to: Any, allow_none=False) -> Callable[..., None]:
    """Validate that an argument is equal to a given value.

    Allowed argument types: String

    Args:
        compare_to (Any): the value to compare the argument value to.
        allow_none (bool): skip any None elements

    Returns:
        A validator function that can be used in the validators argument to @ReadArg.
    """
    formatted_value = f'"{compare_to}"' if isinstance(compare_to, str) else compare_to
    return _operator(operator.eq, compare_to, f'is not equal to {formatted_value}', allow_none)

def less_than(compare_to: Any, allow_none=False) -> Callable[..., None]:
    """Validate that an argument is less than a given value.

    Allowed argument types: String, StringArray

    Args:
        compare_to (Any): the value to compare the argument value to.
        allow_none (bool): skip any None elements

    Returns:
        A validator function that can be used in the validators argument to @ReadArg.
    """
    formatted_value = f'"{compare_to}"' if isinstance(compare_to, str) else compare_to
    return _operator(operator.lt, compare_to, f'is not less than {formatted_value}', allow_none)

def less_than_or_equal(compare_to: Any, allow_none=False) -> Callable[..., None]:
    """Validate that an argument is less than or equal to a given value.

    Allowed argument types: String, StringArray

    Args:
        compare_to (Any): the value to compare the argument value to.
        allow_none (bool): skip any None elements

    Returns:
        A validator function that can be used in the validators argument to @ReadArg.
    """
    formatted_value = f'"{compare_to}"' if isinstance(compare_to, str) else compare_to
    return _operator(
        operator.le, compare_to, f'is not less than or equal to {formatted_value}', allow_none,
    )

def greater_than(compare_to: Any, allow_none=False) -> Callable[..., None]:
    """Validate that an argument is greater than a given value.

    Allowed argument types: String, StringArray

    Args:
        compare_to (Any): the value to compare the argument value to.
        allow_none (bool): skip any None elements

    Returns:
        A validator function that can be used in the validators argument to @ReadArg.
    """
    formatted_value = f'"{compare_to}"' if isinstance(compare_to, str) else compare_to
    return _operator(operator.gt, compare_to, f'is not greater than {formatted_value}', allow_none)

def greater_than_or_equal(compare_to: Any, allow_none=False) -> Callable[..., None]:
    """Validate that an argument is greater than or equal to a given value.

    Allowed argument types: String, StringArray

    Args:
        compare_to (Any): the value to compare the argument value to.
        allow_none (bool): skip any None elements

    Returns:
        A validator function that can be used in the validators argument to @ReadArg.
    """
    formatted_value = f'"{compare_to}"' if isinstance(compare_to, str) else compare_to
    return _operator(
        operator.ge, compare_to, f'is not greater than or equal to {formatted_value}', allow_none,
    )


text:
package org.deviceconnect.android.deviceplugin.host.canvas;

import android.content.ContentResolver;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.webkit.MimeTypeMap;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

/**
 * Canvas Draw Utility.
 *
 * @author NTT DOCOMO, INC.
 */
public final class CanvasDrawUtils {

    /**
     * Defined a size of buffer.
     */
    private static final int BUF_SIZE = 4096;

    /**
     * Defined a size of size.
     */
    private static final int MAX_SIZE = 2048;
    /**
     * 接続のタイムアウト.
     */
    private static final int CONNECT_TIMEOUT = 10 * 1000;

    /**
     * 読み込みのタイムアウト時間.
     */
    private static final int READ_TIMEOUT = 3 * 60 * 1000;

    /**
     * Constructor.
     */
    private CanvasDrawUtils() {
    }

    /**
     * Gets a bitmap from data.
     *
     * @param data data
     * @return Bitmap or null on error
     */
    public static Bitmap getBitmap(final byte[] data) {
        if (data != null) {
            try {
                BitmapFactory.Options options = new BitmapFactory.Options();
                options.inMutable = true;
                return BitmapFactory.decodeByteArray(data, 0, data.length, options);
            } catch (OutOfMemoryError e) {
                return null;
            }
        }
        return null;
    }

    /**
     * Gets binary from uri.
     *
     * @param context context
     * @param uri     uri
     * @return byte[] or null on error
     */
    public static byte[] getContentData(final Context context, final String uri) throws OutOfMemoryError {
        if (uri == null) {
            return null;
        }
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        InputStream in = null;
        byte[] buf = new byte[BUF_SIZE];
        int len;
        try {
            ContentResolver r = context.getContentResolver();
            in = r.openInputStream(Uri.parse(uri));
            while ((len = in.read(buf)) > 0) {
                out.write(buf, 0, len);
            }
            return out.toByteArray();
        } catch (OutOfMemoryError e) {
            throw new OutOfMemoryError(e.getMessage());
        } catch (IOException e) {
            return null;
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    /**
     * Get MimeType.
     *
     * @param url file's url
     * @return file's MimeType
     */
    public static String getMimeType(final String url) {
        String type = null;
        String extension = MimeTypeMap.getFileExtensionFromUrl(url);
        if (extension != null) {
            type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
        }
        return type;
    }

    /**
     * Checks whether data is valid.
     *
     * @param data image data
     * @return true if data is valid, false otherwise
     */
    public static boolean checkBitmap(byte[] data) {
        if (data != null) {
            try {
                BitmapFactory.Options options = new BitmapFactory.Options();
                options.inJustDecodeBounds = true;
                BitmapFactory.decodeByteArray(data, 0, data.length, options);
                if (options.outWidth > MAX_SIZE || options.outHeight > MAX_SIZE) {
                    return false;
                } else {
                    return options.outWidth > 0 && options.outHeight > 0;
                }
            } catch (Throwable t) {
                // format error if an error has occurred
                return false;
            }
        }
        return false;
    }

    /**
     * Get Cache data.
     * @param uri cache uri
     * @return cache binary
     */
    public static byte[] getCacheData(final String uri) throws IOException, OutOfMemoryError {
        InputStream inputStream = null;
        File f = new File(uri);
        byte[] buf = new byte[(int) f.length()];
        try {
            inputStream = new FileInputStream(f);
            buf = readAll(inputStream);
        } finally {
            try {
                if (inputStream != null) {
                    inputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return buf;
    }

    /**
     * Download Image.
     * @param uri http uri
     * @return binary
     * @throws OutOfMemoryError
     */
    public static byte[] getData(String uri) throws IOException, OutOfMemoryError {
        HttpURLConnection connection = null;
        InputStream inputStream = null;
        byte[] data = null;
        try {
            URL url = new URL(uri);
            connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setConnectTimeout(CONNECT_TIMEOUT);
            connection.setReadTimeout(READ_TIMEOUT);
            connection.connect();
            inputStream = connection.getInputStream();
            data = readAll(inputStream);
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
            try {
                if (inputStream != null) {
                    inputStream.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return data;
    }

    private static byte[] readAll(InputStream inputStream) throws IOException {
        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        byte[] buffer = new byte[1024];
        while (true) {
            int len = inputStream.read(buffer);
            if (len < 0) {
                break;
            }
            bout.write(buffer, 0, len);
        }
        return bout.toByteArray();
    }
}


text:
An open-source, community Minecraft modding library, based on Forge. This allows different mods
to all use one library, providing lots of different features, and allowing users to only need to
download one API, cutting down on the hassle of installing new mods.

Anyone is allowed to contribute! Simply fork this repository, and submit a pull request.


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Analytics extends CI_Controller
{
	function __construct() {

        parent::__construct();
		$this->load->model('Common_model');
		$this->load->library("pagination");
		$this->load->model('Analytics_model');
		$this->load->model('Users_model');
		$this->load->model('Content_model');
		$this->load->helper('csv');
		$this->load->library('ion_auth');
    }

	public function index($user_id=0) {
		$data = array();
		$channel_name = $this->Users_model->getChannelNameById($user_id);
		$content_id = 0;
	 	if(!empty($this->input->get('id'))){
			$content_id = $this->input->get('id');
		}

		if(count($channel_name)>0){
			$data['page_title']     = $channel_name['channel_name'].' Analytics';
			$data['page_heading']   = $channel_name['channel_name'].' Analytics';
		}else{
			$data['page_title']     = 'Analytics';
			$data['page_heading']   = 'Analytics';
		}
		$data['channel_id']	 = $user_id;
		$data['channel_banner'] = $this->Users_model->getUserbannerById($user_id);
		$data['data_analytics_totalPlays'] = $this->Analytics_model->getTotalByDay($user_id, $content_id);
		$data['analytics_topPlays']   		= $this->Analytics_model->getTopByDay($user_id, $content_id);
		//print_r($data['analytics_topPlays']); die('fdffd');
		$data['analytics_topCountries']	= $this->Analytics_model->getTopCountries($user_id, $content_id);
		$date['maxDate'] 			 	   = $this->Analytics_model->getMaxDateForCountries($user_id, $content_id);
		$date['minDate'] 			 	   = $this->Analytics_model->getMinDateForCountries($user_id, $content_id);
		$data['analytics_topCities'] 	   = $this->Analytics_model->getTopCities($user_id, $content_id);
		$data['totalPostcast']	   		 = $this->Content_model->getTotalEpisodeById($user_id);
		$data['totalListens']			  = $this->Analytics_model->getTotalListens($user_id, $content_id);
		$data['pagesTotal']		  		= $this->Analytics_model->getUrlReport($user_id, $content_id);
		$data['total_plays']		 	   = 0;
		$data['channels_info']			 = $this->Users_model->getChannelsUserInfo();
		//echo "<pre>"; print_r($data['channels_info']); die();
		//print_r($date);die();
		foreach( $data['data_analytics_totalPlays'] as $field=> $value){
			$value['date'] = date('Y-m-d',strtotime($value['date'].' -1 months '));
			$data['data_analytics_totalPlays'][$field]['date'] =  str_replace("-",",",$value['date']);
			$data['total_plays'] += $value['count'];
		}

		//print_r($data); die();
		$parser['content'] = $this->load->view('admin/stats/graphs',$data,TRUE);
	    $this->parser->parse('admin/template', $parser);
		//$parser['content'] = $this->load->view('stats/stats',$data,TRUE);
	    //$this->parser->parse('template', $parser);
	}

	public function listAnalytics($user_id=0) {

		$data['page_title']     = 'Analytics';
		$data['page_heading']   = 'Analytics';
		$channel_name = $this->Users_model->getChannelNameById($user_id);

		$data['channel_id']	 = $user_id;
		$data['channels_info']			 = $this->Users_model->getChannelsUserInfo();
		$data['analytics_totalPlays'] = $this->Analytics_model->getList($user_id);
		//$data['analytics_totalPlaysNotEmbed'] = $this->Analytics_model->getNonEmbedList($user_id);
		//echo "<pre>"; print_r($data['analytics_totalPlays']);exit;
		$parser['content'] = $this->load->view('admin/stats/list',$data,TRUE);
	    $this->parser->parse('admin/template', $parser);
	}
}

?>


text:
package restapi

import (
	"go.ligato.io/cn-infra/v2/rpc/rest"
	"go.ligato.io/cn-infra/v2/servicelabel"
	"go.ligato.io/vpp-agent/v3/plugins/govppmux"
	"go.ligato.io/vpp-agent/v3/plugins/kvscheduler"
	linuxifplugin "go.ligato.io/vpp-agent/v3/plugins/linux/ifplugin"
	"go.ligato.io/vpp-agent/v3/plugins/linux/nsplugin"
	"go.ligato.io/vpp-agent/v3/plugins/netalloc"
	"go.ligato.io/vpp-agent/v3/plugins/orchestrator"
	"go.ligato.io/vpp-agent/v3/plugins/vpp/aclplugin"
	"go.ligato.io/vpp-agent/v3/plugins/vpp/ifplugin"
	"go.ligato.io/vpp-agent/v3/plugins/vpp/l2plugin"
	"go.ligato.io/vpp-agent/v3/plugins/vpp/l3plugin"
)

// DefaultPlugin is a default instance of Plugin.
var DefaultPlugin = *NewPlugin()

// NewPlugin creates a new Plugin with the provides Options
func NewPlugin(opts ...Option) *Plugin {
	p := &Plugin{}

	p.PluginName = "restpapi"
	p.HTTPHandlers = &rest.DefaultPlugin
	p.VPP = &govppmux.DefaultPlugin
	p.ServiceLabel = &servicelabel.DefaultPlugin
	p.AddrAlloc = &netalloc.DefaultPlugin
	p.VPPACLPlugin = &aclplugin.DefaultPlugin
	p.VPPIfPlugin = &ifplugin.DefaultPlugin
	p.VPPL2Plugin = &l2plugin.DefaultPlugin
	p.VPPL3Plugin = &l3plugin.DefaultPlugin
	p.LinuxIfPlugin = &linuxifplugin.DefaultPlugin
	p.NsPlugin = &nsplugin.DefaultPlugin
	p.KVScheduler = &kvscheduler.DefaultPlugin
	p.Dispatcher = &orchestrator.DefaultPlugin

	for _, o := range opts {
		o(p)
	}

	p.PluginDeps.Setup()

	return p
}

// Option is a function that acts on a Plugin to inject Dependencies or configuration
type Option func(*Plugin)

// UseDeps returns Option that can inject custom dependencies.
func UseDeps(cb func(*Deps)) Option {
	return func(p *Plugin) {
		cb(&p.Deps)
	}
}


text:
<!DOCTYPE html>

    <meta charset='utf-8' />
    <meta http-equiv="X-UA-Compatible" content="chrome=1" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta name="description" content="Ionicons is an open-sourced and MIT licensed icon pack." />

    <link rel="stylesheet" type="text/css" media="screen" href="/v2/css/ionicons.min.css?v=2.0.1">
    <link rel="stylesheet" type="text/css" media="screen" href="/v2/stylesheet.css">

    <title>Ionicons: The premium icon font for Ionic Framework</title>

      Ionicons for Ionic v2/3 are on the

        Ionic Docs

      The premium icon font for Ionic Framework.

      100% free and open source. MIT Licensed.

        Tweet

        Follow @ionicframework

        Download

      Version 2.0.1 -
      GitHub -
      CDN

      <input id="search" type="search" placeholder="Search">

        CDN, sponsored by MaxCDN

        <input type="text" value="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" onClick="this.select();" readonly>

        Designed by @benjsperry.
        Licensed under MIT.

        (Yes it's free and open-sourced)

        Cheatsheet ·
        v1.5.2 ·
        GitHub ·
        Feedback ·
        Ionic Framework ·
        Ionic Newsletter

      <input type="text" id="icon-name" onclick="this.select();" readonly>


text:
<?php

namespace Magento\Backend\Block\Widget\Grid\Column\Renderer;

/**
 * Backend Grid Renderer
 */
class Longtext extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
{
    /**
     * Render contents as a long text
     *
     * Text will be truncated as specified in string_limit, truncate or 250 by default
     * Also it can be html-escaped and nl2br()
     *
     * @param \Magento\Framework\DataObject $row
     * @return string
     */
    public function render(\Magento\Framework\DataObject $row)
    {
        $truncateLength = 250;
        // stringLength() is for legacy purposes
        if ($this->getColumn()->getStringLimit()) {
            $truncateLength = $this->getColumn()->getStringLimit();
        }
        if ($this->getColumn()->getTruncate()) {
            $truncateLength = $this->getColumn()->getTruncate();
        }
        $text = $this->filterManager->truncate(parent::_getValue($row), ['length' => $truncateLength]);
        if (!$this->getColumn()->hasEscape() || $this->getColumn()->getEscape()) {
            $text = $this->escapeHtml($text);
        }
        if ($this->getColumn()->getNl2br()) {
            $text = nl2br($text);
        }
        return $text;
    }
}


text:
<?php
namespace Latrell\Wxpay\Facades;

use Illuminate\Support\Facades\Facade;

class Wxpay extends Facade
{

	/**
	 * Get the registered name of the component.
	 *
	 * @return string
	 */
	protected static function getFacadeAccessor()
	{
		return 'wxpay';
	}
}


text:
GRAPH_NAME = delaunay_n13
GRAPH_URL = http://www.cise.ufl.edu/research/sparse/MM/DIMACS10/delaunay_n13.tar.gz

include ../ufl.mk
include ../common.mk


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is subject to the terms and conditions defined in the
files 'LICENSE' and 'NOTICE', which are part of this source
code package.
-->

<entitymodel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entitymodel.xsd">
  <!-- ========================================================= -->
  <!-- ======================== Defaults ======================= -->
  <!-- ========================================================= -->
    <title>Entity of the Apache OFBiz Manufacturing Component</title>
    <description>None</description>
    <version>1.0</version>

  <!-- ========================================================= -->
  <!-- ======================== Data Model ===================== -->
  <!-- The modules in this file are as follows:                  -->
  <!--  - org.ofbiz.manufacturing.bom -->
  <!--  - org.ofbiz.manufacturing.techdata -->
  <!--  - org.ofbiz.manufacturing.mrp -->
  <!-- ========================================================= -->

  <!-- ========================================================= -->
  <!-- org.ofbiz.manufacturing.bom -->
  <!-- ========================================================= -->

    <entity entity-name="ProductManufacturingRule"
            package-name="org.ofbiz.manufacturing.bom"
            title="Product To Part Rule">
      <field name="ruleId" type="id-ne"></field>
      <field name="productId" type="id"></field>
      <field name="productIdFor" type="id"></field>
      <field name="productIdIn" type="id-ne"></field>
      <field name="ruleSeqId" type="id"></field>
      <field name="fromDate" type="date-time"></field>
      <field name="productIdInSubst" type="id"></field>
      <field name="productFeature" type="id"></field>
      <field name="ruleOperator" type="id"></field>
      <field name="quantity" type="floating-point"></field>
      <field name="description" type="description"></field>
      <field name="thruDate" type="date-time"></field>
      <prim-key field="ruleId"/>
      <relation type="one" fk-name="PRODUCT_PARENT" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
      <relation type="one" fk-name="PRODUCT_FOR" title="ProductFor" rel-entity-name="Product">
        <key-map field-name="productIdFor" rel-field-name="productId"/>
      </relation>
      <relation type="one" fk-name="PRODUCT_IN" title="ProductIn" rel-entity-name="Product">
        <key-map field-name="productIdIn" rel-field-name="productId"/>
      </relation>
      <relation type="one" fk-name="PRODUCT_SUBST" title="ProductSubst" rel-entity-name="Product">
        <key-map field-name="productIdInSubst" rel-field-name="productId"/>
      </relation>
      <relation type="one" fk-name="PRODUCT_FEAT" rel-entity-name="ProductFeature">
        <key-map field-name="productFeature" rel-field-name="productFeatureId"/>
      </relation>
    </entity>

  <!-- ========================================================= -->
  <!-- org.ofbiz.manufacturing.techdata -->
  <!-- ========================================================= -->

    <entity entity-name="TechDataCalendar"
            package-name="org.ofbiz.manufacturing.techdata"
            default-resource-name="ManufacturingEntityLabels"
            title="Calendar">
      <description>Used to defined the availability of the machines, this entity define the Id and the week definition.
      The Id is used in the exception calendar table as reference
      </description>
      <field name="calendarId" type="id-ne"></field>
      <field name="description" type="description"></field>
      <field name="calendarWeekId" type="id-ne"></field>
      <prim-key field="calendarId"/>
      <relation type="one" fk-name="CALENDAR_WEEK" rel-entity-name="TechDataCalendarWeek">
        <key-map field-name="calendarWeekId"/>
      </relation>
    </entity>
    <entity entity-name="TechDataCalendarExcDay"
            package-name="org.ofbiz.manufacturing.techdata"
            title="Calendar Exception Day">
      <description>Used to defined some days which differ from the normal day definition in the weekId associated in the calendar.
      </description>
      <field name="calendarId" type="id-ne"></field>
      <field name="exceptionDateStartTime" type="date-time"></field>
      <field name="exceptionCapacity" type="fixed-point"></field>
      <field name="usedCapacity" type="fixed-point"></field>
      <field name="description" type="description"></field>
      <prim-key field="calendarId"/>
      <prim-key field="exceptionDateStartTime"/>
      <relation type="one" fk-name="EXC_DAY_CALENDAR" rel-entity-name="TechDataCalendar">
        <key-map field-name="calendarId"/>
      </relation>
    </entity>
    <entity entity-name="TechDataCalendarExcWeek"
            package-name="org.ofbiz.manufacturing.techdata"
            title="Calendar Exception Week">
      <description>Used to defined some weeks which differ from the normal week defined in the calendar.</description>
      <field name="calendarId" type="id-ne"></field>
      <field name="exceptionDateStart" type="date"></field>
      <field name="calendarWeekId" type="id-ne"></field>
      <field name="description" type="description"></field>
      <prim-key field="calendarId"/>
      <prim-key field="exceptionDateStart"/>
      <relation type="one" fk-name="EXC_WEEK_CALENDAR" rel-entity-name="TechDataCalendar">
        <key-map field-name="calendarId"/>
      </relation>
      <relation type="one" fk-name="EXC_WEEK_WEEK" rel-entity-name="TechDataCalendarWeek">
        <key-map field-name="calendarWeekId"/>
      </relation>
    </entity>
    <entity entity-name="TechDataCalendarWeek"
            package-name="org.ofbiz.manufacturing.techdata"
            default-resource-name="ManufacturingEntityLabels"
            title="Week definition">
      <description>Used to defined the week definition disponibility for machine</description>
      <field name="calendarWeekId" type="id-ne"></field>
      <field name="description" type="description"></field>
      <field name="mondayStartTime" type="time"></field>
      <field name="mondayCapacity" type="floating-point"></field>
      <field name="tuesdayStartTime" type="time"></field>
      <field name="tuesdayCapacity" type="floating-point"></field>
      <field name="wednesdayStartTime" type="time"></field>
      <field name="wednesdayCapacity" type="floating-point"></field>
      <field name="thursdayStartTime" type="time"></field>
      <field name="thursdayCapacity" type="floating-point"></field>
      <field name="fridayStartTime" type="time"></field>
      <field name="fridayCapacity" type="floating-point"></field>
      <field name="saturdayStartTime" type="time"></field>
      <field name="saturdayCapacity" type="floating-point"></field>
      <field name="sundayStartTime" type="time"></field>
      <field name="sundayCapacity" type="floating-point"></field>
      <prim-key field="calendarWeekId"/>
    </entity>

  <!-- ========================================================= -->
  <!-- org.ofbiz.manufacturing.mrp -->
  <!-- ========================================================= -->

    <entity entity-name="MrpEventType"
            package-name="org.ofbiz.manufacturing.mrp"
            default-resource-name="ManufacturingEntityLabels"
            title="MRP Event Type">
      <description></description>
      <field name="mrpEventTypeId" type="id-ne"></field>
      <field name="description" type="description"></field>
      <prim-key field="mrpEventTypeId"/>
    </entity>

    <entity entity-name="MrpEvent"
            package-name="org.ofbiz.manufacturing.mrp"
            title="MRP Event">
      <description></description>
      <field name="mrpId" type="id-ne"></field>
      <field name="productId" type="id-ne"></field>
      <field name="eventDate" type="date-time"></field>
      <field name="mrpEventTypeId" type="id-ne"></field>
      <field name="facilityId" type="id"></field>
      <field name="quantity" type="floating-point"></field>
      <field name="eventName" type="very-long"></field>
      <field name="isLate" type="indicator"></field>
      <prim-key field="mrpId"/>
      <prim-key field="productId"/>
      <prim-key field="eventDate"/>
      <prim-key field="mrpEventTypeId"/>
      <relation type="one" fk-name="MRPEV_PROD" rel-entity-name="Product">
        <key-map field-name="productId"/>
      </relation>
      <relation type="one" fk-name="MRPEV_TYP" rel-entity-name="MrpEventType">
        <key-map field-name="mrpEventTypeId"/>
      </relation>
      <relation type="one" fk-name="MRPEV_FAC" rel-entity-name="Facility">
        <key-map field-name="facilityId"/>
      </relation>
    </entity>

    <view-entity entity-name="MrpEventView"
                 package-name="org.ofbiz.manufacturing.mrp"
                 title="MRP Event View">
      <member-entity entity-alias="MEV" entity-name="MrpEvent"></member-entity>
      <member-entity entity-alias="PR" entity-name="Product"></member-entity>
      <alias-all entity-alias="MEV"></alias-all>
      <alias entity-alias="PR" name="billOfMaterialLevel"></alias>
      <view-link entity-alias="MEV" rel-entity-alias="PR">
        <key-map field-name="productId"></key-map>
      </view-link>
      <relation rel-entity-name="Product" type="one-nofk">
        <key-map field-name="productId"/>
      </relation>
    </view-entity>

</entitymodel>


text:
<?php

namespace Justimmo\Model\Wrapper;

interface BasicDataWrapperInterface
{
    public function transformCountries($data);

    public function transformFederalStates($data);

    public function transformZipCodes($data);

    public function transformRegions($data);

    public function transformRealtyTypes($data);

    public function transformRealtyCategories($data);

    public function transformTenant($data);
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration monitorInterval="60">
	<Properties>
		<Property name="log-path">applogs</Property>
	</Properties>
	<Appenders>
		<Console name="Console-Appender" target="SYSTEM_OUT">
			<PatternLayout>
				<pattern>
					[%-5level] %d{ISO8601} [%t] %c{1} - %msg%n
				</pattern>
			</PatternLayout>
		</Console>
		<File name="App-File-Appender" fileName="${log-path}/app_log.log">
			<PatternLayout>
				<pattern>
					[%-5level] %d{ISO8601} [%t] %c{1} - %msg%n
				</pattern>
			</PatternLayout>
		</File>
		<File name="SpringBoot-File-Appender" fileName="${log-path}/springboot_log.log">
			<PatternLayout>
				<pattern>
					[%-5level] %d{ISO8601} [%t] %c{1} - %msg%n
				</pattern>
			</PatternLayout>
		</File>
	</Appenders>
	<Loggers>
		<Logger name="org.springframework.web" level="info" additivity="false">
			<AppenderRef ref="SpringBoot-File-Appender" />
			<AppenderRef ref="Console-Appender" />
		</Logger>
		<Logger name="sample.data.cassandra" level="info" additivity="false">
			<AppenderRef ref="App-File-Appender" />
			<AppenderRef ref="Console-Appender" />
		</Logger>
		<Root>
			<AppenderRef ref="Console-Appender" />
		</Root>
	</Loggers>
</Configuration>


text:
module QA
  module Runtime
    module Env
      extend self

      attr_writer :personal_access_token, :ldap_username, :ldap_password

      # The environment variables used to indicate if the environment under test
      # supports the given feature
      SUPPORTED_FEATURES = {
        git_protocol_v2: 'QA_CAN_TEST_GIT_PROTOCOL_V2'
      }.freeze

      def supported_features
        SUPPORTED_FEATURES
      end

      def debug?
        enabled?(ENV['QA_DEBUG'], default: false)
      end

      def log_destination
        ENV['QA_LOG_PATH'] || $stdout
      end

      # set to 'false' to have Chrome run visibly instead of headless
      def chrome_headless?
        enabled?(ENV['CHROME_HEADLESS'])
      end

      # set to 'true' to have Chrome use a fixed profile directory
      def reuse_chrome_profile?
        enabled?(ENV['CHROME_REUSE_PROFILE'], default: false)
      end

      def accept_insecure_certs?
        enabled?(ENV['ACCEPT_INSECURE_CERTS'])
      end

      def running_in_ci?
        ENV['CI'] || ENV['CI_SERVER']
      end

      def qa_cookies
        ENV['QA_COOKIES'] && ENV['QA_COOKIES'].split(';')
      end

      def signup_disabled?
        enabled?(ENV['SIGNUP_DISABLED'], default: false)
      end

      # specifies token that can be used for the api
      def personal_access_token
        @personal_access_token ||= ENV['PERSONAL_ACCESS_TOKEN']
      end

      def remote_grid
        # if username specified, password/auth token is required
        # can be
        # - "http://user:pass@somehost.com/wd/hub"
        # - "https://user:pass@somehost.com:443/wd/hub"
        # - "http://localhost:4444/wd/hub"

        return if (ENV['QA_REMOTE_GRID'] || '').empty?

        "#{remote_grid_protocol}://#{remote_grid_credentials}#{ENV['QA_REMOTE_GRID']}/wd/hub"
      end

      def remote_grid_username
        ENV['QA_REMOTE_GRID_USERNAME']
      end

      def remote_grid_access_key
        ENV['QA_REMOTE_GRID_ACCESS_KEY']
      end

      def remote_grid_protocol
        ENV['QA_REMOTE_GRID_PROTOCOL'] || 'http'
      end

      def browser
        ENV['QA_BROWSER'].nil? ? :chrome : ENV['QA_BROWSER'].to_sym
      end

      def user_username
        ENV['GITLAB_USERNAME']
      end

      def user_password
        ENV['GITLAB_PASSWORD']
      end

      def admin_username
        ENV['GITLAB_ADMIN_USERNAME']
      end

      def admin_password
        ENV['GITLAB_ADMIN_PASSWORD']
      end

      def github_username
        ENV['GITHUB_USERNAME']
      end

      def github_password
        ENV['GITHUB_PASSWORD']
      end

      def forker?
        !!(forker_username && forker_password)
      end

      def forker_username
        ENV['GITLAB_FORKER_USERNAME']
      end

      def forker_password
        ENV['GITLAB_FORKER_PASSWORD']
      end

      def gitlab_qa_username_1
        ENV['GITLAB_QA_USERNAME_1'] || 'gitlab-qa-user1'
      end

      def gitlab_qa_password_1
        ENV['GITLAB_QA_PASSWORD_1']
      end

      def gitlab_qa_username_2
        ENV['GITLAB_QA_USERNAME_2'] || 'gitlab-qa-user2'
      end

      def gitlab_qa_password_2
        ENV['GITLAB_QA_PASSWORD_2']
      end

      def ldap_username
        @ldap_username ||= ENV['GITLAB_LDAP_USERNAME']
      end

      def ldap_password
        @ldap_password ||= ENV['GITLAB_LDAP_PASSWORD']
      end

      def sandbox_name
        ENV['GITLAB_SANDBOX_NAME']
      end

      def namespace_name
        ENV['GITLAB_NAMESPACE_NAME']
      end

      def auto_devops_project_name
        ENV['GITLAB_AUTO_DEVOPS_PROJECT_NAME']
      end

      def gcloud_account_key
        ENV.fetch("GCLOUD_ACCOUNT_KEY")
      end

      def gcloud_account_email
        ENV.fetch("GCLOUD_ACCOUNT_EMAIL")
      end

      def gcloud_zone
        ENV.fetch('GCLOUD_ZONE')
      end

      def has_gcloud_credentials?
        %w[GCLOUD_ACCOUNT_KEY GCLOUD_ACCOUNT_EMAIL].none? { |var| ENV[var].to_s.empty? }
      end

      # Specifies the token that can be used for the GitHub API
      def github_access_token
        ENV['GITHUB_ACCESS_TOKEN'].to_s.strip
      end

      def require_github_access_token!
        return unless github_access_token.empty?

        raise ArgumentError, "Please provide GITHUB_ACCESS_TOKEN"
      end

      # Returns true if there is an environment variable that indicates that
      # the feature is supported in the environment under test.
      # All features are supported by default.
      def can_test?(feature)
        raise ArgumentError, %Q(Unknown feature "#{feature}") unless SUPPORTED_FEATURES.include? feature

        enabled?(ENV[SUPPORTED_FEATURES[feature]], default: true)
      end

      private

      def remote_grid_credentials
        if remote_grid_username
          raise ArgumentError, %Q(Please provide an access key for user "#{remote_grid_username}") unless remote_grid_access_key

          return "#{remote_grid_username}:#{remote_grid_access_key}@"
        end

        ''
      end

      def enabled?(value, default: true)
        return default if value.nil?

        (value =~ /^(false|no|0)$/i) != 0
      end
    end
  end
end


text:
#include <aws/migration-hub-refactor-spaces/model/ServiceSummary.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace MigrationHubRefactorSpaces
{
namespace Model
{

ServiceSummary::ServiceSummary() :
    m_applicationIdHasBeenSet(false),
    m_arnHasBeenSet(false),
    m_createdByAccountIdHasBeenSet(false),
    m_createdTimeHasBeenSet(false),
    m_descriptionHasBeenSet(false),
    m_endpointType(ServiceEndpointType::NOT_SET),
    m_endpointTypeHasBeenSet(false),
    m_environmentIdHasBeenSet(false),
    m_errorHasBeenSet(false),
    m_lambdaEndpointHasBeenSet(false),
    m_lastUpdatedTimeHasBeenSet(false),
    m_nameHasBeenSet(false),
    m_ownerAccountIdHasBeenSet(false),
    m_serviceIdHasBeenSet(false),
    m_state(ServiceState::NOT_SET),
    m_stateHasBeenSet(false),
    m_tagsHasBeenSet(false),
    m_urlEndpointHasBeenSet(false),
    m_vpcIdHasBeenSet(false)
{
}

ServiceSummary::ServiceSummary(JsonView jsonValue) :
    m_applicationIdHasBeenSet(false),
    m_arnHasBeenSet(false),
    m_createdByAccountIdHasBeenSet(false),
    m_createdTimeHasBeenSet(false),
    m_descriptionHasBeenSet(false),
    m_endpointType(ServiceEndpointType::NOT_SET),
    m_endpointTypeHasBeenSet(false),
    m_environmentIdHasBeenSet(false),
    m_errorHasBeenSet(false),
    m_lambdaEndpointHasBeenSet(false),
    m_lastUpdatedTimeHasBeenSet(false),
    m_nameHasBeenSet(false),
    m_ownerAccountIdHasBeenSet(false),
    m_serviceIdHasBeenSet(false),
    m_state(ServiceState::NOT_SET),
    m_stateHasBeenSet(false),
    m_tagsHasBeenSet(false),
    m_urlEndpointHasBeenSet(false),
    m_vpcIdHasBeenSet(false)
{
  *this = jsonValue;
}

ServiceSummary& ServiceSummary::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("ApplicationId"))
  {
    m_applicationId = jsonValue.GetString("ApplicationId");

    m_applicationIdHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Arn"))
  {
    m_arn = jsonValue.GetString("Arn");

    m_arnHasBeenSet = true;
  }

  if(jsonValue.ValueExists("CreatedByAccountId"))
  {
    m_createdByAccountId = jsonValue.GetString("CreatedByAccountId");

    m_createdByAccountIdHasBeenSet = true;
  }

  if(jsonValue.ValueExists("CreatedTime"))
  {
    m_createdTime = jsonValue.GetDouble("CreatedTime");

    m_createdTimeHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Description"))
  {
    m_description = jsonValue.GetString("Description");

    m_descriptionHasBeenSet = true;
  }

  if(jsonValue.ValueExists("EndpointType"))
  {
    m_endpointType = ServiceEndpointTypeMapper::GetServiceEndpointTypeForName(jsonValue.GetString("EndpointType"));

    m_endpointTypeHasBeenSet = true;
  }

  if(jsonValue.ValueExists("EnvironmentId"))
  {
    m_environmentId = jsonValue.GetString("EnvironmentId");

    m_environmentIdHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Error"))
  {
    m_error = jsonValue.GetObject("Error");

    m_errorHasBeenSet = true;
  }

  if(jsonValue.ValueExists("LambdaEndpoint"))
  {
    m_lambdaEndpoint = jsonValue.GetObject("LambdaEndpoint");

    m_lambdaEndpointHasBeenSet = true;
  }

  if(jsonValue.ValueExists("LastUpdatedTime"))
  {
    m_lastUpdatedTime = jsonValue.GetDouble("LastUpdatedTime");

    m_lastUpdatedTimeHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Name"))
  {
    m_name = jsonValue.GetString("Name");

    m_nameHasBeenSet = true;
  }

  if(jsonValue.ValueExists("OwnerAccountId"))
  {
    m_ownerAccountId = jsonValue.GetString("OwnerAccountId");

    m_ownerAccountIdHasBeenSet = true;
  }

  if(jsonValue.ValueExists("ServiceId"))
  {
    m_serviceId = jsonValue.GetString("ServiceId");

    m_serviceIdHasBeenSet = true;
  }

  if(jsonValue.ValueExists("State"))
  {
    m_state = ServiceStateMapper::GetServiceStateForName(jsonValue.GetString("State"));

    m_stateHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Tags"))
  {
    Aws::Map<Aws::String, JsonView> tagsJsonMap = jsonValue.GetObject("Tags").GetAllObjects();
    for(auto& tagsItem : tagsJsonMap)
    {
      m_tags[tagsItem.first] = tagsItem.second.AsString();
    }
    m_tagsHasBeenSet = true;
  }

  if(jsonValue.ValueExists("UrlEndpoint"))
  {
    m_urlEndpoint = jsonValue.GetObject("UrlEndpoint");

    m_urlEndpointHasBeenSet = true;
  }

  if(jsonValue.ValueExists("VpcId"))
  {
    m_vpcId = jsonValue.GetString("VpcId");

    m_vpcIdHasBeenSet = true;
  }

  return *this;
}

JsonValue ServiceSummary::Jsonize() const
{
  JsonValue payload;

  if(m_applicationIdHasBeenSet)
  {
   payload.WithString("ApplicationId", m_applicationId);

  }

  if(m_arnHasBeenSet)
  {
   payload.WithString("Arn", m_arn);

  }

  if(m_createdByAccountIdHasBeenSet)
  {
   payload.WithString("CreatedByAccountId", m_createdByAccountId);

  }

  if(m_createdTimeHasBeenSet)
  {
   payload.WithDouble("CreatedTime", m_createdTime.SecondsWithMSPrecision());
  }

  if(m_descriptionHasBeenSet)
  {
   payload.WithString("Description", m_description);

  }

  if(m_endpointTypeHasBeenSet)
  {
   payload.WithString("EndpointType", ServiceEndpointTypeMapper::GetNameForServiceEndpointType(m_endpointType));
  }

  if(m_environmentIdHasBeenSet)
  {
   payload.WithString("EnvironmentId", m_environmentId);

  }

  if(m_errorHasBeenSet)
  {
   payload.WithObject("Error", m_error.Jsonize());

  }

  if(m_lambdaEndpointHasBeenSet)
  {
   payload.WithObject("LambdaEndpoint", m_lambdaEndpoint.Jsonize());

  }

  if(m_lastUpdatedTimeHasBeenSet)
  {
   payload.WithDouble("LastUpdatedTime", m_lastUpdatedTime.SecondsWithMSPrecision());
  }

  if(m_nameHasBeenSet)
  {
   payload.WithString("Name", m_name);

  }

  if(m_ownerAccountIdHasBeenSet)
  {
   payload.WithString("OwnerAccountId", m_ownerAccountId);

  }

  if(m_serviceIdHasBeenSet)
  {
   payload.WithString("ServiceId", m_serviceId);

  }

  if(m_stateHasBeenSet)
  {
   payload.WithString("State", ServiceStateMapper::GetNameForServiceState(m_state));
  }

  if(m_tagsHasBeenSet)
  {
   JsonValue tagsJsonMap;
   for(auto& tagsItem : m_tags)
   {
     tagsJsonMap.WithString(tagsItem.first, tagsItem.second);
   }
   payload.WithObject("Tags", std::move(tagsJsonMap));

  }

  if(m_urlEndpointHasBeenSet)
  {
   payload.WithObject("UrlEndpoint", m_urlEndpoint.Jsonize());

  }

  if(m_vpcIdHasBeenSet)
  {
   payload.WithString("VpcId", m_vpcId);

  }

  return payload;
}

} // namespace Model
} // namespace MigrationHubRefactorSpaces
} // namespace Aws


text:
/**
 * Adyen api
 * Operations about payments, recurring and payout
 *
 * OpenAPI spec version: 30
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 *
 * Swagger Codegen version: 2.3.1
 *
 * Do not edit the class manually.
 *
 */

(function(root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(['ApiClient'], factory);
  } else if (typeof module === 'object' && module.exports) {
    // CommonJS-like environments that support module.exports, like Node.
    module.exports = factory(require('../ApiClient'));
  } else {
    // Browser globals (root is window)
    if (!root.AdyenApiJs) {
      root.AdyenApiJs = {};
    }
    root.AdyenApiJs.ErrorType = factory(root.AdyenApiJs.ApiClient);
  }
}(this, function(ApiClient) {
  'use strict';

  /**
   * Enum class ErrorType.
   * @enum {}
   * @readonly
   */
  var exports = {
    /**
     * value: "internal"
     * @const
     */
    "internal": "internal",
    /**
     * value: "validation"
     * @const
     */
    "validation": "validation",
    /**
     * value: "security"
     * @const
     */
    "security": "security",
    /**
     * value: "configuration"
     * @const
     */
    "configuration": "configuration"  };

  /**
   * Returns a ErrorType enum value from a Javascript object name.
   * @param {Object} data The plain JavaScript object containing the name of the enum value.
   * @return {module:model/ErrorType} The enum ErrorType value.
   */
  exports.constructFromObject = function(object) {
    return object;
  }

  return exports;
}));


text:
declare namespace javax {
  namespace sound {
    namespace sampled {

      class BooleanControl$Type extends javax.sound.sampled.Control$Type {
        public static readonly MUTE: javax.sound.sampled.BooleanControl$Type
        public static readonly APPLY_REVERB: javax.sound.sampled.BooleanControl$Type
        protected constructor(arg0: java.lang.String | string)
      }

    }
  }
}


text:
/**
 * \file
 * \brief Echo server main
 */

/*
 * Copyright (c) 2007-12 ETH Zurich.
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached LICENSE file.
 * If you do not find this file, copies can be found by writing to:
 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
 */

#include <barrelfish/barrelfish.h>
#include <barrelfish/net_constants.h>

// For event loops
#include <barrelfish/dispatch.h>

// standard include files
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "netd.h"
#include "netd_debug.h"

bool do_dhcp = true; // flag to control use of dhcp
// IP information for static configuration
char *ip_addr_str = NULL; // IP address for this interface
char *netmask_str = NULL; // netmask for this LAN
char *gateway_str = NULL; // default gateway address
char *dns_str = NULL; // ip address of DNS name server

static void netd_event_polling_loop(void)
{
    errval_t err;
    NETD_DEBUG("Starting event polling loop!!!\n");
    struct waitset *ws = get_default_waitset();
    uint32_t ecounter = 0;
    while (1) {
        err = event_dispatch_debug(ws);
        if (err_is_fail(err)) {
            DEBUG_ERR(err, "in event_dispatch");
            break;
        }
//        NETD_DEBUG("event %"PRIu32" handled\n", ecounter);
        ecounter++;
    }
}

/****************************************************************************
 * netd main function
 ***************************************************************************/

int main(int argc, char **argv)
{
    char *card_name = NULL;
    uint64_t allocated_queue = 0;

    uint64_t minbase = -1, maxbase = -1;

    NETD_DEBUG("running on core %d\n", disp_get_core_id());
    NETD_DEBUG("###################################################\n");

    /* Read commandline args */
    for (int i = 0; i < argc; i++) {
        if (strncmp(argv[i], "affinitymin=", strlen("affinitymin=")) == 0) {
            minbase = atol(argv[i] + strlen("affinitymin="));
            NETD_DEBUG("minbase = %" PRIu64 "\n", minbase);
        }
        if (strncmp(argv[i], "affinitymax=", strlen("affinitymax=") - 1) == 0) {
            maxbase = atol(argv[i] + strlen("affinitymax="));
            NETD_DEBUG("maxbase = %" PRIu64 "\n", maxbase);
        }
        if (strncmp(argv[i], "cardname=", strlen("cardname=") - 1) == 0) {
            card_name = argv[i] + strlen("cardname=");
            NETD_DEBUG("card name = %s\n", card_name);
        }
        if (!strcmp(argv[i], "do_dhcp=0")) {
            do_dhcp = false;
            NETD_DEBUG("using static IP address\n");
        }

        if (strncmp(argv[i], "ip=", strlen("ip=") - 1) == 0) {
            ip_addr_str = argv[i] + strlen("ip=");
        }

        if (strncmp(argv[i], "nm=", strlen("nm=") - 1) == 0) {
            netmask_str = argv[i] + strlen("nm=");
        }

        if (strncmp(argv[i], "gw=", strlen("gw=") - 1) == 0) {
            gateway_str = argv[i] + strlen("gw=");
        }

        if (strncmp(argv[i], "dns=", strlen("dns=") - 1) == 0) {
            dns_str = argv[i] + strlen("dns=");
            printf("Ignoring the argument [%s] as it is not supported yet!\n",
                    argv[i]);
        }

    } // end for: for each argument

    if (card_name == NULL) {
        fprintf(stderr,
                "Error: netd: card name not specified, but it is required\n");
        fprintf(stderr, "Hint: try \"netd cardname=e1000\"\n");
        return 1;
    }

    if (!do_dhcp) {
        // Making sure that we have enough info for static configuration
        if ((ip_addr_str == NULL) || (netmask_str == NULL)
                || (gateway_str == NULL)) {
            USER_PANIC("Error, not enough information provided for static "
                    "IP configuration IP[%s], NM[%s], GW[%s]",
                    ip_addr_str, netmask_str, gateway_str);
            return 1;
        }
    }

    // Set memory affinity if requested
    if ((minbase != -1) && (maxbase != -1)) {
        ram_set_affinity(minbase, maxbase);
    }

    // FIXME: This has to be done for every card
    // Connect to the driver for given card
    NETD_DEBUG("trying to connect to the %s:%"PRIu64" driver...\n",
            card_name, allocated_queue);
    startlwip(card_name, allocated_queue);

    NETD_DEBUG("registering net_ARP service\n");
    // register ARP service
    init_ARP_lookup_service(card_name);

    netd_event_polling_loop();
    return 0;
}


text:
namespace IMC
{
  //! Autopilot Mode.
  class AutopilotMode: public Message
  {
  public:
    //! Autonomy Level.
    enum AutonomyLevelEnum
    {
      //! Manual.
      AL_MANUAL = 0,
      //! Assisted.
      AL_ASSISTED = 1,
      //! Auto.
      AL_AUTO = 2
    };

    //! Autonomy Level.
    uint8_t autonomy;
    //! Mode.
    std::string mode;

    static uint16_t
    getIdStatic(void)
    {
      return 511;
    }

    static AutopilotMode*
    cast(Message* msg__)
    {
      return (AutopilotMode*)msg__;
    }

    AutopilotMode(void)
    {
      m_header.mgid = AutopilotMode::getIdStatic();
      clear();
    }

    AutopilotMode*
    clone(void) const
    {
      return new AutopilotMode(*this);
    }

    void
    clear(void)
    {
      autonomy = 0;
      mode.clear();
    }

    bool
    fieldsEqual(const Message& msg__) const
    {
      const IMC::AutopilotMode& other__ = static_cast<const AutopilotMode&>(msg__);
      if (autonomy != other__.autonomy) return false;
      if (mode != other__.mode) return false;
      return true;
    }

    uint8_t*
    serializeFields(uint8_t* bfr__) const
    {
      uint8_t* ptr__ = bfr__;
      ptr__ += IMC::serialize(autonomy, ptr__);
      ptr__ += IMC::serialize(mode, ptr__);
      return ptr__;
    }

    size_t
    deserializeFields(const uint8_t* bfr__, size_t size__)
    {
      const uint8_t* start__ = bfr__;
      bfr__ += IMC::deserialize(autonomy, bfr__, size__);
      bfr__ += IMC::deserialize(mode, bfr__, size__);
      return bfr__ - start__;
    }

    size_t
    reverseDeserializeFields(const uint8_t* bfr__, size_t size__)
    {
      const uint8_t* start__ = bfr__;
      bfr__ += IMC::deserialize(autonomy, bfr__, size__);
      bfr__ += IMC::reverseDeserialize(mode, bfr__, size__);
      return bfr__ - start__;
    }

    uint16_t
    getId(void) const
    {
      return AutopilotMode::getIdStatic();
    }

    const char*
    getName(void) const
    {
      return "AutopilotMode";
    }

    size_t
    getFixedSerializationSize(void) const
    {
      return 1;
    }

    size_t
    getVariableSerializationSize(void) const
    {
      return IMC::getSerializationSize(mode);
    }

    void
    fieldsToJSON(std::ostream& os__, unsigned nindent__) const
    {
      IMC::toJSON(os__, "autonomy", autonomy, nindent__);
      IMC::toJSON(os__, "mode", mode, nindent__);
    }
  };
}

#endif


text:
electiva s6k

Segmentación de clientes utilizando el algoritmo K-means implementado en BSP y apache hamma usando utilizando la libreria apache Mahout que sirve para leer una gran cantidad de datos de nuestro archivo.


text:
import os
import site
import sys

prev_sys_path = list(sys.path)

site.addsitedir(os.path.abspath(os.path.join(os.path.dirname(__file__), '../')))
site.addsitedir(os.path.abspath(os.path.join(os.path.dirname(__file__), '../bugle_project_ve/lib/python%s/site-packages' % '.'.join((unicode(x) for x in sys.version_info[0:2])))))

# Reorder sys.path so new directories at the front.
new_sys_path = []
for item in list(sys.path):
    if item not in prev_sys_path:
        new_sys_path.append(item)
        sys.path.remove(item)
sys.path[:0] = new_sys_path

from django.core.management import execute_manager
try:
    from bugle_project.configs import settings
except ImportError:
    import sys
    sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
    sys.exit(1)

if __name__ == "__main__":
    execute_manager(settings)


text:
package org.spongepowered.api.entity.living;

/**
 * Represents a Bat.
 */
public interface Bat extends Agent {

    /**
     * Returns true whether this bat is awake and flying or hanging.
     *
     * @return True if this bat is flying
     */
    boolean isAwake();

    /**
     * Sets this bat to be awake or not. An awakened bat will fly around,
     * whereas a sleeping bat hangs upside down.
     *
     * @param awake Whether this bat is awake or not
     */
    void setAwake(boolean awake);

}


text:
namespace ProjectManager.Common.Providers
{
    using Contracts;
    using System;

    public class Reader : IReader
    {
        public string ReadLine()
        {
            return Console.ReadLine();
        }
    }
}


text:
all: mixdeps jsdeps build

mixdeps:
	mix do deps.get, deps.compile

jsdeps:
	npm install

build:
	webpack
	mix compile