text:
<?php

abstract class PhabricatorObjectStatus
  extends Phobject {

  private $key;
  private $properties;

  protected function __construct($key = null, array $properties = array()) {
    $this->key = $key;
    $this->properties = $properties;
  }

  protected function getStatusProperty($key) {
    if (!array_key_exists($key, $this->properties)) {
      throw new Exception(
        pht(
          'Attempting to access unknown status property ("%s").',
          $key));
    }

    return $this->properties[$key];
  }

  public function getKey() {
    return $this->key;
  }

  public function getIcon() {
    return $this->getStatusProperty('icon');
  }

  public function getDisplayName() {
    return $this->getStatusProperty('name');
  }

  public function getColor() {
    return $this->getStatusProperty('color');
  }

  protected function getStatusSpecification($status) {
    $map = self::getStatusSpecifications();
    if (isset($map[$status])) {
      return $map[$status];
    }

    return array(
      'key' => $status,
      'name' => pht('Unknown ("%s")', $status),
      'icon' => 'fa-question-circle',
      'color' => 'indigo',
    ) + $this->newUnknownStatusSpecification($status);
  }

  protected function getStatusSpecifications() {
    $map = $this->newStatusSpecifications();

    $result = array();
    foreach ($map as $item) {
      if (!array_key_exists('key', $item)) {
        throw new Exception(pht('Status specification has no "key".'));
      }

      $key = $item['key'];
      if (isset($result[$key])) {
        throw new Exception(
          pht(
            'Multiple status definitions share the same key ("%s").',
            $key));
      }

      $result[$key] = $item;
    }

    return $result;
  }

  abstract protected function newStatusSpecifications();

  protected function newUnknownStatusSpecification($status) {
    return array();
  }

}


text:
angular
    .module('eArkPlatform')
    .filter('docStatus', docStatusFilterFactory);

function docStatusFilterFactory($translate) {
    function docStatusFilter(docStatusValue) {
        return $translate.instant('DOCUMENT.STATUS.' + docStatusValue);
    }

    return docStatusFilter;
}

redpajama_set_name: RedPajamaGithub


text:
require 'spec/spec_helper'

describe "handle index" do
  attr_reader :maker, :app, :request

  before(:each) do
    build_models!
    mock_app {  }
    @maker = new_maker(Article)
    @request = fake_request
  end

  def handle(*args)
    maker.handle(:index, *args)
  end

  it "takes a request" do
    maker.handle(:index, request)
  end

  it "loads all records" do
    mock.proxy(maker.model).all(anything) { [] }
    handle(request)
  end

  describe "rendering a response" do
    context "when there's a :format param" do
      before(:each) do
        @newest_article = Article.create!
        @request = fake_request(:format => "yaml")
        stub(maker.model).all(anything).returns([@newest_article, @article])
      end

      it "sets ETag header" do
        mock(request).etag(anything)
        handle(request)
      end

      describe "setting the last_modified params" do
        context "when the last record was the most recently updated" do
          it "sets last_modified param to the last updated record's updated_at" do
            mock(request).last_modified(anything)
            handle(request)
          end
        end

        context "when the last record was not the most recently updated" do
          before(:each) do
            @article.update_attribute :name, "Updated recently"
          end

          it "sets last_modified param to the last updated record's updated_at" do
            mock(request).last_modified(anything)
            handle(request)
          end
        end
      end
    end

    context "when there's no :format param" do
      before(:each) do
        @request = fake_request
        stub(maker.model).all(anything).returns([:article])
      end

      it "renders the index template" do
        mock.proxy(maker.responder).success(:index, request, [:article])
        handle(request)
      end
    end
  end
end


text:
ap_runtime_text_fields = {
  "InteractivePage" => [
    :name,
    :sidebar,
    :sidebar_title
  ],
  "LightweightActivity" => [
    :name,
    :description,
    :notes,
    :thumbnail_url
  ],
  "MwInteractive" => [
    :name,
    :url,
    :image_url,
    :authored_state
  ],
  "ManagedInteractive" => [
    :name,
    :url_fragment,
    :custom_image_url,
    :authored_state
  ],
  "Sequence" => [
    :description,
    :title,
    :display_title,
    :thumbnail_url
  ],
  "Embeddable::Xhtml" => [
    :name,
    :content
  ],
  "Plugin" => [
    :author_data
  ]
};

lara_runtime_text_fields = ap_runtime_text_fields.merge({
  "ImageInteractive" => [
    :caption,
    :credit,
    :url
  ],
  "VideoInteractive" => [
    :caption,
    :credit,
    :poster_url
  ],
  "VideoSource" => [
    :url
  ],
  "Embeddable::OpenResponse" => [
    :name,
    :prompt,
    :hint,
    :prediction_feedback,
    :default_text
  ],
  "Embeddable::MultipleChoice" => [
    :name,
    :prompt,
    :hint,
    :prediction_feedback
  ],
  "Embeddable::MultipleChoiceChoice" => [
    :choice,
    :prompt
  ],
  "Embeddable::Labbook" => [
    :name,
    :prompt,
    :hint
  ],
  "Embeddable::ImageQuestion" => [
    :name,
    :prompt,
    :hint,
    :drawing_prompt,
    :prediction_feedback
  ]
})

interactive_url_field = {
  "MwInteractive" => [
    :url
  ]
}

def find_text(model_class, field_name, text)
  model_class.constantize.where("#{field_name} like '%#{text}%'")
end

def replace_text(model, field_name, text, replacement, dry_run=false)
  old_text = model.send(field_name.to_s)
  new_text = old_text.gsub(text, replacement)
  if dry_run
    puts "+ would replace text of #{model.class.name}(#{model.id})##{field_name}"
    puts "  old #{old_text}"
    puts "  new #{new_text}"
    return
  end
  model.send("#{field_name}=".to_s, new_text)
  puts "+ replacing text of #{model.class.name}(#{model.id})##{field_name}"
  begin
    model.save!
  rescue
    puts "- failed to save #{model.class.name}(#{model.id})##{field_name}"
  end
end

def print_results(results, field_name, text)
  results.each do |model|
    found_text = model.send(field_name.to_s)
    highlighted = found_text.gsub(text,"\e[1m\\0\e[0m")
    puts "------------------"
    puts "#{model.class.name}(#{model.id})##{field_name} #{highlighted}"
  end
  nil
end

