text:
package com.diegoschivo.samples.iterators;

import java.util.Comparator;
import java.util.Iterator;
import java.util.NoSuchElementException;

public class GroupingIterator<T> implements Iterator<Iterator<T>>
{

    private LookAheadIterator<T> lai;

    private Comparator<T> comparator;

    private boolean groupRead;

    private Iterator<T> group;

    private boolean exausted;

    public GroupingIterator(Iterator<T> iterator, Comparator<T> comparator)
    {
        lai = new LookAheadIterator<T>(iterator);
        this.comparator = comparator;
    }

    public boolean hasNext()
    {
        if (!exausted && !groupRead)
        {
            if (group != null)
            {
                while (group.hasNext())
                {
                    group.next();
                }
            }
            exausted = !lai.hasNext();
            if (!exausted)
            {
                group = new Iterator<T>()
                {

                    private boolean started;

                    private boolean itemRead;

                    private T item;

                    private T previousItem;

                    private boolean finished;

                    public boolean hasNext()
                    {
                        if (!finished && !itemRead)
                        {
                            finished = !lai.hasNext();
                            if (!finished && (!started || comparator.compare(lai.lookAhead(), previousItem) == 0))
                            {
                                item = lai.next();
                                itemRead = true;
                            }
                            else
                            {
                                finished = true;
                            }
                            started = true;
                        }
                        return !finished;
                    }

                    public T next()
                    {
                        if (hasNext())
                        {
                            itemRead = false;
                            return (previousItem = item);
                        }
                        else
                        {
                            throw new NoSuchElementException();
                        }
                    }

                    public void remove()
                    {
                        throw new UnsupportedOperationException();
                    }
                };
                groupRead = true;
            }
        }
        return !exausted;
    }

    public Iterator<T> next()
    {
        if (hasNext())
        {
            groupRead = false;
            return group;
        }
        else
        {
            throw new NoSuchElementException();
        }
    }

    public void remove()
    {
        throw new UnsupportedOperationException();
    }
}


text:
<?php

namespace Quice\Image;

class Thumb
{

    public function getSize($image)
    {
        $imgData = @getimagesize($image);
        if (!$imgData) {
            throw new Exception('Load Image Fail');
        }

        $data = array();
        $data['width'] = $imgData[0];
        $data['height'] = $imgData[1];
        $data['mime'] = $imgData['mime'];
        return $data;
    }

    public function load($image, $mime)
    {
        $imgLoaders = array(
            'image/jpeg' => 'imagecreatefromjpeg', 'image/pjpeg' => 'imagecreatefromjpeg',
            'image/png' => 'imagecreatefrompng', 'image/gif' => 'imagecreatefromgif',
        );
        if (!in_array($mime, array_keys($imgLoaders))) {
            throw new Exception('Image Mime Type Not Supported');
        }
        $loader = $imgLoaders[$mime];
        $source = $loader($image);
        return $source;
    }

    public function thumb($source, $thumbDest, $sourceSize, $targetSize, $scale = true, $inflate = true, $quality = 75)
    {
        // set var
        $sourceWidth = $sourceSize['width'];
        $sourceHeight = $sourceSize['height'];
        $sourceMime = $sourceSize['mime'];

        $targetWidth = $targetSize['width'];
        $targetHeight = $targetSize['height'];
        $targetMime = $targetSize['mime'];
        $cropX = 0;
        $cropY = 0;

        // cal size
        if ($targetWidth > 0) {
            $ratioWidth = $targetWidth / $sourceWidth;
        }
        if ($targetHeight > 0) {
            $ratioHeight = $targetHeight / $sourceHeight;
        }
        if ($scale) {
            if ($targetWidth && $targetHeight) {
                $ratio = ($ratioWidth < $ratioHeight) ? $ratioWidth : $ratioHeight;
            }
            if ($targetWidth xor $targetHeight) {
                $ratio = (isset($ratioWidth)) ? $ratioWidth : $ratioHeight;
            }
            if ((!$targetWidth && !$targetHeight) || (!$inflate && $ratio > 1)) {
                $ratio = 1;
            }

            $thumbWidth = floor($ratio * $sourceWidth);
            $thumbHeight = ceil($ratio * $sourceHeight);
            $targetHeight = $thumbHeight;
        } else {
            if ($sourceWidth > $sourceHeight) { //landscape from here new
                $thumbWidth = round($sourceWidth * $ratioHeight);
                $thumbHeight = $targetHeight;
                $cropX = ceil(($sourceWidth - $sourceHeight) / 2);
                $cropY = 0;
            } elseif ($sourceWidth < $sourceHeight) { //portrait
                $thumbHeight = round($sourceHeight * $ratioWidth);
                $thumbWidth = $targetWidth;
                $cropX = 0;
                $cropY = ceil(($sourceHeight - $sourceWidth) / 2);
            } else { //square
                $thumbWidth = $targetWidth;
                $thumbHeight = $targetHeight;
                $cropX = 0;
                $cropY = 0;
            }
        }
        if(empty($targetWidth)) {
            $targetWidth = $thumbWidth;
        }
        if(empty($targetHeight)) {
            $targetHeight = $thumbHeight;
        }

        // create image
        $thumb = imagecreatetruecolor($targetWidth, $targetHeight);
        if ($sourceWidth == $targetWidth && $sourceHeight == $targetHeight) {
            $thumb = $source;
        } else {
            imagecopyresampled($thumb, $source, 0, 0, $cropX, $cropY,
                $thumbWidth, $thumbHeight, $sourceWidth, $sourceHeight
            );
        }

        // generate thumb
        $imgCreators = array(
            'image/jpeg' => 'imagejpeg', 'image/pjpeg' => 'imagejpeg',
            'image/png' => 'imagepng', 'image/gif' => 'imagegif',
        );
        if($targetMime !== null) {
            $creator = $imgCreators[$targetMime];
        } else {
            $creator = $imgCreators[$sourceMime];
        }

        if ($creator == 'imagejpeg') {
            imagejpeg($thumb, $thumbDest, $quality);
        } else {
            $creator($thumb, $thumbDest);
        }
    }

    public function destroy($image)
    {
        // Free up memory
        imagedestroy($image);
    }

}

redpajama_set_name: RedPajamaGithub


text:
import React from 'react'
import { Dimmer, Image, Segment } from 'shengnian-ui-react'

const DimmerExampleActive = () => (
  <Segment>
    <Dimmer active />

      <Image src='/assets/images/wireframe/short-paragraph.png' />

      <Image src='/assets/images/wireframe/short-paragraph.png' />

  </Segment>
)

export default DimmerExampleActive


text:
using System.Configuration;

namespace Umbraco.Core.Configuration.InfrastructureSettings
{
    public class Infrastructure : ConfigurationSection
    {
        private const string InfrastructureSectionName = "umbraco/infrastructure";

        public static Infrastructure Instance
        {
            get { return (Infrastructure) ConfigurationManager.GetSection(InfrastructureSectionName); }
        }

        #region RepositoriesSection Property

        internal const string RepositoriesPropertyName = "repositories";

        [ConfigurationProperty(RepositoriesPropertyName, IsRequired = true, IsKey = false, IsDefaultCollection = false)]
        public Repositories Repositories
        {
            get { return ((Repositories)base[RepositoriesPropertyName]); }
            set { base[RepositoriesPropertyName] = value; }
        }

        #endregion

        #region PublishingStrategy Property

        internal const string PublishingStrategyPropertyName = "publishingStrategy";

        [ConfigurationProperty(PublishingStrategyPropertyName, IsRequired = true, IsKey = false, IsDefaultCollection = false)]
        public PublishingProvider PublishingStrategy
        {
            get { return ((PublishingProvider)base[PublishingStrategyPropertyName]); }
            set { base[PublishingStrategyPropertyName] = value; }
        }

