text:
import * as path from 'path'

import { Reference } from '@dicy/types'

import Rule from '../Rule'
import { Action, ParsedLog, ParserMatch } from '../types'

export default class ParseAsymptoteStdOut extends Rule {
  static parameterTypes: Set<string>[] = [new Set(['AsymptoteStdOut'])]
  static defaultActions: Action[] = ['parse']
  static description: string = 'Parses the console output of Asymptote.'

  async parse () {
    const output = await this.getResolvedOutput('$DIR_0/$NAME_0.log-ParsedAsymptoteStdOut')
    if (!output) return false

    let rootPath = this.rootPath
    const parsedLog: ParsedLog = {
      messages: [],
      inputs: [],
      outputs: [],
      calls: []
    }

    await this.firstParameter.parse([{
      names: ['filePath'],
      patterns: [/^cd (.*)$/],
      evaluate: (mode: string, reference: Reference, match: ParserMatch): string | void => {
        rootPath = match.groups.filePath
      }
    }, {
      names: ['filePath'],
      patterns: [/^Wrote (.*)$/],
      evaluate: (mode: string, reference: Reference, match: ParserMatch): string | void => {
        parsedLog.outputs.push(this.normalizePath(path.resolve(rootPath, match.groups.filePath)))
      }
    }, {
      names: ['type', 'filePath'],
      patterns: [/^(Including|Loading) \S+ from (.*)$/],
      evaluate: (mode: string, reference: Reference, match: ParserMatch): string | void => {
        if (!path.isAbsolute(match.groups.filePath)) {
          parsedLog.inputs.push(this.normalizePath(path.resolve(rootPath, match.groups.filePath)))
        }
      }
    }])

    output.value = parsedLog

    return true
  }
}


text:
/**
 *
 */
package io.github.furti.spring.web.extended.template;

import javax.servlet.http.HttpServletRequest;

import org.springframework.core.io.Resource;

/**
 * @author Daniel Furtlehner
 */
public interface TemplateContextFactory
{

    /**
     * @param request the request for this template
     * @param resource the resource for the template
     * @return the context
     */
    TemplateContext createContext(HttpServletRequest request, Resource resource);

}

redpajama_set_name: RedPajamaGithub


text:
package controllers

import play.api.data.format.Formats._
import play.api.mvc._
import play.api.data._
import play.api.data.Forms._
import views._
import models.party.Project

object ProjectManager extends Controller {

  case class ProjectDTO(name: String, id: Long) {
    def this(project: Project) =
      this(project.name, project.partyId)
  }

  val projectForm: Form[ProjectDTO] = Form(
    mapping(
      "Project Name" -> nonEmptyText,
      "id" -> of[Long]
    )(ProjectDTO.apply)(ProjectDTO.unapply))

  def showAll() = TODO

  def createForm() = Action {
    Ok(html.project.projectForm(projectForm.fill(new ProjectDTO("", 0))))
  }

  def editForm(id: Long) = TODO

  def create() = TODO

  def show(id: Long) = TODO

}


text:
TAG=${1-latest}

docker build --rm -t=flaviof/elastic-filebeat:$TAG .


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

