text:
package org.springframework.boot.actuate.metrics;

import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.function.BiFunction;
import java.util.stream.Collectors;

import io.micrometer.core.instrument.Meter;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Statistic;
import io.micrometer.core.instrument.Tag;
import io.micrometer.core.instrument.composite.CompositeMeterRegistry;

import org.springframework.boot.actuate.endpoint.InvalidEndpointRequestException;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.annotation.Selector;
import org.springframework.lang.Nullable;

/**
 * An {@link Endpoint @Endpoint} for exposing the metrics held by a {@link MeterRegistry}.
 *
 * @author Jon Schneider
 * @author Phillip Webb
 * @since 2.0.0
 */
@Endpoint(id = "metrics")
public class MetricsEndpoint {

	private final MeterRegistry registry;

	public MetricsEndpoint(MeterRegistry registry) {
		this.registry = registry;
	}

	@ReadOperation
	public ListNamesResponse listNames() {
		Set<String> names = new TreeSet<>();
		collectNames(names, this.registry);
		return new ListNamesResponse(names);
	}

	private void collectNames(Set<String> names, MeterRegistry registry) {
		if (registry instanceof CompositeMeterRegistry compositeMeterRegistry) {
			compositeMeterRegistry.getRegistries().forEach((member) -> collectNames(names, member));
		}
		else {
			registry.getMeters().stream().map(this::getName).forEach(names::add);
		}
	}

	private String getName(Meter meter) {
		return meter.getId().getName();
	}

	@ReadOperation
	public MetricResponse metric(@Selector String requiredMetricName, @Nullable List<String> tag) {
		List<Tag> tags = parseTags(tag);
		Collection<Meter> meters = findFirstMatchingMeters(this.registry, requiredMetricName, tags);
		if (meters.isEmpty()) {
			return null;
		}
		Map<Statistic, Double> samples = getSamples(meters);
		Map<String, Set<String>> availableTags = getAvailableTags(meters);
		tags.forEach((t) -> availableTags.remove(t.getKey()));
		Meter.Id meterId = meters.iterator().next().getId();
		return new MetricResponse(requiredMetricName, meterId.getDescription(), meterId.getBaseUnit(),
				asList(samples, Sample::new), asList(availableTags, AvailableTag::new));
	}

	private List<Tag> parseTags(List<String> tags) {
		if (tags == null) {
			return Collections.emptyList();
		}
		return tags.stream().map(this::parseTag).collect(Collectors.toList());
	}

	private Tag parseTag(String tag) {
		String[] parts = tag.split(":", 2);
		if (parts.length != 2) {
			throw new InvalidEndpointRequestException(
					"Each tag parameter must be in the form 'key:value' but was: " + tag,
					"Each tag parameter must be in the form 'key:value'");
		}
		return Tag.of(parts[0], parts[1]);
	}

	private Collection<Meter> findFirstMatchingMeters(MeterRegistry registry, String name, Iterable<Tag> tags) {
		if (registry instanceof CompositeMeterRegistry compositeMeterRegistry) {
			return findFirstMatchingMeters(compositeMeterRegistry, name, tags);
		}
		return registry.find(name).tags(tags).meters();
	}

	private Collection<Meter> findFirstMatchingMeters(CompositeMeterRegistry composite, String name,
			Iterable<Tag> tags) {
		return composite.getRegistries().stream().map((registry) -> findFirstMatchingMeters(registry, name, tags))
				.filter((matching) -> !matching.isEmpty()).findFirst().orElse(Collections.emptyList());
	}

	private Map<Statistic, Double> getSamples(Collection<Meter> meters) {
		Map<Statistic, Double> samples = new LinkedHashMap<>();
		meters.forEach((meter) -> mergeMeasurements(samples, meter));
		return samples;
	}

	private void mergeMeasurements(Map<Statistic, Double> samples, Meter meter) {
		meter.measure().forEach((measurement) -> samples.merge(measurement.getStatistic(), measurement.getValue(),
				mergeFunction(measurement.getStatistic())));
	}

	private BiFunction<Double, Double, Double> mergeFunction(Statistic statistic) {
		return Statistic.MAX.equals(statistic) ? Double::max : Double::sum;
	}

	private Map<String, Set<String>> getAvailableTags(Collection<Meter> meters) {
		Map<String, Set<String>> availableTags = new HashMap<>();
		meters.forEach((meter) -> mergeAvailableTags(availableTags, meter));
		return availableTags;
	}

	private void mergeAvailableTags(Map<String, Set<String>> availableTags, Meter meter) {
		meter.getId().getTags().forEach((tag) -> {
			Set<String> value = Collections.singleton(tag.getValue());
			availableTags.merge(tag.getKey(), value, this::merge);
		});
	}

	private <T> Set<T> merge(Set<T> set1, Set<T> set2) {
		Set<T> result = new HashSet<>(set1.size() + set2.size());
		result.addAll(set1);
		result.addAll(set2);
		return result;
	}

	private <K, V, T> List<T> asList(Map<K, V> map, BiFunction<K, V, T> mapper) {
		return map.entrySet().stream().map((entry) -> mapper.apply(entry.getKey(), entry.getValue()))
				.collect(Collectors.toList());
	}

	/**
	 * Response payload for a metric name listing.
	 */
	public static final class ListNamesResponse {

		private final Set<String> names;

		ListNamesResponse(Set<String> names) {
			this.names = names;
		}

		public Set<String> getNames() {
			return this.names;
		}

	}

	/**
	 * Response payload for a metric name selector.
	 */
	public static final class MetricResponse {

		private final String name;

		private final String description;

		private final String baseUnit;

		private final List<Sample> measurements;

		private final List<AvailableTag> availableTags;

		MetricResponse(String name, String description, String baseUnit, List<Sample> measurements,
				List<AvailableTag> availableTags) {
			this.name = name;
			this.description = description;
			this.baseUnit = baseUnit;
			this.measurements = measurements;
			this.availableTags = availableTags;
		}

		public String getName() {
			return this.name;
		}

		public String getDescription() {
			return this.description;
		}

		public String getBaseUnit() {
			return this.baseUnit;
		}

		public List<Sample> getMeasurements() {
			return this.measurements;
		}

		public List<AvailableTag> getAvailableTags() {
			return this.availableTags;
		}

	}

	/**
	 * A set of tags for further dimensional drill-down and their potential values.
	 */
	public static final class AvailableTag {

		private final String tag;

		private final Set<String> values;

		AvailableTag(String tag, Set<String> values) {
			this.tag = tag;
			this.values = values;
		}

		public String getTag() {
			return this.tag;
		}

		public Set<String> getValues() {
			return this.values;
		}

	}

	/**
	 * A measurement sample combining a {@link Statistic statistic} and a value.
	 */
	public static final class Sample {

		private final Statistic statistic;

		private final Double value;

		Sample(Statistic statistic, Double value) {
			this.statistic = statistic;
			this.value = value;
		}

		public Statistic getStatistic() {
			return this.statistic;
		}

		public Double getValue() {
			return this.value;
		}

		@Override
		public String toString() {
			return "MeasurementSample{statistic=" + this.statistic + ", value=" + this.value + '}';
		}

	}

}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>TextMeasureContext (JasperReports 5.6.0 API)</title>
<meta name="date" content="2014-05-27">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

net.sf.jasperreports.engine.fill

Interface TextMeasureContext

public interface TextMeasureContext

Version:

$Id: TextMeasureContext.java 5878 2013-01-07 20:23:13Z teodord $

Author:

Lucian Chirita (lucianc@users.sourceforge.net)

Method Summary

Methods

Modifier and Type
Method and Description

JRCommonText
getElement()

java.awt.font.FontRenderContext
getFontRenderContext()

JasperReportsContext
getJasperReportsContext()

JRPropertiesHolder
getPropertiesHolder()

boolean
isIgnoreMissingFont()

Method Detail

getJasperReportsContext

JasperReportsContext getJasperReportsContext()

getElement

JRCommonText getElement()

getPropertiesHolder

JRPropertiesHolder getPropertiesHolder()

isIgnoreMissingFont

boolean isIgnoreMissingFont()

getFontRenderContext

java.awt.font.FontRenderContext getFontRenderContext()

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com

redpajama_set_name: RedPajamaGithub


text:
var express = require('express');
var _ = require('lodash');
var request = require('request');
var htmlparser = require('htmlparser2');
var Url = require('url');

function mergeOnCategory(rows) {
	var arr = [],
		obj = {},
		category;

	_.forEach(rows, (row, i) => {
		category = row.categoryName;

		if (_.isNil(obj[row.id])) {
			row.categoryName = [];
			arr.push(row);
			obj[row.id] = arr.length - 1;
		}

		arr[obj[row.id]].categoryName.push(category);

	});

	return arr;
}

const fs = require("fs")
const messages = JSON.parse(fs.readFileSync(__dirname + "/data.json", "utf-8")).messages

module.exports.Router = function (MessageDB) {
	var router = express.Router();

	router.post("/advanced-search", (req, res, next) => {
		MessageDB.advancedSearch(req.body).then(filteredMsgs => {
			res.json(filteredMsgs)
		})
	})

	router.post("/simple-search", (req, res, next) => {
		MessageDB.simpleSearch(req.body).then(filteredMsgs => {
			res.json(filteredMsgs)
		})
	})

	router.get('/new', (req, res, next) => {
		MessageDB.getUnreadMessages().then(messages => {
			res.json(messages);
		}).catch(next)
	})

	router.get('/old', (req, res, next) => {
		MessageDB.getReadMessages().then(messages => {
			res.json(messages)
		}).catch(next)
	})

	router.patch('/read/:messageId', (req, res, next) => {
		const messageId = req.params.messageId
		MessageDB.markRead(messageId).then(() => {
			res.send("marking message with id: " + messageId + " as read")
		})
	})

	router.patch("/unread/:messageId", (req, res, next) => {
		const messageId = req.params.messageId
		MessageDB.markUnRead(messageId).then(() => {
			res.send("marking message with id: " + messageId + " as unread")
		})
	})

	router.delete("/:messageId", (req, res, next) => {
		const messageId = req.params.messageId
		MessageDB.markDeleted(messageId).then(() => {
			res.send("marking message with id: " + messageId + " as deleted")
		}).catch(next)
	})

	return router;
}


text:
<!doctype html>

    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Driving Lost</title>
    <link rel="stylesheet" href="../css/foundation.css">
    <link rel="stylesheet" href="../css/app.css">
    <link rel="stylesheet" href="../css/mystyles.css">
    <link href="https://fonts.googleapis.com/css?family=Lobster+Two" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Martel" rel="stylesheet">
    <link rel="icon" href="../images/fav.png" type="images/svg" sizes="any">

Driving Lost

Home

About

Presentation

 Good Luck driving lost!

 This takes 5 weeks to finish.

Move on to the Next Task

Are you here by mistake?

  Click Here!

© 2016 Niloofar Khodabakhsh | ART2830 FALL2016


text:
import random
import unittest
from algo.suffix_array import SuffixArray
from algo.charseq import StrView