def matching_text(results, field_name, text, ending_character)
  matches = []
  results.each do |model|
    found_text = model.send(field_name.to_s)
    matches += found_text.scan(/#{text}[^#{ending_character}]*/)
  end
  matches
end

def find_and_print_all(text_fields, text)
  total = 0
  text_fields.each do |model_class, fields|
    fields.each do |field_sym|
      results = find_text(model_class, field_sym.to_s, text)
      total+= results.count
      print_results(results, field_sym.to_s, text)
    end
  end
  puts "------------"
  puts "Total Found: #{total}"
end

def find_all_unqiue_matches(text_fields, text, ending_character)
  matches = []
  text_fields.each do |model_class, fields|
    fields.each do |field_sym|
      results = find_text(model_class, field_sym.to_s, text)
      matches += matching_text(results, field_sym.to_s, text, ending_character)
    end
  end
  matches.uniq.sort
end

# Replace text in all the specificed text fields
# There is a `text_fields` global defined above that specifies the fields of each model
# So this an example usage:
#   find_and_replace_all(text_fields, "http://itsi.portal.concord.org/system/images", "https://s3.amazonaws.com/itsi-production/images-2009")
# Note some AWS endpoints support using `+` for spaces, but some don't, so when switching endpoints watch out for these
def find_and_replace_all(text_fields, text, replacement)
  total = 0
  text_fields.each do |model_class, fields|
    fields.each do |field_sym|
      results = find_text(model_class, field_sym.to_s, text)
      puts "Found #{results.count} in #{model_class}##{field_sym.to_s}"
      total+= results.count
      results.each do |model|
        replace_text(model, field_sym.to_s, text, replacement)
      end
    end
  end
  puts "Total Found: #{total}"
end

# 2 ways to find http interactives
interactives = MwInteractive.where("url like '%http://%'"); nil
interactives = find_text("MwInteractive", :url, "http://"); nil

# Filter out interactives that don't have pages or don't have activities
interactives = interactives.all.select{|i| i.interactive_page}; nil
interactives = interactives.all.select{|i| i.interactive_page.lightweight_activity}; nil

# create an array of interactive info
def interactive_info(i)
  info = [];
  (2013..2019).each{|year|
    info << i.interactive_page.lightweight_activity.runs.where(updated_at: Date.new(year)..Date.new(year+1)).count
  }
  info << i.interactive_page.lightweight_activity.runs.where(updated_at: Date.new(2020)..Date.today).count

  info << i.interactive_page.lightweight_activity.runs.count
  info << i.id
  info << i.interactive_page.lightweight_activity.id
  info << i.url
  info
end

def print_interactives_csv(interactives)
  results = interactives.map{|i| interactive_info(i)}; nil

  # add header
  headers = Array(2013..2019) + ['2020 on', 'total runs count', 'id', 'activity id', 'url']
  results.unshift(headers); nil

  require 'csv'
  puts results.inject([]) { |csv, row|  csv << CSV.generate_line(row) }.join(""); nil
end

# replacing the http with https (note this will also replace these within the URL if it has them as a parameter
interactives.each{|i| replace_text(i, :url, 'http://', 'https://')}; nil

# replace interactive with a button interactive that opens it in a new window
def replace_with_button(interactive)
  old_url = interactive.url
  interactive.url = "https://concord-consortium.github.io/button-interactive/"
  interactive.authored_state = {
    version: "1.0",
    description: "This component no longer works embedded in the page. Use the button below to open it in a new window.",
    url: old_url,
    label: "Open ➚"
  }.to_json
  interactive.save!
end

# to get the unicode arrow in the button text above, the following variables
# need to be set first before running the rails console
LANG="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_CTYPE="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_TIME="C.UTF-8"
LC_ALL="C.UTF-8"
export LANG LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LC_ALL

# print interactives and highlight any escaped http urls
print_results(interactives, :url, 'http%3A')

# replace esacped http urls
interactives.each{|i| replace_text(i, :url, 'http%3A', 'https%3A')}


text:
==================================
Exercise 6.4 - Words and Frequency
==================================

Question
========

Write a program that prints the distinct words in its input sorted into
decreasing order of frequency of occurrence. Precede each word by its count.

.. literalinclude:: ../../languages/cprogs/Ex_6.4.c
   :language: c
   :tab-width: 4

.. runcode:: ../../languages/cprogs/Ex_6.4.c
   :language: c
   :codesite: ideone

Explanation
===========

::

    ab
    ab
    bc
    cd
    ef
    gh
    ab
    x
    Words and their frequencies:
    bc->1
    cd->1
    ef->1
    gh->1
    ab->3

.. git_changelog::

.. seealso::

   * :c-suggest-improve:`Ex_6.4.c`
   * :c-better-explain:`Ex_6.4.rst`


text:
using Microsoft.AspNetCore.Mvc;

namespace VersioningWebSite;

public class StartupWithoutEndpointRouting : Startup
{
    public override void Configure(IApplicationBuilder app)
    {
        app.UseMvcWithDefaultRoute();
    }

    protected override void ConfigureMvcOptions(MvcOptions options)
    {
        options.EnableEndpointRouting = false;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->

<!-- Layout used by the TriStateSiteSettingsPreference. -->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:focusable="false"
    android:orientation="vertical">

    <org.chromium.components.browser_ui.widget.RadioButtonWithDescriptionLayout
        android:id="@+id/radio_button_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <org.chromium.components.browser_ui.widget.RadioButtonWithDescription
            android:id="@+id/allowed"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingStart="?android:attr/listPreferredItemPaddingStart"
            app:primaryText="@string/website_settings_category_allowed" />

        <org.chromium.components.browser_ui.widget.RadioButtonWithDescription
            android:id="@+id/ask"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingStart="?android:attr/listPreferredItemPaddingStart"
            app:primaryText="@string/website_settings_category_ask" />

        <org.chromium.components.browser_ui.widget.RadioButtonWithDescription
            android:id="@+id/blocked"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingStart="?android:attr/listPreferredItemPaddingStart"
            app:primaryText="@string/website_settings_category_blocked" />

    </org.chromium.components.browser_ui.widget.RadioButtonWithDescriptionLayout>
</LinearLayout>


text:
package main

import (
	. "fmt"
	. "strings"
)

func replaceWords(dict []string, sentence string) string {
	sentlist := Split(sentence, " ")
	for _, key := range dict {
		tempList := []string{}
		for _, word := range sentlist {
			if len(key) <= len(word) && key == word[:len(key)] {
				tempList = append(tempList, key)
			} else {
				tempList = append(tempList, word)
			}
		}
		sentlist = tempList
	}
	Println(sentlist)

	result := ""
	for _, word := range sentlist {
		result += word + " "
	}

	return result
}

func main() {
	Println(replaceWords([]string{"cat", "bat", "rat"}, "the cattle was rattled by the battery"))
}


text:
(function($, window) {
  'use strict';

  Chef.Web.Core.components.topBar = {
    init: function() {
      // Hide/show the nav items when the nav icon is clicked
      $(".top-bar .nav-icon").click(function (event) {
        $(event.target).siblings("ul").slideToggle()
      });

      // Ensure the menu items get put back to inline if the window gets bigger
      $(window).resize(function (event) {
        var display = "inline";
        if ($(".top-bar .nav-icon").is(":visible")) { display = "block"; }
        $(".top-bar ul").css("display", display);
      });
    }
  };
})(jQuery, window);


text:
//
//  SPRemoteResource.h
//  SlidePayCore
//
//  Created by Alex Garcia on 9/23/13.
//  Copyright (c) 2013 SlidePay. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <RestKit/RestKit.h>

#define WRONG_OBJECT -1
#define SUCCESS_FLAG_FALSE -2

/**
 *  Typedef for the block response handler used when a remote resource request fails
 *
 *  @param serverCode    The SlidePay error code returned by the server.
 *  @param serverMessage A human readable string describing the server error. Can be nil.
 *  @param error         If an error occured during the request, it's provided here. Can be nil.
 */
typedef void(^ResourceFailureBlock)(NSInteger serverCode, NSString* serverMessage, NSError*error);

@interface SPRemoteResource : NSObject

/**
 *  The resource desginator portion of the URL.
 */
@property (nonatomic) NSString * resource;

/**
 *  The base URL for a network request.
 */
@property (nonatomic,readonly) NSString * endpoint;
@property (nonatomic,readonly) NSString * authToken;
@property (nonatomic,strong) RKObjectManager * objectManager;
@property (nonatomic,readonly) NSString * TAG;

+(void) configureWithResponse:(NSDictionary*)response;
+(NSIndexSet*) successCodes;
+(NSIndexSet*) failureCodes;
+(BOOL)responseSanityCheck:(NSDictionary*)response errorCode:(NSNumber**)errorCode errorMessage:(NSString**)errorMessage;
+(BOOL) checkResponseObjectForSuccessFlag:(id)responseObject failure:(ResourceFailureBlock)failure;
+(void)reset;
+(NSDictionary*)responseFromOperation:(AFHTTPRequestOperation*)operation;
//+(BOOL) checkResponseForSuccessFlag:(NSDictionary*)response;

//
+(RKObjectManager*) sharedManager;

@end


text:
/*eslint no-magic-numbers: "off"*/
/*eslint no-invalid-this: "off"*/
const expect            = require('chai').expect;
const Promise           = require('bluebird');
const TestConfig        = require('../config');
const Utils             = require('../utils');
const Subtask           = require('../../app/models/subtask');
const Subtasks          = require('../../app/services/subtasks');
const Transfer          = require('../../app/services/transfer');
const createEsClient    = require('../../config/elasticsearch');
const createRedisClient = require('../../config/redis');
const config            = require('../../config/index');
const to_bytes          = require('../../config/utils').to_bytes;

const log = config.log;

Promise.longStackTraces();
Promise.onPossiblyUnhandledRejection((error) => log.error('Likely error: ', error.stack));

describe('subtasks service', function () {
  this.timeout(100000);

  let source   = null;
  let redis    = null;
  let subtasks = null;
  let utils    = null;

  before((done) => {
    source = createEsClient(TestConfig.elasticsearch.source);
    redis = createRedisClient(TestConfig.redis.host, TestConfig.redis.port);
    subtasks = new Subtasks(redis);
    utils = new Utils();

    utils.deleteAllTemplates(source)
      .finally(() => utils.deleteAllIndices(source))
      .finally(() => redis.flushdb())
      .finally(() => done());
  });

  after((done) => {
    redis.quit().finally(() => done());
  });

  afterEach((done) => {
    utils.deleteAllTemplates(source)
      .finally(() => utils.deleteAllIndices(source))
      .finally(() => redis.flushdb())
      .finally(() => done());
  });

  const TEST_INDEX    = 'myindex1';
  const TEST_TYPE     = 'mytype1';
  const fakeTask      = {
    source:      TestConfig.elasticsearch.source,
    destination: TestConfig.elasticsearch.destination,
    transfer:    {
      documents: {
        fromIndices: TEST_INDEX
      }
    }
  };
  const loadedFilters = {};
  const createIndex   = (shards) => source.indices.create({
    index: TEST_INDEX,
    body:  {
      settings: {
        index: {
          number_of_shards:   shards,
          number_of_replicas: 0
        }
      },
      mappings: {[TEST_TYPE]: {_size: {enabled: true}}}
    }
  });

  const upload      = (maxIterations, chunkSize, minSize, maxSize) => {
    const buildBody      = () => {
      const body = [];
      for (let i = 0; i < chunkSize; i++) {
        body.push({index: {_index: TEST_INDEX, _type: TEST_TYPE}});
        body.push({size: minSize + Math.floor(Math.random() * (maxSize - minSize))});
      }
      return body;
    };
    const uploadInternal = (index) => index >= maxIterations
      ? null
      : source.bulk({refresh: true, body: buildBody()})
        .then(() => source.indices.refresh({index: TEST_INDEX}))
        .then(() => uploadInternal(index + 1));

    return uploadInternal(0);
  };
  const uploadExact = (chunkSize, size) => {
    const buildBody = () => {
      const body = [];
      for (let i = 0; i < chunkSize; i++) {
        body.push({index: {_index: TEST_INDEX, _type: TEST_TYPE}});
        body.push({size});
      }
      return body;
    };
    return source.bulk({refresh: true, body: buildBody()})
      .then(() => source.indices.refresh({index: TEST_INDEX}));
  };

  const assertSubtask = (subtask, flushSize, minSize, maxSize) => {
    expect(subtask.source).to.be.equals(fakeTask.source);
    expect(subtask.destination).to.be.equals(fakeTask.destination);
    expect(subtask.mutators).to.be.equals(fakeTask.mutators);
    expect(subtask.transfer.flushSize).to.be.equals(flushSize);
    expect(subtask.transfer.documents.index).to.be.equals(TEST_INDEX);
    expect(subtask.transfer.documents.type).to.be.equals(TEST_TYPE);
    expect(subtask.transfer.documents.minSize).to.be.equals(minSize);
    expect(subtask.transfer.documents.maxSize).to.be.equals(maxSize);

  };

  it('pick bounds - no records', (done) => {
    createIndex(1)
      .then(() => Transfer.getIndices(source, fakeTask.transfer.documents.fromIndices))
      .then((allIndices) => subtasks.filterDocumentSubtasks(fakeTask, allIndices, loadedFilters, 'size'))
      .then((actual) => {
        expect(actual.length).to.be.equals(1);
        assertSubtask(actual[0], Subtask.DEFAULT_FLUSH_SIZE, -1, -1);
      })
      .then(() => done())
      .catch(done);
  });

  it('pick bounds - all records same size', (done) => {
    createIndex(1)
      .then(() => uploadExact(100, to_bytes(100, 'B')))
      .then(() => Transfer.getIndices(source, fakeTask.transfer.documents.fromIndices))
      .then((allIndices) => subtasks.filterDocumentSubtasks(fakeTask, allIndices, loadedFilters, 'size'))
      .then((actual) => {
        expect(actual.length).to.be.equals(1);
        assertSubtask(actual[0], 10000, -1, -1);
      })
      .then(() => done())
      .catch(done);
  });

  it('pick bounds - nothing above 1KB, flush size maxed out', (done) => {
    createIndex(1)
      .then(() => upload(10, 2000, to_bytes(1, 'B'), to_bytes(1, 'KB')))
      .then(() => uploadExact(1, to_bytes(1, 'KB')))
      .then(() => Transfer.getIndices(source, fakeTask.transfer.documents.fromIndices))
      .then((allIndices) => subtasks.filterDocumentSubtasks(fakeTask, allIndices, loadedFilters, 'size'))
      .then((actual) => {
        expect(actual.length).to.be.equals(3);
        assertSubtask(actual[0], 10000, to_bytes(0, 'B'), to_bytes(613, 'B'));
        assertSubtask(actual[1], 10000, to_bytes(613, 'B'), to_bytes(919, 'B'));
        assertSubtask(actual[2], 10000, to_bytes(919, 'B'), to_bytes(1, 'KB') + 1);
      })
      .then(() => done())
      .catch(done);
  });

  it('pick bounds - nothing above 10KB', (done) => {
    createIndex(1)
      .then(() => upload(10, 1000, to_bytes(1, 'B'), to_bytes(1, 'KB')))
      .then(() => upload(10, 100, to_bytes(7, 'KB'), to_bytes(8, 'KB')))
      .then(() => upload(10, 1000, to_bytes(9.2, 'KB'), to_bytes(10, 'KB')))
      .then(() => uploadExact(1, to_bytes(6, 'KB')))
      .then(() => uploadExact(1, to_bytes(9, 'KB')))
      .then(() => uploadExact(1, to_bytes(10, 'KB')))
      .then(() => Transfer.getIndices(source, fakeTask.transfer.documents.fromIndices))
      .then((allIndices) => subtasks.filterDocumentSubtasks(fakeTask, allIndices, loadedFilters, 'size'))
      .then((actual) => {
        expect(actual.length).to.be.equals(3);
        assertSubtask(actual[0], 8533, 0, 6145);
        assertSubtask(actual[1], 5688, 6145, 9217);
        assertSubtask(actual[2], 5120, 9217, to_bytes(10, 'KB') + 1);
      })
      .then(() => done())
      .catch(done);
  });

  it('pick bounds - nothing above 10KB and 4 shards', (done) => {
    createIndex(4)
      .then(() => upload(10, 1000, to_bytes(1, 'B'), to_bytes(1, 'KB')))
      .then(() => upload(10, 100, to_bytes(7, 'KB'), to_bytes(8, 'KB')))
      .then(() => upload(10, 1000, to_bytes(9.2, 'KB'), to_bytes(10, 'KB')))
      .then(() => uploadExact(1, to_bytes(6, 'KB')))
      .then(() => uploadExact(1, to_bytes(9, 'KB')))
      .then(() => uploadExact(1, to_bytes(10, 'KB')))
      .then(() => Transfer.getIndices(source, fakeTask.transfer.documents.fromIndices))
      .then((allIndices) => subtasks.filterDocumentSubtasks(fakeTask, allIndices, loadedFilters, 'size'))
      .then((actual) => {
        expect(actual.length).to.be.equals(3);
        assertSubtask(actual[0], 2133, 0, 6145);
        assertSubtask(actual[1], 1422, 6145, 9217);
        assertSubtask(actual[2], 1280, 9217, to_bytes(10, 'KB') + 1);
      })
      .then(() => done())
      .catch(done);
  });

  it('pick bounds - nothing above 50MB', (done) => {
    createIndex(1)
      .then(() => upload(10, 1000, to_bytes(20, 'B'), to_bytes(10, 'KB')))
      .then(() => upload(50, 5000, to_bytes(10, 'KB'), to_bytes(200, 'KB')))
      .then(() => upload(1, 100, to_bytes(20, 'MB'), to_bytes(50, 'MB')))
      .then(() => uploadExact(1, to_bytes(50, 'MB')))
      .then(() => Transfer.getIndices(source, fakeTask.transfer.documents.fromIndices))
      .then((allIndices) => subtasks.filterDocumentSubtasks(fakeTask, allIndices, loadedFilters, 'size'))
      .then((actual) => {
        expect(actual.length).to.be.equals(2);
        assertSubtask(actual[0], 100, 0, 524288);
        assertSubtask(actual[1], 1, 1048576, to_bytes(50, 'MB') + 1);
      })
      .then(() => done())
      .catch(done);
  });

  it('pick bounds - nothing above 50MB', (done) => {
    createIndex(1)
      .then(() => upload(10, 1000, to_bytes(20, 'B'), to_bytes(10, 'KB')))
      .then(() => upload(50, 5000, to_bytes(10, 'KB'), to_bytes(200, 'KB')))
      .then(() => upload(1, 100, to_bytes(20, 'MB'), to_bytes(500, 'MB')))
      .then(() => uploadExact(1, to_bytes(500, 'MB')))
      .then(() => Transfer.getIndices(source, fakeTask.transfer.documents.fromIndices))
      .then((allIndices) => subtasks.filterDocumentSubtasks(fakeTask, allIndices, loadedFilters, 'size'))
      .then((actual) => {
        expect(actual.length).to.be.equals(2);
        assertSubtask(actual[0], 100, 0, 524288);
        assertSubtask(actual[1], 1, 1048576, to_bytes(500, 'MB') + 1);
      })
      .then(() => done())
      .catch(done);
  });
});


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

namespace Pb.TileMap
{
	/// <summary>
	/// Base class for chunk renderers
	/// </summary>
	[System.Serializable]
	public class ChunkRenderer :
		ScriptableObject
	{
		/// <summary>
		/// Renders a chunk with a tile map controller, chunk, and chunk game object.
		/// All created objects should either be components on the chunk game object or children of it.
		/// Creating game objects elsewhere will not allow them to be destroyed when the chunk is unloaded.
		/// </summary>
		/// <param name="tmc">The TileMapController loading the chunk</param>
		/// <param name="chunk">The chunk being rendered</param>
		/// <param name="chunk_go">The game object made for the chunk</param>
		/// <returns>Whether the chunk was rendered</returns>
		public virtual bool Render(TileMapController tmc, Chunk chunk, GameObject chunk_go)
		{
			return false;
		}
	}
}


text:
namespace ControlHandler{
    template <class Type>
    class ModelPredictiveControl
    {
        ModelHandler::StateSpace<Type> SSd;
        ModelHandler::PredictionModel<Type> SSP;
        ModelHandler::IntegrativeModel<Type> SSI;
        LinAlg::Matrix<Type> K, W, Q, R, U;

    public:
        ModelPredictiveControl(){}
        ModelPredictiveControl(const ModelHandler::StateSpace<Type>       &SS,
                               const ModelHandler::IntegrativeModel<Type> &SSI,
                               const ModelHandler::PredictionModel <Type> &SSP,
                               const LinAlg::Matrix<Type> &Q, const LinAlg::Matrix<Type> &R,
                               const LinAlg::Matrix<Type> &W);

        void setReference(LinAlg::Matrix<Type> W);
        void setErrorWeight(LinAlg::Matrix<Type> Q);
        void setInitialState(LinAlg::Matrix<Type> X0);
        void setControlWeight(LinAlg::Matrix<Type> R);
        void setNewModel(ModelHandler::StateSpace<Type>       SS,
                         ModelHandler::IntegrativeModel<Type> SSI,
                         ModelHandler::PredictionModel <Type> SSP,
                         LinAlg::Matrix<Type> Q, LinAlg::Matrix<Type> R,
                         LinAlg::Matrix<Type> W);

        LinAlg::Matrix<Type> getReference() const;
        LinAlg::Matrix<Type> getErrorWeight() const;
        LinAlg::Matrix<Type> getInitialState() const;
        LinAlg::Matrix<Type> getControlWeight() const;

        LinAlg::Matrix<Type> OutputControlCalc(LinAlg::Matrix<Type> X_input);
        LinAlg::Matrix<Type> OutputControlCalc(LinAlg::Matrix<Type> X_input, LinAlg::Matrix<Type> W);
        LinAlg::Matrix<Type> OutputControlCalc(LinAlg::Matrix<Type> X_input, LinAlg::Matrix<Type> Q, LinAlg::Matrix<Type> R, LinAlg::Matrix<Type> W);

    };
}

#include "SistemasdeControle/src/controlLibs/modelpredictivecontrol.hpp"
#endif // PREDITIVO_H


text:
namespace EliteLogAgent
{
    partial class About
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(About));
            this.logoBox = new System.Windows.Forms.PictureBox();
            this.titleLabel = new System.Windows.Forms.Label();
            this.aboutLabel = new System.Windows.Forms.Label();
            ((System.ComponentModel.ISupportInitialize)(this.logoBox)).BeginInit();
            this.SuspendLayout();
            //
            // logoBox
            //
            this.logoBox.Location = new System.Drawing.Point(16, 15);
            this.logoBox.Margin = new System.Windows.Forms.Padding(4);
            this.logoBox.Name = "logoBox";
            this.logoBox.Size = new System.Drawing.Size(64, 59);
            this.logoBox.TabIndex = 0;
            this.logoBox.TabStop = false;
            //
            // titleLabel
            //
            this.titleLabel.AutoSize = true;
            this.titleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.titleLabel.Location = new System.Drawing.Point(87, 15);
            this.titleLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.titleLabel.Name = "titleLabel";
            this.titleLabel.Size = new System.Drawing.Size(192, 29);
            this.titleLabel.TabIndex = 1;
            this.titleLabel.Text = "Software Name";
            //
            // aboutLabel
            //
            this.aboutLabel.AutoSize = true;
            this.aboutLabel.Location = new System.Drawing.Point(88, 44);
            this.aboutLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.aboutLabel.Name = "aboutLabel";
            this.aboutLabel.Size = new System.Drawing.Size(333, 102);
            this.aboutLabel.TabIndex = 2;
            this.aboutLabel.Text = "Elite: Dangerous log parser\r\n\r\nDeveloped by: CMDR John Kozak\r\n\r\nSpecial thanks to" +
    " CMDR Phelbore for huge amount \r\n  of advice and testing";
            //
            // About
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(468, 197);
            this.Controls.Add(this.aboutLabel);
            this.Controls.Add(this.titleLabel);
            this.Controls.Add(this.logoBox);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Margin = new System.Windows.Forms.Padding(4);
            this.Name = "About";
            this.Text = "About";
            this.Load += new System.EventHandler(this.About_Load);
            ((System.ComponentModel.ISupportInitialize)(this.logoBox)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.PictureBox logoBox;
        private System.Windows.Forms.Label titleLabel;
        private System.Windows.Forms.Label aboutLabel;
    }
}


text:
const composeUsername = (dev) => {
  const date = new Date();
  const year = date.getFullYear() - dev.age;
  const username =  dev.firstName + dev.lastName.charAt(0) + year;
  return username.toLowerCase();
};

const addUsername = (list) => list.map((dev) => {
  const username = composeUsername(dev);
  return Object.assign({}, dev, { username });
});


text:
<?php

namespace Latte;

/**
 * HTML element node.
 */
class HtmlNode
{
	use Strict;

	/** @var string */
	public $name;

	/** @var bool */
	public $empty;

	/** @deprecated */
	public $isEmpty;

	/** @var array */
	public $attrs = [];

	/** @var array */
	public $macroAttrs = [];

	/** @var bool */
	public $closing = FALSE;

	/** @var HtmlNode */
	public $parentNode;

	/** @var string */
	public $attrCode;

	/** @var int  position of start tag in source template */
	public $startLine;

	/** @var int  position of end tag in source template */
	public $endLine;

	/** @var string @internal */
	public $innerMarker;

	public function __construct($name, self $parentNode = NULL)
	{
		$this->name = $name;
		$this->parentNode = $parentNode;
		$this->isEmpty = &$this->empty;
	}

}


text:
package main

import (
	"net/http"

	"github.com/UniversityRadioYork/2016-site/controllers"
	"github.com/UniversityRadioYork/2016-site/structs"
	"github.com/UniversityRadioYork/myradio-go"
	"github.com/codegangsta/negroni"
	"github.com/gorilla/mux"
)

// Server is the type of the main 2016site web application.
type Server struct {
	*negroni.Negroni
}

// NewServer creates a 2016site server based on the config c.
func NewServer(c *structs.Config) (*Server, error) {

	s := Server{negroni.Classic()}

	session, err := myradio.NewSessionFromKeyFile()

	if err != nil {
		return &s, err
	}

	router := mux.NewRouter().StrictSlash(true)

	getRouter := router.Methods("GET").Subrouter()

	// Routes go in here
	nfc := controllers.NewNotFoundController(c)
	router.NotFoundHandler = http.HandlerFunc(nfc.Get)

	ic := controllers.NewIndexController(session, c)
	getRouter.HandleFunc("/", ic.Get)

	sc := controllers.NewSearchController(session, c)
	getRouter.HandleFunc("/search/", sc.Get)

	showC := controllers.NewShowController(session, c)
	//	getRouter.HandleFunc("/schedule/shows", showC.Get) // @TODO: Implement this
	getRouter.HandleFunc("/schedule/shows/{id:[0-9]+}/", showC.GetShow).Name("show")
	getRouter.HandleFunc("/schedule/shows/timeslots/{id:[0-9]+}/", showC.GetTimeslot).Name("timeslot")
	getRouter.HandleFunc("/schedule/shows/seasons/{id:[0-9]+}/", showC.GetSeason).Name("season")

	// NOTE: NewScheduleWeekController assumes 'timeslot' is installed BEFORE it is called.
	schedWeekC := controllers.NewScheduleWeekController(session, getRouter, c)
	getRouter.HandleFunc("/schedule/thisweek/", schedWeekC.GetThisWeek).Name("schedule-thisweek")

	getRouter.HandleFunc("/schedule/{year:[1-9][0-9][0-9][0-9]}/w{week:[0-5]?[0-9]}/", schedWeekC.GetByYearWeek).Name("schedule-week")
	// This route exists so that day schedule links from the previous website aren't broken.
	getRouter.HandleFunc("/schedule/{year:[1-9][0-9][0-9][0-9]}/w{week:[0-5]?[0-9]}/{day:[1-7]}/", schedWeekC.GetByYearWeek).Name("schedule-week-day-compat")

	pc := controllers.NewPeopleController(session, c)
	getRouter.HandleFunc("/people/{id:[0-9]+}/", pc.Get)

	getinvolvedC := controllers.NewGetInvolvedController(session, c)
	getRouter.HandleFunc("/getinvolved/", getinvolvedC.Get)

	staticC := controllers.NewStaticController(c)
	getRouter.HandleFunc("/about/", staticC.GetAbout)
	getRouter.HandleFunc("/contact/", staticC.GetContact)
	getRouter.HandleFunc("/competitions/", staticC.GetCompetitions)

	// End routes

	s.UseHandler(router)

	return &s, nil

}


text:
package net.opengis.gml.impl;
/**
 * An XML ArrayType(@http://www.opengis.net/gml).
 *
 * This is a complex type.
 */
public class ArrayTypeImpl extends net.opengis.gml.impl.AbstractGMLTypeImpl implements net.opengis.gml.ArrayType
{
    private static final long serialVersionUID = 1L;

    public ArrayTypeImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }

    private static final javax.xml.namespace.QName MEMBERS$0 =
        new javax.xml.namespace.QName("http://www.opengis.net/gml", "members");

    /**
     * Gets the "members" element
     */
    public net.opengis.gml.ArrayAssociationType getMembers()
    {
        synchronized (monitor())
        {
            check_orphaned();
            net.opengis.gml.ArrayAssociationType target = null;
            target = (net.opengis.gml.ArrayAssociationType)get_store().find_element_user(MEMBERS$0, 0);
            if (target == null)
            {
                return null;
            }
            return target;
        }
    }

    /**
     * True if has "members" element
     */
    public boolean isSetMembers()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(MEMBERS$0) != 0;
        }
    }

    /**
     * Sets the "members" element
     */
     public void setMembers(net.opengis.gml.ArrayAssociationType members)
    {
        generatedSetterHelperImpl(members, MEMBERS$0, 0, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);
    }

    /**
     * Appends and returns a new empty "members" element
     */
    public net.opengis.gml.ArrayAssociationType addNewMembers()
    {
        synchronized (monitor())
        {
            check_orphaned();
            net.opengis.gml.ArrayAssociationType target = null;
            target = (net.opengis.gml.ArrayAssociationType)get_store().add_element_user(MEMBERS$0);
            return target;
        }
    }

    /**
     * Unsets the "members" element
     */
    public void unsetMembers()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(MEMBERS$0, 0);
        }
    }
}


