text:
// ✿✿✿✿ ʕ •ᴥ•ʔ/ ︻デ═一

package pylapp.smoothclicker.android.views;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import pylapp.smoothclicker.android.R;

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

/**
 * A BaseAdapter for the view containing the points to click on
 *
 * @author Pierre-Yves Lapersonne
 * @version 1.4.0
 * @since  17/03/2016
 * @see BaseAdapter
 */
public class PointsListAdapter extends BaseAdapter {

    /* ********** *
     * ATTRIBUTES *
     * ********** */

    /**
     *
     */
    private Context mContext;

    /**
     * The list of points to click on
     */
    private List<Point> mPoints;

    //private static final String LOG_TAG = PointsListAdapter.class.getSimpleName();

    /* *********** *
     * CONSTRUCTOR *
     * *********** */

    /**
     * @param c - The context
     * @param xyPoints - An array list with each X/Y coords
     */
    public PointsListAdapter( Context c, ArrayList<Integer> xyPoints ){

        super();

        mContext = c;
        mPoints = new ArrayList<>();

        if ( xyPoints == null ){
            throw new IllegalArgumentException("The xyPoints is null !");
        }

        // If we have odd number of values, we have an unfilled point
        if ( xyPoints.size() % 2 != 0 ){
            throw new IllegalArgumentException("There is not the good number of values for xyPoints. The array list must be like {x1, y1, x2, y2, ..., xN, yN}");
        }

        if ( xyPoints.size() == 0 ){
            mPoints.add( new Point(mContext.getString(R.string.widget_no_points)) );
        } else {
            mPoints.clear();
            if ( xyPoints.size() == 1 ) mPoints.add( new Point("1 click" ) );
            else mPoints.add( new Point( xyPoints.size() / 2 + " clicks"));
        }

        for ( int i = 0; i < xyPoints.size(); i +=2 ){
            Point p = new Point(xyPoints.get(i), xyPoints.get(i+1));
            mPoints.add(p);
        }

    }

    /* ************************ *
     * METHODS FROM BaseAdapter *
     * ************************ */

    /**
     *
     * @return int -
     */
    @Override
    public int getCount() {
        return mPoints.size();
    }

    /**
     *
     * @param position -
     * @return Object
     */
    @Override
    public Object getItem( int position ){
        return mPoints.get(position);
    }

    /**
     *
     * @param position -
     * @return long -
     */
    @Override
    public long getItemId( int position ){
        return position;
    }

    /**
     *
     * @param position -
     * @param convertView -
     * @param parent -
     * @return View -
     */
    @Override
    public View getView( int position, View convertView, ViewGroup parent ){
        LayoutInflater lf = LayoutInflater.from(mContext);
        convertView = lf.inflate(R.layout.list_points_item, null); // FIXME LINT
        TextView tv = (TextView) convertView.findViewById(R.id.tvTitleOfPointList);
        tv.setText(mPoints.get(position).toString());
        return convertView;
    }

    /* ************* *
     * OTHER METHODS *
     * ************* */

    /**
     *
     * @param p - The point to add
     */
    public void add( Point p ){
        mPoints.add(p);
    }

    /**
     *
     * @param location - The index of the point to get
     * @return Point - The point at this location
     */
    public Point get( int location ){
        return mPoints.get(location);
    }

    /**
     * Returns the list of points
     * @return List<Point>
     */
    public List<Point> getList(){
        return mPoints;
    }

    /**
     *
     * @param location - The location of the point to remove
     * @return Point - The removed point
     */
    public Point remove( int location ){
        return mPoints.remove(location);
    }

    /**
     * Clears the list of points
     */
    public void clear(){
        mPoints.clear();
    }

    /**
     *
     * @return int - The number of points
     */
    public int size(){
        return mPoints.size();
    }

    /* ************* *
     * INNER CLASSES *
     * ************* */

    /**
     * Models a point with its X and Y coordinates
     */
    public static class Point {

        /**
         * The X coordinate
         */
        public int x;
        /**
         * The Y coordinate
         */
        public int y;
        /**
         * A description
         */
        public String desc;
        /**
         * Should we click on it ?
         */
        public boolean isUsable;

        public static final int UNDEFINED_X = -1;
        public static final int UNDEFINED_Y = -1;

        public Point( int x, int y ){
            super();
            this.x = x;
            this.y = y;
            desc = null;
            isUsable = true;
        }

        public Point( int x, int y, String desc ){
            super();
            this.x = x;
            this.y = y;
            this.desc = desc;
            isUsable = true;
        }

        public Point( String desc ){
            super();
            this.x = UNDEFINED_X;
            this.y = UNDEFINED_Y;
            this.desc = desc;
            isUsable = false;
        }

