text:
/*
 * UQI Result sets
 *
 * @thread_safe: no
 * @exception_safe: nothrow
 */

#ifndef UPS_UPSCALEDB_RESULT_H
#define UPS_UPSCALEDB_RESULT_H

#include "0root/root.h"

#include "ups/upscaledb_uqi.h"

// Always verify that a file of level N does not include headers > N!
#include "1base/dynamic_array.h"

#ifndef UPS_ROOT_H
#  error "root.h was not included"
#endif

namespace upscaledb {

/*
 * The struct Result is the actual implementation of uqs_result_t.
 */
struct Result
{
  Result()
    : row_count(0), key_type(UPS_TYPE_BINARY), record_type(UPS_TYPE_BINARY),
      next_key_offset(0), next_record_offset(0) {
  }

  void initialize(uint32_t key_type_, uint32_t record_type_) {
    key_type = key_type_;
    record_type = record_type_;
  }

  void add_row(const void *key_data, uint32_t key_size,
                  const void *record_data, uint32_t record_size) {
    row_count++;
    add_key(key_data, key_size);
    add_record(record_data, record_size);
  }

  void move_from(Result &other) {
    row_count = other.row_count;
    key_type = other.key_type;
    record_type = other.record_type;
    next_key_offset = other.next_key_offset;
    next_record_offset = other.next_record_offset;
    std::swap(key_offsets, other.key_offsets);
    std::swap(record_offsets, other.record_offsets);
    std::swap(key_data, other.key_data);
    std::swap(record_data, other.record_data);
  }

  uint32_t row_count;
  uint32_t key_type;
  uint32_t record_type;
  uint32_t next_key_offset;
  uint32_t next_record_offset;
  std::vector<uint32_t> key_offsets;
  std::vector<uint32_t> record_offsets;

  // Use std::vector instead of ByteArray class because it has better
  // performance when growing. ByteArray calls realloc() for each append(),
  // std::vector doesn't.
  std::vector<uint8_t> key_data;
  std::vector<uint8_t> record_data;

  void add_key(const char *str) {
    add_key(str, (uint32_t)::strlen(str) + 1);
  }

  void add_key(const void *data, uint32_t size) {
    key_data.insert(key_data.end(),
                    (uint8_t *)data, (uint8_t *)data + size);

    key_offsets.push_back(next_key_offset);
    next_key_offset += size;
  }

  void key(uint32_t row, ups_key_t *key) {
    assert(row < row_count);

    uint32_t offset = key_offsets[row];
    if (row == row_count - 1)
      key->size = next_key_offset - offset;
    else
      key->size = key_offsets[row + 1] - offset;

    key->data = &key_data[0] + offset;
  }

  template<typename T>
  void add_record(T t) {
    add_record(&t, sizeof(t));
  }

  void add_record(const void *data, uint32_t size) {
    record_data.insert(record_data.end(),
                    (uint8_t *)data, (uint8_t *)data + size);

    record_offsets.push_back(next_record_offset);
    next_record_offset += size;
  }

  void record(uint32_t row, ups_record_t *record) {
    assert(row < row_count);
    uint32_t offset = record_offsets[row];
    if (row == row_count - 1)
      record->size = next_record_offset - offset;
    else
      record->size = record_offsets[row + 1] - offset;

    record->data = &record_data[0] + offset;
  }
};

} // namespace upscaledb

#endif /* UPS_UPSCALEDB_RESULT_H */


text:
@implementation GPUberViewElement

- (id)initWithProduct:(GPUberProduct *)product {
    self = [super init];
    if (self) {
        self.productId = product.productId;
        self.displayName = product.displayName;
        self.image = product.image;
        self.timeEstimate = -1;
    }

    return self;
}

+ (GPUberViewElement *)elementWithProduct:(GPUberProduct *)product {
    return [[GPUberViewElement alloc] initWithProduct:product];
}

- (void)parametrizeWithPrice:(GPUberPrice *)price {
    if (!price || ![price.productId isEqualToString:self.productId])
        return;

    self.priceEstimate = price.estimate;
    self.timeEstimate = price.duration;
    self.surgeMultiplier = price.surgeMultiplier;
}

- (void)parametrizeWithTime:(GPUberTime *)time {
    if (!time|| ![time.productId isEqualToString:self.productId])
        return;

    self.timeEstimate = time.estimate;
}

- (NSString *)timeEstimateString {
    NSInteger minutes = fmaxf(self.timeEstimate / 60, 1);

    if (minutes == 1)
        return @"1 min";
    else
        return [NSString stringWithFormat:@"%ld mins", (long)minutes];
}

- (BOOL)isEqual:(id)object {
    if (object == nil)
        return NO;

    if (![object isKindOfClass:[GPUberViewElement class]])
        return NO;

    if (object == self)
        return YES;

    GPUberViewElement *element = (GPUberViewElement *)object;
    return self.productId == element.productId;
}

- (NSUInteger)hash {
    return self.productId.hash;
}

@end

redpajama_set_name: RedPajamaGithub


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>org.neo4j.helpers.collection Class Hierarchy (Neo4j Community 2.0.0-M03 API)</title>
<meta name="date" content="2013-05-28">
<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

Neo4j Community

Prev

Next

Frames

No Frames

All Classes

Hierarchy For Package org.neo4j.helpers.collection

Package Hierarchies:

All Packages

Class Hierarchy

java.lang.Object

java.util.AbstractMap<K,V> (implements java.util.Map<K,V>)

java.util.HashMap<K,V> (implements java.lang.Cloneable, java.util.Map<K,V>, java.io.Serializable)

java.util.LinkedHashMap<K,V> (implements java.util.Map<K,V>)

org.neo4j.helpers.collection.LruMap<K,V>

org.neo4j.helpers.collection.ArrayIterator<T> (implements java.util.Iterator<E>)

org.neo4j.helpers.collection.CachingIterator<T> (implements java.util.ListIterator<E>)

org.neo4j.helpers.collection.PagingIterator<T>

org.neo4j.helpers.collection.CollectionWrapper<T,U> (implements java.util.Collection<E>)

org.neo4j.helpers.collection.CombiningIterable<T> (implements java.lang.Iterable<T>)

org.neo4j.helpers.collection.ExceptionHandlingIterable<T> (implements java.lang.Iterable<T>)

org.neo4j.helpers.collection.FilteringIterable<T> (implements java.lang.Iterable<T>)

org.neo4j.helpers.collection.FirstItemIterable<T> (implements java.lang.Iterable<T>)

org.neo4j.helpers.collection.Iterables

org.neo4j.helpers.collection.IterableWrapper<T,U> (implements java.lang.Iterable<T>)

org.neo4j.helpers.collection.IteratorUtil

org.neo4j.helpers.collection.IteratorWrapper<T,U> (implements java.util.Iterator<E>)

org.neo4j.helpers.collection.LimitingIterable<T> (implements java.lang.Iterable<T>)

org.neo4j.helpers.collection.MapUtil

org.neo4j.helpers.collection.NestingIterable<T,U> (implements java.lang.Iterable<T>)

org.neo4j.helpers.collection.PositionedIterator<T> (implements java.util.Iterator<E>)

org.neo4j.helpers.collection.PrefetchingIterator<T> (implements java.util.Iterator<E>)

org.neo4j.helpers.collection.CatchingIteratorWrapper<T,U>

org.neo4j.helpers.collection.CombiningIterator<T>

org.neo4j.helpers.collection.FilteringIterator<T>

org.neo4j.helpers.collection.LimitingIterator<T>

org.neo4j.helpers.collection.LinesOfFileIterator (implements org.neo4j.helpers.collection.ClosableIterator<T>)

org.neo4j.helpers.collection.NestingIterator<T,U>

org.neo4j.helpers.collection.RangeIterator

org.neo4j.helpers.collection.ResourceClosingIterator<T,V> (implements org.neo4j.graphdb.ResourceIterator<T>)

org.neo4j.helpers.collection.ReverseArrayIterator<T> (implements java.util.Iterator<E>)

org.neo4j.helpers.collection.Visitor.SafeGenerics

Interface Hierarchy

java.lang.Iterable<T>

org.neo4j.helpers.collection.ClosableIterable<T>

java.util.Iterator<E>

org.neo4j.helpers.collection.ClosableIterator<T>

org.neo4j.helpers.collection.Visitable<T>

org.neo4j.helpers.collection.Visitor<E,FAILURE>

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Neo4j Community

Prev

Next

Frames

No Frames

All Classes

Copyright © 2002-2013 The Neo4j Graph Database Project. All Rights Reserved.


text:
layout: default
title: "Syllabus"
---

## Syllabus
### {{ site.course.number }}: {{ site.course.title }}
Instructor: {{ site.course.instructor }}

### Official Course Description

INLS 560: Programming for Information Professionals (3 credits)

An introduction to computer programming focusing on language fundamentals and programming techniques for library and information science applications. Emphasizes problem-solving through the development of practical applications that include text processing, file handling, user interfaces, and web data access. Offered fall and spring.

## Overview

This course is an introduction to Programming as a skill, a discipline, and a profession for graduate students.  We'll dive into hands-on programming from day one and progress to evaluating, using, and contributing to open source libraries and frameworks.  We'll focus equally on reading and writing code.  Students will leave the course with real skills, an ability to learn new programming technologies, and an understanding of how to incorporate open source code into their projects.  It will serve as an appropriate foundation for students seeking a career in programming and indispensable background for any information professional needing to evaluate, communicate with, or work with programmers or code.

## Objectives

At the end of this course, students should:

* Have the skills required to solve problems by creating and modifying programs and systems, using modern programming tools.

* Have the knowledge of basic programming concepts, their appropriate usage, and how and where to learn more.

* Have an attitude of confidence when reading, writing, or discussing computer code

Students will be prepared to integrate these skills and knowledge with other SILS courses in Databases, Web Development, Text Mining and others.  Students will also be well versed in common tools and workflows used by developers and development teams.

### Real-world Tools

This class will introduce you to and utilize many of the tools that real development teams use for collaboration, coding, and communication.  This will include Github, Jekyll, terminal and GUI-based text editors, videoconferencing, persistent online chat, and screensharing.  By the end of the course you should be comfortable joining and collaborating on real development teams.

### Flipped Design

I'd like to emphasize the flipped design of the course.  Almost all of the content consumption (readings, lectures, etc) will be pushed outside of the class sessions.  During class we'll focus on completing exercises almost every day, which will be due by midnight if you need extra time (see below).  I'll help answer questions and provide clarification, but understanding the concepts and techniques in the content I assign you will be essential for completing the exercises in class.  Failure to do this will be a serious hindrance to understanding programming, completing the exercises and doing well in the class.

## Assignments

**Cultural Immersion Activities: ** Like other cultural products, digital technologies require an immersive experience for effective learning.  After a vocabulary of about 300-400 words is developed, students can begin teaching themselves languages, and a roughly similar threshold applies to programming concepts and technologies.  Students in INLS 560 will immerse themselves in the culture surrounding programming in three ways:

* Weekly reading and sharing of technical blogs, news outlets, and question-answer sites

* Attending **three in-person programming meetups** over the course of the semester

* Discussions with our guest speakers from industry

These experiences will combine with class assignments, readings, and in-class exercises to deepen students' interest and facility with the concepts and skills we'll learn.  Students who are unable to attend the in-person meetups may propose a comparable virtual community interaction in its place.