        #endregion
    }

    public class Repositories : ConfigurationElement
    {
        [ConfigurationProperty("", IsDefaultCollection = true, IsRequired = true)]
        public RepositoryElementCollection Repository
        {
            get { return ((RepositoryElementCollection)(base[""])); }
        }
    }

    [ConfigurationCollection(typeof(Repository), CollectionType = ConfigurationElementCollectionType.BasicMapAlternate, AddItemName = RepositoryPropertyName)]
    public class RepositoryElementCollection : ConfigurationElementCollection
    {
        internal const string RepositoryPropertyName = "repository";

        public override ConfigurationElementCollectionType CollectionType
        {
            get
            {
                return ConfigurationElementCollectionType.BasicMapAlternate;
            }
        }

        protected override string ElementName
        {
            get
            {
                return RepositoryPropertyName;
            }
        }

        protected override bool IsElementName(string elementName)
        {
            return elementName == RepositoryPropertyName;
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((Repository)element).InterfaceShortTypeName;
        }

        protected override ConfigurationElement CreateNewElement()
        {
            return new Repository();
        }

        #region Indexer

        public Repository this[int index]
        {
            get { return (Repository)base.BaseGet(index); }
        }

        public Repository this[string interfaceShortTypeName]
        {
            get { return (Repository)base.BaseGet(interfaceShortTypeName); }
        }

        #endregion

        #region Add

        public void Add(Repository repository)
        {
            BaseAdd(repository);
        }

        #endregion

        #region Remove

        public void Remove(Repository repository)
        {
            BaseRemove(repository);
        }

        #endregion

        #region GetItem

        public Repository GetItemAt(int index)
        {
            return (Repository)BaseGet(index);
        }

        public Repository GetItemByKey(string interfaceShortTypeName)
        {
            return (Repository)BaseGet(interfaceShortTypeName);
        }

        #endregion

        public bool ContainsKey(string interfaceShortName)
        {
            bool result = false;
            object[] keys = this.BaseGetAllKeys();
            foreach (object key in keys)
            {
                if ((string)key == interfaceShortName)
                {
                    result = true;
                    break;

                }
            }
            return result;
        }
    }

    public class Repository : ConfigurationElement
    {
        internal const string InterfaceShortTypeNamePropertyName = "interfaceShortTypeName";

        [ConfigurationPropertyAttribute(InterfaceShortTypeNamePropertyName, IsRequired = true, IsKey = true, IsDefaultCollection = false)]
        public string InterfaceShortTypeName
        {
            get { return (string) base[InterfaceShortTypeNamePropertyName]; }
            set { base[InterfaceShortTypeNamePropertyName] = value; }
        }

        internal const string RepositoryFullTypeNamePropertyName = "repositoryFullTypeName";

        [ConfigurationPropertyAttribute(RepositoryFullTypeNamePropertyName, IsRequired = true, IsKey = false, IsDefaultCollection = false)]
        public string RepositoryFullTypeName
        {
            get { return (string)base[RepositoryFullTypeNamePropertyName]; }
            set { base[RepositoryFullTypeNamePropertyName] = value; }
        }

        internal const string CacheProviderFullTypeNamePropertyName = "cacheProviderFullTypeName";

        [ConfigurationPropertyAttribute(CacheProviderFullTypeNamePropertyName, IsRequired = true, IsKey = false, IsDefaultCollection = false)]
        public string CacheProviderFullTypeName
        {
            get { return (string)base[CacheProviderFullTypeNamePropertyName]; }
            set { base[CacheProviderFullTypeNamePropertyName] = value; }
        }
    }

    public class PublishingProvider : ConfigurationElement
    {
        internal const string TypePropertyName = "type";

        [ConfigurationPropertyAttribute(TypePropertyName, IsRequired = true, IsKey = false, IsDefaultCollection = false)]
        public string Type
        {
            get { return (string)base[TypePropertyName]; }
            set { base[TypePropertyName] = value; }
        }
    }
}


text:
<?php

namespace Eulogix\Cool\Bundle\CoreBundle\Resources\snippets;

use Eulogix\Cool\Lib\Form\DSCRUDForm;
use Eulogix\Cool\Lib\Form\FormInterface;
use Eulogix\Cool\Lib\Widget\WidgetInterface;

use Eulogix\Cool\Lib\Annotation\SnippetMeta;

class FormSnippets
{
    /**
     * @SnippetMeta(category="form_action", contextIgnore={"widget"}, directInvocation="true", description="Set fields read only")
     *
     * @param FormInterface $widget
     * @param string $fieldNames comma separated list of field names
     */
    public static function setFieldsReadOnly(FormInterface $widget, $fieldNames)
    {
        $fields = explode(',', $fieldNames);
        foreach ($fields as $field) {
            $widget->getField($field)->setReadOnly(true);
        }
    }

    /**
     * @SnippetMeta(category="form_action", contextIgnore={"widget"}, directInvocation="true", description="Set fields mandatory")
     *
     * @param FormInterface $widget
     * @param string $fieldNames comma separated list of field names
     */
    public static function setFieldsMandatory(FormInterface $widget, $fieldNames)
    {
        $fields = explode(',', $fieldNames);
        foreach ($fields as $field) {
            $widget->getField($field)->setNotNull();
        }
    }

    /**
     * @SnippetMeta(category="form_action", contextIgnore={"widget"}, directInvocation="true", description="Validate field is GREATER THAN x")
     *
     * @param FormInterface $widget
     * @param string $field the name of the field
     * @param string $value the min value
     */
    public static function validateFieldIsGreaterThanX(FormInterface $widget, $field, $value)
    {
        $widget->getField($field)->setConstraints(\Eulogix\Lib\Validation\ConstraintBuilder::GreaterThan_($value));
    }

    /**
     * @SnippetMeta(category="form_action", contextIgnore={"widget"}, directInvocation="true", description="Validate fields are null")
     *
     * @param FormInterface $widget
     * @param string $fieldNames , separated field names
     */
    public static function validateFieldsAreNull(FormInterface $widget, $fieldNames)
    {
        $fields = explode(',', $fieldNames);
        foreach ($fields as $field) {
            $widget->getField($field)->setConstraints(\Eulogix\Lib\Validation\ConstraintBuilder::Null_());
        }
    }

    /**
     * @SnippetMeta(category="form_action", contextIgnore={"widget"}, directInvocation="true", description="Validate field is NOT in a list of values")
     *
     * @param FormInterface $widget
     * @param string $values , separated list of values
     * @param string $field the field name
     */
    public static function validateFieldIsNotInAListOfValues(FormInterface $widget, $values, $field)
    {
        $values_ = explode(',', $values);
        $widget->getField($field)->setConstraints(\Eulogix\Lib\Validation\ConstraintBuilder::In_($values_));
    }

    /**
     * @SnippetMeta(category="form_action", contextIgnore={"widget"}, directInvocation="true", description="Hide fields")
     *
     * @param FormInterface $widget
     * @param string $fieldNames Comma separated list of fields to hide
     */
    public static function hideField(FormInterface $widget, $fieldNames)
    {
        $_fieldNames = explode(',', $fieldNames);
        foreach($_fieldNames as $fieldName)
            $widget->getField($fieldName)->hide();
    }

    /**
     * @SnippetMeta(category="form_action", contextIgnore={"widget"}, directInvocation="true", description="Set field VALUE")
     *
     * @param FormInterface $widget
     * @param string $fieldName The field name
     * @param string $value the value
     */
    public static function setFieldValue(FormInterface $widget, $fieldName, $value)
    {
        $widget->getField($fieldName)->setValue($value);
    }