class TestSuffixArray(unittest.TestCase):

    def setUp(self):
        n = 100000
        self.s = ''.join(map(chr, [random.randint(ord('a'), ord('z')) for _ in range(n)]))

    @unittest.skip('perf test')
    def test_timsort(self):
        s = self.s
        n = len(s)
        suffixes = [StrView(s, i, n-i) for i in range(n)]
        print('begin')
        suffixes.sort()
        print('done')

    def test_perf(self):
        s = self.s
        sa = SuffixArray(s)
        r = sa.indexes
        self.assertEqual(len(r), len(s))

if __name__ == '__main__':
    unittest.main()


text:
  <select name="sources">
      <option value="http://www.largesound.com/ashborytour/sound/AshboryBYU.mp3">MP3</option>
    </select>

DL:

Renderer:

  <form action="#" method="get">
    Language <select name="lang">
        <option value="en" selected>English (en)</option>
        <option value="ja">Japanese (ja)</option>
      </select>

    Stretching<select name="stretching">
        <option value="auto" selected>Auto (default)</option>
        <option value="responsive">Responsive</option>
        <option value="fill" selected>Fill</option>
        <option value="none" selected>None (original dimensions)</option>
      </select>

  </form>


text:
from zmeyka_db_models.base_db_models import *
#from zmeyka_db_models.alexey_logging import write_to_log

#from zmeyka_db_models.base_db_models import delete_users_by_page_id_timestamp
#from zmeyka_db_models.base_db_models import delete_likes_by_page_id_timestamp
#from zmeyka_db_models.base_db_models import delete_comments_by_page_id_timestamp
#from zmeyka_db_models.base_db_models import delete_posts_by_page_id_timestamp

##################### API - LIKEs TABLE operations ##################

def add_like(fb_like_id, fb_page_id = None, fb_user_id = None, fb_post_id = None, fb_comment_id = None, reaction = None, time_updated = None, db_models_timestamp = None):
    try:
        like = Like(fb_like_id = fb_like_id, fb_page_id = fb_page_id, fb_user_id = fb_user_id, fb_post_id = fb_post_id, fb_comment_id = fb_comment_id, reaction = reaction, time_updated = time_updated, db_models_timestamp = db_models_timestamp)
        print ('add_like.like: {}'.format(str(like)))

        #if like.zm_like_id is None:
        #    return 'OK'

        db_session.add(like)
        db_session.commit()
        return 'OK'
    except Exception as exception_desc:
        db_session.rollback()
        #print (exception_desc)
        write_to_log(exception_desc)
        print ('Exception when adding like, exception - {}'.format(exception_desc))
        #print (like)
        print ('like.zm_like_id = {}'.format(str(like.zm_like_id)))
        #exit()
        return exception_desc

def get_like(zm_like_id = None, fb_like_id = None):
    like = Like
    if id:
        return like.query.filter(Like.zm_like_id==zm_like_id).all()
    if like_id:
        return like.query.filter(Like.fb_like_id==fb_like_id).all()
    else:
        print ('id or like_id are not specified')
        return None

def get_all_likes():
    like = Like
    try:
        return like.query.all()
    except Exception as exception_desc:
        #print (exception_desc)
        write_to_log(exception_desc)
        return exception_desc

def get_likes (fb_page_id = None, db_models_timestamp = None, fb_post_id = None, offset = None, limit = None):
    #fb_page_id = None
    #db_models_timestamp = None
    #post_id = None
    #offset = None
    #limit = None
    if offset and limit:
        if fb_page_id:
            if db_models_timestamp:
                try:
                    return Like.query.filter(Like.fb_page_id==fb_page_id, Like.db_models_timestamp==db_models_timestamp).offset(offset).limit(limit).all()
                except Exception as exception_desc:
                    write_to_log(exception_desc)
                    return exception_desc
            else:
                try:
                    db_models_timestamp = Page.query.filter(Page.fb_page_id==fb_page_id).order_by(Page.db_models_timestamp.desc()).first().db_models_timestamp
                    return Like.query.filter(Like.fb_page_id==fb_page_id, Like.db_models_timestamp==db_models_timestamp).offset(offset).limit(limit).all()
                except Exception as exception_desc:
                    write_to_log(exception_desc)
                    return exception_desc
        elif fb_post_id:
            if db_models_timestamp:
                try:
                    return Like.query.filter(Like.fb_post_id==fb_post_id, Like.db_models_timestamp==db_models_timestamp).offset(offset).limit(limit).all()
                except Exception as exception_desc:
                    write_to_log(exception_desc)
                    return exception_desc
            else:
                try:
                    db_models_timestamp = Post.query.filter(Post.fb_post_id==fb_post_id).order_by(Post.db_models_timestamp.desc()).first().db_models_timestamp
                    return Like.query.filter(Like.fb_post_id==fb_post_id, Like.db_models_timestamp==db_models_timestamp).offset(offset).limit(limit).all()
                except Exception as exception_desc:
                    write_to_log(exception_desc)
                    return exception_desc
    else:
        if fb_page_id:
            if db_models_timestamp:
                try:
                    return Like.query.filter(Like.fb_page_id==fb_page_id, Like.db_models_timestamp==db_models_timestamp).all()
                except Exception as exception_desc:
                    write_to_log(exception_desc)
                    return exception_desc
            else:
                try:
                    db_models_timestamp = Page.query.filter(Page.fb_page_id==fb_page_id).order_by(Page.db_models_timestamp.desc()).first().db_models_timestamp
                    return Like.query.filter(Like.fb_page_id==fb_page_id, Like.db_models_timestamp==db_models_timestamp).all()
                except Exception as exception_desc:
                    write_to_log(exception_desc)
                    return exception_desc
        elif fb_post_id:
            if db_models_timestamp:
                try:
                    return Like.query.filter(Like.fb_post_id==fb_post_id, Like.db_models_timestamp==db_models_timestamp).all()
                except Exception as exception_desc:
                    write_to_log(exception_desc)
                    return exception_desc
            else:
                try:
                    db_models_timestamp = Post.query.filter(Post.fb_post_id==fb_post_id).order_by(Post.db_models_timestamp.desc()).first().db_models_timestamp
                    return Like.query.filter(Like.fb_post_id==fb_post_id, Like.db_models_timestamp==db_models_timestamp).all()
                except Exception as exception_desc:
                    write_to_log(exception_desc)
                    return exception_desc

def get_likes_by_page_id(fb_page_id):
    try:
        return Like.query.filter(Like.fb_page_id==fb_page_id).all()
    except Exception as exception_desc:
        db_session.rollback()
        #print (exception_desc)
        write_to_log(exception_desc)
        return exception_desc

def delete_all_likes():
    like = Like
    try:
        number_of_deleted = like.query.delete()
        db_session.commit()
        #return number_of_deleted
        return 'OK'
    except Exception as exception_desc:
        #print (exception_desc)
        write_to_log(exception_desc)
        return exception_desc

def delete_likes_by_page_id_timestamp(fb_page_id, db_models_timestamp):
    try:
        Like.query.filter(Like.fb_page_id==fb_page_id, Like.db_models_timestamp==db_models_timestamp).delete()
        db_session.commit()
        return 'OK'
    except Exception as exception_desc:
        db_session.rollback()
        #print (exception_desc)
        write_to_log(exception_desc)
        return exception_desc

##################### get count_page_likes_per_timestamp #####################
def get_counts_page_likes_per_timestamp (zm_page_id = None, fb_page_id = None, db_models_timestamp = None):
    if zm_page_id:
        try:
            return Count_Page_Likes_per_Timestamp.query.filter(Count_Page_Likes_per_Timestamp.zm_page_id == zm_page_id).order_by(Count_Page_Likes_per_Timestamp.likes_timestamp.asc()).all()
        except Exception as exception_desc:
            db_session.rollback()
            #print (exception_desc)
            write_to_log(exception_desc)
            return exception_desc
    elif fb_page_id and db_models_timestamp:
        try:
            return Count_Page_Likes_per_Timestamp.query.filter(Count_Page_Likes_per_Timestamp.fb_page_id == fb_page_id, Count_Page_Likes_per_Timestamp.db_models_timestamp == db_models_timestamp).order_by(Count_Page_Likes_per_Timestamp.likes_timestamp.asc()).all()
        except Exception as exception_desc:
            db_session.rollback()
            #print (exception_desc)
            write_to_log(exception_desc)
            return exception_desc


text:
path = File.expand_path("#{File.dirname(__FILE__)}/../lib")
$LOAD_PATH.unshift(path)

require "rorvswild"
require "minitest/autorun"
require "mocha/minitest"
require "top_tests"

module RorVsWild::AgentHelper
  def agent
    @agent ||= initialize_agent(ignore_requests: ["RorVsWild::Plugin::ActionControllerTest::SecretController#index"])
  end

  def initialize_agent(options = {})
    agent ||= RorVsWild.start({logger: "/dev/null", ignore_jobs: ["SecretJob"]}.merge(options))
    agent.locator.stubs(current_path: File.dirname(__FILE__))
    agent.stubs(:post_request)
    agent.stubs(:post_job)
    agent
  end
end


text:
package org.infinispan.loaders.jdbc.binary;

import org.infinispan.loaders.jdbc.AbstractNonDelegatingJdbcCacheStoreConfig;
import org.infinispan.loaders.jdbc.TableManipulation;
import org.infinispan.loaders.jdbc.connectionfactory.ConnectionFactoryConfig;

/**
 * Defines available configuration elements for {@link org.infinispan.loaders.jdbc.binary.JdbcBinaryCacheStore}.
 *
 * @author Mircea.Markus@jboss.com
 */
public class JdbcBinaryCacheStoreConfig extends AbstractNonDelegatingJdbcCacheStoreConfig {

   /** The serialVersionUID */
   private static final long serialVersionUID = 7659899424935453635L;

   public JdbcBinaryCacheStoreConfig(boolean manageConnectionFactory) {
      this.manageConnectionFactory = manageConnectionFactory;
   }

   public JdbcBinaryCacheStoreConfig(ConnectionFactoryConfig connectionFactoryConfig, TableManipulation tm) {
      super(connectionFactoryConfig, tm);
      this.cacheLoaderClassName = JdbcBinaryCacheStore.class.getName();
      this.connectionFactoryConfig = connectionFactoryConfig;
      this.tableManipulation = tm;
   }

   public JdbcBinaryCacheStoreConfig() {
      cacheLoaderClassName = JdbcBinaryCacheStore.class.getName();
   }

   /**
    * Sets the prefix for the name of the table where the data will be stored. "_<cache name>" will be appended
    * to this prefix in order to enforce unique table names for each cache.
    */
   public void setBucketTableNamePrefix(String bucketTableName) {
      testImmutability("tableManipulation");
      this.tableManipulation.setTableNamePrefix(bucketTableName);
   }

   public void setTableNamePrefix(String tableNamePrefix) {
      testImmutability("tableManipulation");
      this.tableManipulation.setTableNamePrefix(tableNamePrefix);
   }

}