        @Override
        public String toString(){
            StringBuilder sb = new StringBuilder();
            if ( x == UNDEFINED_X || y == UNDEFINED_Y ) return desc;
            if ( desc != null && desc.length() > 0 ) sb.append(desc).append(" / ");
            sb.append("x = ").append(x).append(" / y = ").append(y);
            return sb.toString();
        }

        public String toJson(){
            StringBuilder sb = new StringBuilder();
            sb.append("{\"x\" : ").append("\"").append(x).append("\", ");
            sb.append("\"y\" : ").append("\"").append(y).append("\", ");
            sb.append("\"desc\" : ").append("\"").append(desc).append("\"");
            sb.append("}");
            return sb.toString();
        }

    } // End of public static class Point

}


text:
package edu.cuny.qc.speech.AuToBI.core;

/**
 * Pair<T1,T2> is a lightweight generic to represent two objects as a single Pair.
 *
 * @param <T1> the first object
 * @param <T2> the second object
 */
public class Pair<T1, T2> {
  public T1 first;   // the first object
  public T2 second;  // the second object

  /**
   * Constructs a new pair with values, v1 and v2.
   *
   * @param v1 the first value
   * @param v2 the second value
   */
  public Pair(T1 v1, T2 v2) {
    first = v1;
    second = v2;
  }

  /**
   * Constructs a new empty pair.
   */
  public Pair() {
    first = null;
    second = null;
  }
}

redpajama_set_name: RedPajamaGithub


text:
import React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { makeStyles } from '@material-ui/core/styles';

const styles = (theme) => ({
  root: {
    ...theme.typography.body1,
    color: theme.palette.text.primary,
    wordBreak: 'break-word',
    '& .anchor-link': {
      marginTop: -96, // Offset for the anchor.
      position: 'absolute',
    },
    '& pre': {
      margin: theme.spacing(3, 'auto'),
      padding: theme.spacing(2),
      backgroundColor: '#272c34',
      direction: 'ltr',
      borderRadius: theme.shape.borderRadius,
      overflow: 'auto',
      WebkitOverflowScrolling: 'touch', // iOS momentum scrolling.
      maxWidth: 'calc(100vw - 32px)',
      [theme.breakpoints.up('md')]: {
        maxWidth: 'calc(100vw - 32px - 16px)',
      },
    },
    // inline code
    '& code': {
      direction: 'ltr',
      lineHeight: 1.4,
      display: 'inline-block',
      fontFamily: 'Consolas, "Liberation Mono", Menlo, Courier, monospace',
      WebkitFontSmoothing: 'subpixel-antialiased',
      padding: '0 3px',
      color: theme.palette.text.primary,
      backgroundColor:
        theme.palette.type === 'light' ? 'rgba(255, 229, 100, 0.2)' : 'rgba(255, 229, 100, 0.2)',
      fontSize: '.85em',
      borderRadius: 2,
    },
    '& code[class*="language-"]': {
      backgroundColor: '#272c34',
      color: '#fff',
      // Avoid layout jump after hydration (style injected by prism)
      lineHeight: 1.5,
    },
    // code blocks
    '& pre code': {
      fontSize: '.9em',
    },
    '& .token.operator': {
      background: 'transparent',
    },
    '& h1': {
      ...theme.typography.h3,
      fontSize: 40,
      margin: '16px 0',
    },
    '& .description': {
      ...theme.typography.h5,
      margin: '0 0 40px',
    },
    '& h2': {
      ...theme.typography.h4,
      fontSize: 30,
      margin: '40px 0 16px',
    },
    '& h3': {
      ...theme.typography.h5,
      margin: '40px 0 16px',
    },
    '& h4': {
      ...theme.typography.h6,
      margin: '32px 0 16px',
    },
    '& h5': {
      ...theme.typography.subtitle2,
      margin: '32px 0 16px',
    },
    '& p, & ul, & ol': {
      marginTop: 0,
      marginBottom: 16,
    },
    '& ul': {
      paddingLeft: 30,
    },
    '& h1, & h2, & h3, & h4': {
      '& code': {
        fontSize: 'inherit',
        lineHeight: 'inherit',
        // Remove scroll on small screens.
        wordBreak: 'break-all',
      },
      '& .anchor-link-style': {
        // To prevent the link to get the focus.
        display: 'none',
      },
      '&:hover .anchor-link-style': {
        display: 'inline-block',
        padding: '0 8px',
        color: theme.palette.text.secondary,
        '&:hover': {
          color: theme.palette.text.primary,
        },
        '& svg': {
          width: '0.7em',
          height: '0.7em',
          fill: 'currentColor',
        },
      },
    },
    '& table': {
      // Trade display table for scroll overflow
      display: 'block',
      wordBreak: 'normal',
      width: '100%',
      overflowX: 'auto',
      WebkitOverflowScrolling: 'touch', // iOS momentum scrolling.
      borderCollapse: 'collapse',
      marginBottom: '16px',
      borderSpacing: 0,
      overflow: 'hidden',
      '& .prop-name': {
        fontFamily: 'Consolas, "Liberation Mono", Menlo, monospace',
      },
      '& .required': {
        color: theme.palette.type === 'light' ? '#006500' : '#a5ffa5',
      },
      '& .prop-type': {
        fontFamily: 'Consolas, "Liberation Mono", Menlo, monospace',
        color: theme.palette.type === 'light' ? '#932981' : '#ffb6ec',
      },
      '& .prop-default': {
        fontFamily: 'Consolas, "Liberation Mono", Menlo, monospace',
        borderBottom: `1px dotted ${theme.palette.divider}`,
      },
    },
    '& td': {
      ...theme.typography.body2,
      borderBottom: `1px solid ${theme.palette.divider}`,
      padding: 16,
      color: theme.palette.text.primary,
    },
    '& td code': {
      lineHeight: 1.6,
    },
    '& th': {
      lineHeight: theme.typography.pxToRem(24),
      fontWeight: theme.typography.fontWeightMedium,
      color: theme.palette.text.primary,
      whiteSpace: 'pre',
      borderBottom: `1px solid ${theme.palette.divider}`,
      padding: 16,
    },
    '& blockquote': {
      borderLeft: '5px solid #ffe564',
      backgroundColor: 'rgba(255,229,100,0.2)',
      padding: '4px 24px',
      margin: '24px 0',
      '& p': {
        marginTop: '16px',
      },
    },
    '& a, & a code': {
      // Style taken from the Link component
      color: theme.palette.secondary.main,
      textDecoration: 'none',
      '&:hover': {
        textDecoration: 'underline',
      },
    },
    '& img, video': {
      maxWidth: '100%',
    },
    '& img': {
      // Avoid layout jump
      display: 'inline-block',
    },
    '& hr': {
      height: 1,
      margin: theme.spacing(6, 0),
      border: 'none',
      flexShrink: 0,
      backgroundColor: theme.palette.divider,
    },
    '& kbd': {
      // Style taken from GitHub
      padding: '2px 5px',
      font: '11px Consolas,Liberation Mono,Menlo,monospace',
      lineHeight: '10px',
      color: '#444d56',
      verticalAlign: 'middle',
      backgroundColor: '#fafbfc',
      border: '1px solid #d1d5da',
      borderRadius: 3,
      boxShadow: 'inset 0 -1px 0 #d1d5da',
    },
  },
});
const useStyles = makeStyles(styles, { name: 'MarkdownElement', flip: false });

