text:
/**
 * Constructor for FileSystem. Note that this class is designed for Firefox OS
 * devices and is not standard.
 *
 * @constructor
 * @param {string} [storage_name='sdcard'] the device to use (one of those : apps, music, pictures, sdcard, videos)
 */
function FileSystem(storage_name) {
    this.device = navigator.getDeviceStorage(storage_name || 'sdcard');
}

/**
 * Checks if a file exists on the device
 *
 * @param {string} filename The file to check
 * @param {function} exists_callback The callback to execute if the file exists
 * @param {function} [not_found_callback] The callback to execute if the file doesn't exist
 */
FileSystem.prototype.exists = function(filename, exists_callback, not_found_callback) {
    not_found_callback = not_found_callback || function() {};

    var request = this.device.get(filename);

    request.onsuccess = exists_callback;
    request.onerror = not_found_callback;
};

/**
 * Saves a Blob object on the device
 *
 * @param {Blob} blob The blob to write
 * @param {string} filename The name of the file
 * @param {boolean|function} overwrite True to force overwrite, or the callback to execute if the file already exists
 * @param {function} [success_callback] The callback to execute on success
 * @param {function} [error_callback] The callback to execute if an error occurs
 */
FileSystem.prototype.save_blob = function(blob, filename, overwrite, success_callback, error_callback) {
    overwrite = overwrite || false;
    success_callback = success_callback || function() {};
    error_callback = error_callback || function() {};

    var that = this;

    var write_file = function() {
        var request = that.device.addNamed(blob, filename);

        request.onsuccess = success_callback;
        request.onerror = error_callback;
    };

    this.exists(filename, function() {
        if(overwrite instanceof Function ? overwrite() : overwrite) {
            that.delete(this.result.name, write_file, error_callback);
        }
    }, write_file);
};

/**
 * Saves a text file on the device
 *
 * @param {string} content The text to write
 * @param {string} filename The name of the file
 * @param {boolean|function} overwrite True to force overwrite, or the callback to execute if the file already exists
 * @param {function} [success_callback] The callback to execute on success
 * @param {function} [error_callback] The callback to execute if an error occurs
 */
FileSystem.prototype.save = function(content, filename, overwrite, success_callback, error_callback) {
    var file = new Blob([content], {type: "text/plain"});
    this.save_blob(file, filename, overwrite, success_callback, error_callback);
}

/**
 * Opens a file from the device
 *
 * @param {string} filename The name of the file to open
 * @param {function} success_callback The callback to execute on success
 * @param {function} [error_callback] The callback to execute if an error occurs
 */
FileSystem.prototype.open = function(filename, success_callback, error_callback) {
    error_callback = error_callback || function () {};

    var request = this.device.get(filename);

    request.onsuccess = success_callback;
    request.onerror = error_callback;
};

/**
 * Reads a text file from the device
 *
 * @param {string} filename The name of the file to read
 * @param {function} success_callback The callback to execute on success
 * @param {function} [error_callback] The callback to execute if an error occurs
 */
FileSystem.prototype.read_as_text = function(filename, success_callback, error_callback) {
    error_callback = error_callback || function() {};

    this.open(filename, function () {
        var reader = new FileReader();
        reader.readAsText(this.result);
        reader.onloadend = success_callback;
    }, error_callback);
};

/**
 * Deletes a file from the device
 *
 * @param {string} filename The name of the file to delete
 * @param {function} [success_callback] The callback to execute on success
 * @param {function} [error_callback] The callback to execute if an error occurs
 */
FileSystem.prototype.delete = function(filename, success_callback, error_callback) {
    error_callback = error_callback || function () {};

    var request = this.device.delete(filename);

    request.onsuccess = success_callback;
    request.onerror = error_callback;
};

/**
 * Lists files on the device
 *
 * @param {function} success_callback The callback to execute on success. Its only parameter is an array of filenames.
 * @param {string} [path=''] Path of the directory to search files from. Note that path CAN'T begin with a '/'.
 * @param {string|regex} [pattern=''] Pattern to filter the filenames. Defaults matches everything.
 * @param {function} [error_callback] The callback to execute if an error occurs
 */
FileSystem.prototype.list = function(success_callback, path, pattern, error_callback) {
    pattern = pattern || '';
    path = path || '';
    error_callback = error_callback || function() {};

    var cursor = this.device.enumerate(path);

    var files = [];
    cursor.onsuccess = function () {
        var file = this.result;
        if (file != null) {
            if(file.name.match(pattern)) {
                files.push(file);
            }
            this.continue();
        } else {
            success_callback(files);
        }
    }
    cursor.onerror = error_callback;
};

/**
 * Gets the free/used space in bytes on the device
 *
 * @param {string} type The type of the space to check ('free' or 'used')
 * @param {function} success_callback The callback to execute on success
 * @param {function} [error_callback] The callback to execute if an error occurs
 */
FileSystem.prototype.space = function(type, success_callback, error_callback) {
    error_callback = error_callback || function() {};

    var request = this.device[type + 'Space']();

    request.onsuccess = success_callback;
    request.onerror = error_callback;
};


text:
<?php

namespace NbSessions\Test;

use NbSessions\SessionInstance;

class DestroyTest extends TestCase
{
    /** @test */
    public function removesAllData()
    {
        $session = new SessionInstance('session');
        $session->set([
            'foo' => 'bar',
            'name' => 'John Doe'
        ]);

        $session->destroy();
        // in hhvm we need to define the session handler again after destroy
        session_set_save_handler($this->sessionHandler);

        self::assertNull($session->get('foo'));
        self::assertNull($session->get('name'));
    }

    /** @test */
    public function removesDataFromSuperglobal()
    {
        $session = new SessionInstance('session');
        $session->set('foo', 'bar');

        $session->destroy();

        self::assertSame([], $_SESSION);
    }

    /** @test */
    public function destroysTheSession()
    {
        $session = new SessionInstance('session');
        $session->set('foo', 'bar');
        $this->sessionHandler->shouldReceive('destroy')->with(session_id())->once()->passthru();

        $session->destroy();
    }