text:
package org.apache.drill.exec.store.http;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.calcite.rex.RexNode;
import org.apache.calcite.util.Pair;
import org.apache.drill.common.map.CaseInsensitiveMap;
import org.apache.drill.common.types.TypeProtos.MinorType;
import org.apache.drill.exec.ops.OptimizerRulesContext;
import org.apache.drill.exec.physical.base.GroupScan;
import org.apache.drill.exec.store.StoragePluginOptimizerRule;
import org.apache.drill.exec.store.http.filter.ExprNode;
import org.apache.drill.exec.store.http.filter.ExprNode.AndNode;
import org.apache.drill.exec.store.http.filter.ExprNode.ColRelOpConstNode;
import org.apache.drill.exec.store.http.filter.ExprNode.OrNode;
import org.apache.drill.exec.store.http.filter.FilterPushDownListener;
import org.apache.drill.exec.store.http.filter.FilterPushDownStrategy;

/**
 * The HTTP storage plugin accepts filters which are:
 *

 *
A single column = value expression, where the column is
 * a filter column from the config, or

 *
An AND'ed set of such expressions,

 *
If the value is one with an unambiguous conversion to
 * a string. (That is, not dates, binary, maps, etc.)

 *

 */
public class HttpPushDownListener implements FilterPushDownListener {