const MarkdownElement = React.forwardRef(function MarkdownElement(props, ref) {
  const { className, renderedMarkdown, ...other } = props;
  const classes = useStyles();
  const more = {};

  if (typeof renderedMarkdown === 'string') {
    // workaround for https://github.com/facebook/react/issues/17170
    // otherwise we could just set `dangerouslySetInnerHTML={undefined}`
    more.dangerouslySetInnerHTML = { __html: renderedMarkdown };
  }

  return (
    <div
      className={clsx(classes.root, 'markdown-body', className)}
      {...more}
      {...other}
      ref={ref}
    />
  );
});

MarkdownElement.propTypes = {
  className: PropTypes.string,
  renderedMarkdown: PropTypes.string,
};

export default MarkdownElement;


text:
package i5.las2peer.services.ocd.graphs;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import i5.las2peer.services.ocd.adapters.AdapterException;
import i5.las2peer.services.ocd.algorithms.utils.OcdAlgorithmException;
import i5.las2peer.services.ocd.graphs.Cover;
import i5.las2peer.services.ocd.graphs.CustomGraph;
import i5.las2peer.services.ocd.metrics.ExtendedModularityMetric;
import i5.las2peer.services.ocd.metrics.OcdMetricException;
import i5.las2peer.services.ocd.metrics.StatisticalMeasure;
import i5.las2peer.services.ocd.testsUtils.OcdTestGraphFactory;

import java.io.FileNotFoundException;
import java.util.List;

import org.junit.Before;
import org.junit.Test;
import org.la4j.matrix.Matrix;
import org.la4j.matrix.dense.Basic2DMatrix;
import org.la4j.matrix.sparse.CCSMatrix;

import y.base.Node;

public class CoverTest {

