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

using NtApiDotNet;
using System;
using System.Management.Automation;

namespace NtObjectManager.Cmdlets.Object
{
    ///
    /// <para type="synopsis">Get the object ID for a file.</para>
    /// <para type="description">This cmdlet gets the object ID for a file.</para>
    ///
    /// <example>
    ///   Get-NtFileObjectId -File $f
    ///   <para>Get the object ID for the file.</para>
    /// </example>
    /// <example>
    ///   Get-NtFileObjectId -Path "\??\c:\windows\notepad.exe"
    ///   <para>Get the object ID for the file by path</para>
    /// </example>
    /// <example>
    ///   Get-NtFileObjectId -Path "c:\windows\notepad.exe" -Win32Path
    ///   <para>Get the object ID for the file by win32 path</para>
    /// </example>
    [Cmdlet(VerbsCommon.Get, "NtFileObjectId", DefaultParameterSetName = "Default")]
    [OutputType(typeof(Guid), typeof(FileObjectIdBuffer))]
    public class GetNtFileObjectIdCmdlet : BaseNtFilePropertyCmdlet
    {
        ///
        /// <para type="description">Specify to get extended object ID information.</para>
        ///
        [Parameter]
        public SwitchParameter ExtendedInformation { get; set; }

        ///
        /// <para type="description">Specify to create the object ID if it doesn't already exist.</para>
        ///
        [Parameter]
        public SwitchParameter Create { get; set; }

        ///
        /// Constructor.
        ///
        public GetNtFileObjectIdCmdlet()
            : base(FileAccessRights.Synchronize, FileShareMode.None, FileOpenOptions.None)
        {
        }

        private protected override void HandleFile(NtFile file)
        {
            var objid = Create ? file.CreateOrGetObjectId() : file.GetObjectId();
            if (ExtendedInformation)
            {
                WriteObject(objid);
            }
            else
            {
                WriteObject(objid.ObjectId);
            }
        }
    }
}


text:
Extensible (one day) 2D Tiled Level Generator
=============================================

This program was once a maze generator exclusively, but it can use any algorithm that can create a 2D level with only walls, a starting point and stairs.

In the future, maze/level generators will be changeable in-app, and I'll add a Python interface so that people can add their own generators.

Maze Generation Algorithms Implemented:
- Modified Kruskal's Algorithm

Other Level Generation Algorithms implemented:
- An empty room with a starting point and stairs.

Note that in this game, the player is BLUE, the stairs are GREEN, and walls are RED.
Arrow keys move the player, reach the stairs to generate another level.

This program uses SFML 2 for rendering, and as such the system, window, and graphics libraries must be present during the building process.

redpajama_set_name: RedPajamaGithub


text:
<Page xmlns="http://schemas.nativescript.org/tns.xsd">
<StackLayout>
  <Button height="50" width="100" text="hide keyboard" onTap="hideKeyboard" style.fontSize="8"/>
  <Button height="50" width="100" loaded="onButtonLoaded" text="Click me 3rd (Android)" style.fontSize="8"
    recycleNativeView="false"/>
  <ListView loaded="onListViewLoaded">
      <ListView.itemTemplate>
        <StackLayout>
              <TextField text="Click me 1st"/>
              <TextField text="Click me 2nd" keyboardType="number"/>
        </StackLayout>
      </ListView.itemTemplate>
  </ListView>
</StackLayout>
</Page>


text:
@interface MOBProjectionEPSG2658 : MOBProjection

@end


text:
import sys
import os
import collections
import tempfile
from datetime import datetime
import time
import re

import shortuuid

shortuuid.set_alphabet(
    'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
)

def _print(x):
    """Print x.

    :param x: object
    """
    print x

def _raise(x):
    """Raise x

    :param x: object
    """
    raise x

def gen_id():
    """Return generated short UUID.
    """
    return shortuuid.uuid()

def const(x):
    """Return a function which always returns x

    :param x: object
    """
    return lambda *args, **kwargs: x

def is_map(x):
    """Return True if x is an instance of Mappings, False otherwise.

    :param x: object
    """
    return isinstance(x, collections.Mapping)

def is_string(x):
    """Return True if x is a unicode or a str, False otherwise.

    :param x: object
    """
    return isinstance(x, basestring)

def is_array(x):
    """Return True if x is iterable and not basestring or map, False otherwise.

    :param x: object
    """
    return (isinstance(x, collections.Iterable) and not
            isinstance(x, basestring) and not
            isinstance(x, collections.Mapping))

def is_callable(x):
    """Return True if x is callable, False otherwise.

    :param x: object
    """
    return hasattr(x, '__call__')

def is_readable(x):
    """Return True if x has read method, False otherwise. Don't check about
    IOError.

    :param x: object
    """
    return hasattr(x, 'read') and is_callable(x.read)

def is_writable(x):
    """Return True if x has write method, False otherwise. Don't check about
    IOError

    :param x: object
    """
    return hasattr(x, 'write') and is_callable(x.write)

def safe_encode(x, encoding='utf-8'):
    """Return encoded string of x if x is a unicode, x otherwise.

    :param x: object
    """
    if isinstance(x, unicode):
        return x.encode(encoding)
    return x

def safe_decode(x, encoding=None):
    """Return decoded string if x is a str, x otherwise. If `encoding` is None
    this function try to find appropriate encoding.

    :param x: object
    """
    if isinstance(x, str):
        if encoding is not None:
            return x.decode(encoding)
        else:
            for enc in ('utf-8', 'cp932', 'euc-jp', 'utf-7', 'shift-jis',
                        'shift-jisx0213', 'shift-jis-2004', 'utf-16',
                        'utf-16-be', 'utf-16-le', 'iso-2022-jp',
                        'euc-jisx0213', 'euc-jis-2004', 'iso-2022-jp-1',
                        'iso-2022-jp-2', 'iso-2022-jp-3', 'iso-2022-jp-ext',
                        'iso-2022-jp-2004'):
                try:
                    return x.decode(enc)
                except:
                    pass
    return x

def reinterpret_decode(x):
    """Return unicode string. if `x` is a sequence of ENCODED unicode
    character, this function converts `x` to str, then find appropriate
    encoding and encode with it.

    :param x: unicode
    """
    if isinstance(x, unicode):
        seq = map(ord, x)
        if all((xx < 256 for xx in seq)):
            return safe_decode(''.join(map(chr, seq)))
    return x

def cons_array(data, c, default_array=list):
    """Return an instance of c whose elements are data. Return an instance of
    default_array if c cannot take data as an argument for the constructor.

    :param data: tuple of elements
    :param c: class
    :param default_array: class
    """
    try:
        return c(data)
    except:
        return default_array(data)

def cons_map(data, c, default_map=dict):
    """Return an instance of c whose elements are data. Return an instance of
    default_map if c cannot take data as an argument for the constructor.

    :param data: tuple of elements
    :param c: class
    :param default_array: class
    """
    try:
        return c(data)
    except:
        return default_map(data)

def dt2ts(dt):
    """Return timestamp (int) of dt.

    :param dt: datetime
    """
    return int(time.mktime(dt.timetuple()) * 1000) + (dt.microsecond / 1000)

def ts2dt(ts):
    """Return datetime of ts

    :param ts: int
    """
    return datetime.fromtimestamp(
        int(ts) / 1000).replace(microsecond=int(ts) % 1000 * 1000)

def is_url(x):
    """Return if x matches URL expression.

    :param x: basestring
    """
    return re.match(r'https?://[\w/:%#\$&\?\(\)~\.=\+\-]+', x) is not None

def rec_apply(f, x, condition=const(True), is_map=is_map,
              is_array=is_array, apply_to_key=True,
              default_map=dict, default_array=list):
    """Return the same structured data of x but each element is applied f.
    condition is used to check if f should be applied to x. is_map and is_array
    are used to decide if x is container or not. apply_to_key is a flag to
    control if f is applied to the keys of the mapping objects. default_map and
    default_array is used to reconstruct the same structure if the
    reconstruction is failed.

    :param f: one-argument function
    :param x: object
    :param condition: one-argument function
    :param is_map: one-argument function
    :param is_array: one-argument function
    :param apply_to_key: one-argument function
    :param default_map: class object of inherit class of mapping
    :param default_array: class object of inherit class of iterable container
    """
    def g(y):
        if is_map(y):
            if apply_to_key:
                return cons_map(((g(k), g(v)) for k, v in y.items()),
                                y.__class__, default_map)
            return cons_map(((k, g(v)) for k, v in y.items()), y.__class__,
                            default_map)
        if is_array(y):
            return cons_array((g(v) for v in y), y.__class__, default_array)
        if condition(y):
            return f(y)
        return y
    return g(x)

def rec_decode(x, encoding='utf-8'):
    """Return the same structured data as `x` but each element is decoded with
    `encoding`.

    :param x: object
    :param encoding: string which specifies encoding (default: utf-8)
    """
    return rec_apply(lambda y: y.decode(encoding), x,
                     condition=lambda y: isinstance(y, str))

def rec_encode(x, encoding='utf-8'):
    """Return the same structured data as `x` but each element is encoded with
    `encoding`.

    :param x: object
    :param encoding: string which specifies encoding (default: utf-8)
    """
    return rec_apply(lambda y: y.encode(encoding), x,
                     condition=lambda y: isinstance(y, unicode))

def rec_str2dt(x, timeFormat='%Y/%m/%d %H:%M:%S'):
    """Return the same structured data as `x` but each string which matches the
    `timeFormat` is casted to datetime object.

    :param x: object
    :param timeFormat: string which specifies time format.
    (default: '%Y/%m/%d %H:%M:%S')
    """
    def f(y):
        try:
            return datetime.strptime(y, timeFormat)
        except:
            return y
    return rec_apply(f, x, condition=is_string, apply_to_key=False)

def rec_dt2str(x, timeFormat='%Y/%m/%d %H:%M:%S'):
    """Return the same structured data as `x` but each datetime object is
    stringified with `timeFormat`.

    :param x: 任意のオブジェクトls
    :param timeFormat: string which specifies time format.
    (default: '%Y/%m/%d %H:%M:%S')
    """
    return rec_apply(lambda y: y.strftime(timeFormat), x,
                     condition=lambda y: isinstance(y, datetime),
                     apply_to_key=False)


text:
<?php

namespace Faker\Provider\lv_LV;

class Address extends \Faker\Provider\Base
{
    protected static $cityPrefix = array('pilsēta');

    protected static $regionSuffix = array('reģions');
    protected static $streetPrefix = array(
        'iela', 'bulvāris', 'skvērs', 'gāte',
    );