text:
var days = new Array(7);
days[0] = "Sunday";
days[1] = "Monday";
days[2] = "Tuesday";
days[3] = "Wednesday";
days[4] = "Thursday";
days[5] = "Friday";
days[6] = "Saturday";
var months = new Array(12);
months[0] = "January";
months[1] = "February";
months[2] = "March";
months[3] = "April";
months[4] = "May";
months[5] = "June";
months[6] = "July";
months[7] = "August";
months[8] = "September";
months[9] = "October";
months[10] = "November";
months[11] = "December";
var dateObj = new Date(document.lastModified);
var wday = days[dateObj.getDay()];
var lmonth = months[dateObj.getMonth()];
var date = dateObj.getDate();
var fyear = dateObj.getYear();

if (fyear < 2000) fyear = fyear + 1900;
document.write("
");

document.write("");

document.write("
Last updated: " + wday + ", "
+ lmonth + " " + date + ", " + fyear + "
");


text:
import objectAssign from 'object-assign';
import * as types from '../../actions/actions';
import initState from './initState';

export default function articleReducer(state = initState, action){
  let newState = objectAssign({}, state);
  switch(action.type){
    case types.LOAD_COMPONENTS:
      newState.header = action.header;
      return newState;
    default:
      return state;
  }
}


text:
<?php
/**
 * @package WPSEO\Admin
 * @since      1.7.0
 */

/**
 * Base class for handling plugin conflicts.
 */
class Yoast_Plugin_Conflict {

	/**
	 * The plugins must be grouped per section.
	 *
	 * It's possible to check for each section if there are conflicting plugin
	 *
	 * @var array
	 */
	protected $plugins = array();

	/**
	 * All the current active plugins will be stored in this private var
	 *
	 * @var array
	 */
	protected $all_active_plugins = array();

	/**
	 * After searching for active plugins that are in $this->plugins the active plugins will be stored in this
	 * property
	 *
	 * @var array
	 */
	protected $active_plugins = array();

	/**
	 * Property for holding instance of itself
	 *
	 * @var Yoast_Plugin_Conflict
	 */
	protected static $instance;

	/**
	 * For the use of singleton pattern. Create instance of itself and return his instance
	 *
	 * @param string $class_name Give the classname to initialize. If classname is false (empty) it will use it's own __CLASS__
	 *
	 * @return Yoast_Plugin_Conflict
	 */
	public static function get_instance( $class_name = '' ) {

		if ( is_null( self::$instance ) ) {
			if ( ! is_string( $class_name ) || $class_name === '' ) {
				$class_name = __CLASS__;
			}

			self::$instance = new $class_name();
		}

		return self::$instance;
	}

	/**
	 * Setting instance, all active plugins and search for active plugins
	 *
	 * Protected constructor to prevent creating a new instance of the
	 * *Singleton* via the `new` operator from outside of this class.
	 *
	 */
	protected function __construct() {
		// Set active plugins
		$this->all_active_plugins = get_option( 'active_plugins' );

		// Search for active plugins
		$this->search_active_plugins();
	}

	/**
	 * Check if there are conflicting plugins for given $plugin_section
	 *
	 * @param string $plugin_section
	 *
	 * @return bool
	 */
	public function check_for_conflicts( $plugin_section ) {

		static $sections_checked;

		if ( $sections_checked == null ) {
			$sections_checked = array();
		}

		if ( ! in_array( $plugin_section, $sections_checked ) ) {
			$sections_checked[] = $plugin_section;
			$has_conflicts      = ( ! empty( $this->active_plugins[ $plugin_section ] ) );

			return $has_conflicts;
		}
		else {
			return false;
		}
	}

	/**
	 * Get plugin name from file
	 *
	 * @param string $plugin
	 *
	 * @return bool
	 */
	private function get_plugin_name( $plugin ) {
		$plugin_details = get_plugin_data( ABSPATH . '/wp-content/plugins/' . $plugin );

		if ( $plugin_details['Name'] != '' ) {
			return $plugin_details['Name'];
		}
		return false;
	}

	/**
	 * Getting all the conflicting plugins and return them as a string.
	 *
	 * This method will loop through all conflicting plugins to get the details of each plugin. The plugin name
	 * will be taken from the details to parse a comma separated string, which can be use for by example a notice
	 *
	 * @param string $plugin_section
	 *
	 * @return string
	 */
	public function get_conflicting_plugins_as_string( $plugin_section ) {
		if ( ! function_exists( 'get_plugin_data' ) ) {
			require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
		}

		// Getting the active plugins by given section
		$plugins = $this->active_plugins[ $plugin_section ];

		$plugin_names = array();
		foreach ( $plugins as $plugin ) {
			if ( $name = $this->get_plugin_name( $plugin ) ) {
				$plugin_names[] = '' . $name . '';
			}
		}
		unset( $plugins, $plugin );

		if ( ! empty( $plugin_names ) ) {
			return implode( ' & ', $plugin_names );
		}
	}

	/**
	 * Checks for given $plugin_sections for conflicts
	 *
	 * @param array $plugin_sections
	 */
	public function check_plugin_conflicts( $plugin_sections ) {
		foreach ( $plugin_sections as $plugin_section => $readable_plugin_section ) {
			// Check for conflicting plugins and show error if there are conflicts
			if ( $this->check_for_conflicts( $plugin_section ) ) {
				$this->set_error( $plugin_section, $readable_plugin_section );
			}
		}
	}

	/**
	 * Setting an error on the screen
	 *
	 * @param string $plugin_section
	 * @param string $readable_plugin_section This is the value for the translation
	 */
	protected function set_error( $plugin_section, $readable_plugin_section ) {

		$plugins_as_string = $this->get_conflicting_plugins_as_string( $plugin_section );
		$error_message     = '
' . __( 'Warning!', 'wordpress-seo' ) . '
';

		/* translators: %s: 'Facebook & Open Graph' plugin name(s) of possibly conflicting plugin(s) */
		$error_message .= '
' . sprintf( __( 'The %s plugin(s) might cause issues when used in conjunction with WordPress SEO by Yoast.', 'wordpress-seo' ), $plugins_as_string ) . '
';
		$error_message .= sprintf( $readable_plugin_section, $plugins_as_string ) . '

';
		$error_message .= '
' . __( 'Recommended solution', 'wordpress-seo' ) . '
';

		/* translators: %s: 'Facebook & Open Graph' plugin name(s) of possibly conflicting plugin(s) */
		$error_message .= sprintf( __( 'We recommend you deactivate %s and have another look at your WordPress SEO configuration using the button above.', 'wordpress-seo' ), $plugins_as_string ) . '
';
		foreach ( $this->active_plugins[ $plugin_section ] as $plugin_file ) {

			/* translators: %s: 'Facebook' plugin name of possibly conflicting plugin */
			$error_message .= '' . sprintf( __( 'Deactivate %s', 'wordpress-seo' ), $this->get_plugin_name( $plugin_file ) ) . ' ';
		}
		$error_message .= '
' . __( 'This warning is generated by WordPress SEO by Yoast.', 'wordpress-seo' ) . '

';

		// Add the message to the notifications center
		Yoast_Notification_Center::get()->add_notification( new Yoast_Notification( $error_message, array( 'type' => 'error' ) ) );
	}

	/**
	 * Loop through the $this->plugins to check if one of the plugins is active.
	 *
	 * This method will store the active plugins in $this->active_plugins.
	 */
	protected function search_active_plugins() {
		foreach ( $this->plugins as $plugin_section => $plugins ) {
			$this->check_plugins_active( $plugins, $plugin_section );
		}
	}

	/**
	 * Loop through plugins and check if each plugin is active
	 *
	 * @param array  $plugins
	 * @param string $plugin_section
	 */
	protected function check_plugins_active( $plugins, $plugin_section ) {
		foreach ( $plugins as $plugin ) {
			if ( $this->check_plugin_is_active( $plugin ) ) {
				$this->add_active_plugin( $plugin_section, $plugin );
			}
		}
	}

	/**
	 * Check if given plugin exists in array with all_active_plugins
	 *
	 * @param string $plugin
	 *
	 * @return bool
	 */
	protected function check_plugin_is_active( $plugin ) {
		return in_array( $plugin, $this->all_active_plugins );
	}

	/**
	 * Add plugin to the list of active plugins.
	 *
	 * This method will check first if key $plugin_section exists, if not it will create an empty array
	 * If $plugin itself doesn't exist it will be added.
	 *
	 * @param string $plugin_section
	 * @param string $plugin
	 */
	protected function add_active_plugin( $plugin_section, $plugin ) {

		if ( ! array_key_exists( $plugin_section, $this->active_plugins ) ) {
			$this->active_plugins[ $plugin_section ] = array();
		}

		if ( ! in_array( $plugin, $this->active_plugins[ $plugin_section ] ) ) {
			$this->active_plugins[ $plugin_section ][] = $plugin;
		}
	}

	/**
	 * Search in $this->plugins for the given $plugin
	 *
	 * If there is a result it will return the plugin category
	 *
	 * @param string $plugin
	 *
	 * @return int|string
	 */
	protected function find_plugin_category( $plugin ) {

		foreach ( $this->plugins as $plugin_section => $plugins ) {
			if ( in_array( $plugin, $plugins ) ) {
				return $plugin_section;
			}
		}

	}

}


text:
package com.epam.ta.reportportal.core.events.handler.launch;

import com.epam.ta.reportportal.core.analyzer.auto.strategy.analyze.AnalyzeItemsMode;
import com.epam.ta.reportportal.core.analyzer.pattern.PatternAnalyzer;
import com.epam.ta.reportportal.core.events.activity.LaunchFinishedEvent;
import com.epam.ta.reportportal.core.events.handler.ConfigurableEventHandler;
import com.epam.ta.reportportal.core.launch.GetLaunchHandler;
import com.epam.ta.reportportal.entity.enums.ProjectAttributeEnum;
import com.epam.ta.reportportal.entity.launch.Launch;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collections;
import java.util.Map;

/**
 * @author Ivan Budayeu
 */
@Service
public class LaunchPatternAnalysisRunner implements ConfigurableEventHandler<LaunchFinishedEvent, Map<String, String>> {

	private final GetLaunchHandler getLaunchHandler;
	private final PatternAnalyzer patternAnalyzer;

	@Autowired
	public LaunchPatternAnalysisRunner(GetLaunchHandler getLaunchHandler, PatternAnalyzer patternAnalyzer) {
		this.getLaunchHandler = getLaunchHandler;
		this.patternAnalyzer = patternAnalyzer;
	}

	@Override
	@Transactional
	public void handle(LaunchFinishedEvent launchFinishedEvent, Map<String, String> projectConfig) {

		boolean isPatternAnalysisEnabled = BooleanUtils.toBoolean(projectConfig.get(ProjectAttributeEnum.AUTO_PATTERN_ANALYZER_ENABLED.getAttribute()));

		if (isPatternAnalysisEnabled) {
			final Launch launch = getLaunchHandler.get(launchFinishedEvent.getId());
			patternAnalyzer.analyzeTestItems(launch, Collections.singleton(AnalyzeItemsMode.TO_INVESTIGATE));
		}
	}

}


text:
import os, glob
from weblab.admin.bot.misc import show_time, flush

import cPickle as pickle

FILE_NAME_TEMPLATE = "logs" + os.sep + "botclient_%s__SCEN_%s_CONFIG_0.pickle"
FILL_NUMBER = 2
RANGES = [
        lambda : xrange(1, 5),
        lambda : xrange(5, 151, 5)
    ]

def get_raw_information(date, verbose = True):
    file_name = FILE_NAME_TEMPLATE % (date, '%s')
    raw_information_filename = 'raw_information_%s.dump' % date
    if os.path.exists(raw_information_filename):
        if verbose:
            print "Retrieving cache", show_time()
            flush()
        raw_information = pickle.load(open(raw_information_filename))
        if verbose:
            print "Retrieved cached raw_information", show_time()
            flush()
        return raw_information

    if verbose:
        print "Generating new raw_information", show_time()
        flush()
    # else generate this information file
    def calculate_positions(initial):
        data = {}
        for r in RANGES:
            for i in r():
                data[i] = str(initial).zfill(FILL_NUMBER)
                initial += 1
        return data, initial

    def calculate_protocols():
        # returns
        # { "JSON" : { 1 : "01", 2 : "02", 5 : "03" ... } ...}
        # being each "01", "02" the name of the file for
        # that protocol and for that number of users
        protocols = {
                "JSON"   : {},
            }

        protocols = {}
        data, initial = calculate_positions(0)
        protocols["JSON"] = data
        return protocols

    protocols = calculate_protocols()

    def get_results(protocol, number):
        #
        # Given a protocol and a number of users (1,2,3,4,5,10,15...),
        # it returns the results stored in that scenario
        #
        found_resources = sorted(glob.glob(file_name % "*"), lambda x,y: len(x) - len(y))
        if len(found_resources) == 0:
            raise Exception("No similar file found: %s" % file_name)

        regular_length = len(found_resources[len(found_resources)/2]) # Take the one in the middle
        number_length  = regular_length - len(file_name % '')

        filename = file_name % str(int(protocols[protocol][number])).zfill(number_length)
        results = pickle.load(open(filename))
        return results

    def generate_data(protocol):
        # Given a protocol, it returns the following tuple
        #
        # x = [1,2,3,4,5,10,15,20,25]
        # y = [results_of_1, results_of_2 ...]
        #
        x = []
        y = []
        for r in RANGES:
            for n in r():
                x.append(n)
                results = get_results(protocol, n)
                y.append(results)
        return x,y

    raw_information = {}
    for protocol in protocols.keys():
        x, y = generate_data(protocol)
        raw_information[protocol] = (x,y)

    # raw_information stores:
    # { "JSON" : ([1,2,3,4,5,10...], [results_of_1, results_of_2, results_of_3 ...]) }

    # Save as a cache
    pickle.dump(raw_information, open(raw_information_filename,'w'))

    if verbose:
        print "Raw_information generated", show_time()
        flush()

    return raw_information


text:
fhc-suspend(1)
==============
## SYNOPSIS

 fhc app suspend --app=<app> --env=<env>

## EXAMPLES

  fhc suspend --app=<appGuid> --env=<environmentName>

## OPTIONS

  --app, -a  Unieque 24 character GUID of your application                       [required]
  --env, -e  The lifecycle environment your application is running in, e.g. dev  [required]

## DESCRIPTION

suspends a cloud application. This command will only work if the app has previously been deployed


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class AddMomentumAction : MonoBehaviour {

    public GameObject nodeInput, momentumText;

    public void AddMomentum()
    {
        int node = nodeInput.GetComponent<LoadInputValue>().index;
        float momentum = float.Parse(momentumText.GetComponent<InputField>().text);
        GameObject.FindObjectOfType<BeamCollector>().AddMomentum(node, momentum);
    }
}


text:
from ctypes import *
from ropper.loaders.loader import *
from ropper.common.error import LoaderError
from ropper.common.error import RopperError
from ropper.arch import Endianess
import filebytes.elf as elf
import os

class ELF(Loader):

    def __init__(self, filename, bytes=None, arch=None):

        self.__execSections = None
        self.__dataSections = None

        super(ELF, self).__init__(filename, bytes, arch)

    @property
    def entryPoint(self):
        return self._binary.entryPoint

    def _getImageBase(self):
        return self._binary.imageBase

    def _loadDefaultArch(self):
        try:
            machine = elf.EM[self._binary.elfHeader.header.e_machine]
            cls = elf.ELFCLASS[self._binary.elfHeader.header.e_ident[elf.EI.CLASS]]
            end = self._binary._bytes[elf.EI.DATA]

            return getArch( (machine,cls, end ),self._binary.elfHeader.header.e_entry)
        except BaseException as e:
            raise RopperError(e)

    @property
    def executableSections(self):
        if not self.__execSections:
            self.__execSections = []
            if self._binary.segments:
                for phdr in self._binary.segments:
                    if phdr.header.p_flags & elf.PF.EXEC > 0:
                        self.__execSections.append(Section(name=str(elf.PT[phdr.header.p_type]), sectionbytes=phdr.raw, virtualAddress=phdr.header.p_vaddr, offset=phdr.header.p_offset))
            elif self._binary.sections:
                for shdr in self._binary.sections:
                    print(shdr.header.sh_flags)
                    if shdr.header.sh_flags & elf.SHF.EXECINSTR:
                        self.__execSections.append(Section(name=shdr.name, sectionbytes=shdr.raw, virtualAddress=shdr.header.sh_addr, offset=shdr.header.sh_offset))

        return self.__execSections

    @property
    def dataSections(self):
        if not self.__dataSections:
            self.__dataSections = []
            for shdr in self._binary.sections:
                if shdr.header.sh_flags & elf.SHF.ALLOC and not (shdr.header.sh_flags & elf.SHF.EXECINSTR) and not(shdr.header.sh_type & elf.SHT.NOBITS):
                    self.__dataSections.append(Section(shdr.name, shdr.raw, shdr.header.sh_addr, shdr.header.sh_offset, shdr.header))
        return self.__dataSections

    @property
    def codeVA(self):

        for phdr in self.phdrs:
            if phdr.header.p_type == PT.INTERP:
                return phdr.header.p_vaddr
        return 0

    @property
    def type(self):
        return Type.ELF

    def setASLR(self, enable):
        raise LoaderError('Not available for elf files')

    def setNX(self, enable):
        perm = elf.PF.READ | elf.PF.WRITE  if enable else elf.PF.READ | elf.PF.WRITE | elf.PF.EXEC
        phdrs = self._binary.segments

        for phdr in phdrs:
            if phdr.header.p_type == elf.PT.GNU_STACK:
                phdr.header.p_flags = perm

        self.save()

    def getSection(self, name):
        for shdr in self._binary.sections:
            if shdr.name == name:

                return Section(shdr.name, shdr.raw, shdr.header.sh_addr, shdr.header.sh_addr - self._binary.imageBase)
        raise RopperError('No such section: %s' % name)

    def checksec(self):
        return {}

    def _loadFile(self, fileName, bytes=None):
        return elf.ELF(fileName, bytes)

    @classmethod
    def isSupportedFile(cls, fileName, bytes=None):
        if bytes:
            return elf.ELF.isSupportedContent(bytes)
        return elf.ELF.isSupportedFile(fileName)

def getArch(*params):
    arch = ARCH[params[0]]
    if arch==ARM and (params[1] & 1) == 1:
        return ARMTHUMB
    return arch

ARCH = {(elf.EM.INTEL_386 , elf.ELFCLASS.BITS_32, elf.ELFDATA.LSB): x86,
        (elf.EM.INTEL_80860, elf.ELFCLASS.BITS_32, elf.ELFDATA.LSB): x86,
        (elf.EM.IA_64, elf.ELFCLASS.BITS_64, elf.ELFDATA.LSB): x86_64,
        (elf.EM.X86_64, elf.ELFCLASS.BITS_64, elf.ELFDATA.LSB): x86_64,
        (elf.EM.MIPS, elf.ELFCLASS.BITS_32, elf.ELFDATA.MSB): MIPSBE,
        (elf.EM.MIPS, elf.ELFCLASS.BITS_32, elf.ELFDATA.LSB): MIPS,
        (elf.EM.MIPS, elf.ELFCLASS.BITS_64, elf.ELFDATA.MSB): MIPS64BE,
        (elf.EM.MIPS, elf.ELFCLASS.BITS_64, elf.ELFDATA.LSB): MIPS64,
        (elf.EM.ARM, elf.ELFCLASS.BITS_32, elf.ELFDATA.MSB) : ARMBE,
        (elf.EM.ARM, elf.ELFCLASS.BITS_32, elf.ELFDATA.LSB) : ARM,
        (elf.EM.ARM64, elf.ELFCLASS.BITS_64, elf.ELFDATA.LSB) : ARM64,
        (elf.EM.PPC, elf.ELFCLASS.BITS_32, elf.ELFDATA.MSB) : PPC,
        (elf.EM.PPC64, elf.ELFCLASS.BITS_64, elf.ELFDATA.MSB) : PPC64,
        (elf.EM.SPARCV9, elf.ELFCLASS.BITS_64, elf.ELFDATA.MSB) : SPARC64}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using UnityEngine;

namespace UnityTest
{
	[Serializable]
	public class PropertyResolver
	{
		public string[] ExcludedFieldNames { get; set; }
		public Type[] ExcludedTypes { get; set; }
		public Type[] AllowedTypes { get; set; }

		public PropertyResolver ()
		{
			ExcludedFieldNames = new string[] {};
			ExcludedTypes = new Type[] {};
			AllowedTypes = new Type[] {};
		}

		public IList<string> GetFieldsAndPropertiesUnderPath(GameObject go, string propertPath)
		{
			propertPath = propertPath.Trim ();
			if (!PropertyPathIsValid (propertPath))
			{
				throw new ArgumentException("Incorrent property path: " + propertPath);
			}

			var idx = propertPath.LastIndexOf('.');

			if (idx < 0)
			{
				var components = GetFieldsAndPropertiesFromGameObject(go, 2, null);
				return components;
			}

			var propertyToSearch = propertPath;
			Type type = null;
			try
			{
				type = GetPropertyTypeFromString(go, propertyToSearch);
				idx = propertPath.Length-1;

			}
			catch(ArgumentException)
			{
				try
				{
					propertyToSearch = propertPath.Substring(0, idx);
					type = GetPropertyTypeFromString(go, propertyToSearch);
				}
				catch (NullReferenceException)
				{
					var components = GetFieldsAndPropertiesFromGameObject(go, 2, null);
					return components.Where(s => s.StartsWith(propertPath.Substring(idx + 1))).ToArray();
				}
			}

			var resultList = new List<string>();
			var path = "";
			if(propertyToSearch.EndsWith("."))
				propertyToSearch = propertyToSearch.Substring(0, propertyToSearch.Length-1);
			foreach(var c in propertyToSearch)
			{
				if(c == '.')
					resultList.Add(path);
				path += c;
			}
			resultList.Add(path);
			foreach (var prop in type.GetProperties())
			{
				if (prop.Name.StartsWith(propertPath.Substring(idx + 1)))
					resultList.Add(propertyToSearch + "." + prop.Name);
			}
			foreach (var prop in type.GetFields())
			{
				if (prop.Name.StartsWith(propertPath.Substring(idx + 1)))
					resultList.Add(propertyToSearch + "." + prop.Name);
			}
			return resultList.ToArray();
		}

		private bool PropertyPathIsValid ( string propertPath )
		{
			if (propertPath.StartsWith ("."))
				return false;
			if (propertPath.IndexOf ("..") >= 0)
				return false;
			if (Regex.IsMatch (propertPath,
								@"\s"))
				return false;
			return true;
		}

		public IList<string> GetFieldsAndPropertiesFromGameObject ( GameObject gameObject, int depthOfSearch, string extendPath )
		{
			if(depthOfSearch<1) throw new ArgumentOutOfRangeException("depthOfSearch need to be greater than 0");

			var goVals = GetPropertiesAndFieldsFromType(typeof(GameObject),
														depthOfSearch - 1).Select(s => "gameObject." + s);

			var result = new List<string>();
			if (AllowedTypes == null || !AllowedTypes.Any() || AllowedTypes.Contains(typeof(GameObject)))
				result.Add("gameObject");
			result.AddRange (goVals);

			foreach (var componentType in GetAllComponents(gameObject))
			{
				if (AllowedTypes == null || !AllowedTypes.Any() || AllowedTypes.Contains(componentType))
					result.Add(componentType.Name);

				if (depthOfSearch > 1)
				{
					var vals = GetPropertiesAndFieldsFromType (componentType,
																depthOfSearch - 1 );
					var valsFullName = vals.Select (s => componentType.Name + "." + s);
					result.AddRange (valsFullName);
				}
			}

			if (!string.IsNullOrEmpty (extendPath))
			{
				var pathType = GetPropertyTypeFromString (gameObject,
														extendPath);
				var vals = GetPropertiesAndFieldsFromType (pathType,
																depthOfSearch - 1);
				var valsFullName = vals.Select (s => extendPath + "." + s);
				result.AddRange (valsFullName);
			}

			return result;
		}

		private string[] GetPropertiesAndFieldsFromType ( Type type, int level )
		{
			level--;

			var result = new List<string>();
			var fields = new List<MemberInfo>();
			fields.AddRange(type.GetFields());
			fields.AddRange(type.GetProperties());

			foreach (var member in fields)
			{
				var memberType = GetMemberFieldType(member);
				var memberTypeName = memberType.Name;

				if (AllowedTypes == null
				    ||!AllowedTypes.Any()
					|| (AllowedTypes.Contains(memberType) && !ExcludedFieldNames.Contains(memberTypeName))
					)
				{
					result.Add(member.Name);
				}

				if (level > 0 && IsTypeOrNameNotExcluded(memberType, memberTypeName))
				{
					var vals = GetPropertiesAndFieldsFromType(memberType,
														level);
					var valsFullName = vals.Select(s => member.Name + "." + s);
					result.AddRange(valsFullName);
				}
			}
			return result.ToArray();
		}

		private Type GetMemberFieldType ( MemberInfo info )
		{
			if (info.MemberType == MemberTypes.Property)
				return (info as PropertyInfo).PropertyType;
			if (info.MemberType == MemberTypes.Field)
				return (info as FieldInfo).FieldType;
			throw new Exception("Only properties and fields are allowed");
		}

		private Type[] GetAllComponents ( GameObject gameObject )
		{
			var result = new List<Type>();
			var components = gameObject.GetComponents(typeof(Component));
			foreach (var component in components)
			{
				var componentType = component.GetType();
				if (IsTypeOrNameNotExcluded(componentType, null))
				{
					result.Add(componentType);
				}
			}
			return result.ToArray();
		}

		private bool IsTypeOrNameNotExcluded(Type memberType, string memberTypeName)
		{
			return !ExcludedTypes.Contains(memberType)
					&& !ExcludedFieldNames.Contains(memberTypeName);
		}

		#region Static helpers

		public static object GetPropertyValueFromString(GameObject gameObj, string propertyPath)
		{
			if (propertyPath == "")
				return gameObj;

			var propsQueue = new Queue<string>(propertyPath.Split('.').Where(s => !string.IsNullOrEmpty(s)));

			if (propsQueue == null) throw new ArgumentException("Incorrent property path");

			object result;
			if (char.IsLower(propsQueue.Peek()[0]))
			{
				result = gameObj;
			}
			else
			{
				result = gameObj.GetComponent(propsQueue.Dequeue());
			}
			Type type = result.GetType();

			while (propsQueue.Count != 0)
			{
				var nameToFind = propsQueue.Dequeue();

				var property = type.GetProperty(nameToFind);
				if (property != null)
				{
					result = property.GetGetMethod().Invoke(result,
															null);
				}
				else
				{
					var field = type.GetField(nameToFind);
					result = field.GetValue(result);
				}
				type = result.GetType();
			}
			return result;
		}

		private static Type GetPropertyTypeFromString(GameObject gameObj, string propertyPath)
		{
			if (propertyPath == "")
				return gameObj.GetType();

			var propsQueue = new Queue<string>(propertyPath.Split('.').Where(s => !string.IsNullOrEmpty(s)));

			if (propsQueue == null) throw new ArgumentException("Incorrent property path");

			Type result;
			if (char.IsLower(propsQueue.Peek()[0]))
			{
				result = gameObj.GetType();
			}
			else
			{
				var component = gameObj.GetComponent(propsQueue.Dequeue());

				if (component == null) throw new ArgumentException("Incorrent property path");

				result = component.GetType();
			}
			while (propsQueue.Count != 0)
			{
				var nameToFind = propsQueue.Dequeue();

				var property = result.GetProperty(nameToFind);
				if (property != null)
				{
					result = property.PropertyType;
				}
				else
				{
					var field = result.GetField(nameToFind);
					if (field == null) throw new ArgumentException("Incorrent property path");
					result = field.FieldType;
				}
			}
			return result;
		}

		#endregion
	}
}


text:
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <services>
        <service id="symcloud_storage.session_repository" class="Symcloud\Component\Session\Repository">
            <argument type="service" id="symcloud_storage.chunk_storage.chunk_file_manager"/>
            <argument type="service" id="symcloud_storage.metadata_storage.reference_manager"/>
            <argument type="service" id="symcloud_storage.metadata_storage.tree_manager"/>
            <argument type="service" id="symcloud_storage.metadata_storage.commit_manager"/>
        </service>
    </services>
</container>


text:
import {getFileType, fileTypePreConfig} from './util';

/*
 * CSS loader.
 */
export default (options = {}) => {
    const {
        test, fileType = 'text/css', loaders = [], styleOptions, cssOptions, ...rest
    } = options;

    const cssLoader = (context) => {
        let use = [
            {
                loader: 'style-loader',
                options: styleOptions,
            },
            {
                loader: 'css-loader',
                options: cssOptions,
            },
        ];

        if (Array.isArray(loaders)) {
            use = use.concat(loaders);
        }

        return {
            module: {
                rules: [
                    {
                        ...rest,
                        test: getFileType(context, test, fileType),
                        use,
                    },
                ],
            },
        };
    };

    return Object.assign(cssLoader, {
        pre: fileTypePreConfig(test, fileType),
    });
};


text:
const { generatePeopleObj } = require('../utilities/jwt');

async function updateContact({ resourceName, mobile, validPhone }, me, cb) {
  const people = await generatePeopleObj();

  // console.error(`verified=${verified}` !== undefined ? verified : true);
  const defaultResource = {
    etag: me.etag,
    phoneNumbers: me.phoneNumbers,
    userDefined: me.userDefined,
  };

  if (mobile) {
    defaultResource.phoneNumbers = [
      {
        value: `${mobile}`,
        type: 'mobile',
      },
    ];
  }

  if (validPhone) {
    // possible
    defaultResource.userDefined = [
      {
        key: 'validPhone',
        value: validPhone !== undefined ? validPhone : true,
      },
    ];
  }

  people.people.updateContact(
    {
      resourceName,
      updatePersonFields: ['phoneNumbers', 'userDefined'],
      resource: defaultResource,
    },
    {},
    cb,
  );
}

export default async function update(options) {
  const { resourceName } = options;
  const people = await generatePeopleObj();

  return new Promise((res, rej) => {
    people.people.get(
      {
        resourceName,
        personFields: ['phoneNumbers', 'userDefined'],
      },
      {},
      (err, { obj: me }) => {
        // console.log(err || me);
        if (err) {
          rej(err);
        } else {
          updateContact(options, me, (errUpdate, meUpdate) => {
            if (errUpdate) {
              rej(errUpdate);
            } else {
              res(meUpdate);
            }
          });
        }
      },
    );
  });
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.ferris.tweial.console.io;

import java.io.File;

/**
 *
 * @author Michael Remijan mjremijan@yahoo.com @mjremijan
 */
public class FileLastModifiedEvent {

    private long lastModifiedThen;
    private long lastModifiedNow;
    private File File;

    public FileLastModifiedEvent(long lastModifiedThen, long lastModifiedNow, File File) {
        this.lastModifiedThen = lastModifiedThen;
        this.lastModifiedNow = lastModifiedNow;
        this.File = File;
    }

    public long getLastModifiedThen() {
        return lastModifiedThen;
    }

    public long getLastModifiedNow() {
        return lastModifiedNow;
    }

    public File getFile() {
        return File;
    }
}


text:
import fs from 'fs';
import test from 'tape';
import path from 'path';
import load from 'load-json-file';
import write from 'write-json-file';
import {polygon, point, featureCollection} from '@turf/helpers';
import dissolve from './';

const directories = {
    in: path.join(__dirname, 'test', 'in') + path.sep,
    out: path.join(__dirname, 'test', 'out') + path.sep
};

const fixtures = fs.readdirSync(directories.in).map(filename => {
    return {
        filename,
        name: path.parse(filename).name,
        geojson: load.sync(directories.in + filename)
    };
});

test('turf-dissolve', t => {
    for (const {filename, name, geojson}  of fixtures) {
        const propertyName = geojson.propertyName;
        const results = dissolve(geojson, {propertyName});

        if (process.env.REGEN) write.sync(directories.out + filename, results);
        t.deepEquals(results, load.sync(directories.out + filename), name);
    }
    t.end();
});

test('dissolve -- throw', t => {
    const poly = polygon([[[-61,27],[-59,27],[-59,29],[-61,29],[-61,27]]]);
    const pt = point([-62,29]);

    t.throws(() => dissolve(null), /No featureCollection passed/, 'missing featureCollection');
    t.throws(() => dissolve(poly), /Invalid input to dissolve, FeatureCollection required/, 'invalid featureCollection');
    t.throws(() => dissolve(featureCollection([poly, pt])), /Invalid input to dissolve: must be a Polygon, given Point/, 'invalid collection type');
    t.end();
});


text:
package uk.org.ngo.squeezer.service.event;

import androidx.annotation.NonNull;

import uk.org.ngo.squeezer.model.Player;
import uk.org.ngo.squeezer.model.PlayerState;

/** Event sent when the shuffle status of the player has changed. */
public class ShuffleStatusChanged {
    /** The player with changed state. */
    @NonNull public final Player player;

    /** The new shuffle status. */
    @NonNull
    public final PlayerState.ShuffleStatus shuffleStatus;

    public ShuffleStatusChanged(@NonNull Player player, @NonNull PlayerState.ShuffleStatus shuffleStatus) {
        this.player = player;
        this.shuffleStatus = shuffleStatus;
    }

    @Override
    public String toString() {
        return "ShuffleStatusChanged{" +
                "player=" + player +
                ", shuffleStatus=" + shuffleStatus +
                '}';
    }
}


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">

  <title>QTextBlockGroup Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />

QTextBlockGroup Class Reference

[com.trolltech.qt.gui package]

Inherits QTextObject.

Constructor

This class has no public constructors. Calling the constructor function will cause a TypeError.

Constructor Properties

prototype: The QTextBlockGroup prototype object

Instance Properties

QTextBlockGroup objects have no special properties beyond those inherited from the QTextBlockGroup prototype object.


text:
Install the POSTPROCESS module {#module_postprocess_installation}
==========================

[TOC]

This is an optional unit that can be used to export scripts for
postprocessing simulation data. For example, it can generate
the .pov and .ini scripts to be used with the POVray rendering tool.

Read [the introduction to modules](@ref modules) for a technical
background on the modularity of the Chrono::Engine project.

## Features

The **POSTPROCESSING module** is used to export data for
batch rendering of animations etc.

Here are the main features:

- POVray:
	- converts the ChVisualization assets that one has
	  attached to rigid bodies into rendering primitives for POVray.
	- uses the same ChVisualization assets that one can use
	  for the real-time visualization with the Irrlicht interface
	- allows the introduction of custom POV-specific statements
	- the camera can be attached to moving objects
	- contacts can be rendered in POVray as colored vectors and points
	- etc.

- GNUplot:
	- create graphs using [GNUPLOT](http://www.gnuplot.info).
	- launches gnuplot automatically from c++
	- creates .gpl scripts automatically from c++ with easy functions
	- save plots on disk as .EPS or .PNG or other formats.

In future we plan to support also other type of rendering software,
because the architecture of this system is not limited to POVray.

## Requirements

- To **run** applications based on this unit, there are no requirements.
  Note however that you may want to
	- install [POVray](http://www.POVray.org) to load and render
	  the output files if you are interested in the POVray output,
	- install [GNUPLOT](http://www.gnuplot.info) to display plots if
	  you are interested in the GNUPLOT output.

- To **build** applications based on this unit there are no requirements.

## Building instructions

This unit corresponds to an additional DLL library,
called **ChronoEngine_POSTPROCESS.dll**, that can be linked to your application
if you want to use it. On Linux systems, the .dll suffix is .so.

1. Repeat the instructions for the [full installation](@ref tutorial_install_chrono), but when you see
   the CMake window, you must add the following steps:

2. Set the `ENABLE_MODULE_POSTPROCESS` as 'on', then press 'Configure' (to refresh the variable list)

3. Press 'Configure' again, then 'Generate', and proceed as usual in the installation instructions.

When you will rebuild the project, you could find the demo_postprocess in the
binary directory, among other default demos.

## How to use it

- Look at the [API section](group__postprocess__module.html) of this module for documentation about classes and functions.

- Look at the C++ source of [demos](@ref tutorial_root) to learn how to use the functions of this module.


text:
/*************************** -*- Mod: C++ -*- ******************************
  SSLSNIConfig.cc
   Created On      : 05/02/2017

   Description:
   SNI based Configuration in ATS
 ****************************************************************************/

#include "SSLSNIConfig.h"
#include "P_SNIActionPerformer.h"

#include "PreWarmManager.h"

#include "tscore/Diags.h"
#include "tscore/SimpleTokenizer.h"
#include "tscore/ink_memory.h"
#include "tscore/I_Layout.h"

#include "tscpp/util/TextView.h"

#include <sstream>
#include <utility>
#include <pcre.h>

static constexpr int OVECSIZE{30};

////
// NamedElement
//
NamedElement::NamedElement(NamedElement &&other)
{
  *this = std::move(other);
}

NamedElement &
NamedElement::operator=(NamedElement &&other)
{
  if (this != &other) {
    match = std::move(other.match);
  }
  return *this;
}

void
NamedElement::set_glob_name(std::string name)
{
  std::string::size_type pos = 0;
  while ((pos = name.find('.', pos)) != std::string::npos) {
    name.replace(pos, 1, "\\.");
    pos += 2;
  }
  pos = 0;
  while ((pos = name.find('*', pos)) != std::string::npos) {
    name.replace(pos, 1, "(.{0,})");
  }
  Debug("ssl_sni", "Regexed fqdn=%s", name.c_str());
  set_regex_name(name);
}

void
NamedElement::set_regex_name(const std::string &regex_name)
{
  const char *err_ptr;
  int err_offset = 0;
  if (!regex_name.empty()) {
    match.reset(pcre_compile(regex_name.c_str(), PCRE_ANCHORED | PCRE_CASELESS, &err_ptr, &err_offset, nullptr));
  }
}

////
// SNIConfigParams
//
const NextHopProperty *
SNIConfigParams::get_property_config(const std::string &servername) const
{
  const NextHopProperty *nps = nullptr;
  for (auto &&item : next_hop_list) {
    if (pcre_exec(item.match.get(), nullptr, servername.c_str(), servername.length(), 0, 0, nullptr, 0) >= 0) {
      // Found a match
      nps = &item.prop;
      break;
    }
  }
  return nps;
}

int
SNIConfigParams::load_sni_config()
{
  for (auto &item : yaml_sni.items) {
    auto ai = sni_action_list.emplace(sni_action_list.end());
    ai->set_glob_name(item.fqdn);
    Debug("ssl", "name: %s", item.fqdn.data());

    // set SNI based actions to be called in the ssl_servername_only callback
    if (item.offer_h2.has_value()) {
      ai->actions.push_back(std::make_unique<ControlH2>(item.offer_h2.value()));
    }
    if (item.verify_client_level != 255) {
      ai->actions.push_back(
        std::make_unique<VerifyClient>(item.verify_client_level, item.verify_client_ca_file, item.verify_client_ca_dir));
    }
    if (item.host_sni_policy != 255) {
      ai->actions.push_back(std::make_unique<HostSniPolicy>(item.host_sni_policy));
    }
    if (!item.protocol_unset) {
      ai->actions.push_back(std::make_unique<TLSValidProtocols>(item.protocol_mask));
    }
    if (item.tunnel_destination.length() > 0) {
      ai->actions.push_back(
        std::make_unique<TunnelDestination>(item.tunnel_destination, item.tunnel_type, item.tunnel_prewarm, item.tunnel_alpn));
    }
    if (!item.client_sni_policy.empty()) {
      ai->actions.push_back(std::make_unique<OutboundSNIPolicy>(item.client_sni_policy));
    }
    if (item.http2_buffer_water_mark.has_value()) {
      ai->actions.push_back(std::make_unique<HTTP2BufferWaterMark>(item.http2_buffer_water_mark.value()));
    }

    ai->actions.push_back(std::make_unique<SNI_IpAllow>(item.ip_allow, item.fqdn));

    // set the next hop properties
    auto nps = next_hop_list.emplace(next_hop_list.end());

    SSLConfig::scoped_config params;
    // Load if we have at least specified the client certificate
    if (!item.client_cert.empty()) {
      nps->prop.client_cert_file = Layout::get()->relative_to(params->clientCertPathOnly, item.client_cert.data());
      if (!item.client_key.empty()) {
        nps->prop.client_key_file = Layout::get()->relative_to(params->clientKeyPathOnly, item.client_key.data());
      }

      auto ctx = params->getCTX(nps->prop.client_cert_file, nps->prop.client_key_file, params->clientCACertFilename,
                                params->clientCACertPath);
      if (ctx.get() == nullptr) {
        return 1;
      }
    }

    nps->set_glob_name(item.fqdn);
    nps->prop.verify_server_policy     = item.verify_server_policy;
    nps->prop.verify_server_properties = item.verify_server_properties;
  } // end for

  return 0;
}

std::pair<const ActionVector *, ActionItem::Context>
SNIConfigParams::get(std::string_view servername) const
{
  int ovector[OVECSIZE];

  for (const auto &retval : sni_action_list) {
    int length = servername.length();
    if (retval.match == nullptr && length == 0) {
      return {&retval.actions, {}};
    } else if (auto offset = pcre_exec(retval.match.get(), nullptr, servername.data(), length, 0, 0, ovector, OVECSIZE);
               offset >= 0) {
      if (offset == 1) {
        // first pair identify the portion of the subject string matched by the entire pattern
        if (ovector[0] == 0 && ovector[1] == length) {
          // full match
          return {&retval.actions, {}};
        } else {
          continue;
        }
      }
      // If contains groups
      if (offset == 0) {
        // reset to max if too many.
        offset = OVECSIZE / 3;
      }

      ActionItem::Context::CapturedGroupViewVec groups;
      groups.reserve(offset);
      for (int strnum = 1; strnum < offset; strnum++) {
        const std::size_t start  = ovector[2 * strnum];
        const std::size_t length = ovector[2 * strnum + 1] - start;

        groups.emplace_back(servername.data() + start, length);
      }
      return {&retval.actions, {std::move(groups)}};
    }
  }
  return {nullptr, {}};
}

int
SNIConfigParams::initialize()
{
  std::string sni_filename = RecConfigReadConfigPath("proxy.config.ssl.servername.filename");

  Note("%s loading ...", sni_filename.c_str());

  struct stat sbuf;
  if (stat(sni_filename.c_str(), &sbuf) == -1 && errno == ENOENT) {
    Note("%s failed to load", sni_filename.c_str());
    Warning("Loading SNI configuration - filename: %s doesn't exist", sni_filename.c_str());

    return 0;
  }

  YamlSNIConfig yaml_sni_tmp;
  ts::Errata zret = yaml_sni_tmp.loader(sni_filename);
  if (!zret.isOK()) {
    std::stringstream errMsg;
    errMsg << zret;
    if (TSSystemState::is_initializing()) {
      Emergency("%s failed to load: %s", sni_filename.c_str(), errMsg.str().c_str());
    } else {
      Error("%s failed to load: %s", sni_filename.c_str(), errMsg.str().c_str());
    }
    return 1;
  }
  yaml_sni = std::move(yaml_sni_tmp);

  return load_sni_config();
}

SNIConfigParams::~SNIConfigParams()
{
  // sni_action_list and next_hop_list should cleanup with the params object
}

////
// SNIConfig
//
int SNIConfig::_configid = 0;

void
SNIConfig::startup()
{
  if (!reconfigure()) {
    std::string sni_filename = RecConfigReadConfigPath("proxy.config.ssl.servername.filename");
    Fatal("failed to load %s", sni_filename.c_str());
  }
}

int
SNIConfig::reconfigure()
{
  Debug("ssl", "Reload SNI file");
  SNIConfigParams *params = new SNIConfigParams;

  int retStatus = params->initialize();
  if (!retStatus) {
    _configid = configProcessor.set(_configid, params);
    prewarmManager.reconfigure();
  } else {
    delete params;
  }

  std::string sni_filename = RecConfigReadConfigPath("proxy.config.ssl.servername.filename");
  if (!retStatus || TSSystemState::is_initializing()) {
    Note("%s finished loading", sni_filename.c_str());
  } else {
    Error("%s failed to load", sni_filename.c_str());
  }

  return !retStatus;
}

SNIConfigParams *
SNIConfig::acquire()
{
  return static_cast<SNIConfigParams *>(configProcessor.get(_configid));
}

void
SNIConfig::release(SNIConfigParams *params)
{
  configProcessor.release(_configid, params);
}

// See if any of the client-side actions would trigger for this combination of servername and client IP
// host_sni_policy is an in/out parameter.  It starts with the global policy from the records.config
// setting proxy.config.http.host_sni_policy and is possibly overridden if the sni policy
// contains a host_sni_policy entry
bool
SNIConfig::test_client_action(const char *servername, const IpEndpoint &ep, int &host_sni_policy)
{
  bool retval = false;
  SNIConfig::scoped_config params;

  const auto &actions = params->get(servername);
  if (actions.first) {
    for (auto &&item : *actions.first) {
      retval |= item->TestClientSNIAction(servername, ep, host_sni_policy);
    }
  }
  return retval;
}


text:
package pfg.kraken.astar.endcheck;

import pfg.kraken.struct.Kinematic;
import pfg.kraken.struct.XYO;

public class EndWithXYO implements EndOfTrajectoryCheck
{

	@Override
	public boolean isArrived(Kinematic endPoint, Kinematic robotPoint)
	{
		return robotPoint.getPosition().squaredDistance(endPoint.getPosition()) < 5
				&& Math.abs(XYO.angleDifference(robotPoint.orientationReelle, endPoint.orientationReelle)) < 0.05;
	}

}


text:
using Microsoft.AspNetCore.Mvc;
using TimeLog.Api.Documentation.Models;

namespace TimeLog.Api.Documentation.Controllers;

public class ReportingController : Controller
{
    private readonly IReportingManager _reportingManager;

    public ReportingController(IReportingManager reportingManager)
    {
        _reportingManager = reportingManager;
    }

    // GET: Reporting
    public ActionResult Index()
    {
        return View();
    }

    public ActionResult GettingStarted()
    {
        return View();
    }

    public ActionResult Methods()
    {
        return View(_reportingManager.GetMethods());
    }

    public ActionResult Method(string id)
    {
        return View(_reportingManager.GetMethod(id));
    }

    public ActionResult EnumerableTypes()
    {
        return View();
    }

    public ActionResult PowerBi()
    {
        return View();
    }

    public ActionResult SynchronizingData()
    {
        return View();
    }
}


text:
<meta charset="utf-8">
<meta name="description" content="">
<meta name="author" content="ngoding">

<title>Ngoding ID</title>

<!-- load bootstrap from a cdn -->
{{ HTML::style('aset/css/bootstrap.min.css') }}
{{ HTML::style('aset/css/styles.css') }}
{{ HTML::script('aset/js/jquery.js') }}
{{ HTML::script('aset/js/bootstrap.js') }}


text:
<?php

namespace PhpGitHooks\Infrastructure\Composer;

use Composer\Config;
use Composer\IO\IOInterface;

/**
 * Class IOInterfaceDummy.
 */
class InMemoryIOInterface implements IOInterface
{
    /** @var  string */
    private $ask;

    /**
     * @param string $ask
     */
    public function setAsk($ask)
    {
        $this->ask = $ask;
    }

    /**
     * Is this input means interactive?
     *
     * @return bool
     */
    public function isInteractive()
    {
    }

    /**
     * Is this output verbose?
     *
     * @return bool
     */
    public function isVerbose()
    {
    }

    /**
     * Is the output very verbose?
     *
     * @return bool
     */
    public function isVeryVerbose()
    {
    }

    /**
     * Is the output in debug verbosity?
     *
     * @return bool
     */
    public function isDebug()
    {
    }

    /**
     * Is this output decorated?
     *
     * @return bool
     */
    public function isDecorated()
    {
    }

    /**
     * Writes a message to the output.
     *
     * @param string|array $messages The message as an array of lines or a single string
     * @param bool         $newline  Whether to add a newline or not
     */
    public function write($messages, $newline = true)
    {
    }

    /**
     * Overwrites a previous message to the output.
     *
     * @param string|array $messages The message as an array of lines or a single string
     * @param bool         $newline  Whether to add a newline or not
     * @param int          $size     The size of line
     */
    public function overwrite($messages, $newline = true, $size = null)
    {
    }

    /**
     * Asks a question to the user.
     *
     * @param string|array $question The question to ask
     * @param string       $default  The default answer if none is given by the user
     *
     * @return string The user answer
     *
     * @throws \RuntimeException If there is no data to read in the input stream
     */
    public function ask($question, $default = null)
    {
        return $this->ask;
    }

    /**
     * Asks a confirmation to the user.
     *
     * The question will be asked until the user answers by nothing, yes, or no.
     *
     * @param string|array $question The question to ask
     * @param bool         $default  The default answer if the user enters nothing
     *
     * @return bool true if the user has confirmed, false otherwise
     */
    public function askConfirmation($question, $default = true)
    {
    }

    /**
     * Asks for a value and validates the response.
     *
     * The validator receives the data to validate. It must return the
     * validated data when the data is valid and throw an exception
     * otherwise.
     *
     * @param string|array $question  The question to ask
     * @param callback     $validator A PHP callback
     * @param bool|int     $attempts  Max number of times to ask before giving
     *                                up (false by default, which means infinite)
     * @param string       $default   The default answer if none is given by the user
     *
     * @return mixed
     *
     * @throws \Exception When any of the validators return an error
     */
    public function askAndValidate($question, $validator, $attempts = false, $default = null)
    {
    }

    /**
     * Asks a question to the user and hide the answer.
     *
     * @param string $question The question to ask
     *
     * @return string The answer
     */
    public function askAndHideAnswer($question)
    {
    }

    /**
     * Get all authentication information entered.
     *
     * @return array The map of authentication data
     */
    public function getAuthentications()
    {
    }

    /**
     * Verify if the repository has a authentication information.
     *
     * @param string $repositoryName The unique name of repository
     *
     * @return bool
     */
    public function hasAuthentication($repositoryName)
    {
    }

    /**
     * Get the username and password of repository.
     *
     * @param string $repositoryName The unique name of repository
     *
     * @return array The 'username' and 'password'
     */
    public function getAuthentication($repositoryName)
    {
    }

    /**
     * Set the authentication information for the repository.
     *
     * @param string $repositoryName The unique name of repository
     * @param string $username       The username
     * @param string $password       The password
     */
    public function setAuthentication($repositoryName, $username, $password = null)
    {
    }

    /**
     * Loads authentications from a config instance.
     *
     * @param Config $config
     */
    public function loadConfiguration(Config $config)
    {
    }

    /**
     * Writes a message to the error output.
     *
     * @param string|array $messages The message as an array of lines or a single string
     * @param bool         $newline  Whether to add a newline or not
     */
    public function writeError($messages, $newline = true)
    {
    }

    /**
     * Overwrites a previous message to the error output.
     *
     * @param string|array $messages The message as an array of lines or a single string
     * @param bool         $newline  Whether to add a newline or not
     * @param int          $size     The size of line
     */
    public function overwriteError($messages, $newline = true, $size = null)
    {
    }
}


text:
<!DOCTYPE html>

    <title>IPV4Rule Class Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset='utf-8'>

SwiftValidator Docs (100% documented)

        SwiftValidator Reference

        IPV4Rule Class Reference

            Classes

                AlphaNumericRule

                AlphaRule

                CharacterSetRule

                ConfirmationRule

                EmailRule

                ExactLengthRule

                FloatRule

                FullNameRule

                HexColorRule

                IPV4Rule

                ISBNRule

                MaxLengthRule

                MinLengthRule

                PasswordRule

                PhoneNumberRule

                RegexRule

                RequiredRule

                ValidationError

                ValidationRule

                Validator

                ZipCodeRule

            Protocols

                Rule

                ValidationDelegate

IPV4Rule

public class IPV4Rule: RegexRule

IPV4Rule is a subclass of RegexRule that defines how a IPV4 address validated.

                    init(message:)

Initializes a IPV4Rule object to verify that field has text is an IPV4Rule address.

Declaration

Swift

public init(message: String = "Must be a valid IPV4 address")

Parameters

                                message

String of error message.

Return Value

An initialized object, or nil if an object could not be created for some reason that would not result in an exception.

© 2016 Jeff Potter. All rights reserved. (Last updated: 2016-04-15)

Generated by jazzy ♪♫ v0.5.0, a Realm project.


text:
NS_ASSUME_NONNULL_BEGIN

@interface NFDelegateSet : NSObject {
	NSMutableSet *set;  // delegate set
}

- (void)addDelegate:(nullable id)delegate;
- (void)removeDelegate:(nullable id)delegate;
- (NSArray *)list;

@end

NS_ASSUME_NONNULL_END


text:
<div class="form-row <~/common/error if="ERR[ivalue]">">
  `Setting content`

    <textarea id="ivalue" name="item[ivalue]" rows="10" class="form-control"><~i[ivalue]></textarea>


text:
sap.ui.define([
	"sap/ui/core/UIComponent",
	"sap/ui/model/json/JSONModel",
	"t1/controller/HelloDialog",
	"sap/ui/Device"
], function (UIComponent, JSONModel, HelloDialog, Device) {
	"use strict";

	return UIComponent.extend("t1.Component", {

		metadata: {
			manifest: "json"
		},

		init: function () {

// call the init function of the parent
			UIComponent.prototype.init.apply(this, arguments);

// set data model
			var oData = {
				recipient: {
					name: "World"
				}
			};
			var oModel = new JSONModel(oData);
			this.setModel(oModel);
			// disable batch grouping for v2 API of the northwind service
			this.getModel("invoice").setUseBatch(false);
			// set device model
			var oDeviceModel = new JSONModel(Device);
			oDeviceModel.setDefaultBindingMode("OneWay");
			this.setModel(oDeviceModel, "device");
// set dialog
			this.helloDialog = new HelloDialog();
// create the views based on the url/hash
			this.getRouter().initialize();
		}
	});

});


text:
package com.socks.jiandan.adapter;

import android.app.Activity;
import android.content.Intent;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.loopj.android.http.RequestHandle;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.socks.jiandan.R;
import com.socks.jiandan.async.Handler4FreshNews;
import com.socks.jiandan.async.HttpClientProxy;
import com.socks.jiandan.base.ConstantString;
import com.socks.jiandan.cache.FreshNewsCache;
import com.socks.jiandan.callback.LoadFinishCallBack;
import com.socks.jiandan.callback.LoadResultCallBack;
import com.socks.jiandan.callback.OnHttpResponseCallBackImpl;
import com.socks.jiandan.model.FreshNews;
import com.socks.jiandan.utils.JSONParser;
import com.socks.jiandan.ui.FreshNewsDetailActivity;
import com.socks.jiandan.utils.NetWorkUtil;
import com.socks.jiandan.utils.ShareUtil;
import com.socks.jiandan.utils.ShowToast;
import com.socks.jiandan.view.imageloader.ImageLoadProxy;

import java.util.ArrayList;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.Optional;

public class FreshNewsAdapter extends RecyclerView.Adapter<FreshNewsAdapter.ViewHolder> {

    private int page;
    private int lastPosition = -1;
    private boolean isLargeMode;
    private Activity mActivity;
    private DisplayImageOptions options;
    private ArrayList<FreshNews> mFreshNews;
    private LoadFinishCallBack mLoadFinisCallBack;
    private LoadResultCallBack mLoadResultCallBack;
    private ArrayList<RequestHandle> requestHandles;

    public FreshNewsAdapter(Activity activity, LoadFinishCallBack loadFinisCallBack, LoadResultCallBack loadResultCallBack, boolean isLargeMode) {
        this.mActivity = activity;
        this.isLargeMode = isLargeMode;
        this.mLoadFinisCallBack = loadFinisCallBack;
        this.mLoadResultCallBack = loadResultCallBack;
        requestHandles = new ArrayList<>();
        mFreshNews = new ArrayList<>();

        int loadingResource = isLargeMode ? R.drawable.ic_loading_large : R.drawable.ic_loading_small;
        options = ImageLoadProxy.getOptions4PictureList(loadingResource);
    }

    private void setAnimation(View viewToAnimate, int position) {
        if (position > lastPosition) {
            Animation animation = AnimationUtils.loadAnimation(viewToAnimate.getContext(), R
                    .anim.item_bottom_in);
            viewToAnimate.startAnimation(animation);
            lastPosition = position;
        }
    }

    @Override
    public void onViewDetachedFromWindow(ViewHolder holder) {

        if (isLargeMode) {
            holder.card.clearAnimation();
        } else {
            holder.ll_content.clearAnimation();
        }
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        int layoutId = isLargeMode ? R.layout.item_fresh_news : R.layout.item_fresh_news_small;
        View v = LayoutInflater.from(parent.getContext())
                .inflate(layoutId, parent, false);
        return new ViewHolder(v);
    }

    @Override
    public void onBindViewHolder(final ViewHolder holder, final int position) {

        final FreshNews freshNews = mFreshNews.get(position);

        ImageLoadProxy.displayImage(freshNews.getCustomFields().getThumb_m(), holder.img, options);
        holder.tv_title.setText(freshNews.getTitle());
        holder.tv_info.setText(freshNews.getAuthor().getName() + "@" + freshNews.getTags()
                .getTitle());
        holder.tv_views.setText("浏览" + freshNews.getCustomFields().getViews() + "次");

        if (isLargeMode) {
            holder.tv_share.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    ShareUtil.shareText(mActivity, freshNews.getTitle() + " " + freshNews.getUrl());
                }
            });

            holder.card.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    toDetailActivity(position);
                }
            });

            setAnimation(holder.card, position);
        } else {
            holder.ll_content.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    toDetailActivity(position);
                }
            });
            setAnimation(holder.ll_content, position);
        }

    }

    private void toDetailActivity(int position) {
        Intent intent = new Intent(mActivity, FreshNewsDetailActivity.class);
        intent.putExtra(FreshNewsDetailActivity.DATA_FRESH_NEWS, mFreshNews);
        intent.putExtra(FreshNewsDetailActivity.DATA_POSITION, position);
        mActivity.startActivity(intent);
    }

    @Override
    public int getItemCount() {
        return mFreshNews.size();
    }

    public void loadFirst() {
        page = 1;
        loadDataByNetworkType();
    }

    public void loadNextPage() {
        page++;
        loadDataByNetworkType();
    }

    private void loadDataByNetworkType() {

        if (NetWorkUtil.isNetWorkConnected(mActivity)) {

            RequestHandle requestHandle = HttpClientProxy.get(mActivity, FreshNews.getUrlFreshNews(page),
                    new Handler4FreshNews(new OnHttpResponseCallBackImpl<ArrayList<FreshNews>>() {
                        @Override
                        public void onSuccess(int statusCode, ArrayList<FreshNews> response) {

                            mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null);
                            mLoadFinisCallBack.loadFinish(null);

                            if (page == 1) {
                                mFreshNews.clear();
                                FreshNewsCache.getInstance(mActivity).clearAllCache();
                            }

                            mFreshNews.addAll(response);
                            notifyDataSetChanged();

                            FreshNewsCache.getInstance(mActivity).addResultCache(JSONParser.toString(response),
                                    page);
                        }

                        @Override
                        public void onFailure(int statusCode, Throwable throwable) {
                            mLoadResultCallBack.onError(LoadResultCallBack.ERROR_NET, throwable.getMessage());
                            mLoadFinisCallBack.loadFinish(null);
                        }
                    }));
            requestHandles.add(requestHandle);
        } else {
            mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null);
            mLoadFinisCallBack.loadFinish(null);

            if (page == 1) {
                mFreshNews.clear();
                ShowToast.Short(ConstantString.LOAD_NO_NETWORK);
            }

            mFreshNews.addAll(FreshNewsCache.getInstance(mActivity).getCacheByPage(page));
            notifyDataSetChanged();
        }

    }

    public void cancelAllRequest() {
        HttpClientProxy.cancelRequest(requestHandles);
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {

        @InjectView(R.id.tv_title)
        TextView tv_title;
        @InjectView(R.id.tv_info)
        TextView tv_info;
        @InjectView(R.id.tv_views)
        TextView tv_views;
        @Optional
        @InjectView(R.id.tv_share)
        TextView tv_share;
        @InjectView(R.id.img)
        ImageView img;
        @Optional
        @InjectView(R.id.card)
        CardView card;
        @Optional
        @InjectView(R.id.ll_content)
        LinearLayout ll_content;

        public ViewHolder(View contentView) {
            super(contentView);
            ButterKnife.inject(this, contentView);
        }
    }

}