	private Cover cover;

	/*
	 * Creates a cover for the sawmill graph
	 */
	@Before
	public void sawmillCoverSetUp() throws AdapterException, FileNotFoundException {
		CustomGraph graph = OcdTestGraphFactory.getSawmillGraph();
		Matrix memberships = new Basic2DMatrix(graph.nodeCount(), 5);
		for(int i=0; i<memberships.rows(); i++) {
			for(int j=0; j<memberships.columns(); j++) {
				memberships.set(i, j, i*j);
			}
		}
		cover = new Cover(graph, memberships);
		System.out.println(cover);
	}

	/*
	 * Tests cover normalization.
	 */
	@Test
	public void testMembershipNormalization() {
		Matrix memberships = cover.getMemberships();
		double rowSum;
		for(int i=0; i<memberships.rows(); i++) {
			rowSum = 0;
			for(int j=0; j<memberships.columns(); j++) {
				//////////// TODO test
				System.out.println("(" + i + ", " + j + ") = " + memberships.get(i, j));
				/////////
				rowSum += memberships.get(i, j);
			}
			assertEquals(1.0, rowSum, 0.00001);
		}
	}

	/*
	 * Tests membership filtering.
	 */
	@Test
	public void testFilterMemberships() throws OcdMetricException, InterruptedException, OcdAlgorithmException {
		StatisticalMeasure metric = new ExtendedModularityMetric();
		metric.measure(cover);
		/*
		 * First row must remain unchanged and sum up to zero precisely.
		 */
		System.out.println(cover.toString());
		cover.filterMembershipsbyThreshold(0.25);
		System.out.println(cover.toString());
		assertEquals(0, cover.getMetrics().size());
		assertEquals(3, cover.communityCount());
	}

	/*
	 * Tests return values of the belonging factors.
	 */
	@Test
	public void testGetBelongingFactor() {
		CustomGraph graph = cover.getGraph();
		Node[] nodes = graph.getNodeArray();
		for(int i=0; i<graph.nodeCount(); i++) {
			double rowSum = 0;
			for(int j=0; j<cover.communityCount() - 1; j++) {
				rowSum += i*j;
			}
			if(rowSum == 0) {
				rowSum = 1;
			}
			for(int j=0; j<cover.communityCount(); j++) {
				if(j<cover.communityCount() - 1) {
					assertEquals(i*j / rowSum, cover.getBelongingFactor(nodes[i], j), 0.001);
				}
				else if (i>0) {
					assertEquals(0, cover.getBelongingFactor(nodes[i], j), 0.001);
				}
				else {
					assertEquals(1, cover.getBelongingFactor(nodes[i], j), 0.001);
				}
			}
		}
	}

	/*
	 * Tests the return value of the community count.
	 */
	@Test
	public void testCommunityCount() {
		assertEquals(cover.communityCount(), 6);
	}

	/*
	 * Tests the return value of the community indices of a node.
	 */
	@Test
	public void testGetCommunityIndices() {
		CustomGraph graph = cover.getGraph();
		Node[] nodes = graph.getNodeArray();
		List<Integer> indices = cover.getCommunityIndices(nodes[0]);
		assertEquals(1, indices.size());
		assertEquals(5, (int)indices.get(0));
		indices = cover.getCommunityIndices(nodes[1]);
		assertEquals(4, indices.size());
		for(int i=1; i<= 4; i++) {
			assertTrue(indices.contains(i));
		}
	}

	@Test
	public void testSetEntriesBelowThresholdToZero() {
		Matrix memberships = new CCSMatrix(1, 5);
		memberships.set(0, 1, 1);
		memberships.set(0, 2, 2);
		memberships.set(0, 3, 3);
		memberships.set(0, 4, 3);
		CustomGraph graph = new CustomGraph();
		graph.createNode();
		Cover cover = new Cover(graph, memberships);
		System.out.println(cover);
		cover.setRowEntriesBelowThresholdToZero(memberships, 0, 0.3);
		assertEquals(0, memberships.get(0, 0), 0);
		assertEquals(0, memberships.get(0, 1), 0);
		assertEquals(0, memberships.get(0, 2), 0);
		assertEquals(0.3333, memberships.get(0, 3), 0.001);
		assertEquals(0.3333, memberships.get(0, 4), 0.001);
		System.out.println(memberships);
	}

}


text:
<?php

namespace OC\Files\Storage;

/**
 * for local filestore, we only have to map the paths
 */
class MappedLocal extends \OC\Files\Storage\Common {
	protected $datadir;
	private $mapper;