module.exports = function(client) {
  return {
    /**
     * Change focus to another window. The window to change focus to may be specified by its server assigned window handle, or by the value of its name attribute.
     *
     * To find out the window handle use `window_handles` protocol action
     *
     * ```
     *  this.demoTest = function (browser) {
     *    browser.window_handles(function(result) {
     *      var handle = result.value[0];
     *      browser.switchWindow(handle);
     *    });
     *  };
     * ```
     *
     * @method switchWindow
     * @param {string} handleOrName The server assigned window handle or the name attribute.
     * @param {function} [callback] Optional callback function to be called when the command finishes.
     * @see window
     * @since v0.3.0
     * @api commands
     */
    switchWindow : function(handleOrName, callback) {
      var self = this;
      this.window('POST', handleOrName, function(result) {
        if (typeof callback === 'function') {
          callback.call(self, result);
        }
      });
      return this;
    },

    /**
     * Resizes the current window.
     *
     * ```
     *  this.demoTest = function (browser) {
     *    browser.resizeWindow(1000, 800);
     *  };
     * ```
     *
     * @method resizeWindow
     * @param {number} width The new window width.
     * @param {height} width The new window height.
     * @param {function} [callback] Optional callback function to be called when the command finishes.
     * @see windowSize
     * @since v0.3.0
     * @api commands
     */
    resizeWindow : function(width, height, callback) {
      var self = this;
      return this.windowSize('current', width, height, function(result) {
        if (typeof callback === 'function') {
          callback.call(self, result);
        }
      });
    },

    /**
     * Maximizes the current window.
     *
     * ```
     *  this.demoTest = function (browser) {
     *    browser.maximizeWindow();
     *  };
     * ```
     *
     * @method maximizeWindow
     * @param {function} [callback] Optional callback function to be called when the command finishes.
     * @see windowMaximize
     * @since v0.5.13
     * @api commands
     */
    maximizeWindow: function(callback) {
      var self = this;
      return this.windowMaximize('current', function(result) {
        if (typeof callback === 'function') {
          callback.call(self, result);
        }
      });
    },

    /**
     * Take a screenshot of the current page and saves it as the given filename.
     *
     * ```
     *  this.demoTest = function (browser) {
     *    browser.saveScreenshot('/path/to/fileName.png');
     *  };
     * ```
     *
     * @method saveScreenshot
     * @param {string} fileName The complete path to the file name where the screenshot should be saved.
     * @param {function} [callback] Optional callback function to be called when the command finishes.
     * @see screenshot
     * @api commands
     */
    saveScreenshot : function(fileName, callback) {
      var self = this;
      return this.screenshot(client.api.options.log_screenshot_data, function(result) {
        client.saveScreenshotToFile(fileName, result.value, function(err) {
          if (typeof callback === 'function') {
            callback.call(self, result, err);
          }
        });
      });
    },

    /**
     * Returns the title of the current page. Uses title protocol command.
     *
     * ```
     *  this.demoTest = function (browser) {
     *    browser.getTitle(function(title) {
     *      this.assert.equal(typeof title, 'string');
     *      this.assert.equal(title, 'Nightwatch.js');
     *    });
     *  };
     * ```
     *
     * @method getTitle
     * @param {function} [callback] Optional callback function to be called when the command finishes.
     * @see title
     * @returns {string} The page title.
     * @api commands
     */
    getTitle : function(callback) {
      var self = this;
      return this.title(function(result) {
        callback.call(self, result.value);
      });
    },

    /**
     * Close the current window. This can be useful when you're working with multiple windows open (e.g. an OAuth login).
     * Uses `window` protocol command.
     *
     * ```
     * this.demoTest = function (client) {
     *   client.closeWindow();
     * };
     * ```
     *
     * @method closeWindow
     * @param {function} [callback] Optional callback function to be called when the command finishes.
     * @see window
     * @since v0.3.0
     * @api commands
     */
    closeWindow : function(callback) {
      var self = this;
      return this.window('DELETE', function(result) {
        if (typeof callback === 'function') {
          callback.call(self, result);
        }
      });
    },

    /**
     * This command is an alias to url and also a convenience method when called without any arguments in the sense that it performs a call to .url() with passing the value of `launch_url` field from the settings file.
     * Uses `url` protocol command.
     *
     * ```
     * this.demoTest = function (client) {
     *   client.init();
     * };
     * ```
     *
     * @method init
     * @param {string} [url] Url to navigate to.
     * @see url
     * @since v0.4.0
     * @api commands
     */
    init : function(url) {
      if (url) {
        return this.url(url);
      }

      if (!this.launchUrl) {
        return this;
      }
      return this.url(this.launchUrl);
    },

    /**
     * Convenience method that adds the specified hash (i.e. url fragment) to the current value of the `launch_url` as set in `nightwatch.json`.
     *
     * ```
     * this.demoTest = function (client) {
     *   client.urlHash('#hashvalue');
     *   // or
     *   client.urlHash('hashvalue');
     * };
     * ```
     *
     * @method urlHash
     * @param {string} hash The hash to add/replace to the current url (i.e. the value set in the launch_url property in nightwatch.json).
     * @see url
     * @since v0.4.0
     * @api commands
     */
    urlHash : function(hash) {
      if (hash.charAt(0) === '#') {
        hash = hash.substring(1);
      }
      return this.url(this.launchUrl + '#' + hash);
    },

    /**
     * Retrieve all cookies visible to the current page. The cookies are returned as an array of cookie JSON object, as defined [here](https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object).
     *
     * Uses `cookie` protocol command.
     *
     * ```
     * this.demoTest = function(browser) {
     *   browser.getCookies(function callback(result) {
     *     this.assert.equal(result.value.length, 1);
     *     this.assert.equals(result.value[0].name, 'test_cookie');
     *   });
     * }
     * ```
     *
     * @method getCookies
     * @param {function} callback The callback function which will receive the response as an argument.
     * @api commands
     * @since v0.4.0
     * @see cookie
     * @returns {Array.<object>} A list of cookies.
     */
    getCookies : function(callback) {
      return this.cookie('GET', callback);
    },

    /**
     * Retrieve a single cookie visible to the current page. The cookie is returned as a cookie JSON object, as defined [here](https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object).
     *
     * Uses `cookie` protocol command.
     *
     * ```
     * this.demoTest = function(browser) {
     *   browser.getCookie(name, function callback(result) {
     *     this.assert.equal(result.value, '123456');
     *     this.assert.equals(result.name, 'test_cookie');
     *   });
     * }
     * ```
     *
     * @method getCookie
     * @param {string} name The cookie name.
     * @param {function} callback The callback function which will receive the response as an argument.
     * @api commands
     * @since v0.4.0
     * @see cookie
     * @returns {object|null} The cookie object as a selenium cookie JSON object or null if the cookie wasn't found.
     */
    getCookie : function(name, callback) {
      var self = this;
      return this.cookie('GET', function(result) {
        if (!result.value || result.value.length === 0) {
          callback.call(self, null);
          return;
        }

        var cookie = null;
        for (var i = 0; i < result.value.length; i++) {
          if (result.value[i].name === name) {
            cookie = result.value[i];
            break;
          }
        }

        callback.call(self, cookie);
      });
    },

    /**
     * Set a cookie, specified as a cookie JSON object, as defined [here](https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object).
     *
     * Uses `cookie` protocol command.
     *
     * ```
     * this.demoTest = function(browser) {
     *   browser.setCookie({
     *     name     : "test_cookie",
     *     value    : "test_value",
     *     path     : "/", (Optional)
     *     domain   : "example.org", (Optional)
     *     secure   : false, (Optional)
     *     httpOnly : false, // (Optional)
     *     expiry   : 1395002765 // (Optional) time in seconds since midnight, January 1, 1970 UTC
     *   });
     * }
     * ```
     *
     * @method setCookie
     * @param {object} cookie The cookie object.
     * @param {function} [callback] Optional callback function to be called when the command finishes.
     * @api commands
     * @since v0.4.0
     * @see cookie
     */
    setCookie : function(cookie, callback) {
      return this.cookie('POST', cookie, callback);
    },

    /**
     * Delete the cookie with the given name. This command is a no-op if there is no such cookie visible to the current page.
     *
     * ```
     * this.demoTest = function(browser) {
     *   browser.deleteCookie("test_cookie", function() {
     *     // do something more in here
     *   });
     * }
     * ```
     *
     * @method deleteCookie
     * @param cookieName The name of the cookie to delete.
     * @param {function} [callback] Optional callback function to be called when the command finishes.
     * @api commands
     * @since v0.4.0
     * @see cookie
     */
    deleteCookie : function(cookieName, callback) {
      return this.cookie('DELETE', cookieName, callback);
    },

    /**
     * Delete all cookies visible to the current page.
     *
     * ```
     * this.demoTest = function(browser) {
     *   browser.deleteCookies(function() {
     *     // do something more in here
     *   });
     * }
     * ```
     *
     * @method deleteCookies
     * @param {function} [callback] Optional callback function to be called when the command finishes.
     * @api commands
     * @since v0.4.0
     * @see cookie
     */
    deleteCookies : function(callback) {
      return this.cookie('DELETE', callback);
    },

    /**
     * Utility command to load an external script into the page specified by url.
     *
     * ```
     * this.demoTest = function(client) {
     *   this.injectScript('http://example.org/js/utility.js', function() {
     *     // we're all done here.
     *   });
     * };
     * ```
     *
     * @method injectScript
     * @param {string} scriptUrl The script file url
     * @param {string} [id] Dom element id to be set on the script tag.
     * @param {function} [callback] Optional callback function to be called when the command finishes.
     * @api commands
     * @since v0.4.0
     * @returns {HTMLScriptElement} The newly created script tag.
     */
    injectScript : function(scriptUrl, id, callback) {
      var args = [scriptUrl];
      if (arguments.length == 2 && typeof arguments[1] == 'function') {
        callback = arguments[1];
      } else if (typeof id == 'string') {
        args.push(id);
      }

      return this.execute(function(u,i) {/* jshint browser:true */return (function(d){var e=d.createElement('script');var m=d.getElementsByTagName('head')[0];e.src=u;if(i){e.id=i;}m.appendChild(e);return e;})(document);}, args, callback);
    },

    /**
     * Gets the available log types
     *
     * ```
     * this.demoTest = function(client) {
     *   this.getLogTypes(function(typesArray) {
     *
     *   });
     * };
     * ```
     *
     * @method getLogTypes
     * @param {function} [callback] Optional callback function to be called when the command finishes.
     * @api commands
     * @see logTypes
     */
    getLogTypes: function(callback) {
      var self = this;
      return this.sessionLogTypes(function(response) {
        if (callback) {
          callback.call(self, response.value);
        }
      });
    },

    /**
     * Gets a log from selenium
     *
     * ```
     * this.demoTest = function(client) {
     *   this.getLog('browser', function(logEntriesArray) {
     *     console.log('Log length: ' + logEntriesArray.length);
     *     logEntriesArray.forEach(function(log) {
     *        console.log('[' + log.level + '] ' + log.timestamp + ' : ' + log.message);
     *      });
     *   });
     * };
     * ```
     *
     * @method getLog
     * @param {string|function} typeString Log type to request
     * @param {function} [callback] Optional callback function to be called when the command finishes.
     * @api commands
     * @see log
     */
    getLog: function(typeString, callback) {
      var self = this;
      if (typeof typeString !== 'string') {
        if (typeof typeString === 'function') {
          callback = typeString;
        }
        typeString = 'browser';
      }
      return this.sessionLog(typeString, function (response) {
        if (callback) {
          callback.call(self, response.value);
        }
      });
    },

    /**
     * Utility command to test if the log type is available
     *
     * ```
     * this.demoTest = function(browser) {
     *   browser.isLogAvailable('browser', function(isAvailable) {
     *     // do something more in here
     *   });
     * }
     * ```
     *
     * @method isLogAvailable
     * @param {string|function} typeString Type of log to test
     * @param {function} [callback] Optional callback function to be called when the command finishes.
     * @api commands
     * @see getLogTypes
     */
    isLogAvailable: function (typeString, callback) {
      var self = this;
      if (typeof typeString !== 'string') {
        if (typeof typeString === 'function') {
          callback = typeString;
        }
        typeString = 'browser';
      }
      this.getLogTypes(function (types) {
        var isAvailable = types.indexOf(typeString) >= 0;
        if (callback) {
          callback.call(self, isAvailable);
        }
      });
    }

  };
};


