text:
Provides helper functions for developing modules.

## Functions

- `add-zsh-trap` adds a function name to a list to be called when a trap is
  triggered.
- `is-autoloadable` checks if a file can be autoloaded by trying to load it in
  a subshell.
- `is-callable` checks if a name is a command, function, or alias.
- `is-true` checks a boolean variable for "true".
- `coalesce` prints the first non-empty string in the arguments array.
- `is-darwin` checks if running on macOS Darwin.
- `is-linux` checks if running on Linux.
- `is-bsd` checks if running on BSD.
- `is-cygwin` checks if running on Cygwin (Windows).
- `is-termux` checks if running on Termux (Android).

## Authors

*The authors of this module should be contacted via the [issue tracker][1].*

- [Sorin Ionescu](https://github.com/sorin-ionescu)

[1]: https://github.com/sorin-ionescu/prezto/issues


text:
require './environment'
require 'clockwork'

include Clockwork

every(1.hour, 'feeds.sync') do
  Feed.all.each { |f| f.sync_posts }
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>Uses of Class tetra.logic.Direction (tetra 1.0 API)</title>
<meta name="date" content="2016-03-05">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
tetra.logic.Direction

Packages that use Direction

Package
Description

tetra.logic

Provides the classes necessary to simulate game logic.

Uses of Direction in tetra.logic

Methods in tetra.logic that return Direction

Modifier and Type
Method and Description

Direction
Piece.getOrientation()

Returns the current orientation.

Direction
Direction.rotate(boolean clockwise)

Returns the next available orientation when turning either clockwise or
 counterclockwise.

Direction
Direction.rotateClockwise()

Returns the next available orientation when turning clockwise.

Direction
Direction.rotateCounterclockwise()

Returns the next available orientation when turning counterclockwise.

static Direction
Direction.valueOf(String name)

Returns the enum constant of this type with the specified name.

static Direction[]
Direction.values()

Returns an array containing the constants of this enum type, in
the order they are declared.

Methods in tetra.logic with parameters of type Direction

Modifier and Type
Method and Description

boolean
Piece.canMove(Direction direction)

Returns true if it is possible to take one step in the specified
 direction.

Block
Tetromino.getBlock(Direction orientation,
        int x,
        int y)

Returns the block in the specified (x, y) position, or null if the
 position is empty.

boolean
Tetromino.isOccupied(Direction orientation,
          int x,
          int y)

Returns true if there's a block in the specified (x, y) position;
 false otherwise.

void
Piece.move(Direction direction)

Moves one step in the specified direction, if possible.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2016. All rights reserved.


text: var restar=function(a,b){return a-b},sumar=function(a,b){return a+b};


text:
> An operating system running on Scratch

>

### FeaturedOS is a clean and professionally styled OS that is aiming to be the most powerful OS yet to run on Scratch.
The OS will run many apps, including special features such as safe cloud chats and search engines.
Contests will be held for users to openly contribute to the OS, by creating the best app to run on the OS.

Projects under development:

Safe Chat App.sb2


text:
module.exports = {
    "customSyntax": "postcss-scss",
    "extends": "stylelint-config-standard",
    "rules": {
        "alpha-value-notation": null,
        "indentation": null,
        "at-rule-no-unknown": [true, {
            "ignoreAtRules": ["/include/", "/mixin/"]
        }],
        "declaration-empty-line-before": null,
        "selector-type-no-unknown": [true, {
            "ignoreTypes": ["/mat-/", "/flow-designer-/", "/fds-/", "/td-/"]
        }],
        "font-family-no-missing-generic-family-keyword": null,
        "string-quotes": "single"
    }
};


text:
<?php
namespace Neos\Cache\Backend;

/**
 * A contract for a cache backend which can be frozen.
 *
 * @api
 */
interface FreezableBackendInterface extends BackendInterface
{
    /**
     * Freezes this cache backend.
     *
     * All data in a frozen backend remains unchanged and methods which try to add
     * or modify data result in an exception thrown. Possible expiry times of
     * individual cache entries are ignored.
     *
     * On the positive side, a frozen cache backend is much faster on read access.
     * A frozen backend can only be thawn by calling the flush() method.
     *
     * @return void
     */
    public function freeze();

    /**
     * Tells if this backend is frozen.
     *
     * @return boolean
     */
    public function isFrozen();
}


text:
//
// Copyright(C) 2005-2014 Simon Howard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Handles merging of PWADs, similar to deutex's -merge option
//
// Ideally this should work exactly the same as in deutex, but trying to
// read the deutex source code made my brain hurt.
//

#ifndef W_MERGE_H
#define W_MERGE_H

#define W_NWT_MERGE_SPRITES   0x1
#define W_NWT_MERGE_FLATS     0x2

// Add a new WAD and merge it into the main directory

void W_MergeFile(char *filename);

// NWT-style merging

void W_NWTMergeFile(char *filename, int flags);

// Acts the same as NWT's "-merge" option.

void W_NWTDashMerge(char *filename);

// Debug function that prints the WAD directory.

void W_PrintDirectory(void);

#endif /* #ifndef W_MERGE_H */


text:
namespace tizen_webview {

enum Legacy_Font_Size_Mode {
  TW_LEGACY_FONT_SIZE_MODE_ALWAYS,
  TW_LEGACY_FONT_SIZE_MODE_ONLY_IF_PIXEL_VALUES_MATCH,
  TW_LEGACY_FONT_SIZE_MODE_NEVER
};

} // namespace tizen_webview

#endif  // TIZEN_WEBVIEW_PUBLIC_TW_LEGACY_FONT_SIZE_MODE_H_


text:
package kr.pe.courage.tech.system.user.service.impl;

import java.sql.SQLException;

import org.springframework.stereotype.Repository;

import kr.pe.courage.common.dao.AbstractDAO;
import kr.pe.courage.tech.system.user.service.UserVO;

@Repository("userDAO")
public class UserDAO extends AbstractDAO<UserVO> {

	@Override
	protected String getNameSpace() {
		return "userDAO";
	}

	/**
	 *

	 * 1. 개요 : 사용자 가입 승인
	 *

	 *
	 * @Author	: ChangHo Seok
	 * @Date	: 2016. 3. 1.
	 * @Method Name : updateUserSbscrbConfm
	 * @param userVO
	 * @throws SQLException
	 */
	public void updateUserSbscrbConfm(UserVO userVO) throws SQLException {
		this.update("updateUserSbscrbConfm", userVO);
	}

	/**
	 *

	 * 1. 개요 : 사용자 비밀번호 변경
	 *

	 *
	 * @Author	: ChangHo Seok
	 * @Date	: 2016. 3. 1.
	 * @Method Name : updateUserPassword
	 * @param userVO
	 * @throws SQLException
	 */
	public void updateUserPassword(UserVO userVO) throws SQLException {
		this.update("updateUserPassword", userVO);
	}

	/**
	 *

	 * 1. 개요 : 사용자 삭제
	 *

	 *
	 * @Author	: ChangHo Seok
	 * @Date	: 2016. 3. 20.
	 * @Method Name : updateUserDeleteSttus
	 * @param userVO
	 * @throws SQLException
	 */
	public void updateUserDeleteSttus(UserVO userVO) throws SQLException {
		this.update("updateUserDeleteSttus", userVO);
	}
}


text:
var regType;
var salutationType;

$.scrollView.height = Ti.Platform.displayCaps.platformHeight - 230;

if(Ti.Platform.osname == "android") {
	console.log("android");
	$.scrollView.height = PixelsToDPUnits(Ti.Platform.displayCaps.platformHeight) - 230;
}

function back()
{
	DRAWER.navigation("hopOn",1);
}

function highSpeed(e)
{
	console.log("e.value: "+e.value);
}

function proceed()
{
	DRAWER.navigation("hopOn3",1);
	console.log("proceed");
}

function showPicker()
{
	console.log("showPicker");
	if($.pickerView.visible == "false")
	{
		$.contentView.height = 250;
		$.pickerView.height = 250;
		$.pickerContentView.height  = 250;
		$.pickerView.setVisible(true);
		$.done.setVisible(true);
		$.picker.setVisible(true);
	}
	else
	{
		if($.pickerView.visible == false)
		{
			$.contentView.height = 250;
			$.pickerView.height = 250;
			$.pickerContentView.height  = 250;
			$.pickerView.setVisible(true);
			$.done.setVisible(true);
			$.picker.setVisible(true);
		}
		else
		{
			$.contentView.height = 50;
			$.pickerView.height = 50;
			$.pickerContentView.height  = 50;
			$.pickerView.setVisible(false);
			$.done.setVisible(false);
			$.picker.setVisible(false);
		}
	}
}

function salutationType(e)
{
	console.log("salutationType");
	salutationType = e.row.title;
	if(Ti.Platform.osname == "iphone" || Ti.Platform.osname == "ipad")
	{
		$.salutationLabel.text = salutationType;
	}
}

function done(){
	console.log("done");
	$.contentView.height = 50;
	$.pickerView.height = 50;
	$.pickerContentView.height  = 50;
	$.pickerView.setVisible(false);
	$.done.setVisible(false);
	$.picker.setVisible(false);
}

function showPicker2()
{
	console.log("showPicker");
	if($.pickerView2.visible == "false")
	{
		$.contentView2.height = 250;
		$.pickerView2.height = 250;
		$.pickerContentView2.height  = 250;
		$.pickerView2.setVisible(true);
		$.done2.setVisible(true);
		$.picker2.setVisible(true);
	}
	else
	{
		if($.pickerView2.visible == false)
		{
			$.contentView2.height = 250;
			$.pickerView2.height = 250;
			$.pickerContentView2.height  = 250;
			$.pickerView2.setVisible(true);
			$.done2.setVisible(true);
			$.picker2.setVisible(true);
		}
		else
		{
			$.contentView2.height = 50;
			$.pickerView2.height = 50;
			$.pickerContentView2.height  = 50;
			$.pickerView2.setVisible(false);
			$.done2.setVisible(false);
			$.picker2.setVisible(false);
		}
	}
}

function regType(e)
{
	console.log("simType");
	regType = e.row.title;
	if(Ti.Platform.osname == "iphone" || Ti.Platform.osname == "ipad")
	{
		$.regTypeLabel.text = regType;
	}
}

function done2(){
	console.log("done");
	$.contentView2.height = 50;
	$.pickerView2.height = 50;
	$.pickerContentView2.height  = 50;
	$.pickerView2.setVisible(false);
	$.done2.setVisible(false);
	$.picker2.setVisible(false);
}


text:
Installation
============

Getting the code
----------------

The recommended way to install the Debug Toolbar is via pip_::

    $ pip install django-debug-toolbar

If you aren't familiar with pip, you may also obtain a copy of the
``debug_toolbar`` directory and add it to your Python path.

.. _pip: https://pip.pypa.io/

To test an upcoming release, you can install the in-development version
instead with the following command::

     $ pip install -e git+https://github.com/jazzband/django-debug-toolbar.git#egg=django-debug-toolbar

Prerequisites
-------------

Make sure that ``'django.contrib.staticfiles'`` is `set up properly
<https://docs.djangoproject.com/en/stable/howto/static-files/>`_ and add
``'debug_toolbar'`` to your ``INSTALLED_APPS`` setting::

    INSTALLED_APPS = [
        # ...
        'django.contrib.staticfiles',
        # ...
        'debug_toolbar',
    ]

    STATIC_URL = '/static/'

If you're upgrading from a previous version, you should review the
:doc:`change log <changes>` and look for specific upgrade instructions.

URLconf
-------

Add the Debug Toolbar's URLs to your project's URLconf as follows::

    from django.conf import settings
    from django.conf.urls import include, url

    if settings.DEBUG:
        import debug_toolbar
        urlpatterns = [
            url(r'^__debug__/', include(debug_toolbar.urls)),
        ] + urlpatterns

This example uses the ``__debug__`` prefix, but you can use any prefix that
doesn't clash with your application's URLs. Note the lack of quotes around
``debug_toolbar.urls``.

Middleware
----------

The Debug Toolbar is mostly implemented in a middleware. Enable it in your
settings module as follows::

    MIDDLEWARE = [
        # ...
        'debug_toolbar.middleware.DebugToolbarMiddleware',
        # ...
    ]

Old-style middleware::

    MIDDLEWARE_CLASSES = [
        # ...
        'debug_toolbar.middleware.DebugToolbarMiddleware',
        # ...
    ]

.. warning::

    The order of ``MIDDLEWARE`` and ``MIDDLEWARE_CLASSES`` is important. You
    should include the Debug Toolbar middleware as early as possible in the
    list. However, it must come after any other middleware that encodes the
    response's content, such as
    :class:`~django.middleware.gzip.GZipMiddleware`.

Internal IPs
------------

The Debug Toolbar is shown only if your IP is listed in the ``INTERNAL_IPS``
setting. (You can change this logic with the ``SHOW_TOOLBAR_CALLBACK``
option.) For local development, you should add ``'127.0.0.1'`` to
``INTERNAL_IPS``.


text:
a simple javascript slider using velocity.js

##How To Use

###add this markup to your webpage where you would like the slider repeating the first image
```html
<div id="slider">
    <ul id="slides" class="slides">
      <li class="slide"><img src="http://placehold.it/720x400?text=1" alt=""></li>
      <li class="slide"><img src="http://placehold.it/720x400?text=2" alt=""></li>
      <li class="slide"><img src="http://placehold.it/720x400?text=3" alt=""></li>
      <li class="slide"><img src="http://placehold.it/720x400?text=4" alt=""></li>
      <li class="slide"><img src="http://placehold.it/720x400?text=5" alt=""></li>
      <li class="slide"><img src="http://placehold.it/720x400?text=6" alt=""></li>
      <li class="slide"><img src="http://placehold.it/720x400?text=1"></li>
    </ul>
  </div>
```

###include the scripts velocity.min.js script and slider.js.
```html
  <script src="resources/velocity.min.js"></script>
  <script src="resources/slider.js"></script>
```

###modify slider.js to suit your use.

width: adjusts the width of the slider.
animationSpeed: adjusts the slide transition time.
pause: adjusts the time between slides.
stopOnHover: when true stops the slider on hover.
clickForNext: when true changes the current slide when the slider is clicked.

```javascript
// configureation
var width = 720;
var animationSpeed = 1000;
var pause = 6000;
var interval;
var stopOnHover = true;
var clickForNext = true;
```


text:
using UnityEngine;

public class ShopController : Singleton<ShopController>
{
	[SerializeField]
	private DataBindContext m_DataBindContext;
	private ShopProduct[] m_Products;

	private void Awake()
	{
		m_Products = Resources.LoadAll<ShopProduct>("Data/Products");
	}

	private void Start()
	{
		var consumables = new ObservableList("consumables");
		var upgrades = new ObservableList("upgrades");

		for (var i = 0; i < m_Products.Length; i++) {
			var product = m_Products[i];

			switch (product.category) {
				case ShopProduct.Category.Consumable:
					consumables.Add(product);
					break;
				case ShopProduct.Category.Upgrade:
					upgrades.Add(product);
					break;
			}
		}

		m_DataBindContext["consumables"] = consumables;
		m_DataBindContext["upgrades"] = upgrades;
	}

	private new void OnEnable()
	{
		base.OnEnable();

		m_DataBindContext.BindAll();
	}

	public bool CanBuy(ShopProduct product)
	{
		return GameData.instance.coins >= product.price;
	}

	public void Buy(ShopProduct product)
	{
		if (!CanBuy(product)) {
			return;
		}

		GameData.instance.coins -= product.price;
		m_DataBindContext["coins"] = GameData.instance.coins;
	}
}


text:
package tests.com.goldwatch_checker;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

/**
 *
 * @author tom
 */
@RunWith(Suite.class)
@Suite.SuiteClasses({})
public class SrCheckTestSuite {

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() throws Exception {
    }

    @After
    public void tearDown() throws Exception {
    }

}


text:
<html>
<head>
  <meta http-equiv="Content-type" content="text/html; charset=utf-8">
  <title>index</title>
  <script src="keymaster.min.js"></script>

  <script src="moving_object.js"></script>
  <script src="asteroid.js"></script>
  <script src="bullet.js"></script>
  <script src="particle.js"></script>
  <script src="ship.js"></script>
  <script src="game.js"></script>
</head>

<body id="index" onload="Game.start(900,900);">
  <canvas id="game" width="900" height="900"></canvas>
</body>

</html>


text:
'use strict';

var gulp = require('gulp');
var connect = require('gulp-connect');

// HTML livereload.
gulp.task('html', function() {
  gulp.src(global.paths.html)
    .pipe(connect.reload());
});


text:
#region License
//   Copyright 2015 Kastellanos Nikolaos
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
#endregion

using System.Collections.Generic;

namespace tainicom.DataStructures.Collections
{
    public class Set<TValue> : ICollection<TValue>
    {
        private Dictionary<TValue, short> _dictionary;

        public Set()
        {
            _dictionary = new Dictionary<TValue,short>();
        }

        public void Add(TValue item)
        {
            _dictionary.Add(item,0);
        }

        public void Clear()
        {
            _dictionary.Clear();
        }

        public bool Contains(TValue item)
        {
            return _dictionary.ContainsKey(item);
        }

        public void CopyTo(TValue[] array, int arrayIndex)
        {
            _dictionary.Keys.CopyTo(array,arrayIndex);
        }

        public int Count
        {
            get { return _dictionary.Keys.Count; }
        }

        public bool IsReadOnly
        {
            get { return false; }
        }

        public bool Remove(TValue item)
        {
            return _dictionary.Remove(item);
        }

        public IEnumerator<TValue> GetEnumerator()
        {
            return _dictionary.Keys.GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return _dictionary.Keys.GetEnumerator();
        }
    }
}


text:
System.set('@traceur/module', (function() {
  'use strict';

  var {resolveUrl, isStandardModuleUrl} = System.get('@traceur/url');

  var modules = Object.create(null);

  var refererUrl = './';

  function setRefererUrl(url) {
    refererUrl = url || './';
  }

  function getRefererUrl() {
    return refererUrl;
  }

  class PendingModule {
    constructor(name, func, self) {
      this.name = name;
      this.func = func;
      this.self = self;
    }
    toModule() {
      var oldName = refererUrl;
      refererUrl = this.name;
      try {
        return this.func.call(this.self);
      } finally {
        refererUrl = oldName
      }
    }
  }

  function registerModule(name, func, self) {
    var url = resolveUrl(refererUrl, name);
    modules[url] = new PendingModule(name, func, self);
  }

  // Now it is safe to override System.{get,set} to use resolveUrl.
  var $get = System.get;
  var $set = System.set;

  System.get = function(name) {
    if (isStandardModuleUrl(name))
      return $get(name);

    var url = resolveUrl(refererUrl, name);
    var module = modules[url];
    if (module instanceof PendingModule)
      return modules[url] = module.toModule();
    return module;
  };

  System.set = function(name, object) {
    if (isStandardModuleUrl(name))
      $set(name, object);
    else
      modules[resolveUrl(refererUrl, name)] = object;
  };

  return {
    getRefererUrl,
    registerModule,
    setRefererUrl,
  };
})());


text:
var TT = TT || {};
TT.Utils = (function () {

  var pub = {};

  // If only one item exists, Pivotal API sends that by itself, otherwise as an array of items
  pub.normalizePivotalArray = function (items) {
    return !items ? [] : $.isPlainObject(items) ? [items] : items;
  };

  var pad = function (n) {
    return n < 10 ? '0' + n : n;
  };

  pub.pivotalDateFormat = function (d) {
    d = new Date(d);
    return d.getFullYear() + '/' +
      pad(d.getMonth() + 1) + '/' +
      pad(d.getDate()) + ' ' +
      pad(d.getHours()) + ':' +
      pad(d.getMinutes()) + ':' +
      pad(d.getSeconds());
  };

  pub.daysBetweenDates = function (str1, str2) {
    return Math.floor((Date.parse(str2) - Date.parse(str1)) / 86400000);
  };

  pub.getUsername = function () {
    return $.cookie('pivotalUsername') || '';
  };

  pub.getToken = function () {
    return $.cookie('pivotalToken') || '';
  };

  pub.keyPressed = function (e, key) {
    var keys = {
      'LEFT_CLICK': 1,
      'MIDDLE_CLICK': 2,
      'RIGHT_CLICK': 3,
      'TAB': 9,
      'ENTER': 13,
      'ESCAPE': 27,
      'LEFT_ARROW': 37,
      'UP_ARROW': 38,
      'RIGHT_ARROW': 39,
      'DOWN_ARROW': 40,
      'TILDE': 192
    };

    return e && e.which === keys[key];
  };

  pub.exists = function (obj) {
    return typeof obj !== 'undefined' && obj !== null;
  };

  // from underscore
  pub.isObject = function (obj) {
    return obj === Object(obj);
  };

  pub.isDomElement = function (obj) {
    return !!(obj && obj.nodeType === 1);
  };

  $.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Array'], function (index, type) {
    pub['is' + type] = function (obj) {
      return Object.prototype.toString.call(obj) === '[object ' + type + ']';
    };
  });

  pub.arrayMove = function (arr, oldIndex, newIndex) {
    if (newIndex >= arr.length) {
      var k = newIndex - arr.length;
      while ((k--) + 1) {
        arr.push(undefined);
      }
    }
    arr.splice(newIndex, 0, arr.splice(oldIndex, 1)[0]);

    return arr;
  };

  pub.reconcileArrayOrder = function (key, oldArray, newArray) {
    var shift = true;
    var newIndex;
    while (shift) {
      shift = false;
      for (newIndex = 0; newIndex < newArray.length; newIndex++) {
        var oldIndex = pub.getIndexByKey(oldArray, key, newArray[newIndex][key]);
        if (!shift && oldIndex !== -1 && oldIndex !== newIndex) {
          newArray = pub.arrayMove(newArray, oldIndex, newIndex);
          shift = true;
          break;
        }
      }
    }

    return newArray;
  };

  pub.getIndexByKey = function (arr, key, expected) {
    var i = -1;
    $.each(arr, function (index, val) {
      if (val[key] === expected) {
        i = index;
      }
    });

    return i;
  };

  function localStorageWarning() {
    TT.View.message('This browser does not support localStorage. You should use the latest version of Chrome, Firefox, or Safari.');
  }

  pub.localStorage = function (key, value) {
    try {
      if (window.localStorage) {
        key = 'TT.' + key;

        if (pub.exists(value)) {
          if (!pub.isString(value)) {
            value = JSON.stringify(value);
          }
          window.localStorage[key] = value;
        }

        if (value === null) {
          window.localStorage.removeItem(key);
        }

        return window.localStorage[key];
      }
    } catch (e) {
      localStorageWarning();
    }
  };

  pub.clearLocalStorage = function () {
    try {
      if (window.localStorage) {
        // need to iterate in reverse since window.localStorage.length changes after removing an item
        for (var i = window.localStorage.length - 1; i >= 0; i--) {
          var key = window.localStorage.key(i);
          if (key.indexOf('TT.') === 0) {
            window.localStorage.removeItem(key);
          }
        }
      }
    } catch (e) {
      localStorageWarning();
    }
  };

  pub.strToFunction = function (functionName, context) {
    context = context || window;
    var namespaces = functionName.split('.');
    var func = namespaces.pop();
    for (var i = 0; i < namespaces.length; i++) {
      if (!context[namespaces[i]]) {
        return false;
      }
      context = context[namespaces[i]];
    }
    return context[func];
  };

  pub.cssify = function (str) {
    return str.toLowerCase().replace(/[^a-z0-9\-\_]/g, '');
  };

  pub.generateInitials = function (text) {
    var initials = '';
    var words = text.replace(/[^a-zA-Z0-9 ]/g, '').split(' ');
    $.each(words, function (index, word) {
      initials += word[0] ? word[0] : '';
    });

    return initials;
  };

  pub.marked = function (text) {
    return pub.isString(text) && window.marked ? window.marked(text) : text;
  };

  pub.removeFromArray = function (arr, val) {
    $.each(arr, function (index, item) {
      if (val === item) {
        arr.splice(index, 1);
      }
    });
    return arr;
  };

  pub.sortByProperty = function (arr, prop) {
    return arr.sort(function (a, b) {
      return a[prop] > b[prop] ? 1 : a[prop] === b[prop] ? 0 : -1;
    });
  };

  pub.objectLength = function (obj) {
    return obj ? $.map(obj, function (n, i) { return i; }).length : 0;
  };

  pub.objectSum = function (obj) {
    var sum = 0;
    $.each(obj, function (index, name) {
      sum += (parseInt(name, 10) || 0);
    });

    return sum;
  };

  pub.updateStoryState = function (id, state) {
    var existingState = pub.getStoryState(id);
    state = pub.isObject(state) ? $.extend({}, existingState, state) : existingState;

    var isEmpty = true;
    $.each(state, function (key, val) {
      if (pub.exists(val)) {
        isEmpty = false;
      } else {
        delete state[key];
      }
    });

    pub.localStorage('storyState.' + id, isEmpty ? null : state);
  };

  pub.getStoryState = function (id) {
    var obj = pub.localStorage('storyState.' + id);
    return pub.exists(obj) ? JSON.parse(obj) : {};
  };

  pub.setBoundaryCallback = function (target, callback) {
    var now = new Date().getTime();
    var bounds = target.offset();
    bounds.right = bounds.left + target.outerWidth();
    bounds.bottom = bounds.top + target.outerHeight();

    $('body').bind('mousemove.BoundaryCallback' + now, function (e) {
      if (e.pageX < bounds.left || e.pageX > bounds.right ||
        e.pageY < bounds.top || e.pageY > bounds.bottom) {
        $('body').unbind('mousemove.BoundaryCallback' + now);
        callback();
      }
    });
  };

  pub.returnFalse = function () {
    return false;
  };

  return pub;

}());