	public function __construct($arguments) {
		$this->datadir = $arguments['datadir'];
		if (substr($this->datadir, -1) !== '/') {
			$this->datadir .= '/';
		}

		$this->mapper = new \OC\Files\Mapper($this->datadir);
	}

	public function __destruct() {
		if (defined('PHPUNIT_RUN')) {
			$this->mapper->removePath($this->datadir, true, true);
		}
	}

	public function getId() {
		return 'local::' . $this->datadir;
	}

	public function mkdir($path) {
		return @mkdir($this->buildPath($path), 0777, true);
	}

	public function rmdir($path) {
		try {
			$it = new \RecursiveIteratorIterator(
				new \RecursiveDirectoryIterator($this->buildPath($path)),
				\RecursiveIteratorIterator::CHILD_FIRST
			);
			/**
			 * RecursiveDirectoryIterator on an NFS path isn't iterable with foreach
			 * This bug is fixed in PHP 5.5.9 or before
			 * See #8376
			 */
			$it->rewind();
			while ($it->valid()) {
				/**
				 * @var \SplFileInfo $file
				 */
				$file = $it->current();
				if (in_array($file->getBasename(), array('.', '..'))) {
					$it->next();
					continue;
				} elseif ($file->isDir()) {
					rmdir($file->getPathname());
				} elseif ($file->isFile() || $file->isLink()) {
					unlink($file->getPathname());
				}
				$it->next();
			}
			if ($result = @rmdir($this->buildPath($path))) {
				$this->cleanMapper($path);
			}
			return $result;
		} catch (\UnexpectedValueException $e) {
			return false;
		}
	}

	public function opendir($path) {
		$files = array('.', '..');
		$physicalPath = $this->buildPath($path);

		$logicalPath = $this->mapper->physicalToLogic($physicalPath);
		$dh = opendir($physicalPath);
		if(is_resource($dh)) {
			while (($file = readdir($dh)) !== false) {
				if ($file === '.' or $file === '..') {
					continue;
				}

				$logicalFilePath = $this->mapper->physicalToLogic($physicalPath . '/' . $file);

				$file= $this->mapper->stripRootFolder($logicalFilePath, $logicalPath);
				$file = $this->stripLeading($file);
				$files[]= $file;
			}
		}

		\OC\Files\Stream\Dir::register('local-win32' . $path, $files);
		return opendir('fakedir://local-win32' . $path);
	}

	public function is_dir($path) {
		if (substr($path, -1) == '/') {
			$path = substr($path, 0, -1);
		}
		return is_dir($this->buildPath($path));
	}

	public function is_file($path) {
		return is_file($this->buildPath($path));
	}