    protected static $buildingNumber = array('##');
    protected static $postcode = array('LV ####');
    protected static $country = array(
        'Afghanistan', 'Albania', 'Algeria', 'American Samoa', 'Andorra', 'Angola', 'Anguilla', 'Antarctica (the territory South of 60 deg S)', 'Antigua and Barbuda', 'Argentina', 'Armenia', 'Aruba', 'Australia', 'Austria', 'Azerbaijan',
        'Bahamas', 'Bahrain', 'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivia', 'Bosnia and Herzegovina', 'Botswana', 'Bouvet Island (Bouvetoya)', 'Brazil', 'British Indian Ocean Territory (Chagos Archipelago)', 'British Virgin Islands', 'Brunei Darussalam', 'Bulgaria', 'Burkina Faso', 'Burundi',
        'Cambodia', 'Cameroon', 'Canada', 'Cape Verde', 'Cayman Islands', 'Central African Republic', 'Chad', 'Chile', 'China', 'Christmas Island', 'Cocos (Keeling) Islands', 'Colombia', 'Comoros', 'Congo', 'Congo', 'Cook Islands', 'Costa Rica', 'Cote d\'Ivoire', 'Croatia', 'Cuba', 'Cyprus', 'Czech Republic',
        'Denmark', 'Djibouti', 'Dominica', 'Dominican Republic',
        'Ecuador', 'Egypt', 'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia', 'Ethiopia',
        'Faroe Islands', 'Falkland Islands (Malvinas)', 'Fiji', 'Finland', 'France', 'French Guiana', 'French Polynesia', 'French Southern Territories',
        'Gabon', 'Gambia', 'Georgia', 'Germany', 'Ghana', 'Gibraltar', 'Greece', 'Greenland', 'Grenada', 'Guadeloupe', 'Guam', 'Guatemala', 'Guernsey', 'Guinea', 'Guinea-Bissau', 'Guyana',
        'Haiti', 'Heard Island and McDonald Islands', 'Holy See (Vatican City State)', 'Honduras', 'Hong Kong', 'Hungary',
        'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Isle of Man', 'Israel', 'Italy',
        'Jamaica', 'Japan', 'Jersey', 'Jordan',
        'Kazakhstan', 'Kenya', 'Kiribati', 'Korea', 'Korea', 'Kuwait', 'Kyrgyz Republic',
        'Lao People\'s Democratic Republic', 'Latvia', 'Lebanon', 'Lesotho', 'Liberia', 'Libyan Arab Jamahiriya', 'Liechtenstein', 'Lithuania', 'Luxembourg',
        'Macao', 'Macedonia', 'Madagascar', 'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta', 'Marshall Islands', 'Martinique', 'Mauritania', 'Mauritius', 'Mayotte', 'Mexico', 'Micronesia', 'Moldova', 'Monaco', 'Mongolia', 'Montenegro', 'Montserrat', 'Morocco', 'Mozambique', 'Myanmar',
        'Namibia', 'Nauru', 'Nepal', 'Netherlands Antilles', 'Netherlands', 'New Caledonia', 'New Zealand', 'Nicaragua', 'Niger', 'Nigeria', 'Niue', 'Norfolk Island', 'Northern Mariana Islands', 'Norway',
        'Oman',
        'Pakistan', 'Palau', 'Palestinian Territory', 'Panama', 'Papua New Guinea', 'Paraguay', 'Peru', 'Philippines', 'Pitcairn Islands', 'Poland', 'Portugal', 'Puerto Rico',
        'Qatar',
        'Reunion', 'Romania', 'Russian Federation', 'Rwanda',
        'Saint Barthelemy', 'Saint Helena', 'Saint Kitts and Nevis', 'Saint Lucia', 'Saint Martin', 'Saint Pierre and Miquelon', 'Saint Vincent and the Grenadines', 'Samoa', 'San Marino', 'Sao Tome and Principe', 'Saudi Arabia', 'Senegal', 'Serbia', 'Seychelles', 'Sierra Leone', 'Singapore', 'Slovakia (Slovak Republic)', 'Slovenia', 'Solomon Islands', 'Somalia', 'South Africa', 'South Georgia and the South Sandwich Islands', 'Spain', 'Sri Lanka', 'Sudan', 'Suriname', 'Svalbard & Jan Mayen Islands', 'Swaziland', 'Sweden', 'Switzerland', 'Syrian Arab Republic',
        'Taiwan', 'Tajikistan', 'Tanzania', 'Thailand', 'Timor-Leste', 'Togo', 'Tokelau', 'Tonga', 'Trinidad and Tobago', 'Tunisia', 'Turkey', 'Turkmenistan', 'Turks and Caicos Islands', 'Tuvalu',
        'Uganda', 'Ukraine', 'United Arab Emirates', 'United Kingdom', 'United States of America', 'United States Minor Outlying Islands', 'United States Virgin Islands', 'Uruguay', 'Uzbekistan',
        'Vanuatu', 'Venezuela', 'Vietnam',
        'Wallis and Futuna', 'Western Sahara',
        'Yemen',
        'Zambia', 'Zimbabwe'
    );

    protected static $region = array(
        'Kurzemes', 'Latgales', 'Rīgas', 'Vidzemes', 'Zemgales'
    );

    protected static $city = array('Aizkraukle' ,'Aluksne','Balvi', 'Bauska','Cesis',
        'Daugavpils', 'Dobele','Gulbene', 'Jekabpils', 'Jelgava', 'Kraslava', 'Kuldiga', 'Liepaja',
        'Limbazi', 'Ludza', 'Madona', 'Mobile Phones', 'Ogre', 'Preili', 'Rezekne', 'Rīga', 'Ventspils'
    );

    protected static $street = array(
        'Alfrēda Kalniņa', 'Alksnāja', 'Amatu', 'Anglikāņu', 'Arhitektu', 'Arsenāla', 'Artilērijas',
        'Aspazijas', 'Atgriežu', 'Audēju', 'Basteja', 'Baumaņa', 'Bīskapa', 'Blaumaņa', 'Brīvības', 'Brīvības',
        'Bruņinieku', 'Dainas', 'Daugavas'
    );

    protected static $addressFormats = array(
        "{{postcode}}, {{region}} {{regionSuffix}}, {{city}} {{cityPrefix}}, {{street}} {{streetPrefix}}, {{buildingNumber}}",
    );

    public static function buildingNumber()
    {
        return static::numerify(static::randomElement(static::$buildingNumber));
    }

    public function address()
    {
        $format = static::randomElement(static::$addressFormats);

        return $this->generator->parse($format);
    }

    public static function country()
    {
        return static::randomElement(static::$country);
    }

    public static function postcode()
    {
        return static::toUpper(static::bothify(static::randomElement(static::$postcode)));
    }

    public static function regionSuffix()
    {
        return static::randomElement(static::$regionSuffix);
    }

    public static function region()
    {
        return static::randomElement(static::$region);
    }

    public static function cityPrefix()
    {
        return static::randomElement(static::$cityPrefix);
    }

    public static function city()
    {
        return static::randomElement(static::$city);
    }

    public static function streetPrefix()
    {
        return static::randomElement(static::$streetPrefix);
    }

    public static function street()
    {
        return static::randomElement(static::$street);
    }
}


text:
class Checklist::AutocompleteTaxonConceptSerializer < ActiveModel::Serializer
  attributes :id, :full_name, :rank_name, :matching_names

  def rank_name
    object.rank_display_name
  end
end


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
//somthing shit in here
//WTF this shit
class Album extends MY_Controller {

	public function index()
	{
		$data['temp'] = 'site/album/index';
		$this->load->view('site/main', $data);
	}
	public function albumview($albumid = '')
	{
		$this->load->model('album_model');
		$this->load->model('user_model');
		$this->load->model('photo_model');
		$album = $this->album_model->getalbum($albumid);
		$data['album'] = $album;
		//pre($album);
		$user = $this->user_model->getuserinfo($album->user);
		$data['user'] = $user;
		//pre($user);
		$photolist = $this->photo_model->getlistphoto($albumid);
		$data['photolist'] = $photolist;
		//pre($photolist);
		$data['temp'] = 'site/album/index';
		$data['fixedtitle'] = 'Album view';
		$this->load->view('site/main', $data);
	}
	public function gridview($albumid = '')
	{
		$this->load->model('album_model');
		$this->load->model('user_model');
		$this->load->model('photo_model');
		$album = $this->album_model->getalbum($albumid);
		$data['album'] = $album;
		//pre($album);
		$user = $this->user_model->getuserinfo($album->user);
		$data['user'] = $user;
		//pre($user);
		$photolist = $this->photo_model->getlistphoto($albumid);
		$data['photolist'] = $photolist;
		//pre($photolist);
		$data['temp'] = 'site/album/gridview';
		$data['fixedtitle'] = 'Album view';
		$this->load->view('site/main', $data);
	}
	public function upload()
	{
		if (!$this->session->userdata('user_s')) {
			blockpage();
		}
		$this->load->model('album_model');
		$this->load->model('timeline_model');
		if ($this->input->post('ok')) {
			if ($this->input->post('name'))
			{
				$album['name'] = $this->input->post('name');
			}
			if ($this->input->post('description'))
			{
				$album['description'] = $this->input->post('description');
			}
			if ($this->input->post('cat') != 0)
			{
				$album['cat'] = $this->input->post('cat');
			}
			$album['date'] = gettimenow();
			$album['status'] = $this->input->post('status');
			$album['user'] = $this->session->userdata('user_s')['id'];
			if ($this->album_model->insertalbum($album)) {
				$id = $this->album_model->getalbumid($album);
				$config['upload_path']   = './upload/photo/';
		        $config['allowed_types'] = 'jpg|png|gif';
		        $file  = $_FILES['image_list'];
        		$count = count($file['name']);
        		for ($i=0; $i < $count; $i++) {
        			$_FILES['userfile']['name']     = $file['name'][$i];  //khai báo tên của file thứ i
		            $_FILES['userfile']['type']     = $file['type'][$i]; //khai báo kiểu của file thứ i
		            $_FILES['userfile']['tmp_name'] = $file['tmp_name'][$i]; //khai báo đường dẫn tạm của file thứ i
		            $_FILES['userfile']['error']    = $file['error'][$i]; //khai báo lỗi của file thứ i
		            $_FILES['userfile']['size']     = $file['size'][$i]; //khai báo kích cỡ của file thứ i
		            $this->load->library('upload', $config);
		            if ($this->upload->do_upload()) {
		            	$this->load->model('photo_model');
		            	$photo['idalbum'] = $id;
		            	$photo['date'] = $album['date'];
		            	$photo['link'] = $this->upload->data()['file_name'];
		            	$photo['status'] = $album['status'];
		            	$photo['user'] = $this->session->userdata('user_s')['id'];
		            	if ($this->input->post('cat') != 0)
		            	{
		            		$photo['cat'] = $album['cat'];
		            	}
		            	$this->photo_model->insertphoto($photo);
		            }
        		}
        		$timeline = array();
				$timeline['user'] = $this->session->userdata('user_s')['id'];
				$timeline['datetime'] = $album['date'];
				$timeline['type'] = 1;
				$timeline['topic'] = $id;
				$this->timeline_model->createtimeline($timeline);
				redirect(base_url().'album/albumview/'.$id,'refresh');
			}
		}
		$this->load->model('cat_model');
		$data['list_cat'] = $this->cat_model->get_list_cat();
		$data['temp'] = 'site/album/upload';
		$data['fixedtitle'] = 'Album upload';
		$this->load->view('site/main', $data);
	}

}