    /**
     * @SnippetMeta(category="form_variable", contextIgnore={"widget"}, directInvocation="true", description="Get field VALUE")
     *
     * @param FormInterface $widget
     * @param string $fieldName the field name
     *
     * @return string
     */
    public static function getFieldValue(FormInterface $widget, $fieldName)
    {
        return $widget->getField($fieldName)->getValue();
    }

    /**
     * @SnippetMeta(category="form_variable", contextIgnore={"widget"}, directInvocation="true", description="Is current record NEW ?")
     *
     * @param DSCRUDForm $widget
     *
     * @return bool
     */
    public static function isCurrentRecordNew(DSCRUDForm $widget)
    {
        return $widget->getDSRecord()->isNew();
    }

    /**
     * @SnippetMeta(category="form_variable", contextIgnore={"widget"}, directInvocation="true", description="Field has errors?", longDescription="TRUE if the field has an error (from the validator)")
     *
     * @param FormInterface $widget
     * @param string $fieldName the field name
     *
     * @return bool
     */
    public static function fieldHasErrors(FormInterface $widget, $fieldName)
    {
        return count($widget->getField($fieldName)->getErrors()) > 0;
    }

    /**
     * @SnippetMeta(category="form_action", contextIgnore={"widget"}, directInvocation="true", description="Configure number fields")
     *
     * @param FormInterface $widget
     * @param string $fieldNames comma separated list of field names
     * @param string $to maximum value (optional)
     * @param string $useSlider set to 1 to use a slider
     * @param string $from minimum value (optional)
     */
    public static function setNumberFieldsParameters(FormInterface $widget, $fieldNames, $to, $useSlider, $from)
    {
        $fieldNames_ = explode(',', $fieldNames);

        foreach ($fieldNames_ as $fieldName_) {
            $field = $widget->getField($fieldName_);
            if($field instanceof \Eulogix\Cool\Lib\Form\Field\Number) {
                if ($from !== null) {
                    $field->setFrom(intval($from));
                }
                if ($to !== null) {
                    $field->setTo(intval($to));
                }
                if ($useSlider == '1') {
                    $field->setUseSlider(true);
                }
            }
        }
    }

    /**
     * @SnippetMeta(category="form_action", contextIgnore={"widget"}, directInvocation="true", description="Validate field against regex")
     *
     * @param FormInterface $widget
     * @param string $field the field name
     * @param string $regex the regex
     * @param string $message The error message
     */
    public static function validateFieldAgainstRegex(FormInterface $widget, $field, $regex, $message)
    {
        $widget->getField($field)->setConstraints(\Eulogix\Lib\Validation\ConstraintBuilder::Regex_($regex, $message));
    }

    /**
     * @SnippetMeta(category="form_action", contextIgnore={"widget"}, directInvocation="true", description="Validate field is in list of values")
     *
     * @param FormInterface $widget
     * @param string $values comma separated list of values
     * @param string $field the name of the field
     * @param string $message The error message
     */
    public static function validateFieldIsInListOfValues(FormInterface $widget, $values, $field, $message)
    {
        $values_ = explode(',', $values);
        $widget->getField($field)->setConstraints(\Eulogix\Lib\Validation\ConstraintBuilder::In_($values_, $message));
    }

    /**
     * @SnippetMeta(category="form_action", contextIgnore={"widget"}, directInvocation="true", description="Set control to DATE")
     *
     * @param FormInterface $widget
     * @param string $fieldNames comma separated list of field names
     */
    public static function setControlToDate(FormInterface $widget, $fieldNames)
    {
        $fieldNames_ = explode(',', $fieldNames);

        foreach ($fieldNames_ as $fieldName_) {
            $widget->getField($fieldName_)->setType(\Eulogix\Cool\Lib\Form\Field\FieldInterface::TYPE_DATE);
        }
    }

    /**
     * @SnippetMeta(category="form_variable", contextIgnore={"widget"}, directInvocation="true", description="Get changed fields")
     *
     * @param DSCRUDForm $widget
     *
     * @return array
     */
    public static function getChangedFields(DSCRUDForm $widget)
    {
        return $widget->getChangedFields();
    }

    /**
     * @SnippetMeta(category="form_variable", contextIgnore={"widget"}, directInvocation="true", description="Get original values")
     *
     * @param DSCRUDForm $widget
     *
     * @return array
     */
    public static function getOriginalValues(DSCRUDForm $widget)
    {
        return $widget->getOriginalValues();
    }

    /**
     * @SnippetMeta(category="form_variable", contextIgnore={"widget"}, directInvocation="true", description="Is record just SAVED", longDescription="T/F if the record has been successfully saved")
     *
     * @param DSCRUDForm $widget
     *
     * @return bool
     */
    public static function isRecordJustSaved(DSCRUDForm $widget)
    {
        return $widget->hasEvent(\Eulogix\Cool\Lib\Form\DSCRUDForm::EVENT_RECORD_SAVED);
    }

    /**
     * @SnippetMeta(category="form_variable", contextIgnore={"widget"}, directInvocation="true", description="Is field changed")
     *
     * @param DSCRUDForm $widget
     * @param string $fieldName Field name
     *
     * @return bool
     */
    public static function isFieldChanged(DSCRUDForm $widget, $fieldName)
    {
        return isset( $widget->getChangedFields()[ $fieldName ] );
    }

    /**
     * @SnippetMeta(category="form_variable", contextIgnore={"widget"}, directInvocation="true", description="Get original field VALUE", longDescription="Get original field VALUE (textual or json_encoded)")
     *
     * @param DSCRUDForm $widget
     * @param string $fieldName fieldName
     *
     * @return string
     */
    public static function getOriginalFieldValue(DSCRUDForm $widget, $fieldName)
    {
        $ret = @$widget->getOriginalValues()[ $fieldName ];

        if ($ret instanceof \DateTime) {
            return $ret->format('c');
        }

        if (is_array($ret)) {
            return json_encode($ret);
        }

        return $ret;
    }

    /**
     * @SnippetMeta(category="form_action", contextIgnore={"widget"}, directInvocation="true", description="Set a field to a SELECT with TABLE LOOKUP", longDescription="Transforms a field to a SELECT tied to a TABLE LOOKUP")
     *
     * @param FormInterface $widget
     * @param string $domainName The domain name of the Lookup
     * @param string $fieldName The name of the field to add (or transform)
     */
    public static function setAFieldToASelectWithTableLookup(FormInterface $widget, $domainName, $fieldName)
    {
        $core = \Eulogix\Cool\Lib\Cool::getInstance()->getCoreSchema();
        $mapHash = $core->getValueMapTable($domainName);
        $vMap = new \Eulogix\Cool\Lib\DataSource\SimpleValueMap($mapHash);
        $widget->addFieldSelect($fieldName)->setValueMap($vMap);
    }

