text:
<?php
/*
 * Real implementation of crJossoAuth actions
 *
 * @author Lic. Christian A. Rodriguez <car@cespi.unlp.edu.ar>
 */

class BasecrJossoAuthActions extends sfActions
{
  /**
  * Signin action
  * This action in any other application must be responsable of showing
  * the login form and authenticatin user.
  * In this case every job is delegated to JOSSO
  *
  * @access public
  *
  */
  public function executeSignin()
  {
    $agent=JossoAgent::getNewInstance();
    $josso_user=$agent->getUserInSession();
    if (!is_null($josso_user)){
      $this->getUser()->signIn($agent->accessSession());
      $original_url=$this->getUser()->getAttribute('JOSSO_ORIGINAL_URL');
      if (!is_null($original_url)) $this->redirect($original_url);
      $this->redirect('@homepage');
    }else{
      $this->forwardToLoginAction();
    }
  }

  /**
  * Signout action
  * This action in any other application must be responsable of cleainig
  * session objects
  * In this case every job is delegated to JOSSO and same cleaning is done
  *
  * @access public
  *
  */
  public function executeSignout()
  {
    sfLoader::loadHelpers(array('Url'));

    $josso_agent = JossoAgent::getNewInstance();

    $sign_out_url=sfConfig::get('app_cr_josso_plugin_success_signout_url');
    $sign_out_url=!empty($sign_out_url)?$sign_out_url:'@homepage';

    $logoutUrl = $josso_agent->getGatewayLogoutUrl(). '?josso_back_to=' . url_for($sign_out_url,true);

    $logoutUrl = $logoutUrl . $this->createFrontChannelParams();
    setcookie("JOSSO_SESSIONID", '', 0, "/"); // Clear session cookie ...

    $this->getUser()->signOut();

    $this->redirect($logoutUrl);
  }

  /**
  * This function is used by crJossoSecurityFilter to complement its work
  * checking if JOSSO session is still active or not.
  * The trick is all inside a cookie
  *
  * @access public
  *
  */
  public function executeSecurityCheck()
  {
    $agent=JossoAgent::getNewInstance();
    try{
      $assertionId=$this->getRequestParameter('josso_assertion_id');
      $this->forward404Unless($assertionId);
      $ssoSessionId = $agent->resolveAuthenticationAssertion($assertionId);
      setcookie("JOSSO_SESSIONID", $ssoSessionId, 0, "/"); // session cookie ...
      $sign_in_url=sfConfig::get('app_cr_josso_plugin_success_signin_url');
      $sign_in_url=!empty($sign_in_url)?$sign_in_url:'@homepage';
      $this->redirect($sign_in_url);
    }catch(SoapFault $e){
      setcookie("JOSSO_SESSIONID",'', 0, "/"); // session cookie ...
      $this->redirect('@cr_josso_signin');
    }
  }

  /**
  * It builds login URL and redirects the request
  *
  * @access private
  *
  */
  private function forwardToLoginAction()
  {
    sfLoader::loadHelpers(array('Url'));

    $uri=$this->getRequest()->getUri();
    $this->getUser()->setAttribute('JOSSO_ORIGINAL_URL',$uri);
    $agent=JossoAgent::getNewInstance();
    $securityCheckUrl=url_for(
            sfConfig::get('app_cr_josso_plugin_security_check_module')."/".
            sfConfig::get('app_cr_josso_plugin_security_check_action'),true);
    $loginUrl = $agent->getGatewayLoginUrl(). '?josso_back_to=' . $securityCheckUrl;
    $loginUrl = $loginUrl . $this->createFrontChannelParams();
    $this->redirect($loginUrl);
  }

  private function createFrontChannelParams() {
    // Add some request parameters like host name
    $host = $_SERVER['HTTP_HOST'];
    $params = '&josso_partnerapp_host=' . $host;
    return $params;
    // TODO : Support josso_partnerapp_ctx param too ?

  }

}


text: A Java NIO Server using non-blocking IO all the way through.

redpajama_set_name: RedPajamaGithub


text:
package eu.hansolo.tilesfx.skins;

import eu.hansolo.tilesfx.Tile;
import eu.hansolo.tilesfx.TimeSection;
import eu.hansolo.tilesfx.fonts.Fonts;
import eu.hansolo.tilesfx.tools.Helper;
import javafx.geometry.Point2D;
import javafx.geometry.VPos;
import javafx.scene.CacheHint;
import javafx.scene.Group;
import javafx.scene.effect.BlurType;
import javafx.scene.effect.DropShadow;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Arc;
import javafx.scene.shape.ArcType;
import javafx.scene.shape.Circle;
import javafx.scene.shape.FillRule;
import javafx.scene.shape.LineTo;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.StrokeLineCap;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.transform.Rotate;

import java.time.DayOfWeek;
import java.time.Instant;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoField;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by hansolo on 20.12.16.
 */
public class TimerControlTileSkin extends TileSkin {
    private              DateTimeFormatter     dateFormatter;
    private              double                clockSize;
    private              Pane                  sectionsPane;
    private              Path                  minuteTickMarks;
    private              Path                  hourTickMarks;
    private              Rectangle             hour;
    private              Rectangle             minute;
    private              Rectangle             second;
    private              Circle                knob;
    private              Text                  titleText;
    private              Text                  amPmText;
    private              Text                  dateText;
    private              Text                  text;
    private              Rotate                hourRotate;
    private              Rotate                minuteRotate;
    private              Rotate                secondRotate;
    private              Group                 shadowGroupHour;
    private              Group                 shadowGroupMinute;
    private              Group                 shadowGroupSecond;
    private              DropShadow            dropShadow;
    private              Map<TimeSection, Arc> sectionMap;

    // ******************** Constructors **************************************
    public TimerControlTileSkin(final Tile TILE) {
        super(TILE);
    }

    // ******************** Initialization ************************************
    @Override protected void initGraphics() {
        super.initGraphics();

        currentValueListener = o -> {
            if (tile.isRunning()) { return; } // Update time only if clock is not already running
            updateTime(ZonedDateTime.ofInstant(Instant.ofEpochSecond(tile.getCurrentTime()), ZoneId.of(ZoneId.systemDefault().getId())));
        };
        timeListener         = o -> updateTime(tile.getTime());

        dateFormatter = DateTimeFormatter.ofPattern("EE d", tile.getLocale());

        sectionMap   = new HashMap<>(tile.getTimeSections().size());
        for (TimeSection section : tile.getTimeSections()) { sectionMap.put(section, new Arc()); }

        minuteRotate = new Rotate();
        hourRotate   = new Rotate();
        secondRotate = new Rotate();

        sectionsPane = new Pane();
        sectionsPane.getChildren().addAll(sectionMap.values());
        Helper.enableNode(sectionsPane, tile.getSectionsVisible());

        minuteTickMarks = new Path();
        minuteTickMarks.setFillRule(FillRule.EVEN_ODD);
        minuteTickMarks.setFill(null);
        minuteTickMarks.setStroke(tile.getMinuteColor());
        minuteTickMarks.setStrokeLineCap(StrokeLineCap.ROUND);

        hourTickMarks = new Path();
        hourTickMarks.setFillRule(FillRule.EVEN_ODD);
        hourTickMarks.setFill(null);
        hourTickMarks.setStroke(tile.getHourColor());
        hourTickMarks.setStrokeLineCap(StrokeLineCap.ROUND);

        hour = new Rectangle(3, 60);
        hour.setArcHeight(3);
        hour.setArcWidth(3);
        hour.setStroke(tile.getHourColor());
        hour.getTransforms().setAll(hourRotate);

        minute = new Rectangle(3, 96);
        minute.setArcHeight(3);
        minute.setArcWidth(3);
        minute.setStroke(tile.getMinuteColor());
        minute.getTransforms().setAll(minuteRotate);

        second = new Rectangle(1, 96);
        second.setArcHeight(1);
        second.setArcWidth(1);
        second.setStroke(tile.getSecondColor());
        second.getTransforms().setAll(secondRotate);
        second.setVisible(tile.isSecondsVisible());
        second.setManaged(tile.isSecondsVisible());

        knob = new Circle(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, 4.5);
        knob.setStroke(Color.web("#282a3280"));

        dropShadow = new DropShadow();
        dropShadow.setColor(Color.rgb(0, 0, 0, 0.25));
        dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
        dropShadow.setRadius(0.015 * PREFERRED_WIDTH);
        dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH);

        shadowGroupHour   = new Group(hour);
        shadowGroupMinute = new Group(minute);
        shadowGroupSecond = new Group(second, knob);

        shadowGroupHour.setEffect(tile.isShadowsEnabled() ? dropShadow : null);
        shadowGroupMinute.setEffect(tile.isShadowsEnabled() ? dropShadow : null);
        shadowGroupSecond.setEffect(tile.isShadowsEnabled() ? dropShadow : null);

        titleText = new Text("");
        titleText.setTextOrigin(VPos.TOP);
        Helper.enableNode(titleText, !tile.getTitle().isEmpty());

        amPmText = new Text(tile.getTime().get(ChronoField.AMPM_OF_DAY) == 0 ? "AM" : "PM");

        dateText = new Text("");
        Helper.enableNode(dateText, tile.isDateVisible());

        text = new Text("");
        Helper.enableNode(text, tile.isTextVisible());