/* End of file album.php */
/* Location: ./application/controllers/album.php */


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:animateLayoutChanges="true"
    android:gravity="bottom| center"
    android:orientation="vertical"
    android:visibility="invisible"
    tools:visibility="visible"
    android:layout_width="match_parent"
    android:layout_height="@dimen/defaultwidgetheight"
    android:paddingLeft="5dp">
    <TextView
        android:id="@+id/playbackstatus"
        android:paddingRight="30dp"
        android:alpha="0.5"
        android:text="@string/now_playing"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
    <TextView
		android:paddingRight="30dp"
        android:gravity="center_horizontal"
		android:textSize="25dp"
        android:fontFamily="sans-serif-condensed"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:maxLines="2"
        android:id="@+id/tvSongName"
        android:textColor="@color/primary_text_default_material_dark"
        android:textStyle="normal" />
    <TextView
		android:paddingRight="30dp"
        android:gravity="center_horizontal"
		android:textSize="19dp"
        android:fontFamily="sans-serif-condensed"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:maxLines="1"
        android:id="@+id/tvArtistName"
        android:textColor="@color/primary_text_default_material_dark"
        android:textStyle="normal" />
    <TextView
		android:paddingRight="30dp"
	    android:textSize="17dp"
        android:gravity="center_horizontal"
        android:fontFamily="sans-serif-condensed"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:maxLines="1"
        android:id="@+id/tvAlbumName"
        android:textStyle="italic"
        android:textColor="@color/primary_text_default_material_dark" />
    <SeekBar
        android:alpha="0.5"
		android:paddingRight="30dp"
        android:visibility="visible"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/seeksongTime" />
    <TextView
        android:id="@+id/sourceapp"
        android:paddingRight="30dp"
        android:alpha="0.5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:id="@+id/mediaControls">
        <ImageButton
            android:layout_margin="5dp"
            android:contentDescription=""
            android:src="@drawable/ic_skip_previous_white_24dp"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/btnMediaPrevious"
            android:background="?android:attr/selectableItemBackground" />
        <ImageButton
            android:contentDescription=""
            android:layout_margin="5dp"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/btnMediaPlayPlause"
            android:background="?android:attr/selectableItemBackground" />
        <ImageButton
            android:contentDescription=""
            android:layout_margin="5dp"
            android:src="@drawable/ic_skip_next_white_24dp"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/btnMediaNext"
            android:background="?android:attr/selectableItemBackground" />
        <ImageButton
            android:contentDescription=""
            android:layout_margin="5dp"
            android:visibility="visible"
            android:src="@drawable/ic_notifications_white_24dp"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/btnLaunchNotification"
            android:background="?android:attr/selectableItemBackground" />
    </LinearLayout>
</LinearLayout>


text:
/**
 * Module dependencies.
 */

var chalk = require('chalk');
var PokemonShowdown = require('./pokemon-showdown');
var SimpleHttpServer = require('./simple-http-server');
var utils = require('./utils');

/**
 * stevo prototype.
 */

var stevo = module.exports = {};

/**
 * Create a type of server depending on the user's choice.
 *
 * @param {String} type
 * @param {Object} options
 */
stevo.createServer = function(type, options) {
  var choice = this.handleServer[type.toLowerCase()];
  if (choice) {
    return (utils.getType(choice) === 'Object' && choice.initialize(options)) ||
           (utils.getType(choice) === 'String' && this.handleServer[choice].initialize(options));
  } else {
    var err = 'That server type is not found.';
    console.log(chalk.red(err));
    return new Error(err);
  }
};

/**
 * Handle which server get started.
 */
stevo.handleServer = {
  ps: 'pokemonshowdown',
  pokemonshowdown: PokemonShowdown,
  http: 'simplehttpserver',
  simplehttpserver: SimpleHttpServer
};


text:
package com.monkeyhorse.blog.models;

import org.apache.commons.lang3.builder.HashCodeBuilder;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * An abstract base model class for entities
 *
 *  @author uoor<i@monkeyhorse.cn thx raysmood>
 */
@MappedSuperclass
public abstract class BaseModel implements Comparable<BaseModel>, Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    @Column(nullable = false)
    private Date createdAt;

    @Column(nullable = false)
    private Date updatedAt;

    @PrePersist
    public void prePersist(){
        createdAt = updatedAt = new Date();
    }

    @PreUpdate
    public void preUpdate(){
        updatedAt = new Date();
    }

    @Override
    public int compareTo(BaseModel o) {
        return this.getId().compareTo(o.getId());
    }

    public boolean equals(Object other) {
        if (other == null || other.getClass() != this.getClass())
            return false;

        return this.getId().equals(((BaseModel) other).getId());
    }

    public int hashCode() {
        return new HashCodeBuilder().append(getId()).toHashCode();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long _id) {
        id = _id;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

}


text:
package io.github.hl7.bridge;

import java.io.Serializable;
import java.util.Collection;

import ca.uhn.hl7v2.model.Message;

public interface MessageExchange extends Serializable{

	String getIdentifier();
	Message getMessage();
	boolean hasError();
	Collection<Throwable> getExceptions();
	Collection<MessageDelivery> getDeliveries();

}


text:
/*
 * C Implementation: set
 *
 * Description: how to set key values.
 *
 *
 *
 *
 */
#include <stdio.h>
#include <stdlib.h>

#include "grib_api.h"

int main(int argc, char** argv) {
  int err = 0;
  long centre=80;
  long long_value=0;
  char string_value[100];
  size_t len = sizeof(string_value)/sizeof(char);
  size_t size=0;

  FILE* in = NULL;
  char* infile = "../data/regular_latlon_surface.grib1";
  FILE* out = NULL;
  char* outfile = "out.grib1";
  grib_handle *h = NULL;
  const void* buffer = NULL;

  in = fopen(infile,"r");
  if(!in) {
    printf("ERROR: unable to open file %s\n",infile);
    return 1;
  }

  out = fopen(outfile,"w");
  if(!out) {
    printf("ERROR: unable to open file %s\n",outfile);
    return 1;
  }

  /* create a new handle from a message in a file */
  h = grib_handle_new_from_file(0,in,&err);
  if (h == NULL) {
    printf("Error: unable to create handle from file %s\n",infile);
  }

  /* set centre as a long */
  GRIB_CHECK(grib_set_long(h,"centre",centre),0);

  /* get centre as a long */
  GRIB_CHECK(grib_get_long(h,"centre",&long_value),0);
  printf("centre long value=%ld\n",long_value);

  /* get centre as a string */
  GRIB_CHECK(grib_get_string(h,"centre",string_value,&len),0);
  printf("centre string value=%s\n",string_value);

  /* get the coded message in a buffer */
  GRIB_CHECK(grib_get_message(h,&buffer,&size),0);

  /* write the buffer in a file*/
  if(fwrite(buffer,1,size,out) != size)
  {
     perror(argv[1]);
     exit(1);
  }

  /* delete handle */
  grib_handle_delete(h);

  fclose(in);
  fclose(out);

  return 0;
}


text:
/*** AppView.js ***/

import Famous from 'famous';
import {PageView} from 'views/PageView';
import {MenuView} from 'views/MenuView';
import {StripData} from 'data/StripData';

var View = Famous.core.View
  , Surface = Famous.core.Surface
  , Transform = Famous.core.Transform
  , StateModifier = Famous.modifiers.StateModifier
  , Modifier = Famous.core.Modifier
  , Transitionable = Famous.transitions.Transitionable
  , GenericSync = Famous.inputs.GenericSync
  , MouseSync = Famous.inputs.MouseSync
  , TouchSync = Famous.inputs.TouchSync;

/*import View from 'famous/core/View';
import Surface from 'famous/core/Surface';
import Transform from 'famous/core/Transform';
import StateModifier from 'famous/modifiers/StateModifier';
import Modifier from 'famous/core/Modifier';
import Transitionable from 'famous/transitions/Transitionable';
import GenericSync from 'famous/inputs/GenericSync';
import MouseSync from 'famous/inputs/MouseSync';
import TouchSync from 'famous/inputs/TouchSync';*/

GenericSync.register({'mouse': MouseSync, 'touch': TouchSync});

export class AppView extends View {
  constructor (data) {
    let self = this;
    super(data);
    self.menuToggle = false;
    self.pageViewPos = new Transitionable(0);

    self._createPageView();
    self._createMenuView();
    self._setListeners();
    self._handleSwipe();
  }
  _createPageView () {
    let self = this;
    self.pageView = new PageView();
    self.pageModifier = new Modifier({
      transform: function() {
        return Transform.translate(self.pageViewPos.get(), 0, 0);
      }
    });
    self.add(self.pageModifier).add(self.pageView);
  }
  _createMenuView () {
    let self = this;
    self.menuView = new MenuView({stripData: StripData});
    var menuModifier = new StateModifier({
      transform: Transform.behind
    });
    self.add(menuModifier).add(self.menuView);
  }
  _setListeners () {
    let self = this;
    self.pageView.on('menuToggle', self.toggleMenu.bind(self));
  }
  _handleSwipe () {
    let self = this;

    var sync = new GenericSync(
      ['mouse', 'touch'],
      {direction : GenericSync.DIRECTION_X}
    );

    self.pageView.pipe(sync);

    sync.on('update', function(data) {
      var currentPosition = self.pageViewPos.get();
      if(currentPosition === 0 && data.velocity > 0) {
        self.menuView.animateStrips();
      }
      self.pageViewPos.set(Math.max(0, currentPosition + data.delta));
    });

    sync.on('end', function(data) {
      var velocity = data.velocity;
      var position = self.pageViewPos.get();
      if(position > self.options.posThreshold) {
        if(velocity < -self.options.velThreshold) {
          self.slideLeft();
        } else {
          self.slideRight();
        }
      } else {
        if(velocity > self.options.velThreshold) {
          self.slideRight();
        } else {
          self.slideLeft();
        }
      }
    });
  }
  slideRight () {
    let self = this;
    self.pageViewPos.set(self.options.openPosition, self.options.transition, function() {
      self.menuToggle = true;
    });
  }
  slideLeft () {
    let self = this;
    self.pageViewPos.set(0, self.options.transition, function() {
      self.menuToggle = false;
    });
  }
  toggleMenu () {
    let self = this;
    if(self.menuToggle) {
      self.slideLeft();
    } else {
      self.slideRight();
      self.menuView.animateStrips();
    }
  }
}

AppView.DEFAULT_OPTIONS = {
  openPosition: 276,
  transition: {
    duration: 300,
    curve: 'easeInOut'
  },
  posThreshold: 138,
  velThreshold: 0.75
};


text:
/*!
 *
 * \file src/relay/op/dyn/nn/upsampling.h
 * \brief implementation of the InferCorrectLayout pass for dynamic upsampling
 */