    /**
     * @SnippetMeta(category="form_action", contextIgnore={"widget"}, directInvocation="true", description="Populate select with SQL query", longDescription="Populates a fields with the results of a SQL query. The query must provide the fields 'value' and optionally 'label' and 'pk'")
     *
     * @param WidgetInterface $widget
     * @param string $schemaName the name of the schema on which to perform the query
     * @param string $fieldName the name of the field to populate
     * @param string $humanDescriptionTable (optional) if set, the label will be taken using the getHumanDescription() method of the OM class of this table, records are instantiated using the sql expression 'pk' or in alternative, 'value'
     * @param string $sql The sql expression which must contain 'value' and optionally 'label' and 'pk'
     */
    public static function populateSelectWithSqlQuery(
        WidgetInterface $widget,
        $schemaName,
        $fieldName,
        $humanDescriptionTable,
        $sql
    ) {
        try {

            $schema = \Eulogix\Cool\Lib\Cool::getInstance()->getSchema($schemaName);
            $data = $schema->fetchArray($sql);

            if ($humanDescriptionTable) {
                foreach ($data as &$option) {
                    $pk = @$option[ 'pk' ] ?? @$option[ 'value' ];
                    $obj = $schema->getPropelObject($humanDescriptionTable, $pk);
                    if (method_exists($obj, 'getHumanDescription')) {
                        $option[ 'label' ] = $obj->getHumanDescription();
                    }
                }
            }

            $field = $widget->getField($fieldName)->setType(\Eulogix\Cool\Lib\Form\Field\FieldInterface::TYPE_SELECT);
            $field->setOptions($data);

        } catch (\Exception $e) {
            $widget->addMessageError($e->getMessage());
        }
    }

}


text:
/**
 * All services provided by verita
 */
package de.cpg.oss.verita.service;


text:
import os
import random
import sys

# TODO:
# Add unit tests
# look at file handling
# add picking from man pages + other sources?

TEST = True

TODO_PATH = '/home/bob/projects/scripts/text_files/todo_test' if TEST else '/home/bob/projects/scripts/text_files/todo'
CURRENT_TASK_PATH = '/home/bob/projects/scripts/text_files/current_task_test' if TEST else '/home/bob/projects/scripts/text_files/current_task'
TEMP_PATH = '/home/bob/projects/scripts/text_files/temp'

COMMENT_MARKER = '#'

def main():
    if len(sys.argv) > 1 and sys.argv[1] == 'done':
        finish_current_task()
    else:
        current_task = read_current_task()
        if current_task == '':
            current_task = pick_new_task()
            if current_task != '':
                print('Chosen task:', current_task)
            else:
                print('No tasks available, add some more.')
        else:
            print('Current task:', current_task)

def finish_current_task():
    try:
        os.remove(CURRENT_TASK_PATH)
        print('Current task complete.')
    except FileNotFoundError:
        print('No task currently chosen.')

def read_current_task():
    try:
        return open(CURRENT_TASK_PATH).read().strip()
    except IOError:
        return ''

def pick_new_task():
    lines = [line.strip() for line in open(TODO_PATH).readlines()]
    potential_tasks = [line for line in lines if len(line) > 0 and line[0] != COMMENT_MARKER]
    if len(potential_tasks) > 0:
        current_task = random.choice(potential_tasks)
        open(CURRENT_TASK_PATH, 'w').write(current_task)
        delete_chosen_task(current_task)
    else:
        current_task = ''
    return current_task

def delete_chosen_task(task):
    with open(TODO_PATH, 'r') as inputfile:
        with open(TEMP_PATH, 'w') as outputfile:
            for line in inputfile:
                if line.strip() != task:
                    outputfile.write(line)

    os.remove(TODO_PATH)
    os.rename(TEMP_PATH, TODO_PATH)

if __name__ == '__main__':
    main()


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@android:color/white">

    <FrameLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:padding="6dp"
        android:background="@drawable/rc_bg_item"
        android:id="@id/rc_title_layout">

        <io.rong.imkit.widget.AsyncImageView
            android:id="@id/rc_img"
            android:background="@drawable/rc_bg_item"
            android:layout_gravity="center"
            android:scaleType="centerCrop"
            android:layout_width="fill_parent"
            android:layout_height="150dp"/>

        <TextView
            android:id="@id/rc_txt"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:background="#75000000"
            android:padding="6dp"
            android:gravity="left"
            android:textSize="18dp"
            android:textColor="#ffffff"/>

    </FrameLayout>

    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="@color/rc_normal_bg"/>

    <ListView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scrollbars="none"
        android:id="@id/rc_list"/>

</LinearLayout>
<!-- From: file:/Users/rhj/AndroidStudioProjects/EveryDayBuild/TestRongCloud01/IMKit/src/main/res/layout/rc_item_public_service_multi_rich_content_message.xml --><!-- From: file:/Users/rhj/AndroidStudioProjects/EveryDayBuild/TestRongCloud01/IMKit/build/intermediates/bundles/debug/res/layout/rc_item_public_service_multi_rich_content_message.xml -->


text:
Tags = new Mongo.Collection("tags");

Levels = new Mongo.Collection("levels");


text:
void test_playfield_equals(){
	playfield_impl field1;
	playfield_impl field2;

	field1.set_stone_in_column(1,0);
	field1.set_stone_in_column(2,1);
	field2.set_stone_in_column(1,0);
	field2.set_stone_in_column(2,1);

	assert(field1 == field2);
}

int main(){
	test_playfield_equals();
	std::cout << "All tests passed" << std::endl;
	return 0;
}