        getPane().getChildren().addAll(sectionsPane, hourTickMarks, minuteTickMarks, titleText, amPmText, dateText, text, shadowGroupHour, shadowGroupMinute, shadowGroupSecond);
    }

    @Override protected void registerListeners() {
        super.registerListeners();
        tile.timeProperty().addListener(timeListener);
    }

    // ******************** Methods *******************************************
    @Override protected void handleEvents(final String EVENT_TYPE) {
        super.handleEvents(EVENT_TYPE);

        if ("VISIBILITY".equals(EVENT_TYPE)) {
            Helper.enableNode(titleText, !tile.getTitle().isEmpty());
            Helper.enableNode(text, tile.isTextVisible());
            Helper.enableNode(dateText, tile.isDateVisible());
            Helper.enableNode(second, tile.isSecondsVisible());
            Helper.enableNode(sectionsPane, tile.getSectionsVisible());
        } else if ("SECTION".equals(EVENT_TYPE)) {
            sectionMap.clear();
            for (TimeSection section : tile.getTimeSections()) { sectionMap.put(section, new Arc()); }
            sectionsPane.getChildren().setAll(sectionMap.values());
            resize();
            redraw();
        }
    }

    private void drawTicks() {
        minuteTickMarks.setCache(false);
        hourTickMarks.setCache(false);
        minuteTickMarks.getElements().clear();
        hourTickMarks.getElements().clear();
        double  sinValue;
        double  cosValue;
        double  startAngle             = 180;
        double  angleStep              = 360 / 60;
        Point2D center                 = new Point2D(clockSize * 0.5, clockSize * 0.5);
        boolean hourTickMarksVisible   = tile.isHourTickMarksVisible();
        boolean minuteTickMarksVisible = tile.isMinuteTickMarksVisible();
        for (double angle = 0, counter = 0 ; Double.compare(counter, 59) <= 0 ; angle -= angleStep, counter++) {
            sinValue = Math.sin(Math.toRadians(angle + startAngle));
            cosValue = Math.cos(Math.toRadians(angle + startAngle));

            Point2D innerPoint       = new Point2D(center.getX() + clockSize * 0.405 * sinValue, center.getY() + clockSize * 0.405 * cosValue);
            Point2D innerMinutePoint = new Point2D(center.getX() + clockSize * 0.435 * sinValue, center.getY() + clockSize * 0.435 * cosValue);
            Point2D outerPoint       = new Point2D(center.getX() + clockSize * 0.465 * sinValue, center.getY() + clockSize * 0.465 * cosValue);

            if (counter % 5 == 0) {
                // Draw hour tickmark
                if (hourTickMarksVisible) {
                    hourTickMarks.setStrokeWidth(clockSize * 0.01);
                    hourTickMarks.getElements().add(new MoveTo(innerPoint.getX(), innerPoint.getY()));
                    hourTickMarks.getElements().add(new LineTo(outerPoint.getX(), outerPoint.getY()));
                } else if (minuteTickMarksVisible) {
                    minuteTickMarks.setStrokeWidth(clockSize * 0.005);
                    minuteTickMarks.getElements().add(new MoveTo(innerMinutePoint.getX(), innerMinutePoint.getY()));
                    minuteTickMarks.getElements().add(new LineTo(outerPoint.getX(), outerPoint.getY()));
                }
            } else if (counter % 1 == 0 && minuteTickMarksVisible) {
                // Draw minute tickmark
                minuteTickMarks.setStrokeWidth(clockSize * 0.005);
                minuteTickMarks.getElements().add(new MoveTo(innerMinutePoint.getX(), innerMinutePoint.getY()));
                minuteTickMarks.getElements().add(new LineTo(outerPoint.getX(), outerPoint.getY()));
            }
        }
        minuteTickMarks.setCache(true);
        minuteTickMarks.setCacheHint(CacheHint.QUALITY);
        hourTickMarks.setCache(true);
        hourTickMarks.setCacheHint(CacheHint.QUALITY);
    }

    private void drawTimeSections() {
        if (sectionMap.isEmpty()) return;
        ZonedDateTime time              = tile.getTime();
        DayOfWeek     day               = time.getDayOfWeek();
        boolean       isAM              = time.get(ChronoField.AMPM_OF_DAY) == 0;
        double        offset            = 90;
        double        angleStep         = 360.0 / 60.0;
        boolean       highlightSections = tile.isHighlightSections();
        for (TimeSection section : sectionMap.keySet()) {
            LocalTime   start     = section.getStart();
            LocalTime   stop      = section.getStop();
            boolean     isStartAM = start.get(ChronoField.AMPM_OF_DAY) == 0;
            boolean     isStopAM  = stop.get(ChronoField.AMPM_OF_DAY) == 0;
            boolean     draw      = isAM ? (isStartAM || isStopAM) : (!isStartAM || !isStopAM);
            if (!section.getDays().contains(day)) { draw = false; }
            if (!section.isActive()) { draw = false; }
            if (draw) {
                double sectionStartAngle = (start.getHour() % 12 * 5.0 + start.getMinute() / 12.0 + start.getSecond() / 300.0) * angleStep + 180;
                double sectionAngleExtend = ((stop.getHour() - start.getHour()) % 12 * 5.0 + (stop.getMinute() - start.getMinute()) / 12.0 + (stop.getSecond() - start.getSecond()) / 300.0) * angleStep;
                if (start.getHour() > stop.getHour()) { sectionAngleExtend = (360.0 - Math.abs(sectionAngleExtend)); }

                Arc arc = sectionMap.get(section);
                arc.setCenterX(clockSize * 0.5);
                arc.setCenterY(clockSize * 0.5);
                arc.setRadiusX(clockSize * 0.45);
                arc.setRadiusY(clockSize * 0.45);
                arc.setStartAngle(-(offset + sectionStartAngle));
                arc.setLength(-sectionAngleExtend);
                arc.setType(ArcType.OPEN);
                arc.setStrokeWidth(clockSize * 0.04);
                arc.setStrokeLineCap(StrokeLineCap.BUTT);
                arc.setFill(null);

                if (highlightSections) {
                    arc.setStroke(section.contains(time.toLocalTime()) ? section.getHighlightColor() : section.getColor());
                } else {
                    arc.setStroke(section.getColor());
                }
            }
        }
    }

    public void updateTime(final ZonedDateTime TIME) {
        if (tile.isDiscreteHours()) {
            hourRotate.setAngle(TIME.getHour() * 30);
        } else {
            hourRotate.setAngle(0.5 * (60 * TIME.getHour() + TIME.getMinute()));
        }

        if (tile.isDiscreteMinutes()) {
            minuteRotate.setAngle(TIME.getMinute() * 6);
        } else {
            minuteRotate.setAngle(TIME.getMinute() * 6 + TIME.getSecond() * 0.1);
        }

        if (second.isVisible()) {
            if (tile.isDiscreteSeconds()) {
                secondRotate.setAngle(TIME.getSecond() * 6);
            } else {
                secondRotate.setAngle(TIME.getSecond() * 6 + TIME.get(ChronoField.MILLI_OF_SECOND) * 0.006);
            }
        }

        if (sectionsVisible) {
            for (TimeSection section : sectionMap.keySet()) {
                if (highlightSections) {
                    sectionMap.get(section).setStroke(section.contains(TIME.toLocalTime()) ? section.getHighlightColor() : section.getColor());
                } else {
                    sectionMap.get(section).setStroke(section.getColor());
                }
            }
            drawTimeSections();
        }

        amPmText.setText(TIME.get(ChronoField.AMPM_OF_DAY) == 0 ? "AM" : "PM");
        Helper.adjustTextSize(amPmText, 0.2 * size, size * 0.05);
        amPmText.setX((width - amPmText.getLayoutBounds().getWidth()) * 0.5);
        amPmText.setY(height * 0.5 - size * 0.1);

        dateText.setText(dateFormatter.format(TIME).toUpperCase());
        Helper.adjustTextSize(dateText, 0.3 * size, size * 0.05);
        dateText.setX((width - dateText.getLayoutBounds().getWidth()) * 0.5);
        dateText.setY(height * 0.5 + size * 0.15);
    }

    @Override public void dispose() {
        tile.timeProperty().removeListener(timeListener);
        super.dispose();
    }

    // ******************** Resizing ******************************************
    @Override protected void resizeDynamicText() {
        double maxWidth = width - size * 0.1;
        double fontSize = size * textSize.factor;

        boolean customFontEnabled = tile.isCustomFontEnabled();
        Font    customFont        = tile.getCustomFont();
        Font    font              = (customFontEnabled && customFont != null) ? Font.font(customFont.getFamily(), fontSize) : Fonts.latoRegular(fontSize);

        titleText.setFont(font);
        titleText.setText(tile.getTitle());
        if (titleText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(titleText, maxWidth, fontSize); }
        switch(tile.getTitleAlignment()) {
            default    :
            case LEFT  : titleText.relocate(size * 0.05, size * 0.05); break;
            case CENTER: titleText.relocate((width - titleText.getLayoutBounds().getWidth()) * 0.5, size * 0.05); break;
            case RIGHT : titleText.relocate(width - (size * 0.05) - titleText.getLayoutBounds().getWidth(), size * 0.05); break;
        }
        titleText.setY(size * 0.05);

        maxWidth = width - size * 0.8;
        amPmText.setFont(font);
        amPmText.setText(tile.getTime().get(ChronoField.AMPM_OF_DAY) == 0 ? "AM" : "PM");
        Helper.adjustTextSize(amPmText, maxWidth, fontSize);
        amPmText.setX((width - amPmText.getLayoutBounds().getWidth()) * 0.5);
        amPmText.setY(height * 0.5 - size * 0.1);

        maxWidth = width - size * 0.4;
        dateText.setFont(font);
        if (dateText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(dateText, maxWidth, fontSize); }
        dateText.setX((width - dateText.getLayoutBounds().getWidth()) * 0.5);
        dateText.setY(height * 0.5 + size * 0.15);

        maxWidth = width - size * 0.1;

        text.setText(tile.getText());
        text.setFont(font);
        if (text.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(text, maxWidth, fontSize); }
        switch(tile.getTextAlignment()) {
            default    :
            case LEFT  : text.setX(size * 0.05); break;
            case CENTER: text.setX((width - text.getLayoutBounds().getWidth()) * 0.5); break;
            case RIGHT : text.setX(width - (size * 0.05) - text.getLayoutBounds().getWidth()); break;
        }
        text.setY(height - size * 0.05);
    }

    @Override protected void resize() {
        super.resize();
        clockSize      = contentBounds.getWidth() < contentBounds.getHeight() ? contentBounds.getWidth() : contentBounds.getHeight();
        double centerX = width * 0.5;
        double centerY = height * 0.5;

        sectionsPane.setMinSize(clockSize, clockSize);
        sectionsPane.relocate((width - clockSize) * 0.5, (height - clockSize) * 0.5);

        dropShadow.setRadius(0.008 * size);
        dropShadow.setOffsetY(0.008 * size);

        drawTimeSections();
        drawTicks();

        hourTickMarks.relocate((width - hourTickMarks.getLayoutBounds().getWidth()) * 0.5,
                               (height - hourTickMarks.getLayoutBounds().getHeight()) * 0.5);
        minuteTickMarks.relocate((width - minuteTickMarks.getLayoutBounds().getWidth()) * 0.5,
                                 (height - minuteTickMarks.getLayoutBounds().getHeight()) * 0.5);

        hour.setFill(tile.getHourColor());
        hour.setCache(false);
        hour.setWidth(clockSize * 0.015);
        hour.setHeight(clockSize * 0.29);
        hour.setArcWidth(clockSize * 0.015);
        hour.setArcHeight(clockSize * 0.015);
        hour.setCache(true);
        hour.setCacheHint(CacheHint.ROTATE);
        hour.relocate(centerX - hour.getWidth() * 0.5, centerY - hour.getHeight());

        minute.setFill(tile.getMinuteColor());
        minute.setCache(false);
        minute.setWidth(clockSize * 0.015);
        minute.setHeight(clockSize * 0.47);
        minute.setArcWidth(clockSize * 0.015);
        minute.setArcHeight(clockSize * 0.015);
        minute.setCache(true);
        minute.setCacheHint(CacheHint.ROTATE);
        minute.relocate(centerX - minute.getWidth() * 0.5, centerY - minute.getHeight());

        second.setFill(tile.getSecondColor());
        second.setCache(false);
        second.setWidth(clockSize * 0.005);
        second.setHeight(clockSize * 0.47);
        second.setArcWidth(clockSize * 0.015);
        second.setArcHeight(clockSize * 0.015);
        second.setCache(true);
        second.setCacheHint(CacheHint.ROTATE);
        second.relocate(centerX - second.getWidth() * 0.5, centerY - second.getHeight());

        knob.setFill(tile.getKnobColor());
        knob.setRadius(clockSize * 0.0225);
        knob.setCenterX(centerX);
        knob.setCenterY(centerY);

        minuteRotate.setPivotX(minute.getWidth() * 0.5);
        minuteRotate.setPivotY(minute.getHeight());
        hourRotate.setPivotX(hour.getWidth() * 0.5);
        hourRotate.setPivotY(hour.getHeight());
        secondRotate.setPivotX(second.getWidth() * 0.5);
        secondRotate.setPivotY(second.getHeight());
    }

    @Override protected void redraw() {
        super.redraw();

        dateFormatter = DateTimeFormatter.ofPattern("EE d", tile.getLocale());

        shadowGroupHour.setEffect(tile.isShadowsEnabled() ? dropShadow : null);
        shadowGroupMinute.setEffect(tile.isShadowsEnabled() ? dropShadow : null);
        shadowGroupSecond.setEffect(tile.isShadowsEnabled() ? dropShadow : null);

        // Tick Marks
        minuteTickMarks.setStroke(tile.getMinuteColor());
        hourTickMarks.setStroke(tile.getHourColor());

        updateTime(tile.getTime());

        resizeDynamicText();

        titleText.setFill(tile.getTitleColor());
        amPmText.setFill(tile.getTitleColor());
        dateText.setFill(tile.getDateColor());
        text.setFill(tile.getTextColor());
    }
}