text:
namespace pdalboost {} namespace boost = pdalboost; namespace pdalboost { namespace python { namespace objects {

// Very much like pdalboost::reference_wrapper<T>, except that in this
// case T can be a reference already without causing a
// reference-to-reference error.
template <class T>
struct reference_to_value
{
    typedef typename add_reference<typename add_const<T>::type>::type reference;

    reference_to_value(reference x) : m_value(x) {}
    reference get() const { return m_value; }
 private:
    reference m_value;
};

// A little metaprogram which selects the type to pass through an
// intermediate forwarding function when the destination argument type
// is T.
template <class T>
struct forward
    : mpl::if_<
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
          // vc6 chokes on unforwarding enums nested in classes
          mpl::and_<
              is_scalar<T>
            , mpl::not_<
                  is_enum<T>
              >
          >
# else
          mpl::or_<python::detail::copy_ctor_mutates_rhs<T>, is_scalar<T> >
# endif
        , T
        , reference_to_value<T>
      >
{
};

# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template<typename T>
struct unforward
{
    typedef typename unwrap_reference<T>::type& type;
};

template<typename T>
struct unforward<reference_to_value<T> >
{
    typedef T type;
};

template <typename T>
struct unforward_cref
  : python::detail::value_arg<
        typename unwrap_reference<T>::type
    >
{
};

template<typename T>
struct unforward_cref<reference_to_value<T> >
  : add_reference<typename add_const<T>::type>
{
};

# else // no partial specialization

namespace detail
{
  typedef char (&yes_reference_to_value_t)[1];
  typedef char (&no_reference_to_value_t)[2];