	public function stat($path) {
		$fullPath = $this->buildPath($path);
		$statResult = stat($fullPath);
		if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) {
			$filesize = $this->filesize($path);
			$statResult['size'] = $filesize;
			$statResult[7] = $filesize;
		}
		return $statResult;
	}

	public function filetype($path) {
		$filetype = filetype($this->buildPath($path));
		if ($filetype == 'link') {
			$filetype = filetype(realpath($this->buildPath($path)));
		}
		return $filetype;
	}

	public function filesize($path) {
		if ($this->is_dir($path)) {
			return 0;
		}
		$fullPath = $this->buildPath($path);
		if (PHP_INT_SIZE === 4) {
			$helper = new \OC\LargeFileHelper;
			return $helper->getFilesize($fullPath);
		}
		return filesize($fullPath);
	}

	public function isReadable($path) {
		return is_readable($this->buildPath($path));
	}

	public function isUpdatable($path) {
		return is_writable($this->buildPath($path));
	}

	public function file_exists($path) {
		return file_exists($this->buildPath($path));
	}

	public function filemtime($path) {
		return filemtime($this->buildPath($path));
	}

	public function touch($path, $mtime = null) {
		// sets the modification time of the file to the given value.
		// If mtime is nil the current time is set.
		// note that the access time of the file always changes to the current time.
		if (!is_null($mtime)) {
			$result = touch($this->buildPath($path), $mtime);
		} else {
			$result = touch($this->buildPath($path));
		}
		if ($result) {
			clearstatcache(true, $this->buildPath($path));
		}

		return $result;
	}

	public function file_get_contents($path) {
		return file_get_contents($this->buildPath($path));
	}

	public function file_put_contents($path, $data) {
		return file_put_contents($this->buildPath($path), $data);
	}

	public function unlink($path) {
		return $this->delTree($path);
	}

	public function rename($path1, $path2) {
		if (!$this->isUpdatable($path1)) {
			\OC_Log::write('core', 'unable to rename, file is not writable : ' . $path1, \OC_Log::ERROR);
			return false;
		}
		if (!$this->file_exists($path1)) {
			\OC_Log::write('core', 'unable to rename, file does not exists : ' . $path1, \OC_Log::ERROR);
			return false;
		}

		if ($this->is_dir($path2)) {
			$this->rmdir($path2);
		} else if ($this->is_file($path2)) {
			$this->unlink($path2);
		}

		$physicPath1 = $this->buildPath($path1);
		$physicPath2 = $this->buildPath($path2);
		if ($return = rename($physicPath1, $physicPath2)) {
			// mapper needs to create copies or all children
			$this->copyMapping($path1, $path2);
			$this->cleanMapper($physicPath1, false, true);
		}
		return $return;
	}

	public function copy($path1, $path2) {
		if ($this->is_dir($path1)) {
			if ($this->is_dir($path2)) {
				$this->rmdir($path2);
			} else if ($this->is_file($path2)) {
				$this->unlink($path2);
			}
			$dir = $this->opendir($path1);
			$this->mkdir($path2);
			while ($file = readdir($dir)) {
				if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
					if (!$this->copy($path1 . '/' . $file, $path2 . '/' . $file)) {
						return false;
					}
				}
			}
			closedir($dir);
			return true;
		} else {
			if ($return = copy($this->buildPath($path1), $this->buildPath($path2))) {
				$this->copyMapping($path1, $path2);
			}
			return $return;
		}
	}

	public function fopen($path, $mode) {
		if ($return = fopen($this->buildPath($path), $mode)) {
			switch ($mode) {
				case 'r':
					break;
				case 'r+':
				case 'w+':
				case 'x+':
				case 'a+':
					break;
				case 'w':
				case 'x':
				case 'a':
					break;
			}
		}
		return $return;
	}

	/**
	 * @param string $dir
	 */
	private function delTree($dir, $isLogicPath=true) {
		$dirRelative = $dir;
		if ($isLogicPath) {
			$dir = $this->buildPath($dir);
		}
		if (!file_exists($dir)) {
			return true;
		}
		if (!is_dir($dir) || is_link($dir)) {
			if ($return = unlink($dir)) {
				$this->cleanMapper($dir, false);
				return $return;
			}
		}
		foreach (scandir($dir) as $item) {
			if ($item == '.' || $item == '..') {
				continue;
			}
			if (is_file($dir . '/' . $item)) {
				if (unlink($dir . '/' . $item)) {
					$this->cleanMapper($dir . '/' . $item, false);
				}
			} elseif (is_dir($dir . '/' . $item)) {
				if (!$this->delTree($dir . "/" . $item, false)) {
					return false;
				};
			}
		}
		if ($return = rmdir($dir)) {
			$this->cleanMapper($dir, false);
		}
		return $return;
	}

	public function hash($type, $path, $raw = false) {
		return hash_file($type, $this->buildPath($path), $raw);
	}

	public function free_space($path) {
		return @disk_free_space($this->buildPath($path));
	}

	public function search($query) {
		return $this->searchInDir($query);
	}

	public function getLocalFile($path) {
		return $this->buildPath($path);
	}

	public function getLocalFolder($path) {
		return $this->buildPath($path);
	}

	/**
	 * @param string $query
	 */
	protected function searchInDir($query, $dir = '') {
		$files = array();
		$physicalDir = $this->buildPath($dir);
		foreach (scandir($physicalDir) as $item) {
			if ($item == '.' || $item == '..')
				continue;
			$physicalItem = $this->mapper->physicalToLogic($physicalDir . '/' . $item);
			$item = substr($physicalItem, strlen($physicalDir) + 1);

			if (strstr(strtolower($item), strtolower($query)) !== false) {
				$files[] = $dir . '/' . $item;
			}
			if (is_dir($physicalItem)) {
				$files = array_merge($files, $this->searchInDir($query, $dir . '/' . $item));
			}
		}
		return $files;
	}

	/**
	 * check if a file or folder has been updated since $time
	 *
	 * @param string $path
	 * @param int $time
	 * @return bool
	 */
	public function hasUpdated($path, $time) {
		return $this->filemtime($path) > $time;
	}

	/**
	 * @param string $path
	 */
	private function buildPath($path, $create = true) {
		$path = $this->stripLeading($path);
		$fullPath = $this->datadir . $path;
		return $this->mapper->logicToPhysical($fullPath, $create);
	}

	/**
	 * @param string $path
	 */
	private function cleanMapper($path, $isLogicPath = true, $recursive=true) {
		$fullPath = $path;
		if ($isLogicPath) {
			$fullPath = $this->datadir . $path;
		}
		$this->mapper->removePath($fullPath, $isLogicPath, $recursive);
	}

	/**
	 * @param string $path1
	 * @param string $path2
	 */
	private function copyMapping($path1, $path2) {
		$path1 = $this->stripLeading($path1);
		$path2 = $this->stripLeading($path2);

		$fullPath1 = $this->datadir . $path1;
		$fullPath2 = $this->datadir . $path2;

		$this->mapper->copy($fullPath1, $fullPath2);
	}

	/**
	 * @param string $path
	 */
	private function stripLeading($path) {
		if (strpos($path, '/') === 0) {
			$path = substr($path, 1);
		}
		if (strpos($path, '\\') === 0) {
			$path = substr($path, 1);
		}
		if ($path === false) {
			return '';
		}

		return $path;
	}
}