  public static Set<StoragePluginOptimizerRule> rulesFor(
      OptimizerRulesContext optimizerRulesContext) {
    return FilterPushDownStrategy.rulesFor(
        new HttpPushDownListener());
  }

  @Override
  public String prefix() {
    return "Http";
  }

  @Override
  public boolean isTargetScan(GroupScan groupScan) {
    return groupScan instanceof HttpGroupScan;
  }

  @Override
  public ScanPushDownListener builderFor(GroupScan groupScan) {
    HttpGroupScan httpScan = (HttpGroupScan) groupScan;
    if (httpScan.hasFilters() || !httpScan.allowsFilters()) {
      return null;
    } else {
      return new HttpScanPushDownListener(httpScan);
    }
  }

  private static class HttpScanPushDownListener implements ScanPushDownListener {

    private final HttpGroupScan groupScan;
    private final Map<String, String> filterParams = CaseInsensitiveMap.newHashMap();

    HttpScanPushDownListener(HttpGroupScan groupScan) {
      this.groupScan = groupScan;
      for (String field : groupScan.getHttpConfig().params()) {
        filterParams.put(field, field);
      }
    }

    @Override
    public ExprNode accept(ExprNode node) {
      if (node instanceof OrNode) {
        return null;
      } else if (node instanceof ColRelOpConstNode) {
        return acceptRelOp((ColRelOpConstNode) node);
      } else {
        return null;
      }
    }

    /**
     * Only accept equality conditions.
     */
    private ColRelOpConstNode acceptRelOp(ColRelOpConstNode relOp) {
      switch (relOp.op) {
      case EQ:
        return acceptColumn(relOp.colName) &&
               acceptType(relOp.value.type) ? relOp : null;
      default:
        return null;
      }
    }

    /**
     * Only accept columns in the filter params list.
     */
    private boolean acceptColumn(String colName) {
      return filterParams.containsKey(colName);
    }

    /**
     * Only accept types which have an unambiguous mapping to
     * String.
     */
    private boolean acceptType(MinorType type) {
      switch (type) {
      case BIGINT:
      case BIT:
      case FLOAT4:
      case FLOAT8:
      case INT:
      case SMALLINT:
      case VARCHAR:
      case VARDECIMAL:
        return true;
      default:
        return false;
      }
    }