  no_reference_to_value_t is_reference_to_value_test(...);

  template<typename T>
  yes_reference_to_value_t is_reference_to_value_test(pdalboost::type< reference_to_value<T> >);

  template<bool wrapped>
  struct unforwarder
  {
      template <class T>
      struct apply
      {
          typedef typename unwrap_reference<T>::type& type;
      };
  };

  template<>
  struct unforwarder<true>
  {
      template <class T>
      struct apply
      {
          typedef typename T::reference type;
      };
  };

  template<bool wrapped = false>
  struct cref_unforwarder
  {
      template <class T>
      struct apply
        : python::detail::value_arg<
              typename unwrap_reference<T>::type
          >
      {
      };
  };

  template<>
  struct cref_unforwarder<true>
  {
      template <class T>
      struct apply
        : python::detail::value_arg<
              typename T::reference
          >
      {
      };
  };

  template<typename T>
  struct is_reference_to_value
  {
      BOOST_STATIC_CONSTANT(
          bool, value = (
              sizeof(is_reference_to_value_test(pdalboost::type<T>()))
              == sizeof(yes_reference_to_value_t)));
      typedef mpl::bool_<value> type;
  };
}

template <typename T>
struct unforward
    : public detail::unforwarder<
        detail::is_reference_to_value<T>::value
      >::template apply<T>
{};

template <typename T>
struct unforward_cref
    : public detail::cref_unforwarder<
        detail::is_reference_to_value<T>::value
      >::template apply<T>
{};

# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION

template <class T>
typename reference_to_value<T>::reference
do_unforward(reference_to_value<T> const& x, int)
{
    return x.get();
}

template <class T>
typename reference_wrapper<T>::type&
do_unforward(reference_wrapper<T> const& x, int)
{
    return x.get();
}

template <class T>
T const& do_unforward(T const& x, ...)
{
    return x;
}

}}} // namespace pdalboost::python::objects