text:
using System;

namespace NJsonApi
{
    public class Context
    {
        public Context(Uri requestUri)
        {
            IncludedResources = new string[0];
            RequestUri = requestUri;
        }

        public Context(Uri requestUri, string[] includedResources)
        {
            RequestUri = requestUri;
            IncludedResources = includedResources;
        }

        public Uri RequestUri { get; private set; }
        public string[] IncludedResources { get; set; }

        public Uri BaseUri {
            get
            {
                var authority = (UriComponents.Scheme | UriComponents.UserInfo | UriComponents.Host | UriComponents.Port);
                return new Uri(RequestUri.GetComponents(authority, UriFormat.SafeUnescaped));
            }
        }
    }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>The Markdown Tutorial</title>
  <meta name="description" content="">
  <meta name="author" content="">

  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

  <link href="http://fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">

  <link rel="stylesheet" href="../css/normalize.css">
  <link rel="stylesheet" href="../css/skeleton.css">
  <link rel="stylesheet" href="../css/sweet-alert.css">
  <link rel="stylesheet" href="../css/fullPage.css">
  <link rel="stylesheet" href="../css/points.css">
  <link rel="stylesheet" href="../css/menu.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/styles/default.min.css">
  <link rel="stylesheet" href="../css/style.css">

  <link rel="icon" type="image/png" href="../images/favicon.png">

1

2

3

4

Paragraphs

A paragraph in Markdown is made by separating consecutive lines of text with one or more blank lines. This is known as a hard break.

To create a line break, you need to end a line with two or more spaces. Just typing return won't do it. This is known as a soft break.

Click on the red points to know more. Move through the exercises by using the buttons or the dot menu at the bottom.

Click on the red points to know more. Move through the exercises by using the buttons or by swiping left or right.

<button class="button-primary button-next">Start exercises</button>

									More

											A blank line is any line without text or a line containing nothing but spaces or tabs.

										Close

									More

											There are two spaces here.

										Close

Organize the following two sentences into two paragraphs.

					<textarea id="editor_7-1" class="editor">Actress Amy Adams has been nominated five times for an Academy Award.265 million people kick a football in association football matches every year.</textarea>

					<input id="ck_show_html_7-1" type="checkbox" class="show-html" /> Show generated HTML?

<button id="btn_answer_7-1" class="button-primary button-answer">Show me the answer</button>

<button class="button-primary button-previous u-full-width">Go to the beginning</button>
					<button class="button-primary button-next u-full-width">Next Exercise</button>

Format these lines of "The Road Not Taken" by Robert Frost so they look like in the Markdown editor.

					<textarea id="editor_7-2" class="editor">Two roads diverged in a yellow wood,
And sorry I could not travel both
And be one traveler, long I stood
And looked down one as far as I could
To where it bent in the undergrowth</textarea>

					<input id="ck_show_html_7-2" type="checkbox" class="show-html" /> Show generated HTML?

<button id="btn_answer_7-2" class="button-primary button-answer">Show me the answer</button>

<button class="button-primary button-previous u-full-width">Previous Exercise</button>
					<button class="button-primary button-next u-full-width">Next Exercise</button>

Play with the concepts you just learned!

For example:

					Use formatting elements (like inline code) inside a paragraph.

See the generated HTML. Even if you don't know HTML, try to understand what's happening. Go wild!

					Go to the next lesson when you're ready.

					<textarea id="editor_7-3" class="editor"></textarea>

					<input id="ck_show_html_7-3" type="checkbox" class="show-html" /> Show generated HTML?

<button class="button-primary button-previous u-full-width">Previous Exercise</button>
					Go to the next lesson


text:
var User = require('./User')

class Parent extends User {
  constructor(
    id,
    first_name,
    last_name,
    phone,
    active,
    ak_access_token,
    ak_user_id,
    ak_token_refresh_interval_sec,
    ak_token_last_renewed_timestamp,
    last_login_timestamp,
    created_on_timestamp,
    member_since_timestamp,
    profilePhotoUrl,
    neighborhood,
    otherNeighborhood,
    kids
  ) {
    super(
      id,
      first_name,
      last_name,
      phone,
      "Parent",
      active,
      ak_access_token,
      ak_user_id,
      ak_token_refresh_interval_sec,
      ak_token_last_renewed_timestamp,
      last_login_timestamp,
      created_on_timestamp,
      member_since_timestamp,
      profilePhotoUrl
    )
    this.neighborhood = neighborhood;
    this.otherNeighborhood = otherNeighborhood;
    this.kids = kids;
  }

  toString() {
    return `
      Parent\n
      ${super.toString()}
      neighborhood\t${this.neighborhood}\n
      otherNeighborhood\t${this.otherNeighborhood}\n
      kids\t${this.kids}\n
    `
  }
}

module.exports = Parent


text:
import './default_viewer.css';

import 'neuroglancer/sliceview/chunk_format_handlers';

import {StatusMessage} from 'neuroglancer/status';
import {DisplayContext} from 'neuroglancer/display_context';
import {Viewer, ViewerOptions} from 'neuroglancer/viewer';
import {disableContextMenu, disableWheel} from 'neuroglancer/ui/disable_default_actions';

export function makeDefaultViewer(options?: Partial<ViewerOptions>) {
  disableContextMenu();
  disableWheel();
  try {
    let display = new DisplayContext(document.getElementById('neuroglancer-container')!);
    return new Viewer(display, options);
  } catch (error) {
    StatusMessage.showMessage(`Error: ${error.message}`);
    throw error;
  }
}


text:
#ifndef _OISCompileSettings_h_
#define _OISCompileSettings_h_

#ifdef WIN32
/* #undef OGREKIT_OIS_WIN32_NATIVE */

#ifdef OGREKIT_OIS_WIN32_NATIVE
#define OIS_WIN32_NATIVE 1
#endif

#endif

#endif//_OISCompileSettings_h_


text:
var AuthorSource = {
    getAuthor:function(page=1,limit=10,params={}){
        return new Promise(function(resolve,reject){
            var url = "/api/author";
            var param = {
                "page": page,
                "limit": limit,
                "query": params
            };
            $.get(url, param).done(resolve).fail(reject);
        })
    },
    updateAuthor:function(author={}){
        return new Promise(function(resolve,reject){
            var url = "/api/updateAuthor";
            $.post(url, author).done(resolve).fail(reject);
        })
    }
}

export default AuthorSource;


text:
/*
 * 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.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.slides.v1.model;

/**
 * Ungroups objects, such as groups.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Google Slides API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class UngroupObjectsRequest extends com.google.api.client.json.GenericJson {

  /**
   * The object IDs of the objects to ungroup. Only groups that are not inside other groups can be
   * ungrouped. All the groups should be on the same page. The group itself is deleted. The visual
   * sizes and positions of all the children are preserved.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<java.lang.String> objectIds;

  /**
   * The object IDs of the objects to ungroup. Only groups that are not inside other groups can be
   * ungrouped. All the groups should be on the same page. The group itself is deleted. The visual
   * sizes and positions of all the children are preserved.
   * @return value or {@code null} for none
   */
  public java.util.List<java.lang.String> getObjectIds() {
    return objectIds;
  }

  /**
   * The object IDs of the objects to ungroup. Only groups that are not inside other groups can be
   * ungrouped. All the groups should be on the same page. The group itself is deleted. The visual
   * sizes and positions of all the children are preserved.
   * @param objectIds objectIds or {@code null} for none
   */
  public UngroupObjectsRequest setObjectIds(java.util.List<java.lang.String> objectIds) {
    this.objectIds = objectIds;
    return this;
  }

  @Override
  public UngroupObjectsRequest set(String fieldName, Object value) {
    return (UngroupObjectsRequest) super.set(fieldName, value);
  }

  @Override
  public UngroupObjectsRequest clone() {
    return (UngroupObjectsRequest) super.clone();
  }

}


text:
import React from 'react'

const NoMatch = ({ location }) => (

Sorry, we could not find: {location.pathname}

)

export default NoMatch


text:
namespace FluentMsBuild
{
    /// <summary>
    /// Interface for adding chaining functinality to a wrapped ImportGroup element
    /// </summary>
    public interface IImportGroupActions : IElementContainerActions<IImportGroupActions, ImportGroup>
    {
        /// <summary>
        /// Sets the project of the ImportGroup
        /// </summary>
        /// <returns>The ImportActions to allow chaining</returns>
        IImportActions AddImport(string project);
    }
}


text:
/**
 * @author X. Chen, Tested by Curtis Lewis
 * @date 22 Feb '14
 * @brief Stores information about a Piece object.
 * @details Stores a piece object in a specific board position by having 2 identical
 * 2D arrays where one stores an integer which corresponds to the other having
 * a piece at the same index location.
 *
 */
public class Board {

    /** Method to get the 2D array (board) of pieces */
    public Piece[][] getBoard() {
        return m_Pieces;
    }

    public Piece getPiece(int i, int j){
        return m_Pieces[i][j];
    }

    /**
     * Returns the heiht of the board
     * @return the m_BoardHeight
     */
    public int getBoardHeight(){
        return m_BoardHeight;
    }

    /** Method to set the boards height */
    public void setBoardHeight(int boardHeight){
        m_BoardHeight = boardHeight;
    }

    /**
     * Returns the width of the board
     * @return the m_BoardWidth
     */
    public int getBoardWidth(){
        return m_BoardWidth;
    }

    /** Method to set the boards width */
    public void setBoardWidth(int boardWidth){
        m_BoardWidth = boardWidth;
    }

    /**
     *  Method to "setBoard" which instantiate both 2D arrays
     *  Initializes board for given board size values
     *  @param set the the Width of the board
     *  @param set the the height of the board
     */
    public void setBoard(int boardWidth, int boardHeight) {
        setBoardHeight(boardHeight);
        setBoardWidth(boardWidth);
        m_Board = new int[boardWidth][boardHeight];
        m_Pieces = new Piece[boardWidth][boardHeight];
        for(int j = 0; j < boardHeight; j++){
            for(int i = 0; i < boardWidth; i++){
                m_Pieces[i][j] = new Piece(" ");
            }
        }
    }