    /**
     * Convert the equality nodes to a map of param/string pairs using
     * the case specified in the storage plugin config.
     */
    @Override
    public Pair<GroupScan, List<RexNode>> transform(AndNode andNode) {
      Map<String, String> filters = new HashMap<>();
      double selectivity = 1;
      for (ExprNode expr : andNode.children) {
        ColRelOpConstNode relOp = (ColRelOpConstNode) expr;
        filters.put(filterParams.get(relOp.colName), relOp.value.value.toString());
        selectivity *= relOp.op.selectivity();
      }
      HttpGroupScan newScan = new HttpGroupScan(groupScan, filters, selectivity);
      return Pair.of(newScan, Collections.emptyList());
    }
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- From: file:/F:/TheMovieTime/libraryPullToRefresh/build/intermediates/bundles/debug/res/values-es/values-es.xml -->
    <eat-comment/>
    <string name="pull_to_refresh_pull_label">Tirar para actualizar…</string>
    <string name="pull_to_refresh_refreshing_label">Cargando…</string>
    <string name="pull_to_refresh_release_label">Soltar para actualizar…</string>
</resources>


text:
require 'rexml/document'
require 'logger'

include REXML

class Nessus
	attr_reader :token

	def initialize(options = {})
		options = {:host => "127.0.0.1", :port => "8834", :timeout => "120"}.merge(options)

		@host = options[:host]
		@port = options[:port]
		@timeout = options[:timeout]

		if options[:logger] then
			@logger = options[:logger]
		else
			@logger = Logger.new(STDOUT)
		end

		@token = nil
	end

	def execute_command(command, parameters,  fail_on_error = true)
		cmd = "curl --silent --max-time #{@timeout} --insecure "
		parameters.each do|param|
			if param[:type].nil? || param[:type] == :data then
				cmd << "--data \"#{param[:value]}\" "
			elsif param[:type] == :form then
				cmd << "--form \"#{param[:value]}\" "
			elsif param[:type] == :cookie then
				cmd << "--cookie \"#{param[:value]}\" "
			else
				raise "unknown parameter type #{param[:type]}"
			end
		end

		cmd << "https://#{@host}:#{@port}/#{command}"

		@logger.info {"Executing command: #{cmd}"}

		result_str = `#{cmd}`

		raise "unexpected return value from nessus command #{command} " unless result_str.class == String

		result = Document.new(result_str)
		status = result.elements.inject("reply/status", []) {|r, x| r << x.text}

		if fail_on_error then
			raise "Invalid return status for nessus command #{command}" unless status && status.length == 1 && status[0] == "OK"
		end

		return result
	end

	def login(username, password)
		result = execute_command("login", [{:value => "login=#{username}"}, {:value => "password=#{password}"}])
		token = result.elements.inject("reply/contents/token", []) {|r, x| r << x.text}
		raise "Invalid token during nessus login" unless token && token.length == 1

		@token = token[0]
	end

	def upload_file(file)
		raise "File '#{file}' is not accessible" unless File.exist?(file) && File.readable?(file)

		reply = execute_command("file/upload",
	   	                    [{:type => :cookie, :value => "token=#{@token}"},
	      	                  {:type => :form, :value => "Filedata=@#{file}"}])
		return reply.elements.inject("/reply/contents/fileUploaded", []) {|r, x| r << x.text}[0]
	end

	def import_policy(filename)
		return execute_command("file/policy/import",
	   	                           [{:value => "file=#{filename}"},
	      	                         {:type => :cookie, :value => "token=#{@token}"}])
	end

	def delete_policy(id)
		return execute_command("policy/delete",
	   	                           [{:value => "policy_id=#{id}"},
	      	                         {:type => :cookie, :value => "token=#{@token}"}])
	end

	def get_policy_ids(policy_name)
		policies = execute_command("policy/list",
	   	                               [{:type => :cookie, :value => "token=#{@token}"}])
		return policies.elements.inject("/reply/contents/policies/policy[policyName='#{policy_name}']/policyID", []) {|r, x| r << x.text}
	end

	def import_policy_file(file)
		policy_name = Nessus.get_policy_name_from_file(file)
		policy_ids = get_policy_ids(policy_name)
		policy_ids.each do|id|
			delete_policy(id)
		end
		uploaded_name = upload_file(file)
		policies = import_policy(uploaded_name)
		return policies.elements.inject("/reply/contents/policies/policy[policyName='#{policy_name}']/policyID", []) {|r, x| r << x.text}[0]
	end

	#Start a new nessus scan
	#
	# @param :policy_id The policy id of the policy to use (String)
	# @param :targets The scan targets (String or Array of String)
	def start_scan(options)
		raise "Missing parameter :policy_id" unless options[:policy_id]
		raise "Missing parameter :targets" unless options[:targets]

		scan_opts = [{:value => "policy_id=#{options[:policy_id]}"},
		             {:type => :cookie, :value => "token=#{@token}"}]

		if options[:targets].class() == String then
			scan_opts << {:value => "target=#{options[:targets]}"}
		elsif options[:targets].class() == Array then
			options[:targets].each do|target|
				scan_opts << {:value => "target=#{target}"}
			end
		else
			raise "Unknown target type #{options[:targets].class().name()}"
		end

		scan_reply = execute_command("scan/new",  scan_opts)
		return scan_reply.elements.inject("/reply/contents/scan/uuid", []) {|r, x| r << x.text}[0]
	end

	def scan_status(uuid)
		report = list_report(uuid)
		return "unknown" unless report

		return report["status"]
	end

	def list_reports()
		reply = execute_command("report/list", [{:type => :cookie, :value => "token=#{@token}"}])

		results = []
		reply.elements.each("/reply/contents/reports/report") do|elem|
			result = {}
			elem.elements.each do|subelem|
				result[subelem.name] = subelem.text
			end
			results << result
		end

		return results
	end

	def list_report(uuid)
		reports = list_reports()

		report = reports.reject {|rep| rep["name"] != uuid}

		return nil if report.length != 1

		return report[0]
	end

	def save_report(uuid, file)
		report = execute_command("file/report/download",
		                       [{:value => "report=#{uuid}"},
		                        {:type => :cookie, :value => "token=#{@token}"}],
		                       false)
		if report.elements.inject("/NessusClientData_v2", []) {|r, x| r << x}.empty? then
			raise "error during save_report"
		end

		File.open(file, 'w') {|file| file << report.to_s}
	end

	def delete_report(uuid)
		report = execute_command("report/delete",
		                       [{:value => "report=#{uuid}"},
		                        {:type => :cookie, :value => "token=#{@token}"}])
	end

	# Scan targets completely and return when scan is finished
	#
	# Note: Only one of :policy_id, :policy_name or :policy_file needs to be specified.
	# @param :targets Hosts to scan (String or Array of String)
	# @param :report_file Path to report file (String)
	# @param :policy_id Policy ID of policy to use (String)
	# @param :policy_name Name of policy to use (String)
	# @param :policy_file Path to policy file to import and use (String)
	# @param :delete_policy (optional) Delete policy when scan is finished (Boolean)
	# @param :delete_report (optional) Delete report when scan is finished (Boolean)
	def scan_targets(options)
		raise "Need parameter :targets" unless options[:targets]
		raise "Need parameter :report_file" unless options[:report_file]

		policy_id = ""

		if options[:policy_id] then
			policy_id = options[:policy_id]
		elsif options[:policy_name] then
			policy_ids = get_policy_ids(policy_name)

			raise "No policy with this name (#{policy_name}) found" if policy_ids.empty?
			raise "Several policies with this name (#{policy_name}) found" if policy_ids.length > 1
			policy_id = policy_ids[0]
		elsif options[:policy_file] then
			policy_id = import_policy_file(options[:policy_file])
		else
			raise "Need parameter :policy_file, :policy_name or :policy_id"
		end

		scan_uuid = start_scan(:policy_id => policy_id, :targets => options[:targets])
		while scan_status(scan_uuid) != "completed" do
			sleep 30
		end
		save_report(scan_uuid, options[:report_file])
		delete_policy(policy_id) if options[:delete_policy]
		delete_report(scan_uuid) if options[:delete_report]

		return scan_uuid
	end

	def logout()
		execute_command("logout",
		                [{:type => :cookie, :value => "token=#{@token}"}])
		@token = nil
	end

	def self.get_policy_name_from_file(file)
		return (Document.new(File.new(file)).elements.inject("NessusClientData_v2/Policy/policyName", []) {|r, x| r << x.text})[0]
	end

	# Allowed values for configuration keys are:
	#
	#  "policy_name": "some_name"
	#  "policy_shared": "0" if the policy is not shared, or "1" if it is shared
	#  "SSH settings[entry]:SSH user name :": "root"
	#  "SSH settings[file]:SSH private key to use :": {:type => :file, :file => "/tmp/key.pem"}
	#  "plugin_selection.family.Service detection": "enabled", "disabled", "mixed"
	#  "plugin_selection.individual_plugin.19679": "enabled", "disabled"
	#  "SSH settings[radio]:Elevate privileges with :": "Nothing", "sudo", "su", ...
	def new_policy(options)
		raise "missing option \"policy_name\"" unless options["policy_name"]
		raise "missing option \"policy_shared\"" unless options["policy_shared"]

		cmd_params = [{:type => :cookie, :value => "token=#{@token}"}]

		options.each do|key,value|
			if value.class() == String then
				cmd_params << {:value => "#{key}=#{value}"}
			elsif value.class() == Hash then
				if value[:type] == :file then
					filename = upload_file(value[:file])
					cmd_params << {:value => "#{key}=#{filename}"}
				else
					raise "Unknown value hash type '#{value[:type]}' for policy configuration key '#{key}'"
				end
			else
				raise "Unknown value type '#{value.class()} for policy configuration key '#{key}'"
			end
		end

		reply = execute_command("policy/add", cmd_params)
		policy_ids = reply.elements.inject("/reply/contents/policy/policyID", []) {|r, x| r << x.text}

		raise "Policy '#{options["policy_name"]}' already exists or was not imported (#{policy_ids.length()})" unless policy_ids.length() == 1

		return policy_ids[0]
	end

	def list_plugin_families()
		reply = execute_command("plugins/list",
		                        [{:type => :cookie, :value => "token=#{@token}"}])
		return reply.elements.inject("/reply/contents/pluginFamilyList/family/familyName", []) {|r, x| r << x.text}
	end