text:
package ca.carleton.gcrc.couch.client;

import nunaliit.org.json.JSONObject;

public interface CouchUserDb extends CouchDb {

	CouchUserDocContext getUserFromName(String userName) throws Exception;

	/**
	 * Does not call the database. Instead, modifies the given user document
	 * to reflect a new password.
	 * @param userDoc User document to be modified
	 * @param password PLain text password to be assigned to the user
	 * @throws Exception
	 */
	void computeUserPassword(JSONObject userDoc, String password) throws Exception;
}


text:
#include <sys/time.h>
#include <rtthread.h>

#ifdef RT_USING_DEVICE
int gettimeofday(struct timeval *tp, void *ignore)
{
    time_t time;
    rt_device_t device;

    device = rt_device_find("rtc");
    RT_ASSERT(device != RT_NULL);

    rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time);
    if (tp != RT_NULL)
    {
        tp->tv_sec = time;
        tp->tv_usec = 0;
    }

    return time;
}
#endif

/**
 * Returns the current time.
 *
 * @param time_t * t the timestamp pointer, if not used, keep NULL.
 *
 * @return time_t return timestamp current.
 *
 */
/* for IAR 6.2 later Compiler */
#if defined (__IAR_SYSTEMS_ICC__) &&  (__VER__) >= 6020000
#pragma module_name = "?time"
time_t (__time32)(time_t *t) /* Only supports 32-bit timestamp */
#else
time_t time(time_t *t)
#endif
{
    time_t time_now = 0;

#ifdef RT_USING_RTC
    static rt_device_t device = RT_NULL;

    /* optimization: find rtc device only first. */
    if (device == RT_NULL)
    {
        device = rt_device_find("rtc");
    }

    /* read timestamp from RTC device. */
    if (device != RT_NULL)
    {
        if (rt_device_open(device, 0) == RT_EOK)
        {
            rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time_now);
            rt_device_close(device);
        }
    }