    /**
     * Method to set a piece in both arrays
     * initializes piece for given position values and colour
     * @param set the the colour of the piece
     * @param set the the row number of the piece
     * @param set the the column number of the piece
     */
    public void setPiece(Piece piece, int column, int row) {
        System.out.println("Board::setPiece()");
        if(m_Board[column][row] != HAS_PIECE_OBJECT){
            m_Board[column][row] = HAS_PIECE_OBJECT;
            m_Pieces[column][row] = piece;
        }
    }

    public void setPiece2(Piece piece, int column, int row) {
        System.out.println("Board::setPiece2()");
        m_Board[column][row] = HAS_PIECE_OBJECT;
        m_Pieces[column][row] = piece;
    }
    public void foobar(int i, int j){
        m_Board[i][j] = 1;
    }

    /**
     *  Method to check if a board has a piece object in it i.e. is not empty
     */
    public boolean isEmpty(int column, int row) {
        return m_Board[column][row] != HAS_PIECE_OBJECT;
    }

    public static void main(String[] args) {

            m_BoardStore = new Board();
            m_BoardStore.setBoard(NORMAL_BOARD_SIZE, NORMAL_BOARD_SIZE);
            // get the right size values.

        if(m_BoardStore.getBoardWidth() == NORMAL_BOARD_SIZE && m_BoardStore.getBoardHeight() == NORMAL_BOARD_SIZE) {
            System.out.println("Board Test One NormalSize Evaluated: Correct");
        } else {
            System.out.println("Board Test One NormalSize Evaluated: Incorrect");
        }

        // Set board with no size.

            m_BoardStore = new Board();
            m_BoardStore.setBoard(0, 0);
            // get the right size values.

        if(m_BoardStore.getBoardWidth() == 0 && m_BoardStore.getBoardHeight() == 0) {
            System.out.println("Board Test Two NoSize Evaluated: Correct");
        } else {
            System.out.println("Board Test Two NoSize Evaluated: Incorrect");
        }

        // Set board with sizes very big.

            m_BoardStore = new Board();
            m_BoardStore.setBoard(LARGE_BOARD_SIZE, LARGE_BOARD_SIZE);
            // get the right size values.

        if(m_BoardStore.getBoardWidth() == LARGE_BOARD_SIZE && m_BoardStore.getBoardHeight() == LARGE_BOARD_SIZE) {
            System.out.println("Board Test Three BigSize Evaluated: Correct");
        } else {
            System.out.println("Board Test Three BigSize Evaluated: Incorrect");
        }

        // Set board with negative sizes which is impossible.
        // so there is no board here.
        try {

            m_BoardStore = new Board();
            m_BoardStore.setBoard(NEGATIVE_BOARD_SIZE, NEGATIVE_BOARD_SIZE);

            if(m_BoardStore.getBoardWidth() == NEGATIVE_BOARD_SIZE && m_BoardStore.getBoardHeight() == NEGATIVE_BOARD_SIZE) {

                System.out.println("Board Test Four MinusSize Evaluated: Correct");
            }

        } catch (Exception e) {
            System.out.println("Board Test Four MinusSize Evaluated: Incorrect");
        }

        try {

            // create a board and try to set piece outside the board.

            m_BoardStore = new Board();
            m_BoardStore.setBoard(NORMAL_BOARD_SIZE, NORMAL_BOARD_SIZE);
            m_Piece = new Piece("black");
            m_BoardStore.setPiece(m_Piece, OUTSIDE_BOARD, OUTSIDE_BOARD);

            // maybe it just stores the data. no change on the board.

        if(m_BoardStore.getBoard()[OUTSIDE_BOARD][OUTSIDE_BOARD].getColour().equals ("black")) {

            System.out.println("Board Test Five OutsideBoard Evaluated: Correct");
        }

        } catch (Exception e) {

            System.out.println("Board Test Five OutsideBoard Evaluated: Incorrect");

        }

        try {

            // set piece in a negative position which is not exist.

            m_BoardStore = new Board();
            m_BoardStore.setBoard(NORMAL_BOARD_SIZE, NORMAL_BOARD_SIZE);
            m_Piece = new Piece("black");
            m_BoardStore.setPiece(m_Piece, NEGATIVE_BOARD_SIZE, NEGATIVE_BOARD_SIZE);

            // maybe it just stores the data. no change on the board.

        if(m_BoardStore.getBoard()[-1][-1].getColour().equals ("black")) {
            System.out.println("Board Test Six NegativeBoard Evaluated: Correct");
        }

        } catch (Exception e) {

            System.out.println("Board Test Six NegativeBoard Evaluated: Incorrect");

        }

        // set a black piece on the edge of the board

            m_BoardStore = new Board();
            m_BoardStore.setBoard(NORMAL_BOARD_SIZE, NORMAL_BOARD_SIZE);
            m_Piece = new Piece("black");
            m_BoardStore.setPiece(m_Piece, 0, ROW_SEVEN);
            // yeah! there is a black piece!

        if(m_BoardStore.getBoard()[0][ROW_SEVEN].getColour().equals ("black")) {
            System.out.println("Board Test Seven BlackOnSide Evaluated: Correct");
        } else {
            System.out.println("Board Test Seven BlackOnSide Evaluated: Incorrect");
        }

        /** set a black piece on the board
         *  then set a white piece at the same position
         *  please do not override it !
         */

            m_BoardStore = new Board();
            m_BoardStore.setBoard(NORMAL_BOARD_SIZE, NORMAL_BOARD_SIZE);
            // set a black piece on column 0, row 7.
            m_Piece = new Piece("black");
            m_BoardStore.setPiece(m_Piece, 0, ROW_SEVEN);
            // set a white piece again on column 0, row 7.
            m_Piece2 = new Piece("white");
            m_BoardStore.setPiece(m_Piece2, 0, ROW_SEVEN);
            // you cannot put the white piece here !!!

        if(m_BoardStore.getBoard()[0][ROW_SEVEN].getColour().equals ("black")) {
            System.out.println("Board Test Eight Override Evaluated: Correct");
        } else {
            System.out.println("Board Test Eight Override Evaluated: Incorrect");
        }

    }

    /**
     * Member variables to store both 2D arrays and the boards height and width
     */
    private int[][] m_Board;
    private Piece[][] m_Pieces;
    private int m_BoardWidth;
    private int m_BoardHeight;
    private static Board m_BoardStore;
    private static Piece m_Piece;
    private static Piece m_Piece2;
    private static final int ROW_SEVEN = 7;
    private static final int NORMAL_BOARD_SIZE = 8;
    private static final int OUTSIDE_BOARD = 10;
    private static final int LARGE_BOARD_SIZE = 800;
    private static final int NEGATIVE_BOARD_SIZE = -1;

    /** Symbolic constant */
    private final int HAS_PIECE_OBJECT = 1;
}


text:
ACCEPTED

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

#### Published in
Mycosystema, Suppl. 4: 47 (1991)

#### Original name
Rhizomucor variabilis var. variabilis

### Remarks
null


text:
function getSiteHierarchyFormWidgets()
{
    var widgets = [ {
        name : 'alfresco/forms/controls/Select',
        config : {
            fieldId: 'ACO6SH_SHOW_IN_HIERARCHY_MODE',
            name : 'aco6sh_showInHierarchyMode',
            label : 'acosix.siteHierarchy.siteDialog.extensions.autoMembershipMode.label',
            description : 'acosix.siteHierarchy.siteDialog.extensions.autoMembershipMode.help',
            optionsConfig : {
                fixed : [ {
                    label : msg.get('acosix.siteHierarchy.siteDialog.extensions.showInHierarchyMode.ifParentOrChild.label'),
                    value : 'ifParentOrChild'
                }, {
                    label : msg.get('acosix.siteHierarchy.siteDialog.extensions.showInHierarchyMode.never.label'),
                    value : 'never'
                }, {
                    label : msg.get('acosix.siteHierarchy.siteDialog.extensions.showInHierarchyMode.always.label'),
                    value : 'always'
                } ]
            }
        }
    }, {
        name : 'alfresco/forms/controls/SitePicker',
        config : {
            // needed to force single item as simple string value
            valueDelimiter : ',',
            fieldId : 'ACO6SH_PARENT_SITE',
            name : 'aco6sh_parentSite',
            label : 'acosix.siteHierarchy.siteDialog.extensions.parentSite.label',
            // this is a way to add CSS dependencies provided by acosix-utility module (not supported by default)
            // it does not really matter where this is included as long as it is on the page
            cssRequirements : [{
                cssFile : 'aco6-aikau/forms/css/PickerEnhancements.css'
            }],
            additionalCssClasses : 'betterInlinePicker'
        }
    }, {
        name : 'alfresco/forms/controls/Select',
        config : {
            fieldId: 'ACO6SH_AUTO_MEMBERSHIP_MODE',
            name : 'aco6sh_autoMembershipMode',
            label : 'acosix.siteHierarchy.siteDialog.extensions.showInHierarchyMode.label',
            description : 'acosix.siteHierarchy.siteDialog.extensions.showInHierarchyMode.help',
            optionsConfig : {
                fixed : [ {
                    label : msg.get('acosix.siteHierarchy.siteDialog.extensions.autoMembershipMode.systemDefault.label'),
                    value : 'systemDefault'
                }, {
                    label : msg.get('acosix.siteHierarchy.siteDialog.extensions.autoMembershipMode.none.label'),
                    value : 'none'
                }, {
                    label : msg.get('acosix.siteHierarchy.siteDialog.extensions.autoMembershipMode.parentMembersAsChildConsumers.label'),
                    value : 'parentMembersAsChildConsumers'
                }, {
                    label : msg.get('acosix.siteHierarchy.siteDialog.extensions.autoMembershipMode.childMembersAsParentConsumers.label'),
                    value : 'childMembersAsParentConsumers'
                } ]
            }
        }
    } ];

    return widgets;
}

function processSiteServiceCreateDialog(siteService)
{
    var acosixGenericBlock;

    siteService.config.widgetsForCreateSiteDialogOverrides = siteService.config.widgetsForCreateSiteDialogOverrides || [];

    acosixGenericBlock = widgetUtils.findObject(siteService.config.widgetsForCreateSiteDialogOverrides, 'id',
            'ACOSIX_GENERIC_CREATE_SITE_BLOCK');
    if (!acosixGenericBlock)
    {
        acosixGenericBlock = {
            id : 'ACOSIX_GENERIC_CREATE_SITE_BLOCK',
            name : 'aco6-aikau/forms/ProcessWidgets',
            config : {
                widgets : []
            }
        };

        siteService.config.widgetsForCreateSiteDialogOverrides.push({
            id : 'ACOSIX_GENERIC_CREATE_SITE',
            targetPosition : 'END',
            name : 'alfresco/forms/CollapsibleSection',
            config : {
                // this is a way to add CSS dependencies provided by acosix-utility module (not supported by default)
                // it does not really matter where this is included as long as it is on the page
                cssRequirements : [{
                    cssFile : 'aco6-aikau/layout/css/TwisterEnhancements.css'
                }],
                label : 'acosix.utility.siteDialog.extensions.section.label',
                initiallyOpen : false,
                additionalCssClasses : 'withoutInset',
                widgets : [ acosixGenericBlock ]
            }
        });
    }
    else
    {
        acosixGenericBlock.name = 'alfresco/layout/AlfTabContainer';
    }

    acosixGenericBlock.config.widgets.push({
        id : 'ACOSIX_CREATE_SITE_HIERARCHY',
        title : 'acosix.siteHierarchy.siteDialog.extensions.title',
        selected : acosixGenericBlock.config.widgets.length === 0,
        delayProcessing : acosixGenericBlock.config.widgets.length !== 0,
        name : 'aco6-aikau/forms/ProcessWidgets',
        config : {
            additionalCssClasses : 'formRootSubstitute',
            widgets : getSiteHierarchyFormWidgets()
        }
    });
}