#endif // FORWARD_DWA20011215_HPP


text:
import com.google.common.base.Optional;

class A {

  void m() {
    Option<caret>al<String> o = Optional.absent();
    String s = o.get();
    Optional<String> yetAnotherOptional = Optional.fromNullable("bla-bla");
    System.out.println(o.or(yetAnotherOptional));
    if (o.isPresent()) {
      System.out.println(o.get());
    }
    System.out.println(o.orNull());
    Set<String> set = o.asSet();
  }

}


text:
package org.jivesoftware.smackx.blocking.element;

import java.util.Collections;
import java.util.List;

import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smackx.blocking.BlockingCommandManager;
import org.jxmpp.jid.Jid;

/**
 * Block contact IQ class.
 *
 * @author Fernando Ramirez
 * @see XEP-0191: Blocking
 *      Command
 */
public class BlockContactsIQ extends IQ {

    /**
     * block element.
     */
    public static final String ELEMENT = "block";

    /**
     * the IQ NAMESPACE.
     */
    public static final String NAMESPACE = BlockingCommandManager.NAMESPACE;

    private final List<Jid> jids;

    /**
     * Block list IQ constructor.
     *
     * @param jids
     */
    public BlockContactsIQ(List<Jid> jids) {
        super(ELEMENT, NAMESPACE);
        this.setType(Type.set);
        this.jids = Collections.unmodifiableList(jids);
    }

    /**
     * Get the JID.
     *
     * @return the list of JIDs
     */
    public List<Jid> getJids() {
        return jids;
    }

    @Override
    protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
        xml.rightAngleBracket();

        if (jids != null) {
            for (Jid jid : jids) {
                xml.halfOpenElement("item");
                xml.attribute("jid", jid);
                xml.closeEmptyElement();
            }
        }

        return xml;
    }

}


text:
/* jshint strict: false */
/* jshint node: true */

var autoprefixer = require('gulp-autoprefixer');
var browserify   = require('browserify');
var babelify     = require('babelify');
var browserSync  = require('browser-sync').create();
var buffer       = require('vinyl-buffer');
var del          = require('del');
var envify       = require('envify/custom');
var ghPages      = require('gulp-gh-pages');
var gulp         = require('gulp');
var path         = require('path');
var riot         = require('riotify');
var runSequence  = require('run-sequence');
var sass         = require('gulp-sass');
var source       = require('vinyl-source-stream');
var sourcemaps   = require('gulp-sourcemaps');
var watchify     = require('watchify');