#endif /* RT_USING_RTC */

    /* if t is not NULL, write timestamp to *t */
    if (t != RT_NULL)
    {
        *t = time_now;
    }

    return time_now;
}

RT_WEAK clock_t clock(void)
{
    return rt_tick_get();
}


text:
"""Camera support for the Skybell HD Doorbell."""
from datetime import timedelta
import logging

import requests
import voluptuous as vol

from homeassistant.components.camera import PLATFORM_SCHEMA, Camera
from homeassistant.const import CONF_MONITORED_CONDITIONS
import homeassistant.helpers.config_validation as cv

from . import DOMAIN as SKYBELL_DOMAIN, SkybellDevice

_LOGGER = logging.getLogger(__name__)

SCAN_INTERVAL = timedelta(seconds=90)

IMAGE_AVATAR = "avatar"
IMAGE_ACTIVITY = "activity"

CONF_ACTIVITY_NAME = "activity_name"
CONF_AVATAR_NAME = "avatar_name"

PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
    {
        vol.Optional(CONF_MONITORED_CONDITIONS, default=[IMAGE_AVATAR]): vol.All(
            cv.ensure_list, [vol.In([IMAGE_AVATAR, IMAGE_ACTIVITY])]
        ),
        vol.Optional(CONF_ACTIVITY_NAME): cv.string,
        vol.Optional(CONF_AVATAR_NAME): cv.string,
    }
)