text:
Given /^a file and an MD(\d+)$/ do |arg1|
  pending # express the regexp above with the code you wish you had
end

When /^I want to fetch the file through a URI$/ do
  pending # express the regexp above with the code you wish you had
end

Then /^it checks the MD(\d+)$/ do |arg1|
  pending # express the regexp above with the code you wish you had
end

Then /^it should download the file if there is no match$/ do
  pending # express the regexp above with the code you wish you had
end

Then /^it should test for an MD(\d+) match$/ do |arg1|
  pending # express the regexp above with the code you wish you had
end

Given /^a file$/ do
  pending # express the regexp above with the code you wish you had
end

Then /^it should save an MD(\d+) \(regardless\)$/ do |arg1|
  pending # express the regexp above with the code you wish you had
end


text:
<?php

namespace Monolog\Handler;

use Monolog\Logger;
use Monolog\Handler\SyslogUdp\UdpSocket;

/**
 * A Handler for logging to a remote syslogd server.
 *
 * @author Jesper Skovgaard Nielsen <nulpunkt@gmail.com>
 */
class SyslogUdpHandler extends AbstractSyslogHandler
{
    /**
     * @param string $host
     * @param int $port
     * @param mixed $facility
     * @param integer $level The minimum logging level at which this handler will be triggered
     * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
     */
    public function __construct($host, $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, $bubble = true)
    {
        parent::__construct($facility, $level, $bubble);

        $this->socket = new UdpSocket($host, $port ?: 514);
    }