	def list_plugin_family(family_name)
		reply = execute_command("plugins/list/family",
		                        [{:type => :cookie, :value => "token=#{@token}"},
		                         {:value => "family=#{family_name}"}])
		results = []

		reply.elements.each("/reply/contents/pluginList/plugin") do|elem|
			result = {}
			elem.elements.each do|subelem|
				result[subelem.name] = subelem.text
			end
			results << result
		end
		return results
	end
end


text:
<?php
/**
 * Created by: ogre
 * Date: 2014-04-19
 * Time: 14:47
 */

require_once('rest_response_page.class.php');
require_once(DIR_INC . 'classes/api/responses/login/rerr_need_login.class.php');
require_once(DIR_INC . 'classes/user/user_nameless_dbc.class.php');
require_once(DIR_INC . 'classes/api/responses/_misc/rerr_missing_parameters.class.php');
require_once(DIR_INC . 'classes/api/responses/_misc/rerr_invalid_parameter_value.class.php');
require_once(DIR_INC . 'classes/api/responses/_misc/rerr_internal_server_error.class.php');
require_once(DIR_INC . 'classes/user/user_nameless_dbc.class.php');

abstract class Rest_Response_Page_UA extends Rest_Response_Page {
    private $ua_config;

    abstract protected function handle_request_logged(Web_Context $context, User $user);

    public function handle_request(Web_Context $context) {
        $user = $this->who_is_logged();
        if ($user) {
            $resp = $this->handle_request_logged($context, $user);
        } else {
            $resp = new RErr_Need_Login();
        }

        return $resp;
    }

    function __construct($page_name, $ua_config) {
        parent::__construct($page_name);
        $this->set_ua_config($ua_config);
    }

    public function set_ua_config($ua_config) {
        $this->ua_config = $ua_config;
    }

    public function get_ua_config() {
        return $this->ua_config;
    }

    /**
     * @return bool|User
     */
    protected function who_is_logged() {
        return $this->get_user();
    }

    /**
     * @return bool|User
     */
    protected function get_user() {
        $ret = false;

        $user_auth_config = $this->get_ua_config();
        $svm = $this->get_svm();
        if ($svm->is_global_var_registered($user_auth_config['session_var_name'])) {
            $user = $svm->get_global_var($user_auth_config['session_var_name']);
            if ($user instanceof User) {
                $ret = $user;
            }
        }

        return $ret;
    }

    /**
     * Returns current web site configuration object.
     *
     * @return My_Web_Site_Config Current $WSC
     */
    public function get__config() {
        return $this->_config;
    }
}


text:
package com.guyulei.emarket.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.guyulei.emarket.utils.UIUtils;
import com.guyulei.emarket.view.LoadingPage;

import java.util.ArrayList;

/**
 * Created by 12539 on 2017/8/24.
 */

public abstract class BaseFragment extends Fragment {

    private static final String ACTIVITY_TAG = "guyulei";
    private LoadingPage mLoadingPage;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        mLoadingPage = new LoadingPage(UIUtils.getContext()) {
            @Override
            public View onCreateSuccess() {
                return onCreateSuccessView();
            }

            @Override
            protected ResultState initNetData() {
                return onLoadNetData();
            }
        };
        return mLoadingPage;
    }

    public abstract View onCreateSuccessView();

    public abstract LoadingPage.ResultState onLoadNetData();

    public void loadNetData() {
        if (mLoadingPage != null) {
            mLoadingPage.loadData();
        }
    }

    public LoadingPage.ResultState checkData(Object obj) {
        if (obj != null) {
            if (obj instanceof ArrayList) {
                ArrayList list = (ArrayList) obj;
                if (!list.isEmpty()) {
                    return LoadingPage.ResultState.SUCCESS_STATE;
                } else {
                    return LoadingPage.ResultState.EMPTY_STATE;//暂无数据
                }
            }
        }
        return LoadingPage.ResultState.ERROR_STATE;
    }
}


text:
use strict;
use warnings;
package Task::Tapper::Server::Automation;
# git description: caec9eb085e3a752c42522a38c4dc3805ce6920c

BEGIN {
  $Task::Tapper::Server::Automation::AUTHORITY = 'cpan:AMD';
}
{
  $Task::Tapper::Server::Automation::VERSION = '0.001';
}
# ABSTRACT: Tapper - dependencies for automation layer

__END__
=pod

=head1 NAME

Task::Tapper::Server::Automation - Tapper - dependencies for automation layer

=head1 VERSION

version 0.001

=head1 TASK CONTENTS

=head2 Explicit troublemaker deps

=head3 L<Proc::ProcessTable>

=head3 L<App::Daemon>

=head2 Tapper

=head3 L<Tapper::Action>

=head3 L<Tapper::Producer>

=head3 L<Tapper::MCP>

=head3 L<Tapper::Notification>

=head3 L<Tapper::MCP::MessageReceiver>

1;

=head1 AUTHOR

AMD OSRC Tapper Team <tapper@amd64.org>

=head1 COPYRIGHT AND LICENSE

This software is Copyright (c) 2012 by Advanced Micro Devices, Inc..

This is free software, licensed under:

  The (two-clause) FreeBSD License

=cut


text:
package me.criticaldiamonds.aloawyr.engine.component;

import me.criticaldiamonds.aloawyr.engine.core.Vector3f;
import me.criticaldiamonds.aloawyr.engine.render.ForwardSpot;

public class SpotLight extends PointLight {

    private float cutoff;

    public SpotLight(Vector3f color, float intensity, Vector3f atten, float cutoff) {
	super(color, intensity, atten);
	this.cutoff = cutoff;
	setShader(ForwardSpot.getInstance());
    }

    public Vector3f getDirection() {
	return getTransform().getRot().getForward();
    }

    public float getCutoff() {
	return cutoff;
    }

    public void setCutoff(float cutoff) {
	this.cutoff = cutoff;
    }
}


text:
require 'spec_helper'

RSpec.describe 'Admin managing members', type: :feature do
  let(:member) { Fabricate(:student) }
  let(:admin) { Fabricate(:chapter_organiser) }
  let(:invitation) { Fabricate(:attended_workshop_invitation, member: member) }

  before do
    invitation

    login(admin)
    visit admin_member_path(member)
  end

  describe 'Admin managing members' do
    it 'can view member information' do
      expect(page).to have_content(member.name)
      expect(page).to have_content(member.email)
      expect(page).to have_content(member.about_you)
    end

    it 'can view a summary of member event attendances' do
      within '.attendance-summary' do
        expect(page).to have_content('1 workshops', normalize_ws: true)
      end
    end

    it 'can add a note about a member' do
      click_on 'Add note'
      fill_in 'member_note_note', with: 'Bananas and custard'
      click_on 'Save'

      within '.note' do
        expect(page).to have_content 'Bananas and custard'
        expect(page).to have_content "Note added by #{admin.full_name}"
      end
    end

    it 'can suspend a member' do
      click_on 'Suspend'

      select 'Violated attendance policy', from: 'ban_reason'
      fill_in 'ban_note', with: Faker::Lorem.word
      fill_in 'ban_expires_at', with: Time.zone.today + 1.month
      click_on 'Suspend member'

      expect(page).to have_content 'Member marked as supended and suspension email sent.'
      within '.suspension' do
        expect(page).to have_content "Suspended until #{I18n.l(Time.zone.today + 1.month)} by #{admin.full_name}"
      end
    end

    it 'can unsubscribe a member from group', js: true do
      within '#subscriptions > li:first-child' do
        expect do
          accept_confirm { find('.fa-times').click }
        end.to change { member.subscriptions.count }.by(0)
      end

      expect(page).to have_content "Successfully unsubscribed #{member.full_name}"
    end

    it 'can send an eligibility email to a member' do
      click_on 'Send eligibility inquiry'

      expect(page).to have_content 'Eligibility inquiry email sent.'
      within '.eligibility-inquiry' do
        expect(page).to have_content "Sent eligibility inquiry email by #{admin.full_name}"
      end
    end

    it 'can send an attendance warning to a member' do
      expect(page).to have_selector("a[data-confirm='Clicking OK will send an automated email to this user now to warn them about missing too many workshops. This cannot be undone. Are you sure?']")
      click_on 'Send attendance warning'
      expect(page).to have_selector("a[data-confirm='#{member.name} has already received a warning about missing too many workshops on #{member.attendance_warnings.last.created_at.strftime('%Y-%m-%d at %H:%M')}. Are you sure you want to proceed with sending another one?']")

      expect(page).to have_content 'Attendance warning email sent.'
      within '.attendance-warning' do
        expect(page).to have_content "Sent attendance warning email by #{admin.full_name}"
      end
    end
  end
end


text:
package com.siyeh.igtest.imports;

import java.util.*;
<warning descr="Single class import 'import java.io.File;'">import java.io.File;</warning>

public class SingleClassImport
{
    public HashMap m_map;
    public File file;
}


text:
<!doctype html>

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>Graph | GraphBoard/tf_graph_common</title>
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="../assets/css/main.css">

						Search
						<input id="tsd-search-field" type="text" />

Preparing search index...

The search index is not available

					GraphBoard/tf_graph_common

						Options

								All

Public

Public/Protected

All

							<input type="checkbox" id="tsd-filter-inherited" checked />
							Inherited
							<input type="checkbox" id="tsd-filter-only-exported" />
							Only exported

					Menu

					Globals

					"externs"

					graphlib

					Graph

Class Graph<N, E>

Type parameters

N

E

Hierarchy