function processSiteServiceEditDialog(siteService)
{
    var acosixGenericBlock;

    siteService.config.widgetsForEditSiteDialogOverrides = siteService.config.widgetsForEditSiteDialogOverrides || [];

    acosixGenericBlock = widgetUtils.findObject(siteService.config.widgetsForEditSiteDialogOverrides, 'id',
            'ACOSIX_GENERIC_EDIT_SITE_BLOCK');
    if (!acosixGenericBlock)
    {
        acosixGenericBlock = {
            id : 'ACOSIX_GENERIC_EDIT_SITE_BLOCK',
            name : 'aco6-aikau/forms/ProcessWidgets',
            config : {
                widgets : []
            }
        };

        siteService.config.widgetsForEditSiteDialogOverrides.push({
            id : 'ACOSIX_GENERIC_EDIT_SITE',
            targetPosition : 'END',
            name : 'alfresco/forms/CollapsibleSection',
            config : {
                // this is a way to add CSS dependencies provided by acosix-utility module (not supported by default)
                // it does not really matter where this is included as long as it is on the page
                cssRequirements : [{
                    cssFile : 'aco6-aikau/layout/css/TwisterEnhancements.css'
                }],
                label : 'acosix.utility.siteDialog.extensions.section.label',
                initiallyOpen : false,
                additionalCssClasses : 'withoutInset',
                widgets : [ acosixGenericBlock ]
            }
        });
    }
    else
    {
        acosixGenericBlock.name = 'alfresco/layout/AlfTabContainer';
    }

    acosixGenericBlock.config.widgets.push({
        id : 'ACOSIX_CREATE_SITE_HIERARCHY',
        title : 'acosix.siteHierarchy.siteDialog.extensions.title',
        selected : acosixGenericBlock.config.widgets.length === 0,
        delayProcessing : acosixGenericBlock.config.widgets.length !== 0,
        name : 'aco6-aikau/forms/ProcessWidgets',
        config : {
            additionalCssClasses : 'formRootSubstitute',
            widgets : getSiteHierarchyFormWidgets()
        }
    });
}

function findAndProcessSiteService(services)
{
    var idx, siteService;

    for (idx = 0; idx < services.length; idx++)
    {
        if ((!services[idx].name && String(services[idx]) === 'alfresco/services/SiteService')
                || (services[idx].name && String(services[idx].name) === 'alfresco/services/SiteService'))
        {
            if (services[idx].name)
            {
                siteService = services[idx];
            }
            else
            {
                siteService = {
                    name : services[idx],
                    config : {}
                };
                services[idx] = siteService;
            }
        }
    }

    if (siteService === undefined)
    {
        siteService = {
            name : 'alfresco/services/SiteService',
            config : {}
        };
        services.push(siteService);
    }

    processSiteServiceCreateDialog(siteService);
    processSiteServiceEditDialog(siteService);
}

findAndProcessSiteService(model.jsonModel.services);


text:
<?php

/**
 * Class AuthControllerTest
 */
class AuthControllerTest extends TestCase
{
    use \Illuminate\Foundation\Testing\DatabaseTransactions;

    /**
     * @var \Mockery\Mock
     */
    private $mockRep;
    /**
     * @var \Mockery\Mock
     */
    private $mockAuth;
    /**
     * @var App\User
     */
    private $user;

    /**
     *
     */
    public function setUp()
    {
        parent::setUp();

        $this->user = App\User::whereId(1)->first();

        $this->mockRep = Mockery::mock(App\Repositories\UserRepository::class);
        $this->mockRep->shouldReceive('findByUidOrCreate')->andReturn($this->user);

        $this->mockAuth = Mockery::mock('App\Http\Controllers\AuthController[getSocialUser,getAuthorizationFirst]',
            [$this->mockRep]);
        $this->mockAuth->shouldReceive('getSocialUser')->andReturn($this->user);
        $this->mockAuth->shouldReceive('getAuthorizationFirst')->andReturn(redirect('http://oauth.vk.com'));

        $this->app->instance('App\Repositories\UserRepository', $this->mockRep);
        $this->app->instance('App\Http\Controllers\AuthController', $this->mockAuth);
    }

    public function tearDown()
    {
        Mockery::close();

        parent::tearDown();
    }

    public function testSeeLoginPage()
    {
        $this->action('GET', 'AuthController@loginPage');
        $this->see('Войти');
    }

    public function testLoginSocialUser()
    {
        Auth::shouldReceive('login')
            ->once()
            ->with($this->user, true);
        $this->action('GET', 'AuthController@loginSocialUser');
        $this->assertRedirectedTo('/');
    }

    public function testProcessVkAuth()
    {
        $this->action('GET', 'AuthController@getAuthorizationFirst');
        $this->assertRedirectedTo('http://oauth.vk.com');
    }

    public function testLogout()
    {
        Auth::shouldReceive('logout')
            ->once()
            ->withNoArgs();
        $this->action('GET', 'AuthController@logout');
        $this->assertRedirectedToRoute('login');
    }
}


text:
<?php

namespace app\model;

class CityHasBuilding implements \stphp\Database\iDataModel {

  private $id_city;
  private $id_building;
  private $x;
  private $y;
  private $z;

  public function getDescription($field) {

  }

  public function getFieldsDescriptor() {

  }

  public function getId() {
    $id_city = $this->getId_city();
    $id_building = $this->getId_building();
    return array('id_city' => $id_city, 'id_building' => $id_building);
  }

  public function setId($id) {
    if (isset($id['id_city'])) {
      $this->setId_city($id['id_city']);
    }
    if (isset($id['id_building'])) {
      $this->setId_building($id['id_building']);
    }
  }

  function getId_city() {
    return $this->id_city;
  }

  function getId_building() {
    return $this->id_building;
  }

  function getX() {
    return $this->x;
  }

  function getY() {
    return $this->y;
  }

  function getZ() {
    return $this->z;
  }

  function setId_city($id_city) {
    $this->id_city = $id_city;
  }

  function setId_building($id_building) {
    $this->id_building = $id_building;
  }

  function setX($x) {
    $this->x = $x;
  }

  function setY($y) {
    $this->y = $y;
  }

  function setZ($z) {
    $this->z = $z;
  }

}


text:
import { Component } from "../components/component";
import { Point } from "../core/interfaces";
import * as Dispatchers from "../dispatchers";
import * as Utils from "../utils";

import { Interaction } from "./interaction";

export type ClickCallback = (point: Point, event: MouseEvent | TouchEvent) => void;

export class Click extends Interaction {

  private _mouseDispatcher: Dispatchers.Mouse;
  private _touchDispatcher: Dispatchers.Touch;

  private _clickedDown = false;
  private _clickedPoint: Point;
  private _doubleClicking = false;

  private _onClickCallbacks = new Utils.CallbackSet<ClickCallback>();
  private _onDoubleClickCallbacks = new Utils.CallbackSet<ClickCallback>();

  /**
   * Note: we bind to mousedown, mouseup, touchstart and touchend because browsers
   * have a 300ms delay between touchstart and click to allow for scrolling cancelling etc.
   */
  private _mouseDownCallback = (p: Point, event: MouseEvent) => this._handleClickDown(p, event);
  private _mouseUpCallback = (p: Point, event: MouseEvent) => this._handleClickUp(p, event);
  private _dblClickCallback = (p: Point, event: MouseEvent) => this._handleDblClick(p, event);

  private _touchStartCallback = (ids: number[], idToPoint: Point[], event: TouchEvent) => this._handleClickDown(idToPoint[ids[0]], event);
  private _touchEndCallback = (ids: number[], idToPoint: Point[], event: TouchEvent) => this._handleClickUp(idToPoint[ids[0]], event);
  private _touchCancelCallback = (ids: number[], idToPoint: Point[]) => this._clickedDown = false;

  protected _anchor(component: Component) {
    super._anchor(component);

    this._mouseDispatcher = Dispatchers.Mouse.getDispatcher(component);
    this._mouseDispatcher.onMouseDown(this._mouseDownCallback);
    this._mouseDispatcher.onMouseUp(this._mouseUpCallback);
    this._mouseDispatcher.onDblClick(this._dblClickCallback);

    this._touchDispatcher = Dispatchers.Touch.getDispatcher(component);
    this._touchDispatcher.onTouchStart(this._touchStartCallback);
    this._touchDispatcher.onTouchEnd(this._touchEndCallback);
    this._touchDispatcher.onTouchCancel(this._touchCancelCallback);
  }

  protected _unanchor() {
    super._unanchor();
    this._mouseDispatcher.offMouseDown(this._mouseDownCallback);
    this._mouseDispatcher.offMouseUp(this._mouseUpCallback);
    this._mouseDispatcher.offDblClick(this._dblClickCallback);
    this._mouseDispatcher = null;

    this._touchDispatcher.offTouchStart(this._touchStartCallback);
    this._touchDispatcher.offTouchEnd(this._touchEndCallback);
    this._touchDispatcher.offTouchCancel(this._touchCancelCallback);
    this._touchDispatcher = null;
  }

  private _handleClickDown(p: Point, event: MouseEvent | TouchEvent) {
    const translatedP = this._translateToComponentSpace(p);
    if (this._isInsideComponent(translatedP)) {
      this._clickedDown = true;
      this._clickedPoint = translatedP;
    }
  }

  private _handleClickUp(p: Point, event: MouseEvent | TouchEvent) {
    const translatedP = this._translateToComponentSpace(p);
    if (this._clickedDown && Click._pointsEqual(translatedP, this._clickedPoint)) {
      setTimeout(() => {
        if (!this._doubleClicking) {
          this._onClickCallbacks.callCallbacks(translatedP, event);
        }
      }, 0);
    }
    this._clickedDown = false;
  }

  private _handleDblClick(p: Point, event: MouseEvent | TouchEvent) {
    const translatedP = this._translateToComponentSpace(p);
    this._doubleClicking = true;
    this._onDoubleClickCallbacks.callCallbacks(translatedP, event);
    setTimeout(() => this._doubleClicking = false, 0);
  }

  private static _pointsEqual(p1: Point, p2: Point) {
    return p1.x === p2.x && p1.y === p2.y;
  }