    protected function write(array $record)
    {
        $lines = $this->splitMessageIntoLines($record['formatted']);

        $header = $this->makeCommonSyslogHeader($this->logLevels[$record['level']]);

        foreach ($lines as $line) {
            $this->socket->write($line, $header);
        }
    }

    public function close()
    {
        $this->socket->close();
    }

    private function splitMessageIntoLines($message)
    {
        if (is_array($message)) {
            $message = implode("\n", $message);
        }

        return preg_split('/$\R?^/m', $message);
    }

    /**
     * Make common syslog header (see rfc5424)
     */
    protected function makeCommonSyslogHeader($severity)
    {
        $priority = $severity + $this->facility;

        return "<$priority>1 ";
    }

    /**
     * Inject your own socket, mainly used for testing
     */
    public function setSocket($socket)
    {
        $this->socket = $socket;
    }
}


text:
# CombinePerKey

After creating a keyed PCollection, a common pattern  is to combine the collection of values associated with
each key into a single, merged value. The Go SDK inserts a GroupByKey and per-key Combine transform into the pipeline.

**Kata:** Implement the sum of scores per player using
[beam.CombinePerKey](https://godoc.org/github.com/apache/beam/sdks/go/pkg/beam#CombinePerKey).

  Implement the sum of scores per player using

    beam.CombinePerKey.

  Provide a function to

    beam.CombinePerKey
    that returns a sum of two numbers.

  Refer to the Beam Programming Guide

    "Combining values in a keyed PCollection" section for more information.


text:
'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.serialize = exports.test = undefined;

var _markup = require('./lib/markup');

const ELEMENT_NODE = 1;
const TEXT_NODE = 3;
const COMMENT_NODE = 8;

const ELEMENT_REGEXP = /^(HTML|SVG)\w*?Element$/;

const testNode = (nodeType, name) =>
nodeType === ELEMENT_NODE && ELEMENT_REGEXP.test(name) ||
nodeType === TEXT_NODE && name === 'Text' ||
nodeType === COMMENT_NODE && name === 'Comment';

const test = exports.test = val =>
val &&
val.constructor &&
val.constructor.name &&
testNode(val.nodeType, val.constructor.name);

// Convert array of attribute objects to keys array and props object.
const keysMapper = attribute => attribute.name;
const propsReducer = (props, attribute) => {
  props[attribute.name] = attribute.value;
  return props;
};

const serialize = exports.serialize = (
node,
config,
indentation,
depth,
refs,
printer) =>
{
  if (node.nodeType === TEXT_NODE) {
    return (0, _markup.printText)(node.data, config);
  }

  if (node.nodeType === COMMENT_NODE) {
    return (0, _markup.printComment)(node.data, config);
  }

  const type = node.tagName.toLowerCase();
  if (++depth > config.maxDepth) {
    return (0, _markup.printElementAsLeaf)(type, config);
  }

  return (0, _markup.printElement)(
  type,
  (0, _markup.printProps)(
  Array.prototype.map.call(node.attributes, keysMapper).sort(),
  Array.prototype.reduce.call(node.attributes, propsReducer, {}),
  config,
  indentation + config.indent,
  depth,
  refs,
  printer),

  (0, _markup.printChildren)(
  Array.prototype.slice.call(node.childNodes),
  config,
  indentation + config.indent,
  depth,
  refs,
  printer),

  config,
  indentation);

};exports.default =

{ serialize, test };