def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the platform for a Skybell device."""
    cond = config[CONF_MONITORED_CONDITIONS]
    names = {}
    names[IMAGE_ACTIVITY] = config.get(CONF_ACTIVITY_NAME)
    names[IMAGE_AVATAR] = config.get(CONF_AVATAR_NAME)
    skybell = hass.data.get(SKYBELL_DOMAIN)

    sensors = []
    for device in skybell.get_devices():
        for camera_type in cond:
            sensors.append(SkybellCamera(device, camera_type, names.get(camera_type)))

    add_entities(sensors, True)

class SkybellCamera(SkybellDevice, Camera):
    """A camera implementation for Skybell devices."""

    def __init__(self, device, camera_type, name=None):
        """Initialize a camera for a Skybell device."""
        self._type = camera_type
        SkybellDevice.__init__(self, device)
        Camera.__init__(self)
        if name is not None:
            self._name = "{} {}".format(self._device.name, name)
        else:
            self._name = self._device.name
        self._url = None
        self._response = None

    @property
    def name(self):
        """Return the name of the sensor."""
        return self._name

    @property
    def image_url(self):
        """Get the camera image url based on type."""
        if self._type == IMAGE_ACTIVITY:
            return self._device.activity_image
        return self._device.image

    def camera_image(self):
        """Get the latest camera image."""
        super().update()

        if self._url != self.image_url:
            self._url = self.image_url

            try:
                self._response = requests.get(self._url, stream=True, timeout=10)
            except requests.HTTPError as err:
                _LOGGER.warning("Failed to get camera image: %s", err)
                self._response = None

        if not self._response:
            return None

        return self._response.content


text:
namespace UwpNetworkingEssentials.Channels
{
    public interface IConnectionReceiveEventArgs
    {
        IConnectionListener Listener { get; }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Zarf.Metadata.Entities;

namespace Zarf.Query.Expressions
{
    public class UpdateExpression : Expression
    {
        public override Type Type => typeof(void);

        public override ExpressionType NodeType => ExpressionType.Extension;

        public IEnumerable<DbParameter> DbParams { get; }

        public IEnumerable<string> Columns { get; }

        public string Identity { get; }

        public DbParameter IdentityValue { get; }

        public Table Table { get; }

        public UpdateExpression(
            Table table,
            IEnumerable<DbParameter> parameters,
            IEnumerable<string> columns,
            string identity,
            DbParameter identityValue)
        {
            Table = table;
            DbParams = parameters;
            Columns = columns;
            Identity = identity;
            IdentityValue = identityValue;
        }
    }
}


text:
package org.artifactory.request;

import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpHeaders;

import javax.annotation.Nonnull;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author Noam Y. Tenne
 */
public abstract class BaseRequestContext implements InternalRequestContext {
    private static final Pattern PATTERN_JAVA_AGENT = Pattern.compile("[Jj]ava/(.+)");

    protected final ArtifactoryRequest request;

    /**
     * Generic attributes which can be added and queried, this should not be mistaken with
     * request properties which are the matrix params of the request, the attributes are
     * essentially meant for internal usage.
     */
    protected Map<String, String> attributes;

    protected BaseRequestContext(@Nonnull ArtifactoryRequest request) {
        this.request = request;
    }

    @Override
    public String getServletContextUrl() {
        return request.getServletContextUrl();
    }

    @Override
    public boolean clientSupportsM3SnapshotVersions() {
        Request request = getRequest();
        String userAgent = request.getHeader(HttpHeaders.USER_AGENT);
        if (StringUtils.isBlank(userAgent)) {
            return true;
        }

        if (userAgent.startsWith("Wharf Ivy/") || userAgent.startsWith("Apache Ivy/")) {
            return false;
        }

        /**
         * Maven versions older that 2.0.9 (including) sent only the java version in the user agent; that's how we know
         * if the metadata should be filtered for compatibility
         */
        Matcher agentVersionMatcher = PATTERN_JAVA_AGENT.matcher(userAgent);
        return !agentVersionMatcher.matches();
    }

    @Override
    @Nonnull
    public ArtifactoryRequest getRequest() {
        return request;
    }

    @Override
    public void setAttribute(String name, String value) {
        if (attributes == null) {
            attributes = Maps.newHashMap();
        }
        attributes.put(name, value);
    }

    @Override
    public String getAttribute(String name) {
        if (attributes == null) {
            return null;
        }
        return attributes.get(name);
    }
}


text:
package org.homedrop.thirdParty.server;

import org.homedrop.core.HomeDrop;
import org.homedrop.core.model.User;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

public interface FtpServer {
    void setUpUsers(Collection<User> users);
    void setUp(String path, HomeDrop parent);
    void start();
    void stop();

}


text:
Copyright (c) David Lidström
| Powered by nuffsaid-mvc


text:
package org.apache.jackrabbit.oak.plugins.index.search;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

/**
 * Defines field names that are used internally to store data in the
 * search index.
 */
public final class FieldNames {

    /**
     * Private constructor.
     */
    private FieldNames() {
    }

    /**
     * Name of the field that contains the {@value} property of the node.
     */
    public static final String PATH = ":path";

    /**
     * Name of the field that contains all the path hierarchy e.g. for /a/b/c
     * it would contain /a, /a/b, /a/b/c
     */
    public static final String ANCESTORS = ":ancestors";

    /**
     * Name of the field which refers to the depth of path
     */
    public static final String PATH_DEPTH = ":depth";

    /**
     * Name of the field that contains the fulltext index.
     */
    public static final String FULLTEXT = ":fulltext";

    /**
     * Name of the field that contains the similarity search indexed tokens.
     */
    private static final String SIMILARITY_PREFIX = "sim:";

    /**
     * Name of the field that contains the suggest index.
     */
    public static final String SUGGEST = ":suggest";

    /**
     * Name of the field that contains the spellcheck index.
     */
    public static final String SPELLCHECK = ":spellcheck";

    /**
     * Prefix for all field names that are fulltext indexed by property name.
     */
    public static final String ANALYZED_FIELD_PREFIX = "full:";

    /**
     * Prefix used for storing fulltext of relative node
     */
    public static final String FULLTEXT_RELATIVE_NODE = "fullnode:";

    /**
     * Name of the field that contains those property names which are not found
     * (or were null) for the given
     */
    public static final String NULL_PROPS = ":nullProps";

    /**
     * Name of the field that contains those property names which are exist i.e. not null
     * for the given NodeState
     */
    public static final String NOT_NULL_PROPS = ":notNullProps";

    /**
     * Name of the field that contains the node name
     */
    public static final String NODE_NAME = ":nodeName";

    /**
     * Suffix of the fields that contains function values
     */
    public static final String FUNCTION_PREFIX = "function*";

    /**
     * Used to select only the PATH field from the lucene documents
     */
    public static final Set<String> PATH_SELECTOR = new HashSet<>(
        Collections.singletonList(PATH));

    /**
     * Encodes the field name such that it can be used for storing DocValue
     * This is done such a field if used for both sorting and querying uses
     * a different name for docvalue field
     *
     * @param name name to encode
     * @return encoded field name
     */
    public static String createDocValFieldName(String name){
        return ":dv" + name;
    }

    public static String createAnalyzedFieldName(String pname) {
        return ANALYZED_FIELD_PREFIX + pname;
    }

    public static String createFulltextFieldName(String nodeRelativePath) {
        if (nodeRelativePath == null){
            return FULLTEXT;
        }
        return FULLTEXT_RELATIVE_NODE + nodeRelativePath;
    }

    public static String createFacetFieldName(String pname) {
        return pname + "_facet";
    }

    /**
     * @return if {@code field} represents a field property indexed data
     */
    public static boolean isPropertyField(String field) {
        return !field.startsWith(ANALYZED_FIELD_PREFIX)
                && !field.startsWith(FULLTEXT_RELATIVE_NODE)
                && !field.startsWith(":")
                && !field.endsWith("_facet");
    }

    public static String createSimilarityFieldName(String name) {
        return SIMILARITY_PREFIX + name;
    }
}


text:
#ifndef _NET_L3MDEV_H_
#define _NET_L3MDEV_H_

/**
 * struct l3mdev_ops - l3mdev operations
 *
 * @l3mdev_fib_table: Get FIB table id to use for lookups
 *
 * @l3mdev_get_rtable: Get cached IPv4 rtable (dst_entry) for device
 *
 * @l3mdev_get_saddr: Get source address for a flow
 *
 * @l3mdev_get_rt6_dst: Get cached IPv6 rt6_info (dst_entry) for device
 */

struct l3mdev_ops {
	u32		(*l3mdev_fib_table)(const struct net_device *dev);

	/* IPv4 ops */
	struct rtable *	(*l3mdev_get_rtable)(const struct net_device *dev,
					     const struct flowi4 *fl4);
	int		(*l3mdev_get_saddr)(struct net_device *dev,
					    struct flowi4 *fl4);

	/* IPv6 ops */
	struct dst_entry * (*l3mdev_get_rt6_dst)(const struct net_device *dev,
						 const struct flowi6 *fl6);
};

#ifdef CONFIG_NET_L3_MASTER_DEV

int l3mdev_master_ifindex_rcu(struct net_device *dev);
static inline int l3mdev_master_ifindex(struct net_device *dev)
{
	int ifindex;

	rcu_read_lock();
	ifindex = l3mdev_master_ifindex_rcu(dev);
	rcu_read_unlock();

	return ifindex;
}

static inline int l3mdev_master_ifindex_by_index(struct net *net, int ifindex)
{
	struct net_device *dev;
	int rc = 0;

	if (likely(ifindex)) {
		rcu_read_lock();

		dev = dev_get_by_index_rcu(net, ifindex);
		if (dev)
			rc = l3mdev_master_ifindex_rcu(dev);

		rcu_read_unlock();
	}

	return rc;
}

/* get index of an interface to use for FIB lookups. For devices
 * enslaved to an L3 master device FIB lookups are based on the
 * master index
 */
static inline int l3mdev_fib_oif_rcu(struct net_device *dev)
{
	return l3mdev_master_ifindex_rcu(dev) ? : dev->ifindex;
}

static inline int l3mdev_fib_oif(struct net_device *dev)
{
	int oif;

	rcu_read_lock();
	oif = l3mdev_fib_oif_rcu(dev);
	rcu_read_unlock();

	return oif;
}

u32 l3mdev_fib_table_rcu(const struct net_device *dev);
u32 l3mdev_fib_table_by_index(struct net *net, int ifindex);
static inline u32 l3mdev_fib_table(const struct net_device *dev)
{
	u32 tb_id;

	rcu_read_lock();
	tb_id = l3mdev_fib_table_rcu(dev);
	rcu_read_unlock();

	return tb_id;
}

static inline struct rtable *l3mdev_get_rtable(const struct net_device *dev,
					       const struct flowi4 *fl4)
{
	if (netif_is_l3_master(dev) && dev->l3mdev_ops->l3mdev_get_rtable)
		return dev->l3mdev_ops->l3mdev_get_rtable(dev, fl4);

	return NULL;
}

static inline bool netif_index_is_l3_master(struct net *net, int ifindex)
{
	struct net_device *dev;
	bool rc = false;

	if (ifindex == 0)
		return false;

	rcu_read_lock();

	dev = dev_get_by_index_rcu(net, ifindex);
	if (dev)
		rc = netif_is_l3_master(dev);

	rcu_read_unlock();

	return rc;
}

static inline int l3mdev_get_saddr(struct net *net, int ifindex,
				   struct flowi4 *fl4)
{
	struct net_device *dev;
	int rc = 0;

	if (ifindex) {

		rcu_read_lock();

		dev = dev_get_by_index_rcu(net, ifindex);
		if (dev && netif_is_l3_master(dev) &&
		    dev->l3mdev_ops->l3mdev_get_saddr) {
			rc = dev->l3mdev_ops->l3mdev_get_saddr(dev, fl4);
		}

		rcu_read_unlock();
	}

	return rc;
}

static inline struct dst_entry *l3mdev_get_rt6_dst(const struct net_device *dev,
						   const struct flowi6 *fl6)
{
	if (netif_is_l3_master(dev) && dev->l3mdev_ops->l3mdev_get_rt6_dst)
		return dev->l3mdev_ops->l3mdev_get_rt6_dst(dev, fl6);

	return NULL;
}

static inline
struct dst_entry *l3mdev_rt6_dst_by_oif(struct net *net,
					const struct flowi6 *fl6)
{
	struct dst_entry *dst = NULL;
	struct net_device *dev;

	dev = dev_get_by_index(net, fl6->flowi6_oif);
	if (dev) {
		dst = l3mdev_get_rt6_dst(dev, fl6);
		dev_put(dev);
	}

	return dst;
}

#else

static inline int l3mdev_master_ifindex_rcu(struct net_device *dev)
{
	return 0;
}
static inline int l3mdev_master_ifindex(struct net_device *dev)
{
	return 0;
}

static inline int l3mdev_master_ifindex_by_index(struct net *net, int ifindex)
{
	return 0;
}

static inline int l3mdev_fib_oif_rcu(struct net_device *dev)
{
	return dev ? dev->ifindex : 0;
}
static inline int l3mdev_fib_oif(struct net_device *dev)
{
	return dev ? dev->ifindex : 0;
}

static inline u32 l3mdev_fib_table_rcu(const struct net_device *dev)
{
	return 0;
}
static inline u32 l3mdev_fib_table(const struct net_device *dev)
{
	return 0;
}
static inline u32 l3mdev_fib_table_by_index(struct net *net, int ifindex)
{
	return 0;
}

static inline struct rtable *l3mdev_get_rtable(const struct net_device *dev,
					       const struct flowi4 *fl4)
{
	return NULL;
}

static inline bool netif_index_is_l3_master(struct net *net, int ifindex)
{
	return false;
}

static inline int l3mdev_get_saddr(struct net *net, int ifindex,
				   struct flowi4 *fl4)
{
	return 0;
}

static inline
struct dst_entry *l3mdev_get_rt6_dst(const struct net_device *dev,
				     const struct flowi6 *fl6)
{
	return NULL;
}
static inline
struct dst_entry *l3mdev_rt6_dst_by_oif(struct net *net,
					const struct flowi6 *fl6)
{
	return NULL;
}
#endif

#endif /* _NET_L3MDEV_H_ */


text:
<BroadcastMonitor>
  <updated>2015-08-11T14:06:01</updated>
  <stationName>Radio 6</stationName>
  <Current>
    <startTime>2015-08-11T14:02:08</startTime>
    <itemId>1000080629:1244217</itemId>
    <titleId>216079555</titleId>
    <itemCode>04147</itemCode>
    <itemReference></itemReference>
    <titleName>From Now On</titleName>
    <artistName>Magnus Carlson & The Moon Ray Quintet</artistName>
    <albumName></albumName>
    <CategoryCode>736</CategoryCode>
    <CategoryName>SOUL</CategoryName>
    <itemDuration>247</itemDuration>
    <MultiMedia1></MultiMedia1>
    <MultiMedia2></MultiMedia2>
    <MultiMedia3></MultiMedia3>
    <MultiMedia4></MultiMedia4>
  </Current>
  <Next>
    <startTime>2015-08-11T14:06:16</startTime>
    <itemId>1000080629:0</itemId>
    <titleId>216139061</titleId>
    <itemCode></itemCode>
    <itemReference></itemReference>
    <titleName>*** SWEEP 02 ZET M OP RUDY</titleName>
    <artistName>RUDY</artistName>
    <albumName></albumName>
    <CategoryCode>832</CategoryCode>
    <CategoryName>VORMGEVING</CategoryName>
    <itemDuration>5</itemDuration>
    <MultiMedia1></MultiMedia1>
    <MultiMedia2></MultiMedia2>
    <MultiMedia3></MultiMedia3>
    <MultiMedia4></MultiMedia4>
  </Next>
</BroadcastMonitor>


text:
var util = require('util');
var path = require('path');
var config = require('./../../util/config');
var help = require('./../../util/helpers');

var loginUrl = 'https://tls.passthepopcorn.me/ajax.php?action=login';
var searchUrl = 'https://tls.passthepopcorn.me/torrents.php?json=noredirect&searchstr=%s&order_by=relevance&order_way=descending';
var downloadUrl = 'https://tls.passthepopcorn.me/torrents.php?action=download&id=%s';

function PTPHttp(logger, searcher) {
	this.logger = logger;
	this.searcher = searcher;
	this.client = require('./../../client/http')(logger);
}

PTPHttp.prototype.__login = function(full, callback) {
	var self = this;
	var data = {};

	if (full) {
		data = {
			'username': config.ptp.username,
			'password': config.ptp.password,
			'passkey': config.ptp.passkey,
			'keeplogged': '1',
			'login': 'Login'
		};
	}

	self.client.json(loginUrl, data, true, function(err, resp) {
		if (err) return callback(err);

		if ((typeof resp['Result'] !== 'undefined') && (resp['Result'] == 'Ok')) {
			self.logger.debug('Login successful!');
			return callback(null, true);
		}
		return callback(null, false);
	});
};

PTPHttp.prototype.login = function(callback) {
	var self = this;

	self.__login(false, function(err, success) {
		if (err) return callback(err);
		if (success) return callback(null);

		self.__login(true, function(err, success) {
			if (err) return callback(err);
			if (success) return callback(null);

			callback('PTP: Login failed, wrong user/pass/key combination?');
		});
	});
};

PTPHttp.prototype.downloadTorrent = function(torrentId, dir, callback) {
	var self = this;

	self.searcher.simple(0, 0, 1, function(opts) {
		self.client.download(util.format(downloadUrl, torrentId), path.join(dir, torrentId+'.torrent'), {}, 'application/x-bittorrent', opts.cb);
	}, callback);
};

PTPHttp.prototype.getMovieInfo = function(ptpId, title, callback) {
	var self = this;

	self.searcher.simple(0, 15, 5, function(opts) {
		self.__getMovieInfo(ptpId, title, function(err, movie) {
			if (err) return opts.again(err);
			return opts.cb(null, movie);
		});
	}, callback);
};

PTPHttp.prototype.__getMovieInfo = function(ptpId, title, callback) {
	var self = this;

	self.client.json(util.format(searchUrl, encodeURIComponent(title)), {}, function(err, resp) {
		if (err) return callback(err);

		if ((typeof resp['Movies'] !== 'undefined') && (resp['Movies'].length > 0)) {
			for (var i in resp['Movies']) {
				var movie = resp['Movies'][i];

				if ((typeof movie['GroupId'] === 'undefined') || (movie['GroupId'] != ptpId)) continue;
				if (typeof movie['ImdbId'] === 'undefined') continue;

				return callback(null, movie);
			}
		}

		return callback('Found no movie-matches on PTP');
	});
};

PTPHttp.prototype.getTorrent = function(ptpId, torrentId, title, callback) {
	var self = this;

	self.searcher.simple(0, 15, 5, function(opts) {
		self.__getMovieInfo(ptpId, title, function(err, movie) {
			if (err) return opts.again(err);

			if ((typeof movie['Torrents'] !== 'undefined') && (movie['Torrents'].length > 0)) {
				for (var i in movie['Torrents']) {
					var torrent = movie['Torrents'][i];

					if ((typeof torrent['Id'] === 'undefined') || (typeof torrent['Size'] === 'undefined')) continue;
					if (torrent['Id'] != torrentId) continue;

					return opts.cb(null, torrent);
				}
			}

			return opts.again('Found no torrent-match for movie');
		});
	}, callback);
};

PTPHttp.prototype.torrentExists = function(torrentId, imdbId, callback) {
	var self = this;

	self.searcher.simple(0, 0, 1, function(opts) {
		self.client.json(util.format(searchUrl, imdbId), {}, function(err, resp) {
			if (err) return opts.cb(err);

			if ((typeof resp['Movies'] !== 'undefined') && (resp['Movies'].length > 0)) {
				for (var i in resp['Movies']) {
					var movie = resp['Movies'][i];
					if ((typeof movie['Torrents'] === 'undefined') || !movie['Torrents'].length) continue;

					for (var y in movie['Torrents']) {
						var torrent = movie['Torrents'][y];
						if ((typeof torrent['Id'] === 'undefined') || (torrent['Id'] != torrentId)) continue;

						return opts.cb(null, true);
					}
				}
			}

			self.logger.debug('Found no torrent with id: '+torrentId+' for movie: '+imdbId);
			opts.cb(null, false);
		});
	}, callback);
};

module.exports = function(logger, searcher) {
	return new PTPHttp(logger, searcher);
};


text:
require File.join(File.dirname(__FILE__), '..', '..', '..', 'test_helper')

class AddBoxActionTest < Test::Unit::TestCase
  setup do
    @runner, @vm, @action = mock_action(Vagrant::Actions::Box::Add)
    mock_config
  end

  context "prepare" do
    setup do
      @default_order = [Vagrant::Actions::Box::Download, Vagrant::Actions::Box::Unpackage]
      @runner.stubs(:directory).returns("foo")
      File.stubs(:exists?).returns(false)
    end

    def setup_action_expectations
      default_seq = sequence("default_seq")
      @default_order.each do |action|
        @runner.expects(:add_action).with(action).once.in_sequence(default_seq)
      end
    end

    should "setup the proper sequence of actions" do
      setup_action_expectations
      @action.prepare
    end

    should "result in an action exception if the box already exists" do
      File.expects(:exists?).once.returns(true)
      @runner.expects(:name).once.returns('foo')
      @runner.expects(:add_action).never
      assert_raise Vagrant::Actions::ActionException do
        @action.prepare
      end
    end
  end
end


text:
var expect = require('chai').expect
var db = require('./database.js')

const resultArr = [
  {id: 16, name: 'Flour'},
  {id: 33, name: 'Pasta'},
  {id: 36, name: 'Rice'}
]

describe('grocery_store', () => {
  it('itemsInSection(bulk) returns flour, pasta, rice', () => {
    return db.itemsInSection({section: 'bulk'}).then(items => {
      items.forEach((item,i) => {
        expect(item).to.deep.equal(resultArr[i])
      })
    })
  })

  it('cheapItems() returns fish as first item and honey as last item', () => {
    return db.cheapItems().then(items => {
      expect(items[0].name).to.deep.equal('Fish')
      expect(items[items.length-1].name).to.deep.equal('Honey')
    })
  })

  it('countItemsInSection("packaged") returns count of 5', () => {
    return db.countItemsInSection({section: "packaged"}).then(result => {
      expect(result.count).to.deep.equal('5')
    })
  })
})


text:
<!DOCTYPE html>

  <meta http-equiv='content-type' value='text/html;charset=utf8'>
  <meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
  <title>blogc-template(7) - blogc's template format</title>

    NAME
    DESCRIPTION
    TEMPLATE BLOCKS
    TEMPLATE VARIABLES
    PREDEFINED TEMPLATE VARIABLES
    TEMPLATE CONDITIONALS
    TEMPLATE ITERATORS
    WHITESPACE CONTROL
    BUGS
    AUTHOR
    SEE ALSO

blogc-template(7)

blogc Manual

blogc-template(7)

NAME

  blogc-template - blogc's template format

DESCRIPTION

Template files are used as base to build output files by blogc(1). These files
can include variables, blocks, conditionals and iterators, that will directly
affect the output files.

The syntax of the template files is defined to be simple, without affecting the
content output. The syntax is somewhat inspired by Jinja2 syntax.

Templates must be valid UTF-8.

This manual describes the basic syntax and functionalities of template files.

TEMPLATE BLOCKS

Template blocks are used to delimit content. The content inside a block will
be included in the output file (or not) if the parameters passed to blogc(1)
matches the requirements of the given block.

Blocks can be defined more than once, but can't be nested.

The available blocks are: entry, listing, listing_empty, listing_entry
and listing_once.

entry block

The content of an entry block is included in the output file when blogc(1)
is called without -l option, and with only one source file. It is used to
render a single entry of your blog/website. All the variables defined in the
source file are available inside this block (see blogc-source(7)), and will
override global variables (see blogc(1)).

This is how an entry block is defined:

{% block entry %}
This content will only be included when rendering a single entry.
{% endblock %}

listing block

The content of a listing block is included in the output file when blogc(1)
is called with -l option, and with zero or more source files. It is used
to create a listing of entries, and its content will be included once for
each given source file (in the order that the source files were provided to
blogc(1)). All the variables defined in the source files are available
inside this block (see blogc-source(7)), and will override global variables
(see blogc(1)). The variables will be provided by each file, when blogc(1)
iterates over them.

This is how a listing block is defined:

{% block listing %}
This content will be only included when rendering an entry listing, and
will be included once for each entry.
{% endblock %}

listing_empty block

This block is similar to the listing block, but its content is included
only when there are no entries to be listed, either because no source files
were provided or because there are no entries remaining after filtering (see
blogc-pagination(7)).

This is how a listing_empty block is defined:

{% block listing_empty %}
No entries available.
{% endblock %}

listing_entry block

This block is identical to the entry block, but its content is included in
the output file only when blogc(1) is called with -l and -e <var>SOURCE</var>
options. The variables available in the block are provided by the source
file provided using -e <var>SOURCE</var> option.

This is how a listing_entry block is defined:

{% block listing_entry %}
This content will only be included when rendering a listing, but with
content provided by a single entry.
{% endblock %}

When multiple listing_entry blocks are defined, blogc(1) should be called
with multiple -e <var>SOURCE</var> options. If a listing_entry block does not have
a corresponding -e <var>SOURCE</var> option, or if its value is an empty string,
the content of the listing_entry block is not included.

listing_entry blocks inside iterator are evaluated as multiple blocks and
also require multiple -e <var>SOURCE</var> options. blogc(1) won't use the same
source for every iteration.

listing_once block

The content of a listing_once block is included in the output file when
blogc(1) is called with -l option, and with zero or more source files. It is
like a listing block, but is only called once, and does not have access
to the local variables defined in the source files. It is useful to add
something before an entry listing.

The content of a listing_once block is included even if no source file is
provided.

This is how a listing_once block is defined:

{% block listing_once %}
This content will be only included when rendering an entry listing, but
will be included only once.
{% endblock %}

This is a 'real world' usage example of a listing_once block, supposing
that the TITLE variable is defined:

{% block listing_once %}
<ul>
{% endblock %}
{% block listing %}
<li>{{ TITLE }}</li>
{% endblock %}
{% block listing_once %}
</ul>
{% endblock %}

TEMPLATE VARIABLES

Template variables are used to provide content to templates from blogc(1)
command-line and from source files.

This is how a variable is defined in a template:

{{ VARIABLE_NAME }}

The value of a variable will depends of its scope. Global variables provided
to blogc(1) are available everywhere in the templates. Local variables
provided in the source files are available only inside entry and listing
blocks, and will override global variables.

If a variable is not defined, it will be replaced by an empty string. blogc(1)
won't raise any error in this case.

Variables are always strings, even if the value of the variable is a number,
it is handled as a string by blogc(1).

Variable formatters

blogc(1) can apply a formatter to a variable, depending on how it is called
in the template. If user append _FORMATTED to the end of the variable name,
a formatter will be applied, if available for the variable name:

Date formatter: if variable name starts with DATE_, it is formatted with
a strftime(3) format, provided by DATE_FORMAT variable. The DATE_FORMATTED
"meta-variable" will return the formatted version of the DATE variable.
If DATE_FORMAT is not provided, the original value will be returned.

An existing variable is not overrided by formatter. That means that if
FOO_FORMATTED variable exists, it won't be handled as a formatter
"meta-variable", and FOO_FORMATTED variable value will be returned normally.

Truncated variables

blogc(1) can truncate the value of a variable to a maximum length, if it is
called with the maximum length appended to the end of the variable, like:
FOO_5 will return the 5 first characters of the FOO variable, if bigger
than 5 characters.

This is applicable to the "meta-variables", like DATE_FORMATTED. It can
be truncated like: DATE_FORMATTED_5, that will return the 5 first
characters of the DATE_FORMATTED "meta-variable".

An existing variable is not overrided by the truncate syntax. That means
that if FOO_5 variable exists, it won't be handled as a truncate
"meta-variable", and FOO_5 variable value will be returned normally.

PREDEFINED TEMPLATE VARIABLES

blogc(1) provides some template variables, that can be used to display some build
metadata in your website.

If some of the variables are not available in the system running the build, they
won't be defined. It is recommended to rely on template conditionals, mainly
ifdef and ifndef when using these variables.

Static variables

These variables are always available, and are set during the blogc(1) binary
compilation.

BLOGC_VERSION

The version of blogc(1) used to build. e.g.: blogc 0.14.1.

Resource usage variables

It is not possible to measure the resource usage of blogc(1) until the end of
the execution, because the rendering of these variables itself is using resources,
and the evaluation of the used resources was already done. To get better values,
it is recommended to use these variables only in the website footer.

BLOGC_RUSAGE_CPU_TIME

The CPU time used to build, up to the point where this variable was used for
the first time in the template (value is cached). e.g.: 12.345ms.

BLOGC_RUSAGE_MEMORY

The memory used to build, up to the point where this variable was used for the
first time in the template (value is cached). e.g.: 1.234MB.

System information variables

BLOGC_SYSINFO_HOSTNAME

The hostname of the machine where the build happened (short hostname only, not
FQDN).

BLOGC_SYSINFO_USERNAME

The username of the user that executed the build.

BLOGC_SYSINFO_DATETIME

The GMT datetime of the build. e.g. 2019-02-10 22:00:00.

BLOGC_SYSINFO_INSIDE_DOCKER

If built inside a docker container, this variable will be defined, with value 1.

TEMPLATE CONDITIONALS

Template conditionals are used to include content to the output, or not,
based on the value and existence of variables in the current scope.

The implementation of conditionals is simple, and each will just evaluate the
value of a single variable.

The available conditionals are: ifdef, ifndef and if. else statements
are supported.

ifdef conditional

The content of an ifdef conditional is included in the output file when
the given variable is defined in the current scope.

This is how an ifdef conditional is defined in a template:

{% ifdef TITLE %}
This is title: {{ TITLE }}
{% else %}
Untitled entry
{% endif %}

In this case, if the TITLE variable is defined, the content after the statement
is included. Otherwise, the content after else statement is included.

ifndef conditional

The content of an ifndef conditional is included in the output file when
the given variable is not defined in the current scope.

This is how an ifndef conditional is defined in a template:

{% ifndef TITLE %}
Untitled entry
{% endif %}

In this case, if the TITLE variable is not defined, the content is included.
else statements are supported here, even if it does not makes much sense to
be used this way.

if conditional

The content of an if conditional is included in the output file when
the comparision between the given variable and the given static string or
variable evaluates to true in the current scope. The left operand of the
comparision must be a variable.

The available operators are: ==, !=, <, >, <= and >=. The
comparisions are strcmp(3)-like.

This is how an if conditional is defined in a template:

{% if TITLE == "My Title" %}
Special description of "My Title"
{% else %}
Title is {{ TITLE }}
{% endif %}

Or:

{% if TITLE == DEFAULT_TITLE %}
Title is the default title
{% endif %}

TEMPLATE ITERATORS

Template iterators are used to iterate over the value of a variable, that is handled
as a list.

The available conditionals are: foreach.

foreach iterator

The content of a foreach iterator is included in the output file when the target
variable is defined, and is repeated for each item in the list parsed from the variable
value.

The variable value should be formatted as a space-separated list of items. Quotes are
not supported, as this is intended to work with identifiers, like slugs, and not with
arbitrary strings.

This is how a variable value would be formatted:

item1 item2 item3

For more info about how to define variables, see blogc(1) and blogc-source(7).

This is how a foreach iterator is defined in a template:

{% foreach TAGS %}
<a href="/tag/{{ FOREACH_ITEM }}/">{{ FOREACH_ITEM }}</a>
{% endforeach %}

Where TAGS is the variable with space-separated list of items, and FOREACH_ITEM
is the variable defined by blogc(1), that will store the item value for a given
iteration.

If the value of the TAGS variable is "item1 item2 item3", this template is
rendered 3 times, one for each item value.

The FOREACH_ITEM variable can be truncated, like:

{% foreach TAGS %}
<a href="/tag/{{ FOREACH_ITEM }}/">{{ FOREACH_ITEM_5 }}</a>
{% endforeach %}

WHITESPACE CONTROL

Users can control how whitespaces (space, form-feed (\f), newline (\n),
carriage return (\r), horizontal tab (\t), and vertical tab (\v)) are
handled before and after statements delimited with {% and %} sequences,
respectively.

Adding a minus sign (-)  after a {% sequence ({%-) will remove whitespaces
before the sequence and after the last non-whitespace character before the sequence.

Adding a minus sign (-)  before a %} sequence (-%}) will remove whitespaces
after the sequence and before the first non-whitespace character after the sequence.

BUGS

The template content is handled by handwritten parsers, that even being well
tested, may be subject of parsing bugs. Please report any issues to:
https://github.com/blogc/blogc

AUTHOR

Rafael G. Martins <rafael@rafaelmartins.eng.br>

SEE ALSO

blogc(1), blogc-source(7), strcmp(3), strftime(3)

Rafael G. Martins

May 2020

blogc-template(7)


text:
/* vim: set et fdm=syntax sts=3 sw=3 ts=3 : */
/**
 * NSSConfiguration.hh
 * Copyright 2009 Saleem Abdulrasool <compnerd@compnerd.org>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 **/

#ifndef __NSS_CONFIGURATION_HH__
#define __NSS_CONFIGURATION_HH__

#include <map>
#include <deque>

#include "NSSService.hh"
#include "NSSDatabase.hh"

namespace SystemConfiguration
{
   class NSSConfiguration
   {
      friend std::ostream & operator<<(std::ostream &, const NSSConfiguration &);
      friend std::istream & operator>>(std::istream &, NSSConfiguration &);

      private:
         std::map< NSSDatabase, std::deque< NSSService > > _configuration;

      public:
         NSSConfiguration(void);
         ~NSSConfiguration(void);

         std::deque< NSSService > & operator[](const NSSDatabase database);
   };

   std::ostream &
   operator<<(std::ostream & os, const NSSConfiguration & configuration);

   std::istream &
   operator>>(std::istream & is, NSSConfiguration & configuration);
};

#endif


text:
/**
 */
package de.uni_hildesheim.sse.ivml;

import org.eclipse.emf.ecore.EObject;

/**
 *
 * A representation of the model object 'Expression List Entry'.
 *
 *
 *

 * The following features are supported:
 *

 *

 *
{@link de.uni_hildesheim.sse.ivml.ExpressionListEntry#getName Name}

 *
{@link de.uni_hildesheim.sse.ivml.ExpressionListEntry#getAttrib Attrib}

 *
{@link de.uni_hildesheim.sse.ivml.ExpressionListEntry#getValue Value}

 *
{@link de.uni_hildesheim.sse.ivml.ExpressionListEntry#getContainer Container}

 *

 *
 * @see de.uni_hildesheim.sse.ivml.IvmlPackage#getExpressionListEntry()
 * @model
 * @generated
 */
public interface ExpressionListEntry extends EObject
{
  /**
   * Returns the value of the 'Name' attribute.
   *
   *
   * @return the value of the 'Name' attribute.
   * @see #setName(String)
   * @see de.uni_hildesheim.sse.ivml.IvmlPackage#getExpressionListEntry_Name()
   * @model
   * @generated
   */
  String getName();

  /**
   * Sets the value of the '{@link de.uni_hildesheim.sse.ivml.ExpressionListEntry#getName Name}' attribute.
   *
   *
   * @param value the new value of the 'Name' attribute.
   * @see #getName()
   * @generated
   */
  void setName(String value);

  /**
   * Returns the value of the 'Attrib' attribute.
   *
   *
   * @return the value of the 'Attrib' attribute.
   * @see #setAttrib(String)
   * @see de.uni_hildesheim.sse.ivml.IvmlPackage#getExpressionListEntry_Attrib()
   * @model
   * @generated
   */
  String getAttrib();

  /**
   * Sets the value of the '{@link de.uni_hildesheim.sse.ivml.ExpressionListEntry#getAttrib Attrib}' attribute.
   *
   *
   * @param value the new value of the 'Attrib' attribute.
   * @see #getAttrib()
   * @generated
   */
  void setAttrib(String value);

  /**
   * Returns the value of the 'Value' containment reference.
   *
   *
   * @return the value of the 'Value' containment reference.
   * @see #setValue(ImplicationExpression)
   * @see de.uni_hildesheim.sse.ivml.IvmlPackage#getExpressionListEntry_Value()
   * @model containment="true"
   * @generated
   */
  ImplicationExpression getValue();

  /**
   * Sets the value of the '{@link de.uni_hildesheim.sse.ivml.ExpressionListEntry#getValue Value}' containment reference.
   *
   *
   * @param value the new value of the 'Value' containment reference.
   * @see #getValue()
   * @generated
   */
  void setValue(ImplicationExpression value);

  /**
   * Returns the value of the 'Container' containment reference.
   *
   *
   * @return the value of the 'Container' containment reference.
   * @see #setContainer(ContainerInitializer)
   * @see de.uni_hildesheim.sse.ivml.IvmlPackage#getExpressionListEntry_Container()
   * @model containment="true"
   * @generated
   */
  ContainerInitializer getContainer();

  /**
   * Sets the value of the '{@link de.uni_hildesheim.sse.ivml.ExpressionListEntry#getContainer Container}' containment reference.
   *
   *
   * @param value the new value of the 'Container' containment reference.
   * @see #getContainer()
   * @generated
   */
  void setContainer(ContainerInitializer value);

} // ExpressionListEntry


text:
require 'test_helper'

class CorrectionNotifierTest < ActionMailer::TestCase

  test "received" do
    mail = CorrectionNotifier.received(users(:xy), users(:admin), reports(:one))
    assert_equal "You got new corrections", mail.subject
    assert_equal ["xy@report8.com"], mail.to
    assert_equal ["noreply@report8.com"], mail.from
    assert_match /one/, mail.body.encoded
  end

end


text:
package testsubjects;

public class WhileSubject
{
    public String firstNonNull(String[] values)
    {
        return null;
    }
}


text:
package org.apache.asterix.lang.sqlpp.visitor;

import java.io.PrintWriter;

import org.apache.asterix.lang.common.base.IAstPrintVisitorFactory;
import org.apache.asterix.lang.common.visitor.QueryPrintVisitor;

public class SqlppAstPrintVisitorFactory implements IAstPrintVisitorFactory {

    @Override
    public QueryPrintVisitor createLangVisitor(PrintWriter writer) {
        return new SqlppAstPrintVisitor(writer);
    }

}


text:
#include "test.h"
__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_isorr_rr_moved.c 201247 2009-12-30 05:59:21Z kientzle $");

/*
Execute the following command to rebuild the data for this program:
   tail -n +32 test_read_format_isorr_rr_moved.c | /bin/sh

dirname=/tmp/iso
rm -rf $dirname
mkdir -p $dirname/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10
echo "hello" >$dirname/file
dd if=/dev/zero count=1 bs=12345678 >>$dirname/file
deepfile=$dirname/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10/deep
echo "hello" >$deepfile
dd if=/dev/zero count=1 bs=12345678 >>$deepfile
time="197001020000.01"
TZ=utc touch -afhm -t $time $deepfile
TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10
TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9
TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8
TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3/dir4/dir5/dir6/dir7
TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3/dir4/dir5/dir6
TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3/dir4/dir5
TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3/dir4
TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3
TZ=utc touch -afhm -t $time $dirname/dir1/dir2
TZ=utc touch -afhm -t $time $dirname/dir1
TZ=utc touch -afhm -t $time $dirname/file
TZ=utc touch -afhm -t $time $dirname
F=test_read_format_isorr_rockridge_moved.iso.Z
mkhybrid -R -uid 1 -gid 2 $dirname | compress > $F
uuencode $F $F > $F.uu
exit 1
 */

DEFINE_TEST(test_read_format_isorr_rr_moved)
{
	const char *refname = "test_read_format_iso_rockridge_rr_moved.iso.Z";
	struct archive_entry *ae;
	struct archive *a;
	const void *p;
	size_t size;
	int64_t offset;
	int i;

	extract_reference_file(refname);
	assert((a = archive_read_new()) != NULL);
	assertEqualInt(0, archive_read_support_filter_all(a));
	assertEqualInt(0, archive_read_support_format_all(a));
	assertEqualInt(ARCHIVE_OK,
	    archive_read_open_filename(a, refname, 10240));

	/* Retrieve each of the 8 files on the ISO image and
	 * verify that each one is what we expect. */
	for (i = 0; i < 13; ++i) {
		assertEqualInt(0, archive_read_next_header(a, &ae));

		if (strcmp(".", archive_entry_pathname(ae)) == 0) {
			/* '.' root directory. */
			assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
			assertEqualInt(2048, archive_entry_size(ae));
			/* Now, we read timestamp recorded by RRIP "TF". */
			assertEqualInt(86401, archive_entry_mtime(ae));
			assertEqualInt(0, archive_entry_mtime_nsec(ae));
			/* Now, we read links recorded by RRIP "PX". */
			assertEqualInt(3, archive_entry_stat(ae)->st_nlink);
			assertEqualInt(1, archive_entry_uid(ae));
			assertEqualIntA(a, ARCHIVE_EOF,
			    archive_read_data_block(a, &p, &size, &offset));
			assertEqualInt((int)size, 0);
		} else if (strcmp("dir1", archive_entry_pathname(ae)) == 0) {
			/* A directory. */
			assertEqualString("dir1", archive_entry_pathname(ae));
			assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
			assertEqualInt(2048, archive_entry_size(ae));
			assertEqualInt(86401, archive_entry_mtime(ae));
			assertEqualInt(86401, archive_entry_atime(ae));
			assertEqualInt(3, archive_entry_stat(ae)->st_nlink);
			assertEqualInt(1, archive_entry_uid(ae));
			assertEqualInt(2, archive_entry_gid(ae));
		} else if (strcmp("dir1/dir2",
		    archive_entry_pathname(ae)) == 0) {
			/* A directory. */
			assertEqualString("dir1/dir2",
			    archive_entry_pathname(ae));
			assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
			assertEqualInt(2048, archive_entry_size(ae));
			assertEqualInt(86401, archive_entry_mtime(ae));
			assertEqualInt(86401, archive_entry_atime(ae));
			assertEqualInt(3, archive_entry_stat(ae)->st_nlink);
			assertEqualInt(1, archive_entry_uid(ae));
			assertEqualInt(2, archive_entry_gid(ae));
		} else if (strcmp("dir1/dir2/dir3",
		    archive_entry_pathname(ae)) == 0) {
			/* A directory. */
			assertEqualString("dir1/dir2/dir3",
			    archive_entry_pathname(ae));
			assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
			assertEqualInt(2048, archive_entry_size(ae));
			assertEqualInt(86401, archive_entry_mtime(ae));
			assertEqualInt(86401, archive_entry_atime(ae));
			assertEqualInt(3, archive_entry_stat(ae)->st_nlink);
			assertEqualInt(1, archive_entry_uid(ae));
			assertEqualInt(2, archive_entry_gid(ae));
		} else if (strcmp("dir1/dir2/dir3/dir4",
		    archive_entry_pathname(ae)) == 0) {
			/* A directory. */
			assertEqualString("dir1/dir2/dir3/dir4",
			    archive_entry_pathname(ae));
			assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
			assertEqualInt(2048, archive_entry_size(ae));
			assertEqualInt(86401, archive_entry_mtime(ae));
			assertEqualInt(86401, archive_entry_atime(ae));
			assertEqualInt(3, archive_entry_stat(ae)->st_nlink);
			assertEqualInt(1, archive_entry_uid(ae));
			assertEqualInt(2, archive_entry_gid(ae));
		} else if (strcmp("dir1/dir2/dir3/dir4/dir5",
		    archive_entry_pathname(ae)) == 0) {
			/* A directory. */
			assertEqualString("dir1/dir2/dir3/dir4/dir5",
			    archive_entry_pathname(ae));
			assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
			assertEqualInt(2048, archive_entry_size(ae));
			assertEqualInt(86401, archive_entry_mtime(ae));
			assertEqualInt(86401, archive_entry_atime(ae));
			assertEqualInt(3, archive_entry_stat(ae)->st_nlink);
			assertEqualInt(1, archive_entry_uid(ae));
			assertEqualInt(2, archive_entry_gid(ae));
		} else if (strcmp("dir1/dir2/dir3/dir4/dir5/dir6",
		    archive_entry_pathname(ae)) == 0) {
			/* A directory. */
			assertEqualString("dir1/dir2/dir3/dir4/dir5/dir6",
			    archive_entry_pathname(ae));
			assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
			assertEqualInt(2048, archive_entry_size(ae));
			assertEqualInt(86401, archive_entry_mtime(ae));
			assertEqualInt(86401, archive_entry_atime(ae));
			assertEqualInt(3, archive_entry_stat(ae)->st_nlink);
			assertEqualInt(1, archive_entry_uid(ae));
			assertEqualInt(2, archive_entry_gid(ae));
		} else if (strcmp("dir1/dir2/dir3/dir4/dir5/dir6/dir7",
		    archive_entry_pathname(ae)) == 0) {
			/* A directory. */
			assertEqualString("dir1/dir2/dir3/dir4/dir5/dir6/dir7",
			    archive_entry_pathname(ae));
			assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
			assertEqualInt(2048, archive_entry_size(ae));
			assertEqualInt(86401, archive_entry_mtime(ae));
			assertEqualInt(86401, archive_entry_atime(ae));
			assertEqualInt(3, archive_entry_stat(ae)->st_nlink);
			assertEqualInt(1, archive_entry_uid(ae));
			assertEqualInt(2, archive_entry_gid(ae));
		} else if (strcmp("dir1/dir2/dir3/dir4/dir5/dir6/dir7"
		   "/dir8",
		    archive_entry_pathname(ae)) == 0) {
			/* A directory. */
			assertEqualString("dir1/dir2/dir3/dir4/dir5/dir6/dir7"
			    "/dir8",
			    archive_entry_pathname(ae));
			assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
			assertEqualInt(2048, archive_entry_size(ae));
			assertEqualInt(86401, archive_entry_mtime(ae));
			assertEqualInt(86401, archive_entry_atime(ae));
			assertEqualInt(3, archive_entry_stat(ae)->st_nlink);
			assertEqualInt(1, archive_entry_uid(ae));
			assertEqualInt(2, archive_entry_gid(ae));
		} else if (strcmp("dir1/dir2/dir3/dir4/dir5/dir6/dir7"
		   "/dir8/dir9",
		    archive_entry_pathname(ae)) == 0) {
			/* A directory. */
			assertEqualString("dir1/dir2/dir3/dir4/dir5/dir6/dir7"
			    "/dir8/dir9",
			    archive_entry_pathname(ae));
			assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
			assertEqualInt(2048, archive_entry_size(ae));
			assertEqualInt(86401, archive_entry_mtime(ae));
			assertEqualInt(86401, archive_entry_atime(ae));
			assertEqualInt(3, archive_entry_stat(ae)->st_nlink);
			assertEqualInt(1, archive_entry_uid(ae));
			assertEqualInt(2, archive_entry_gid(ae));
		} else if (strcmp("dir1/dir2/dir3/dir4/dir5/dir6/dir7"
		   "/dir8/dir9/dir10",
		    archive_entry_pathname(ae)) == 0) {
			/* A directory. */
			assertEqualString("dir1/dir2/dir3/dir4/dir5/dir6/dir7"
			    "/dir8/dir9/dir10",
			    archive_entry_pathname(ae));
			assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
			assertEqualInt(2048, archive_entry_size(ae));
			assertEqualInt(86401, archive_entry_mtime(ae));
			assertEqualInt(86401, archive_entry_atime(ae));
			assertEqualInt(2, archive_entry_stat(ae)->st_nlink);
			assertEqualInt(1, archive_entry_uid(ae));
			assertEqualInt(2, archive_entry_gid(ae));
		} else if (strcmp("file", archive_entry_pathname(ae)) == 0) {
			/* A regular file. */
			assertEqualString("file", archive_entry_pathname(ae));
			assertEqualInt(AE_IFREG, archive_entry_filetype(ae));
			assertEqualInt(12345684, archive_entry_size(ae));
			assertEqualInt(0,
			    archive_read_data_block(a, &p, &size, &offset));
			assertEqualInt(0, offset);
			assertEqualMem(p, "hello\n", 6);
			assertEqualInt(86401, archive_entry_mtime(ae));
			assertEqualInt(86401, archive_entry_atime(ae));
			assertEqualInt(1, archive_entry_stat(ae)->st_nlink);
			assertEqualInt(1, archive_entry_uid(ae));
			assertEqualInt(2, archive_entry_gid(ae));
		} else if (strcmp("dir1/dir2/dir3/dir4/dir5/dir6/dir7"
		    "/dir8/dir9/dir10/deep",
		    archive_entry_pathname(ae)) == 0) {
			/* A regular file. */
			assertEqualString("dir1/dir2/dir3/dir4/dir5/dir6/dir7"
			    "/dir8/dir9/dir10/deep",
			    archive_entry_pathname(ae));
			assertEqualInt(AE_IFREG, archive_entry_filetype(ae));
			assertEqualInt(12345684, archive_entry_size(ae));
			assertEqualInt(0,
			    archive_read_data_block(a, &p, &size, &offset));
			assertEqualInt(0, offset);
			assertEqualMem(p, "hello\n", 6);
			assertEqualInt(86401, archive_entry_mtime(ae));
			assertEqualInt(86401, archive_entry_atime(ae));
			assertEqualInt(1, archive_entry_stat(ae)->st_nlink);
			assertEqualInt(1, archive_entry_uid(ae));
			assertEqualInt(2, archive_entry_gid(ae));
		} else {
			failure("Saw a file that shouldn't have been there");
			assertEqualString(archive_entry_pathname(ae), "");
		}
	}

	/* End of archive. */
	assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae));

	/* Verify archive format. */
	assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_COMPRESS);
	assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660_ROCKRIDGE);

	/* Close the archive. */
	assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
	assertEqualInt(ARCHIVE_OK, archive_read_free(a));
}