						Graph

Index

Constructors

constructor

Methods

edge

edges

graph

has<wbr>Edge

has<wbr>Node

in<wbr>Edges

neighbors

node

node<wbr>Count

nodes

out<wbr>Edges

predecessors

remove<wbr>Edge

remove<wbr>Node

set<wbr>Edge

set<wbr>Graph

set<wbr>Node

set<wbr>Parent

sources

successors

Constructors

constructor

new <wbr>Graph(opt?: Object): Graph

Defined in externs.ts:45

Parameters

Optional opt: Object

Returns Graph

Methods

edge

edge(fromName: string, toName: string): E

edge(edgeObject: EdgeObject): E

Defined in externs.ts:51

Parameters

fromName: string

toName: string

Returns E

Defined in externs.ts:52

Parameters

edgeObject: EdgeObject

Returns E

edges

edges(): EdgeObject[]

Defined in externs.ts:63

Returns EdgeObject[]

graph

graph(): GraphOptions

Defined in externs.ts:58

Returns GraphOptions

has<wbr>Edge

has<wbr>Edge(fromName: string, toName: string): boolean

Defined in externs.ts:50

Parameters

fromName: string

toName: string

Returns boolean

has<wbr>Node

has<wbr>Node(name: string): boolean

Defined in externs.ts:48

Parameters

name: string

Returns boolean

in<wbr>Edges

in<wbr>Edges(name: string): E[]

Defined in externs.ts:65

Parameters

name: string

Returns E[]

neighbors

neighbors(name: string): string[]

Defined in externs.ts:60

Parameters

name: string

Returns string[]

node

node(name: string): N

Defined in externs.ts:55

Parameters

name: string

Returns N

node<wbr>Count

node<wbr>Count(): number

Defined in externs.ts:59

Returns number

nodes

nodes(): string[]

Defined in externs.ts:54

Returns string[]

out<wbr>Edges

out<wbr>Edges(name: string): E[]

Defined in externs.ts:64

Parameters

name: string

Returns E[]

predecessors

predecessors(name: string): string[]

Defined in externs.ts:62

Parameters

name: string

Returns string[]

remove<wbr>Edge

remove<wbr>Edge(v: string, w: string): void

Defined in externs.ts:53

Parameters

v: string

w: string

Returns void

remove<wbr>Node

remove<wbr>Node(name: string): void

remove<wbr>Node(name: string): Graph<N, E>

Defined in externs.ts:56

Parameters

name: string

Returns void

Defined in externs.ts:77

Remove the node with the id v in the graph or do nothing if
										the node is not in the graph. If the node was removed this
										function also removes any incident edges. Returns the graph,
									allowing this to be chained with other functions. Takes O(|E|) time.

Parameters

name: string

Returns Graph<N, E>

set<wbr>Edge

set<wbr>Edge(fromName: string, toName: string, value?: E): void

Defined in externs.ts:49

Parameters

fromName: string

toName: string

Optional value: E

Returns void

set<wbr>Graph

set<wbr>Graph(graphOptions: GraphOptions): void

Defined in externs.ts:57

Parameters

graphOptions: GraphOptions

Returns void

set<wbr>Node

set<wbr>Node(name: string, value?: N): void

Defined in externs.ts:47

Parameters

name: string

Optional value: N

Returns void

set<wbr>Parent

set<wbr>Parent(name: string, parentName: string): void

Defined in externs.ts:78

Parameters

name: string

parentName: string

Returns void

sources

sources(): string[]

Defined in externs.ts:70

Returns those nodes in the graph that have no in-edges.
									Takes O(|V|) time.

Returns string[]

successors

successors(name: string): string[]

Defined in externs.ts:61

Parameters

name: string

Returns string[]

						Globals

						"colors"

						"common"

						"externs"

								graphlib

						"graph"

						"hierarchy"

						"layout"

						"parser"

						"proto"

						"render"

						"scene/annotation"

						"scene/contextmenu"

						"scene/edge"

						"scene/minimap"

						"scene/node"

						"scene/scene"

						"template"

						"util"

						Graph

								constructor

								edge

								edges

								graph

								has<wbr>Edge

								has<wbr>Node

								in<wbr>Edges

								neighbors

								node

								node<wbr>Count

								nodes

								out<wbr>Edges

								predecessors

								remove<wbr>Edge

								remove<wbr>Node

								set<wbr>Edge

								set<wbr>Graph

								set<wbr>Node

								set<wbr>Parent

								sources

								successors

						Edge<wbr>Object

						Graph<wbr>Options

Legend

Module

Object literal

Variable

Function

Function with type parameter

Index signature

Type alias

Enumeration

Enumeration member

Property

Method

Interface

Interface with type parameter

Constructor

Property

Method

Index signature

Class

Class with type parameter

Constructor

Property

Method

Accessor

Index signature

Inherited constructor

Inherited property

Inherited method

Inherited accessor

Protected property

Protected method

Protected accessor

Private property

Private method

Private accessor

Static property

Static method

Generated using TypeDoc


text:
<?php

namespace Application\Migrations;

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

/**
 * Auto-generated Migration: Please modify to your needs!
 */
class Version20160914205638 extends AbstractMigration
{
    /**
     * @param Schema $schema
     */
    public function up(Schema $schema)
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('ALTER TABLE message DROP FOREIGN KEY FK_B6BD307FE2904019');
        $this->addSql('DROP INDEX IDX_B6BD307FE2904019 ON message');
        $this->addSql('ALTER TABLE message CHANGE thread_id threadId INT DEFAULT NULL');
        $this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307F4579B4E1 FOREIGN KEY (threadId) REFERENCES thread (id)');
        $this->addSql('CREATE INDEX IDX_B6BD307F4579B4E1 ON message (threadId)');
    }

    /**
     * @param Schema $schema
     */
    public function down(Schema $schema)
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('ALTER TABLE message DROP FOREIGN KEY FK_B6BD307F4579B4E1');
        $this->addSql('DROP INDEX IDX_B6BD307F4579B4E1 ON message');
        $this->addSql('ALTER TABLE message CHANGE threadid thread_id INT DEFAULT NULL');
        $this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FE2904019 FOREIGN KEY (thread_id) REFERENCES thread (id)');
        $this->addSql('CREATE INDEX IDX_B6BD307FE2904019 ON message (thread_id)');
    }
}


text:
require("lib/access")

barrier_whitelist = { [""] = true, ["cycle_barrier"] = true, ["bollard"] = true, ["entrance"] = true, ["cattle_grid"] = true, ["border_control"] = true, ["toll_booth"] = true, ["sally_port"] = true, ["gate"] = true, ["no"] = true}
access_tag_whitelist = { ["yes"] = true, ["foot"] = true, ["permissive"] = true, ["designated"] = true  }
access_tag_blacklist = { ["no"] = true, ["private"] = true, ["agricultural"] = true, ["forestery"] = true }
access_tag_restricted = { ["destination"] = true, ["delivery"] = true }
access_tags_hierachy = { "foot", "access" }
service_tag_restricted = { ["parking_aisle"] = true }
ignore_in_grid = { ["ferry"] = true }
restriction_exception_tags = { "foot" }

walking_speed = 5

speeds = {
  ["primary"] = walking_speed,
  ["primary_link"] = walking_speed,
  ["secondary"] = walking_speed,
  ["secondary_link"] = walking_speed,
  ["tertiary"] = walking_speed,
  ["tertiary_link"] = walking_speed,
  ["unclassified"] = walking_speed,
  ["residential"] = walking_speed,
  ["road"] = walking_speed,
  ["living_street"] = walking_speed,
  ["service"] = walking_speed,
  ["track"] = walking_speed,
  ["path"] = walking_speed,
  ["steps"] = walking_speed,
  ["pedestrian"] = walking_speed,
  ["footway"] = walking_speed,
  ["pier"] = walking_speed,
  ["default"] = walking_speed
}

route_speeds = {
	["ferry"] = 5
}

platform_speeds = {
	["platform"] = walking_speed
}

amenity_speeds = {
	["parking"] = walking_speed,
	["parking_entrance"] = walking_speed
}

man_made_speeds = {
	["pier"] = walking_speed
}

surface_speeds = {
	["fine_gravel"] =   walking_speed*0.75,
	["gravel"] =        walking_speed*0.75,
	["pebbelstone"] =   walking_speed*0.75,
	["mud"] =           walking_speed*0.5,
	["sand"] =          walking_speed*0.5
}

traffic_signal_penalty 	= 2
u_turn_penalty 			= 2
use_turn_restrictions   = false

function get_exceptions(vector)
	for i,v in ipairs(restriction_exception_tags) do
		vector:Add(v)
	end
end

function node_function (node)
	local barrier = node.tags:Find ("barrier")
	local access = Access.find_access_tag(node, access_tags_hierachy)
	local traffic_signal = node.tags:Find("highway")

	-- flag node if it carries a traffic light
	if traffic_signal == "traffic_signals" then
		node.traffic_light = true
	end

	-- parse access and barrier tags
	if access and access ~= "" then
		if access_tag_blacklist[access] then
			node.bollard = true
		else
			node.bollard = false
		end
	elseif barrier and barrier ~= "" then
		if barrier_whitelist[barrier] then
			node.bollard = false
		else
			node.bollard = true
		end
	end

	return 1
end