var $ = {
  dist: "./dist/",
  app:  "./src/app.js",
  html: "./src/**/*.html",
  js:   "./src/js/*.js",
  scss: "./src/scss/**/*.scss",
  tag:  "./src/tag/*.tag",
  env:  "development"
};

function compile(watch) {
  var bundler  = watchify(browserify($.app), {debug: true})
                    .transform(envify({NODE_ENV: $.env}))
                    .transform(babelify)
                    .transform(riot, {type: 'es6'});

  function rebundle() {
    bundler.bundle()
    .on('error', function(err) { console.error(err); this.emit('end'); })
    .pipe(source(path.basename($.app)))
    .pipe(buffer())
    .pipe(sourcemaps.init({ loadMaps: true }))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest($.dist));
  }

  if (watch) {
    bundler.on('update', function() {
      console.log('-> bundling...');
      rebundle();
    });
  }

  rebundle();
}

function watch() {
  return compile(true);
}

gulp.task('clean', function(cb) { del([$.dist], cb); });
gulp.task('jsBuild', function() { return compile(); });
gulp.task('jsWatch', function() { return watch(); });
gulp.task('setProduction', function() {$.env = 'production'; });

gulp.task('serve', function() {
  browserSync.init({
    server: {
      baseDir: $.dist
    },
    files: [$.dist]
  });

  gulp.watch($.html, ['html']);
  gulp.watch($.scss, ['sass']);
  gulp.watch([$.js, $.tag], ['jsBuild']);
});

gulp.task('sass', function() {
  var include = require('node-normalize-scss').with('./node_modules/csstyle');

  gulp.src($.scss)
  .pipe(sass({includePaths: include})
        .on('error', function(err) { console.log(err); }))
  .pipe(autoprefixer({
    browsers: ['> 1%', 'last 2 versions', 'Android 4'],
    cascade: false
  }))
  .pipe(gulp.dest($.dist))
  .pipe(browserSync.stream());
});

gulp.task('html', function() {
  gulp.src($.html)
      .pipe(gulp.dest($.dist));
});

gulp.task('production', function(cb) {
  $.env = 'production';
  runSequence('clean', ['html', 'sass', 'jsBuild'], cb);
});

gulp.task('deploy', function() {
  gulp.src($.dist + "**/*")
      .pipe(ghPages());
});

gulp.task('default', function(cb) {
  runSequence('clean', ['html', 'sass', 'jsWatch'], 'serve', cb);
});


text:
@extends('adminlte::layouts.app')
@section('content')

        Manteniment Localització

 Manteniment

Location

    @yield('action-content')

@endsection


text:
module Escher
  module Request
    class Factory

      def self.from_request(request)
        case request

          when defined?(ActionDispatch::Request) && ActionDispatch::Request
            RackRequest.new(Rack::Request.new(request.env))

          when defined?(Rack::Request) && Rack::Request
            RackRequest.new(request)

          when Hash
            HashRequest.new(request)

          else
            Escher::Request::LegacyRequest.new(request)

        end
      end

    end
  end
end


text:
namespace df
{
class StraightTextLayout;

class TextShape : public MapShape
{
public:
  TextShape(m2::PointD const & basePoint, TextViewParams const & params,
            TileKey const & tileKey, bool hasPOI, m2::PointF const & symbolSize,
            dp::Anchor symbolAnchor, uint32_t textIndex);

  void Draw(ref_ptr<dp::Batcher> batcher, ref_ptr<dp::TextureManager> textures) const override;
  MapShapeType GetType() const override { return MapShapeType::OverlayType; }

  // Only for testing purposes!
  void DisableDisplacing() { m_disableDisplacing = true; }

private:
  void DrawSubString(StraightTextLayout const & layout, dp::FontDecl const & font,
                     glsl::vec2 const & baseOffset, ref_ptr<dp::Batcher> batcher,
                     ref_ptr<dp::TextureManager> textures, bool isPrimary, bool isOptional) const;