  /**
   * Adds a callback to be called when the Component is clicked.
   *
   * @param {ClickCallback} callback
   * @return {Interactions.Click} The calling Click Interaction.
   */
  public onClick(callback: ClickCallback) {
    this._onClickCallbacks.add(callback);
    return this;
  }

  /**
   * Removes a callback that would be called when the Component is clicked.
   *
   * @param {ClickCallback} callback
   * @return {Interactions.Click} The calling Click Interaction.
   */
  public offClick(callback: ClickCallback) {
    this._onClickCallbacks.delete(callback);
    return this;
  }

  /**
   * Adds a callback to be called when the Component is double-clicked.
   *
   * @param {ClickCallback} callback
   * @return {Interactions.Click} The calling Click Interaction.
   */
  public onDoubleClick(callback: ClickCallback) {
    this._onDoubleClickCallbacks.add(callback);
    return this;
  }

  /**
   * Removes a callback that would be called when the Component is double-clicked.
   *
   * @param {ClickCallback} callback
   * @return {Interactions.Click} The calling Click Interaction.
   */
  public offDoubleClick(callback: ClickCallback) {
    this._onDoubleClickCallbacks.delete(callback);
    return this;
  }
}


text:
use crate::ops::{ControlFlow, Try};

/// An iterator able to yield elements from both ends.
///
/// Something that implements `DoubleEndedIterator` has one extra capability
/// over something that implements [`Iterator`]: the ability to also take
/// `Item`s from the back, as well as the front.
///
/// It is important to note that both back and forth work on the same range,
/// and do not cross: iteration is over when they meet in the middle.
///
/// In a similar fashion to the [`Iterator`] protocol, once a
/// `DoubleEndedIterator` returns [`None`] from a [`next_back()`], calling it
/// again may or may not ever return [`Some`] again. [`next()`] and
/// [`next_back()`] are interchangeable for this purpose.
///
/// [`next_back()`]: DoubleEndedIterator::next_back
/// [`next()`]: Iterator::next
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let numbers = vec![1, 2, 3, 4, 5, 6];
///
/// let mut iter = numbers.iter();
///
/// assert_eq!(Some(&1), iter.next());
/// assert_eq!(Some(&6), iter.next_back());
/// assert_eq!(Some(&5), iter.next_back());
/// assert_eq!(Some(&2), iter.next());
/// assert_eq!(Some(&3), iter.next());
/// assert_eq!(Some(&4), iter.next());
/// assert_eq!(None, iter.next());
/// assert_eq!(None, iter.next_back());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "DoubleEndedIterator")]
pub trait DoubleEndedIterator: Iterator {
    /// Removes and returns an element from the end of the iterator.
    ///
    /// Returns `None` when there are no more elements.
    ///
    /// The [trait-level] docs contain more details.
    ///
    /// [trait-level]: DoubleEndedIterator
    ///
    /// # Examples
    ///
    /// Basic usage:
    ///
    /// ```
    /// let numbers = vec![1, 2, 3, 4, 5, 6];
    ///
    /// let mut iter = numbers.iter();
    ///
    /// assert_eq!(Some(&1), iter.next());
    /// assert_eq!(Some(&6), iter.next_back());
    /// assert_eq!(Some(&5), iter.next_back());
    /// assert_eq!(Some(&2), iter.next());
    /// assert_eq!(Some(&3), iter.next());
    /// assert_eq!(Some(&4), iter.next());
    /// assert_eq!(None, iter.next());
    /// assert_eq!(None, iter.next_back());
    /// ```
    ///
    /// # Remarks
    ///
    /// The elements yielded by `DoubleEndedIterator`'s methods may differ from
    /// the ones yielded by [`Iterator`]'s methods:
    ///
    /// ```
    /// let vec = vec![(1, 'a'), (1, 'b'), (1, 'c'), (2, 'a'), (2, 'b')];
    /// let uniq_by_fst_comp = || {
    ///     let mut seen = std::collections::HashSet::new();
    ///     vec.iter().copied().filter(move |x| seen.insert(x.0))
    /// };
    ///
    /// assert_eq!(uniq_by_fst_comp().last(), Some((2, 'a')));
    /// assert_eq!(uniq_by_fst_comp().next_back(), Some((2, 'b')));
    ///
    /// assert_eq!(
    ///     uniq_by_fst_comp().fold(vec![], |mut v, x| {v.push(x); v}),
    ///     vec![(1, 'a'), (2, 'a')]
    /// );
    /// assert_eq!(
    ///     uniq_by_fst_comp().rfold(vec![], |mut v, x| {v.push(x); v}),
    ///     vec![(2, 'b'), (1, 'c')]
    /// );
    /// ```
    #[stable(feature = "rust1", since = "1.0.0")]
    fn next_back(&mut self) -> Option<Self::Item>;

    /// Advances the iterator from the back by `n` elements.
    ///
    /// `advance_back_by` is the reverse version of [`advance_by`]. This method will
    /// eagerly skip `n` elements starting from the back by calling [`next_back`] up
    /// to `n` times until [`None`] is encountered.
    ///
    /// `advance_back_by(n)` will return [`Ok(())`] if the iterator successfully advances by
    /// `n` elements, or [`Err(k)`] if [`None`] is encountered, where `k` is the number of
    /// elements the iterator is advanced by before running out of elements (i.e. the length
    /// of the iterator). Note that `k` is always less than `n`.
    ///
    /// Calling `advance_back_by(0)` can do meaningful work, for example [`Flatten`] can advance its
    /// outer iterator until it finds an inner iterator that is not empty, which then often
    /// allows it to return a more accurate `size_hint()` than in its initial state.
    ///
    /// [`advance_by`]: Iterator::advance_by
    /// [`Flatten`]: crate::iter::Flatten
    /// [`next_back`]: DoubleEndedIterator::next_back
    ///
    /// # Examples
    ///
    /// Basic usage:
    ///
    /// ```
    /// #![feature(iter_advance_by)]
    ///
    /// let a = [3, 4, 5, 6];
    /// let mut iter = a.iter();
    ///
    /// assert_eq!(iter.advance_back_by(2), Ok(()));
    /// assert_eq!(iter.next_back(), Some(&4));
    /// assert_eq!(iter.advance_back_by(0), Ok(()));
    /// assert_eq!(iter.advance_back_by(100), Err(1)); // only `&3` was skipped
    /// ```
    ///
    /// [`Ok(())`]: Ok
    /// [`Err(k)`]: Err
    #[inline]
    #[unstable(feature = "iter_advance_by", reason = "recently added", issue = "77404")]
    fn advance_back_by(&mut self, n: usize) -> Result<(), usize> {
        for i in 0..n {
            self.next_back().ok_or(i)?;
        }
        Ok(())
    }

    /// Returns the `n`th element from the end of the iterator.
    ///
    /// This is essentially the reversed version of [`Iterator::nth()`].
    /// Although like most indexing operations, the count starts from zero, so
    /// `nth_back(0)` returns the first value from the end, `nth_back(1)` the
    /// second, and so on.
    ///
    /// Note that all elements between the end and the returned element will be
    /// consumed, including the returned element. This also means that calling
    /// `nth_back(0)` multiple times on the same iterator will return different
    /// elements.
    ///
    /// `nth_back()` will return [`None`] if `n` is greater than or equal to the
    /// length of the iterator.
    ///
    /// # Examples
    ///
    /// Basic usage:
    ///
    /// ```
    /// let a = [1, 2, 3];
    /// assert_eq!(a.iter().nth_back(2), Some(&1));
    /// ```
    ///
    /// Calling `nth_back()` multiple times doesn't rewind the iterator:
    ///
    /// ```
    /// let a = [1, 2, 3];
    ///
    /// let mut iter = a.iter();
    ///
    /// assert_eq!(iter.nth_back(1), Some(&2));
    /// assert_eq!(iter.nth_back(1), None);
    /// ```
    ///
    /// Returning `None` if there are less than `n + 1` elements:
    ///
    /// ```
    /// let a = [1, 2, 3];
    /// assert_eq!(a.iter().nth_back(10), None);
    /// ```
    #[inline]
    #[stable(feature = "iter_nth_back", since = "1.37.0")]
    fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
        self.advance_back_by(n).ok()?;
        self.next_back()
    }

    /// This is the reverse version of [`Iterator::try_fold()`]: it takes
    /// elements starting from the back of the iterator.
    ///
    /// # Examples
    ///
    /// Basic usage:
    ///
    /// ```
    /// let a = ["1", "2", "3"];
    /// let sum = a.iter()
    ///     .map(|&s| s.parse::<i32>())
    ///     .try_rfold(0, |acc, x| x.and_then(|y| Ok(acc + y)));
    /// assert_eq!(sum, Ok(6));
    /// ```
    ///
    /// Short-circuiting:
    ///
    /// ```
    /// let a = ["1", "rust", "3"];
    /// let mut it = a.iter();
    /// let sum = it
    ///     .by_ref()
    ///     .map(|&s| s.parse::<i32>())
    ///     .try_rfold(0, |acc, x| x.and_then(|y| Ok(acc + y)));
    /// assert!(sum.is_err());
    ///
    /// // Because it short-circuited, the remaining elements are still
    /// // available through the iterator.
    /// assert_eq!(it.next_back(), Some(&"1"));
    /// ```
    #[inline]
    #[stable(feature = "iterator_try_fold", since = "1.27.0")]
    fn try_rfold<B, F, R>(&mut self, init: B, mut f: F) -> R
    where
        Self: Sized,
        F: FnMut(B, Self::Item) -> R,
        R: Try<Output = B>,
    {
        let mut accum = init;
        while let Some(x) = self.next_back() {
            accum = f(accum, x)?;
        }
        try { accum }
    }

    /// An iterator method that reduces the iterator's elements to a single,
    /// final value, starting from the back.
    ///
    /// This is the reverse version of [`Iterator::fold()`]: it takes elements
    /// starting from the back of the iterator.
    ///
    /// `rfold()` takes two arguments: an initial value, and a closure with two
    /// arguments: an 'accumulator', and an element. The closure returns the value that
    /// the accumulator should have for the next iteration.
    ///
    /// The initial value is the value the accumulator will have on the first
    /// call.
    ///
    /// After applying this closure to every element of the iterator, `rfold()`
    /// returns the accumulator.
    ///
    /// This operation is sometimes called 'reduce' or 'inject'.
    ///
    /// Folding is useful whenever you have a collection of something, and want
    /// to produce a single value from it.
    ///
    /// Note: `rfold()` combines elements in a *right-associative* fashion. For associative
    /// operators like `+`, the order the elements are combined in is not important, but for non-associative
    /// operators like `-` the order will affect the final result.
    /// For a *left-associative* version of `rfold()`, see [`Iterator::fold()`].
    ///
    /// # Examples
    ///
    /// Basic usage:
    ///
    /// ```
    /// let a = [1, 2, 3];
    ///
    /// // the sum of all of the elements of a
    /// let sum = a.iter()
    ///            .rfold(0, |acc, &x| acc + x);
    ///
    /// assert_eq!(sum, 6);
    /// ```
    ///
    /// This example demonstrates the right-associative nature of `rfold()`:
    /// it builds a string, starting with an initial value
    /// and continuing with each element from the back until the front:
    ///
    /// ```
    /// let numbers = [1, 2, 3, 4, 5];
    ///
    /// let zero = "0".to_string();
    ///
    /// let result = numbers.iter().rfold(zero, |acc, &x| {
    ///     format!("({} + {})", x, acc)
    /// });
    ///
    /// assert_eq!(result, "(1 + (2 + (3 + (4 + (5 + 0)))))");
    /// ```
    #[doc(alias = "foldr")]
    #[inline]
    #[stable(feature = "iter_rfold", since = "1.27.0")]
    fn rfold<B, F>(mut self, init: B, mut f: F) -> B
    where
        Self: Sized,
        F: FnMut(B, Self::Item) -> B,
    {
        let mut accum = init;
        while let Some(x) = self.next_back() {
            accum = f(accum, x);
        }
        accum
    }

    /// Searches for an element of an iterator from the back that satisfies a predicate.
    ///
    /// `rfind()` takes a closure that returns `true` or `false`. It applies
    /// this closure to each element of the iterator, starting at the end, and if any
    /// of them return `true`, then `rfind()` returns [`Some(element)`]. If they all return
    /// `false`, it returns [`None`].
    ///
    /// `rfind()` is short-circuiting; in other words, it will stop processing
    /// as soon as the closure returns `true`.
    ///
    /// Because `rfind()` takes a reference, and many iterators iterate over
    /// references, this leads to a possibly confusing situation where the
    /// argument is a double reference. You can see this effect in the
    /// examples below, with `&&x`.
    ///
    /// [`Some(element)`]: Some
    ///
    /// # Examples
    ///
    /// Basic usage:
    ///
    /// ```
    /// let a = [1, 2, 3];
    ///
    /// assert_eq!(a.iter().rfind(|&&x| x == 2), Some(&2));
    ///
    /// assert_eq!(a.iter().rfind(|&&x| x == 5), None);
    /// ```
    ///
    /// Stopping at the first `true`:
    ///
    /// ```
    /// let a = [1, 2, 3];
    ///
    /// let mut iter = a.iter();
    ///
    /// assert_eq!(iter.rfind(|&&x| x == 2), Some(&2));
    ///
    /// // we can still use `iter`, as there are more elements.
    /// assert_eq!(iter.next_back(), Some(&1));
    /// ```
    #[inline]
    #[stable(feature = "iter_rfind", since = "1.27.0")]
    fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
    where
        Self: Sized,
        P: FnMut(&Self::Item) -> bool,
    {
        #[inline]
        fn check<T>(mut predicate: impl FnMut(&T) -> bool) -> impl FnMut((), T) -> ControlFlow<T> {
            move |(), x| {
                if predicate(&x) { ControlFlow::Break(x) } else { ControlFlow::CONTINUE }
            }
        }

        self.try_rfold((), check(predicate)).break_value()
    }
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for &'a mut I {
    fn next_back(&mut self) -> Option<I::Item> {
        (**self).next_back()
    }
    fn advance_back_by(&mut self, n: usize) -> Result<(), usize> {
        (**self).advance_back_by(n)
    }
    fn nth_back(&mut self, n: usize) -> Option<I::Item> {
        (**self).nth_back(n)
    }
}