function way_function (way)
 	-- initial routability check, filters out buildings, boundaries, etc
	local highway = way.tags:Find("highway")
	local route = way.tags:Find("route")
	local man_made = way.tags:Find("man_made")
	local railway = way.tags:Find("railway")
	local amenity = way.tags:Find("amenity")
	local public_transport = way.tags:Find("public_transport")
    if (not highway or highway == '') and
		(not route or route == '') and
		(not railway or railway=='') and
		(not amenity or amenity=='') and
		(not man_made or man_made=='') and
    	(not public_transport or public_transport=='')
    	then
    	return 0
    end

    -- don't route on ways that are still under construction
    if highway=='construction' then
        return 0
    end

	-- access
    local access = Access.find_access_tag(way, access_tags_hierachy)
    if access_tag_blacklist[access] then
		return 0
    end

	local name = way.tags:Find("name")
	local ref = way.tags:Find("ref")
	local junction = way.tags:Find("junction")
	local onewayClass = way.tags:Find("oneway:foot")
	local duration	= way.tags:Find("duration")
	local service	= way.tags:Find("service")
	local area = way.tags:Find("area")
	local foot = way.tags:Find("foot")
	local surface = way.tags:Find("surface")

 	-- name
	if "" ~= ref and "" ~= name then
		way.name = name .. ' / ' .. ref
    elseif "" ~= ref then
    	way.name = ref
	elseif "" ~= name then
		way.name = name
	else
		way.name = "{highway:"..highway.."}"	-- if no name exists, use way type
		                                        -- this encoding scheme is excepted to be a temporary solution
	end

    -- roundabouts
	if "roundabout" == junction then
	  way.roundabout = true;
	end

    -- speed
    if route_speeds[route] then
		-- ferries (doesn't cover routes tagged using relations)
		way.direction = Way.bidirectional
		way.ignore_in_grid = true
		if durationIsValid(duration) then
			way.duration = math.max( 1, parseDuration(duration) )
		else
		 	way.speed = route_speeds[route]
		end
	elseif railway and platform_speeds[railway] then
		-- railway platforms (old tagging scheme)
		way.speed = platform_speeds[railway]
	elseif platform_speeds[public_transport] then
		-- public_transport platforms (new tagging platform)
		way.speed = platform_speeds[public_transport]
	elseif amenity and amenity_speeds[amenity] then
		-- parking areas
		way.speed = amenity_speeds[amenity]
	elseif speeds[highway] then
		-- regular ways
      	way.speed = speeds[highway]
	elseif access and access_tag_whitelist[access] then
	    -- unknown way, but valid access tag
		way.speed = walking_speed
    end

	-- oneway
	if onewayClass == "yes" or onewayClass == "1" or onewayClass == "true" then
		way.direction = Way.oneway
	elseif onewayClass == "no" or onewayClass == "0" or onewayClass == "false" then
		way.direction = Way.bidirectional
	elseif onewayClass == "-1" then
		way.direction = Way.opposite
	else
      way.direction = Way.bidirectional
    end

    -- surfaces
    if surface then
        surface_speed = surface_speeds[surface]
        if surface_speed then
            way.speed = math.min(way.speed, surface_speed)
            way.backward_speed  = math.min(way.backward_speed, surface_speed)
        end
    end

  	way.type = 1
    return 1
end


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="generator" content="rustdoc">
    <meta name="description" content="API documentation for the Rust `Texture` struct in crate `nitro`.">
    <meta name="keywords" content="rust, rustlang, rust-lang, Texture">

    <title>nitro::graphics::Texture - Rust</title>

    <link rel="stylesheet" type="text/css" href="../../normalize.css">
    <link rel="stylesheet" type="text/css" href="../../rustdoc.css">
    <link rel="stylesheet" type="text/css" href="../../main.css">

nitro::<wbr>graphics

        <form class="search-form js-only">

                <input class="search-input" name="search"
                       autocomplete="off"
                       placeholder="Click or press 'S' to search, '?' for more options…"
                       type="search">

        </form>

Struct nitro::<wbr>graphics::<wbr>Texture

                       [−]

               [src]

pub struct Texture {
    pub flip_vertical: bool,
    pub flip_horizontal: bool,
    // some fields omitted
}

A static handle to a texture whose data is managed by Nitro.

Fields

                           flip_vertical: bool

                           flip_horizontal: bool

Help

Keyboard Shortcuts

?

Show this help dialog

S

Focus the search field

⇤

Move up in search results

⇥

Move down in search results

⏎

Go to active search result

+

Collapse/expand all sections

Search Tricks

                    Prefix searches with a type followed by a colon (e.g.
                    fn:) to restrict the search to a given type.

                    Accepted types are: fn, mod,
                    struct, enum,
                    trait, type, macro,
                    and const.

                    Search functions by type signature (e.g.
                    vec -> usize or * -> vec)


text:
<?php

/**
 * @uses       Zend_Service_DeveloperGarden_Request_SendSms_AbstractSendSms
 * @category   Zend
 * @package    Zend_Service
 * @subpackage DeveloperGarden
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @author     Marco Kaiser
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Service_DeveloperGarden_Request_SendSms_SendSMS
    extends Zend_Service_DeveloperGarden_Request_SendSms_AbstractSendSms
{
    /**
     * this is the sms type
     * 1 = normal SMS
     *
     * @var integer
     */
    protected $_smsType = 1;
}


text:
package exercicio_5;

import java.util.Scanner;

public class Media {

	private static Scanner scanner;

	public static void main(String[] args) {

		scanner = new Scanner(System.in);
		double nota1, nota2, nota3, media;

		System.out.println("Entre com a primeira nota: ");
		nota1 = scanner.nextDouble();
		System.out.println("Entre com a segunda nota: ");
		nota2 = scanner.nextDouble();
		System.out.println("Entre com a terceira nota: ");
		nota3 = scanner.nextDouble();
		media = (nota1+nota2+nota3)/3;

		if(media >= 7){
			System.out.println("Aprovado com média: "+ media);
				}
		else if(media >= 5){
			System.out.println("Em recuperação com média: "+ media);
				}
		else{
			System.out.println("Reprovado com média: "+ media);
		}
	}

}


text:
package com.kdemo.mvc.service;

public interface TextService {

	String generate(String key);

	String generate2(String key);
}


text:
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.github.stefanbirkner</groupId>
        <artifactId>lib-parent</artifactId>
        <version>7</version>
    </parent>

    <artifactId>scroole-maven-plugin</artifactId>
    <version>0.1.0-SNAPSHOT</version>
    <packaging>maven-plugin</packaging>

    <name>Scroole</name>
    <url>http://stefanbirkner.github.io/scroole/</url>
    <inceptionYear>2015</inceptionYear>
    <licenses>
        <license>
            <name>MIT License</name>
            <url>http://opensource.org/licenses/MIT</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <prerequisites>
        <maven>3.0.4</maven>
    </prerequisites>

    <scm>
        <connection>scm:git:git://github.com/stefanbirkner/scroole.git</connection>
        <developerConnection>scm:git:git@github.com:stefanbirkner/scroole.git</developerConnection>
        <url>https://github.com/stefanbirkner/scroole/</url>
    </scm>

    <properties>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
        <findbugs.excludeFilterFile>findbugs-exclude.xml</findbugs.excludeFilterFile>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.squareup</groupId>
            <artifactId>javapoet</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>[3,4)</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>[3,4)</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>[3,4)</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>[4.12]</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>[1.7.1]</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>3.4</version>
                <configuration>
                    <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                </configuration>
                <executions>
                    <execution>
                        <id>mojo-descriptor</id>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>help-goal</id>
                        <goals>
                            <goal>helpmojo</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-invoker-plugin</artifactId>
                <version>1.10</version>
                <configuration>
                    <debug>true</debug>
                    <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                    <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>install</goal>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


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

<title>ShadowAsyncTaskBridge</title>
<meta name="date" content="2018-12-12">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.robolectric.shadows

Class ShadowAsyncTaskBridge<Params,Progress,Result>

java.lang.Object

org.robolectric.shadows.ShadowAsyncTaskBridge<Params,Progress,Result>

@DoNotInstrument
public class ShadowAsyncTaskBridge<Params,Progress,Result>
extends java.lang.Object

Bridge between shadows and AsyncTask.

Constructor Summary

Constructors

Constructor and Description

ShadowAsyncTaskBridge(android.os.AsyncTask<Params,Progress,Result> asyncTask)

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

Result
doInBackground(Params... params)

void
onCancelled()

void
onPostExecute(Result result)

void
onPreExecute()

void
onProgressUpdate(Progress... values)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

ShadowAsyncTaskBridge

public ShadowAsyncTaskBridge(android.os.AsyncTask<Params,Progress,Result> asyncTask)

Method Detail

doInBackground

public Result doInBackground(Params... params)

onPreExecute

public void onPreExecute()

onPostExecute

public void onPostExecute(Result result)

onProgressUpdate

public void onProgressUpdate(Progress... values)

onCancelled

public void onCancelled()

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
Les URL de fichiers renvoient le fichier en question
Les URL de dossiers sont traitées et formaté par Apache via le .htacces

Toutes les autres URL executent un .php associé

Les URL sont découpées en niveaux par les "/" puis confiées au controleur correspondant au premier niveau.
Exemple : "monsite.com/User/view/toto" sera confiée au controller User.php et sa fonction "get_view" sera appelée

Les controllers doivent se trouver dans le dossier /src/

Si un controller n'est pas trouvé, le controlleur "Page" est invoqué a la place
Si la fonction demandée n'existe pas, la fonction "get_default" est invoquée a la place
Exemple : "monsite.com/" sera confié a la fonction "get_default" du controleur "Page"
Exemple : "monsite.com/test" sera confié a la fonction "get_default" du controleur "test"
Exemple : "monsite.com/test/ca" sera confié a la fonction "get_ca" du controleur "test"

Le controller "Page" génére des pages listant sous forme hierarchique, les fichiers présent dans le dossier /web/public/page
Le contenu de ces page est le fichier passé dans l'URL ou a default, la page Accueil.html
Les fichiers cachés (commencant par un ".") ne sont pas listé mais restent accessible par URL
Il est possible de créer des lien symbolique pour faire lister des fichiers externe au dossier /page/

Le controller "v1" est en charge des interaction avec la bases de donnée.
Un descriptif des fonctions proposées par v1 est disponible a l'adresse "/v1"


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Sedum tenuifolium subsp. ibericum

### Remarks
null


text:
`Bytefeld EPC` is an EPC [Electronic Product Code](https://en.wikipedia.org/wiki/Electronic_Product_Code) Encoder/Decoder library written in C#, with support for .NET Framework 3.5 and .NET Standard 1.4

It aims to support the latest [EPC TAG Data Standard](http://www.gs1.org/gsmp/kc/epcglobal/tds/) with focus on id and tag uri handling.

## Install

```Powershell
Install-Package bytefeld.epc -Version 0.5.0-beta2
```

## Usage

Use the EpcTag class as an convenient entry point to the library.

Converting from binary tag into an EPC tag uri:

```csharp
string uri = EpcTag.FromBinary("302D28B329B0F6C000000001").ToString();
// uri is "epc:tag:sgtin-96:1.311112347.0987.1"
```

Converting from uri to binary representation:

```csharp
string tag = EpcTag.FromUri("epc:tag:sgtin-96:1.311112347.0987.1").ToBinary();
// tag is "302D28B329B0F6C000000001"
```

Accessing properties of a typed tag:

```csharp
var tag = EpcTag.FromBinary<Sgtin96>("302D28B329B0F6C000000001");
string customerPrefix = tag.CustomerPrefix;
```

## Supported Tags

The following tags are currently supported by Bytefeld EPC:

* SGTIN-96
* SGTIN-198
* SSCC-96

The following tags are currently not supported:

* SGLN-96
* GRAI-96
* GRAI-170
* GSRN-96
* GDTI-96
* GDTI-113
* GID-96
* DOD
* ADI