  void DrawSubStringPlain(StraightTextLayout const & layout, dp::FontDecl const & font,
                          glsl::vec2 const & baseOffset, ref_ptr<dp::Batcher> batcher,
                          ref_ptr<dp::TextureManager> textures, bool isPrimary, bool isOptional) const;
  void DrawSubStringOutlined(StraightTextLayout const & layout, dp::FontDecl const & font,
                             glsl::vec2 const & baseOffset, ref_ptr<dp::Batcher> batcher,
                             ref_ptr<dp::TextureManager> textures, bool isPrimary, bool isOptional) const;

  uint64_t GetOverlayPriority() const;

  m2::PointD m_basePoint;
  TextViewParams m_params;
  m2::PointI m_tileCoords;
  bool m_hasPOI;
  m2::PointF m_symbolSize;
  dp::Anchor m_symbolAnchor;
  uint32_t m_textIndex;

  bool m_disableDisplacing = false;
};
}  // namespace df


text:
<?php
namespace Nicklas\Comment\HTMLForm\Profile;

use \Anax\HTMLForm\FormModel;
use \Anax\DI\DIInterface;
use \Nicklas\Comment\Modules\User;

/**
 * Example of FormModel implementation.
 */
class UpdateProfileSecurityForm extends FormModel
{
    /**
     * Constructor injects with DI container.
     *
     * @param Anax\DI\DIInterface $di a service container
     */
    public function __construct(DIInterface $di)
    {
        parent::__construct($di);
        $this->user = new User();
        $this->user->setDb($this->di->get("db"));
        $this->user = $this->user->find("name", $this->di->get("session")->get("user"));
        $this->form->create(
            [
                "id" => __CLASS__,
                "br-after-label" => false,
                "wrapper-element" => "div",
                "legend" => "Ändra ditt lösenord"
            ],
            [
                "answer" => [
                    "type"        => "text",
                    "value" => "{$this->user->question}",
                    "label" => "Kontrollfråga",
                    "validation" => ["not_empty"],
                ],
                "password" => [
                    "type"        => "password",
                    "label" => "Lösenord",
                ],
                "password-again" => [
                    "type"        => "password",
                    "label" => "Lösenord igen"
                ],
                "submit" => [
                    "type" => "submit",
                    "value" => "Ändra lösenord",
                    "callback" => [$this, "callbackSubmit"],
                ],
                "submit2" => [
                    "type" => "submit",
                    "value" => "Ändra kontrollfråga",
                    "callback" => [$this, "callbackQuestion"],
                ],
            ]
        );
    }
    /**
     * Callback for submit-button which should return true if it could
     * carry out its work and false if something failed.
     *
     * @return boolean true if okey, false if something went wrong.
     */
    public function callbackSubmit()
    {
        // Get values from the submitted form
        $password      = $this->form->value("password");
        $passwordAgain = $this->form->value("password-again");

        // Check password matches
        if ($password == null) {
            $this->form->rememberValues();
            $this->form->addOutput("Du angav aldrig ett lösenord");
            return false;
        }

        // Check password matches
        if ($password !== $passwordAgain) {
            $this->form->rememberValues();
            $this->form->addOutput("Lösenordet matchade ej");
            return false;
        }

        $this->user->setPassword($password);
        $this->user->save();
        $this->form->addOutput("
Du ändrade ditt lösenord!

TIPS:Innan du loggar ut, kontrollera så din kontrollfråga stämmer ifall du glömmer bort
");
        return true;
    }

    /**
     * Callback for submit-button which should return true if it could
     * carry out its work and false if something failed.
     *
     * @return boolean true if okey, false if something went wrong.
     */
    public function callbackQuestion()
    {
        // Get values from the submitted form
        $this->user->question = $this->form->value("answer");
        $this->form->addOutput("Du har ändrat svaret på din kontrollfråga till `{$this->user->question}`");
        $this->user->save();
        return true;
    }
}


text:
package org.kie.workbench.common.stunner.bpmn.client.forms.fields.notificationsEditor.validation;

import com.google.gwtmockito.GwtMockitoTestRunner;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.Expiration;

import static org.junit.Assert.assertEquals;

@RunWith(GwtMockitoTestRunner.class)
public class ExpirationTypeOracleTest {

    private ExpirationTypeOracle oracle;

    @Before
    public void setUp() throws Exception {
        oracle = new ExpirationTypeOracle();
    }