text:
//  Given a binary tree, return all root-to-leaf paths.
// For example, given the following binary tree:
//    1
//  /   \
// 2     3
//  \
//   5
// All root-to-leaf paths are:
// ["1->2->5", "1->3"]
// Credits:
// Special thanks to @jianchao.li.fighter for adding this problem and creating
// all test cases.

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode(int x) : val(x), left(NULL), right(NULL) {}
 * };
 */
class Solution {
  public:
    vector<string> binaryTreePaths(TreeNode *root) {
        vector<string> ret;
        if (!root)
            return ret;

        TreeNode *curr;
        string str;

        stack<pair<TreeNode *, string>> temp;
        temp.push({root, ""});

        while (!temp.empty()) {
            curr = temp.top().first;
            str = temp.top().second;
            temp.pop();

            if (!(curr->left) && !(curr->right))
                ret.push_back(str + to_string(curr->val));

            if (curr->right)
                temp.push({curr->right, str + to_string(curr->val) + "->"});

            if (curr->left)
                temp.push({curr->left, str + to_string(curr->val) + "->"});
        }

        return ret;
    }
};

// Recursive
class Solution {
  public:
    vector<string> binaryTreePaths(TreeNode *root) {
        vector<string> ret;
        if (!root)
            return ret;

        string rs = to_string(root->val);

        if (!(root->left) && !(root->right))
            ret.push_back(rs);
        else {
            if (root->left)
                for (auto &&str : binaryTreePaths(root->left))
                    ret.push_back(rs + "->" + str);

            if (root->right)
                for (auto &&str : binaryTreePaths(root->right))
                    ret.push_back(rs + "->" + str);
        }

        return ret;
    }
};

// Ref Java 1
// public
// List<String> binaryTreePaths(TreeNode root) {
//     List<String> answer = new ArrayList<String>();
//     if (root != null)
//         searchBT(root, "", answer);
//     return answer;
// }
// private
// void searchBT(TreeNode root, String path, List<String> answer) {
//     if (root.left == null && root.right == null)
//         answer.add(path + root.val);
//     if (root.left != null)
//         searchBT(root.left, path + root.val + "->", answer);
//     if (root.right != null)
//         searchBT(root.right, path + root.val + "->", answer);
// }

// Ref Java 2
// public
// List<String> binaryTreePaths(TreeNode root) {
//     List<String> paths = new LinkedList<>();
//     if (root == null)
//         return paths;
//     if (root.left == null && root.right == null) {
//         paths.add(root.val + "");
//         return paths;
//     }
//     for (String path : binaryTreePaths(root.left)) {
//         paths.add(root.val + "->" + path);
//     }
//     for (String path : binaryTreePaths(root.right)) {
//         paths.add(root.val + "->" + path);
//     }
//     return paths;
// }


text:
package kepModeler;

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

import com.google.common.base.Function;

import edu.uci.ics.jung.graph.DirectedSparseMultigraph;
import exchangeGraph.CplexUtil;

import ilog.concert.IloException;
import ilog.concert.IloIntVar;
import ilog.concert.IloLinearNumExpr;
import ilog.cplex.IloCplex;

public class MaximumCycleChainPacking<V, E> implements Objective<V, E> {

	public static final double defaultCycleBonus = .01;

	private double cycleBonus;
	private Function<Object,Integer> edgeWeight;

	public MaximumCycleChainPacking(){
		this(defaultCycleBonus);
	}
	public MaximumCycleChainPacking(double cycleBonus) {
		this.cycleBonus = cycleBonus;
		this.edgeWeight = CplexUtil.unity;
	}

	@Override
	public Function<? super E, Integer> getEdgeWeights() {
		return edgeWeight;
	}
	@Override
	public double getCycleBonus() {
		return cycleBonus;
	}

}


text:
class PasswordsController < ApplicationController
  layout 'sessions'

  # Forgot password action
  def create
    if @user = User.find_for_forget(params[:email])
      @user.forgot_password
      @user.save
      flash[:notice] = "A password reset link has been sent to #{@user.email}"
      redirect_to new_session_path
    else
      flash[:notice] = "Could not find a user with that email address."
      render :template=>"passwords/new"
    end
  end

  # Action triggered by clicking on the /reset_password/:id link recieved via email
  # Makes sure the id code is included
  # Checks that the id code matches a user in the database
  # Then if everything checks out, shows the password reset fields
  def edit
    if params[:id].nil?
      render :template=>"passwords/new"
    else
      @user = User.find_by_password_reset_code(params[:id]) if params[:id]
      raise if @user.nil?
    end
  rescue
    flash[:notice] = "Sorry - That is an invalid password reset code. Please check your code and try again. (Perhaps your email client inserted a carriage return?)"
    redirect_to new_session_path
  end

  # Reset password action /reset_password/:id
  # Checks once again that an id is included and makes sure that the password field isn't blank
  def update
    if params[:id].nil?
      render :template=>"passwords/new"
      return
    end
    if params[:password].blank?
      flash[:notice] = "Password field cannot be blank."
      render :action => 'edit', :id => params[:id]
      return
    end

    @user = User.find_by_password_reset_code(params[:id]) if params[:id]
    raise if @user.nil?
    return if @user unless params[:password]

    if (params[:password] == params[:password_confirmation])
      @user.password_confirmation = params[:password_confirmation]
      @user.password = params[:password]
      @user.reset_password
      flash[:notice] = @user.save ? "Password reset." : "Password not reset."
    else
      flash[:notice] = "Password mismatch."
      render :action => 'edit', :id => params[:id]
      return
    end
    redirect_to new_session_path
  rescue
    flash[:notice] = "Sorry - That is an invalid password reset code. Please check your code and try again. (Perhaps your email client inserted a carriage return?)"
    redirect_to new_session_path
  end
end


text:
<!DOCTYPE html>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <title>Space</title>

        <link rel="stylesheet" href="style/main.css" type="text/css">

Space

How to play

            <canvas id="background" width="700" height="550"></canvas>
            <canvas id="main" width="700" height="550"></canvas>
            <canvas id="ship" width="700" height="550"></canvas>

Score:

Health: ♥ ♥ ♥ ♥ ♥

                Your score:

                High score:


text:
import java.util.*;

/**
 * Given an array of integers, every element appears twice except for one. Find
 * that single one.
 *
 * Note:
 * Your algorithm should have a linear runtime complexity. Could you implement
 * it without using extra memory?
 *
 * Tags: Hashtable, Bit Manipulation
 */
class SingleNum {

    public static void main(String[] args) {
        int[] A = {1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7};
        System.out.println(singleNum(A));
        System.out.println(singleNumNoSpace(A));
    }

    /**
     * Without extra space
     * XOR of two equal numbers is 0 : a^a=0. This is the main idea of the
     * algorithm.
     */
    public static int singleNumNoSpace(int[] A) {
        int res = 0;
        for (int i = 0; i < A.length; i++) res ^= A[i];
        return res;
    }

    /**
     * hashtable, store the value and remove when appears second time
     * the only number left is the one
     */

	 // Use the hashset
    public static int singleNum(int[] A) {
        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
        for (int i = 0; i < A.length; i++) {
            if (!map.containsKey(A[i])) map.put(A[i], 1);
            else map.remove(A[i]);
        }
        int res = 0;
        for (Integer key : map.keySet()) res = key;
        return res;
    }
}


text:
package com.mikemilla.copyshare.lists;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.mikemilla.copyshare.R;
import com.mikemilla.copyshare.data.ContactModel;

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

/**
 * Created with Android Studio
 * User: Xaver
 * Date: 24/05/15
 */
public class ContactAddingAdapter extends RecyclerView.Adapter<ContactViewHolder> implements RecyclerViewFastScroller.BubbleTextGetter {

    private final LayoutInflater mInflater;
    private final List<ContactModel> mModels;

    public ContactAddingAdapter(Context context, List<ContactModel> models) {
        mInflater = LayoutInflater.from(context);
        mModels = new ArrayList<>(models);
    }