#ifndef TVM_RELAY_OP_DYN_NN_UPSAMPLING_H_
#define TVM_RELAY_OP_DYN_NN_UPSAMPLING_H_

#include <tvm/relay/attrs/nn.h>
#include <tvm/tir/data_layout.h>

#include "../../op_common.h"

namespace tvm {
namespace relay {
namespace dyn {

template <typename T>
InferCorrectLayoutOutput UpsamplingInferCorrectLayout(const Attrs& attrs,
                                                      const Array<Layout>& new_in_layouts,
                                                      const Array<Layout>& old_in_layouts,
                                                      const Array<tvm::relay::Type>& old_in_types) {
  const auto* attrs_ptr = attrs.as<T>();
  ICHECK(attrs_ptr);
  ObjectPtr<T> params = make_object<T>(*attrs_ptr);

  if (new_in_layouts.defined()) {
    ICHECK_GT(new_in_layouts.size(), 0);

    Layout raw_layout(params->layout);
    Layout input = new_in_layouts[0];
    if (input.IndexOf(LayoutAxis::Get('W')) == raw_layout.IndexOf(LayoutAxis::Get('W')) &&
        input.IndexOf(LayoutAxis::Get('H')) == raw_layout.IndexOf(LayoutAxis::Get('H')) &&
        !input.Contains(LayoutAxis::Get('w')) && !input.Contains(LayoutAxis::Get('h')) &&
        (input.IndexOf(LayoutAxis::Get('D')) == -1 ||
         (input.IndexOf(LayoutAxis::Get('D')) == raw_layout.IndexOf(LayoutAxis::Get('D')) &&
          !input.Contains(LayoutAxis::Get('d'))))) {
      params->layout = input.name();  // modify self to follow the input layout
    }
  }

  Layout inferred_layout(params->layout);
  Layout param_layout("NCHW");
  return InferCorrectLayoutOutput({inferred_layout, param_layout, param_layout}, {inferred_layout},
                                  Attrs(params));
}

}  // namespace dyn
}  // namespace relay
}  // namespace tvm

#endif  // TVM_RELAY_OP_DYN_NN_UPSAMPLING_H_


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Maanviljelys Talondellin Koelaitos Vuoskivija 1915-1916 27 (1920)

#### Original name
null

### Remarks
null


text:
require.def('antie/widgets/scrubbar',
	['antie/widgets/horizontalslider'],
	function(HorizontalSlider) {
		'use strict';

		/**
		 * The ScrubBar provides a media scrub bar showing current position and portion of the stream that is currently buffered.
		 * @name antie.widgets.ScrubBar
		 * @class
		 * @extends antie.widgets.HorizontalSlider
		 * @param {String} [id] The unique ID of the widget. If excluded, a temporary internal ID will be used (but not included in any output).
		 * @param {double} [initialValue] Initial value for the slider.
		 * @param {double} [smallIncrement] Amount to increase/decrease the value by when VK_LEFT or VK_RIGHT is pressed.
		 * @param {double} [largeIncrement] Amount to increase/decrease the value by when VK_LEFT or VK_RIGHT is held down.
		 * @param {double} [largeIncrementAfter] Number of smallIncrements to perform until switching to largeIncrement when key is held down.
		 */
		return HorizontalSlider.extend(/** @lends antie.widgets.ScrubBar.prototype */ {
			init: function(id, initialValue, smallIncrement, largeIncrement, largeIncrementAfter) {
				this._super(id, initialValue, smallIncrement, largeIncrement, largeIncrementAfter);

				this._bufferedRange = {start: 0, end: 0};
				this._lastBufferLeft = -1;
				this._lastBufferWidth = -1;
			},

			/**
			 * Renders the widget and any child widgets to device-specific output.
			 * @param {antie.devices.Device} device The device to render to.
			 * @returns A device-specific object that represents the widget as displayed on the device (in a browser, a DOMElement);
			 */
			render: function(device) {
				this.outputElement = this._super(device);
				this._buffer = device.createButton(this.id+'_buffer');
				device.addClassToElement(this._buffer, 'scrubbarbuffer');
				device.prependChildElement(this.outputElement, this._buffer);
				return this.outputElement;
			},
			_moveBuffer: function() {
				if(this.outputElement) {
					var device = this.getCurrentApplication().getDevice();
					var elsize = device.getElementSize(this.outputElement);
					var left = Math.floor(this._bufferedRange.start * elsize.width);
					var width = Math.floor((this._bufferedRange.end - this._bufferedRange.start) * elsize.width);

					if(this._lastBufferLeft != left) {
						this._lastBufferLeft = left;
						device.moveElementTo({
							el: this._buffer,
							to: {
								left: left,
								top: null
							},
							skipAnim: true
						});
					}
					if(this._lastBufferWidth != width) {
						this._lastBufferWidth = width;
						device.setElementSize(this._buffer, {width: width});
					}
				}
			},
			getBufferedRange: function() {
				return this._bufferedRange;
			},
			setBufferedRange: function(bufferedRange) {
				this._bufferedRange = bufferedRange;
				this._moveBuffer();
			}
		});
	}
);


text:
package com.architjn.materialicons.launchers;

import android.content.Context;
import android.content.Intent;

public class GoLauncher {
    public GoLauncher(Context context) {
        Intent intent = context.getPackageManager().getLaunchIntentForPackage("com.gau.go.launcherex");
        Intent go = new Intent("com.gau.go.launcherex.MyThemes.mythemeaction");
        go.putExtra("type", 1);
        go.putExtra("pkgname", context.getPackageName());
        context.sendBroadcast(go);
        context.startActivity(intent);
    }
}


text:
> IDE's like Intellij provides a feature to *create* and *apply* a patch. This is an attempt to have the same feature available for VSCODE.

## [0.2.1] - 2018-02-10
### Added
> * Provides a context menu under SCM & File Explorer.

> * Removed extra layer of confirmation.

## [0.2.0] - 2018-02-05
### Added

> * Better way to create & apply patch via dialog.

> * Save patch at custom location.

## Features

> * Creates a GIT patch from `Staged` files on the fly.

> * Creates a GIT patch from `Unstaged` files on the fly.

> * `Apply` a patch by `selecting` a patch file on the fly.