**In-Class Exercises:**  Almost every class will feature exercises that build on assigned readings.  These assignments can be completed and submitted during class, or students can submit them before midnight if they need extra time.  Exercises may involve pair programming and I will circle through class to resolve any confusion and share important concepts with the group.  Some of these exercises will involve code submission via Github, while others will be online exercises.

**Readings & Jekyll Blog:  **Assigned readings, lectures, or exercises should be completed before the indicated class.  In most cases their content will be essential to completing the in-class exercises.  In technology we'll often encounter terms or project names that we haven't heard of before (myself included).  We'll collaboratively author a Jekyll blog on Github, at first as an in-class exercise, and then as a way to keep explain these novel concepts and projects to each other and the community at large.

**Google Plus Community:  **We'll use a private Google Plus community for helping each other with assignments and sharing interesting readings.  We'll be able to utilize the Hangouts feature for informal discussion via video and for pair programming via screensharing.

**Final Project:  **The semester will culminate in a fully developed program or system of the student's creation.  The project should utilize one or more prominent open source library or framework and be fully documented.  Projects can be selected from examples to be provided by the instructor or the student can design their own with approval from the instructor.  Due to the interconnected nature of modern programming, projects that utilize code libraries from multiple students will be given extra credit and be eligible for an H grade (see below).  The Final Project is due at 8:00am on Friday, December 6th.  See below for my policy on late work (short version: don't be late).

**Extra Credit:** There will be infrequent opportunities to earn small amounts of extra credit.  This will usually involve doing things I might normally do, like deploying our class blog, tidying up code I write for this class for wider consumption, or helping moderate our forums.

## Materials

**Readings: **Most, if not all, materials used in this course will be drawn from freely available resources on the Internet.  This mimics the working environment of most programmers.  I'll select readings from blogs, project documentation, and leading free textbooks and developer reference books Think Python, Learn Python the Hard Way, and Pro Git.

**Software:** The course will utilize free open source software almost exclusively.  For in-class exercises we'll all use the same version of Ubuntu Linux to eliminate configuration and compatibility issues.  Students will be able to choose between installing Ubuntu on a VirtualBox virtual machine and installing the operating system on their own hardware.  VirtualBox is a free, open source project that allows Mac, Windows, and Linux systems to host other operating systems.  Detailed walkthroughs will be provided for all software installations and there will be time in class for troubleshooting.

**Hardware:**  Students will need their own laptops.  Computers conforming to CCI guidelines should do fine.  Older hardware or netbooks might have trouble with virtualization, so please contact me if you'd prefer to set up a dual-boot system.  My 2010 MacBook Pro runs VirtualBox just fine, and a native installation on an old 2007 MacBook works great as well.  Contact me if you have any questions.

## Grading

Weights of course components are as follows:

* Cultural Immersion Activities: 10%

* Google Plus Community Participation: 10%

* In-Class Exercises & Participation: 40%

* Final Project: 40%

Note that the SILS grading policy is based on the University Grading Policy. SILS uses the following graduate and undergraduate grading scales:

Graduate    Description     Undergraduate

H       Clear excellence    A

P       Entirely satisfactory   A-, B+, B, B-

L       Low passing     C+, C, C-

F       Failed          D+, D, F

For the purposes of this course, satisfactory performance (the 'P' grade) involves completing all of the assignments and showing personal mastery of the material.  Clear excellence (the 'H' grade) means participation in communities and effective collaboration with other programmers, both inside and outside our class.

## Student and Instructor Expectations

### Honor Code

Students should familiarize themselves with the University of North Carolina at Chapel Hill

Honor Code which is described in University publications.  For this course in particular, collaboration with other students will be expected in many instances, but work that is assigned to you as an individual should be yours alone.  In group projects a combination of git commit histories, writeups and/or project documentation should attribute individual and collaborative work.

### Attendance & Attention

Students should attend every class and give it their undivided attention.  Use of non-coding websites or social features is prohibited.  There will be many opportunities for interaction, but during class time please pay attention.

### Late Work

In general, lateness is not tolerated in the professional world, and these are the standards I'm holding you to.  Late work without prior approval will not be accepted.  Contact me as soon as you think you may have difficulty meeting a deadline with your rationale for an extension.  Turning work in early is good for all involved, for this class and your career beyond.

### Diversity & Inclusiveness

I take the happiness and wellbeing of all students very seriously and share the university's commitment to diversity (available here: [http://diversity.unc.edu/our-committment/div-values/](http://diversity.unc.edu/our-committment/div-values/)).  The field of programming has historically struggled with diversity but we have the opportunity to help build a more inclusive future for the profession.  I expect students to join me in welcoming different perspectives and backgrounds in the course.

## Acknowledgements

This course and its content has been deeply influenced by my interactions with and the input of others.  I'd like to thank Hilmar Lapp, Stephanie Haas, Eric Martindale, Brian Marks, Greg Wilson, John D. Martin III, and Alan Dipert for a wide range of help.


text: """Contains third party logging applications."""


text:
<?php

use SeerUK\Module\SecurityModule\Event\Listener\ForbiddenHttpExceptionListener;
use Trident\Component\HttpKernel\KernelEvents;

return function($container) {
    // Extensions
    $container->extend('security.aegis.authenticator.delegating', function($authenticator, $c) {
        $authenticator->addAuthenticator($c->get('sm.authenticator.user'));

        return $authenticator;
    });

    $container->extend('event_dispatcher', function($dispatcher, $c) {
        $dispatcher->addListener(KernelEvents::EXCEPTION, [
            new ForbiddenHttpExceptionListener(
                $c->get('configuration'),
                $c->get('request_stack'),
                $c->get('router'),
                $c->get('security')
            ),
            'onException'
        ]);

        return $dispatcher;
    });
};


text:
import React from 'react'
import WizardStep from 'react-wizard-step'

const TestComponent = ({ children }) => (<div>{ children }</div>)
const Common = () => (
  <WizardStep>
    <TestComponent title="Title 1" subTitle="Sub title 1">
      Content 1
    </TestComponent>
    <TestComponent title="Title 2" subTitle="Sub title 2">
      Content 2
    </TestComponent>
    <TestComponent title="Title 3" subTitle="Sub title 3">
      Content 3
    </TestComponent>
  </WizardStep>
)

export default Common


text:
namespace Teference.Zoho.Api
{
    #region Namespace

    using Newtonsoft.Json;

    #endregion

    internal sealed class ZsAddonJson : ZsErrorJson
    {
        [JsonProperty("addon")]
        public ZsAddon Addon { get; set; }
    }
}