    @Test
    public void testEmptyNotificationRow() {
        Expiration result = oracle.guess("1d");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testISO8601DATETIMERepeatableValue() {
        Expiration result = oracle.guess("R/2019-07-14T13:34-02/PT33M");
        assertEquals(Expiration.DATETIME, result);
    }

    @Test
    public void testISO8601WithTZ02ZRepeatable1AndPeriodValue() {
        Expiration result = oracle.guess("R1/2019-07-14T13:34-02/PT33M");
        assertEquals(Expiration.DATETIME, result);
    }

    @Test
    public void testISO8601WithTZ00ZRepeatable1AndPeriodAndTZ02Value() {
        Expiration result = oracle.guess("R1/2019-07-14T13:34-02/PT33D");
        assertEquals(Expiration.DATETIME, result);
    }

    @Test
    public void testISO8601WithTZ00ZRepeatable10AndPeriodAndTZ0230Value() {
        Expiration result = oracle.guess("R10/2019-07-14T13:34+02:30/P33M");
        assertEquals(Expiration.DATETIME, result);
    }

    @Test
    public void testISO8601WithTZ02RepeatableValue() {
        Expiration result = oracle.guess("2019-07-14T13:34-02");
        assertEquals(Expiration.DATETIME, result);
    }

    @Test
    public void testISO8601DATETIMEValue() {
        Expiration result = oracle.guess("2019-07-14T13:34-02");
        assertEquals(Expiration.DATETIME, result);
    }

    @Test
    public void testISO8601RepeatableValue() {
        Expiration result = oracle.guess("R/PT33M");
        assertEquals(Expiration.TIMEPERIOD, result);
    }

    @Test
    public void testMonthRepeatableUntilStateChangesNotification() {
        Expiration result = oracle.guess("R/P33M");
        assertEquals(Expiration.TIMEPERIOD, result);
    }

    @Test
    public void testNotificationAndTZ0245() {
        Expiration result = oracle.guess("2019-07-14T13:34-02:45");
        assertEquals(Expiration.DATETIME, result);
    }

    @Test
    public void testNotificationAndTZ002() {
        Expiration result = oracle.guess("2019-07-14T13:34:00Z");
        assertEquals(Expiration.DATETIME, result);
    }

    @Test
    public void test1DigExpiresAtNotificationRow() {
        Expiration result = oracle.guess("1d");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testOldTimeFormat() {
        Expiration result = oracle.guess("2d6H48m32s12mS");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testExampleFromTheTip() {
        Expiration result = oracle.guess("P2y10M14dT20h13m");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testDurations() {
        Expiration result = oracle.guess("P1Y2M5DT4H5M8S6MS");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testDurationsY() {
        Expiration result = oracle.guess("P1YT20H13M");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testDurationsD() {
        Expiration result = oracle.guess("P1DT20H13M");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testDurationsW() {
        Expiration result = oracle.guess("P1WT20H13M");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testRepeatingIntervals() {
        Expiration result = oracle.guess("R5/P1Y2M5DT4H5M8S6MS");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testRepeatingIntervalsY() {
        Expiration result = oracle.guess("R2/P1YT20H13M");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testRepeatingIntervalsD() {
        Expiration result = oracle.guess("R2/P1DT20H13M");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testRepeatingIntervalsW() {
        Expiration result = oracle.guess("R2/P1WT20H13M");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testR2StartEnd() {
        Expiration result = oracle.guess("R2/2019-05-27T13:00:00Z/2019-05-27T17:00:00Z");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testRStartEnd() {
        Expiration result = oracle.guess("R/2019-05-27T13:00:00Z/2019-05-27T17:00:00Z");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testPT0H() {
        Expiration result = oracle.guess("PT0H");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testR2PT4H20190527T130000Z() {
        Expiration result = oracle.guess("R2/PT4H/2019-05-27T13:00:00Z");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testR2P1WT20H13M20190527T130000Z() {
        Expiration result = oracle.guess("R2/P1WT20H13M/2019-05-27T13:00:00Z");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testR120190714T133402P33S() {
        Expiration result = oracle.guess("R1/2019-07-14T13:34-02/P33S");
        assertEquals(Expiration.EXPRESSION, result);
    }

    @Test
    public void testR120190714T133402P33MS() {
        Expiration result = oracle.guess("R1/2019-07-14T13:34-02/P33MS");
        assertEquals(Expiration.EXPRESSION, result);
    }
}