    /** @test */
    public function sessionGetRestarted()
    {
        $session = new SessionInstance('session');
        $session->set('foo', 'bar');
        $this->sessionHandler->shouldReceive('destroy')->with(session_id())->atLeast()->once()->passthru();
        $session->destroy();
        // in hhvm we need to define the session handler again after destroy
        session_set_save_handler($this->sessionHandler);

        $session->set('foo', 'bar');

        self::assertSame('bar', $session->get('foo'));
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xamarin.Forms.Controls
{

	public class CarouselPageGallery : CarouselPage
	{
		public CarouselPageGallery ()
		{
			var pageOneLabel = new Label {
				Text = "No click one"
			};

			var pageTwoLabel = new Label {
				Text = "No click two"
			};

			var pageThreeLabel = new Label {
				Text = "No click three"
			};

			var pageOneButton = new Button {
				Text = "Click me one",
				Command = new Command (() => pageOneLabel.Text = "Clicked one")
			};

			var pageTwoButton = new Button {
				Text = "Click me two",
				Command = new Command (() => pageTwoLabel.Text = "Clicked two")
			};

			var pageThreeButton = new Button {
				Text = "Click me three",
				Command = new Command (() => pageThreeLabel.Text = "Clicked three")
			};

			Children.Add (new ContentPage {
				Title = "Page One",
				BackgroundColor = new Color (1, 0, 0),
				Content = new StackLayout {
					Children = {
						pageOneLabel,
						pageOneButton
					}
				}
			});

			Children.Add (new ContentPage {
				Title = "Page Two",
				BackgroundColor = new Color (0, 1, 0),
				Content = new StackLayout {
					Children = {
						pageTwoLabel,
						pageTwoButton
					}
				}
			});

			Children.Add (new ContentPage {
				Title = "Page Three",
				BackgroundColor = new Color (0, 0, 1),
				Content = new StackLayout {
					Children = {
						pageThreeLabel,
						pageThreeButton
					}
				}
			});
		}
	}
}


text:
import validator from 'validator';

/************************************************
 *                                               *
 *                  IMPORT TESTS                 *
 *                                               *
 ************************************************/
import blacklistFunc from 'validator/lib/blacklist';
import containsFunc from 'validator/lib/contains';
import equalsFunc from 'validator/lib/equals';
import escapeFunc from 'validator/lib/escape';
import isAfterFunc from 'validator/lib/isAfter';
import isAlphaFunc from 'validator/lib/isAlpha';
import isAlphanumericFunc from 'validator/lib/isAlphanumeric';
import isAsciiFunc from 'validator/lib/isAscii';
import isBase64Func from 'validator/lib/isBase64';
import isBeforeFunc from 'validator/lib/isBefore';
import isIBANFunc from 'validator/lib/isIBAN';
import isBICFunc from 'validator/lib/isBIC';
import isBooleanFunc from 'validator/lib/isBoolean';
import isByteLengthFunc from 'validator/lib/isByteLength';
import isCreditCardFunc from 'validator/lib/isCreditCard';
import isCurrencyFunc from 'validator/lib/isCurrency';
import isEthereumAddressFunc from 'validator/lib/isEthereumAddress';
import isBtcAddressFunc from 'validator/lib/isBtcAddress';
import isDataURIFunc from 'validator/lib/isDataURI';
import isDateFunc from 'validator/lib/isDate';
import isDecimalFunc from 'validator/lib/isDecimal';
import isDivisibleByFunc from 'validator/lib/isDivisibleBy';
import isEmailFunc from 'validator/lib/isEmail';
import isEmptyFunc from 'validator/lib/isEmpty';
import isFQDNFunc from 'validator/lib/isFQDN';
import isFloatFunc from 'validator/lib/isFloat';
import isFullWidthFunc from 'validator/lib/isFullWidth';
import isHalfWidthFunc from 'validator/lib/isHalfWidth';
import isHashFunc from 'validator/lib/isHash';
import isHexColorFunc from 'validator/lib/isHexColor';
import isHSLFunc from 'validator/lib/isHSL';
import isRgbColorFunc from 'validator/lib/isRgbColor';
import isHexadecimalFunc from 'validator/lib/isHexadecimal';
import isIPFunc from 'validator/lib/isIP';
import isIPRange from 'validator/lib/isIPRange';
import isISBNFunc from 'validator/lib/isISBN';
import isEANFunc from 'validator/lib/isEAN';
import isISSNFunc from 'validator/lib/isISSN';
import isISINFunc from 'validator/lib/isISIN';
import isISO8601Func from 'validator/lib/isISO8601';
import isISO31661Alpha2Func from 'validator/lib/isISO31661Alpha2';
import isISO31661Alpha3Func from 'validator/lib/isISO31661Alpha3';
import isISRCFunc from 'validator/lib/isISRC';
import isInFunc from 'validator/lib/isIn';
import isIntFunc from 'validator/lib/isInt';
import isJSONFunc from 'validator/lib/isJSON';
import isJWTFunc from 'validator/lib/isJWT';
import isLatLongFunc from 'validator/lib/isLatLong';
import isLengthFunc from 'validator/lib/isLength';
import isLocaleFunc from 'validator/lib/isLocale';
import isLowercaseFunc from 'validator/lib/isLowercase';
import isMACAddressFunc from 'validator/lib/isMACAddress';
import isMD5Func from 'validator/lib/isMD5';
import isMimeTypeFunc from 'validator/lib/isMimeType';
import isMobilePhoneFunc from 'validator/lib/isMobilePhone';
import isMongoIdFunc from 'validator/lib/isMongoId';
import isMultibyteFunc from 'validator/lib/isMultibyte';
import isNumericFunc from 'validator/lib/isNumeric';
import isOctalFunc from 'validator/lib/isOctal';
import isPassportNumberFunc from 'validator/lib/isPassportNumber';
import isPortFunc from 'validator/lib/isPort';
import isPostalCodeFunc from 'validator/lib/isPostalCode';
import isSemVerFunc from 'validator/lib/isSemVer';
import isStrongPasswordFunc from 'validator/lib/isStrongPassword';
import isSurrogatePairFunc from 'validator/lib/isSurrogatePair';
import isURLFunc from 'validator/lib/isURL';
import isUUIDFunc from 'validator/lib/isUUID';
import isUppercaseFunc from 'validator/lib/isUppercase';
import isVariableWidthFunc from 'validator/lib/isVariableWidth';
import isWhitelistedFunc from 'validator/lib/isWhitelisted';
import ltrimFunc from 'validator/lib/ltrim';
import matchesFunc from 'validator/lib/matches';
import normalizeEmailFunc from 'validator/lib/normalizeEmail';
import rtrimFunc from 'validator/lib/rtrim';
import stripLowFunc from 'validator/lib/stripLow';
import toBooleanFunc from 'validator/lib/toBoolean';
import toDateFunc from 'validator/lib/toDate';
import toFloatFunc from 'validator/lib/toFloat';
import toIntFunc from 'validator/lib/toInt';
import trimFunc from 'validator/lib/trim';
import unescapeFunc from 'validator/lib/unescape';
import whitelistFunc from 'validator/lib/whitelist';
import isSlugFunc from 'validator/lib/isSlug';

{
    let _blacklist = validator.blacklist;
    _blacklist = blacklistFunc;

    let _contains = validator.contains;
    _contains = containsFunc;

    let _equals = validator.equals;
    _equals = equalsFunc;

    let _escape = validator.escape;
    _escape = escapeFunc;

    let _isAfter = validator.isAfter;
    _isAfter = isAfterFunc;

    let _isAlpha = validator.isAlpha;
    _isAlpha = isAlphaFunc;

    let _isAlphanumeric = validator.isAlphanumeric;
    _isAlphanumeric = isAlphanumericFunc;

    let _isAscii = validator.isAscii;
    _isAscii = isAsciiFunc;

    let _isBase64 = validator.isBase64;
    _isBase64 = isBase64Func;

    let _isBefore = validator.isBefore;
    _isBefore = isBeforeFunc;

    let _isIBANFunc = validator.isIBAN;
    _isIBANFunc = isIBANFunc;

    let _isBIC = validator.isBIC;
    _isBIC = isBICFunc;

    let _isBoolean = validator.isBoolean;
    _isBoolean = isBooleanFunc;

    let _isByteLength = validator.isByteLength;
    _isByteLength = isByteLengthFunc;

    let _isCreditCard = validator.isCreditCard;
    _isCreditCard = isCreditCardFunc;

    let _isCurrency = validator.isCurrency;
    _isCurrency = isCurrencyFunc;

    let _isEthereumAddress = validator.isEthereumAddress;
    _isEthereumAddress = isEthereumAddressFunc;

    let _isBtcAddress = validator.isBtcAddress;
    _isBtcAddress = isBtcAddressFunc;

    let _isDataURI = validator.isDataURI;
    _isDataURI = isDataURIFunc;

    let _isDate = validator.isDate;
    _isDate = isDateFunc;

    let _isDecimal = validator.isDecimal;
    _isDecimal = isDecimalFunc;

    let _isDivisibleBy = validator.isDivisibleBy;
    _isDivisibleBy = isDivisibleByFunc;

    let _isEmail = validator.isEmail;
    _isEmail = isEmailFunc;

    let _isEmpty = validator.isEmpty;
    _isEmpty = isEmptyFunc;

    let _isFQDN = validator.isFQDN;
    _isFQDN = isFQDNFunc;

    let _isFloat = validator.isFloat;
    _isFloat = isFloatFunc;

    let _isFullWidth = validator.isFullWidth;
    _isFullWidth = isFullWidthFunc;

    let _isHalfWidth = validator.isHalfWidth;
    _isHalfWidth = isHalfWidthFunc;

    let _isHash = validator.isHash;
    _isHash = isHashFunc;

    let _isHexColor = validator.isHexColor;
    _isHexColor = isHexColorFunc;

    let _isHSL = validator.isHSL;
    _isHSL = isHSLFunc;

    let _isRgbColor = validator.isRgbColor;
    _isRgbColor = isRgbColorFunc;

    let _isHexadecimal = validator.isHexadecimal;
    _isHexadecimal = isHexadecimalFunc;

    let _isIP = validator.isIP;
    _isIP = isIPFunc;

    let _isIPRange = validator.isIPRange;
    _isIPRange = isIPRange;

    let _isISBN = validator.isISBN;
    _isISBN = isISBNFunc;

    let _isEAN = validator.isEAN;
    _isEAN = isEANFunc;

    let _isISSN = validator.isISSN;
    _isISSN = isISSNFunc;

    let _isISIN = validator.isISIN;
    _isISIN = isISINFunc;

    let _isISO8601 = validator.isISO8601;
    _isISO8601 = isISO8601Func;

    let _isISO31661Alpha2 = validator.isISO31661Alpha2;
    _isISO31661Alpha2 = isISO31661Alpha2Func;

    let _isISO31661Alpha3 = validator.isISO31661Alpha3;
    _isISO31661Alpha3 = isISO31661Alpha3Func;

    let _isISRC = validator.isISRC;
    _isISRC = isISRCFunc;

    let _isIn = validator.isIn;
    _isIn = isInFunc;

    let _isInt = validator.isInt;
    _isInt = isIntFunc;

    let _isJSON = validator.isJSON;
    _isJSON = isJSONFunc;

    let _isJWT = validator.isJWT;
    _isJWT = isJWTFunc;

    let _isLatLong = validator.isLatLong;
    _isLatLong = isLatLongFunc;

    let _isLength = validator.isLength;
    _isLength = isLengthFunc;

    let _isLocale = validator.isLocale;
    _isLocale = isLocaleFunc;

    let _isLowercase = validator.isLowercase;
    _isLowercase = isLowercaseFunc;

    let _isMACAddress = validator.isMACAddress;
    _isMACAddress = isMACAddressFunc;

    let _isMD5 = validator.isMD5;
    _isMD5 = isMD5Func;

    let _isMimeType = validator.isMimeType;
    _isMimeType = isMimeTypeFunc;

    let _isMobilePhone = validator.isMobilePhone;
    _isMobilePhone = isMobilePhoneFunc;

    let _isMongoId = validator.isMongoId;
    _isMongoId = isMongoIdFunc;

    let _isMultibyte = validator.isMultibyte;
    _isMultibyte = isMultibyteFunc;

    let _isNumeric = validator.isNumeric;
    _isNumeric = isNumericFunc;

    let _isOctal = validator.isOctal;
    _isOctal = isOctalFunc;

    let _isPassportNumber = validator.isPassportNumber;
    _isPassportNumber = isPassportNumberFunc;

    let _isPort = validator.isPort;
    _isPort = isPortFunc;

    let _isPostalCode = validator.isPostalCode;
    _isPostalCode = isPostalCodeFunc;

    let _isSemVer = validator.isSemVer;
    _isSemVer = isSemVerFunc;

    let _isStrongPassword = validator.isStrongPassword;
    _isStrongPassword = isStrongPasswordFunc;

    let _isSurrogatePair = validator.isSurrogatePair;
    _isSurrogatePair = isSurrogatePairFunc;

    let _isURL = validator.isURL;
    _isURL = isURLFunc;

    let _isUUID = validator.isUUID;
    _isUUID = isUUIDFunc;

    let _isUppercase = validator.isUppercase;
    _isUppercase = isUppercaseFunc;

    let _isVariableWidth = validator.isVariableWidth;
    _isVariableWidth = isVariableWidthFunc;

    let _isWhitelisted = validator.isWhitelisted;
    _isWhitelisted = isWhitelistedFunc;

    let _ltrim = validator.ltrim;
    _ltrim = ltrimFunc;

    let _matches = validator.matches;
    _matches = matchesFunc;

    let _normalizeEmail = validator.normalizeEmail;
    _normalizeEmail = normalizeEmailFunc;

    let _rtrim = validator.rtrim;
    _rtrim = rtrimFunc;

    let _stripLow = validator.stripLow;
    _stripLow = stripLowFunc;

    let _toBoolean = validator.toBoolean;
    _toBoolean = toBooleanFunc;

    let _toDate = validator.toDate;
    _toDate = toDateFunc;

    let _toFloat = validator.toFloat;
    _toFloat = toFloatFunc;

    let _toInt = validator.toInt;
    _toInt = toIntFunc;

    let _trim = validator.trim;
    _trim = trimFunc;

    let _unescape = validator.unescape;
    _unescape = unescapeFunc;

    let _whitelist = validator.whitelist;
    _whitelist = whitelistFunc;

    let _isSlug = validator.isSlug;
    _isSlug = isSlugFunc;
}

/************************************************
 *                                               *
 *                  ES IMPORT TESTS              *
 *                                               *
 ************************************************/
import blacklistFuncEs from 'validator/es/lib/blacklist';
import containsFuncEs from 'validator/es/lib/contains';
import equalsFuncEs from 'validator/es/lib/equals';
import escapeFuncEs from 'validator/es/lib/escape';
import isAfterFuncEs from 'validator/es/lib/isAfter';
import isAlphaFuncEs from 'validator/es/lib/isAlpha';
import isAlphanumericFuncEs from 'validator/es/lib/isAlphanumeric';
import isAsciiFuncEs from 'validator/es/lib/isAscii';
import isBase64FuncEs from 'validator/es/lib/isBase64';
import isBeforeFuncEs from 'validator/es/lib/isBefore';
import isIBANFuncEs from 'validator/es/lib/isIBAN';
import isBICFuncEs from 'validator/es/lib/isBIC';
import isBooleanFuncEs from 'validator/es/lib/isBoolean';
import isByteLengthFuncEs from 'validator/es/lib/isByteLength';
import isCreditCardFuncEs from 'validator/es/lib/isCreditCard';
import isCurrencyFuncEs from 'validator/es/lib/isCurrency';
import isEthereumAddressFuncEs from 'validator/es/lib/isEthereumAddress';
import isBtcAddressFuncEs from 'validator/es/lib/isBtcAddress';
import isDataURIFuncEs from 'validator/es/lib/isDataURI';
import isDateFuncEs from 'validator/es/lib/isDate';
import isDecimalFuncEs from 'validator/es/lib/isDecimal';
import isDivisibleByFuncEs from 'validator/es/lib/isDivisibleBy';
import isEmailFuncEs from 'validator/es/lib/isEmail';
import isEmptyFuncEs from 'validator/es/lib/isEmpty';
import isFQDNFuncEs from 'validator/es/lib/isFQDN';
import isFloatFuncEs from 'validator/es/lib/isFloat';
import isFullWidthFuncEs from 'validator/es/lib/isFullWidth';
import isHalfWidthFuncEs from 'validator/es/lib/isHalfWidth';
import isHashFuncEs from 'validator/es/lib/isHash';
import isHexColorFuncEs from 'validator/es/lib/isHexColor';
import isHSLFuncEs from 'validator/es/lib/isHSL';
import isRgbColorFuncEs from 'validator/es/lib/isRgbColor';
import isHexadecimalFuncEs from 'validator/es/lib/isHexadecimal';
import isIPFuncEs from 'validator/es/lib/isIP';
import isIPRangeFuncEs from 'validator/es/lib/isIPRange';
import isISBNFuncEs from 'validator/es/lib/isISBN';
import isEANFuncEs from 'validator/es/lib/isEAN';
import isISSNFuncEs from 'validator/es/lib/isISSN';
import isISINFuncEs from 'validator/es/lib/isISIN';
import isISO8601FuncEs from 'validator/es/lib/isISO8601';
import isISO31661Alpha2FuncEs from 'validator/es/lib/isISO31661Alpha2';
import isISO31661Alpha3FuncEs from 'validator/es/lib/isISO31661Alpha3';
import isISRCFuncEs from 'validator/es/lib/isISRC';
import isInFuncEs from 'validator/es/lib/isIn';
import isIntFuncEs from 'validator/es/lib/isInt';
import isJSONFuncEs from 'validator/es/lib/isJSON';
import isJWTFuncEs from 'validator/es/lib/isJWT';
import isLatLongFuncEs from 'validator/es/lib/isLatLong';
import isLengthFuncEs from 'validator/es/lib/isLength';
import isLocaleFuncEs from 'validator/es/lib/isLocale';
import isLowercaseFuncEs from 'validator/es/lib/isLowercase';
import isMACAddressFuncEs from 'validator/es/lib/isMACAddress';
import isMD5FuncEs from 'validator/es/lib/isMD5';
import isMimeTypeFuncEs from 'validator/es/lib/isMimeType';
import isMobilePhoneFuncEs from 'validator/es/lib/isMobilePhone';
import isMongoIdFuncEs from 'validator/es/lib/isMongoId';
import isMultibyteFuncEs from 'validator/es/lib/isMultibyte';
import isNumericFuncEs from 'validator/es/lib/isNumeric';
import isOctalFuncEs from 'validator/es/lib/isOctal';
import isPassportNumberFuncEs from 'validator/es/lib/isPassportNumber';
import isPortFuncEs from 'validator/es/lib/isPort';
import isPostalCodeFuncEs from 'validator/es/lib/isPostalCode';
import isSemVerFuncEs from 'validator/es/lib/isSemVer';
import isStrongPasswordFuncEs from 'validator/es/lib/isStrongPassword';
import isSurrogatePairFuncEs from 'validator/es/lib/isSurrogatePair';
import isURLFuncEs from 'validator/es/lib/isURL';
import isUUIDFuncEs from 'validator/es/lib/isUUID';
import isUppercaseFuncEs from 'validator/es/lib/isUppercase';
import isVariableWidthFuncEs from 'validator/es/lib/isVariableWidth';
import isWhitelistedFuncEs from 'validator/es/lib/isWhitelisted';
import ltrimFuncEs from 'validator/es/lib/ltrim';
import matchesFuncEs from 'validator/es/lib/matches';
import normalizeEmailFuncEs from 'validator/es/lib/normalizeEmail';
import rtrimFuncEs from 'validator/es/lib/rtrim';
import stripLowFuncEs from 'validator/es/lib/stripLow';
import toBooleanFuncEs from 'validator/es/lib/toBoolean';
import toDateFuncEs from 'validator/es/lib/toDate';
import toFloatFuncEs from 'validator/es/lib/toFloat';
import toIntFuncEs from 'validator/es/lib/toInt';
import trimFuncEs from 'validator/es/lib/trim';
import unescapeFuncEs from 'validator/es/lib/unescape';
import whitelistFuncEs from 'validator/es/lib/whitelist';
import isSlugFuncEs from 'validator/es/lib/isSlug';

/************************************************
 *                                               *
 *                  API TESTS                    *
 *                                               *
 ************************************************/
const any: any = null;

// **************
// * Validators *
// **************

{
    let result: boolean;

    result = validator.contains('sample', 'sample');

    result = validator.equals('sample', 'sample');

    result = validator.isAfter('sample');
    result = validator.isAfter('sample', new Date().toString());

    result = validator.isAlpha('sample');
    result = validator.isAlpha('sample', 'ar');
    result = validator.isAlpha('sample', 'ar-AE');
    result = validator.isAlpha('sample', 'ar-BH');
    result = validator.isAlpha('sample', 'ar-DZ');
    result = validator.isAlpha('sample', 'ar-EG');
    result = validator.isAlpha('sample', 'ar-IQ');
    result = validator.isAlpha('sample', 'ar-JO');
    result = validator.isAlpha('sample', 'ar-KW');
    result = validator.isAlpha('sample', 'ar-LB');
    result = validator.isAlpha('sample', 'ar-LY');
    result = validator.isAlpha('sample', 'ar-MA');
    result = validator.isAlpha('sample', 'ar-QA');
    result = validator.isAlpha('sample', 'ar-QM');
    result = validator.isAlpha('sample', 'ar-SA');
    result = validator.isAlpha('sample', 'ar-SD');
    result = validator.isAlpha('sample', 'ar-SY');
    result = validator.isAlpha('sample', 'ar-TN');
    result = validator.isAlpha('sample', 'ar-YE');
    result = validator.isAlpha('sample', 'bg-BG');
    result = validator.isAlpha('sample', 'cs-CZ');
    result = validator.isAlpha('sample', 'da-DK');
    result = validator.isAlpha('sample', 'de-DE');
    result = validator.isAlpha('sample', 'el-GR');
    result = validator.isAlpha('sample', 'en-AU');
    result = validator.isAlpha('sample', 'en-GB');
    result = validator.isAlpha('sample', 'en-HK');
    result = validator.isAlpha('sample', 'en-IN');
    result = validator.isAlpha('sample', 'en-NZ');
    result = validator.isAlpha('sample', 'en-US');
    result = validator.isAlpha('sample', 'en-ZA');
    result = validator.isAlpha('sample', 'en-ZM');
    result = validator.isAlpha('sample', 'es-ES');
    result = validator.isAlpha('sample', 'fr-FR');
    result = validator.isAlpha('sample', 'hu-HU');
    result = validator.isAlpha('sample', 'it-IT');
    result = validator.isAlpha('sample', 'nb-NO');
    result = validator.isAlpha('sample', 'nl-NL');
    result = validator.isAlpha('sample', 'nn-NO');
    result = validator.isAlpha('sample', 'pl-PL');
    result = validator.isAlpha('sample', 'pt-BR');
    result = validator.isAlpha('sample', 'pt-PT');
    result = validator.isAlpha('sample', 'ru-RU');
    result = validator.isAlpha('sample', 'sk-SK');
    result = validator.isAlpha('sample', 'sr-RS');
    result = validator.isAlpha('sample', 'sr-RS@latin');
    result = validator.isAlpha('sample', 'sv-SE');
    result = validator.isAlpha('sample', 'tr-TR');
    result = validator.isAlpha('sample', 'uk-UA');

    result = validator.isAlphanumeric('sample');
    result = validator.isAlphanumeric('sample', 'ar');
    result = validator.isAlphanumeric('sample', 'ar-AE');
    result = validator.isAlphanumeric('sample', 'ar-BH');
    result = validator.isAlphanumeric('sample', 'ar-DZ');
    result = validator.isAlphanumeric('sample', 'ar-EG');
    result = validator.isAlphanumeric('sample', 'ar-IQ');
    result = validator.isAlphanumeric('sample', 'ar-JO');
    result = validator.isAlphanumeric('sample', 'ar-KW');
    result = validator.isAlphanumeric('sample', 'ar-LB');
    result = validator.isAlphanumeric('sample', 'ar-LY');
    result = validator.isAlphanumeric('sample', 'ar-MA');
    result = validator.isAlphanumeric('sample', 'ar-QA');
    result = validator.isAlphanumeric('sample', 'ar-QM');
    result = validator.isAlphanumeric('sample', 'ar-SA');
    result = validator.isAlphanumeric('sample', 'ar-SD');
    result = validator.isAlphanumeric('sample', 'ar-SY');
    result = validator.isAlphanumeric('sample', 'ar-TN');
    result = validator.isAlphanumeric('sample', 'ar-YE');
    result = validator.isAlphanumeric('sample', 'bg-BG');
    result = validator.isAlphanumeric('sample', 'cs-CZ');
    result = validator.isAlphanumeric('sample', 'da-DK');
    result = validator.isAlphanumeric('sample', 'de-DE');
    result = validator.isAlphanumeric('sample', 'el-GR');
    result = validator.isAlphanumeric('sample', 'en-AU');
    result = validator.isAlphanumeric('sample', 'en-GB');
    result = validator.isAlphanumeric('sample', 'en-HK');
    result = validator.isAlphanumeric('sample', 'en-IN');
    result = validator.isAlphanumeric('sample', 'en-NZ');
    result = validator.isAlphanumeric('sample', 'en-US');
    result = validator.isAlphanumeric('sample', 'en-ZA');
    result = validator.isAlphanumeric('sample', 'en-ZM');
    result = validator.isAlphanumeric('sample', 'es-ES');
    result = validator.isAlphanumeric('sample', 'fr-FR');
    result = validator.isAlphanumeric('sample', 'hu-HU');
    result = validator.isAlphanumeric('sample', 'it-IT');
    result = validator.isAlphanumeric('sample', 'nb-NO');
    result = validator.isAlphanumeric('sample', 'nl-NL');
    result = validator.isAlphanumeric('sample', 'nn-NO');
    result = validator.isAlphanumeric('sample', 'pl-PL');
    result = validator.isAlphanumeric('sample', 'pt-BR');
    result = validator.isAlphanumeric('sample', 'pt-PT');
    result = validator.isAlphanumeric('sample', 'ru-RU');
    result = validator.isAlphanumeric('sample', 'sk-SK');
    result = validator.isAlphanumeric('sample', 'sr-RS');
    result = validator.isAlphanumeric('sample', 'sr-RS@latin');
    result = validator.isAlphanumeric('sample', 'sv-SE');
    result = validator.isAlphanumeric('sample', 'tr-TR');
    result = validator.isAlphanumeric('sample', 'uk-UA');

    result = validator.isAscii('sample');

    const isBase64Options: validator.IsBase64Options = {};
    result = validator.isBase64('sample');
    result = validator.isBase64('sample', isBase64Options);

    result = validator.isBefore('sample');
    result = validator.isBefore('sample', new Date().toString());

    result = validator.isIBAN('sample');

    result = validator.isBIC('SBICKEN1345');

    result = validator.isBoolean('sample');

    const isByteLengthOptions: validator.IsByteLengthOptions = {};
    result = validator.isByteLength('sample', isByteLengthOptions);

    result = validator.isCreditCard('sample');

    const isCurrencyOptions: validator.IsCurrencyOptions = {};
    result = validator.isCurrency('sample');
    result = validator.isCurrency('sample', isCurrencyOptions);

    result = validator.isEthereumAddress('sample');

    result = validator.isBtcAddress('sample');

    result = validator.isDataURI('sample');

    const isDateOptions: validator.IsDateOptions = {};
    result = validator.isDate('sample');
    result = validator.isDate('sample', isDateOptions);

    const isDecimalOptions: validator.IsDecimalOptions = {};
    result = validator.isDecimal('sample');
    result = validator.isDecimal('sample', isDecimalOptions);

    result = validator.isDivisibleBy('sample', 2);

    const isEmailOptions: validator.IsEmailOptions = {};
    result = validator.isEmail('sample');
    result = validator.isEmail('sample', isEmailOptions);

    const isEmptyOptions: validator.IsEmptyOptions = {};
    result = validator.isEmpty('sample');
    result = validator.isEmpty('sample', isEmptyOptions);

    const isFQDNOptions: validator.IsFQDNOptions = {};
    result = validator.isFQDN('sample');
    result = validator.isFQDN('sample', isFQDNOptions);

    const isFloatOptions: validator.IsFloatOptions = {};
    result = validator.isFloat('sample');
    result = validator.isFloat('sample', isFloatOptions);

    result = validator.isFullWidth('sample');

    result = validator.isHalfWidth('sample');

    result = validator.isHash('sample', 'md4');
    result = validator.isHash('sample', 'md5');
    result = validator.isHash('sample', 'sha1');
    result = validator.isHash('sample', 'sha256');
    result = validator.isHash('sample', 'sha384');
    result = validator.isHash('sample', 'sha512');
    result = validator.isHash('sample', 'ripemd128');
    result = validator.isHash('sample', 'ripemd160');
    result = validator.isHash('sample', 'tiger128');
    result = validator.isHash('sample', 'tiger160');
    result = validator.isHash('sample', 'tiger192');
    result = validator.isHash('sample', 'crc32');
    result = validator.isHash('sample', 'crc32b');

    result = validator.isHexColor('sample');

    result = validator.isHSL('sample');

    result = validator.isRgbColor('sample');
    result = validator.isRgbColor('sample', true);

    result = validator.isHexadecimal('sample');

    result = validator.isIP('sample');
    result = validator.isIP('sample', '6');

    result = validator.isIPRange('sample');
    result = validator.isIPRange('sample', '6');

    result = validator.isISBN('sample');
    result = validator.isISBN('sample', '13');

    result = validator.isEAN('sample');

    const isISSNOptions: validator.IsISSNOptions = {
        case_sensitive: true,
        require_hyphen: true,
    };
    result = validator.isISSN('sample');
    result = validator.isISSN('sample', isISSNOptions);

    result = validator.isISIN('sample');

    const isISO8601Options: validator.IsISO8601Options = {
        strict: true,
    };
    result = validator.isISO8601('sample');
    result = validator.isISO8601('sample', isISO8601Options);

    result = validator.isISO31661Alpha2('sample');
    result = validator.isISO31661Alpha3('sample');

    result = validator.isISRC('sample');

    result = validator.isIn('sample', []);

    const isIntOptions: validator.IsIntOptions = {};
    result = validator.isInt('sample');
    result = validator.isInt('sample', isIntOptions);

    result = validator.isJSON('sample');

    result = validator.isLatLong('sample');

    const isLengthOptions: validator.IsLengthOptions = {};
    result = validator.isLength('sample', isLengthOptions);
    result = validator.isLength('sample');

    result = validator.isLocale('sample');

    result = validator.isLowercase('sample');

    const isMACAddressOptions: validator.IsMACAddressOptions = {
        no_colons: true,
    };
    result = validator.isMACAddress('sample', isMACAddressOptions);
    result = validator.isMACAddress('sample');

    result = validator.isMD5('sample');

    result = validator.isMimeType('sample');

    const isMobilePhoneOptions: validator.IsMobilePhoneOptions = {
        strictMode: true,
    };
    result = validator.isMobilePhone('sample', 'any', isMobilePhoneOptions);
    result = validator.isMobilePhone('sample', 'ar-AE');
    result = validator.isMobilePhone('sample', 'ar-DZ');
    result = validator.isMobilePhone('sample', 'ar-EG');
    result = validator.isMobilePhone('sample', 'ar-JO');
    result = validator.isMobilePhone('sample', 'ar-SA');
    result = validator.isMobilePhone('sample', 'ar-SY');
    result = validator.isMobilePhone('sample', 'be-BY');
    result = validator.isMobilePhone('sample', 'bg-BG');
    result = validator.isMobilePhone('sample', 'cs-CZ');
    result = validator.isMobilePhone('sample', 'de-DE');
    result = validator.isMobilePhone('sample', 'da-DK');
    result = validator.isMobilePhone('sample', 'el-GR');
    result = validator.isMobilePhone('sample', 'en-AU');
    result = validator.isMobilePhone('sample', 'en-GB');
    result = validator.isMobilePhone('sample', 'en-HK');
    result = validator.isMobilePhone('sample', 'en-IN');
    result = validator.isMobilePhone('sample', 'en-KE');
    result = validator.isMobilePhone('sample', 'en-NG');
    result = validator.isMobilePhone('sample', 'en-NZ');
    result = validator.isMobilePhone('sample', 'en-UG');
    result = validator.isMobilePhone('sample', 'en-RW');
    result = validator.isMobilePhone('sample', 'en-SG');
    result = validator.isMobilePhone('sample', 'en-TZ');
    result = validator.isMobilePhone('sample', 'en-PK');
    result = validator.isMobilePhone('sample', 'en-US');
    result = validator.isMobilePhone('sample', 'en-CA');
    result = validator.isMobilePhone('sample', 'en-ZA');
    result = validator.isMobilePhone('sample', 'en-ZM');
    result = validator.isMobilePhone('sample', 'es-ES');
    result = validator.isMobilePhone('sample', 'fa-IR');
    result = validator.isMobilePhone('sample', 'fi-FI');
    result = validator.isMobilePhone('sample', 'fo-FO');
    result = validator.isMobilePhone('sample', 'fr-FR');
    result = validator.isMobilePhone('sample', 'he-IL');
    result = validator.isMobilePhone('sample', 'hu-HU');
    result = validator.isMobilePhone('sample', 'id-ID');
    result = validator.isMobilePhone('sample', 'it-IT');
    result = validator.isMobilePhone('sample', 'ja-JP');
    result = validator.isMobilePhone('sample', 'kk-KZ');
    result = validator.isMobilePhone('sample', 'kl-GL');
    result = validator.isMobilePhone('sample', 'ko-KR');
    result = validator.isMobilePhone('sample', 'lt-LT');
    result = validator.isMobilePhone('sample', 'ms-MY');
    result = validator.isMobilePhone('sample', 'nb-NO');
    result = validator.isMobilePhone('sample', 'nn-NO');
    result = validator.isMobilePhone('sample', 'pl-PL');
    result = validator.isMobilePhone('sample', 'pt-PT');
    result = validator.isMobilePhone('sample', 'ro-RO');
    result = validator.isMobilePhone('sample', 'ru-RU');
    result = validator.isMobilePhone('sample', 'sr-RS');
    result = validator.isMobilePhone('sample', 'sk-SK');
    result = validator.isMobilePhone('sample', 'th-TH');
    result = validator.isMobilePhone('sample', 'tr-TR');
    result = validator.isMobilePhone('sample', 'uk-UA');
    result = validator.isMobilePhone('sample', 'vi-VN');
    result = validator.isMobilePhone('sample', 'zh-CN');
    result = validator.isMobilePhone('sample', 'zh-HK');
    result = validator.isMobilePhone('sample', 'zh-TW');
    result = validator.isMobilePhone('sample', 'any');
    result = validator.isMobilePhone('sample');
    result = validator.isMobilePhone('sample', ['pl-PL', 'pt-PT']);

    result = validator.isMongoId('sample');

    result = validator.isMultibyte('sample');

    result = validator.isNumeric('sample');
    result = validator.isNumeric('+358', { no_symbols: true });

    result = validator.isOctal('076543210');

    result = validator.isPassportNumber('sample', 'US');

    result = validator.isPort('sample');

    result = validator.isPostalCode('sample', 'AT');
    result = validator.isPostalCode('sample', 'AU');
    result = validator.isPostalCode('sample', 'BE');
    result = validator.isPostalCode('sample', 'BG');
    result = validator.isPostalCode('sample', 'CA');
    result = validator.isPostalCode('sample', 'CH');
    result = validator.isPostalCode('sample', 'CZ');
    result = validator.isPostalCode('sample', 'DE');
    result = validator.isPostalCode('sample', 'DK');
    result = validator.isPostalCode('sample', 'DZ');
    result = validator.isPostalCode('sample', 'ES');
    result = validator.isPostalCode('sample', 'FI');
    result = validator.isPostalCode('sample', 'FR');
    result = validator.isPostalCode('sample', 'GB');
    result = validator.isPostalCode('sample', 'GR');
    result = validator.isPostalCode('sample', 'IL');
    result = validator.isPostalCode('sample', 'IN');
    result = validator.isPostalCode('sample', 'IS');
    result = validator.isPostalCode('sample', 'IT');
    result = validator.isPostalCode('sample', 'JP');
    result = validator.isPostalCode('sample', 'KE');
    result = validator.isPostalCode('sample', 'LI');
    result = validator.isPostalCode('sample', 'MX');
    result = validator.isPostalCode('sample', 'NL');
    result = validator.isPostalCode('sample', 'NO');
    result = validator.isPostalCode('sample', 'PL');
    result = validator.isPostalCode('sample', 'PT');
    result = validator.isPostalCode('sample', 'RO');
    result = validator.isPostalCode('sample', 'RU');
    result = validator.isPostalCode('sample', 'SA');
    result = validator.isPostalCode('sample', 'SE');
    result = validator.isPostalCode('sample', 'TW');
    result = validator.isPostalCode('sample', 'US');
    result = validator.isPostalCode('sample', 'ZA');
    result = validator.isPostalCode('sample', 'ZM');
    result = validator.isPostalCode('sample', 'any');

    result = validator.isSemVer('sample');

    result = validator.isStrongPassword('sample');

    result = validator.isSurrogatePair('sample');

    const isURLOptions: validator.IsURLOptions = {};
    result = validator.isURL('sample');
    result = validator.isURL('sample', isURLOptions);

    result = validator.isUUID('sample');
    result = validator.isUUID('sample', 5);
    result = validator.isUUID('sample', 'all');

    result = validator.isUppercase('sample');

    result = validator.isVariableWidth('sample');

    result = validator.isWhitelisted('sample', 'abc');
    result = validator.isWhitelisted('sample', ['a', 'b', 'c']);

    result = validator.matches('foobar', 'foo/i');
    result = validator.matches('foobar', 'foo', 'i');

    result = validator.isSlug('cs_67CZ');
}

// **************
// * Sanitizers *
// **************

{
    let result: string;

    result = validator.blacklist('sample', 'abc');

    result = validator.escape('sample');

    result = validator.unescape('sample');

    result = validator.ltrim('sample');
    result = validator.ltrim('sample', ' ');

    const normalizeEmailOptions: validator.NormalizeEmailOptions = {};
    let normalizeResult: string | false;
    normalizeResult = validator.normalizeEmail('sample');
    normalizeResult = validator.normalizeEmail('sample', normalizeEmailOptions);

    result = validator.rtrim('sample');
    result = validator.rtrim('sample', ' ');

    result = validator.stripLow('sample');
    result = validator.stripLow('sample', true);
}

{
    let result: boolean;

    result = validator.toBoolean(any);
    result = validator.toBoolean(any, true);
}

{
    let result: Date | null;

    result = validator.toDate(any);
}

{
    let result: number;

    result = validator.toFloat(any);

    result = validator.toInt(any);
    result = validator.toInt(any, 10);
}

{
    let result: string;

    result = validator.trim('sample');
    result = validator.trim('sample', ' ');

    result = validator.whitelist('sample', 'abc');
}

{
    let str: string;
    str = validator.toString([123, 456, '123', '456', true, false]);
}

{
    let ver: string;
    ver = validator.version;
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title> Action localisation and instance segmentation </title>

    <link href="../css.old.website/bootstrap.min.css" rel="stylesheet">

    <link href="../css.old.website/1-col-portfolio.css" rel="stylesheet">

    <link href="../css.old.website/simple-sidebar.css" rel="stylesheet">

  Home

  Overview

  Related publication

                A Real-Time Monocular Vision-based Frontal Obstacle Detection and Avoidance for Low Cost UAVs

		This paper presents a novel monocular vision-based realtime obstacle detection and avoidance for a low cost
unmanned aerial vehicle (UAV) in an unstructured, GPS denied environment. We propose a mathematical model to estimate the
relative distance from the UAV's camera to an obstacle which will subsequently be used in a collision avoidance algorithm.
We validate our model with some real time experiments under both stationary and dynamic motion of the UAV during its
flight. The results show good agreement with the ground truth values with an acceptable percentage of error in estimation
under 3% thus proving it can facilitate obstacle detection and avoidance for low cost and lightweight UAVs.

 Youtube Video links for obstacle avoidance experiments with Parrot Ar.Drone 2.0:

 UAV's camera calibration and Expanded monocular cues

 UAV's frontal camera calibration video

 Expanded monocular cues/features used for obstacle avoidance task

                Related Publication:

                A real-time monocular vision-based frontal obstacle detection and avoidance for low cost UAVs in GPS denied environment,
                Aerospace Electronics and Remote Sensing Technology (ICARES), 2014 IEEE International Conference on.

                  Suman Saha,
                  Ashutosh Natraj ,
                  Sonia Waharte .

                 code  |
                 video

Overview

             A block diagram representation of the model considered for the mathematical modelling.

                    Webpage designed by  Bootstrap .


text:
namespace sdl
{
     class Texture
     {
     public:
          Texture(SDL_Renderer* renderer,
                  int w = 640, int h = 480) throw (error::InitError);
          ~Texture();

          void update(const SDL_Rect*, const void*, int);

          SDL_Texture* handle() { return texture; }

     private:
          SDL_Texture* texture;
     };
}

#endif


text:
My `dotfiles` inspired by [Mathias Bynens](https://github.com/mathiasbynens/dotfiles)

## Installation

1. Clone this repository
1. Run `./install.sh`
    - This will copy dotfiles to ``
    - Install or update [`n`](https://github.com/tj/n) (node version manager)
    - Install or update [Homebrew](https://brew.sh/index_de)
    - Install the latest node version
    - Install a GMail app (build via [nativefier](https://github.com/jiahaog/nativefier))
1. Run `./brew.sh`

### Specify the `$PATH`

If `~/.path` exists, it will be sourced along with the other files, before any feature testing (such as [detecting which version of `ls` is being used](https://github.com/mathiasbynens/dotfiles/blob/aff769fd75225d8f2e481185a71d5e05b76002dc/.aliases#L21-26)) takes place.

Here's an example `~/.path` file that adds `/usr/local/bin` to the `$PATH`:

```bash
export PATH="/usr/local/bin:$PATH"
```

### Add custom commands without creating a new fork

If `~/.extra` exists, it will be sourced along with the other files. You can use this to add a few custom commands without the need to fork this entire repository, or to add commands you don't want to commit to a public repository.

My `~/.extra` looks something like this:

```bash
# Git credentials
# Not in the repository, to prevent people from accidentally committing under my name
GIT_AUTHOR_NAME="Mathias Bynens"
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
git config --global user.name "$GIT_AUTHOR_NAME"
GIT_AUTHOR_EMAIL="mathias@mailinator.com"
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
git config --global user.email "$GIT_AUTHOR_EMAIL"
```

You could also use `~/.extra` to override settings, functions and aliases from my dotfiles repository. It's probably better to [fork this repository](https://github.com/mathiasbynens/dotfiles/fork) instead, though.

### Sensible OS X defaults

When setting up a new Mac, you may want to set some sensible OS X defaults:

```bash
./.osx
```

### Install Homebrew formulae

When setting up a new Mac, you may want to install some common [Homebrew](http://brew.sh/) formulae (after installing Homebrew, of course):

```bash
./brew.sh
```


text:
#if !defined CASTOR_CONFIG_H
#define CASTOR_CONFIG_H 1

// Defining this turns *lref into unchecked access (i.e. same as lref.get())
//#define LREF_QUICKACCESS

#endif


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**companyName** | **NSString*** |  | [optional]
**ocn** | **NSString*** |  | [optional]
**ocnCategory** | **NSString*** |  | [optional]
**npa** | **NSString*** |  | [optional]
**nxx** | **NSString*** |  | [optional]
**startRange** | **NSString*** |  | [optional]
**endRange** | **NSString*** |  | [optional]
**lata** | **NSString*** |  | [optional]
**areaName4** | **NSString*** |  | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


text:
"""For environment specific extensions."""

import abc
from typing import Optional

from tfx.orchestration.experimental.core import orchestration_options
from tfx.proto.orchestration import pipeline_pb2

_ENV = None

class Env(abc.ABC):
  """Base class for environment specific extensions."""

  def __enter__(self) -> None:
    global _ENV
    self._old_env = _ENV
    _ENV = self

  def __exit__(self, exc_type, exc_val, exc_tb):
    global _ENV
    _ENV = self._old_env

  @abc.abstractmethod
  def get_orchestration_options(
      self, pipeline: pipeline_pb2.Pipeline
  ) -> orchestration_options.OrchestrationOptions:
    """Gets orchestration options for the pipeline."""

  @abc.abstractmethod
  def get_base_dir(self) -> Optional[str]:
    """Returns the base directory for the pipeline."""

  @abc.abstractmethod
  def max_mlmd_str_value_length(self) -> Optional[int]:
    """Returns max size of a string value in MLMD db, `None` if unlimited."""

  @abc.abstractmethod
  def concurrent_pipeline_runs_enabled(self) -> bool:
    """Returns whether concurrent pipeline runs are enabled."""

class _DefaultEnv(Env):
  """Default environment."""

  def get_orchestration_options(
      self, pipeline: pipeline_pb2.Pipeline
  ) -> orchestration_options.OrchestrationOptions:
    del pipeline
    return orchestration_options.OrchestrationOptions()

  def get_base_dir(self) -> Optional[str]:
    return None

  def max_mlmd_str_value_length(self) -> Optional[int]:
    return None

  def concurrent_pipeline_runs_enabled(self) -> bool:
    return False

_ENV = _DefaultEnv()

def get_env() -> Env:
  return _ENV


text:
require 'spec_helper'

describe DataStore do
  let(:instance)    { DataStore.instance }
  let(:original)    { 'bar' }
  let(:transformed) { 'BAR' }

  before(:each) do
    instance.set({
      :id => 'foo',
      :original => original,
      :transformed => transformed
    })
  end

  describe 'set(data)' do
    it 'stores original and transformed data' do
      expect(instance.get('foo')[:original]).to eq(original)
      expect(instance.get('foo')[:transformed]).to eq(transformed)
    end
  end

  describe 'get(id)' do
     it 'returns data object' do
       expect(instance.get('foo')).to be_a Hash
       expect(instance.get('foo').key?(:original)).to be true
       expect(instance.get('foo').key?(:transformed)).to be true
     end
   end

   describe 'reset(id)' do
     it 'replaces the transformed data with original data' do
       instance.reset('foo')
       foo = instance.get('foo')
       expect(foo[:original]).to eq(foo[:transformed])
     end
   end
end


text:
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
 * String.prototype.substring (start, end)
 *
 * @path ch15/15.5/15.5.4/15.5.4.15/S15.5.4.15_A1_T1.js
 * @description Arguments are false and true, and instance is object
 */

var __instance = new Object(true);

__instance.substring = String.prototype.substring;

//////////////////////////////////////////////////////////////////////////////
//CHECK#1
if (__instance.substring(false, true) !== "t") {
  $ERROR('#1: __instance = new Object(true); __instance.substring = String.prototype.substring;  __instance.substring(false, true) === "t". Actual: '+__instance.substring(false, true) );
}
//
//////////////////////////////////////////////////////////////////////////////


text:
#define TEST_DESCRIPTION	"Create and destory surfaces"

#include "test_common.c"

void pre()
{
    test_init();
}

#define DEAD_SURFACE_ID 	(VASurfaceID) 0xbeefdead

void test_unique_surfaces(VASurfaceID *surface_list1, int surface_count1, VASurfaceID *surface_list2, int surface_count2)
{
    int i,j;

    for(i = 0; i < surface_count1; i++)
    {
        for(j = 0; j < surface_count2; j++)
        {
            if ((surface_list1 == surface_list2) && (i == j)) continue;
            ASSERT(surface_list1[i] != VA_INVALID_SURFACE);
            ASSERT(surface_list2[j] != VA_INVALID_SURFACE);
            ASSERT(surface_list1[i] != surface_list2[j]);
        }
    }
}

void test()
{
    VASurfaceID surfaces_1[1+1];
    VASurfaceID surfaces_4[4+1];
    VASurfaceID surfaces_16[16+1];
    VASurfaceID surfaces_6[6+1];

    memset(surfaces_1, 0xff, sizeof(surfaces_1));
    memset(surfaces_4, 0xff, sizeof(surfaces_4));
    memset(surfaces_16, 0xff, sizeof(surfaces_16));
    memset(surfaces_6, 0xff, sizeof(surfaces_6));

    status("vaCreateSurfaces 1 surface\n");
    surfaces_1[1] = DEAD_SURFACE_ID;
    va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 1, surfaces_1);
    ASSERT( VA_STATUS_SUCCESS == va_status );
    ASSERT( DEAD_SURFACE_ID == surfaces_1[1] ); /* bounds check */

    status("vaCreateSurfaces 4 surfaces\n");
    surfaces_4[4] = DEAD_SURFACE_ID;
    va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 4, surfaces_4);
    ASSERT( VA_STATUS_SUCCESS == va_status );
    ASSERT( DEAD_SURFACE_ID == surfaces_4[4] ); /* bounds check */

    status("vaCreateSurfaces 16 surfaces\n");
    surfaces_16[16] = DEAD_SURFACE_ID;
    va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 16, surfaces_16);
    ASSERT( VA_STATUS_SUCCESS == va_status );
    ASSERT( DEAD_SURFACE_ID == surfaces_16[16] ); /* bounds check */

    test_unique_surfaces(surfaces_1, 1, surfaces_4, 4);
    test_unique_surfaces(surfaces_4, 4, surfaces_16, 4);
    test_unique_surfaces(surfaces_4, 4, surfaces_16, 16);
    test_unique_surfaces(surfaces_4, 1, surfaces_16, 16);
    test_unique_surfaces(surfaces_1, 16, surfaces_16, 16);

    status("vaDestroySurface 4 surfaces\n");
    va_status = vaDestroySurfaces(va_dpy, surfaces_4, 4);
    ASSERT( VA_STATUS_SUCCESS == va_status );

    status("vaCreateSurfaces 6 surfaces\n");
    surfaces_6[6] = DEAD_SURFACE_ID;
    va_status = vaCreateSurfaces(va_dpy, 352, 288, VA_RT_FORMAT_YUV420, 6, surfaces_6);
    ASSERT( VA_STATUS_SUCCESS == va_status );
    ASSERT( DEAD_SURFACE_ID == surfaces_6[6] ); /* bounds check */

    test_unique_surfaces(surfaces_1, 1, surfaces_6, 6);
    test_unique_surfaces(surfaces_6, 6, surfaces_16, 16);
    test_unique_surfaces(surfaces_1, 6, surfaces_16, 6);

    status("vaDestroySurface 16 surfaces\n");
    va_status = vaDestroySurfaces(va_dpy, surfaces_16, 16);
    ASSERT( VA_STATUS_SUCCESS == va_status );

    status("vaDestroySurface 1 surface\n");
    va_status = vaDestroySurfaces(va_dpy, surfaces_1, 1);
    ASSERT( VA_STATUS_SUCCESS == va_status );

    status("vaDestroySurface 6 surfaces\n");
    va_status = vaDestroySurfaces(va_dpy, surfaces_6, 6);
    ASSERT( VA_STATUS_SUCCESS == va_status );
}

void post()
{
    test_terminate();
}


text:
This is a wrapper around the [PLDA](https://code.google.com/p/plda/) Latent Dirichlet Allocation toolkit. It is currently a work-in-progress.

Example usage:

```
BPBLDAModel *plda = [[BPBLDAModel alloc] init];

//foreach document with *uuid and *paragraph
{
  BPBBagOfWords *bow = [[BPBBagOfWords alloc] init];
  for(NSString *paragraph in paragraphs){
    //this stems and removes stop words, so don't
    //worry about that
    [bow addText:str];
  }
  //we can do this part multithreaded, as this method should be reentrant:
  [plda addBagToCorpus:bow withTag:uuid inferenceOnly:NO];
}

//Learn from the model:

plda.numTopics=6;
plda.burnin=110;
plda.iterations=150;
//this is slow, don't do it on the main thread:
[plda learn];

//Infer topics

plda.burnin=30;
plda.iterations=60;
NSArray *uuids = [plda corpusTags];
//this is slow, don't do it on the main thread
NSArray *topics = [plda topicProbs];

/*
Topics contains one array for each document.
Each array contains plda.numTopics double values.
Each value is the expected number of words generated
by each topic. The total of these values should be
equal to the number of words in each document (minus the
stop words).
*/

//Get the most informative five (stemmed) words for topic i:

[plda toptags:5 forTopic:i];

```


text:
package bbb

import (
	"time"
)

type Recording struct {
	RecordId  string
	MeetingId string
	Name      string
	Published bool
	StartTime time.Time
	EndTime   time.Time
	Metadata  map[string]interface{}
	Playback  struct {
		Type string
		Url  string
		Len  int
	}
}


text:
<?php

namespace AppBundle\Controller;

use AppBundle\Entity\Patologia;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;

/**
 * Patologium controller.
 *
 * @Route("patologia")
 */
class PatologiaController extends Controller {

    /**
     * Lists all patologium entities.
     *
     * @Route("/", name="patologia_index")
     * @Method("GET")
     */
    public function indexAction() {
        $em = $this->getDoctrine()->getManager();

        $patologias = $em->getRepository('AppBundle:Patologia')->findAll();

        return $this->render('patologia/index.html.twig', array(
                    'patologias' => $patologias,
        ));
    }

    /**
     * Creates a new patologium entity.
     *
     * @Route("/new", name="patologia_new")
     * @Method({"GET", "POST"})
     */
    public function newAction(Request $request) {
        $em = $this->getDoctrine()->getManager();
        $patologium = new Patologia();
        $form = $this->createForm('AppBundle\Form\PatologiaType', $patologium);
        $form->handleRequest($request);
        $paciente = $em->getRepository('AppBundle:Paciente')->find($request->request->get('ii_paciente'));
        $patologium->setPaciente($paciente);

        if ($form->isSubmitted() && $form->isValid()) {

            $patologium->setFechaRegistro(new \DateTime("now"));
            $em->persist($patologium);
            $em->flush($patologium);

            return $this->redirectToRoute('homepage_consulta', array(
                        'paciente' => $patologium->getPaciente()->getId(),
            ));
        }

        return $this->render('patologia/new.html.twig', array(
                    'patologium' => $patologium,
                    'form' => $form->createView(),
                    'ii_paciente' => $request->get('ii_paciente')
        ));
    }

    /**
     * Finds and displays a patologium entity.
     *
     * @Route("/{id}", name="patologia_show")
     * @Method("GET")
     */
    public function showAction(Patologia $patologium) {
        $deleteForm = $this->createDeleteForm($patologium);

        return $this->render('patologia/show.html.twig', array(
                    'patologium' => $patologium,
                    'delete_form' => $deleteForm->createView(),
        ));
    }

    /**
     * Displays a form to edit an existing patologium entity.
     *
     * @Route("/{id}/edit", name="patologia_edit")
     * @Method({"GET", "POST"})
     */
    public function editAction(Request $request, Patologia $patologium) {
        $deleteForm = $this->createDeleteForm($patologium);
        $editForm = $this->createForm('AppBundle\Form\PatologiaType', $patologium);
        $editForm->handleRequest($request);

        if ($editForm->isSubmitted() && $editForm->isValid()) {
            $patologium->setFechaActualizacion(new \DateTime("now"));
            $this->getDoctrine()->getManager()->flush();
            $this->addFlash('success', 'Datos actualizados satisfactoriamente');

            return $this->redirectToRoute('homepage_consulta', array(
                        'paciente' => $patologium->getPaciente()->getId(),
            ));
        }

        return $this->render('patologia/edit.html.twig', array(
                    'patologium' => $patologium,
                    'edit_form' => $editForm->createView(),
                    'delete_form' => $deleteForm->createView(),
        ));
    }

    /**
     * Deletes a patologium entity.
     *
     * @Route("/{id}", name="patologia_delete")
     * @Method("DELETE")
     */
    public function deleteAction(Request $request, Patologia $patologium) {
        $form = $this->createDeleteForm($patologium);
        $form->handleRequest($request);
        $paciente = $patologium->getPaciente()->getId();

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $id = $patologium->getPaciente()->getId();
            $em->remove($patologium);
            $em->flush($patologium);
        }

        return $this->redirectToRoute('homepage_consulta', array(
                    'paciente' => $id,
        ));
    }

    /**
     * Creates a form to delete a patologium entity.
     *
     * @param Patologia $patologium The patologium entity
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createDeleteForm(Patologia $patologium) {
        return $this->createFormBuilder()
                        ->setAction($this->generateUrl('patologia_delete', array('id' => $patologium->getId())))
                        ->setMethod('DELETE')
                        ->getForm()
        ;
    }

}


text:
require "test_helper"

module Events
  # :stopdoc:
  class ResultsTest < ActiveSupport::TestCase
    test "find all with results" do
      event = FactoryBot.create(:result).event
      assert_equal([event], Event.find_all_with_results, "events")
    end

    test "find all with results with year" do
      event_with_results = FactoryBot.create(:event, date: Date.new(2003))
      race = FactoryBot.create(:race, event: event_with_results)
      FactoryBot.create(:result, race: race)

      # Event and race + event with no results
      FactoryBot.create(:event, date: Date.new(2003))
      FactoryBot.create(:race)

      # Calculation event results
      event = FactoryBot.create(:event, date: Date.new(2003), type: "Event")
      race = FactoryBot.create(:race, event: event)
      FactoryBot.create(:result, race: race, competition_result: true)
      FactoryBot.create(:result, race: race, team_competition_result: true)

      assert_equal([event_with_results], Event.find_all_with_results(2003), "events")

      event_with_results = FactoryBot.create(:event, date: Date.new(2004))
      race = FactoryBot.create(:race, event: event_with_results)
      FactoryBot.create(:result, race: race)

      weekly_series_with_results = FactoryBot.create(:weekly_series, date: Date.new(2004))
      series_event = weekly_series_with_results.children.create!
      race = FactoryBot.create(:race, event: series_event)
      FactoryBot.create(:result, race: race)

      events = Event.find_all_with_results(2004)
      assert_equal_events([event_with_results, weekly_series_with_results].sort, events.sort, "events")

      assert_equal([], Event.find_all_with_results(2005), "events")
    end

    test "find all with results with discipline" do
      FactoryBot.create(:discipline, name: "Road")
      FactoryBot.create(:discipline, name: "Circuit")
      FactoryBot.create(:discipline, name: "Criterium")
      FactoryBot.create(:discipline, name: "Track")

      event_with_results = FactoryBot.create(:event, date: Date.new(2003))
      race = FactoryBot.create(:race, event: event_with_results)
      FactoryBot.create(:result, race: race)

      assert_equal([event_with_results], Event.find_all_with_results(2003, Discipline["Road"]), "events")

      assert_equal([], Event.find_all_with_results(2003, Discipline["Criterium"]), "events")

      circuit_race = FactoryBot.create(:event, discipline: "Circuit")
      category = FactoryBot.create(:category)
      circuit_race.races.create!(category: category).results.create!

      track_event = FactoryBot.create(:event, discipline: "Track")
      track_event.races.create!(category: category).results.create!

      track_series = WeeklySeries.create!(discipline: "Track")
      track_series_event = track_series.children.create!
      track_series_event.races.create!(category: category).results.create!

      assert_equal([circuit_race], Event.find_all_with_results(Time.zone.today.year, Discipline["Road"]), "events")

      events = Event.find_all_with_results(Time.zone.today.year, Discipline["Track"])
      assert_equal([track_event, track_series].sort, events.sort, "events")
    end

    test "find all with only child event results" do
      series = WeeklySeries.create!
      series_event = series.children.create!
      child_event = series_event.children.create!
      child_event.races.create!(category: FactoryBot.create(:category)).results.create!

      assert(child_event.is_a?(Event), "Child event should be an Event")
      assert_not(child_event.is_a?(SingleDayEvent), "Child event should not be an SingleDayEvent")

      assert_equal([series], Event.find_all_with_results, "weekly_series")
    end

    test "has results" do
      assert_not(Event.new.any_results?, "New Event should not have results")

      event = SingleDayEvent.create!
      race = event.races.create!(category: FactoryBot.create(:category))
      assert_not(event.any_results?, "Event with race, but no results should not have results")

      race.results.create!(place: 200, person: FactoryBot.create(:person))
      assert(event.any_results?, "Event with one result should have results")
    end

    test "races with results" do
      bb3 = FactoryBot.create(:event)
      assert(bb3.races_with_results.empty?, "No races")

      sr_p_1_2 = FactoryBot.create(:category)
      bb3.races.create!(category: sr_p_1_2)
      assert(bb3.races_with_results.empty?, "No results")

      senior_women = FactoryBot.create(:category)
      race_1 = bb3.races.create!(category: senior_women)
      race_1.results.create!
      assert_equal([race_1], bb3.races_with_results, "One results")

      race_2 = bb3.races.create!(category: sr_p_1_2)
      race_2.results.create!
      women_4 = FactoryBot.create(:category)
      bb3.races.create!(category: women_4)
      assert_same_elements [race_2, race_1], bb3.races_with_results, "Two races with results"
    end

    test "children with results" do
      event = SingleDayEvent.create!
      assert_equal(0, event.children_with_results.size, "events_with_results: no child")
      assert_equal(0, event.children_with_results.size, "children_with_results: no child")

      event.children.create!
      assert_equal(0, event.children_with_results.size, "events_with_results: child with no results")
      assert_equal(0, event.children_with_results.size, "children_with_results: child with no results")

      category = FactoryBot.create(:category)
      event.children.create!.races.create!(category: category).results.create!
      assert_equal(1, event.children_with_results.size, "cached: events_with_results: 1 children with results")
      assert_equal(1, event.children_with_results.size, "refresh cache: events_with_results: 1 children with results")
      assert_equal(1, event.children_with_results.size, "refresh cache: children_with_results: 1 children with results")

      event.children.create!.races.create!(category: category).results.create!
      assert_equal(2, event.children_with_results.size, "refresh cache: events_with_results: 2 children with results")
      assert_equal(2, event.children_with_results.size, "refresh cache: children_with_results: 2 children with results")
    end

    test "children with results only child events" do
      series_event = FactoryBot.create(:series_event)
      child_event = series_event.children.create!
      FactoryBot.create(:result, race: FactoryBot.create(:race, event: child_event))
      series = Event.find(series_event.parent_id)

      assert_equal(1, series.children_with_results.size, "Should have child with results")
      assert_equal(series_event, series.children_with_results.first, "Should have child with results")
      assert_equal(1, series_event.children_with_results.size, "Should have child with results")
      assert_equal(child_event, series_event.children_with_results.first, "Should have child with results")
    end

    test "has results including children" do
      series_event = FactoryBot.create(:weekly_series_event)
      child_event = series_event.children.create!
      FactoryBot.create(:result, race: FactoryBot.create(:race, event: child_event))
      series = Event.find(series_event.parent_id)

      assert(series.any_results_including_children?, "Series any_results_including_children?")
      assert(series_event.any_results_including_children?, "Series Event any_results_including_children?")
      assert(child_event.any_results_including_children?, "Series Event child any_results_including_children?")
    end

    test "results_updated_at" do
      event = FactoryBot.create(:event)
      assert_nil event.results_updated_at, "results_updated_at with no results"

      result = nil
      travel_to 1.day.ago do
        result = FactoryBot.create(:result)
      end
      assert_equal result.reload.updated_at, result.event.results_updated_at, "results_updated_at should use result updated_at"
    end
  end
end


text:
import * as babylon from "babylon";
import traverse, {Visitor} from 'babel-traverse';
import * as t from 'babel-types';

// Examples from: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md
const MyVisitor: Visitor = {
    Identifier: {
        enter() {
            console.log("Entered!");
        },
        exit() {
            console.log("Exited!");
        }
    }
};

const MyVisitor2: Visitor = {
    Identifier(path) {
        console.log("Visiting: " + path.node.name);
    }
};

// Example from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-traverse
const code = `function square(n) {
    return n * n;
}`;

const ast = babylon.parse(code);

traverse(ast, {
    enter(path) {
        let node = path.node;
        if (t.isIdentifier(node) && node.name === "n") {
            node.name = "x";
        }
    }
});

// Examples from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#writing-your-first-babel-plugin

const v1: Visitor = {

    BinaryExpression(path) {
        if (t.isIdentifier(path.node.left)) {
            // ...
        }
        path.replaceWith(
            t.binaryExpression("**", path.node.left, t.numericLiteral(2))
        );
        path.parentPath.replaceWith(
            t.expressionStatement(t.stringLiteral("Anyway the wind blows, doesn't really matter to me, to me."))
        );
        path.parentPath.remove();
    },

    Identifier(path) {
        if (path.isReferencedIdentifier()) {
            // ...
        }
        if (t.isReferenced(path.node, path.parent)) {
            // ...
        }
    },

    ReturnStatement(path) {
        path.replaceWithMultiple([
            t.expressionStatement(t.stringLiteral("Is this the real life?")),
            t.expressionStatement(t.stringLiteral("Is this just fantasy?")),
            t.expressionStatement(t.stringLiteral("(Enjoy singing the rest of the song in your head)")),
        ]);
    },

    FunctionDeclaration(path, state) {
        path.replaceWithSourceString(`function add(a, b) {
            return a + b;
        }`);

        path.insertBefore(t.expressionStatement(t.stringLiteral("Because I'm easy come, easy go.")));
        path.insertAfter(t.expressionStatement(t.stringLiteral("A little high, little low.")));
        path.remove();

        if (path.scope.hasBinding("n")) {
            // ...
        }
        if (path.scope.hasOwnBinding("n")) {
            // ...
        }

        let id1 = path.scope.generateUidIdentifier("uid");
        id1.type;
        id1.name;
        let id2 = path.scope.generateUidIdentifier("uid");
        id2.type;
        id2.name;

        const id = path.scope.generateUidIdentifierBasedOnNode(path.node.id);
        path.remove();
        path.scope.parent.push({ id, init: path.node });

        path.scope.rename("n", "x");
        path.scope.rename("n");
    }
};

// Binding.kind
const BindingKindTest: Visitor  = {
    Identifier(path) {
        const kind = path.scope.getBinding("str").kind;
        kind === 'module';
        kind === 'const';
        kind === 'let';
        kind === 'var';
        // The following should fail when uncommented
        // kind === 'anythingElse';
    },
};

// https://github.com/babel/babel/blob/d33d02359474296402b1577ef53f20d94e9085c4/packages/babel-plugin-transform-es2015-block-scoping/test/fixtures/exec/scope-bindings.js#L15-L25
const vScope: Visitor = {
    Scope: {
        enter(path) {
            console.log(`Entering scope: ${path.node.type}`);
        },
        exit(path) {
            console.log(`Exiting scope: ${path.node.type}`);
        }
    }
};


text:
// Copyright © 2008, 2013, Oracle and/or its affiliates. All rights reserved.
//
// MySQL Connector/NET is licensed under the terms of the GPLv2
// <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
// MySQL Connectors. There are special exceptions to the terms and
// conditions of the GPLv2 as it is applied to this software, see the
// FLOSS License Exception
// <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
//
// 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; version 2 of the License.
//
// 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.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA

using System;
using System.Data.Common;
using System.Data;
using MySql.Data.MySqlClient;
#if EF6
using System.Data.Entity.Core.Metadata.Edm;
#else
using System.Data.Metadata.Edm;
#endif
#if NET_40_OR_GREATER
using System.Threading.Tasks;
#endif

namespace MySql.Data.Entity
{
  class EFMySqlCommand : DbCommand, ICloneable
  {
    private bool designTimeVisible = true;
    private DbConnection connection;
    private MySqlCommand command = new MySqlCommand();

    internal PrimitiveType[] ColumnTypes;

    #region Properties

    public override string CommandText
    {
      get { return command.CommandText; }
      set { command.CommandText = value; }
    }

    public override int CommandTimeout
    {
      get { return command.CommandTimeout; }
      set { command.CommandTimeout = value; }
    }

    public override CommandType CommandType
    {
      get { return command.CommandType; }
      set { command.CommandType = value; }
    }

    public override bool DesignTimeVisible
    {
      get { return designTimeVisible; }
      set { designTimeVisible = value; }
    }

    protected override DbConnection DbConnection
    {
      get { return connection; }
      set
      {
        connection = value;
        command.Connection = (MySqlConnection)value;
        MySqlConnection _con = (MySqlConnection)connection;
        if (_con.Settings.UseDefaultCommandTimeoutForEF)
        {
          command.CommandTimeout = (int)(_con.Settings.DefaultCommandTimeout);
        }
      }
    }

    protected override DbTransaction DbTransaction
    {
      get { return command.Transaction; }
      set { command.Transaction = (MySqlTransaction)value; }
    }

    protected override DbParameterCollection DbParameterCollection
    {
      get { return command.Parameters; }
    }

    public override UpdateRowSource UpdatedRowSource
    {
      get { return command.UpdatedRowSource; }
      set { command.UpdatedRowSource = value; }
    }

    #endregion

    public override void Cancel()
    {
      command.Cancel();
    }

    protected override DbParameter CreateDbParameter()
    {
      return new MySqlParameter();
    }

    protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
    {
      return new EFMySqlDataReader(this, command.ExecuteReader(behavior));
    }

    public override int ExecuteNonQuery()
    {
      return command.ExecuteNonQuery();
    }

    public override object ExecuteScalar()
    {
      return command.ExecuteScalar();
    }

    public override void Prepare()
    {
      command.Prepare();
    }

    #region ICloneable Members

    public object Clone()
    {
      EFMySqlCommand clone = new EFMySqlCommand();

      clone.connection = connection;
      clone.ColumnTypes = ColumnTypes;
      clone.command = (MySqlCommand)((ICloneable)command).Clone();

      return clone;
    }

    #endregion

#if NET_40_OR_GREATER
#region Async
    /// <summary>
    /// Async version of ExecuteNonQuery
    /// </summary>
    /// <returns>Affected rows.</returns>
    public Task<int> ExecuteNonQueryAsync()
    {
      return Task.Factory.StartNew(() =>
      {
        return ExecuteNonQuery();
      });
    }

    /// <summary>
    /// Async version of ExecuteScalar
    /// </summary>
    /// <returns>Value of the firs row in the first column.</returns>
    public Task<object> ExecuteScalarAsync()
    {
      return Task.Factory.StartNew(() =>
      {
        return ExecuteScalar();
      });
    }

    /// <summary>
    /// Async version of Prepare
    /// </summary>
    /// <returns>Information about the task executed.</returns>
    public Task PrepareAsync()
    {
      return Task.Factory.StartNew(() =>
      {
        Prepare();
      });
    }
    #endregion
#endif

  }
}


text:
package org.drools.karaf.itest;

import org.apache.karaf.features.FeaturesService;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.OptionUtils;
import org.ops4j.pax.exam.junit.PaxExamParameterized;
import org.ops4j.pax.exam.karaf.options.LogLevelOption;
import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
import org.ops4j.pax.exam.spi.reactors.PerMethod;

import javax.inject.Inject;
import java.util.Arrays;
import java.util.List;

import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.*;

/**
 * Serves as a quick smoke test to verify that all the supported KIE features can be successfully installed.
 */
@RunWith(PaxExamParameterized.class)
@ExamReactorStrategy(PerMethod.class)
public class InstallFeaturesKarafIntegrationTest extends AbstractKarafIntegrationTest {

    private String featureName;

    @Inject
    protected FeaturesService featuresService;

    public InstallFeaturesKarafIntegrationTest(String featureName) {
        this.featureName = featureName;
    }

    @Parameterized.Parameters(name = "{index}: {0}")
    public static List<Object[]> getParameters() {
        return Arrays.asList(new Object[][]{
                {"drools-common"},
                {"drools-module"},
                //{"drools-templates"}, // TODO: feature install fails, needs to be investigated
                {"drools-decisiontable"},
                {"drools-wb-guided-decisiontables"},
                {"drools-jpa"},
                //{"kie"}, // TODO: feature install fails, needs to be investigated
                //{"kie-ci"}, // TODO: feature install fails, needs to be investigated
                {"kie-spring"},
                {"kie-aries-blueprint"},
                {"jbpm-commons"},
                //{"jbpm-human-task"}, // TODO: feature install fails, needs to be investigated
                {"jbpm"},
                {"jbpm-spring-persistent"},
                //{"droolsjbpm-hibernate"}, // TODO: feature install fails, needs to be investigated
                {"hibernate-validator"},
                //{"h2"}
        });
    }

    @Configuration
    public static Option[] configure() {
        return new Option[]{
                // Install Karaf Container
                getKarafDistributionOption(),

                // It is really nice if the container sticks around after the test so you can check the contents
                // of the data directory when things go wrong.
                keepRuntimeFolder(),
                // Don't bother with local console output as it just ends up cluttering the logs
                configureConsole().ignoreLocalConsole(),
                // Force the log level to INFO so we have more details during the test.  It defaults to WARN.
                logLevel(LogLevelOption.LogLevel.INFO),

                loadKieFeaturesRepo()
                // Option to be used to do remote debugging
                //  debugConfiguration("5005", true),
        };
    }

    @Test
    public void testInstallFeature() throws Exception {
        featuresService.installFeature(featureName);
        Assert.assertTrue("Feature " + featureName + " not installed!",
                featuresService.isInstalled(featuresService.getFeature(featureName)));
    }

}


text:
import sys
from logger import Logger

def run_modules():
    import conf.scans

    # Running Module Scans
    count = {'mods': 0, 'scans': 0, 'failed_scans': 0}
    for mod in conf.scans.enabled_modules:
        klass = mod['class']
        servers = mod.get('servers', [None])
        params = mod.get('params')
        for server in servers:
            try:
                mod_instance = klass(server=server, params=params)
                mod_instance.run()
            except Exception as e:
                print >> sys.stderr, str(e)
                count['failed_scans'] += 1
            count['scans'] += 1
        count['mods'] += 1
    print('Run Summary: {mods} modules, {scans} total scans, {failed_scans} failed.'.format(**count))

    # closing log files
    Logger.get().close_all()

if __name__ == '__main__':
    run_modules()


text:
<?php

namespace Atlassian\JiraWebhook\Events\Worklog;

/**
 * Class Updated
 * @package Atlassian\JiraWebhook\Events\Worklog
 */
class Updated extends WorklogEvent
{

}


text:
export @byrow!

##############################################################################
##
## @byrow!
##
##############################################################################

# Recursive function that traverses the syntax tree of e, replaces instances of
# ":(:(x))" with ":x[row]".
function byrow_replace(e::Expr)
    # target is the Expr that is built to replace ":(:(x))"
    target = Expr(:ref)

    # Traverse the syntax tree of e
    if e.head != :quote
        return Expr(e.head, (isempty(e.args) ? e.args : map(x -> byrow_replace(x), e.args))...)
    else
        push!(target.args, e, :row)
        return target
    end
end

# Set the base case for helper, i.e. for when expand hits an object of type
# other than Expr (generally a Symbol or a literal).
byrow_replace(x) = x

function byrow_find_newcols(e::Expr, newcol_decl)
    if e.head == :macrocall && e.args[1] == Symbol("@newcol")
        ea = e.args[2]
        # expression to assign a new column to df
        return (nothing, Any[Expr(:kw, ea.args[1], Expr(:call, ea.args[2].args[1], ea.args[2].args[2], :_N))])
    else
        if isempty(e.args)
            return (e.args, Any[])
        end
        newargs = Any[]
        for ea in e.args
            (nea, newcol) = byrow_find_newcols(ea, newcol_decl)
            nea != nothing && push!(newargs, nea)
            nea == nothing && length(newcol) > 0 && append!(newcol_decl, newcol)
        end
        return (Expr(e.head, newargs...), newcol_decl)
    end
end

byrow_find_newcols(x, newcol_decl) = (x, Any[])

function byrow_helper(df, body)
    (e_body, e_newcols) = byrow_find_newcols(body, Any[])
    e_delimiters = Expr(:(=), :row, :( 1:_N ))
    e_forloop = Expr(:for, e_delimiters, byrow_replace(e_body))
    return quote
        _N = length($df[1])
        _DF = @transform($df, $(e_newcols...))
        @with _DF $e_forloop
        _DF
    end
end

"""
```julia
@byrow!(d, expr)
```

Act on a DataFrame row-by-row.

Includes support for control flow and `begin end` blocks. Since the
"environment" induced by `@byrow! df` is implicitly a single row of `df`,
use regular operators and comparisons instead of their elementwise counterparts
as in `@with`. Note that the scope within `@byrow!` is a hard scope.

`byrow!` also supports special syntax for allocating new columns. The syntax
`@newcol x::Array{Int}` allocates a new column `:x` with an `Array` container
with eltype `Int`. Note that the returned `AbstractDataFrame` includes these new
columns, but the original `d` is not affected. This feature makes it easier to
use `byrow!` for data transformations.

### Arguments

* `d` : an `AbstractDataFrame`
* `expr` : expression operated on row by row

### Returns

The modified `AbstractDataFrame`.

### Examples

```julia
df = DataFrame(A = 1:3, B = [2, 1, 2])
let x = 0
    @byrow!(df, if :A + :B == 3; x += 1 end)  #  This doesn't work without the let
    x
end
@byrow! df if :A > :B; :A = 0 end
df2 = @byrow! df begin
    @newcol colX::Array{Float64}
    :colX = :B == 2 ? pi * :A : :B
end
```

"""
macro byrow!(df, body)
    esc(byrow_helper(df, body))
end


text:
import { Component, OnInit, AfterViewInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { User, LayoutService, AuthenticationService } from '../../core';
import { AppConfig } from '../../app-config';
import { ConfigService } from '../../app-config.service';
declare const moment: any;

@Component({
    moduleId: module.id,
    selector: 'bhmc-sidebar',
    templateUrl: 'sidebar.component.html',
    styleUrls: ['sidebar.component.css']
})

export class SidebarComponent implements OnInit, AfterViewInit {

    public user: User;
    public isOpen: boolean;
    public adminUrl: string;
    public currentMonth: any;
    public config: AppConfig;

    constructor(
        private _router: Router,
        private _route: ActivatedRoute,
        private _layoutService: LayoutService,
        private _authService: AuthenticationService,
        private configService: ConfigService
    ) {
        this.config = configService.config;
    }

    ngOnInit(): void {
        this.adminUrl = this.config.adminUrl;
        this._layoutService.sidebarToggle.subscribe(value => this.isOpen = value);
        this._authService.currentUser$.subscribe(user => {
            this.user = user;
        });
        let today = moment();
        this.currentMonth = {
            year: today.year(),
            month: today.format('MMMM').toLowerCase()
        };
    }

    ngAfterViewInit(): void {
        // no-op-for-now
    }

    close(): void {
        this._layoutService.closeSidebar();
    }

    isCurrentRoute(parent: string): boolean {
        if (this._route && this._route.parent) {
            return this._route.parent.toString() === parent;
        }
        return false;
    }

    logout(): void {
        this.close();
        this._authService.logout().then( () => {
            this._router.navigate(['/']);
        });
    }
}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
  File: README

    — Documentation by YARD 0.9.8

</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />

    Index »
    File: README

        <svg width="24" height="24">
          <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
          <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
        </svg>

Faceauth

Faceauth gem is a simple plugin which allows users to sign into any rails
based web application using their face. Primarily supporting devise
authentication system (Please refer Devise gem), this gem
uses FindFace Cloud API to run the
matches & authenticate users. This is implemented from thought process
of finding new ways of authenticating users eliminating need for users to
remember so many passwords for various web applications they interact with.

Installation

Add this line to your application's Gemfile:

gem 'faceauth'

And then execute: bash $ bundle

Or install it yourself as: bash $ gem install faceauth

Next, you need to run the generator: bash $ rails generate
faceauth:install

Embedding in a Rails app

Add the following to your routes.rb file:

mount Faceauth::Engine, at: "/"

(Note: You may mount the server at any path, not just at
"/")

Add two columns using migration to your devise user model in rails
application. Example for column names: user_picture, last_sign_in_picture

And run migrations:

$ rake db:migrate

Generate devise views: (Assumption that you are already using devise gem
for authentication platform in your rails application)

rails generate devise:views

add the following in devise/shared/_links.html.erb file.

<%= link_to "Log in using your face", faceauth.new_session_path %><br />

(Note: Ensure to setup process of recording user picture
during signup process and store details in :user_picture column.)

Next, setup the configuration:

Open your initializers file at config/initializers/faceauth.rb where you
can configure settings for faceauth as follows:

Faceauth.configuration do |config|
  config.model_name = "user"
  config.uploader_name = "carrierwave"
  config.redirect_url = "root_path"
  config.findface_api_key = "YOUR_API_KEY"
  config.signup_picture_column = "user_picture"
  config.signin_picture_column = "last_sign_in_picture"
  config.email_column = "email"
end

The options available are:

| Option | Description | Default Values | | —————– | ——————————- |
——————————– | | model_name | String to set devise user model .
| "user" | | uploader_name | String to define attachments
plugin used to store images. | "carrierwave" or "paperclip" | |
redirect_url | String to provide location details for taking
user after successful authentication. | "root_path" | |
findface_api_key | String to set Findface API Key. | "Findface
API key" | | email_column | set column name where user email
is stored | "email" | | signup_picture_column | set column
name where user picture is stored | "user_picture" | |
signin_picture_column | set column name where user picture is
stored recorded from faceauth sign in page | "last_sign_in_picture" |

Ensure you have set 'findface_api_key' and 'redirect_url'
in config/initializers/faceauth.rb

config.findface_api_key = "YOUR_API_KEY"
config.redirect_url = "root_path" #By default, the option takes root_path of your rails application.

If you wish to pass your custom model name & column names, please set
the names using

config.model_name = "your_model_name"
config.signup_picture_column = "custom_column_name"
config.signin_picture_column = "custom_column_name"

Start using the gem 🙂

Note:

In development environment please use ngrok with https protocol. As per the
security standards & protocols access to microphones & webcames are
allowed only through secure channel.

Customization

We built Faceuth to help you quickly integrate contact form in your
application. However, we don't want to be in your way when you need to
customize it.

Since Faceauth is an Rails engine, all its views are packaged inside the
gem. These views will help you get started, but after some time you may
want to change them. If this is the case, you just need to invoke the
following generator, and it will copy all views to your application:

$ rails generate faceauth:views

If you would like to generate only a few sets of views, like the ones for
the form you can pass a list of names to the generator with
the -v flag.

$ rails generate faceuath:views -v form

Todos

Extending this functionality for other authentication plugins.

Support for ruby versions < 2.2.2 .

Writing Test cases.

Making signin process faster. i.e. The response time of Jpeg_camera gem we
use to capture picture is slow. Need to make it faster such that it
improves overall user experience.

User will be able to login by showing a hardcopy of photo instead of
showing his face to webcam which allows successful authentication. Need to
explore on this to avoid this scneario to make it more efficient and
authentic.

Need to check system behaviour in assuming Twins in users base and find
fixes for any issues observed.

Adding security question system will eliminate the use cases 5 & 6
after immediate positive verification, however this addition should not
hammer user experience. Need to design very intutive & flexible user
sign in flow.

Contributing

Bug reports and pull requests are welcome on GitHub at github.com/[USERNAME]/faceauth.
This project is intended to be a safe, welcoming space for collaboration,
and contributors are expected to adhere to the Contributor Covenant code of
conduct.

Please ensure to follow the following steps as standard practice to
contribute:

Fork it ( github.com/rubyeffect/faceauth/fork
)

Create your feature branch (git checkout -b my-new-feature)

Commit your changes (git commit -am 'Add some feature')

Push to the branch (git push origin my-new-feature)

Create a new Pull Request

License

The gem is available as open source under the terms of the MIT License.

Authored by

Sandeep Mallela a.k.a Sam (sandeep@rubyeffect.com)

Contributions:

Venkatesh Vasamasetti (venkatesh@rubyeffect.com)

About RubyEffect

RubyEffect builds intuitive, live and elegant software that solves real
world problems. We love open source and it's community.

Liked this gem? You may also like the articles we post on our blog. Please do check.

We would love to work on your ideas and see them grow. Say hello @ rubyeffect.com/contact

  Generated on Wed Mar 22 11:54:36 2017 by
  yard
  0.9.8 (ruby-2.4.0).


text:
using System.Collections.Generic;
using Newtonsoft.Json;
namespace IBM.WatsonDeveloperCloud.VisualRecognition.v3.Model
{
    /// <summary>
    /// Success
    /// </summary>
    public class CollectionsConfig
    {
        /// <summary>
        /// Gets or Sets Images
        /// </summary>
        [JsonProperty("images")]
        public List<CollectionImagesConfig> Images { get; set; }
        /// <summary>
        /// The number of images processed in this call.
        /// </summary>
        /// <value>The number of images processed in this call.</value>
        [JsonProperty("images_processed")]
        public int ImagesProcessed { get; set; }
    }
}


text:
"""Global options for restclient."""

AUTH_PRINCIPAL = 'HTTP'


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.proydesa.jee.integrator.helper;

/**
 *
 * @author asalazar
 */
public class DoubleHelper {

    public static Double tryParse(String rawValue) {
        if (StringHelper.isBlank(rawValue))
        {
            // No Parseable.
            return null;
        }

        try {
            // Try to parse.
            return Double.parseDouble(rawValue);
        }
        catch (NumberFormatException ex) {
            // No Parseable.
            return null;
        }
    }
}


text:
tabbedbrowser_show_submenu = function(id) {
	var el = $('tabbedbrowser_'+id+'_popup');
	el.style.display="";
	el.clonePosition("tabbed_browser_submenu_"+id,{setWidth:false,setHeight:false,offsetTop:$("tabbed_browser_submenu_"+id).getHeight()-1});
}

tabbedbrowser_hide_submenu = function(id) {
	var el = $('tabbedbrowser_'+id+'_popup');
	el.style.display="none";
}