text:
/* This version of ObjImporter first reads through the entire file, getting a count of how large
 * the final arrays will be, and then uses standard arrays for everything (as opposed to ArrayLists
 * or any other fancy things).
 *
 * Script downloaded from:
 * http://wiki.unity3d.com/index.php?title=ObjImporter
 */
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Ecosim
{
	public class ObjImporter
	{

		private struct meshStruct
		{
			public Vector3[] vertices;
			public Vector3[] normals;
			public Vector2[] uv;
			public Vector2[] uv1;
			public Vector2[] uv2;
			public int[] triangles;
			public int[] faceVerts;
			public int[] faceUVs;
			public Vector3[] faceData;
			public string name;
			public string fileName;
		}

		// Use this for initialization
		public static Mesh ImportFile (string filePath, Vector3 scale)
		{
			meshStruct newMesh = createMeshStruct (filePath);
			populateMeshStruct (ref newMesh);

			Vector3[] newVerts = new Vector3[newMesh.faceData.Length];
			Vector2[] newUVs = new Vector2[newMesh.faceData.Length];
			Vector3[] newNormals = new Vector3[newMesh.faceData.Length];
			int i = 0;
			/* The following foreach loops through the facedata and assigns the appropriate vertex, uv, or normal
        	 * for the appropriate Unity mesh array.
        	 */
			foreach (Vector3 v in newMesh.faceData) {
				newVerts [i] = Vector3.Scale (newMesh.vertices [(int)v.x - 1], scale);
				if (v.y >= 1)
					newUVs [i] = newMesh.uv [(int)v.y - 1];

				if (v.z >= 1)
					newNormals [i] = newMesh.normals [(int)v.z - 1];
				i++;
			}

			Mesh mesh = new Mesh ();

			mesh.vertices = newVerts;
			mesh.uv = newUVs;
			mesh.normals = newNormals;
			mesh.triangles = newMesh.triangles;

			mesh.RecalculateBounds ();
			mesh.Optimize ();

			return mesh;
		}

		private static meshStruct createMeshStruct (string filename)
		{
			int triangles = 0;
			int vertices = 0;
			int vt = 0;
			int vn = 0;
			int face = 0;
			meshStruct mesh = new meshStruct ();
			mesh.fileName = filename;
			StreamReader stream = File.OpenText (filename);
			string entireText = stream.ReadToEnd ();
			stream.Close ();
			using (StringReader reader = new StringReader(entireText)) {
				string currentText = reader.ReadLine ();
				char[] splitIdentifier = { ' ' };
				string[] brokenString;
				while (currentText != null) {
					if (!currentText.StartsWith ("f ") && !currentText.StartsWith ("v ") && !currentText.StartsWith ("vt ")
                    && !currentText.StartsWith ("vn ")) {
						currentText = reader.ReadLine ();
						if (currentText != null) {
							currentText = currentText.Replace ("  ", " ");
						}
					} else {
						currentText = currentText.Trim ();                           //Trim the current line
						brokenString = currentText.Split (splitIdentifier, 50);      //Split the line into an array, separating the original line by blank spaces
						switch (brokenString [0]) {
						case "v":
							vertices++;
							break;
						case "vt":
							vt++;
							break;
						case "vn":
							vn++;
							break;
						case "f":
							face = face + brokenString.Length - 1;
							triangles = triangles + 3 * (brokenString.Length - 2); /*brokenString.Length is 3 or greater since a face must have at least
                                                                                3 vertices.  For each additional vertice, there is an additional
                                                                                triangle in the mesh (hence this formula).*/
							break;
						}
						currentText = reader.ReadLine ();
						if (currentText != null) {
							currentText = currentText.Replace ("  ", " ");
						}
					}
				}
			}
			mesh.triangles = new int[triangles];
			mesh.vertices = new Vector3[vertices];
			mesh.uv = new Vector2[vt];
			mesh.normals = new Vector3[vn];
			mesh.faceData = new Vector3[face];
			return mesh;
		}

		private static void populateMeshStruct (ref meshStruct mesh)
		{
			StreamReader stream = File.OpenText (mesh.fileName);
			string entireText = stream.ReadToEnd ();
			stream.Close ();
			using (StringReader reader = new StringReader(entireText)) {
				string currentText = reader.ReadLine ();

				char[] splitIdentifier = { ' ' };
				char[] splitIdentifier2 = { '/' };
				string[] brokenString;
				string[] brokenBrokenString;
				int f = 0;
				int f2 = 0;
				int v = 0;
				int vn = 0;
				int vt = 0;
				int vt1 = 0;
				int vt2 = 0;
				while (currentText != null) {
					if (!currentText.StartsWith ("f ") && !currentText.StartsWith ("v ") && !currentText.StartsWith ("vt ") &&
                    !currentText.StartsWith ("vn ") && !currentText.StartsWith ("g ") && !currentText.StartsWith ("usemtl ") &&
                    !currentText.StartsWith ("mtllib ") && !currentText.StartsWith ("vt1 ") && !currentText.StartsWith ("vt2 ") &&
                    !currentText.StartsWith ("vc ") && !currentText.StartsWith ("usemap ")) {
						currentText = reader.ReadLine ();
						if (currentText != null) {
							currentText = currentText.Replace ("  ", " ");
						}
					} else {
						currentText = currentText.Trim ();
						brokenString = currentText.Split (splitIdentifier, 50);
						switch (brokenString [0]) {
						case "#":
							break;
						case "g":
							break;
						case "usemtl":
							break;
						case "usemap":
							break;
						case "mtllib":
							break;
						case "v":
							mesh.vertices [v] = new Vector3 (System.Convert.ToSingle (brokenString [1]), System.Convert.ToSingle (brokenString [2]),
                                                     System.Convert.ToSingle (brokenString [3]));
							v++;
							break;
						case "vt":
							mesh.uv [vt] = new Vector2 (System.Convert.ToSingle (brokenString [1]), System.Convert.ToSingle (brokenString [2]));
							vt++;
							break;
						case "vt1":
							mesh.uv [vt1] = new Vector2 (System.Convert.ToSingle (brokenString [1]), System.Convert.ToSingle (brokenString [2]));
							vt1++;
							break;
						case "vt2":
							mesh.uv [vt2] = new Vector2 (System.Convert.ToSingle (brokenString [1]), System.Convert.ToSingle (brokenString [2]));
							vt2++;
							break;
						case "vn":
							mesh.normals [vn] = new Vector3 (System.Convert.ToSingle (brokenString [1]), System.Convert.ToSingle (brokenString [2]),
                                                    System.Convert.ToSingle (brokenString [3]));
							vn++;
							break;
						case "vc":
							break;
						case "f":

							int j = 1;
							List<int> intArray = new List<int> ();
							while (j < brokenString.Length && ("" + brokenString[j]).Length > 0) {
								Vector3 temp = new Vector3 ();
								brokenBrokenString = brokenString [j].Split (splitIdentifier2, 3);
								// Separate the face into individual components (vert, uv, normal)
								temp.x = System.Convert.ToInt32 (brokenBrokenString [0]);
								if (brokenBrokenString.Length > 1) {
									// Some .obj files skip UV and normal
									if (brokenBrokenString [1] != "") {
										// Some .obj files skip the uv and not the normal
										temp.y = System.Convert.ToInt32 (brokenBrokenString [1]);
									}
									temp.z = System.Convert.ToInt32 (brokenBrokenString [2]);
								}
								j++;

								mesh.faceData [f2] = temp;
								intArray.Add (f2);
								f2++;
							}
							j = 1;
							while (j + 2 < brokenString.Length) { // Create triangles out of the face data.  There will generally be more than 1 triangle per face.
								mesh.triangles [f] = intArray [0];
								f++;
								mesh.triangles [f] = intArray [j];
								f++;
								mesh.triangles [f] = intArray [j + 1];
								f++;

								j++;
							}
							break;
						}
						currentText = reader.ReadLine ();
						if (currentText != null) {
							currentText = currentText.Replace ("  ", " "); // Some .obj files insert double spaces, this removes them.
						}
					}
				}
			}
		}
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="org.datakick.app" >

    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        android:maxSdkVersion="18" />
    <uses-permission android:name="android.permission.INTERNET" />

    <uses-feature
        android:name="android.hardware.camera"
        android:required="true" />

    <uses-sdk
        android:minSdkVersion="15"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="org.datakick.app.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="org.datakick.app.PhotoActivity"
            android:label="Add Images">
        </activity>

        <service
            android:name="org.datakick.app.DatakickService"
            android:exported="false" >
        </service>
    </application>

</manifest>


text:
package com.hp.autonomy.hod.client.api.developer;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

@Data
@JsonDeserialize(builder = Application.Builder.class)
public class Application {
    private final String name;
    private final String description;
    private final String domain;
    private final String domainDescription;
    private final List<Privilege> privileges;

    private Application(final Builder builder) {
        name = builder.name;
        description = builder.description;
        domain = builder.domain;
        domainDescription = builder.domainDescription;
        privileges = builder.privileges;
    }

    @Data
    @Accessors(chain = true)
    @JsonPOJOBuilder(withPrefix = "set")
    public static class Builder {
        private String name;
        private String description;
        private String domain;
        private List<Privilege> privileges;
        private String domainDescription;

        public Application build() {
            return new Application(this);
        }
    }
}


text:
<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Example - example-ng-dblclick</title>

  <script src="../../../angular.min.js"></script>

</head>
<body ng-app="">
  <button ng-dblclick="count = count + 1" ng-init="count=0">
  Increment (on double click)
</button>
count: {{count}}
</body>
</html>


text:
#define INCL_DOSSEMAPHORES

#include <os2.h>

#define _RWSTD_MUTEX_INIT(mutex) \
        DosCreateMutexSem (0, &mutex, DC_SEM_SHARED,FALSE)
#define _RWSTD_MUTEX_DESTROY(mutex)   DosCloseMutexSem (mutex)
#define _RWSTD_MUTEX_LOCK(mutex) \
        DosRequestMutexSem (mutex, SEM_INDEFINITE_WAIT)
#define _RWSTD_MUTEX_UNLOCK(mutex)    DosReleaseMutexSem (mutex)
#define _RWSTD_MUTEX_T                HMTX


text:
$Title = "vSwitch Security"
$Header = "vSwitch and portgroup security settings"
$Comments = "All security options for standard and distributed switches and port groups should be set to REJECT unless explicitly required, except for ForgedTrasmits which is required on vDS uplink port groups."
$Display = "Table"
$Author = "Justin Mercier, Sam McGeown, John Sneddon, Ben Hocker, Dan Barr"
$PluginVersion = 1.5
$PluginCategory = "vSphere"

# Start of Settings
# Warn for AllowPromiscuous enabled?
$AllowPromiscuousPolicy = $true
# Warn for ForgedTransmits enabled?
$ForgedTransmitsPolicy = $true
# Warn for MacChanges enabled?
$MacChangesPolicy = $true
# End of Settings

# Update settings where there is an override
$AllowPromiscuousPolicy = Get-vCheckSetting $Title "AllowPromiscuousPolicy" $AllowPromiscuousPolicy
$ForgedTransmitsPolicy = Get-vCheckSetting $Title "ForgedTransmitsPolicy" $ForgedTransmitsPolicy
$MacChangesPolicy = Get-vCheckSetting $Title "MacChangesPolicy" $MacChangesPolicy

# Check Power CLI version. Build must be at least 1012425 (5.1 Release 2) to contain Get-VDPortGroup cmdlet
$VersionOK = $false

if (((Get-PowerCLIVersion) -match "VMware.* PowerCLI (.*) build ([0-9]+)")) {

    if ([int]($Matches[2]) -ge 1012425) {
        $VersionOK = $true
        if ([int]($Matches[2]) -ge 2548067) {
            #PowerCLI 6+
            if (!(Get-Module -Name VMware.VimAutomation.Vds -ErrorAction SilentlyContinue)) {
                Import-Module VMware.VimAutomation.Vds
            }
        }
        else {
            # Add required Snap-In
            if (!(Get-PSSnapin -name VMware.VimAutomation.Vds -ErrorAction SilentlyContinue)) {
                Add-PSSnapin VMware.VimAutomation.Vds
            }
        }
    }
}

if ($VersionOK) {
    [array] $results = $null

    Get-VirtualSwitch | ForEach-Object {
        $Output = "" | Select-Object Host, Type, vSwitch, Portgroup, AllowPromiscuous, ForgedTransmits, MacChanges
        if ($_.ExtensionData.Summary -ne $null) {
            $Output.Type = "vDS"
            $Output.Host = "*"
        }
        else {
            $Output.Type = "vSS"
            $Output.Host = $_.VMHost
        }
        $Output.vSwitch = $_.Name
        $Output.Portgroup = "(none)"
        $Output.AllowPromiscuous = ($_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.AllowPromiscuous.Value -or $_.ExtensionData.Spec.Policy.Security.AllowPromiscuous)
        $Output.ForgedTransmits = ($_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.ForgedTransmits.Value -or $_.ExtensionData.Spec.Policy.Security.ForgedTransmits)
        $Output.MacChanges = ($_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.MacChanges.Value -or $_.ExtensionData.Spec.Policy.Security.MacChanges)
        $results += $Output
    }

    Get-VDPortGroup | ForEach-Object {
        $Output = "" | Select-Object Host, Type, vSwitch, Portgroup, AllowPromiscuous, ForgedTransmits, MacChanges
        $Output.Host = "*"
        if ($_.ExtensionData.Config.Uplink -eq $true) {
            $Output.Type = "vDS Uplink Port Group"
        }
        else {
            $Output.Type = "vDS Port Group"
        }
        $Output.vSwitch = $_.VDSwitch
        $Output.Portgroup = $_.Name
        $Output.AllowPromiscuous = $_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.AllowPromiscuous.Value
        $Output.ForgedTransmits = $_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.ForgedTransmits.Value
        $Output.MacChanges = $_.ExtensionData.Config.DefaultPortConfig.SecurityPolicy.MacChanges.Value
        $results += $Output
    }

    $VMH | Where-Object { $_.ConnectionState -eq "Connected" } | ForEach-Object {
        $VMHost = $_
        Get-VirtualPortGroup -VMHost $_ -Standard | ForEach-Object {
            $Output = "" | Select-Object Host, Type, vSwitch, Portgroup, AllowPromiscuous, ForgedTransmits, MacChanges
            $Output.Host = $VMHost.Name
            $Output.Type = "vSS Port Group"
            $Output.vSwitch = $_.VirtualSwitch
            $Output.Portgroup = $_.Name
            $Output.AllowPromiscuous = $_.ExtensionData.Spec.Policy.Security.AllowPromiscuous -and ($_.Spec.Policy.Security.AllowPromiscuous -eq $null)
            $Output.ForgedTransmits = $_.ExtensionData.Spec.Policy.Security.ForgedTransmits -and ($_.Spec.Policy.Security.ForgedTransmits -eq $null)
            $Output.MacChanges = $_.ExtensionData.Spec.Policy.Security.MacChanges -and ($_.Spec.Policy.Security.MacChanges -eq $null)
            $results += $Output
        }
    }

    if ($results.Host) { $results | Where-Object { ($_.AllowPromiscuous -and $AllowPromiscuousPolicy) -or ($_.ForgedTransmits -and $ForgedTransmitsPolicy -and $_.Type -ne "vDS Uplink Port Group") -or ($_.MacChanges -and $MacChangesPolicy) } | Sort-Object vSwitch, PortGroup }
}
else {
    Write-Warning "PowerCLi version installed is lower than 5.1 Release 2"
    New-Object PSObject -Property @{"Message" = "PowerCLi version installed is lower than 5.1 Release 2, please update to use this plugin"}
}

# Changelog
## 1.0 : Initial Release
## 1.1 : Re-written for performance improvements
## 1.2 : Added version check (Issue #71)
## 1.3 : Add Get-vCheckSetting
## 1.4 : Fix Version checking for PowerCLI 6.5 - vSphere is no longer in the product name (Issue #514)
## 1.5 : Ignore ForgedTransmits on vDS Uplink port groups, removed redundant plugin variable block, fixed logic bugs


text:
package org.hisp.dhis.node.transformers;

import org.hisp.dhis.node.Node;
import org.hisp.dhis.node.NodeTransformer;
import org.hisp.dhis.node.types.SimpleNode;
import org.hisp.dhis.schema.Property;
import org.hisp.dhis.schema.PropertyType;
import org.springframework.stereotype.Component;

import java.util.List;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * @author Morten Olav Hansen <mortenoh@gmail.com>
 */
@Component
public class SizeNodeTransformer implements NodeTransformer
{
    @Override
    public String name()
    {
        return "size";
    }

    @Override
    public Node transform( Node node, List<String> args )
    {
        checkNotNull( node );
        checkNotNull( node.getProperty() );

        Property property = node.getProperty();

        if ( property.isCollection() )
        {
            return new SimpleNode( property.getCollectionName(), node.getChildren().size(), property.isAttribute() );
        }
        else if ( property.is( PropertyType.TEXT ) || property.is( PropertyType.TEXT ) )
        {
            return new SimpleNode( property.getName(), ((String) ((SimpleNode) node).getValue()).length(), property.isAttribute() );
        }
        else if ( property.is( PropertyType.INTEGER ) || property.is( PropertyType.NUMBER ) )
        {
            return new SimpleNode( property.getName(), ((SimpleNode) node).getValue(), property.isAttribute() );
        }

        return node;
    }
}


text:
apt-get update
gem install sass
apt-get install git
npm install -g grunt-cli


text:
/* jshint -W097 */
/* globals  module */
'use strict';

/**
 * A list of firebase event types
 * See https://www.firebase.com/docs/web/api/query/on.html
 * @type {{CHANGED: number}}
 */
var FirebaseEventType = {
    CHANGED: 'changed' // maps to Firebase's "value" event
};

module.exports = FirebaseEventType;


text:
module DateHelper
  # Ruby's strptime is too lenient, and will accept 2001-01-foobar and just parse out 2001-01.
  # We match against regex first, then use strptime
  DATE_STANDARD = {
    format: "%Y-%m-%d",
    regex: /(^\d{4}-\d{1,2}-\d{1,2}$)/,
  }.freeze

  DATE_STANDARD_MONTH = {
    format: "%Y-%m",
    regex: /(^\d{4}-\d{1,2}$)/,
  }.freeze

  DATE_ALT = {
    format: "%m/%d/%y",
    regex: %r{^\d{1,2}\/\d{1,2}\/\d{2}$},
  }.freeze

  DATE_ALT_MONTH = {
    format: "%m/%Y",
    regex: %r{^\d{1,2}\/\d{4}$},
  }.freeze

  def parse_date(date_string, allow_day = true)
    allowed_formats =
      if allow_day
        [DATE_STANDARD, DATE_STANDARD_MONTH, DATE_ALT, DATE_ALT_MONTH]
      else
        [DATE_STANDARD_MONTH, DATE_ALT_MONTH]
      end

    allowed_formats.each do |date_obj|
      date = parse_date_helper(date_string, date_obj)

      if date
        return date
      end
    end

    # If nothing worked, raise an error.
    raise ArgumentError, "Date could not be parsed"
  end

  def parse_date_helper(date_string, date_obj)
    unless date_obj[:regex].match(date_string)
      return nil
    end

    Date.strptime(date_string, date_obj[:format])
  rescue ArgumentError
    nil
  end
end


text:
/**
*
* ToolsRequestTraining
*
*/

import React from 'react';
import styled from 'styled-components';

import { injectIntl } from 'react-intl';
import Markdown from 'react-remarkable';
import messages from './messages';
import ContentBlock from 'components/ContentBlock';
import LanguageThemeProvider from 'components/LanguageThemeProvider';

function ToolsRequestTraining(props) {
  const {formatMessage} = props.intl;
  return (
    <LanguageThemeProvider>
      <ContentBlock>
        <Markdown source={ formatMessage(
                              messages.requestTraining,
                              { form: formatMessage(messages.trainingForm) }
                            )
                          } />
      </ContentBlock>
    </LanguageThemeProvider>
  );
}

ToolsRequestTraining.propTypes = {};

export default injectIntl(ToolsRequestTraining);


text:
"""script to test idf reads.
Use this to test all the files in the example folder when a new version is released"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import argparse

import sys
# pathnameto_eppy = 'c:/eppy'
pathnameto_eppy = '../../'
sys.path.append(pathnameto_eppy)

import os
from eppy.modeleditor import IDF
import eppy.simpleread as simpleread

# iddfile = '/Applications/EnergyPlus-8-1-0/Energy+.idd'
# folder = '/Applications/EnergyPlus-8-1-0/ExampleFiles'
# python eppyreadtest_folder.py '/Applications/EnergyPlus-8-1-0/Energy+.idd'
# '/Applications/EnergyPlus-8-1-0/ExampleFiles'

def doreadtest(iddfile, folder, silent=False):
    """print out all the readtest results"""
    lst = os.listdir(folder)
    lst = [l for l in lst if l.endswith('.idf')]

    iddhandle = open(iddfile, 'r')
    for i, fname in enumerate(lst[355:359]): # lst[6:7]
                                    # if you want to test a specific file
        fname1 = "%s/%s" % (folder, fname)
        idfhandle1 = open(fname1, 'rb')
        idfhandle2 = open(fname1, 'rb')
        verbose = not silent
        result = simpleread.idfreadtest(
            iddhandle, idfhandle1, idfhandle2,
            verbose=verbose, save=False)
        print(i, result, fname)
        if result == False and (not silent):
            print("full filepath of file that failed the read test ->")
            print("    %s" % (fname1, ))
            print()
        idfhandle1.close()
        idfhandle2.close()
    iddhandle.close()

if __name__ == '__main__':
    # do the argparse stuff
    parser = argparse.ArgumentParser()
    parser.add_argument(
        'idd', action='store',
        help='location of idd file. ./somewhere/eplusv8-0-1.idd')
    parser.add_argument(
        'folder', action='store',
        help='location of folder with idf files. ./somewhere/examples')
    parser.add_argument(
        '--silent', action='store_true', default=False,
        help="don't print the first mismatching line")
    nspace = parser.parse_args()
    folder = nspace.folder
    iddfile = nspace.idd
    silent = nspace.silent
    doreadtest(iddfile, folder, silent)


text:
/**
 * Interface for all AMP Async Input Elements.
 * enforces the overridable function, getValue().
 * Async Input should be implemented
 * by components like AMP form, to async request
 * a value from a component, and then be used for
 * some other action. For examples, this can be used
 * by reCAPTCHA to request tokens for the form.
 *
 * NOTE: Elements that implemented AsyncInput must
 * Also add and follow the other exported constants.
 * See amp-recaptcha-input as an example.
 *
 * @interface
 */
export class AsyncInput {

  /**
   * Called to get the asynchronous value of an
   * AsyncInput field.
   * @return {!Promise<string>}
   */
  getValue() {}
}

/**
 * Classes
 *
 * Components implementing the AsyncInput,
 * are expected to add the following classes
 * at the appropriate time.
 *
 * @constant {!Object<string, string>}
 */
export const AsyncInputClasses = {
  /**
   * i-amphtml-async-input
   *
   * Required base class that must be added to the async-input
   * element on buildCallback or layoutCallback.
   * This will be used by other amp components to find
   * and use async-input elements.
   */
  'ASYNC_INPUT': 'i-amphtml-async-input',
};


text:
package net.whg.we.net;

import java.io.IOException;

/**
 * Represents a connection wrapper which has sent a packet to this library.
 */
public interface IPacketSender
{
    /**
     * Sends a packet to this packet sender.
     *
     * @param packet
     *     - The packet to send.
     */
    void sendPacket(IPacket packet) throws IOException;
}


text:
using System.Collections.Generic;
using FoxTool.Fox.Types.Values;

namespace FoxTool.Tpp.Classes
{
    public class ObjectBrush : Data
    {
        // Static properties
        public FoxEntityHandle Parent { get; set; }
        public FoxEntityPtr Transform { get; set; }
        public FoxEntityPtr ShearTransform { get; set; }
        public FoxEntityPtr PivotTransform { get; set; }
        public FoxEntityHandle Children { get; set; }
        public FoxUInt32 Flags { get; set; }
        public List<FoxEntityHandle> PluginHandle { get; set; }
        public List<FoxString> BlockDataName { get; set; }
        public FoxPath FilePath { get; set; }
        public FoxPath LoadFilePath { get; set; }
        public FoxFilePtr ObrFile { get; set; }
        public FoxUInt32 NumBlocks { get; set; }
    }
}


text:
"""
WSGI config for ProyectoDAI project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""

import os
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
#from whitenoise.django import DjangoWhiteNoise

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ProyectoDAI.settings")

#application = get_wsgi_application()
application = Cling(get_wsgi_application())

#application = DjangoWhiteNoise(application)


text:
package org.instantlogic.designer.sharedpagefragment;

public class ApplicationContextPageFragment extends org.instantlogic.interaction.page.SharedElement {

	public static ApplicationContextPageFragment INSTANCE = new ApplicationContextPageFragment();

	private static org.instantlogic.fabric.deduction.Deduction createDeduction0() {
		  	org.instantlogic.fabric.deduction.AttributeDeduction d0 = new org.instantlogic.fabric.deduction.AttributeDeduction();
		    d0.setAttribute(org.instantlogic.designer.entity.ApplicationDesignEntity.name);
		  	org.instantlogic.fabric.deduction.SelectedInstanceDeduction d1 = new org.instantlogic.fabric.deduction.SelectedInstanceDeduction();
		    d1.setOfEntity(org.instantlogic.designer.entity.ApplicationDesignEntity.INSTANCE);
		    d0.setInstance(d1);
		return d0;
	}

	public static final org.instantlogic.interaction.page.Element SHARED_INSTANCE =
    new org.instantlogic.interaction.page.FragmentTemplate("FragmentTemplateDesign_66", "Link")
        .setDestination(org.instantlogic.designer.placetemplate.WelcomePlaceTemplate.INSTANCE)
        .addChild("content",
            new org.instantlogic.interaction.page.FragmentTemplate("FragmentTemplateDesign_67", "Block")
                .setStyleNames(new String[]{"inactive-card"})
                .addChild("content",
                    new org.instantlogic.interaction.page.FragmentTemplate("FragmentTemplateDesign_68", "Heading3")
                        .putText("text", new org.instantlogic.fabric.text.TextTemplate().getUntranslated().add(createDeduction0()).add(" (Application)").getTextTemplate())
                )
        );

	protected ApplicationContextPageFragment() {
	    INSTANCE=this;
	}

	static {
	    INSTANCE.setElement(SHARED_INSTANCE);
	}

}


text:
/**
 *
 */
package org.semanticweb.elk.benchmark;
/*
 * #%L
 * ELK Benchmarking Package
 * $Id:$
 * $HeadURL:$
 * %%
 * Copyright (C) 2011 - 2014 Department of Computer Science, University of Oxford
 * %%
 * 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.
 * #L%
 */

/**
 * @author Pavel Klinov
 *
 * pavel.klinov@uni-ulm.de
 */
public interface TaskVisitor {

	public void visit(Task task) throws TaskException;
}


text:
package za.org.grassroot.core.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import za.org.grassroot.core.domain.Role;

import java.util.List;
import java.util.Set;

/**
 * @author Lesetse Kimwaga
 */
public interface RoleRepository extends JpaRepository<Role,Long> {

    List<Role> findByName(String name);

    List<Role> findByNameAndRoleType(String name, Role.RoleType roleType);

    Role findOneByNameAndRoleType(String name, Role.RoleType roleType);

    List<Role> findByRoleType(Role.RoleType roleType);

    Set<Role> findByGroupUid(String groupUid);

    Role findByNameAndGroupUid(String name, String groupUid);
}


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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">

    <bean id="dynamicUrlHandlerMapping" class="com.communote.server.web.commons.controller.DynamicUrlHandlerMapping">
        <property name="order" value="1" />
    </bean>

    <bean name="pluginResourceDownloadController" class="com.communote.server.web.commons.view.PluginResourceDownloadController"
        lazy-init="true" />

    <bean id="pluginHandlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="alwaysUseFullPath" value="true" />
        <property name="mappings">
            <props>
                <prop key="/*/*/plugins/**">pluginResourceDownloadController</prop>
            </props>
        </property>
    </bean>
</beans>


text:
layout: page
title: Base Motors Party
date: 2016-05-24
author: Dennis Davidson
tags: weekly links, java
status: published
summary: Sed sit amet faucibus diam, eget dapibus est. Proin.
banner: images/banner/leisure-01.jpg
booking:
  startDate: 12/26/2019
  endDate: 12/28/2019
  ctyhocn: HELMTHX
  groupCode: BMP
published: true
---
Duis pretium feugiat eros, nec ornare eros sodales ac. Proin lacinia in dolor quis ornare. Donec eget pretium augue. Donec iaculis metus interdum pretium consectetur. Mauris non eleifend augue, vel aliquam erat. Proin lobortis laoreet augue, volutpat cursus justo varius non. Sed vel bibendum lacus. Vestibulum pharetra viverra enim. Praesent dolor ipsum, auctor et scelerisque et, pharetra in augue. Cras eget fringilla ligula, placerat ullamcorper massa. Ut blandit rutrum lacus, nec dignissim nisl sagittis sit amet. Integer accumsan lorem sit amet varius rhoncus. In pharetra diam eu mauris fermentum viverra. Aenean quis justo neque. Duis id est non nisl cursus facilisis id et nulla.

* Vivamus consectetur ipsum nec libero volutpat consectetur
* Nunc consequat velit vel leo ultrices, ut dictum dui bibendum
* Morbi in lorem pulvinar, aliquet metus sed, eleifend urna
* Morbi dignissim dui id lectus iaculis varius.

Sed imperdiet at tellus sed faucibus. Pellentesque pulvinar ultricies augue, vel accumsan augue tincidunt et. Aenean vel lorem semper, finibus ligula elementum, molestie eros. Duis eu ligula eu nunc consequat volutpat et nec magna. Ut bibendum nibh vitae neque viverra, commodo suscipit urna convallis. Integer eget nisi nec orci interdum consequat. Nunc at gravida orci. Mauris sit amet justo quis mi imperdiet iaculis at vel justo. Etiam rhoncus efficitur lorem, quis interdum quam blandit et. Ut lobortis maximus tempus. Integer vel ipsum gravida, sagittis mauris in, condimentum purus. Mauris id nulla quis leo eleifend rhoncus eget a magna.
Donec sed ipsum vulputate, aliquet nunc vitae, interdum quam. Donec faucibus sem nec fermentum consequat. Vivamus id libero ut nisi lacinia bibendum. Nulla congue ipsum eu lacus auctor dignissim vitae ac tortor. Donec in tellus quis neque bibendum semper porttitor et nisl. Quisque augue lorem, mollis sit amet felis in, consequat bibendum metus. Donec suscipit non felis et posuere.


text:
cask "xampp" do
  version "8.0.12-0"
  sha256 "08d26efdc8648d5610dee0f01d4a678fe66fe8d9396107f19f7dc5fe090404c5"

  url "https://downloadsapachefriends.global.ssl.fastly.net/xampp-files/#{version.split("-").first}/xampp-osx-#{version}-installer.dmg",
      verified: "downloadsapachefriends.global.ssl.fastly.net/xampp-files/"
  name "XAMPP"
  desc "Apache distribution containing MySQL, PHP, and Perl"
  homepage "https://www.apachefriends.org/index.html"

  livecheck do
    url "https://www.apachefriends.org/download.html"
    regex(%r{href=.*?/xampp[._-]osx[._-]v?(\d+(?:\.\d+)*-\d+)[._-]installer\.dmg}i)
  end

  installer script: {
    executable: "XAMPP.app/Contents/MacOS/osx-x86_64",
    args:       ["--mode", "unattended"],
    sudo:       true,
  }

  uninstall quit:   "com.bitnami.manager",
            script: {
              executable: "/Applications/XAMPP/uninstall.app/Contents/MacOS/osx-x86_64",
              args:       ["--mode", "unattended"],
              sudo:       true,
            },
            delete: "/Applications/XAMPP/"
end


text:
<!Doctype html>

  <link rel="stylesheet" href="../css/960_12_col.css">
  <link rel="stylesheet" href="../css/MySpaceStyling.css">
  <title>Welcome to Myspace</title>

        MySpace

Meet MySpace

Portfolio

Download

For Business

Help

With MySpace, sharing is easy.

          Invite others to view your files and edit them. Or keep your files private.

50GB Free

          At MySpace, we understand your requirements. Enjoy 50GB free space for all your needs. You may also upgrade to a larger storage plan.

Store any file.

          PDF's, documents,presentations, photos, videos. No matter what type of file, we've got you covered.

Security

          File security is our prime concern. Your files are protected by our copywrited security protocol and only you have access to them.

Work Offline

          Your files are also available offline so that they are accessible even in case of no connectivity.

Storage Plans

View plans/pricing

Plans FAQ's

Downloads

For Mac

For PC

For android

For iOS

Support

Help Center

Our Blog

FAQ's

Contact us