    @Override
    public ContactViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        final View itemView = mInflater.inflate(R.layout.contact_item, parent, false);
        return new ContactViewHolder(itemView);
    }

    @Override
    public void onBindViewHolder(ContactViewHolder holder, int position) {
        final ContactModel model = mModels.get(position);
        holder.bind(model);
    }

    @Override
    public int getItemCount() {
        return mModels.size();
    }

    public void animateTo(List<ContactModel> models) {
        applyAndAnimateRemovals(models);
        applyAndAnimateAdditions(models);
        applyAndAnimateMovedItems(models);
    }

    private void applyAndAnimateRemovals(List<ContactModel> newModels) {
        for (int i = mModels.size() - 1; i >= 0; i--) {
            final ContactModel model = mModels.get(i);
            if (!newModels.contains(model)) {
                removeItem(i);
            }
        }
    }

    private void applyAndAnimateAdditions(List<ContactModel> newModels) {
        for (int i = 0, count = newModels.size(); i < count; i++) {
            final ContactModel model = newModels.get(i);
            if (!mModels.contains(model)) {
                addItem(i, model);
            }
        }
    }

    private void applyAndAnimateMovedItems(List<ContactModel> newModels) {
        for (int toPosition = newModels.size() - 1; toPosition >= 0; toPosition--) {
            final ContactModel model = newModels.get(toPosition);
            final int fromPosition = mModels.indexOf(model);
            if (fromPosition >= 0 && fromPosition != toPosition) {
                moveItem(fromPosition, toPosition);
            }
        }
    }

    public ContactModel removeItem(int position) {
        final ContactModel model = mModels.remove(position);
        notifyItemRemoved(position);
        return model;
    }

    public void addItem(int position, ContactModel model) {
        mModels.add(position, model);
        notifyItemInserted(position);
    }

    public void moveItem(int fromPosition, int toPosition) {
        final ContactModel model = mModels.remove(fromPosition);
        mModels.add(toPosition, model);
        notifyItemMoved(fromPosition, toPosition);
    }

    @Override
    public String getTextToShowInBubble(int pos) {
        return Character.toString(mModels.get(pos).getName().charAt(0));
    }
}


text:
#ifndef GRPC_CORE_LIB_CHANNEL_CONTEXT_H
#define GRPC_CORE_LIB_CHANNEL_CONTEXT_H

#include <grpc/support/port_platform.h>

#include "src/core/lib/promise/context.h"

/// Call object context pointers.

/// Call context is represented as an array of \a grpc_call_context_elements.
/// This enum represents the indexes into the array, where each index
/// contains a different type of value.
typedef enum {
  /// Value is either a \a grpc_client_security_context or a
  /// \a grpc_server_security_context.
  GRPC_CONTEXT_SECURITY = 0,

  /// Value is a \a census_context.
  GRPC_CONTEXT_TRACING,

  /// Value is a CallTracer object.
  GRPC_CONTEXT_CALL_TRACER,

  /// Reserved for traffic_class_context.
  GRPC_CONTEXT_TRAFFIC,

  /// Holds a pointer to ServiceConfigCallData associated with this call.
  GRPC_CONTEXT_SERVICE_CONFIG_CALL_DATA,

  GRPC_CONTEXT_COUNT
} grpc_context_index;

struct grpc_call_context_element {
  void* value = nullptr;
  void (*destroy)(void*) = nullptr;
};

namespace grpc_core {
// Bind the legacy context array into the new style structure
// TODO(ctiller): remove as we migrate these contexts to the new system.
template <>
struct ContextType<grpc_call_context_element> {};
}  // namespace grpc_core

#endif /* GRPC_CORE_LIB_CHANNEL_CONTEXT_H */


text:
var request = require('request');

function LoaderIO() {
    this.apiUrl = 'https://api.loader.io';
}

LoaderIO.prototype.setApiKey = function(apiKey) {
    this.apiKey = apiKey;
}

LoaderIO.prototype.getApiKey = function() {
    return this.apiKey;
}

LoaderIO.prototype.performApiRequest = function(uri, callback, method, body) {
    var options = {
        method: method || 'GET',
        url: this.apiUrl + uri,
        headers: { 'loaderio-auth': this.apiKey }
    };

    if (body && body === Object(body)) {
        options.body = body;
        options.json = true;
    }

    request(options, function(error, response, body) {
        if (!error && response.statusCode == 200) {
            if (response.body && typeof response.body === 'string') {
                response.body = JSON.parse(response.body);
            }
            callback(null, response.body);
        } else {
            callback(error, response.body);
        }
    });
}

LoaderIO.prototype.getServers = function(callback) {
    this.performApiRequest('/v2/servers', callback);
}

LoaderIO.prototype.getTests = function(callback) {
    this.performApiRequest('/v2/tests', callback);
}

LoaderIO.prototype.getTest= function(test_id, callback) {
    this.performApiRequest('/v2/tests/' + test_id, callback);
}

LoaderIO.prototype.runTest = function(test_id, callback) {
    this.performApiRequest('/v2/tests/' + test_id + '/run', callback, 'PUT');
}

LoaderIO.prototype.stopTest = function(test_id, callback) {
    this.performApiRequest('/v2/tests/' + test_id + '/stop', callback, 'PUT');
}

LoaderIO.prototype.createTest = function(test_object, callback) {
    this.performApiRequest('/v2/tests', callback, 'POST', test_object);
}

LoaderIO.prototype.getApps = function(callback) {
    this.performApiRequest('/v2/apps', callback);
}

LoaderIO.prototype.getApp = function(app_id, callback) {
    this.performApiRequest('/v2/apps/' + app_id, callback);
}

LoaderIO.prototype.createApp = function(app_object, callback) {
    this.performApiRequest('/v2/apps', callback, 'POST', app_object);
}

LoaderIO.prototype.verifyApp = function(app_id, callback, method) {
    this.performApiRequest('/v2/apps/' + app_id + '/verify', callback, 'POST', {'method': method || 'http'});
}

LoaderIO.prototype.deleteApp = function(app_id, callback) {
    this.performApiRequest('/v2/apps/' + app_id, callback, 'DELETE');
}

LoaderIO.prototype.getAllResults = function(test_id, callback) {
    this.performApiRequest('/v2/tests/' + test_id + '/results', callback);
}

LoaderIO.prototype.getResults = function(test_id, results_id, callback) {
    this.performApiRequest('/v2/tests/' + test_id + '/results/' + results_id, callback);
}

module.exports = new LoaderIO();


text:
package i5.las2peer.api;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Hashtable;
import java.util.Properties;
import java.util.Set;

/**
 * Base (abstract) super type for classes that may be configurable via property files.
 *
 * The basic idea is, that the runtime system will look for .property files in the current runtime
 * directory or the subdirectories ./config and ./properties for a file named
 * as the sub class of Configurable (including the package name).
 *
 * All protected (non-static) fields can be set via the {@link #setFieldValues} method.
 * This won't be done automatically, thins subclasses may want to add some extra configuration
 * behavior.
 *
 * @author Holger Janßen
 *
 */
public abstract class Configurable {

	/**
	 * Used to determine, if this service should be monitored.
	 * Can be overwritten by service configuration file.
	 * Deactivated per default.
	 */
	protected boolean monitor = false;

	/**
	 * Tries to find a (service) class specific property file
	 *
	 * The following dirs will be checked:
	 *

	 *
./

	 *
./config/

	 *
./properties/

	 *

	 *
	 * The name of the property file is the name of the implementing service class
	 * followed by .properties.
	 *
	 * @return hashtable with all property entries
	 */
	protected Hashtable<String, String> getProperties () {
		Hashtable<String, String> result = new Hashtable<String, String>();

		String propFile = findPropertyFile ();
		if ( propFile == null )
			return result;

		try {
			Properties props = new Properties();
			props.load(new FileInputStream ( propFile ));

			for ( Object propname: props.keySet() )
				result.put( (String) propname, (String) props.get(propname));
		} catch (FileNotFoundException e) {
			System.err.println( "Unable to open property file " + propFile);
		} catch (IOException e) {
			System.err.println( "Error opening property file " + propFile + ": " + e.getMessage());
		}

		return result;
	}

	/**
	 * Sets a field to the given value.
	 * @param f
	 * @param value
	 *
	 * @throws IllegalAccessException
	 */
	private void setField ( Field f, String value ) throws IllegalAccessException {
		Class<?> fieldType = f.getType();

		if ( fieldType.equals( String.class ) ) {
			f.set( this, value);
		} else if ( fieldType.equals( long.class ) ) {
			f.setLong (this, Long.parseLong( value ));
		} else if ( fieldType.equals ( int.class )) {
			f.setInt( this, Integer.parseInt( value ) );
		} else if ( fieldType.equals ( short.class )) {
			f.setShort(this, Short.parseShort(value));
		} else if ( fieldType.equals( boolean.class) ) {
			f.setBoolean(this, Boolean.parseBoolean(value));
		} else if ( fieldType.equals (float.class)) {
			f.setFloat(this, Float.parseFloat(value));
		} else if ( fieldType.equals( double.class)) {
			f.setDouble(this, Double.parseDouble( value) );
		} else {
			System.err.println( "Unknown class of field: " + f.getName() + ": " + f.getType() );
		}
	}

	/**
	 * Sets all field values from the classes property file.
	 * This method uses {@link #getProperties} to get the value stored in the classes property file
	 * to set all fields with the name of the properties.
	 *
	 * Note that the name "monitor" is reserved to switch the monitoring on and off.
	 */
	protected void setFieldValues () {
		setFieldValues (null);
	}

	/**
	 * Sets all field values from the classes property file.
	 * This method uses {@link #getProperties} to get the value stored in the classes property file
	 * to set all fields with the name of the properties.
	 * Also checks, if the field contains the value for the monitoring switch and sets it if so.

	 * All fields mentioned in except will be left out.
	 *
	 */
	protected void setFieldValues ( Set<String> except ) {
		Hashtable<String, String> props = getProperties ();

		for ( String key: props.keySet() ) {
			if (key.equals("monitor")){
				this.monitor = 	Boolean.parseBoolean(props.get(key));
				continue;
			}
			if ( (except != null && except.contains(key))){
				continue;
			}
			try {
				Field f = getClass().getDeclaredField(key);
				if (! Modifier.isFinal(f.getModifiers())
						&& ! Modifier.isStatic(f.getModifiers())) {
					f.setAccessible(true);
					setField ( f, props.get(key));
					System.out.println ( "Class: " + getClass().getSimpleName() + " using: " + key + " -> " + props.get(key));
				}
			} catch ( NoSuchFieldException e ) {
				System.err.println( "field not found: " + key );
			} catch ( IllegalAccessException e ) {
				System.err.println( "illegal access: " + key );
				e.printStackTrace();
			} catch ( Exception e ) {
				e.printStackTrace();
			}
		}

	}

	/**
	 * Looks for a property file named after the service class calling this method.
	 *
	 * @return name of a property file
	 */
	private String findPropertyFile () {
		String filename = getClass().getName() + ".properties";
		String [] testDirs = new String[] { "./", "config/", "properties/" };

		for ( String dir : testDirs )
			if ( new File( dir + filename).exists() )
				return dir + filename;

		return null;
	}
}