text:
require 'spec_helper'

RSpec.describe 'Escodex integration specs' do
  let(:client) { Cryptoexchange::Client.new }
  let(:market) { 'escodex' }
  let(:lpc_btc_pair) { Cryptoexchange::Models::MarketPair.new(base: 'LPC', target: 'BTC', market: 'escodex') }

  it 'fetch pairs' do
    pairs = client.pairs('escodex')
    expect(pairs).not_to be_empty

    pair = pairs.first
    expect(pair.base).to_not be nil
    expect(pair.target).to_not be nil
    expect(pair.market).to eq 'escodex'
  end

  it 'give trade url' do
    trade_page_url = client.trade_page_url market, base: lpc_btc_pair.base, target: lpc_btc_pair.target
    expect(trade_page_url).to eq "https://wallet.escodex.com/market/ESCODEX.LPC_ESCODEX.BTC"
  end

  it 'fetch ticker' do
    ticker = client.ticker(lpc_btc_pair)

    expect(ticker.base).to eq 'LPC'
    expect(ticker.target).to eq 'BTC'
    expect(ticker.market).to eq 'escodex'
    expect(ticker.last).to be_a Numeric
    expect(ticker.bid).to be_a Numeric
    expect(ticker.ask).to be_a Numeric
    expect(ticker.volume).to be_a Numeric
    expect(ticker.timestamp).to be nil

    expect(ticker.payload).to_not be nil
  end
end


text:
<?php
/**
 * Created by PhpStorm.
 * User: faustos
 * Date: 27.05.14
 * Time: 21:51
 */

namespace Tixi\ApiBundle\Interfaces\Dispo\MonthlyView;

/**
 * Class MonthlyPlanEditDTO
 * @package Tixi\ApiBundle\Interfaces\Dispo\MonthlyView
 */
class MonthlyPlanEditDTO {

    public $workingMonthId;          // integer number
    public $workingDayId;            // integer number
    public $workingMonthDateString;  // swiss date string: dd.mm.yyyy
    public $workingDayWeekdayString; // local day name e.g. Montag
    public $workingDayDateString;    // swiss date string: dd.mm.yyyy
    public $workingDayDate;          // \DateTime object

    public $editMode;                // string with mode: edit, show (local)
    public $shifts = array();        // MonthlyPlanEditShiftDTO[]
    public $allVehicles = array();   // MonthlyPlanEditVehiclesDTO[]
    public $closeUrl;                // close page (fully qualified url)
    public $swapUrl;                 // swap page (fully qualified url)
    public $switchUrl;               // switch to daily plan view (url)
    public $updateUrl;               // rebuild borderingRides (url)

}


text:
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *//**
  * Sample React Native App
  * https://github.com/facebook/react-native
  */
 'use strict';

 import React, { Component } from 'react';
 import {
   AppRegistry,
   StyleSheet,
   Text,
   View
 } from 'react-native';

 import {
   ViroSceneNavigator,
   ViroScene,
   ViroBox,
   ViroMaterials,
   ViroNode,
   ViroOrbitCamera,
   ViroCamera,
   ViroAmbientLight,
   ViroOmniLight,
   ViroSpotLight,
   ViroDirectionalLight,
   ViroImage,
   ViroVideo,
   Viro360Image,
   Viro360Video,
   ViroFlexView,
   ViroUtils,
   ViroText,
   ViroAnimations,
   ViroQuad,
   ViroSkyBox,
   ViroSphere,
   Viro3DObject,
 } from 'react-viro';

let polarToCartesian = ViroUtils.polarToCartesian;

var createReactClass = require('create-react-class');

var ReleaseMenu = require("./ReleaseMenu.js");