text:
[![Latest Stable Version](https://poser.pugx.org/symfony-cmf/routing-auto/v/stable)](https://packagist.org/packages/symfony-cmf/routing-auto)
[![Latest Unstable Version](https://poser.pugx.org/symfony-cmf/routing-auto/v/unstable)](https://packagist.org/packages/symfony-cmf/routing-auto)
[![License](https://poser.pugx.org/symfony-cmf/routing-auto/license)](https://packagist.org/packages/symfony-cmf/routing-auto)

[![Total Downloads](https://poser.pugx.org/symfony-cmf/routing-auto/downloads)](https://packagist.org/packages/symfony-cmf/routing-auto)
[![Monthly Downloads](https://poser.pugx.org/symfony-cmf/routing-auto/d/monthly)](https://packagist.org/packages/symfony-cmf/routing-auto)
[![Daily Downloads](https://poser.pugx.org/symfony-cmf/routing-auto/d/daily)](https://packagist.org/packages/symfony-cmf/routing-auto)

Branch | Travis | Coveralls |
------ | ------ | --------- |
master | [![Build Status][travis_unstable_badge]][travis_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] |

This package is part of the [Symfony Content Management Framework (CMF)](http://cmf.symfony.com/) and licensed
under the [MIT License](LICENSE).

This component automatically creates and manages routes for configured persisted document classes.
This library contains all implementation agnostic code.

## Requirements

* PHP 7.1 / 7.2
* Symfony 2.8 / 3.3 / 3.4 / 4.0
* See also the `require` section of [composer.json](composer.json)

## Documentation

For the install guide and reference, see:

* [symfony-cmf/routing-auto Documentation](http://symfony.com/doc/master/cmf/components/routing/index.html)

See also:

* [All Symfony CMF documentation](http://symfony.com/doc/master/cmf/index.html) - complete Symfony CMF reference
* [Symfony CMF Website](http://cmf.symfony.com/) - introduction, live demo, support and community links

## Support

For general support and questions, please use [StackOverflow](http://stackoverflow.com/questions/tagged/symfony-cmf).

## Contributing

Pull requests are welcome. Please see our
[CONTRIBUTING](https://github.com/symfony-cmf/blob/master/CONTRIBUTING.md)
guide.

Unit and/or functional tests exist for this package. See the
[Testing documentation](http://symfony.com/doc/master/cmf/components/testing.html)
for a guide to running the tests.

Thanks to
[everyone who has contributed](contributors) already.

## License

This package is available under the [MIT license](src/Resources/meta/LICENSE).

[travis_legacy_badge]: https://travis-ci.org/symfony-cmf/routing-auto.svg?branch=master
[travis_stable_badge]: https://travis-ci.org/symfony-cmf/routing-auto.svg?branch=master
[travis_unstable_badge]: https://travis-ci.org/symfony-cmf/routing-auto.svg?branch=master
[travis_link]: https://travis-ci.org/symfony-cmf/routing-auto

[coveralls_legacy_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-auto/badge.svg?branch=master
[coveralls_legacy_link]: https://coveralls.io/github/symfony-cmf/routing-auto?branch=master
[coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-auto/badge.svg?branch=master
[coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/routing-auto?branch=master
[coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/routing-auto/badge.svg?branch=master
[coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/routing-auto?branch=master


text:
<?php

namespace flat\core\controller;
/**
 * Interface neutral controller for defining RESTful responses to flat routes.
 *
 */
abstract class api implements  \flat\core\input\consumer, \flat\core\controller {

   final public function __construct($param=null, $callback=null) {
      if ($param!==null) {
         $method=null;$input=null;$response_handler=null;$response_cb=null;
         if (is_array($param)) {
            if (array_key_exists('method', $param)) $method = $param['method'];
            if (array_key_exists('input', $param)) $input = $param['input'];
            if (array_key_exists('response_handler', $param)) $response_handler = $param['response_handler'];
         }elseif(is_string($param)) {
            $method=$param;
         }
         if (is_array($input) || is_object($input)) {
            $input = new \flat\input\map($input);
         } elseif (is_scalar($input)) {
            $input = new \flat\input\map(['data'=>$input]);
         } else {
            $input = new \flat\input\map([]);
         }
         if (is_callable($callback)) {
            $response_cb=$callback;
         }elseif (is_array($callback) && (array_key_exists('always', $callback))) {
            $response_cb = $callback['always'];
         }
         $callback_ok = null;
         $callback_error = null;
         if (is_array($callback) && (array_key_exists('ok', $callback))) {
            $callback_ok = $callback['ok'];
         }elseif (is_array($callback) && (array_key_exists('success', $callback))) {
            $callback_ok = $callback['success'];
         }
         if (is_array($callback) && (array_key_exists('error', $callback))) {
            $callback_error = $callback['error'];
         }
         $error_callback_invoked = false;
         $response=null;
         try {
            $response = $this->set_input($input,$method,$response_handler);
         } catch (\Exception $e) {
            if ($e instanceof \flat\api\response\exception) {
               $response = $e->get_response();
            }
            if (is_callable($callback_error)) {
               $msg = $e->getMessage();
               if ($e instanceof \flat\api\response\exception) {
                  $data = $e->get_response();
                  if ($data instanceof \flat\api\response\error) {
                     $msg = $data->message;
                     $data = $data->data;
                  }
               }
               $error_callback_invoked = true;
               $callback_error($response,$msg,$data,$e);
            } else {
               throw $e;
            }
            if (is_callable($response_cb) && ($response!==null)) {
               $response_cb($response,$e);
            } elseif (!$error_callback_invoked) {
               throw $e;
            }
            return;
         }
         if (!$error_callback_invoked && ($response instanceof \flat\api\response\error) && is_callable($callback_error)) {
            $msg = $data->message;
            $data = $data->data;
            $error_callback_invoked = true;
            $callback_error($response,$msg,$data);
         }
         $status_sub = substr((string) $response->get_status()->get_code(),0,1);
         if (!$error_callback_invoked && (($status_sub == 4) || ($status_sub == 5)) && is_callable($callback_error)) {
            $error_callback_invoked = true;
            $callback_error($response,$msg,$data,$e);
         }
         if (!$error_callback_invoked && ($status_sub==2) && is_callable($callback_ok) && ($response instanceof \flat\api\response)) {
            $callback_ok($response);
         }
         if (is_callable($response_cb)) {
            $response_cb($response);
         }
      }
   }
   /**
    * @var string
    */
   private static $response_handler;
   /**
    * @return void
    *
    */
   final static public function set_response_handler(callable $handler) {
      self::$response_handler=$handler;
   }

   /**
    * @var string fallback 'request method' when not specified by the input.
    */
   private static $_method;
   /**
    * string[] list of methods recognized by the api controller
    */
   const VALID_METHOD_LIST = ['DELETE','GET','TRACE','OPTIONS','POST','PUT','HEAD'];
   /**
    * Sets the fallback 'request method' when not specified by the input.
    *
    * @param string $method request method; Must be one of the following:
    *   GET, PUT, POST, DELETE, TRACE, HEAD, or OPTIONS.
    *
    * @return void
    *
    * @throws \flat\core\controller\api\exception\unknown_method
    */
   final static public function set_method(string $method) {
      if (!in_array($method,self::VALID_METHOD_LIST,true)) {
         throw new api\exception\unknown_method($method);
      }
      self::$_method = $method;
   }

   /**
    * @var string
    */
   private static $_media_type = "";
   public static function set_accept_mtype(string $media_type) :void {
      self::$_media_type = $media_type;
   }

   /**
    * @var string
    */
   public static function get_accept_mtype() : string {
      return self::$_media_type;
   }
   /**
    * @var string
    *    request method corresponding to the current 'input', if any.
    */
   private $_request_method;
   /**
    * @return string request method corresponding to the current 'input'.
    * @throws \flat\core\controller\api\exception\missing_method
    */
   final protected function _get_request_method() :string {
      if (empty($this->_request_method)) throw new api\exception\missing_method();
      return (string) $this->_request_method;
   }

   /**
    * @var bool
    *    true if the request method corresponding to the current 'input'
    *    was set to HEAD.
    */
   private $_HEAD_request;
   /**
    * @return bool
    *    Determines if the request method corresponding to the current 'input'
    *    was set to HEAD ('HEAD' methods are always invoked as 'GET')
    */
   final protected function _is_HEAD_request() : bool {
      return !! $this->_HEAD_request;
   }
   /**
    * Passes an input object to the the interface call associated
    *    with a request method. Optionally, invokes a callback with the
    *    once a response is resolved from the interface.
    *
    * @return \flat\api\response
    *
    * @param \flat\input $input
    * @param string $method (optional) Specify the request method to associate with this input. By default,
    *    uses the 'fallback method' specified by calling the static \flat\core\controller\api::set_method().
    *
    * @param callable $response_handler (optional) callback invoked after response object is resolved.
    *    callback signature: function(\flat\api\response $response,string $request_method).
    *    If the callback returns a \flat\api\response object, this object becomes returned value.
    *
    * @throws \flat\core\controller\api\exception\missing_method
    * @throws \flat\core\controller\api\exception\unknown_method
    * @throws \flat\core\controller\api\exception\bad_response
    *
    *
    */
   final public function set_input(\flat\input $input,string $method=null,callable $response_handler=null) :\flat\api\response {
      //       var_dump(get_called_class());
      //       die(__FILE__);
      if (empty($method)) {

         $method = self::$_method;
      }
      $invoked_method = $method;
      if ($method=='HEAD') {
         $invoked_method = 'GET';
         $this->_HEAD_request = true;
      }

      if ($method=='TRACE') {
         return new \flat\api\response\ok($input->get_as_assoc());
      }

      $this->_input_method = $invoked_method;

      if (!in_array($method,self::VALID_METHOD_LIST,true)) {
         throw new api\exception\unknown_method($method);
      }

      if (empty($invoked_method)) throw new api\exception\missing_method();
      $r = new \ReflectionClass($this);

      if ($response_handler===null) {
         $response_handler = self::$response_handler;
      }
      $response = null;

      if ($this instanceof \flat\api\method\any) {
         try {
            $response = $this->any_method($input);
         } catch (\flat\api\response\exception $e) {
            $response = $e->get_response();
         }
      }
      if (!$response instanceof \flat\api\response) {
         if ($r->implementsInterface('\flat\api\method') && $r->implementsInterface('\flat\api\method\\'.$invoked_method)) {
            $f = $invoked_method."_method";
            try {
               $response = $this->$f($input);
            } catch (\flat\api\response\exception $e) {
               $response = $e->get_response();
            }
            if (!$response instanceof \flat\api\response) {
               throw new api\exception\bad_response(
                     get_class($this),
                     $invoked_method
                     );
            }
         }
      }

      if ($response instanceof \flat\api\response) {
         if (is_callable($response_handler)) {
            $handler_return = $response_handler($response,$method);
            if ($handler_return instanceof \flat\api\response) {
               $response = $handler_return;
            }
         }
         return $response;
      } else {
         return new \flat\api\response\no_interface;
      }
   }

}


text:
layout: quote
title: Observe how they behave
date: '2015-11-19T08:47:42+04:00'
tags: []
tumblr_url: https://robertocarroll.tumblr.com/post/133528207800/design-studio-kitprecious-designstudio-researchpd
---
<img src="/images/quotes/tumblr_ny2ebiDy3D1u0ytjpo1_1280.png"/>


text:
package pers.hal42.lang;

import pers.hal42.logging.ErrorLogStream;
import pers.hal42.timer.LocalTimeFormat;
import pers.hal42.util.Executor;

import java.io.FileOutputStream;
import java.util.Date;

public class Safe {

  /**
   * this is in Safe because it uses some packages that the more obvious pakages for it otherwise aren't needed
   */
  static final LocalTimeFormat LinuxDateCommand = LocalTimeFormat.Utc("MMddHHmmyyyy.ss");

  /**
   * if 1st object is null return second else return it. Kotlin has an operator for this.
   */
  public static <T> T deNull(T nullish, T def) {
    return (nullish != null) ? nullish : def;
  }

  public static int enumSize(Class<? extends Enum> eclass) {
    return eclass.getEnumConstants().length;
  }

  public static int enumSize(Enum eg) {
    return enumSize(eg.getClass());
  }

  public static void setSystemClock(long millsfromepoch) { //exec something to set the system clock
    String forlinuxdateprogram = LinuxDateCommand.format(new Date(millsfromepoch));   //todo:1 move this line into DateX
    ErrorLogStream.Global().ERROR("setting time to:" + forlinuxdateprogram);
    String progname = pers.hal42.lang.OS.isUnish() ? "setClock " : "setClock.bat ";
    // Executor.runProcess("date -s -u "+busybox.format(now),"fixing clock",0,0,null,false);
    Executor.ezExec(progname + forlinuxdateprogram, 0);
  }

  public static FileOutputStream fileOutputStream(String filename) {
    FileOutputStream fos = null;
    try {
      fos = new FileOutputStream(filename);
    } catch (Exception e) {
      // +++ bitch
    }
    return fos;
  }

}


text:
package wordhunter

import java.io
import java.io.{File, IOException, FileReader, BufferedReader}

class Dictionary(private val data: List[String]) {

  def find(reg: WordRegex) = {
    println("Size: "+data.size)
    data.filter(reg.filter).sorted.distinct
  }
}

object Dictionary {

  def load(name: String): Option[Dictionary] = {
    try {
      println("Reading dictionary: "+new File(s"dictionaries/$name").getAbsolutePath)
      val in = new BufferedReader(new FileReader(s"dictionaries/$name"))
      Some(new Dictionary(Stream.continually(in.readLine()).takeWhile(_ != null).toList))
    } catch {
      case _: IOException => None
    }
  }
}


text:
using MonoMac.Foundation;

namespace MonoMac.CFNetwork.Test.Views
{
	[Register ("DownloadDataViewController")]
	partial class DownloadDataViewController
	{
		[Outlet]
		MonoMac.AppKit.NSView HeaderView { get; set; }

		void ReleaseDesignerOutlets ()
		{
			if (HeaderView != null) {
				HeaderView.Dispose ();
				HeaderView = null;
			}
		}
	}

	[Register ("DownloadDataView")]
	partial class DownloadDataView
	{

		void ReleaseDesignerOutlets ()
		{
		}
	}
}


text:
package umich.ms.fileio.filetypes.mzml.util;

import java.util.concurrent.TimeUnit;

/**
 * Used to convert retention times in mzML files.
 *
 * @author Dmitry Avtonomov
 */
public enum UnitsCV {

  UO_NANOSECONDS("UO:0000150", "nanosecond", TimeUnit.NANOSECONDS),
  UO_MICROSECONDS("UO:0000029", "microsecond", TimeUnit.MICROSECONDS),
  UO_MILLISECONDS("UO:0000028", "millisecond", TimeUnit.MILLISECONDS),
  UO_SECONDS("UO:0000010", "second", TimeUnit.SECONDS),
  UO_MINUTES("UO:0000031", "minute", TimeUnit.MINUTES),
  UO_HOURS("UO:0000032", "hour", TimeUnit.HOURS);
  public final String accession;
  public final String name;
  public final TimeUnit timeUnit;

  UnitsCV(String accession, String name, TimeUnit timeUnit) {
    this.accession = accession;
    this.name = name;
    this.timeUnit = timeUnit;
  }

  /**
   * Converts mzML representation of time into minutes.
   */
  public static double inMinutes(String uoAccession, String value) {
    double val = Double.parseDouble(value);

    if (UO_SECONDS.accession.equals(uoAccession)) {
      return val / 60d;
    } else if (UO_MINUTES.accession.equals(uoAccession)) {
      return val;
    } else if (UO_MILLISECONDS.accession.equals(uoAccession)) {
      return val / 1e3d / 60d;
    } else if (UO_MICROSECONDS.accession.equals(uoAccession)) {
      return val / 1e6d / 60d;
    } else if (UO_NANOSECONDS.accession.equals(uoAccession)) {
      return val / 1e9d / 60d;
    } else if (UO_HOURS.accession.equals(uoAccession)) {
      return val * 60d;
    }

    throw new IllegalArgumentException(
        "Unsupported ontology ref for time units encountered: " + uoAccession);
  }
}


text:
#ifndef __UIBUTTON_H__
#define __UIBUTTON_H__

#include "ui/UIWidget.h"
#include "ui/GUIExport.h"

/**
 * @addtogroup ui
 * @{
 */
NS_CC_BEGIN

class Label;
class SpriteFrame;

namespace ui{

    class Scale9Sprite;
/**
 * Represents a push-button widget.
 * Push-buttons can be pressed, or clicked, by the user to perform an action.
 */
class CC_GUI_DLL Button : public Widget
{

    DECLARE_CLASS_GUI_INFO

public:

    /**
     * Default constructor.
     */
    Button();

    /**
     * Default destructor.
     *
     * @lua NA
     */
    virtual ~Button();

    /**
     * Create a empty Button.
     *@return A empty Button instance.
     */
    static Button* create();

    /**
     * Create a button with custom textures.
     * @param normalImage normal state texture name.
     * @param selectedImage  selected state texture name.
     * @param disableImage disabled state texture name.
     * @param texType    @see `TextureResType`
     * @return a Button instance.
     */
    static Button* create(const std::string& normalImage,
                          const std::string& selectedImage = "",
                          const std::string& disableImage = "",
                          TextureResType texType = TextureResType::LOCAL);

    /**
     * Load textures for button.
     *
     * @param normal    normal state texture name.
     * @param selected    selected state texture name.
     * @param disabled    disabled state texture name.
     * @param texType    @see `TextureResType`
     */
    void loadTextures(const std::string& normal,
                      const std::string& selected,
                      const std::string& disabled = "",
                      TextureResType texType = TextureResType::LOCAL);

    /**
     * Load normal state texture for button.
     *
     * @param normal    normal state texture.
     * @param texType    @see `TextureResType`
     */
    void loadTextureNormal(const std::string& normal, TextureResType texType = TextureResType::LOCAL);

    /**
     * Load selected state texture for button.
     *
     * @param selected    selected state texture.
     * @param texType    @see `TextureResType`
     */
    void loadTexturePressed(const std::string& selected, TextureResType texType = TextureResType::LOCAL);

    /**
     * Load disabled state texture for button.
     *
     * @param disabled    dark state texture.
     * @param texType    @see `TextureResType`
     */
    void loadTextureDisabled(const std::string& disabled, TextureResType texType = TextureResType::LOCAL);

    /**
     * Sets capInsets for button.
     * The capInset affects  all button scale9 renderer only if `setScale9Enabled(true)` is called
     *
     * @param capInsets    capInset in Rect.
     */
    void setCapInsets(const Rect &capInsets);

    /**
     * Sets capInsets for button, only the normal state scale9 renderer will be affected.
     *
     * @param capInsets    capInsets in Rect.
     */
    void setCapInsetsNormalRenderer(const Rect &capInsets);

    /**
     * Return the capInsets of normal state scale9sprite.
     *@return The normal scale9 renderer capInsets.
     */
    const Rect& getCapInsetsNormalRenderer()const;

    /**
     * Sets capInsets for button, only the pressed state scale9 renderer will be affected.
     *
     * @param capInsets    capInsets in Rect
     */
    void setCapInsetsPressedRenderer(const Rect &capInsets);

    /**
     * Return the capInsets of pressed state scale9sprite.
     *@return The pressed scale9 renderer capInsets.
     */
    const Rect& getCapInsetsPressedRenderer()const;

    /**
     * Sets capInsets for button, only the disabled state scale9 renderer will be affected.
     *
     * @param capInsets  capInsets in Rect.
     */
    void setCapInsetsDisabledRenderer(const Rect &capInsets);

    /**
     * Return the capInsets of disabled state scale9sprite.
     *@return The disabled scale9 renderer capInsets.
     */
    const Rect& getCapInsetsDisabledRenderer()const;

    /**
     * Enable scale9 renderer.
     *
     * @param enable Set to true will use scale9 renderer, false otherwise.
     */
    virtual void setScale9Enabled(bool enable);

    /**
     * Query whether button is using scale9 renderer or not.
     *@return whether button use scale9 renderer or not.
     */
    bool isScale9Enabled()const;

    /**
     * Enable zooming action when button is pressed.
     *
     * @param enabled Set to true will enable zoom effect, false otherwise.
     */
    void setPressedActionEnabled(bool enabled);

    //override methods
    virtual void ignoreContentAdaptWithSize(bool ignore) override;
    virtual Size getVirtualRendererSize() const override;
    virtual Node* getVirtualRenderer() override;
    virtual std::string getDescription() const override;

    /**
     * Return the inner title renderer of Button.
     * @return The button title.
     * @since v3.3
     */
    Label* getTitleRenderer()const;

    /**
     * Change the content of button's title.
     *@param text The title in std::string.
     */
    void setTitleText(const std::string& text);

    /**
     * Query the button title content.
     *@return Get the button's title content.
     */
    const std::string getTitleText() const;

    /**
     * Change the color of button's title.
     *@param color The title color in Color3B.
     */
    void setTitleColor(const Color3B& color);

    /**
     * Query the button title color.
     *@return Color3B of button title.
     */
    Color3B getTitleColor() const;

    /**
     * Change the font size of button's title
     *@param size Title font size in float.
     */
    void setTitleFontSize(float size);

    /**
     * Query the font size of button title
     *@return font size in float.
     */
    float getTitleFontSize() const;

    /**
     * Change the font name of button's title
     *@param fontName a font name string.
     */
    void setTitleFontName(const std::string& fontName);

    /**
     * Query the font name of button's title
     *@return font name in std::string
     */
    const std::string getTitleFontName() const;

    /** @brief When user pressed the button, the button will zoom to a scale.
     * The final scale of the button  equals (button original scale + _zoomScale)
     * @since v3.3
     */
    void setZoomScale(float scale);

    /**
     * @brief Return a zoom scale
     * @return the zoom scale in float
     * @since v3.3
     */
    float getZoomScale()const;

CC_CONSTRUCTOR_ACCESS:
    virtual bool init() override;
    virtual bool init(const std::string& normalImage,
                      const std::string& selectedImage = "",
                      const std::string& disableImage = "",
                      TextureResType texType = TextureResType::LOCAL);

    virtual Size getNormalTextureSize() const;

protected:
    virtual void initRenderer() override;
    virtual void onPressStateChangedToNormal() override;
    virtual void onPressStateChangedToPressed() override;
    virtual void onPressStateChangedToDisabled() override;
    virtual void onSizeChanged() override;

    void loadTextureNormal(SpriteFrame* normalSpriteFrame);
    void setupNormalTexture();
    void loadTexturePressed(SpriteFrame* pressedSpriteFrame);
    void setupPressedTexture();
    void loadTextureDisabled(SpriteFrame* disabledSpriteFrame);
    void setupDisabledTexture();

    void normalTextureScaleChangedWithSize();
    void pressedTextureScaleChangedWithSize();
    void disabledTextureScaleChangedWithSize();

    virtual void adaptRenderers() override;
    void updateTitleLocation();
    void updateContentSize();
    void createTitleRenderer();

    virtual Widget* createCloneInstance() override;
    virtual void copySpecialProperties(Widget* model) override;

    virtual Size getNormalSize() const;
protected:
    Scale9Sprite* _buttonNormalRenderer;
    Scale9Sprite* _buttonClickedRenderer;
    Scale9Sprite* _buttonDisableRenderer;
    Label* _titleRenderer;

    float _zoomScale;
    bool _prevIgnoreSize;
    bool _scale9Enabled;
    bool _pressedActionEnabled;

    Rect _capInsetsNormal;
    Rect _capInsetsPressed;
    Rect _capInsetsDisabled;

    Size _normalTextureSize;
    Size _pressedTextureSize;
    Size _disabledTextureSize;

    float _normalTextureScaleXInSize;
    float _normalTextureScaleYInSize;
    float _pressedTextureScaleXInSize;
    float _pressedTextureScaleYInSize;

    bool _normalTextureLoaded;
    bool _pressedTextureLoaded;
    bool _disabledTextureLoaded;
    bool _normalTextureAdaptDirty;
    bool _pressedTextureAdaptDirty;
    bool _disabledTextureAdaptDirty;

private:
    enum class FontType
    {
        SYSTEM,
        TTF
    };

    int _fontSize;
    FontType _type;
};

}

NS_CC_END
// end of ui group
/// @}

#endif /* defined(__CocoGUI__Button__) */


text:
import {ɵɵelementEnd, ɵɵelementStart} from '../../../../src/render3/instructions/element';
import {createTNode, createTView} from '../../../../src/render3/instructions/shared';
import {ɵɵtext} from '../../../../src/render3/instructions/text';
import {RenderFlags} from '../../../../src/render3/interfaces/definition';
import {TNodeType, TViewNode} from '../../../../src/render3/interfaces/node';
import {createBenchmark} from '../micro_bench';
import {createAndRenderLView} from '../setup';

`<div>
    <button>0</button>
    <button>1</button>
    <button>2</button>
    <button>3</button>
    <button>4</button>
    <button>5</button>
    <button>6</button>
    <button>7</button>
    <button>8</button>
    <button>9</button>
  </div>
</ng-template>`;
function testTemplate(rf: RenderFlags, ctx: any) {
  if (rf & 1) {
    ɵɵelementStart(0, 'div');
    ɵɵelementStart(1, 'button', 0);
    ɵɵtext(2, '0');
    ɵɵelementEnd();
    ɵɵelementStart(3, 'button', 0);
    ɵɵtext(4, '1');
    ɵɵelementEnd();
    ɵɵelementStart(5, 'button', 0);
    ɵɵtext(6, '2');
    ɵɵelementEnd();
    ɵɵelementStart(7, 'button', 0);
    ɵɵtext(8, '3');
    ɵɵelementEnd();
    ɵɵelementStart(9, 'button', 0);
    ɵɵtext(10, '4');
    ɵɵelementEnd();
    ɵɵelementStart(11, 'button', 0);
    ɵɵtext(12, '5');
    ɵɵelementEnd();
    ɵɵelementStart(13, 'button', 0);
    ɵɵtext(14, '6');
    ɵɵelementEnd();
    ɵɵelementStart(15, 'button', 0);
    ɵɵtext(16, '7');
    ɵɵelementEnd();
    ɵɵelementStart(17, 'button', 0);
    ɵɵtext(18, '8');
    ɵɵelementEnd();
    ɵɵelementStart(19, 'button', 0);
    ɵɵtext(20, '9');
    ɵɵelementEnd();
    ɵɵelementEnd();
  }
}

const viewTNode = createTNode(null !, null, TNodeType.View, -1, null, null) as TViewNode;
const embeddedTView = createTView(-1, testTemplate, 21, 0, null, null, null, null, [
  ['name1', 'value1', 'name2', 'value2', 'name3', 'value3', 'name4', 'value4', 'name5', 'value5']
]);

// create view once so we don't profile first template pass
createAndRenderLView(null, embeddedTView, viewTNode);

// scenario to benchmark
const elementTextCreate = createBenchmark('element and text create');
const createTime = elementTextCreate('create');

console.profile('element_text_create');
while (createTime()) {
  createAndRenderLView(null, embeddedTView, viewTNode);
}
console.profileEnd();

// report results
elementTextCreate.report();


text:
module Locomotive
  module Mounter
    module Reader
      module FileSystem

        class PagesReader < Base

          attr_accessor :pages

          def initialize(runner)
            self.pages = {}
            super
          end

          # Build the tree of pages based on the filesystem structure
          #
          # @return [ Hash ] The pages organized as a Hash (using the fullpath as the key)
          #
          def read
            self.fetch

            index, not_found = self.pages['index'], self.pages['404']

            # localize the fullpath for the 2 core pages: index and 404
            [index, not_found].each { |p| p.localize_fullpath(self.locales) }

            self.build_relationships(index, self.pages_to_list)

            # Locomotive::Mounter.with_locale(:en) { self.to_s } # DEBUG

            # Locomotive::Mounter.with_locale(:fr) { self.to_s } # DEBUG

            self.pages
          end

          protected

          # Create a ordered list of pages from the Hash
          #
          # @return [ Array ] An ordered list of pages
          #
          def pages_to_list
            # sort by fullpath first
            list = self.pages.values.sort { |a, b| a.fullpath <=> b.fullpath }
            # sort finally by depth
            list.sort { |a, b| a.depth <=> b.depth }
          end

          def build_relationships(parent, list)
            # do not use an empty template for other locales than the default one
            parent.set_default_template_for_each_locale(self.default_locale)

            list.dup.each do |page|
              # comparing filepath to find out the ascendant/descendant relationship
              next unless self.is_subpage_of?(filepath_to_fullpath(page.filepath), filepath_to_fullpath(parent.filepath))

              # attach the page to the parent (order by position), also set the parent
              parent.add_child(page)

              # localize the fullpath in all the locales
              page.localize_fullpath

              # remove the page from the list
              list.delete(page)

              # go under
              self.build_relationships(page, list)
            end
          end

          # Record pages found in file system
          def fetch
            position, last_dirname = nil, nil

            Dir.glob(File.join(self.root_dir, '**/*')).sort.each do |filepath|
              next unless File.directory?(filepath) || filepath =~ /\.(#{Locomotive::Mounter::TEMPLATE_EXTENSIONS.join('|')})$/

              if last_dirname != File.dirname(filepath)
                position, last_dirname = 100, File.dirname(filepath)
              end

              page = self.add(filepath, position: position)

              next if File.directory?(filepath) || page.nil?

              if locale = self.filepath_locale(filepath)
                Locomotive::Mounter.with_locale(locale) do
                  self.set_attributes_from_header(page, filepath)
                end
              else
                Locomotive::Mounter.logger.warn "Unknown locale in the '#{File.basename(filepath)}' file."
              end

              position += 1
            end
          end

          # Add a new page in the global hash of pages.
          # If the page exists, override it.
          #
          # @param [ String ] filepath The path of the template
          # @param [ Hash ] attributes The attributes of the new page
          #
          # @return [ Object ] A newly created page or the existing one
          #
          def add(filepath, attributes = {})
            fullpath = self.filepath_to_fullpath(filepath)

            unless self.pages.key?(fullpath)
              attributes[:title]    = File.basename(fullpath).humanize
              attributes[:fullpath] = fullpath

              page = Locomotive::Mounter::Models::Page.new(attributes)
              page.mounting_point = self.mounting_point
              page.filepath       = File.expand_path(filepath)

              page.template = OpenStruct.new(raw_source: '') if File.directory?(filepath)

              self.pages[fullpath] = page
            end

            self.pages[fullpath]
          end

          # Set attributes of a page from the information
          # stored in the header of the template (YAML matters).
          # It also stores the template.
          #
          # @param [ Object ] page The page
          # @param [ String ] filepath The path of the template
          #
          def set_attributes_from_header(page, filepath)
            template = Locomotive::Mounter::Utils::YAMLFrontMattersTemplate.new(filepath)

            if template.attributes
              attributes = template.attributes.clone

              # set the editable elements
              page.set_editable_elements(attributes.delete('editable_elements'))

              # set the content type
              if content_type_slug = attributes.delete('content_type')
                attributes['templatized']   = true
                attributes['content_type']  = self.mounting_point.content_types.values.find { |ct| ct.slug == content_type_slug }
              end

              page.attributes = attributes
            end

            page.template = template
          end

          # Return the directory where all the templates of
          # pages are stored in the filesystem.
          #
          # @return [ String ] The root directory
          #
          def root_dir
            File.join(self.runner.path, 'app', 'views', 'pages')
          end

          # Take the path to a file on the filesystem
          # and return its matching value for a Page.
          #
          # @param [ String ] filepath The path to the file
          #
          # @return [ String ] The fullpath of the page
          #
          def filepath_to_fullpath(filepath)
            _filepath = File.expand_path(filepath)
            _rootpath = File.expand_path(self.root_dir)

            fullpath = _filepath.gsub(File.join(_rootpath, '/'), '')

            fullpath.gsub!(/^\.\//, '')

            fullpath.split('.').first.dasherize
          end

          # Tell is a page described by its fullpath is a sub page of a parent page
          # also described by its fullpath
          #
          # @param [ String ] fullpath The full path of the page to test
          # @param [ String ] parent_fullpath The full path of the parent page
          #
          # @return [ Boolean] True if the page is a sub page of the parent one
          #
          def is_subpage_of?(fullpath, parent_fullpath)
            return false if %w(index 404).include?(fullpath)

            if parent_fullpath == 'index' && fullpath.split('/').size == 1
              return true
            end

            File.dirname(fullpath.dasherize) == parent_fullpath.dasherize
          end

          # Output simply the tree structure of the pages.
          #
          # Note: only for debug purpose
          #
          def to_s(page = nil)
            page ||= self.pages['index']

            puts "#{"  " * (page.try(:depth) + 1)} #{page.fullpath.inspect} (#{page.title}, position=#{page.position}, template=#{page.template_translations.keys.inspect})"

            (page.children || []).each { |child| self.to_s(child) }
          end

        end

      end
    end
  end
end


text:
/********************************************************************
**
** sheaf.css
**
**   A library that supports the representation and automated
**   rendering of lecture notes for mathematics and computer
**   science courses.
**
**   Web:     sheaf.io
**   Version: 0.0.1.0
**
**   Stylesheet for rendering of sheaf course material XML files
**   as HTML webpages.
*/

/********************************************************************
*/

body { font-family: Times,serif; }
.sheaf { margin: 50px 60px 50px 60px; }

#sheaf .toc { margin:18px 0px 18px 0px; }
#sheaf .toc ul { padding-top:0px; margin:0px; }
#sheaf .toc ul li { margin:0px; padding:0px; }

#sheaf .header_numeral { color:#8A8A8A; }
#sheaf h2 { margin-top:40px; color:#6A6A6A; white-space:nowrap; }
#sheaf h3 { padding-top:40px; white-space:nowrap; }

#sheaf .linked { position:relative; left:-45px; }
#sheaf .link-title {
  color:#9F9F9F;
  font-variant:small-caps; font-size:11px; font-weight:bold;
  display:inline-block;
  vertical-align:bottom;
  padding:0px 7px 5px 0px;
}
#sheaf .link-block {
  color:#9F9F9F;
  font-variant:small-caps; font-size:11px; font-weight:bold;
  float:left; display:inline-block;
  position:relative; top:11px;
  margin-right:10px;
}

#sheaf .section { }
#sheaf .review { }
#sheaf .appendix { }
#sheaf .subsection { }
#sheaf .paragraph { margin:12px 0px 12px 0px; }
#sheaf .text { margin:8px 0px 8px 0px; }

#sheaf .inferences { padding:8px 8px 8px 16px; }
#sheaf .inferences .inference { padding:5px 1px 5px 1px; }
#sheaf .inferences .inference .premises {
  border-bottom:1px solid #000000; border-spacing:0; border-collapse:collapse;
  padding:0px 12px 0px 12px;
  text-align:center;
}
#sheaf .inferences .inference .conclusion {
  border:0px; border-spacing:0; border-collapse:collapse;
  padding:0px 12px 0px 12px;
  text-align:center;
}
#sheaf .inferences .inference  .title {
  font-family:serif; font-variant:small-caps; font-size:14px;
}

#sheaf .code {
  background-color:#F4F4F4;
  border:1px dashed #AFAFAF;
  font-family:Monospace; font-size:12px;
  margin:8px 10px 8px 10px;
}
#sheaf .code .source { margin:-8px 10px -8px 10px; }
#sheaf .code .source  .comment { color:#8A8A8A; font-style:italic; }
#sheaf .code .source  .literal { color:firebrick; font-weight:bold; }
#sheaf .code .source  .keyword { color:blue; font-weight:bold; }
#sheaf .code .source  .builtin { color:purple; font-weight:bold; }

#sheaf .assignment { }
#sheaf .assignment .problems { margin-left:-20px; }
#sheaf .assignment .problems .problem { margin:0px 0px 10px 0px; }
#sheaf .assignment .problems .problem .parts { margin:10px 0px 0px 0px; list-style-type:lower-alpha; }
#sheaf .assignment .problems .problem .part { margin:10px 0px 0px -20px; }
#sheaf .assignment_title { text-decoration:underline; }

#sheaf .midterm { }
#sheaf .midterm .problems { margin-left:-20px; }
#sheaf .midterm .problems .problem { margin:0px 0px 10px 0px; }
#sheaf .midterm .problems .problem .parts { margin:10px 0px 0px 0px; list-style-type:lower-alpha; }
#sheaf .midterm .problems .problem .part { margin:10px 0px 0px -20px; }
#sheaf .midterm_title { text-decoration:underline; }

#sheaf .final { }
#sheaf .final .problems { margin-left:-20px; }
#sheaf .final .problems .problem { margin:0px 0px 10px 0px; }
#sheaf .final .problems .problem .parts { margin:10px 0px 0px 0px; list-style-type:lower-alpha; }
#sheaf .final .problems .problem .part { margin:10px 0px 0px -20px; }
#sheaf .final_title { text-decoration:underline; }

#sheaf ul { padding-top:0px 0px 0px 5px; margin:8px 0px 8px 0px; }
#sheaf ul li ul { padding-top:0px 0px 0px 5px; margin:0px 0px 0px 0px; }
#sheaf ol { margin-left:8px; padding-top:0px 0px 0px 5px; }
#sheaf  li { text-align:left; position:relative; min-width:200px; padding:0px 0px 0px 0px; }
#sheaf  code { background-color:#EEEEEE; padding:0px 2px 0px 2px;}

#sheaf a { text-decoration:none; color:#AC701E; }
#sheaf a:hover { text-decoration:underline; color:firebrick; }

#sheaf .block { margin: 12px 0px 12px 0px; }
#sheaf .definition { padding:8px; white-space:normal; }
#sheaf .fact { padding:8px; white-space:normal; }
#sheaf .theorem { padding:8px; white-space:normal; }
#sheaf .conjecture { padding:8px; white-space:normal; background-color:#F6F3C8; }
#sheaf .algorithm { padding:8px; white-space:normal; }
#sheaf .protocol { padding:8px; white-space:normal; }
#sheaf .example { padding:8px; white-space:normal; }
#sheaf .exercise { padding:8px; white-space:normal; }
#sheaf .definition_required { padding:8px; white-space:normal; background-color:#F6F3C8; }
#sheaf .fact_required { padding:8px; white-space:normal; background-color:#F6F3C8; } /*F9F7DC*/
#sheaf .theorem_required { padding:8px; white-space:normal; background-color:#F6F3C8; }
#sheaf .conjecture_required { padding:8px; white-space:normal; background-color:#F6F3C8; }
#sheaf .algorithm_required { padding:8px; white-space:normal; background-color:#F6F3C8; }
#sheaf .protocol_required { padding:8px; white-space:normal; background-color:#F6F3C8; }
#sheaf .example_required { padding:8px; white-space:normal; background-color:#D7F8D7; }
#sheaf .exercise_required { padding:8px; white-space:normal; background-color:#D7F8D7; }
#sheaf .solution_container { border:1px dotted green; padding:0px; margin:12px 8px 8px 8px; }
#sheaf .solution_container .solution { background-color:#E6F9F4; border:1px dotted green; padding:8px 8px 8px 8px; }
#sheaf .diagram { margin:14px; text-align:center; width:100%; font-size:12px; font-family:Arial,Sans-serif; }
#sheaf .diagram .container { border-spacing:7px; margin:0 auto; }
#sheaf .diagram .container .box { font-weight:bold; padding:2px 10px 2px 10px; border:1px dashed #444444; text-align:center; }

#sheaf .fig_table {margin:8px 0px 8px 0px;}
#sheaf .fig_table td { padding:4px 10px 4px 10px; margin:0px 10px 0px 10px; white-space:nowrap; background-color:#EFEFEF;}
#sheaf .fig_table2 .cell { padding:4px 10px 4px 10px; margin:0px 10px 0px 10px; white-space:nowrap; background-color:#EFEFEF;}
#sheaf .truthtable td { text-align:center; }

#sheaf .btn { display:inline-block; margin-right:5px; font-size:10px; font-family:Verdana,Arial,Sans-serif; background-color:#CFCFCF; cursor:pointer; }
#sheaf .btn_verify { display:inline-block; padding:5px; font-size:10px; font-family:Verdana,Arial,Sans-serif; background-color:#CFCFCF; cursor:pointer; }
#sheaf .btn_format { display:inline-block; padding:5px; font-size:10px; font-family:Verdana,Arial,Sans-serif; background-color:#CFCFCF; cursor:pointer; }
#sheaf .btn_selected { background-color:#EFEFEF; cursor:pointer; }
#sheaf .widget_argument_controls { display:inline-block; font-size:10px; font-family:Verdana,Arial,Sans-serif; float:right; }

#sheaf .argument       { margin:0px 20px 0px 20px; padding:0px 15px 0px 15px; background-color:#F6F6F6; padding:10px; border:2px solid #FFFFFF; }
#sheaf .argument:hover { margin:0px 20px 0px 20px; padding:0px 15px 0px 15px; background-color:#F6F6F6; padding:10px; border:2px solid green; } /*D7F8D7*/

.footer { margin:0px; padding:0px; width:100%; text-align:right; border-top:1px solid #DFDFDF; }
.footer .sheaflink { color:#AFAFAF; font-family:Verdana,Arial,sans-serif; font-size:10px; margin:5px; padding:5px; text-align:right; }
.footer .sheaflink a { color:#777777; text-decoration:none; }
.footer .sheaflink a:hover { color:#AFAFAF; text-decoration:none; }

.html_matrix_lft { border-left:1px solid #000000; border-top:1px solid #000000; border-bottom:1px solid #000000; }
.html_matrix_rgt { border-right:1px solid #000000; border-top:1px solid #000000; border-bottom:1px solid #000000; }
.html_matrix_entry { text-align:center; padding-left:2px; padding-right:2px; margin:0px; }

.html_frac_lft { border-left:0px solid #000000; border-top:0px solid #000000; border-bottom:0px solid #000000; }
.html_frac_rgt { border-right:0px solid #000000; border-top:0px solid #000000; border-bottom:0px solid #000000; }
.html_frac_numerator { text-align:center; padding-left:2px; padding-right:2px; margin:0px; }
.html_frac_denominator { text-align:center; padding-left:2px; padding-right:2px; margin:0px; }

/*eof*/


text:
#ifndef HTMLOptionsCollection_h
#define HTMLOptionsCollection_h

#include "HTMLCollection.h"
#include "HTMLSelectElement.h"

namespace WebCore {

class HTMLOptionElement;

typedef int ExceptionCode;

class HTMLOptionsCollection final : public HTMLCollection {
public:
    static PassRef<HTMLOptionsCollection> create(HTMLSelectElement&, CollectionType);

    HTMLSelectElement& selectElement() { return toHTMLSelectElement(ownerNode()); }
    const HTMLSelectElement& selectElement() const { return toHTMLSelectElement(ownerNode()); }

    void add(PassRefPtr<HTMLOptionElement>, ExceptionCode&);
    void add(PassRefPtr<HTMLOptionElement>, int index, ExceptionCode&);
    void remove(int index);
    void remove(HTMLOptionElement*);

    int selectedIndex() const;
    void setSelectedIndex(int);

    void setLength(unsigned, ExceptionCode&);

private:
    explicit HTMLOptionsCollection(HTMLSelectElement&);
};

} //namespace

#endif


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System.Collections.Generic;
using System.Composition;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.Extensions;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Shared.Utilities;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.CSharp.UsePatternMatching
{
    /// <summary>
    /// DiagnosticAnalyzer that looks for is-tests and cast-expressions, and offers to convert them
    /// to use patterns.  i.e. if the user has <c>obj is TestFile && ((TestFile)obj).Name == "Test"</c>
    /// it will offer to convert that <c>obj is TestFile file && file.Name == "Test"</c>.
    ///
    /// Complements <see cref="CSharpIsAndCastCheckDiagnosticAnalyzer"/> (which does the same,
    /// but only for code cases where the user has provided an appropriate variable name in
    /// code that can be used).
    /// </summary>
    //
    // disabled for preview 1 due to some perf issue.
    // we will re-enable it once the issue is addressed.
    // https://devdiv.visualstudio.com/DevDiv/_workitems?id=504089&_a=edit&triage=true
    // [DiagnosticAnalyzer(LanguageNames.CSharp), Shared]
    internal class CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer : AbstractCodeStyleDiagnosticAnalyzer
    {
        private const string CS0165 = nameof(CS0165); // Use of unassigned local variable 's'
        private static readonly SyntaxAnnotation s_referenceAnnotation = new SyntaxAnnotation();

        public static readonly CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer Instance = new CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer();

        public override bool OpenFileOnly(Workspace workspace) => false;

        public CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer()
            : base(IDEDiagnosticIds.InlineIsTypeWithoutNameCheckDiagnosticsId,
                   new LocalizableResourceString(
                       nameof(FeaturesResources.Use_pattern_matching), FeaturesResources.ResourceManager, typeof(FeaturesResources)))
        {
        }

        public override DiagnosticAnalyzerCategory GetAnalyzerCategory()
            => DiagnosticAnalyzerCategory.SemanticSpanAnalysis;

        protected override void InitializeWorker(AnalysisContext context)
            => context.RegisterSyntaxNodeAction(SyntaxNodeAction, SyntaxKind.IsExpression);

        private void SyntaxNodeAction(SyntaxNodeAnalysisContext context)
        {
            var cancellationToken = context.CancellationToken;
            var semanticModel = context.SemanticModel;
            var syntaxTree = semanticModel.SyntaxTree;

            // "x is Type y" is only available in C# 7.0 and above.  Don't offer this refactoring
            // in projects targetting a lesser version.
            if (((CSharpParseOptions)syntaxTree.Options).LanguageVersion < LanguageVersion.CSharp7)
            {
                return;
            }

            var root = syntaxTree.GetRoot(cancellationToken);
            var isExpression = (BinaryExpressionSyntax)context.Node;

            var workspace = (context.Options as WorkspaceAnalyzerOptions)?.Services.Workspace;
            if (workspace == null)
            {
                return;
            }

            // See if this is an 'is' expression that would be handled by the analyzer.  If so
            // we don't need to do anything.
            if (CSharpIsAndCastCheckDiagnosticAnalyzer.Instance.TryGetPatternPieces(
                    isExpression, out _, out _, out _, out _))
            {
                return;
            }

            var (matches, _) = AnalyzeExpression(workspace, semanticModel, isExpression, cancellationToken);
            if (matches == null || matches.Count == 0)
            {
                return;
            }

            context.ReportDiagnostic(
                Diagnostic.Create(
                    this.Descriptor, isExpression.GetLocation()));
        }

        public (HashSet<CastExpressionSyntax>, string localName) AnalyzeExpression(
            Workspace workspace,
            SemanticModel semanticModel,
            BinaryExpressionSyntax isExpression,
            CancellationToken cancellationToken)
        {
            var container = GetContainer(isExpression);
            if (container == null)
            {
                return default;
            }

            var expr = isExpression.Left.WalkDownParentheses();
            var type = (TypeSyntax)isExpression.Right;

            var typeSymbol = semanticModel.GetTypeInfo(type, cancellationToken).Type;
            if (typeSymbol == null || typeSymbol.IsNullable())
            {
                // not legal to write "(x is int? y)"
                return default;
            }

            // First, find all the potential cast locations we can replace with a reference to
            // our new local.
            var matches = new HashSet<CastExpressionSyntax>();
            AddMatches(container, expr, type, matches);

            if (matches.Count == 0)
            {
                return default;
            }

            // Find a reasonable name for the local we're going to make.  It should ideally
            // relate to the type the user is casting to, and it should not collisde with anything
            // in scope.
            var reservedNames = semanticModel.LookupSymbols(isExpression.SpanStart)
                                             .Concat(semanticModel.GetExistingSymbols(container, cancellationToken))
                                             .Select(s => s.Name)
                                             .ToSet();

            var localName = NameGenerator.EnsureUniqueness(
                ICodeDefinitionFactoryExtensions.GetLocalName(typeSymbol),
                reservedNames).EscapeIdentifier();

            // Now, go and actually try to make the change.  This will allow us to see all the
            // locations that we updated to see if that caused an error.
            var tempMatches = new HashSet<CastExpressionSyntax>();
            foreach (var castExpression in matches.ToArray())
            {
                tempMatches.Add(castExpression);
                var updatedSemanticModel = ReplaceMatches(
                    workspace, semanticModel, isExpression, localName, tempMatches, cancellationToken);
                tempMatches.Clear();

                var causesError = ReplacementCausesError(updatedSemanticModel, cancellationToken);
                if (causesError)
                {
                    matches.Remove(castExpression);
                }
            }

            return (matches, localName);
        }

        private bool ReplacementCausesError(
            SemanticModel updatedSemanticModel, CancellationToken cancellationToken)
        {
            var root = updatedSemanticModel.SyntaxTree.GetRoot(cancellationToken);

            var currentNode = root.GetAnnotatedNodes(s_referenceAnnotation).Single();
            var diagnostics = updatedSemanticModel.GetDiagnostics(currentNode.Span, cancellationToken);

            return diagnostics.Any(d => d.Id == CS0165);
        }

        public SemanticModel ReplaceMatches(
            Workspace workspace, SemanticModel semanticModel, BinaryExpressionSyntax isExpression,
            string localName, HashSet<CastExpressionSyntax> matches,
            CancellationToken cancellationToken)
        {
            var root = semanticModel.SyntaxTree.GetRoot(cancellationToken);
            var editor = new SyntaxEditor(root, workspace);

            // now, replace "x is Y" with "x is Y y" and put a rename-annotation on 'y' so that
            // the user can actually name the variable whatever they want.
            var newLocalName = SyntaxFactory.Identifier(localName)
                                            .WithAdditionalAnnotations(RenameAnnotation.Create());
            var isPattern = SyntaxFactory.IsPatternExpression(
                isExpression.Left, isExpression.OperatorToken,
                SyntaxFactory.DeclarationPattern((TypeSyntax)isExpression.Right.WithTrailingTrivia(SyntaxFactory.Space),
                    SyntaxFactory.SingleVariableDesignation(newLocalName))).WithTriviaFrom(isExpression);

            editor.ReplaceNode(isExpression, isPattern);

            // Now, go through all the "(Y)x" casts and replace them with just "y".
            var localReference = SyntaxFactory.IdentifierName(localName);
            foreach (var castExpression in matches)
            {
                var castRoot = castExpression.WalkUpParentheses();

                editor.ReplaceNode(
                    castRoot,
                    localReference.WithTriviaFrom(castRoot)
                                  .WithAdditionalAnnotations(s_referenceAnnotation));
            }

            var changedRoot = editor.GetChangedRoot();
            var updatedSyntaxTree = semanticModel.SyntaxTree.WithRootAndOptions(
                changedRoot, semanticModel.SyntaxTree.Options);

            var updatedCompilation = semanticModel.Compilation.ReplaceSyntaxTree(
                semanticModel.SyntaxTree, updatedSyntaxTree);
            return updatedCompilation.GetSemanticModel(updatedSyntaxTree);
        }

        private SyntaxNode GetContainer(BinaryExpressionSyntax isExpression)
        {
            for (SyntaxNode current = isExpression; current != null; current = current.Parent)
            {
                switch (current)
                {
                    case StatementSyntax statement:
                        return statement;
                    case LambdaExpressionSyntax lambda:
                        return lambda.Body;
                    case ArrowExpressionClauseSyntax arrowExpression:
                        return arrowExpression.Expression;
                    case EqualsValueClauseSyntax equalsValue:
                        return equalsValue.Value;
                }
            }

            return null;
        }

        private void AddMatches(
            SyntaxNode node, ExpressionSyntax expr, TypeSyntax type, HashSet<CastExpressionSyntax> matches)
        {
            // Don't bother recursing down nodes that are before the type in the is-expressoin.
            if (node.Span.End >= type.Span.End)
            {
                if (node.IsKind(SyntaxKind.CastExpression))
                {
                    var castExpression = (CastExpressionSyntax)node;
                    if (SyntaxFactory.AreEquivalent(castExpression.Type, type) &&
                        SyntaxFactory.AreEquivalent(castExpression.Expression.WalkDownParentheses(), expr))
                    {
                        matches.Add(castExpression);
                    }
                }

                foreach (var child in node.ChildNodesAndTokens())
                {
                    if (child.IsNode)
                    {
                        AddMatches(child.AsNode(), expr, type, matches);
                    }
                }
            }
        }
    }
}


text:
package org.apache.jena.riot.system;

import java.util.Collection ;
import java.util.HashMap ;
import java.util.Map ;

import org.apache.jena.n3.N3JenaWriter ;
import org.apache.jena.rdf.model.impl.RDFWriterFImpl ;
import org.apache.jena.riot.RDFFormat ;
import org.apache.jena.riot.adapters.JenaReadersWriters.RDFWriterRIOT_JSONLD ;
import org.apache.jena.riot.adapters.JenaReadersWriters.RDFWriterRIOT_N3 ;
import org.apache.jena.riot.adapters.JenaReadersWriters.RDFWriterRIOT_N3Plain ;
import org.apache.jena.riot.adapters.JenaReadersWriters.RDFWriterRIOT_N3Triples ;
import org.apache.jena.riot.adapters.JenaReadersWriters.RDFWriterRIOT_N3TriplesAlt ;
import org.apache.jena.riot.adapters.JenaReadersWriters.RDFWriterRIOT_N3_PP ;
import org.apache.jena.riot.adapters.JenaReadersWriters.RDFWriterRIOT_NTriples ;
import org.apache.jena.riot.adapters.JenaReadersWriters.RDFWriterRIOT_RDFJSON ;
import org.apache.jena.riot.adapters.JenaReadersWriters.RDFWriterRIOT_Turtle ;
import org.apache.jena.riot.adapters.JenaReadersWriters.RDFWriterRIOT_Turtle1 ;
import org.apache.jena.riot.adapters.JenaReadersWriters.RDFWriterRIOT_Turtle2 ;

public class IO_JenaWriters
{
    private static Map<String, RDFFormat> mapJenaNameToFormat               = new HashMap<>() ;

    /** return the RDFFormat for the existing Jena writer name, or null */
    public static RDFFormat getFormatForJenaWriter(String jenaName) { return mapJenaNameToFormat.get(jenaName) ; }

    /** Register an RDFFormat for a Jena writer name */
    public static void setFormatForJenaWriter(String jenaName, RDFFormat format) { mapJenaNameToFormat.put(jenaName, format) ; }

    /** Return a collection of jena writer names */
    public static Collection<String> getJenaWriterNames() { return mapJenaNameToFormat.keySet() ; }

    public static void wireIntoJena()
    {
        setFormatForJenaWriter("RDF/XML",                           RDFFormat.RDFXML_PLAIN) ;
        setFormatForJenaWriter("RDF/XML-ABBREV",                    RDFFormat.RDFXML_ABBREV) ;
        setFormatForJenaWriter("N-TRIPLE",                          RDFFormat.NTRIPLES) ;
        setFormatForJenaWriter("NT",                                RDFFormat.NTRIPLES) ;
        setFormatForJenaWriter("N-TRIPLES",                         RDFFormat.NTRIPLES) ;
        setFormatForJenaWriter("N-Triples",                         RDFFormat.NTRIPLES) ;
        setFormatForJenaWriter("N3",                                RDFFormat.TURTLE) ;
        setFormatForJenaWriter(N3JenaWriter.n3WriterPrettyPrinter,  RDFFormat.TURTLE_PRETTY) ;
        setFormatForJenaWriter(N3JenaWriter.n3WriterPlain,          RDFFormat.TURTLE_BLOCKS) ;
        setFormatForJenaWriter(N3JenaWriter.n3WriterTriples,        RDFFormat.TURTLE_FLAT) ;
        setFormatForJenaWriter(N3JenaWriter.n3WriterTriplesAlt,     RDFFormat.TURTLE_FLAT) ;
        setFormatForJenaWriter(N3JenaWriter.turtleWriter,           RDFFormat.TURTLE) ;
        setFormatForJenaWriter(N3JenaWriter.turtleWriterAlt1,       RDFFormat.TURTLE) ;
        setFormatForJenaWriter(N3JenaWriter.turtleWriterAlt2,       RDFFormat.TURTLE) ;

        setFormatForJenaWriter("JSON-LD",                           RDFFormat.JSONLD) ;
        setFormatForJenaWriter("JSONLD",                            RDFFormat.JSONLD) ;

        setFormatForJenaWriter("RDF/JSON",                          RDFFormat.RDFJSON) ;
        setFormatForJenaWriter("RDFJSON",                           RDFFormat.RDFJSON) ;

        //registerForModelWrite("RDF/XML",                            RDFWriterRIOT_RDFXML.class) ;
        //registerForModelWrite("RDF/XML-ABBREV",                     RDFWriterRIOT_RDFXMLAbbrev.class) ;

        // Use the original classes so that setting properties works transparently.
        registerForModelWrite("RDF/XML",                            org.apache.jena.rdfxml.xmloutput.impl.Basic.class) ;
        registerForModelWrite("RDF/XML-ABBREV",                     org.apache.jena.rdfxml.xmloutput.impl.Abbreviated.class) ;

        registerForModelWrite("N-TRIPLE",                           RDFWriterRIOT_NTriples.class) ;
        registerForModelWrite("N-TRIPLES",                          RDFWriterRIOT_NTriples.class) ;
        registerForModelWrite("N-Triples",                          RDFWriterRIOT_NTriples.class) ;
        registerForModelWrite("NT",                                 RDFWriterRIOT_NTriples.class) ;
        registerForModelWrite("N3",                                 RDFWriterRIOT_N3.class) ;

        registerForModelWrite(N3JenaWriter.n3WriterPrettyPrinter,   RDFWriterRIOT_N3_PP.class) ;
        registerForModelWrite(N3JenaWriter.n3WriterPlain,           RDFWriterRIOT_N3Plain.class) ;
        registerForModelWrite(N3JenaWriter.n3WriterTriples,         RDFWriterRIOT_N3Triples.class) ;
        registerForModelWrite(N3JenaWriter.n3WriterTriplesAlt,      RDFWriterRIOT_N3TriplesAlt.class) ;

        registerForModelWrite(N3JenaWriter.turtleWriter,            RDFWriterRIOT_Turtle.class) ;
        registerForModelWrite(N3JenaWriter.turtleWriterAlt1,        RDFWriterRIOT_Turtle1.class) ;
        registerForModelWrite(N3JenaWriter.turtleWriterAlt2,        RDFWriterRIOT_Turtle2.class) ;

        registerForModelWrite("JSON-LD",                            RDFWriterRIOT_JSONLD.class) ;
        registerForModelWrite("JSONLD",                             RDFWriterRIOT_JSONLD.class) ;

        registerForModelWrite("RDF/JSON",                           RDFWriterRIOT_RDFJSON.class) ;
        registerForModelWrite("RDFJSON",                            RDFWriterRIOT_RDFJSON.class) ;
    }

    public static void resetJena()
    {
        // This is the old Jena configuration (bugs and all)
        RDFWriterFImpl.setBaseWriterClassName("RDF/XML",        org.apache.jena.rdfxml.xmloutput.impl.Basic.class.getName()) ;
        RDFWriterFImpl.setBaseWriterClassName("RDF/XML-ABBREV", org.apache.jena.rdfxml.xmloutput.impl.Abbreviated.class.getName()) ;

        RDFWriterFImpl.setBaseWriterClassName("N-TRIPLE",       org.apache.jena.rdf.model.impl.NTripleWriter.class.getName()) ;
        RDFWriterFImpl.setBaseWriterClassName("NT",             "") ;
        RDFWriterFImpl.setBaseWriterClassName("N-TRIPLES",      org.apache.jena.rdf.model.impl.NTripleWriter.class.getName()) ;
        RDFWriterFImpl.setBaseWriterClassName("N-Triples",      org.apache.jena.rdf.model.impl.NTripleWriter.class.getName()) ;

        RDFWriterFImpl.setBaseWriterClassName("N3",             org.apache.jena.n3.N3JenaWriter.class.getName()) ;
        RDFWriterFImpl.setBaseWriterClassName(N3JenaWriter.n3WriterPrettyPrinter,    org.apache.jena.n3.N3JenaWriterPP.class.getName()) ;
        RDFWriterFImpl.setBaseWriterClassName(N3JenaWriter.n3WriterPlain,           org.apache.jena.n3.N3TurtleJenaWriter.class.getName()) ;
        RDFWriterFImpl.setBaseWriterClassName(N3JenaWriter.n3WriterTriples,         org.apache.jena.n3.N3TurtleJenaWriter.class.getName()) ;
        RDFWriterFImpl.setBaseWriterClassName(N3JenaWriter.n3WriterTriplesAlt,      org.apache.jena.n3.N3JenaWriterTriples.class.getName()) ;
        RDFWriterFImpl.setBaseWriterClassName(N3JenaWriter.turtleWriter,            org.apache.jena.n3.N3TurtleJenaWriter.class.getName()) ;
        RDFWriterFImpl.setBaseWriterClassName(N3JenaWriter.turtleWriterAlt1,        org.apache.jena.n3.N3TurtleJenaWriter.class.getName()) ;
        RDFWriterFImpl.setBaseWriterClassName(N3JenaWriter.turtleWriterAlt2,        org.apache.jena.n3.N3TurtleJenaWriter.class.getName()) ;

        RDFWriterFImpl.setBaseWriterClassName("JSON-LD",    "");
        RDFWriterFImpl.setBaseWriterClassName("JSON",       "");

        RDFWriterFImpl.setBaseWriterClassName("RDF/JSON",   "");
        RDFWriterFImpl.setBaseWriterClassName("RDFJSON",    "");
    }

    /** Register for use with Model.write  (old style compatibility) */
    public static void registerForModelWrite(String name, Class<?> cls)
    {
        RDFWriterFImpl.setBaseWriterClassName(name, cls.getName()) ;
    }
}


text:
<resources>

    <style name="Base.Theme.Preview" parent="@android:style/Theme.Material">
        <item name="android:colorPrimary">?colorPrimary</item>
        <item name="android:colorPrimaryDark">?colorPrimaryDark</item>
        <item name="android:colorAccent">?colorAccent</item>
    </style>

    <style name="Base.Theme.Preview.Light" parent="@android:style/Theme.Material.Light">
        <item name="android:colorPrimary">?colorPrimary</item>
        <item name="android:colorPrimaryDark">?colorPrimaryDark</item>
        <item name="android:colorAccent">?colorAccent</item>
    </style>

    <style name="Base.Theme.Preview.Light.DarkActionBar" parent="@android:style/Theme.Material.Light.DarkActionBar">
        <item name="android:colorPrimary">?colorPrimary</item>
        <item name="android:colorPrimaryDark">?colorPrimaryDark</item>
        <item name="android:colorAccent">?colorAccent</item>
    </style>

</resources>


text:
module.exports = function(Document) {
  var docs = []
  function Documents() {
  }
  Document.content = function(msg, cb) {
      for (var i=0; i < 100; i++) {
       docs.push(new Documents);
      }
      cb(null, 'Adding document content' + msg);
    }

    var docs = []
    Document.remoteMethod(
        'content',
        {
          accepts: {arg: 'content', type: 'string'},
          returns: {arg: 'content', type: 'string'}
        }
    );
};


text:
USE_PKGBUILD=1
include /usr/local/share/luggage/luggage.make
PB_EXTRA_ARGS+= --sign "Developer ID Installer: Clayton Burlison"

TITLE=disable_bluetooth
PACKAGE_VERSION=1.0.0
REVERSE_DOMAIN=com.github.clburlison
PAYLOAD= \
	pack-script-postinstall


text:
<?php

declare(strict_types=1);

namespace DCarbone\PHPConsulAPI\Agent;

use DCarbone\PHPConsulAPI\AbstractResponse;
use DCarbone\PHPConsulAPI\Error;
use DCarbone\PHPConsulAPI\ErrorContainer;

/**
 * Class AgentHealthServiceResponse
 */
class AgentHealthServicesResponse extends AbstractResponse
{
    use ErrorContainer;

    /** @var string */
    public string $AggregatedStatus = '';
    /** @var \DCarbone\PHPConsulAPI\Agent\AgentServiceChecksInfo[]|null */
    public ?array $AgentServiceChecksInfos = null;

    /**
     * AgentHealthServiceResponse constructor.
     * @param string $aggregatedStatus
     * @param array|null $checkInfos
     * @param \DCarbone\PHPConsulAPI\Error|null $err
     */
    public function __construct(string $aggregatedStatus, ?array $checkInfos, ?Error $err)
    {
        $this->AggregatedStatus = $aggregatedStatus;
        if (null !== $checkInfos) {
            $this->AgentServiceChecksInfos = [];
            foreach ($checkInfos as $checkInfo) {
                $this->AgentServiceChecksInfos[] = new AgentServiceChecksInfo($checkInfo);
            }
        }
        $this->Err = $err;
    }

    /**
     * @return string
     */
    public function getAggregatedStatus(): string
    {
        return $this->AggregatedStatus;
    }

    /**
     * @return \DCarbone\PHPConsulAPI\Agent\AgentServiceChecksInfo[]|null
     */
    public function getAgentServiceChecksInfos(): ?array
    {
        return $this->AgentServiceChecksInfos;
    }

    /**
     * @param mixed $offset
     * @return bool
     */
    public function offsetExists($offset): bool
    {
        return \is_int($offset) && 0 <= $offset && $offset < 3;
    }

    /**
     * @param mixed $offset
     * @return array|\DCarbone\PHPConsulAPI\Agent\AgentServiceChecksInfo[]|\DCarbone\PHPConsulAPI\Error|mixed|string|null
     */
    public function offsetGet($offset)
    {
        if (0 === $offset) {
            return $this->AggregatedStatus;
        }
        if (1 === $offset) {
            return $this->AgentServiceChecksInfos;
        }
        if (2 === $offset) {
            return $this->Err;
        }
        throw $this->_newOutOfRangeException($offset);
    }
}


text:
package org.apache.hadoop.tools.posum.simulation.predictor.optimal;

import org.apache.hadoop.tools.posum.simulation.predictor.simple.SimpleMapPredictionStats;

import static org.apache.hadoop.tools.posum.simulation.predictor.optimal.FlexKeys.MAP_RATE;
import static org.apache.hadoop.tools.posum.simulation.predictor.optimal.FlexKeys.MAP_SELECTIVITY;

class OptimalMapPredictionStats extends SimpleMapPredictionStats {

  OptimalMapPredictionStats(int maxHistory, int relevance) {
    super(maxHistory, relevance, MAP_RATE.getKey(), MAP_SELECTIVITY.getKey());
  }

}


text:
package edu.stanford.math.plex4.homology.zigzag.bootstrap;

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

import edu.stanford.math.plex4.homology.barcodes.AnnotatedBarcodeCollection;
import edu.stanford.math.plex4.homology.barcodes.BarcodeCollection;
import edu.stanford.math.plex4.homology.chain_basis.Simplex;
import edu.stanford.math.plex4.homology.chain_basis.SimplexComparator;
import edu.stanford.math.plex4.homology.zigzag.IntervalTracker;
import edu.stanford.math.plex4.homology.zigzag.SimpleHomologyBasisTracker;
import edu.stanford.math.plex4.metric.impl.EuclideanMetricSpace;
import edu.stanford.math.plex4.streams.impl.VietorisRipsStream;
import edu.stanford.math.plex4.utility.ArrayUtility;
import edu.stanford.math.plex4.utility.RandomUtility;
import edu.stanford.math.primitivelib.algebraic.impl.ModularIntField;
import edu.stanford.math.primitivelib.autogen.algebraic.IntAbstractField;
import edu.stanford.math.primitivelib.autogen.formal_sum.IntAlgebraicFreeModule;
import edu.stanford.math.primitivelib.autogen.formal_sum.IntSparseFormalSum;

public class VietorisRipsBootstrapper {
	private final double[][] points;
	private final List<int[]> indexSelections;
	IntAbstractField intField = ModularIntField.getInstance(2);
	protected final IntAlgebraicFreeModule<Simplex> chainModule = new IntAlgebraicFreeModule<Simplex>(this.intField);

	private final double maxDistance;
	private final int maxDimension;

	public VietorisRipsBootstrapper(double[][] points, double maxDistance, int maxDimension, List<int[]> indexSelections) {
		this.points = points;
		this.maxDimension = maxDimension;
		this.maxDistance = maxDistance;

		this.indexSelections = new ArrayList<int[]>();
		for (int i = 0; i < indexSelections.size(); i++) {
			int[] selection = indexSelections.get(i);
			this.indexSelections.add(ArrayUtility.makeMonotone(selection));
		}
	}

	public VietorisRipsBootstrapper(double[][] points, double maxDistance, int maxDimension, int numSelections, int selectionSize) {
		this.points = points;
		this.indexSelections = new ArrayList<int[]>();
		this.maxDimension = maxDimension;
		this.maxDistance = maxDistance;

		selectionSize = Math.min(points.length, selectionSize);

		for (int selection = 0; selection < numSelections; selection++) {
			int[] set = RandomUtility.randomSubset(selectionSize, points.length).toArray();
			set = ArrayUtility.makeMonotone(set);
			this.indexSelections.add(set);
		}
	}

	public int[] getSubset(int index) {
		return this.indexSelections.get(index);
	}

	public BarcodeCollection<Integer> performBootstrap() {
		int[] i_indices = this.indexSelections.get(0);
		VietorisRipsStream<double[]> X_stream = new VietorisRipsStream<double[]>(new EuclideanMetricSpace(ArrayUtility.getSubset(points, i_indices)), maxDistance, maxDimension + 1, i_indices);
		X_stream.finalizeStream();

		VietorisRipsStream<double[]> Y_stream;

		IntervalTracker<Integer, Integer, IntSparseFormalSum<Simplex>> result = null;

		SimpleHomologyBasisTracker<Simplex> ZTracker = null;
		SimpleHomologyBasisTracker<Simplex> XTracker = null;
		SimpleHomologyBasisTracker<Simplex> YTracker = null;

		for (int j = 1; j < this.indexSelections.size(); j++) {
			if (XTracker == null) {
				XTracker = new SimpleHomologyBasisTracker<Simplex>(intField, SimplexComparator.getInstance(), 0, this.maxDimension);
				for (Simplex x: X_stream) {
					XTracker.add(x, X_stream.getFiltrationIndex(x));
				}

				System.out.println("Barcodes for X_" + (j - 1));
				AnnotatedBarcodeCollection<Integer, IntSparseFormalSum<Simplex>> XBarcodes = XTracker.getAnnotatedBarcodes();
				System.out.println(XBarcodes.toString());
			}

			int[] j_indices = this.indexSelections.get(j);
			Y_stream = new VietorisRipsStream<double[]>(new EuclideanMetricSpace(ArrayUtility.getSubset(points, j_indices)), maxDistance, maxDimension + 1, j_indices);
			Y_stream.finalizeStream();

			YTracker = new SimpleHomologyBasisTracker<Simplex>(intField, SimplexComparator.getInstance(), 0, this.maxDimension);
			for (Simplex y: Y_stream) {
				YTracker.add(y, Y_stream.getFiltrationIndex(y));
			}

			int[] ij_indices = ArrayUtility.union(i_indices, j_indices);

			VietorisRipsStream<double[]> Z_stream = new VietorisRipsStream<double[]>(new EuclideanMetricSpace(ArrayUtility.getSubset(points, ij_indices)), maxDistance, maxDimension + 1, ij_indices);
			Z_stream.finalizeStream();

			ZTracker = new SimpleHomologyBasisTracker<Simplex>(intField, SimplexComparator.getInstance(), 0, this.maxDimension);
			for (Simplex z: Z_stream) {
				ZTracker.add(z, Z_stream.getFiltrationIndex(z));
			}

			System.out.println("Barcodes for X_" + (j-1) + "," + (j));
			AnnotatedBarcodeCollection<Integer, IntSparseFormalSum<Simplex>> ZBarcodes = ZTracker.getAnnotatedBarcodes();
			System.out.println(ZBarcodes.toString());

			System.out.println("Barcodes for X_" + (j));
			AnnotatedBarcodeCollection<Integer, IntSparseFormalSum<Simplex>> YBarcodes = YTracker.getAnnotatedBarcodes();
			System.out.println(YBarcodes.toString());

			if (result == null) {
				result = XTracker.getStateWithoutFiniteBarcodes(j - 1);
				result.setUseLeftClosedIntervals(true);
				result.setUseRightClosedIntervals(true);
			}

			result = InducedHomologyMappingUtility.include(XTracker, ZTracker, YTracker, result, chainModule, (j - 1), j);

			X_stream = Y_stream;
			XTracker = YTracker;
			i_indices = j_indices;
		}

		result.endAllIntervals(this.indexSelections.size() - 1);

		return BarcodeCollection.forgetGeneratorType(result.getAnnotatedBarcodes().filterByMaxDimension(maxDimension));
	}
}