## How this works

  ![Git create patch preview](https://raw.githubusercontent.com/paragdiwan/vscode-git-patch/master/images/vscode.gif)

## Requirements
You must have `git` installed already.

## Known Issues
- Patch sometimes fails due to HUNK errors.
- Patch doesn't take care of conflicts, if any.

Kindly provide your feedback to improve this extension.

**Enjoy!**


text:
<?php  namespace Iannazzi\Generators\Commands;
use Iannazzi\Generators\DatabaseImporter\DatabaseConnector;
use Iannazzi\Generators\DatabaseImporter\DatabaseDataImporter;
use Illuminate\Console\Command;

class ImportDatabaseCommand extends Command
{

    protected $signature = 'zz:ImportDatabase
                             {--test=false : If True I will import only 100 rows from the database}';
    protected $description = 'Import Data from production database';
    public function __construct()
    {
        parent::__construct();

    }
    public function handle()
    {
        $test = $this->option('test');
        $test  = ($test == 'true') ? true: false;
        DatabaseConnector::addConnections();
        $dataImporter = new DatabaseDataImporter('POS', $test);
        $dataImporter->importEmbrasseMoiData();

    }

}
?>


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >

<TextView
    android:id="@+id/ab_basemaps_dropdown_title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:padding="10dip"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textColor="@color/actionbar_color"
     />

</RelativeLayout>


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:p="http://www.springframework.org/schema/p"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <!-- 引入jdbc配置文件 -->
    <bean id="jdbc"
          class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
          p:locations="classpath:/jdbc.properties"
            />

    <!--创建jdbc数据源 -->
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="#{jdbc['driver']}"/>
        <property name="url" value="#{jdbc['url']}"/>
        <property name="username" value="#{jdbc['username']}"/>
        <property name="password" value="#{jdbc['password']}"/>
        <property name="initialSize" value="#{jdbc['initialSize']}"/>
        <property name="maxActive" value="#{jdbc['maxActive']}"/>
        <property name="maxIdle" value="#{jdbc['maxIdle']}"/>
        <property name="minIdle" value="#{jdbc['minIdle']}"/>
    </bean>

    <!-- 创建SqlSessionFactory,同时指定数据源-->
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource"/>
    </bean>

    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="annotationClass" value="com.imethod.core.jdbc.ibatis.IMapper"/>
        <property name="basePackage" value="com.imethod"/>
        <property name="sqlSessionFactory" ref="sqlSessionFactory"/>
    </bean>
</beans>


text:
namespace Umbraco.Cms.Core.Models;

public interface IReadOnlyContentBase
{
    /// <summary>
    ///     Gets the integer identifier of the entity.
    /// </summary>
    int Id { get; }

    /// <summary>
    ///     Gets the Guid unique identifier of the entity.
    /// </summary>
    Guid Key { get; }

    /// <summary>
    ///     Gets the creation date.
    /// </summary>
    DateTime CreateDate { get; }

    /// <summary>
    ///     Gets the last update date.
    /// </summary>
    DateTime UpdateDate { get; }

    /// <summary>
    ///     Gets the name of the entity.
    /// </summary>
    string? Name { get; }

    /// <summary>
    ///     Gets the identifier of the user who created this entity.
    /// </summary>
    int CreatorId { get; }

    /// <summary>
    ///     Gets the identifier of the parent entity.
    /// </summary>
    int ParentId { get; }

    /// <summary>
    ///     Gets the level of the entity.
    /// </summary>
    int Level { get; }

    /// <summary>
    ///     Gets the path to the entity.
    /// </summary>
    string? Path { get; }

    /// <summary>
    ///     Gets the sort order of the entity.
    /// </summary>
    int SortOrder { get; }

    /// <summary>
    ///     Gets the content type id
    /// </summary>
    int ContentTypeId { get; }

    /// <summary>
    ///     Gets the identifier of the writer.
    /// </summary>
    int WriterId { get; }

    /// <summary>
    ///     Gets the version identifier.
    /// </summary>
    int VersionId { get; }
}


text:
package WWW::Search::Pagesjaunes;
use strict;
use Carp qw(carp croak);
use HTML::Form;
use HTML::TokeParser;
use LWP::UserAgent;

$WWW::Search::Pagesjaunes::VERSION = '0.08';

sub ROOT_URL() { 'http://www.pagesjaunes.fr' }

sub new {
    my $class = shift;
    my $self  = {};
    my $ua    = shift() || LWP::UserAgent->new(
        env_proxy  => 1,
        keep_alive => 1,
        timeout    => 30,
    );

    $ua->agent( "WWW::Search::Pagesjaunes-X/$WWW::Search::Pagesjaunes::VERSION "
          . $ua->agent );

    $self->{ua}    = $ua;
    $self->{limit} = 50;

    $self->{error} = 1;
    $self->{lang}  = 'FR';

    bless( $self, $class );
}

sub find {
    my $self = shift;
    my %opt  = @_;

    # Make the first request to pagesjaunes.fr
    $self->{URL} = ROOT_URL . ( $opt{activite} ? '/pj.cgi' : '/pb.cgi' );

    my $req = $self->{ua}->request( HTTP::Request->new( 'GET', $self->{URL} ) );

    $DB::single = 1;
    if ( !$req->content || !$req->is_success ) {
        croak('Error while retrieving the HTML page');
    }

    my @forms = HTML::Form->parse( $req->content, $self->{URL} );

    #my $form = $opt{activite} ? $forms[1] : $forms[0];
    my $form = $forms[0];

    {

        # HTML::Form complains when you change hidden fields values.
        local $^W;
        $form->value( 'lang', $self->{lang} );
    }

    $form->value( 'FRM_ACTIVITE', $opt{activite} ) if $opt{activite};
    $form->value( 'FRM_NOM',      $opt{nom} );
    $form->value( 'FRM_PRENOM',   $opt{prenom} )   if !$opt{activite};
    $form->value( 'FRM_ADRESSE',  $opt{adresse} );
    $form->value( 'FRM_LOCALITE', $opt{localite} );
    $form->value( 'FRM_DEPARTEMENT', $opt{departement} );

    $self->{limit} = $opt{limit} || $self->{limit};

    $self->{req} = $form->click;

    return $self;
}

sub results {
    my $self = shift;

    my $result_page = $self->{ua}->request( $self->{req} )->content;
    my $parser      = HTML::TokeParser->new( \$result_page );

    # All the
 tags are transformed to whitespace
    $parser->{textify} = {
        'br' => sub() { " " }
    };

    my @results;

    if ( $self->{limit} == 0 ) {
        $self->{has_more} = 0;
        return @results;
    }

    # XXX This is a really crude parsing of the data, but it seems to
    # get the job done.
    #
    #

    #

    #

    #       Name
    #
    #

    #

    #       Address
    #       (télécopie)? Phone
    #

    #

    #

    #
    $self->{has_more} = 0;

    while ( my $token = $parser->get_tag("table") ) {
        next
          unless $token->[1]
          && $token->[1]{class}
          && $token->[1]{class} eq 'fdcadreinscr';
        {    # We're inside an entry table

            $parser->get_tag("td");    # The first  is the name
            my $name = _trim( $parser->get_trimmed_text('/td') );

            $parser->get_tag("td");    # The second  is the address
            my $address = _trim( $parser->get_trimmed_text('/td') );
            $address =~ s/\W*\|.*$//;

            $parser->get_tag("td");    # The third  is the phone number
            my $phone = _trim( $parser->get_trimmed_text('/td') );
            $phone =~ s/^\W(.*)$/$1/g;

            push(
                @results,
                WWW::Search::Pagesjaunes::Entry->new(
                    $name, $address, $phone, 0
                )
            );

            return @results if --$self->{limit} == 0;
        }
    }

    foreach my $form ( HTML::Form->parse( $result_page, $self->{URL} ) ) {
        if (   $form->find_input('faire')
            && $form->value('faire') eq 'inscriptions_suivant' )
        {
            $self->{has_more} = 1;
            $self->{req}      = $form->click();
        }
    }

    # If there was no result, we look for an error message in the HTML page
    if ( !@results && $self->{error} ) {
        $parser = HTML::TokeParser->new( \$result_page );
        while ( my $token = $parser->get_tag("font") ) {
            next
              unless $token->[1]
              && $token->[1]{color}
              && $token->[1]{color} eq '#ff0000';
            $parser->{textify} = {
                'br' => sub() { " " }
            };
            print STDERR _trim( $parser->get_trimmed_text('/font') ) . "\n";
        }
    }

    wantarray ? @results : $results[0];
}

sub _trim {
    $_[0] =~ s/\xa0/ /g;       # Transform the   into whitespace
    $_[0] =~ s/^\s*|\s*$//g;
    $_[0];
}

sub limit {
    my $self = shift;
    $self->{limit} = $_[0] || $self->{limit};
}

sub has_more { $_[0]->{has_more} }

package WWW::Search::Pagesjaunes::Entry;
sub new { bless [ $_[1], $_[2], $_[3], $_[4] ], $_[0] }
sub name    { $_[0]->[0] }
sub address { $_[0]->[1] }
sub phone   { $_[0]->[2] }
sub is_fax  { $_[0]->[3] }
sub entry   { @{ $_[0] }[ 0 .. 2 ] }

1;

__END__

=pod

=head1 NAME

WWW::Search::Pagesjaunes - Lookup phones numbers from www.pagesjaunes.fr

=head1 SYNOPSIS

 use WWW::Search::Pagesjaunes;

 my $pj = new WWW::Search::Pagesjaunes;
 $pj->find( activite => "Plombier", localite => "Paris" );

 do {
    print $_->entry . "\n" foreach ($pj->results);
 } while $pj->has_more;

=head1 DESCRIPTION

The WWW::Search::Pagesjaunes provides name, phone number and addresses of French
telephone subscribers by using the L<http://www.pagesjaunes.fr>
directory.

=head1 METHODS

Two classes are used in this module, a first one (WWW::Search::Pagesjaunes) to do the
fetching and parsing, and the second one and a second one
(WWW::Search::Pagesjaunes::Entry) holding the entry infos.

Here are the methods for the main WWW::Search::Pagesjaunes module:

=over 4

=item new()

The constructor accept an optional LWP::UserAgent as argument, if you want to
provide your own.

=item find( %request )

Here are the values for the %request hash that are understood. They
each have two name, the first is the french one and the second is the
english one:

=over 4

=item nom / name

Name of the person you're looking for.

=item activite / business

Business type of the company you're looking for. Note that if this
field is filled, the module searches in the yellow pages.

=item localite / town

Name of the town you're searching in.

=item prenom / firstname

First name of the person you're looking for. It is not set if you set the
'activite' field.

=item departement / district

Name or number of the Département or Région you're searching in.

=back

=item results()

Returns an array of WWW::Search::Pagesjaunes::Entry containing the first matches of the
query.

=item limit($max_number_of_entries)

Set the maximum number of entries returned. Default to 50.

=item has_more()

If the query leads to more than a few results, the field has_more is set. You
can then call the results() method again to fetch the datas.

=back

The WWW::Search::Pagesjaunes::Entry class has six methods:

=over 4

=item new($name, $address, $phone, $fax)

Returns a new WWW::Search::Pagesjaunes::Entry.

=item name

Returns the name of the entry.

=item address

Returns the address of the entry.

=item phone

Returns the phone number of the entry.

=item is_fax

Returns true if the phone number is a fax one, false otherwise. Note
that currently, this method always returns 0.

=item entry($separator)

Returns the concatenation of the name and the phone number, separated by
" - ". You can specify your own separator as first argument.

=back

=head1 BUGS

The phone numbers are sometimes not correctly parsed, esp. when one
entry has several phone numbers.

If you found a bug and want to report it or send a patch, you are
encouraged to use the CPAN Request Tracker interface:
L<https://rt.cpan.org/NoAuth/Dists.html?Queue=WWW-Search-Pagesjaunes>

=head1 COPYRIGHT

Please read the Publisher information of L<http://www.pagesjaunes.fr> available at the following URL:
L<http://www.pagesjaunes.fr/pj.cgi?html=commun/avertissement.html&lang=en>

WWW::Search::Pagesjaunes is Copyright (C) 2002, Briac Pilpré

This module is free software; you can redistribute it or modify it under the
same terms as Perl itself.

=head1 AUTHOR

Briac Pilpré <briac@cpan.org>

=cut


text:
require 'spec_helper'

module DBLock
  RSpec.describe Adapter do
    subject { Adapter }

    shared_examples 'a correctly delegating adapter' do |adapter|
      before do
        allow(adapter).to receive(:lock)
        allow(adapter).to receive(:release)
      end

      it "delegates 'lock' correctly" do
        subject.lock 'foo', 3
        expect(adapter).to have_received(:lock).with('foo', 3)
      end

      it "delegates 'release' correctly" do
        subject.release 'foo'
        expect(adapter).to have_received(:release).with('foo')
      end
    end

    let(:connection) { double(adapter_name: adapter_name) }

    before do
      allow(DBLock).to receive(:db_handler) { double(connection: connection) }
    end

    context 'when using MySQL' do
      let(:adapter_name) { 'mysql2' }

      include_examples 'a correctly delegating adapter', Adapter::MYSQL.instance
    end

    context 'when using Microsoft SQL Server' do
      let(:adapter_name) { 'sqlserver' }

      include_examples 'a correctly delegating adapter', Adapter::Sqlserver.instance
    end
  end
end


text:
require_relative 'test_helper'

class StubDummy
  def self.call(*args)
    #
  end
end

class GlobTests < MiniTest::Test
  def setup
    @vm = VirtualMachine.new
    block = Visher.parse! 'mount /v;mkdir /v/bin;install'
    @vm.call block
  end
  def test_ok
    StubDummy.stub(:call, 'true') do |o|
      g = Glob.new o
      g.call env:@vm.ios, frames:@vm.fs
    end
  end
  def test_glob_in_physical_layer_path_slash_star_returns_non_empty_array
    vhome = @vm.fs[:vhome]
    Hal.chdir(vhome)
    StubDummy.stub(:call, 'etc/*') do |o|
      g = Glob.new o
      result = g.call env:@vm.ios, frames:@vm.fs
      assert_is result, Array
      assert !result.empty?
    end
  end
  def test_physical_works_w_brackets
    vhome = @vm.fs[:vhome]
    Hal.chdir(vhome)

    StubDummy.stub(:call, 'scripts/00[12]_*.vsh') do |o|
      g = Glob.new o
      result = g.call env: @vm.ios, frames: @vm.fs
      assert !result.empty?
      assert_eq 2, result.length
    end
  end
  def test_physical_works_w_question
      vhome = @vm.fs[:vhome]
    StubDummy.stub(:call, 'scripts/???_*') do |o|
      g = Glob.new(o)
      result = g.call env: @vm.ios, frames: @vm.fs
      assert !result.empty?
    end

  end
  def test_star_returns_non_empty_array
    Hal.chdir '/v/bin'
    StubDummy.stub :call, '*' do |o|
      g = Glob.new o
      result = g.call env:@vm.ios, frames:@vm.fs
      assert_is result, Array
      assert !result.empty?
      assert result.length > 1
    end
  end
  def test_virtual_layer_w_path_star_returns_non_empty_array
    Hal.chdir('/v/')
    StubDummy.stub(:call, 'bin/*') do |o|
      g = Glob.new o
      result = g.call env:@vm.ios, frames:@vm.fs
      assert_is result, Array
      assert !result.empty?
      assert result.length > 1
    end
  end
end


text:
![React](https://img.shields.io/badge/react-%5E15.5.1-brightgreen.svg)
![Redux](https://img.shields.io/badge/redux-%5E3.6.0-brightgreen.svg)
![webpack](https://img.shields.io/badge/webpack-%5E2.x.x-brightgreen.svg)
![MIT](https://img.shields.io/dub/l/vibe-d.svg?style=flat-square)

> A SPA boilerplate with React, built with love.

## Features
 - **React 15.5.1**
 - **Redux 3.6.0**
 - **react-redux 5.0.3**, to bind React and Redux.
 - **react-router v4 or v3**, choose the one you are familiar with.
 - **JSX**
 - **ES6**, support [`stage-1`](http://babeljs.io/docs/plugins/preset-stage-1/) by default.
 - **webpack 2.x**
 - **Express**, the dev-server.
 - **Hot-Reload**, support both React and Redux!
 - **Proxy**
 - **Environmental value**
 - **ESlint**, with [`standard`](https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style) and [`standard-react`](https://github.com/feross/eslint-config-standard-react).
 - **Redux-devtools**, to make the stores more clear
 - **bundle-analyzer**
 - **jest** with Enzyme, to make unit test for react components easier.

## Usage

```bash
# install sao first
npm install -g sao

# download the template
sao yang302/react-cli new-project --install

# if you would like to try React 16
sao yang302/react-cli#next new-project --install

# install all this dependencies.
cd new-project
npm install

# development, default port: 8080
npm run dev

# production
npm run build

# build with report
npm run build --report

# lint the files (if use eslint)
npm run lint

# run all tests
npm test
```

## Doc

It's pretty much the same config as [vue-cli/webpack](https://github.com/vuejs-templates/webpack/tree/master/docs). If you are familiar with `vue-cli`, you may have a great joy with this boilerplate. If you want to have a peek of the structure, you can visit [`full-features` branch](https://github.com/yang302/react-cli/tree/full-features).

### Pre-Processor

You can take `less`, `sass`, or `stylus` as your CSS pre-processors, after installing the dependencies. For example, to use `less`:
```bash
npm install less less-loader --save-dev
```
Then, you can `import` your `less` files in your components.

### postcss-config

We use [postcss](http://postcss.org/) with autoprefixer by default. You can also use your own plugins in the project. For example, to use `postcss-color-gray` to "grayify" your color:
```bash
# First thing to do
npm install postcss-color-gray --save-dev
```

add your plugin in `postcssrc.js`
```javascript
module.exports = {
  "plugins": {
    // to edit target browsers: use "browserlist" field in package.json
    "autoprefixer": {},
    // put your plugin here
    "postcss-color-gray": {}
  }
}
```

Tada! Everything is gray now.

### Proxy

We uses [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware)  for proxying.
For example, you want to proxy `/api/get-post` and `/api/get-id`, you can edit the option in `config/index.js`:
```javascript
...
dev: {
  proxyTable: {
    '/api': {
      target: 'http://example.org',
      changeOrigin: true
    }
  }
}
...
```
Then, you can proxy `/api` in your dev server. See more [options](https://github.com/chimurai/http-proxy-middleware#options).

### Env

This [doc](https://github.com/vuejs-templates/webpack/blob/master/docs/env.md) can illustrate the usage well.

### Hot-Reload

We use [react-hot-loader v3](https://github.com/gaearon/react-hot-loader/tree/next) to tweak React components, even for Redux! Have fun!

### ESlint

[standard](https://github.com/feross/standard) and [standard-react](https://github.com/feross/standard-react) are the default style guides for this boilerplate, feel free to edit your own config in `.eslintrc.js`.

### Router

You can use v3 or v4 as your router, and both of them support async router! As for v4, based on its concept(everything should be component, even for config), it's a little tricky on using async router. To solve this issue, we use [`react-loadable`](https://github.com/thejameskyle/react-loadable) to split router into several chunk. It's an awesome Higher-Order-Component! It can not only split router for react, but also every single component you have. Do whatever you want to make your app neat!

### Redux

You can use **Redux** in the project when you enable the choice. Noted that we separate two kinds of store(`dev` and `prod`) in two files. The `prod` one doesn't have any devtools' code, for reducing the size of bundle. If you need to apply the middlewares (`redux-thunk`, `redux-saga` and so on), you need to apply them in `middlewares.js`.

### redux-devtools

This boilerplate has enabled the `browser devtool` config for **Redux** automatically. To make it work, you need to download the [extension](https://github.com/zalmoxisus/redux-devtools-extension) for your browser.

You can also choose `Customized DevTools` that built in your page. With this you can customized your own devtool. Click [here](https://github.com/gaearon/redux-devtools) to see more options.

### Production

The production files built for server, so you are not supposed to visit `index.html` directly. To make it works, you may need a static server:
```bash
npm install -g serve # or others

# in `./dist`.
serve

# if you enable router
serve -s
```

We use [babel-plugin-transform-react-remove-prop-types](https://www.npmjs.com/package/babel-plugin-transform-react-remove-prop-types) to remove PropType from production bundle.

### bundle-analyzer

We analyze the bundle content with [webpack-bundle-analyzer](https://github.com/th0r/webpack-bundle-analyzer):

![bundle-analyzer](/bundle_report.png)

To get this out, please run:

```bash
npm run build --report
```

### Source Map

You can have a better experience on debugging with sourceMap in your development, but we disable it by default in production for others are not supposed to get your source code from the browser. It also can make your building process faster. Feel free to turn it on in `config/index.js: productionSourceMap`.

### Unit test with jest

We provide [jest](http://facebook.github.io/jest/) as the default unit test library for its powerful and convenient apis. We also use [Enzyme](http://airbnb.io/enzyme/index.html) as a helper to make components more testable. All test files should place in `./test/unit/__tests__`. And you need to create the files named `your-js(x)-file.test.js`, or it will not pass in jest. But you can set your own rules in `package.json`.

## Known Issues

* When combine with `react-router v3`, hot-reload will cause browser's error log in `console`. This is `react-router v3`'s known issue, but it doesn't have other side effects. I solve this issue with a random number as a `key` in router, thanks to [@chenz24](https://github.com/chenz24). Noted that there is no such issue with `v4`.

* ~~When combine with `Redux`, hot-reload will cause `<Provider> does not support changing `store` on the fly...` in the console, and break hot-reload in redux.~~

* ~~Because of `eslint-plugin-react@6.10.3` bug,  eslint was not able to work for now.~~

## Reference

* [vue-cli/webpack](https://github.com/vuejs-templates/webpack)


text:
package com.sachin.cloudy.web.rest.controllers;

import com.sachin.cloudy.services.services.OTPService;
import com.sachin.cloudy.services.services.UserService;
import com.sachin.cloudy.web.constants.CloudyWebConstants.URLS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by sachinhooda on 31/8/17.
 */
@RestController
@RequestMapping(value = URLS.URL_BASE)
public class OTPController {

    private UserService userService;

    private OTPService otpService;

    @Autowired
    public OTPController(UserService userService, OTPService otpService) {
        this.userService = userService;
        this.otpService = otpService;
    }
}


text:
/**
 * @author Camille Reynders
 */
(function( root,
           factory ){
    /*
     AMD/CommonJS compatibility largely stolen from https://github.com/kriskowal/q/blob/master/q.js
     */
    // Turn off strict mode for this function so we can assign to global.dijon
    /*jshint strict: false, -W117*/

    // This file will function properly as a


text:
<!doctype html>

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

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

Preparing search index...

The search index is not available

					parse5

						Options

								All

Public

Public/Protected

All

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

					Menu

					Globals

					AST

					HtmlParser2

Module HtmlParser2

Index

Interfaces

Comment<wbr>Node

Document

Document<wbr>Fragment

Document<wbr>Type

Element

Node

Parent<wbr>Node

Text<wbr>Node

						Globals

						AST

						AST.<wbr>Default

						AST.<wbr>Html<wbr>Parser2

						Markup<wbr>Data

						Options

						Comment<wbr>Node

						Document

						Document<wbr>Fragment

						Document<wbr>Type

						Element

						Node

						Parent<wbr>Node

						Text<wbr>Node

Legend

Module

Object literal

Variable

Function

Function with type parameter

Index signature

Type alias

Enumeration

Enumeration member

Property

Method

Interface

Interface with type parameter

Constructor

Property

Method

Index signature

Class

Class with type parameter

Constructor

Property

Method

Accessor

Index signature

Inherited constructor

Inherited property

Inherited method

Inherited accessor

Protected property

Protected method

Protected accessor

Private property

Private method

Private accessor

Static property

Static method

Generated using TypeDoc


text:
package com.alibaba.druid.bvt.proxy;

import java.io.Closeable;
import java.io.IOException;
import java.io.Reader;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.util.concurrent.atomic.AtomicInteger;

import junit.framework.TestCase;

import org.junit.Assert;

import com.alibaba.druid.mock.MockConnection;
import com.alibaba.druid.mock.MockResultSet;
import com.alibaba.druid.mock.MockResultSetMetaData;
import com.alibaba.druid.mock.MockStatement;
import com.alibaba.druid.proxy.DruidDriver;
import com.alibaba.druid.stat.JdbcStatManager;
import com.alibaba.druid.util.Utils;
import com.alibaba.druid.util.JdbcUtils;

public class JdbcUtilsTest extends TestCase {
    protected void tearDown() throws Exception {
        DruidDriver.getProxyDataSources().clear();
        Assert.assertEquals(0, JdbcStatManager.getInstance().getSqlList().size());
    }

    public void test_print() throws Exception {
        final AtomicInteger nextCount = new AtomicInteger(2);

        final MockResultSetMetaData rsMeta = new MockResultSetMetaData() {

            private int[] types = new int[] { Types.DATE, Types.BIT, Types.BOOLEAN, Types.TINYINT,

                                Types.SMALLINT, Types.INTEGER, Types.CLOB, Types.LONGVARCHAR, Types.OTHER,

                                Types.VARCHAR, Types.CHAR, Types.NVARCHAR, Types.NCHAR

                                };

            @Override
            public int getColumnCount() throws SQLException {
                return types.length;
            }

            @Override
            public int getColumnType(int column) throws SQLException {
                return types[column - 1];
            }

            @Override
            public String getColumnName(int column) throws SQLException {
                return "C" + column;
            }
        };

        MockResultSet rs = new MockResultSet(null) {

            @Override
            public boolean next() throws SQLException {
                return nextCount.getAndDecrement() > 0;
            }

            @Override
            public ResultSetMetaData getMetaData() throws SQLException {
                return rsMeta;
            }

            @Override
            public java.sql.Date getDate(int columnIndex) throws SQLException {
                return new java.sql.Date(System.currentTimeMillis());
            }

            @Override
            public boolean wasNull() throws SQLException {
                if (nextCount.get() == 1) {
                    return true;
                }
                return false;
            }

            public Object getObject(int columnIndex) throws SQLException {
                return null;
            }
        };

        JdbcUtils.printResultSet(rs);
    }

    public void test_close() throws Exception {
        JdbcUtils.close((Connection) null);
        JdbcUtils.close((Statement) null);
        JdbcUtils.close((ResultSet) null);

        JdbcUtils.close(new MockConnection() {

            @Override
            public void close() throws SQLException {
                throw new SQLException();
            }
        });
        JdbcUtils.close(new MockStatement(null) {

            @Override
            public void close() throws SQLException {
                throw new SQLException();
            }
        });
        JdbcUtils.close(new MockResultSet(null) {

            @Override
            public void close() throws SQLException {
                throw new SQLException();
            }
        });
        JdbcUtils.close(new Closeable() {

            @Override
            public void close() throws IOException {
                throw new IOException();
            }
        });
        JdbcUtils.close(new Closeable() {

            @Override
            public void close() throws IOException {
            }
        });
        JdbcUtils.close((Closeable) null);

        new JdbcUtils();
    }

    public void test_getTypeName() {
        JdbcUtils.getTypeName(Types.ARRAY);
        JdbcUtils.getTypeName(Types.BIGINT);
        JdbcUtils.getTypeName(Types.BINARY);
        JdbcUtils.getTypeName(Types.BIT);
        JdbcUtils.getTypeName(Types.BLOB);
        JdbcUtils.getTypeName(Types.BOOLEAN);
        JdbcUtils.getTypeName(Types.CHAR);
        JdbcUtils.getTypeName(Types.CLOB);
        JdbcUtils.getTypeName(Types.DATALINK);
        JdbcUtils.getTypeName(Types.DATE);
        JdbcUtils.getTypeName(Types.DECIMAL);
        JdbcUtils.getTypeName(Types.DISTINCT);
        JdbcUtils.getTypeName(Types.DOUBLE);
        JdbcUtils.getTypeName(Types.FLOAT);
        JdbcUtils.getTypeName(Types.INTEGER);
        JdbcUtils.getTypeName(Types.JAVA_OBJECT);
        JdbcUtils.getTypeName(Types.LONGNVARCHAR);
        JdbcUtils.getTypeName(Types.LONGVARBINARY);
        JdbcUtils.getTypeName(Types.NCHAR);
        JdbcUtils.getTypeName(Types.NCLOB);
        JdbcUtils.getTypeName(Types.NULL);
        JdbcUtils.getTypeName(Types.NUMERIC);
        JdbcUtils.getTypeName(Types.NVARCHAR);
        JdbcUtils.getTypeName(Types.REAL);
        JdbcUtils.getTypeName(Types.REF);
        JdbcUtils.getTypeName(Types.ROWID);
        JdbcUtils.getTypeName(Types.SMALLINT);
        JdbcUtils.getTypeName(Types.SQLXML);
        JdbcUtils.getTypeName(Types.STRUCT);
        JdbcUtils.getTypeName(Types.TIME);
        JdbcUtils.getTypeName(Types.TIMESTAMP);
        JdbcUtils.getTypeName(Types.TINYINT);
        JdbcUtils.getTypeName(Types.VARBINARY);
        JdbcUtils.getTypeName(Types.VARCHAR);
        JdbcUtils.getTypeName(Types.OTHER);
    }

    public void test_read() throws Exception {
        {
            Exception error = null;
            try {
                Utils.read(new Reader() {

                    @Override
                    public int read(char[] cbuf, int off, int len) throws IOException {
                        throw new IOException();
                    }

                    @Override
                    public void close() throws IOException {
                        throw new IOException();
                    }

                });
            } catch (RuntimeException ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }
        {
            Exception error = null;
            try {
                Utils.read(new Reader() {

                    @Override
                    public int read(char[] cbuf, int off, int len) throws IOException {
                        throw new IOException();
                    }

                    @Override
                    public void close() throws IOException {
                        throw new IOException();
                    }

                }, 0);
            } catch (RuntimeException ex) {
                error = ex;
            }
            Assert.assertNotNull(error);
        }

        {
            String text = Utils.read(new Reader() {

                @Override
                public int read(char[] cbuf, int off, int len) throws IOException {
                    return -1;
                }

                @Override
                public void close() throws IOException {
                    throw new IOException();
                }

            }, 1);
            Assert.assertEquals("", text);
        }
        {
            String text = Utils.read(new Reader() {

                @Override
                public int read(char[] cbuf, int off, int len) throws IOException {
                    for (int i = off; i < len; ++i) {
                        cbuf[i] = 'A';
                    }
                    return len;
                }

                @Override
                public void close() throws IOException {
                    throw new IOException();
                }

            }, 2);
            Assert.assertEquals("AA", text);
        }
        {
            Reader reader = new Reader() {

                @Override
                public int read(char[] cbuf, int off, int len) throws IOException {
                    cbuf[off] = 'A';
                    return 1;
                }

                @Override
                public void close() throws IOException {
                    throw new IOException();
                }

            };
            String text = Utils.read(reader, 2);
            Assert.assertEquals("AA", text);
        }
    }

}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>JSDoc: Source: edge_tile.js</title>

    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">

Source: edge_tile.js

var Tile = require('./tile'),
    inherits = require('util').inherits;

/**
 * The EdgeTile class
 * @constructor
 * @param {VertexTile} start - Vertex on one side of the edge
 * @param {VertexTile} end - Vertex on the other side of the edge
 * @extends {Tile}
*/
function EdgeTile(start, end) {
  Tile.call(this);
  this.startVertex = start;
  this.endVertex = end;
}

inherits(EdgeTile, Tile);

module.exports = EdgeTile;

Home

Classes

ArrayBoard

Board

Card

Component

Deck

EdgeTile

Game

GridBoard

Player

Tile

Token

Trade

VertexTile

View

    Documentation generated by JSDoc 3.3.3 on Thu Jan 21 2016 20:55:21 GMT-0500 (EST)


text:
template<typename R>
struct Log : StaticInterface<Log<R> >, UnaryOperation<R> {
    using UnaryOperation<R>::Right;

    INLINE_MODE
    Log(const R& right) :
        UnaryOperation<R> (right, log(right.Value)) {}

    template<unsigned GradLevel, typename T>INLINE_MODE
    void Gradient(real gradData[], unsigned index, const unsigned baseCount, const T& gradient) const {
        Right. template Gradient<GradLevel> (gradData, index, baseCount, gradient / Right);
    }

    INLINE_MODE
    void Gradient(real gradData[], unsigned index, const unsigned baseCount, const real& gradient) const {
        Right.Gradient(gradData, index, baseCount, gradient / Right.Value);
    }
};

template<typename R>INLINE_MODE
const Log<R> log(const StaticInterface<R>& right) {
    return Log<R> (right.Self());
}

#endif  // LOG_H


text:
happyLeaf.directive('highlightOnChange', function() {
  return {
    link : function(scope, element, attrs) {
      attrs.$observe( 'highlightOnChange', function ( val ) {
        $(element).addClass('highlight');
        setTimeout(function(){
          $(element).removeClass('highlight');
        }, 800);
      });
    }
  };
});


text:
package org.eknet.wicket.commons.textstore;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * The persist service for {@link TextNode}s.
 *

 * The idea is, that {@link TextNode}s itself are responsible for persisting its
 * values they receive. So this interface lacks a {@code saveNode()} method.
 *
 * @author Eike Kettner
 * @since 17.12.11 14:40
 */
public interface TextNodeStore {

  /**
   * Creates a new {@link TextNode} using a generated unique id.
   *
   * @return
   */
  @NotNull
  TextNode createTextNode();

  /**
   * Creates a new {@link TextNode} using the supplied id. It
   * must check for duplicate ids.
   *
   * @param id
   * @return
   */
  @NotNull
  TextNode createTextNode(@NotNull String id);

  /**
   * Either returns a {@link TextNode} from the underlying store,
   * or creates a new one using the supplied id.
   *
   * @param id
   * @return
   */
  @NotNull
  TextNode getOrCreateNode(@NotNull String id);

  /**
   * Returns a available {@link TextNode} of the supplied id from
   * the store or {@code null} if none is found.
   * @param id
   * @return
   */
  @Nullable
  TextNode getTextNode(@NotNull String id);

  /**
   * Returns a available {@link TextNode} of the supplied id from
   * the store or throws an exception if none is found.
   *
   * @param id
   * @return
   */
  @NotNull
  TextNode requireTextNode(@NotNull String id);

}


text:
<project name="TextMangler" default="dist" basedir=".">

<!-- This is the Ant build script for the TextMangler tool.
     Written using Ant 1.6.1 (http://ant.apache.org/).
-->

  <property name="app.name"       value="textmangler"/>
  <property name="src.dir"        value="src"/>
  <property name="deploy.home"    value="./classes"/>
  <property name="dist.jar"       value="${app.name}.jar"/>
  <property name="javadoc.home"   value="./docs"/>

  <!-- Create the output directories for the classes and javadocs -->
  <target name="prepare" description="Create classes and javadocs directories">
    <mkdir  dir="${deploy.home}"/>
  </target>

  <!-- Delete the output directories for the classes and javadocs -->
  <target name="clean" description="Delete classes and javadocs directories">
    <delete dir="${javadoc.home}"/>
    <delete dir="${deploy.home}"/>
  </target>

  <!-- Compile the source code (in 'src') and store in 'classes' -->
  <target name="compile" depends="prepare" description="Compile the source code">
    <javac srcdir="${src.dir}" destdir="${deploy.home}"
           classpath="${deploy.home}" target="1.5" source="1.5"
    	   includeantruntime="false"
           debug="off" optimize="off" deprecation="off"/>
  </target>

  <!-- Generate the javadocs for the source code -->
  <target name="javadoc" description="Generate javadocs">
    <mkdir  dir="${javadoc.home}"/>
    <javadoc sourcepath="${src.dir}" packagenames="*"
             destdir="${javadoc.home}"/>
  </target>

  <!-- Generate the jar file -->
  <target name="dist" depends="compile" description="Generate the jar file">
    <jar destfile="./${dist.jar}">
      <fileset dir="${deploy.home}"/>
      <manifest>
        <attribute name="Built-By" value="Mike Wallace"/>
        <attribute name="Main-Class" value="io.miti.textmangler.TextMangler"/>
      </manifest>
    </jar>
  </target>

  <!-- Delete the generated class files and compile all of the code -->
  <target name="all" depends="clean,prepare,compile,javadoc"
          description="Run the clean, prepare, compile and javadoc targets"/>

  <!-- Generate the zip file for the app -->
  <target name="zipapp" depends="dist" description="Generate the zip file">
    <zip basedir="." destfile="./${app.name}.zip"
    includes="${dist.jar}, mangler.html, mangler.ini" />
  </target>

  <!-- Generate the source zip file -->
  <target name="zipsource" depends="compile" description="Generate the source zip file">
    <zip basedir="." destfile="./${app.name}-src.zip"
     includes="build.xml, mangler.ini, mangler.html, ${src.dir}/**" />
  </target>
</project>


text:
require 'spec_helper_acceptance'

describe 'mongodb::server class' do

  shared_examples 'normal tests' do |tengen|
    if tengen
      case fact('osfamily')
      when 'RedHat'
        package_name = 'mongodb-org-server'
        service_name = 'mongod'
        config_file  = '/etc/mongod.conf'
      when 'Debian'
        package_name = 'mongodb-org-server'
        service_name = 'mongod'
        config_file  = '/etc/mongod.conf'
      end
    else
      case fact('osfamily')
      when 'RedHat'
        package_name = 'mongodb-server'
        service_name = 'mongod'
        config_file  = '/etc/mongodb.conf'
      when 'Debian'
        package_name = 'mongodb-server'
        service_name = 'mongodb'
        config_file  = '/etc/mongodb.conf'
      end
    end

    client_name  = 'mongo --version'

    context "default parameters with 10gen => #{tengen}" do
      after :all do
        if tengen
          puts "XXX uninstalls mongodb because changing the port with tengen doesn't work because they have a crappy init script"
          pp = <<-EOS
            class {'mongodb::globals': manage_package_repo => #{tengen}, }
            -> class { 'mongodb::server':
                 ensure => absent,
                 package_ensure => absent,
                 service_ensure => stopped,
                 service_enable => false
               }
            -> class { 'mongodb::client': ensure => absent, }
          EOS
          apply_manifest(pp, :catch_failures => true)
        end
      end

      it 'should work with no errors' do
        pp = <<-EOS
          class { 'mongodb::globals': manage_package_repo => #{tengen}, }
          -> class { 'mongodb::server': }
          -> class { 'mongodb::client': }
        EOS

        apply_manifest(pp, :catch_failures => true)
        apply_manifest(pp, :catch_changes  => true)
      end

      describe package(package_name) do
        it { is_expected.to be_installed }
      end

      describe file(config_file) do
        it { is_expected.to be_file }
      end

      describe service(service_name) do
         it { is_expected.to be_enabled }
         it { is_expected.to be_running }
      end

      describe port(27017) do
        it { is_expected.to be_listening }
      end

      describe command(client_name) do
        describe '#exit_status' do
          subject { super().exit_status }
          it { is_expected.to eq 0 }
        end
      end
    end

    context "test using custom port and 10gen => #{tengen}" do
      it 'change port to 27018' do
        pp = <<-EOS
          class { 'mongodb::globals': manage_package_repo => #{tengen}, }
          -> class { 'mongodb::server': port => 27018, }
          -> class { 'mongodb::client': }
        EOS

        apply_manifest(pp, :catch_failures => true)
        apply_manifest(pp, :catch_changes  => true)
      end

      describe port(27018) do
        it { is_expected.to be_listening }
      end
    end

    describe "uninstalling with 10gen => #{tengen}" do
      it 'uninstalls mongodb' do
        pp = <<-EOS
          class {'mongodb::globals': manage_package_repo => #{tengen}, }
          -> class { 'mongodb::server':
               ensure => absent,
               package_ensure => absent,
               service_ensure => stopped,
               service_enable => false
             }
          -> class { 'mongodb::client': ensure => absent, }
        EOS
        apply_manifest(pp, :catch_failures => true)
      end
    end
  end

  it_behaves_like 'normal tests', false
  it_behaves_like 'normal tests', true
end


text:
"""Utilities for dealing with service resources."""

from googlecloudsdk.api_lib.app import operations_util
from googlecloudsdk.calliope import exceptions as calliope_exceptions
from googlecloudsdk.core import exceptions
from googlecloudsdk.core.console import progress_tracker
from googlecloudsdk.core.util import text

class ServiceValidationError(exceptions.Error):
  pass

class ServicesDeleteError(exceptions.Error):
  pass

class ServicesNotFoundError(exceptions.Error):

  @classmethod
  def FromServiceLists(cls, requested_services, all_services):
    """Format a ServiceNotFoundError.

    Args:
      requested_services: list of str, IDs of services that were not found.
      all_services: list of str, IDs of all available services

    Returns:
      ServicesNotFoundError, error with properly formatted message
    """
    return cls(
        'The following {0} not found: [{1}]\n\n'
        'All services: [{2}]'.format(
            text.Pluralize(len(requested_services), 'service was',
                           plural='services were'),
            ', '.join(requested_services),
            ', '.join(all_services)))

class ServicesSplitTrafficError(exceptions.Error):
  pass

class Service(object):
  """Value class representing a service resource."""

  def __init__(self, project, id_, split=None):
    self.project = project
    self.id = id_
    self.split = split or {}

  def __eq__(self, other):
    return (type(other) is Service and
            self.project == other.project and self.id == other.id)

  def __ne__(self, other):
    return not self == other

  @classmethod
  def FromResourcePath(cls, path):
    parts = path.split('/')
    if len(parts) != 2:
      raise ServiceValidationError('[{0}] is not a valid resource path. '
                                   'Expected <project>/<service>.')
    return cls(*parts)

  # TODO(b/25662075): convert to use functools.total_ordering
  def __lt__(self, other):
    return (self.project, self.id) < (other.project, other.id)

  def __le__(self, other):
    return (self.project, self.id) <= (other.project, other.id)

  def __gt__(self, other):
    return (self.project, self.id) > (other.project, other.id)

  def __ge__(self, other):
    return (self.project, self.id) >= (other.project, other.id)

  def __repr__(self):
    return '{0}/{1}'.format(self.project, self.id)

def _ValidateServicesAreSubset(filtered_services, all_services):
  not_found_services = set(filtered_services) - set(all_services)
  if not_found_services:
    raise ServicesNotFoundError.FromServiceLists(not_found_services,
                                                 all_services)

def GetMatchingServices(all_services, args_services):
  """Return a list of services to act on based on user arguments.

  Args:
    all_services: list of Service representing all services in the project.
    args_services: list of string, service IDs to filter for.
      If empty, match all services.

  Returns:
    list of matching Service

  Raises:
    ServiceValidationError: If an improper combination of arguments is given
  """
  if not args_services:
    args_services = [s.id for s in all_services]
  _ValidateServicesAreSubset(args_services, [s.id for s in all_services])
  return [s for s in all_services if s.id in args_services]

def ParseTrafficAllocations(args_allocations, split_method):
  """Parses the user-supplied allocations into a format acceptable by the API.

  Args:
    args_allocations: The raw allocations passed on the command line. A dict
      mapping version_id (str) to the allocation (float).
    split_method: Whether the traffic will be split by ip or cookie. This
      affects the format we specify the splits in.

  Returns:
    A dict mapping version id (str) to traffic split (float).

  Raises:
    ServicesSplitTrafficError: if the sum of traffic allocations is zero.
  """
  # Splitting by IP allows 2 decimal places, splitting by cookie allows 3.
  max_decimal_places = 2 if split_method == 'ip' else 3
  sum_of_splits = sum([float(s) for s in args_allocations.values()])
  if sum_of_splits < 10 ** -max_decimal_places:
    raise ServicesSplitTrafficError(
        'Cannot set traffic split to zero. If you would like a version to '
        'receive no traffic, send 100% of traffic to other versions or delete '
        'the service.')

  allocations = {}
  for version, split in args_allocations.iteritems():
    allocation = float(split) / sum_of_splits
    allocation = round(allocation, max_decimal_places)
    allocations[version] = allocation

  # The API requires that these sum to 1.0. This is hard to get exactly correct,
  # (think .33, .33, .33) so we take our difference and subtract it from a
  # random element.
  total_splits = sum(allocations.values())
  difference = total_splits - 1.0

  allocations[sorted(allocations.keys())[0]] -= difference
  return allocations

def DeleteServices(api_client, services):
  """Delete the given services."""
  errors = {}
  for service in services:
    try:
      with progress_tracker.ProgressTracker(
          'Deleting [{0}]'.format(service.id)):
        api_client.DeleteService(service.id)
    except (calliope_exceptions.HttpException, operations_util.OperationError,
            operations_util.OperationTimeoutError) as err:
      errors[service.id] = str(err)

  if errors:
    printable_errors = {}
    for service_id, error_msg in errors.items():
      printable_errors[service_id] = '[{0}]: {1}'.format(service_id,
                                                         error_msg)
    raise ServicesDeleteError(
        'Issue deleting {0}: [{1}]\n\n'.format(
            text.Pluralize(len(printable_errors), 'service'),
            ', '.join(printable_errors.keys())) +
        '\n\n'.join(printable_errors.values()))


text:
using System.Collections.Generic;
using NUnit.Framework;
using Sqloogle.Libs.Rhino.Etl.Core;
using Sqloogle.Operations;
using Sqloogle.Operations.Support;

namespace Tests {
    [TestFixture]
    public class TestSqloogleCompare : EtlProcessHelper {

        [Test]
        public void Test1() {

            //"use", "lastused", "modified", "count", "created", "name", "server", "database", "schema", "dropped"
            var fresh = new FakeOperation(
                new List<Row> {
                    new Row {{"id", 1}, {"use", "old1"}, {"lastused", ""}, {"modified", "old2"}, {"count", ""}, {"created",""}, {"name",""}, {"server",""}, {"database",""}, {"schema",""},{"dropped",false}},
                    new Row {{"id", 2}, {"use", "old1"}, {"lastused", ""}, {"modified", "same"}, {"count", "3"}, {"created",""}, {"name",""}, {"server",""}, {"database",""}, {"schema",""},{"dropped",false}},
                    new Row {{"id", 3}, {"use", "new1"}, {"lastused", ""}, {"modified", "new2"}, {"count", ""}, {"created",""}, {"name",""}, {"server",""}, {"database",""}, {"schema",""},{"dropped",false}}
                }
            );

            var existing = new FakeOperation(
                new List<Row> {
                    new Row {{"id", 1}, {"use", "old1"}, {"lastused", ""}, {"modified", "old2"}, {"count", ""}, {"created",""}, {"name",""}, {"server",""}, {"database",""}, {"schema",""},{"dropped",false}},
                    new Row {{"id", 2}, {"use", "old1"}, {"lastused", ""}, {"modified", "same"}, {"count", "2"}, {"created",""}, {"name",""}, {"server",""}, {"database",""}, {"schema",""},{"dropped",false}},
                    new Row {{"id", 4}, {"use", "old1"}, {"lastused", ""}, {"modified", "old2"}, {"count", ""}, {"created",""}, {"name",""}, {"server",""}, {"database",""}, {"schema",""},{"dropped",false}}
                }
            );

            var results = TestOperation(
                new SqloogleCompare().Left(fresh).Right(existing)
                ,new LogOperation()
            );

            Assert.AreEqual(4, results.Count, "It's a full outer join, we should have all 4 rows!");
            Assert.AreEqual("None", results[0]["Action"], "These rows are the same; should be None!");
            Assert.AreEqual("Update", results[1]["Action"], "There is an updated property; should be Update!");
            Assert.AreEqual("Create", results[2]["Action"], "This has never been seen before; should be Create!");
            Assert.AreEqual("Update", results[3]["Action"], "This is gone! should be an Update!");
            Assert.AreEqual(true, results[3]["Dropped"], "We don't delete drops, we mark them as dropped!");

        }
    }
}