var Uri360Image = {uri:"https://lh3.googleusercontent.com/dB3Dvgf3VIglusoGJAfpNUAANhTXW8K9mvIsiIPkhJUAbAKGKJcEMPTf0mkSexzLM5o=w300"};
var Local360Image = require("../res/sun_2302.jpg");

 var ViroSkyBoxTest = createReactClass({
   getInitialState() {
     return {
        color:"#098765",
        format:"RGBA8",
        showColorBackground:false,
        showUrlImage:false
     };
   },

   render: function() {
     var image = this.state.showUrlImage ? Uri360Image : Local360Image;
     if (this.state.showColorBackground){
      return (
            <ViroScene>

            <ReleaseMenu sceneNavigator={this.props.sceneNavigator}/>

             <ViroSkyBox
                 color={this.state.color}
                 format={this.state.format}
                 onLoadStart={this._onLoadStart}
                 onLoadEnd={this._onLoadEnd}/>
                 {this._getTestControls()}

            <ViroImage source={require('./res/poi_dot.png')} position={[-1, 0, 0]} transformBehaviors={["billboard"]} onClick={this._showNext} />

            </ViroScene>

           );
     } else {
      return (
            <ViroScene>
            <ReleaseMenu sceneNavigator={this.props.sceneNavigator}/>

             <ViroSkyBox source={{nx:image,
              px:image,
              ny:image,
              py:image,
              nz:image,
              pz:image}} format={this.state.format} onLoadStart={this._onLoadStart} onLoadEnd={this._onLoadEnd}/>
              {this._getTestControls()}

              <ViroImage source={require('./res/poi_dot.png')} position={[-1, 0, 0]} transformBehaviors={["Billboard"]} onClick={this._showNext} />

            </ViroScene>

           );
     }
   },

   _getTestControls(){
     return(
         <ViroNode position={[0,-0.5,-3]}>
             <ViroText style={styles.baseTextTwo}  position={[-2,0, 0]} width={2} height ={2}
                    text={"ToggleImageSource isUrlIamge: " + this.state.showUrlImage}
                    onClick={this._toggleImageSource}/>

             <ViroText style={styles.baseTextTwo}  position={[0,0, 0]} width={2} height ={2}
                      text={"ToggleImageColor with color: " + this.state.color} textLineBreakMode='Justify'
                                    onClick={this._toggleImageColor}/>

             <ViroText style={styles.baseTextTwo}  position={[2,0, 0]} width={2} height ={2}
                    text={"Toggle Format " + this.state.format}
                    onClick={this._toggleFormat}/>
          </ViroNode>
        );
   },

   _showNext() {
      this.props.sceneNavigator.replace({scene:require('./Viro360ImageTest')});
   },

   _toggleImageSource() {
      var newShowUrlImageFlag = !this.state.showUrlImage;
      this.setState({
          showUrlImage:newShowUrlImageFlag,
          showColorBackground:false
      });
   },

   _toggleImageColor() {
      var newColor = "#098765";
      if (this.state.color == newColor){
        newColor = 0xffff;
      }

      this.setState({
        color:newColor,
        showColorBackground:true
      });
   },

   _toggleFormat() {
        var newState;
        if (this.state.format == "RGBA8"){
            newState="RGB565";
        } else if (this.state.format == "RGB565"){
            newState="RGBA8";
        }
         this.setState({
                            format:newState
                        });
   },

   _onLoadStart() {
        console.log("ViroSkyBoxtest: _onLoadStart");
   },

   _onLoadEnd() {
      console.log("ViroSkyBoxtest: _onLoadEnd");
   },
 });

var styles = StyleSheet.create({
  baseTextTwo: {
      fontFamily: 'Arial',
      fontSize: 10,
      color: '#ffffff',
      flex: 1,
      textAlignVertical: 'center',
      textAlign: 'center',
  },
});

 module.exports = ViroSkyBoxTest;


text:
package com.blackboxsociety.net

import java.net._
import scalaz._
import scalaz.syntax.id._
import scalaz.concurrent._
import scalaz.concurrent.Task._
import java.nio.channels._
import com.blackboxsociety._

trait TcpServer {
  def accept(): Task[TcpClient]
  def close(): Task[Unit]
}

object TcpServer {

  def apply(host: String, port: Int): Task[TcpServer] = now {
    val channel = ServerSocketChannel.open
    val address = new InetSocketAddress(port)
    channel.socket().bind(address)
    channel.configureBlocking(false)
    TcpServerImpl(channel)
  }

  private case class TcpServerImpl(s: ServerSocketChannel) extends TcpServer {

    def accept(): Task[TcpClient] = async { next =>
      EventLoop.addServerSocketAccept(s, { () =>
        val client = s.accept()
        next(TcpClient(client).right)
      })
    }

    def close(): Task[Unit] = async { next =>
      EventLoop.closeChannel(s)
      s.close()
      next(\/-(Unit))
    }

  }

}