text:
class Error100(Exception):
    def __init__(self, *args, **kwargs):
        super(Error100, self).__init__(*args, **kwargs)
        self.status = 100

class Error101(Exception):
    def __init__(self, *args, **kwargs):
        super(Error101, self).__init__(*args, **kwargs)
        self.status = 101

class Error102(Exception):
    def __init__(self, *args, **kwargs):
        super(Error102, self).__init__(*args, **kwargs)
        self.status = 102

class Error200(Exception):
    def __init__(self, *args, **kwargs):
        super(Error200, self).__init__(*args, **kwargs)
        self.status = 200

class Error201(Exception):
    def __init__(self, *args, **kwargs):
        super(Error201, self).__init__(*args, **kwargs)
        self.status = 201

class Error202(Exception):
    def __init__(self, *args, **kwargs):
        super(Error202, self).__init__(*args, **kwargs)
        self.status = 202

class Error203(Exception):
    def __init__(self, *args, **kwargs):
        super(Error203, self).__init__(*args, **kwargs)
        self.status = 203

class Error204(Exception):
    def __init__(self, *args, **kwargs):
        super(Error204, self).__init__(*args, **kwargs)
        self.status = 204

class Error205(Exception):
    def __init__(self, *args, **kwargs):
        super(Error205, self).__init__(*args, **kwargs)
        self.status = 205

class Error206(Exception):
    def __init__(self, *args, **kwargs):
        super(Error206, self).__init__(*args, **kwargs)
        self.status = 206

class Error207(Exception):
    def __init__(self, *args, **kwargs):
        super(Error207, self).__init__(*args, **kwargs)
        self.status = 207

class Error226(Exception):
    def __init__(self, *args, **kwargs):
        super(Error226, self).__init__(*args, **kwargs)
        self.status = 226

class Error300(Exception):
    def __init__(self, *args, **kwargs):
        super(Error300, self).__init__(*args, **kwargs)
        self.status = 300

class Error301(Exception):
    def __init__(self, *args, **kwargs):
        super(Error301, self).__init__(*args, **kwargs)
        self.status = 301

class Error302(Exception):
    def __init__(self, *args, **kwargs):
        super(Error302, self).__init__(*args, **kwargs)
        self.status = 302

class Error303(Exception):
    def __init__(self, *args, **kwargs):
        super(Error303, self).__init__(*args, **kwargs)
        self.status = 303

class Error304(Exception):
    def __init__(self, *args, **kwargs):
        super(Error304, self).__init__(*args, **kwargs)
        self.status = 304

class Error305(Exception):
    def __init__(self, *args, **kwargs):
        super(Error305, self).__init__(*args, **kwargs)
        self.status = 305

class Error307(Exception):
    def __init__(self, *args, **kwargs):
        super(Error307, self).__init__(*args, **kwargs)
        self.status = 307

class Error400(Exception):
    def __init__(self, *args, **kwargs):
        super(Error400, self).__init__(*args, **kwargs)
        self.status = 400

class Error401(Exception):
    def __init__(self, *args, **kwargs):
        super(Error401, self).__init__(*args, **kwargs)
        self.status = 401

class Error402(Exception):
    def __init__(self, *args, **kwargs):
        super(Error402, self).__init__(*args, **kwargs)
        self.status = 402

class Error403(Exception):
    def __init__(self, *args, **kwargs):
        super(Error403, self).__init__(*args, **kwargs)
        self.status = 403

class Error404(Exception):
    def __init__(self, *args, **kwargs):
        super(Error404, self).__init__(*args, **kwargs)
        self.status = 404

class Error405(Exception):
    def __init__(self, *args, **kwargs):
        super(Error405, self).__init__(*args, **kwargs)
        self.status = 405

class Error406(Exception):
    def __init__(self, *args, **kwargs):
        super(Error406, self).__init__(*args, **kwargs)
        self.status = 406

class Error407(Exception):
    def __init__(self, *args, **kwargs):
        super(Error407, self).__init__(*args, **kwargs)
        self.status = 407

class Error408(Exception):
    def __init__(self, *args, **kwargs):
        super(Error408, self).__init__(*args, **kwargs)
        self.status = 408

class Error409(Exception):
    def __init__(self, *args, **kwargs):
        super(Error409, self).__init__(*args, **kwargs)
        self.status = 409

class Error410(Exception):
    def __init__(self, *args, **kwargs):
        super(Error410, self).__init__(*args, **kwargs)
        self.status = 410

class Error411(Exception):
    def __init__(self, *args, **kwargs):
        super(Error411, self).__init__(*args, **kwargs)
        self.status = 411

class Error412(Exception):
    def __init__(self, *args, **kwargs):
        super(Error412, self).__init__(*args, **kwargs)
        self.status = 412

class Error413(Exception):
    def __init__(self, *args, **kwargs):
        super(Error413, self).__init__(*args, **kwargs)
        self.status = 413

class Error414(Exception):
    def __init__(self, *args, **kwargs):
        super(Error414, self).__init__(*args, **kwargs)
        self.status = 414

class Error415(Exception):
    def __init__(self, *args, **kwargs):
        super(Error415, self).__init__(*args, **kwargs)
        self.status = 415

class Error416(Exception):
    def __init__(self, *args, **kwargs):
        super(Error416, self).__init__(*args, **kwargs)
        self.status = 416

class Error417(Exception):
    def __init__(self, *args, **kwargs):
        super(Error417, self).__init__(*args, **kwargs)
        self.status = 417

class Error418(Exception):
    def __init__(self, *args, **kwargs):
        super(Error418, self).__init__(*args, **kwargs)
        self.status = 418

class Error422(Exception):
    def __init__(self, *args, **kwargs):
        super(Error422, self).__init__(*args, **kwargs)
        self.status = 422

class Error423(Exception):
    def __init__(self, *args, **kwargs):
        super(Error423, self).__init__(*args, **kwargs)
        self.status = 423

class Error424(Exception):
    def __init__(self, *args, **kwargs):
        super(Error424, self).__init__(*args, **kwargs)
        self.status = 424

class Error426(Exception):
    def __init__(self, *args, **kwargs):
        super(Error426, self).__init__(*args, **kwargs)
        self.status = 426

class Error500(Exception):
    def __init__(self, *args, **kwargs):
        super(Error500, self).__init__(*args, **kwargs)
        self.status = 500

class Error501(Exception):
    def __init__(self, *args, **kwargs):
        super(Error501, self).__init__(*args, **kwargs)
        self.status = 501

class Error502(Exception):
    def __init__(self, *args, **kwargs):
        super(Error502, self).__init__(*args, **kwargs)
        self.status = 502

class Error503(Exception):
    def __init__(self, *args, **kwargs):
        super(Error503, self).__init__(*args, **kwargs)
        self.status = 503

class Error504(Exception):
    def __init__(self, *args, **kwargs):
        super(Error504, self).__init__(*args, **kwargs)
        self.status = 504

class Error505(Exception):
    def __init__(self, *args, **kwargs):
        super(Error505, self).__init__(*args, **kwargs)
        self.status = 505

class Error507(Exception):
    def __init__(self, *args, **kwargs):
        super(Error507, self).__init__(*args, **kwargs)
        self.status = 507

class Error510(Exception):
    def __init__(self, *args, **kwargs):
        super(Error510, self).__init__(*args, **kwargs)
        self.status = 510


text:
1. [](#bugfix)
   * Better validation for Git Repository value on both Wizard and Backend.
   * Prevent malicious commands from being executed in Wizard when "Verifying Authentication, Connection and Branch".

# v2.3.1
## 04/30/2021

1. [](#bugfix)
   * Fixed regression where `testRepository` would erroneously pass with invalid credentials [#200](https://github.com/trilbymedia/grav-plugin-git-sync/issues/200)
   * Fixed Exception thrown with `bin/plugin git-sync status` command, preventing `sync` [#200](https://github.com/trilbymedia/grav-plugin-git-sync/issues/200)

# v2.3.0
## 04/27/2021

1. [](#new)
   * Added new Advanced Git Ignore field where it is possible to specify custom git ignore entries to play along with GitSync [#197](https://github.com/trilbymedia/grav-plugin-git-sync/issues/197) [#117](https://github.com/trilbymedia/grav-plugin-git-sync/issues/117)
   * Support `ssh://` protocol and SSH Key authentication ([read more](https://github.com/trilbymedia/grav-plugin-git-sync#ssh--enterprise)) [#110](https://github.com/trilbymedia/grav-plugin-git-sync/issues/110)
1. [](#improved)
   * Updated PHP Encryption dependency
1. [](#bugfix)
   * Fixed issue with Flex Objects, preventing GitSync's settings to get refreshed `onAdminSave` when "Sync on Page Save" disabled
   * Return raw URL for repositories setup with `ssh://` protocol, instead of injecting the password like `git://` and `http://` protocols do [#104](https://github.com/trilbymedia/grav-plugin-git-sync/issues/104)

# v2.2.0
## 04/17/2021

1. [](#improved)
   * Better support for branches other than `master`. This includes the transition to `main` from GitHub and the groundwork to support other big providers making the change as announced soon. GitSync is now capable of preset the branch based on the provider selected. You are now also able to specify any custom branch and when testing the repository connection it will also ensure the branch exists and provide feedback if not.
1. [](#bugfix)
   * Changing remote branch is now going to properly reference it instead of remaining stuck to `master` [#192](https://github.com/trilbymedia/grav-plugin-git-sync/issues/192), [#183](https://github.com/trilbymedia/grav-plugin-git-sync/issues/183)
   * Fixed issue where the Folders to synchronize from the Wizard wouldn't get properly saved [#178](https://github.com/trilbymedia/grav-plugin-git-sync/issues/178)

# v2.1.1
## 07/17/2020

1. [](#new)
    * Added `No User` option to allow disabling the username requirement. This is useful for when you have a token and the user is not required. (#166, thanks GwynethLlewelyn)
    * Added `passwd` command for programmatically change user/password (use: `bin/plugin git-sync passwd`) (#146)
    * Fixed regression wrongly returning the installed Git version and causing all sort of problems, including unrelated histories not kicking off (#61, #168, #171, #173)
    * Fixed potential issue where the new feature `no_user` my throw an error
    * Fixed issue with autoload
1. [](#bugfix)
    * Fixed classes not being loaded in `cli` commands due to Grav changes (#167)
    * Updated dependencies / recompiled JS for production
1. [](#improved)
    * Bumped modules versions

# v2.1.0
## 03/13/2020

1. [](#new)
    * Requires Grav v1.6.0
    * Pass phpstan level 2 tests
1. [](#improved)
    * Code cleanup
    * Added support for Gitea / Gogs webhook secret (#149, thanks @Aisbergg)

# v2.0.5
## 05/06/2019

1. [](#bugfix)
    * Fixed validation error with commalist in Folders to Sync field (#141)

# v2.0.4
## 04/22/2019

1. [](#improved)
    * urlencode username to allow for special characters (#139)

# v2.0.3
## 03/07/2019

1. [](#bugifx)
    * Properly fallback to config message if not there yet (#134)

# v2.0.2
## 02/21/2019

1. [](#improved)
    * Fixed InitCommand spelling (#132, thanks @alex-mohemian)
1. [](#bugfix)
    * Fixed PHP 5.6 incompatibility introduced by latest release.

# v2.0.1
## 02/19/2019

1. [](#new)
    * Added new `init` CLI command (`bin/plugin git-sync init`) (#128, thanks @LeonRyan and @alex-mohemian)
1. [](#improved)
    * Allow setting a personalised commit message (#123, thanks @kyed)
    * Added better directions for Azure + IIS users for the Git Binary
1. [](#bugfix)
    * Fixed `LC_ALL` to use `C` instead of en_US.UTF-8`, to be more flexible (#124, #125, thanks @lambopedia)

# v2.0.0
## 10/15/2018

1. [](#new)
    * Added support for new awesome Grav 1.6 Scheduler
    * Added logic to display custom nested folders in wizard
    * Other than `pages`, it is now possible to enable `config`, `data`, `plugins` and `themes` for synchronization. You can also add any custom folder you have in your `user` (#4, #21, #34, #58, #63, #83)
    * Allow users with `admin.pages` permissions to synchronize through quick tray (#79, thanks @apfrod)
    * When using Grav as committer, the user email will be now used for the commit (#81, thanks @apfrod)
    * Added support for Webhook Secret (Bitbucket does not yet support them) (#72, #73, thanks @pathmissing)
    * Added options to turn automatic synchronization on/off with page saves, delete and media changes (#105, thanks @AmauryCarrade)
1. [](#improved)
    * Fixed alignment of the git icon in the Wizard (#115)
    * Prevent Wizard modal to get canceled when clicking on the overlay background (#115)
    * Quick tray icon is now smarter. If GitSync has not been initialized yet, it will take you straight to wizard, otherwise it would perform a synchronization (#115)
    * Rearranged blueprint order (thanks @paulhibbitts)
    * GitLab: Updated wizard instructions to be inline with the new GitLab UI (#90)
    * Tweaked alignment of links in the wizard (#57)
    * Properly support local branches that aren't `master` (#56)
    * Allow to specify custom local_repository (default, `USER_DIR`) (#95, thanks @Hydraner, also #54, #33, #25)
    * Webhook URL is now more robust and secure, by default it is generated with a random value
    * Git icon from Admin has been replaced to use the `git` text icon instead of the logo
    * Prevent next step if Step 1 and Step 2 are not filled in (#92)
    * Added notice in Step 2 explaning what GitSync expect from the repository structure (#92)
1. [](#bugfix)
    * Fixed issue where on first initialization the checkout process would error out
    * Fixed issue with Pages save.
    * Fixed JS error in plugins list
    * Fixed nested folders not synchronizing
    * Fixed issue where Wizard wouldn't work in case the `admin` path was modified (#27, #94, #77, thanks @pathmissing)
    * Fixed webhook generated URL when multi-lang active (#71)
    * Resolved issue with untracked/uncommited files at the root of the `sync` folder. (#101, thanks @ScottHamper)

# v1.0.4
## 08/16/2017

1. [](#new)
    * CLI: Added `status` command to check config and git (#52, thanks @karfau)
    * Allow local branches to be named differently than the remote branches (#48, thanks @denniswebb)
    * Added support for new Admin Navigation Tray
1. [](#bugfix)
    * Fixed minimum Git required version to support `--all` (#32,#49, thanks @redrohX)

# v1.0.3
## 02/21/2017

1. [](#bugfix)
    * Fixed issue with new 'author' option that could trigger errors when settings were not saved. (#23)
    * Fixed the 'More Details' button triggering the Modal to close instead of just expanding the details

# v1.0.2
## 02/18/2017

1. [](#new)
    * It is now possible to change the committer name. You can choose between Git User, GitSync Committer Name, Grav User Name, Grav User Fullname (#14).
2. [](#improved)
    * Added more documentation and description about the support of 2FA and Access Tokens (#16, #19, thanks @OleVik)
    * Added 4th Generic Git choice in the wizard for self-hosted and custom git services (Gogs/Gitea) (#7 - #22 - thanks @erlepereira)
1. [](#bugfix)
    * Fixed issue preventing the custom Git Binary Path from getting used (#15)
    * Fixed issue with Webhook auto-generated URL where it would display double slashes in case of root domain (#15)
    * Fixed issue with the modal not properly restoring the tutorial steps of the active selected service

# v1.0.1
## 01/29/2017

1. [](#bugfix)
    * Changed default GitSync email for commits

# v1.0.0
## 01/25/2017

1. [](#new)
    * Released plugin to stable GPM channel

# v1.0.0-rc.3
## 01/19/2017

1. [](#new)
    * Added logger setting to log Git command executions
1. [](#improved)
    * Improved Windows compatibility

# v1.0.0-rc.2
## 01/16/2017

1. [](#new)
    * Allow to change the path for the `git` binary (#1)
    * Added CLI for synchronizing `bin/plugin git-sync sync` (#2)
    * More security: Git password will now get encrypted and won't load in admin
1. [](#improved)
    * Wizard: Improved Bitbucket explanation about stripping out `user@` from the copied HTTPS url (#3)
1. [](#bugfix)
    * Fixed potential issue when retrieving the currently installed git version
    * Fixed issue that would not properly hide the password from error messages if the password contained special chars
    * Fixed issue preventing the plugin to properly get setup the very first time and causing 401 error (#4)
    * Workaround for error thrown when removing the plugin

# v1.0.0-rc.1
##  12/19/2016

1. [](#new)
    * Initial Release

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Arindam Paul</title>
    <description>My website</description>
    <link>http://localhost:4000/</link>
    <atom:link href="http://localhost:4000/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Thu, 24 Oct 2019 20:20:13 -0500</pubDate>
    <lastBuildDate>Thu, 24 Oct 2019 20:20:13 -0500</lastBuildDate>
    <generator>Jekyll v3.7.3</generator>

      <item>
        <title>Test Post</title>
        <description>
Lorem ipsum thor smash liege-bastogne-liege landbouwkrediet ombregt krabbe, rouleur derby is for lovers bonk giro gilbert bidon. Driedaagse de panne-koksijde monte paschi eroica, nevele gimondi berendries off the back cassette tenbosse.

Bahamontes lanterne rouge normandie belgium. Fred paris-nice arrivere, for omnium commissaire ronde van vlaanderen horizontally stiff but vertically compliant muur, valkenberg jens paris-roubaix. Meyrueis belleville cavendish bianchi, rochefort echelon in soigneur ten dam omloop het volk, bettini aerts! Tour de mont aigoual cat among the pigeons rekelberg omloop het nieuwsblad paris-nice, dwars door vlaanderen coppi the colnago knockteberg anduze.

Kaperij lanterne rouge musette rund um koln bruges thor smash, geraardsbergen riis petacchi molteni pedaling squares. Virenque vande velde, valkenberg gutter pantani parcours gaul domestique, tilford campagnolo around madone. Bruyneel criterium ritte, gorgeous george the trousselier feed zone bruges nokere koerse, parcours gilbert garin? Anquetil valkenberg bettini cat among the pigeons.

Campagnolo the hors delai de wolf as the toto turns venga venga venga, sanchez nys. Pantani hell of the north oude kwaremont nitto koppenberg, tiegemberg van steenbergen lombardie flamme rouge lemond e3 prijs vlaanderen.

Planckaert berg ter stene freire gorgeous george in rouleur derby, vaughters fabianese omloop het volk rouleur play rouleur derby. Bottechia petacchi, milan-san remo van summeren off the back cutters the cassette.

Nyvelocity pyrenees vande velde merckx. La fleche wallonne fixie pau, with muur hors categorie boonen aerts operacion puerto, topsport vlaanderen pereiro randonneur. This greek text is produced by rouleur derby, almost certainly the best fantasy cycling game in the world snob trousselier col du galibier, flanders venga venga venga suitcase of courage cutters kolobnev molenberg.

</description>

          <description>
Lorem ipsum thor smash liege-bastogne-liege landbouwkrediet ombregt krabbe, rouleur derby is for lovers bonk giro gilbert bidon. Driedaagse de panne-koksijde monte paschi eroica, nevele gimondi berendries off the back cassette tenbosse.

</description>

        <pubDate>Wed, 10 Dec 2014 00:00:00 -0600</pubDate>
        <link>http://localhost:4000/blog/test-post/</link>
        <guid isPermaLink="true">http://localhost:4000/blog/test-post/</guid>

      </item>

  </channel>
</rss>


text:
using shaderc_spvc::CompilationResult;
using shaderc_spvc::CompileOptions;
using shaderc_spvc::Compiler;

namespace {

TEST(Compile, Glsl) {
  Compiler compiler;
  CompileOptions options;
  options.SetSourceEnvironment(shaderc_target_env_webgpu,
                               shaderc_env_version_webgpu);
  options.SetTargetEnvironment(shaderc_target_env_vulkan,
                               shaderc_env_version_vulkan_1_1);

  CompilationResult result = compiler.CompileSpvToGlsl(
      kWebGPUShaderBinary, sizeof(kWebGPUShaderBinary) / sizeof(uint32_t),
      options);
  EXPECT_EQ(shaderc_compilation_status_success, result.GetCompilationStatus());
  EXPECT_NE(0, result.GetOutput().size());
}

TEST(Compile, Hlsl) {
  Compiler compiler;
  CompileOptions options;
  options.SetSourceEnvironment(shaderc_target_env_webgpu,
                               shaderc_env_version_webgpu);
  options.SetTargetEnvironment(shaderc_target_env_vulkan,
                               shaderc_env_version_vulkan_1_1);

  CompilationResult result = compiler.CompileSpvToHlsl(
      kWebGPUShaderBinary, sizeof(kWebGPUShaderBinary) / sizeof(uint32_t),
      options);
  EXPECT_EQ(shaderc_compilation_status_success, result.GetCompilationStatus());
  EXPECT_NE(0, result.GetOutput().size());
}

TEST(Compile, Msl) {
  Compiler compiler;
  CompileOptions options;
  options.SetSourceEnvironment(shaderc_target_env_webgpu,
                               shaderc_env_version_webgpu);
  options.SetTargetEnvironment(shaderc_target_env_vulkan,
                               shaderc_env_version_vulkan_1_1);

  CompilationResult result = compiler.CompileSpvToMsl(
      kWebGPUShaderBinary, sizeof(kWebGPUShaderBinary) / sizeof(uint32_t),
      options);
  EXPECT_EQ(shaderc_compilation_status_success, result.GetCompilationStatus());
  EXPECT_NE(0, result.GetOutput().size());
}

}  // anonymous namespace


text:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import {
  fetchPosts, removePost, upVotePost, downVotePost, fetchPostComments, fetchCategories
} from '../../actions';
import { PostList, SideNav } from '../../components';

class Home extends Component {
  componentDidMount() {
    this.props.fetchPosts().then(data => {
      data && data.payload && data.payload.map(post => this.props.fetchPostComments(post.id));
    });
    this.props.fetchCategories();
  }

  render() {
    const { posts, categories, removePost, upVotePost, downVotePost } = this.props;
    const links = categories ? categories.map(category => {
      return { url: `/${category.path}`, name: category.name };
    }) : [];
    return (
      <div>
        <PostList posts={posts} onDeletePost={removePost} onUpVote={upVotePost} onDownVote={downVotePost}/>
        <SideNav links={links} />
      </div>
    );
  }
}
Home.propTypes = {
  fetchPosts: PropTypes.func,
  removePost: PropTypes.func,
  upVotePost: PropTypes.func,
  downVotePost: PropTypes.func,
  fetchPostComments: PropTypes.func,
  fetchCategories: PropTypes.func,
};

function mapStateToProps(state) {
  const { posts, categories } = state;
  return {
    posts,
    categories,
  };
}
export default connect(mapStateToProps, {
  fetchPosts,
  removePost,
  upVotePost,
  downVotePost,
  fetchPostComments,
  fetchCategories,
})(Home);


text:
package org.testmonkeys.jentitytest.comparison;

import org.testmonkeys.jentitytest.comparison.result.ConditionalCheckResult;

public interface PreComparisonCheck {

    ConditionalCheckResult runCheck(Object actual, Object expected, ComparisonContext context);
}


text:
/**
 * Performs the `closest()` scan through context nodes to find the one that
 * matches the predicate with an optional argument.
 *
 * @param {!./node.ContextNode} startNode
 * @param {function(!./node.ContextNode, T):boolean} predicate
 * @param {T=} arg
 * @param {boolean=} includeSelf
 * @return {?./node.ContextNode}
 * @template T
 */
export function findParent(
  startNode,
  predicate,
  arg = undefined,
  includeSelf = true
) {
  for (let n = includeSelf ? startNode : startNode.parent; n; n = n.parent) {
    if (predicate(n, arg)) {
      return n;
    }
  }
  return null;
}

/**
 * Performs the deep scan through context nodes and calls the specified
 * callback with the optional argument. A node can stop the deep scan into its
 * subtree by returning a falsy result. Otherwise, the subtree will be scanned
 * and the result value will be passed to the children callbacks.
 *
 * @param {!./node.ContextNode} startNode
 * @param {function(!./node.ContextNode, T, S):S} callback
 * @param {T=} arg
 * @param {S=} state
 * @param {boolean=} includeSelf
 * @template T
 * @template S
 */
export function deepScan(
  startNode,
  callback,
  arg = undefined,
  state = true,
  includeSelf = true
) {
  if (includeSelf) {
    const newState = callback(startNode, arg, state);
    if (newState) {
      deepScan(startNode, callback, arg, newState, false);
    }
  } else if (startNode.children) {
    for (const node of startNode.children) {
      deepScan(node, callback, arg, state, true);
    }
  }
}


text:
<title>mars 3.0.23: dynaform(n) -- Dynamic Form Specification, submodule of marsutil(n)</title>

 mars 3.0.23: Mars Simulation Support Library

NAME

dynaform(n) -- Dynamic Form Specification, submodule of marsutil(n)

NAME

SYNOPSIS

DESCRIPTION

Form Specification Script

Application Resources

Layout Algorithm

Custom Field Types

COMMANDS

ENVIRONMENT

AUTHOR

HISTORY

SYNOPSIS

package require marsutil 3.0.23
namespace import ::marsutil::*

fieldType field ?options...?

    -context flag

    -defvalue value

    -invisible flag

    -loadcmd command

    -tip text

br

c ?label? ?options...?

    -for field

    -span n

    -width width

case case label script

cc label ?options...?

    -for field

    -span n

    -width width

check field ?options...?

    -text text

    -image image

color field ?options...?

dbkey field ?options...?

    -table table

    -keys keys

    -dispcols names

    -widths widths

    -labels strings

dbmulti field ?options...?

    -table table

    -key key

disp field ?options...?

    -textcmd cmd

    -width columns

enum field ?options...?

    -list values

    -listcmd command

enumlong field ?options...?

    -dict dict

    -dictcmd command

    -showkeys flag

enumlist field ?options...?

    -list values

    -listcmd command

    -width columns

    -height rows

    -stripe flag

enumlonglist field ?options...?

    -dict dict

    -dictcmd command

    -width columns

    -height rows

    -stripe flag

    -showkeys flag

file field ?options...?

    -width columns

    -title string

    -filetypes list

key field ?options...?

    -db db

    -table table

    -keys keys

    -dispcols names

    -widths widths

    -labels strings

label text ?-for field?

layout algorithm ?option value...?

    -shrink flag

    -height height

    -width width

multi field ?options...?

    -db db

    -table table

    -key key

para

range field ?options...?

    -datatype object

    -changemode mode

    -min value

    -max value

    -scalelength pixels

    -resetvalue value

    -resolution value

    -showreset flag

    -showsymbols flag

rc ?label? ?options...?

    -for field

    -span n

    -width width

rcc label ?options...?

    -for field

    -span n

    -width width

resources name ?name...?

selector field ?options...? selscript

    -listcmd command

text field ?options...?

    -width columns

when expr tscript ?else fscript?

ncolumn

2column

ribbon

dynaform allitems ftype

dynaform cases ftype field vdict

dynaform context ftype

dynaform define ftype fscript

dynaform dump ftype

dynaform fields ftype

dynaform fieldtype define name body

dynaform fieldtype alias name fieldtype ?options...

dynaform item id ?attr?

dynaform layout ftype

dynaform resources ftype

dynaform topitems ftype

dynaform types

DESCRIPTION

The dynaform(n) module is used to specify the content and behavior
of data entry forms with signficant dynamic behavior.  dynaform(n) forms
are displayed in the GUI using the dynaview(n) widget.  This
man page explains how to define a dynaform(n) form, how to query the
existing forms, and how to define new field types.

Form Specification Script

A form specification script defines the "items" that make up the
form.  There are three kinds of item: fields, hints, and selectors.
Field items define fields into which the user can enter data, or,
more rarely, data that provides context to the user and the rest of
the form.  Hint items add text and affect how the form appears to the
user, depending on the chosen Layout Algorithm.  Selector
items determine which items are visible to the user at any given
time.

Consider a plot widget which can plot many different
variables; each variable is subscripted by different indices.  The
user can select the variable using a selector item, which
will then make the relevant subscript fields visible.

marsutil(n) defines a number of standard field types; it
also possible to define Custom Field Types.

The following commands can appear in the specification script:

fieldType field ?options...?

Defines a field with name field of type fieldType with
the given options.  Different field types have their own
type-specific options; however, all accept the following options:

-context flag

If flag is true, the field will be a read-only context field.
A context field is one that should be set by the application before
the form is displayed; it determines the context for the data being
edited.  Context fields cannot be edited by the user; and in
addition, clearing the form should not clear the context fields.

-defvalue value

Specifies a default value for the field.  When the form is cleared,
this value will be placed in the field.

-invisible flag

If flag is true, the field will be invisible, that is, it will
not be displayed to the user.  This is sometimes useful for context
fields, e.g., a field used in an enum field's
-listcmd.  By default, fields are visible.

-loadcmd command

Specifies a Tcl command that will be called when the field's value
changes.  It will called with two additional arguments: the field's
item definition dictionary and its current value.  The command should
return a dictionary of field names and values to be loaded into the
form.  For example, a key field might use a -loadcmd
to load a database entity's attributes into the form when the key
changes.

The command may reference upstream field values by name, as well
as the entity_ variable (if defined).

Note: It is OK if the returned dictionary contains keys
that don't match any field in the form; they will simply be
ignored.

-tip text

Specifies tool-tip text for the field.  How this text is used depends
on the layout algorithm.

br

For ncolumn layouts, inserts a line break into the form.

c ?label? ?options...?

For ncolumn layouts, begins a new column.  If label is
given, it will be placed first in the column.  The command takes the
following options:

-for field

Associates the label with the named field, just as for
label.

-span n

This column's content will span n columns in the table
layout.  The default, naturally, is one column.

-width width

This column will be given the specified width, which is
specified in HTML length units, e.g., "3in" or
"100pxi".

case case label script

This command is used in selector scripts to define a
selector case.  The case is called case; the label is a
human-readable string used in the selector pulldown.  The
script is a script of form specification items that will be
visible when this case is selected.  Note that the case is
not a subform with its own layout; when the form is layed out,
all selected items are layed out together.

cc label ?options...?

For ncolumn layouts, begins two new columns on the current
row.  The label is placed in the first of the two columns;
subsequent items will appear in the second of the two columns.

The command takes the following options:

-for field

Associates the label with the named field, just as for
label.

-span n

The second new column's content will span n columns in the table
layout.  The default, naturally, is one column.

-width width

The second new column will be given the specified width, which is
specified in HTML length units, e.g., "3in" or
"100px".

check field ?options...?

Defines a checkbutton field, i.e., a field for editing boolean flags.
In addition to the standard field options,
the field type defines the following:

-text text

Specifies the text to display as the checkbutton label.

-image image

Specifies the Tk image to display as the checkbutton label.

color field ?options...?

Defines a color field, based on the colorfield(n) widget.
There are no field-type-specific options.

dbkey field ?options...?

Defines a field for selecting a key value from a database table,
i.e., a keyfield(n) widget.  The field displays a labeled
pulldown for each key column.

This field type depends on an
application resource called
"db_", whose value must be the relevant SQLite3 database handle
(or the equivalent).

In addition to the standard field options, the field type defines
the following:

-table table

Specifies the name of the table or view in the database.

-keys keys

Specifies a list of the names of the key column or columns in the table.

-dispcols names

Specifies the names of columns whose values are to be displayed in
place of the -keys columns in the pulldowns. The values
in the -dispcols columns need to be paired one-to-one
with the matching values in the -keys columns.

This is usually used when the -table's key is a bare
integer. The -table can be a view that provides a
human-readable version of the key as a parallel column. The GUI then
uses the human-readable text, while the underlying order uses the
integer key.

-widths widths

Specifies a list of widths, in characters of the current font, for
each key column.  The widths will determine the approximate width of
each pulldown.

-labels strings

Specifies a list of label strings, one for each key column.  If a
column's label string is not the empty string, it will appear to the
left of the column's pulldown.

This design allows each invocation of the dynaform to serve a
different database.

dbmulti field ?options...?

Defines a context field containing multiple table keys for a given
database and table.  The field (a multifield(n) widget) displays
the number of selected items.  The field type defines the following
additional options:

-table table

Specifies the name of the table or view in the database.

-key key

Specifies a list of the name of the key column.  It is assumed that
the table has a single key column; however, this can be simulated using
a view that concatenates the values of the key columns in some
way.

The field itself makes no use of these options; they are provided for
use by the field's -loadcmd.

disp field ?options...?

Defines a field for displaying an arbitrary, read-only text string.
(i.e., a dispfield(n) widget).  This is useful for
displaying ancillary data to the user that the user is not allowed to
edit.  The field type defines the following additional options:

-textcmd cmd

Specifies a command to be called to retrieve the field's value
for display.  The command may contain references to the values of
any upstream fields.  The return value is placed in the field.

This option is useful for translating numeric object IDs and other
opaque references into human-readable values.  The true ID goes in
an upstream field (and is quite possibly invisible); this one takes
the true ID and produces the value for display.

-width columns

Specifies the width of the field in characters of the current
font.

enum field ?options...?

Defines an enumeration field, i.e., a pull-down menu for a specific
set of values.  In addition to the standard field options,
the field type defines the following:

-list values

Specifies the list of values to display in the pull-down.

-listcmd command

Specifies a command to call to retrieve the list of values.  This
option overrides -list.  The command may contain
references to the values of upstream fields.  For example:

    enum a -listcmd {::actor names}
    enum g -listcmd {::ownedgroups $a}

The first field allows the user to select the name of an actor; the
second allows the user to select the name of a group owned by the
selected actor.

enumlong field ?options...?

Defines an enumeration field, i.e., a pull-down menu for a specific
set of values.  An enumlong is like an enum, but it
is configured with a dictionary of short name/long name pairs instead
of a simple list.  It displays the long names in the pull-down, but
returns a short name as its value.  In addition to the standard field
options, the field type defines the following:

-dict dict

Specifies the dictionary of short names and long names.

-dictcmd command

Specifies a command to call to retrieve the short name/long name
dictionary.  This option overrides -dict.  The command may contain
references to the values of upstream fields; see enum for an
example of the syntax.

-showkeys flag

If true, the widget will display both short names and long names,
e.g., "short: long".  If false (the default) it will display only the
long names.

enumlist field ?options...?

Defines a field for selecting multiple items from an enumerated list
(i.e., a listfield(n) widget). In addition to the standard
field options, the field type defines the following:

-list values

Specifies the list of values from which the user can choose.

-listcmd command

Specifies a command to call to retrieve the list of values from
which the user can choose.  This
option overrides -list.  The command may contain
references to the values of upstream fields.  For example:

    enum     a     -listcmd {::actor names}
    enumlist glist -listcmd {::ownedgroups $a}

The first field allows the user to select the name of an actor; the
second allows the user to select the names of one or more groups owned
by the selected actor.

-width columns

This field displays two side-by-side list boxes, with buttons in between.
Both list boxes will have this width in terms of the average-sized
character of the current font.  Long items will wrap.

-height rows

Specifies the number of visible items in the selection lists.
Defaults to 5.

-stripe flag

If true (the default), then even-numbered items in the
selection lists are displayed with a light green stripe.   If long
items wrap, this makes it easier to distinguish the items.

enumlonglist field ?options...?

Defines a field for selecting multiple items from an enumerated list
(i.e., a listfield(n) widget), where the valid choices are
specified as a short name/long name dictionary.  The user selects
from the long names, and the field's value is a list of the matching
short names.

In addition to the standard field options, the field type defines
the following:

-dict dict

Specifies the dictionary of short name/long name values from which the user
can choose.

-dictcmd command

Specifies a command to call to retrieve the dictionary of
short name/long name values from which the user can choose.  This
option overrides -dict.  The command may contain
references to the values of upstream fields; see
enumlist for an example of the syntax.

-width columns

This field displays two side-by-side list boxes, with buttons in between.
Both list boxes will have this width in terms of the average-sized
character of the current font.  Long items will wrap.

-height rows

Specifies the number of visible items in the selection lists.
Defaults to 5.

-stripe flag

If true (the default), then even-numbered items in the
selection lists are displayed with a light green stripe.   If long
items wrap, this makes it easier to distinguish the items.

-showkeys flag

If true, the widget will display both short names and long names,
e.g., "short: long".  If false (the default) it will display only the
long names.

file field ?options...?

Defines a field for selecting a file from the disk
(i.e., a filefield(n) widget).  The field displays the selected
file name as a read-only string, and includes a "Browse" button for
selecting a different file.  The field type defines the following
additional options:

-width columns

Specifies the width of the field in characters of the current
font.

-title string

Specifies the title string for the file selection dialog.  Defaults
to "Select File".

-filetypes list

Specifies the acceptable file type or types, in the same form as
for tk_getOpenFile.  Defaults to any kind of file.

key field ?options...?

Defines a field for selecting a key value from a database table,
i.e., a keyfield(n) widget.  The field displays a labeled
pulldown for each key column.  In addition to the standard
field options, the field type defines the following:

-db db

Specifies the name of an sqldocument(n) or the equivalent
containing the relevant table.

-table table

Specifies the name of the table or view in the database.

-keys keys

Specifies a list of the names of the key column or columns in the table.

-dispcols names

Specifies the names of columns whose values are to be displayed in
place of the -keys columns in the pulldowns. The values
in the -dispcols columns need to be paired one-to-one
with the matching values in the -keys columns.

This is usually used when the -table's key is a bare
integer. The -table can be a view that provides a
human-readable version of the key as a parallel column. The GUI then
uses the human-readable text, while the underlying order uses the
integer key.

-widths widths

Specifies a list of widths, in characters of the current font, for
each key column.  The widths will determine the approximate width of
each pulldown.

-labels strings

Specifies a list of label strings, one for each key column.  If a
column's label string is not the empty string, it will appear to the
left of the column's pulldown.

This design allows different dynaforms to access databases via
different handles.  If it is certain that the application will only
use one database handle, the application can define an alias like
this:

    dynaform fieldtype alias key key -db ::rdb

All key fields will then use the same database handle.

label text ?-for field?

For those layout algorithms that use labels (ncolumn and
ribbon), specifies some text to display to the user.
If a field name is given, the label will be associated with
that field; if the application marks the field's value invalid, the
label will be displayed in a way that reflects this.

When the -for option is used (either here or in the
commands that define labels) for the 2column and ncolumn
layout algorithms, the label text is escaped with
&nbsp; so that the text is rendered all on one line.

layout algorithm ?option value...?

Names the Layout Algorithm for this form type.  Defaults
to ncolumn.

This command can appear anywhere in the form; conventionally, if it
appears it is the first command in the specification script.

The command can also set the following options affecting the layout
and size of the form:

-shrink flag

Defaults to true.  By default, then, the form will have the smallest
size that will contain the currently displayed content.  This is a problem
for particularly dynamic forms; thus, the form can choose to set flag
to false, and set the default width and height explicitly.

-height height

-width width

Sets the default width and height of the form in pixels.  The form will be
this size unless the content is larger, in which case it will expand to fit
(at the cost of a visible jump).  These options are ignored if
-shrink is true.

multi field ?options...?

Defines a context field containing multiple table keys for a given
database and table.  The field (a multifield(n) widget) displays
the number of selected items.  The field type defines the following
additional options:

-db db

Specifies the name of an sqldocument(n) or the equivalent
containing the relevant table.

-table table

Specifies the name of the table or view in the database.

-key key

Specifies a list of the name of the key column.  It is assumed that
the table has a single key column; however, this can simulated using
a view that concatenates the values of the key columns in some
way.

para

For ncolumn layouts, inserts a paragraph break into the form.

range field ?options...?

Defines a field for selecting a number from a range using a slider
(i.e., a rangefield(n) widget).  The field type defines the
following additional options, all of which are defined in the
rangefield(n) man page:

-datatype object

This option is equivalent to the rangefield(n)
-type option.

-changemode mode

-min value

-max value

-scalelength pixels

-resetvalue value

-resolution value

-showreset flag

-showsymbols flag

These options are defined just as for rangefield(n).

rc ?label? ?options...?

For ncolumn layouts, begins a new row and column.  If label is
given, it will be placed first in the column.  The command takes the
following options:

-for field

Associates the label with the named field, just as for
label.

-span n

This column's content will span n columns in the table
layout.  The default, naturally, is one column.

-width width

The column will be given the specified width, which is
specified in HTML length units, e.g., "3in" or
"100px".

rcc label ?options...?

For ncolumn layouts, begins a new row with two new columns.
The label is placed in the first of the two columns;
subsequent items will appear in the second of the two columns.

The command takes the following options:

-for field

Associates the label with the named field, just as for
label.

-span n

The second new column's content will span n columns in the table
layout.  The default, naturally, is one column.

-width width

The second new column will be given the specified width, which is
specified in HTML length units, e.g., "3in" or
"100px".

resources name ?name...?

Specifies the name(s) of Application Resources required by a
specific instance of the form at run time.  Resource values are provided
to the dynaview(n) widget when it is created, and it in turn makes
them available to the form's callback commands.  In particular,
field callback commands may refer to resource values by name, just
as they may refer to upstream fields by name.  For example, a
-loadcmd might refer to the relevant order object as "$order_".

Resource names conventionally have a trailing underscore so that
they won't collide with parameter names, e.g., "db_",
"order_".

selector field ?options...? selscript

Defines a selector.  A selector is a field-like item that controls
the items displayed in the form.  The selector script,
selscript, defines a number of cases; each case can contain
zero or more items.  The selector displays a pulldown with a list of
the cases; when the user selects a case, the relevant items are
displayed.  As a field, the selector item's value is the selected
case.

The selector command takes all of the standard field
options, and also the following:

-listcmd command

The selscript defines all of the theoretically possible cases;
however, which cases can actually be selected might depend on
context, e.g., different activities might be assignable to different
groups.  The dynaform can be written for all group types, and the
list of cases to display can be determined by this command.

As with the enum item's -listcmd, the
command may reference upstream fields, thus providing the
necessary context.

text field ?options...?

Defines a field for entering an arbitrary text string.
(i.e., a textfield(n) widget).  The field type defines the
following additional option:

-width columns

Specifies the width of the field in characters of the current
font.

when expr tscript ?else fscript?

This command is like a selector in that it controls the
items that will be displayed; however, it is not a field.  Instead,
expr is a boolean expression which can reference upstream
fields by name.  If the expression is true, the items defined by
tscript will be visible; if not, the items defined by
fscript (if any) will be visible.

For example, suppose field b should be visible only if
field a has a non-empty value:

    text a
    when {$a ne ""} {
        text b
    }

Application Resources

As noted above, the various field callback commands (e.g., -loadcmd,
-listcmd, and so forth) can refer to "upstream" field values. In
addition, they can also refer to "application resources": named values
provided by the application when the form is invoked.  Certain field
types, notably dbkey, also require application resources.

For example, a particular field's -loadcmd might need to access
a database.  We can't hardcode the database handle into the -loadcmd
without limiting the form to being used with only that one database.
Instead, we define an application resource, "db_", whose
value must be set to the required database handle.  The form's field
callbacks can than refer freely to "$db_".

A dynaform(n) is displayed in a dynaview(n) widget; and the
application must provide the form's resource values to the
dynaview(n) widget via its -resources option.  If there's
a mismatch between the given and required resources, the widget will
throw an error.

Layout Algorithm

Each dynaform is associated with a specific layout algorithm; this
algorithm, specified using the layout command, determines how
the form's items are displayed to the user.  At present, there are
three supported algorithms:

ncolumn

Default Layout: This layout is intended to emulate the classic
form(n) two-column layout, with extensions to allow more
complex table-based forms.  Use the label item to label
fields, and the c, cc, rc, and
rcc items to control the layout.  Fields can define tool
tips using the -tip option.

2column

This layout is intended to emulate the classic form(n)
two-column layout with minimal changes.  Each field widget appears on
its own row, labeled by its -tip text.  "Hint" items
(e.g., label) are ignored.

ribbon

This layout puts all fields and labels on one line, which can wrap to
subsequent lines if necessary.  Of the "Hint" items, only
label is used.  Fields can define tool tips using the
-tip option.

Custom Field Types

There are two ways to define new field types for use with dynaform(n)
and dynaview(n).  The simpler of the two is define a
fieldtype alias; this is useful when you find that you are using
the same field type with the same options over and over again.

To create a new field type based on a new field(i) widget,
use fieldtype define.  See dynaform_field(i) for
details.

COMMANDS

This module defines the following commands.  The define and
fieldtype define commands are for use by the application;
the remainder are primarily for use by dynaview(n).

dynaform allitems ftype

Returns a list of the IDs of all items defined by the named form
type, in order of definition.

dynaform cases ftype field vdict

Returns the symbolic names of the cases associated with form
ftype's selector field field given the context
provided by the value dictionary vdict.  This command is
provided to make it easy for clients (e.g., orders) to validate the
value of selector fields.

dynaform context ftype

Returns a list of the names of any context fields for the named
form type.

dynaform define ftype fscript

Defines a new form type called ftype (or redefines an existing
one).  The form type is defined by a
Form Specification Script.

dynaform dump ftype

Dumps a pretty-printed item tree, in outline form, for the named
form type.  This command is primarily useful for debugging
dynaform(n) itself.

dynaform fields ftype

Returns a list of the names of the fields contained in the named form
type.  Note that field items on different branches of the tree can
have the same name; however, the name will only appear once in the
output.

dynaform fieldtype define name body

Defines a new field type called name for use in form
specification scripts.  The name will become a command in the
form specification language, parallel to the existing field commands.
The body is a snit::type definition body matching the
dynaform_fieldtype(i) interface.

dynaform fieldtype alias name fieldtype ?options...

Defines a new field type command, name, as an alias to an
existing fieldtype.  The options can include any of the
options provided by the fieldtype.  Once aliased, the
name can be used a field command in form specification
scripts.  For example, the following defines a new enumeration
type called "character":

    dynaform fieldtype alias character enumlong -dict {
        good "The Good"
        bad  "The Bad"
        ugly "The Ugly"
    }

You may not create an alias to an alias.

dynaform item id ?attr?

Given a dynaform item ID and an item attribute name, returns the
value of the attribute.  If the attribute name is omitted, returns
the entire item definition dictionary.

dynaform layout ftype

Returns the name of the layout algorithm for the named form
type.

dynaform resources ftype

Returns the names of the Application Resources required by
this form.  The returned list will include all resources
explicitly declared in the form specification using the
resources command along with all resources implicitly
required by the field types used in the specification.

dynaform topitems ftype

Because of selectors, the items in a form are arranged in a
tree.  This command returns a list of the IDs of all items defined at
the toplevel of the form's tree, in order of definition.

dynaform types

Returns a list of names of the defined form types.

ENVIRONMENT

marsutil(n) requires Tcl 8.5 or later.

To use marsutil(n) in a Tcl script, the environment variable
TCLLIBPATH must include the parent of the package
directory.

AUTHOR

Will Duquette

HISTORY

Original package.

mars 3.0.23 Man page generated by manpage(n) on
Fri Nov 20 09:53:50 PST 2015


text:
favorite:5 / forked:2

Ground.as
Display a 3d ground surface and pillars.

![thumbnail](./thumbnail.jpg)


text:
var assert = require('assert'),
    math = require('../../../index.js'),
    approx = require('../../../tools/approx.js'),
    multiply = math.multiply,
    divide = math.divide,
    matrix = math.matrix,
    complex = math.complex,
    range = math.range,
    i = math.i,
    unit = math.unit;

describe('multiply', function() {

  it('should multiply two numbers correctly', function() {
    approx.equal(multiply(2, 3), 6);
    approx.equal(multiply(-2, 3), -6);
    approx.equal(multiply(-2, -3), 6);
    approx.equal(multiply(5, 0), 0);
    approx.equal(multiply(0, 5), 0);
    approx.deepEqual(multiply(0, Infinity), NaN);
    approx.deepEqual(multiply(2, Infinity), Infinity);
    approx.deepEqual(multiply(-2, Infinity), -Infinity);
  });

  it('should multiply booleans', function() {
    assert.equal(multiply(true, true), 1);
    assert.equal(multiply(true, false), 0);
    assert.equal(multiply(false, true), 0);
    assert.equal(multiply(false, false), 0);
  });

  it('should multiply mixed numbers and booleans', function() {
    assert.equal(multiply(2, true), 2);
    assert.equal(multiply(2, false), 0);
    assert.equal(multiply(true, 2), 2);
    assert.equal(multiply(false, 2), 0);
  });

  it('should multiply two complex numbers correctly', function() {
    approx.deepEqual(multiply(complex(2, 3), 2), complex(4, 6));
    approx.deepEqual(multiply(complex(2, -3), -2), complex(-4, 6));
    approx.deepEqual(multiply(complex(2, -3), 2), complex(4, -6));
    approx.deepEqual(multiply(complex(-2, 3), 2), complex(-4, 6));
    approx.deepEqual(multiply(complex(-2, -3), 2), complex(-4, -6));
    approx.deepEqual(multiply(2, complex(2, 3)), complex(4, 6));
    approx.deepEqual(multiply(i, complex(2, 3)), complex(-3, 2));
    approx.deepEqual(multiply(complex(0, 1), complex(2, 3)), complex(-3, 2));
    approx.deepEqual(multiply(complex(1, 1), complex(2, 3)), complex(-1, 5));
    approx.deepEqual(multiply(complex(2, 3), complex(1, 1)), complex(-1, 5));
    approx.deepEqual(multiply(complex(2, 3), complex(2, 3)), complex(-5, 12));
    approx.deepEqual(divide(complex(-5, 12), complex(2, 3)), complex(2, 3));
    approx.deepEqual(multiply(complex(2, 3), 0), complex(0, 0));
    approx.deepEqual(multiply(complex(0, 3), complex(0, -4)), complex(12, 0));
    approx.deepEqual(multiply(multiply(3, i), multiply(-4, i)), complex(12, 0));
    approx.deepEqual(multiply(math.i, Infinity), complex(0, Infinity));
    approx.deepEqual(multiply(Infinity, math.i), complex(0, Infinity));

    approx.deepEqual(multiply(complex(2,0), complex(0,2)), complex(0, 4));
    approx.deepEqual(multiply(complex(0,2), complex(0,2)), -4);
    approx.deepEqual(multiply(complex(2,2), complex(0,2)), complex(-4, 4));
    approx.deepEqual(multiply(complex(2,0), complex(2,2)), complex(4, 4));
    approx.deepEqual(multiply(complex(0,2), complex(2,2)), complex(-4, 4));
    approx.deepEqual(multiply(complex(2,2), complex(2,2)), complex(0, 8));
    approx.deepEqual(multiply(complex(2,0), complex(2,0)), 4);
    approx.deepEqual(multiply(complex(0,2), complex(2,0)), complex(0, 4));
    approx.deepEqual(multiply(complex(2,2), complex(2,0)), complex(4, 4));

    approx.deepEqual(multiply(complex(2, 3), complex(4, 5)), complex(-7, 22));
    approx.deepEqual(multiply(complex(2, 3), complex(4, -5)), complex(23, 2));
    approx.deepEqual(multiply(complex(2, 3), complex(-4, 5)), complex(-23, -2));
    approx.deepEqual(multiply(complex(2, 3), complex(-4, -5)), complex(7, -22));
    approx.deepEqual(multiply(complex(2, -3), complex(4, 5)), complex(23, -2));
    approx.deepEqual(multiply(complex(2, -3), complex(4, -5)), complex(-7, -22));
    approx.deepEqual(multiply(complex(2, -3), complex(-4, 5)), complex(7, 22));
    approx.deepEqual(multiply(complex(2, -3), complex(-4, -5)), complex(-23, 2));
    approx.deepEqual(multiply(complex(-2, 3), complex(4, 5)), complex(-23, 2));
    approx.deepEqual(multiply(complex(-2, 3), complex(4, -5)), complex(7, 22));
    approx.deepEqual(multiply(complex(-2, 3), complex(-4, 5)), complex(-7, -22));
    approx.deepEqual(multiply(complex(-2, 3), complex(-4, -5)), complex(23, -2));
    approx.deepEqual(multiply(complex(-2, -3), complex(4, 5)), complex(7, -22));
    approx.deepEqual(multiply(complex(-2, -3), complex(4, -5)), complex(-23, -2));
    approx.deepEqual(multiply(complex(-2, -3), complex(-4, 5)), complex(23, 2));
    approx.deepEqual(multiply(complex(-2, -3), complex(-4, -5)), complex(-7, 22));
  });

  it('should multiply a number and a unit correctly', function() {
    assert.equal(multiply(2, unit('5 mm')).toString(), '10 mm');
    assert.equal(multiply(2, unit('5 mm')).toString(), '10 mm');
    assert.equal(multiply(unit('5 mm'), 2).toString(), '10 mm');
    assert.equal(multiply(unit('5 mm'), 0).toString(), '0 m');
  });

  it('should throw an error if used with strings', function() {
    assert.throws(function () {multiply("hello", "world")});
    assert.throws(function () {multiply("hello", 2)});
  });

  var a = matrix([[1,2],[3,4]]);
  var b = matrix([[5,6],[7,8]]);
  var c = matrix([[5],[6]]);
  var d = matrix([[5,6]]);

  it('should perform element-wise multiplication if multiplying a matrix and a number', function() {
    approx.deepEqual(multiply(a, 3), matrix([[3,6],[9,12]]));
    approx.deepEqual(multiply(3, a), matrix([[3,6],[9,12]]));
  });

  it('should perform matrix multiplication', function () {
    approx.deepEqual(multiply(a, b), matrix([[19,22],[43,50]]));
    approx.deepEqual(multiply(a, c), matrix([[17],[39]]));
    approx.deepEqual(multiply(d, a), matrix([[23,34]]));
    approx.deepEqual(multiply(d, b), matrix([[67,78]]));
    approx.deepEqual(multiply(d, c), matrix([[61]]));
    approx.deepEqual(multiply([[1,2],[3,4]], [[5,6],[7,8]]), [[19,22],[43,50]]);
    approx.deepEqual(multiply(range(1, 5), 2), [2, 4, 6, 8]);
  });

  it('should throw an error if multiplying matrices with incompatible sizes', function() {
    assert.throws(function () {multiply(c, b)});
  });

});


text:
using System;
using System.Collections.Generic;
using System.Text;

namespace OpenQA.Selenium
{
    /// <summary>
    /// Defines the interface through which the user can locate a given frame or window.
    /// </summary>
    public interface ITargetLocator
    {
        /// <summary>
        /// Select a frame by its (zero-based) index.
        /// </summary>
        /// <param name="frameIndex">The zero-based index of the frame to select.</param>
        /// <returns>An <see cref="IWebDriver"/> instance focused on the specified frame.</returns>
        /// <exception cref="NoSuchFrameException">If the frame cannot be found.</exception>
        /// <remarks>The <see cref="Frame(System.Int32)"/> method finds frames by numeric index,
        /// and the index is zero-based.That is, if a page has three frames, the first frame
        /// would be at index "0", the second at index "1" and the third at index "2". Once
        /// the frame has been selected, all subsequent calls on the IWebDriver interface are
        /// made to that frame.
        /// </remarks>
        IWebDriver Frame(int frameIndex);

        /// <summary>
        /// Select a frame by its name or ID.
        /// </summary>
        /// <param name="frameName">The name of the frame to select.</param>
        /// <returns>An <see cref="IWebDriver"/> instance focused on the specified frame.</returns>
        /// <exception cref="NoSuchFrameException">If the frame cannot be found.</exception>
        /// <remarks>The <see cref="Frame(System.String)"/> method selects a frame by its
        /// name or ID. To select sub-frames, simply separate the frame names/IDs by dots.
        /// As an example "main.child" will select the frame with the name "main" and then
        /// it's child "child". If a frame name is a number, then it will be treated as
        /// selecting a frame as if using <see cref="Frame(System.Int32)"/>.
        /// </remarks>
        IWebDriver Frame(string frameName);

        /// <summary>
        /// Switches the focus of future commands for this driver to the window with the given name.
        /// </summary>
        /// <param name="windowName">The name of the window to select.</param>
        /// <returns>An <see cref="IWebDriver"/> instance focused on the given window.</returns>
        /// <exception cref="NoSuchWindowException">If the window cannot be found.</exception>
        IWebDriver Window(string windowName);

        /// <summary>
        /// Selects either the first frame on the page or the main document when a page contains iframes.
        /// </summary>
        /// <returns>An <see cref="IWebDriver"/> instance focused on the default frame.</returns>
        IWebDriver DefaultContent();

        /// <summary>
        /// Switches to the element that currently has the focus, or the body element
        /// if no element with focus can be detected.
        /// </summary>
        /// <returns>An <see cref="IWebElement"/> instance representing the element
        /// with the focus, or the body element if no element with focus can be detected.</returns>
        IWebElement ActiveElement();
    }
}


text:
'use strict'

var minimist = require('minimist')
var bench = require('fastbench')
var pump = require('pump')
var net = require('net')
var childProcess = require('child_process')
var path = require('path')
var parallel = require('fastparallel')({
  results: false
})
var tentacoli = require('../')

var argv = minimist(process.argv.slice(2), {
  boolean: 'child',
  default: {
    child: true,
    port: 3000,
    host: 'localhost'
  }
})

function buildPingPong (cb) {
  var sender = tentacoli()
  var timer = setTimeout(function () {
    throw new Error('unable to start child')
  }, 1000)
  var child

  if (argv.child) {
    child = childProcess.fork(path.join(__dirname, 'tentacoli_echo.js'), {
      stdio: 'inherit'
    })

    child.on('message', start)

    child.on('error', cb)

    child.on('exit', console.log)
  } else {
    start(argv)
  }

  function start (addr) {
    var client = net.connect(addr.port, addr.host)

    client.on('connect', function () {
      cb(null, benchPingPong)
      clearTimeout(timer)
    })

    pump(client, sender, client)
  }

  var max = 1000
  var functions = new Array(max)

  for (var i = 0; i < max; i++) {
    functions[i] = sendEcho
  }

  function benchPingPong (cb) {
    parallel(null, functions, null, cb)
  }

  function sendEcho (cb) {
    sender.request({
      cmd: 'ping'
    }, function () {
      cb()
    })
  }
}

buildPingPong(function (err, benchPingPong) {
  if (err) throw err

  var run = bench([benchPingPong], 100)

  run(function (err) {
    if (err) throw err

    run(function (err) {
      if (err) throw err

      // close the sockets the bad way
      process.exit(0)
    })
  })
})


text:
package eleflow.uberdata.core.conf

import org.apache.spark.SparkConf

/**
  * Created by dirceu on 26/11/15.
  */
object UberdataEventConfig {

  def rootFolder() = {
    "///tmp/Uberdata/"
  }

  def buildPathName(sparkConf: SparkConf) = {
    val appId = sparkConf.getAppId
    val appName = sparkConf.get("spark.app.name")
    s"${buildPath(sparkConf)}/$appName/$appId-${System.currentTimeMillis()}"
  }

  def buildPath(sparkConf: SparkConf) = {
    val host = sparkConf.get("spark.driver.host")
    val customFolder =
      sparkConf.getOption("uberdata.event.folder").getOrElse("/tmp/")
    s"$customFolder/$host"
  }
}


text:
import os.path
from subprocess import PIPE, Popen
from ansible.module_utils.basic import *

DOCUMENTATION = '''
This module provides two functionalities:
1) when dir and optionally group, mode, owner parameters are provided it creates a directory in hdfs and
optionally sets permissions and ownership for it
2) when src, dst and optionally group, mode, owner parameters are provided it copies a file from local fs
to an existing directory in hdfs and optionally sets permissions and ownership for it
'''
EXAMPLES = '''
1) hdfs: dir=/user/oozie group=oozie mode=750 owner=oozie -> directory is created in hdfs and permissions
along with ownership are set
2) hdfs: src=/etc/service.conf dst=/user/oozie/service.conf group=oozie mode=640 owner=oozie -> file
is copied from local filesystem to an existing dirextory in hdfs and permissions along with ownership are set
'''

MODULE_ARGUMENTS = {
    'dir': {'type': 'str'},
    'owner': {'type': 'str'},
    'group': {'type': 'str'},
    'mode': {'type': 'str'},
    'src': {'type': 'str'},
    'dst': {'type': 'str'}
}

def execute(cmd):
  proc = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
  out, err = proc.communicate()
  proc.wait()
  if proc.returncode == 0:
    err = None
  return out, err

def executehdfs(cmd):
  return execute('sudo -u hdfs hdfs dfs -' + cmd)

def hdfs_create_directory(module, directory, owner=None, group=None, mode=None):
  """Creates a directory in hdfs and optionally sets ownership and permissions for it"""
  changed = False
  dir_handler = [a for a in directory.split('/') if a != '']
  if len(dir_handler) < 2:
    curr_path = '/'
  else:
    curr_path = '/' + '/'.join(dir_handler[0:-1])
  if curr_path[-1] != '/':
    curr_path += '/'
  current_dir = dir_handler[-1]

  std_o, err_o = executehdfs('ls hdfs:{0} | grep {0}{1}'.format(curr_path, current_dir))
  if std_o == '' or std_o is None:
    std_o, err_o = executehdfs('mkdir {0}{1}'.format(curr_path, current_dir))
    if err_o is not None and err_o != '':
      module.fail_json(msg='Error when creating {0}{1} file. Error: {2}'.format(curr_path, current_dir, err_o))
    changed = True

  std_o, err_o = executehdfs('ls hdfs:{0} | grep "{0}{1}$"'.format(curr_path, current_dir))
  if std_o[0] != 'd':
    module.fail_json(msg='File {0}{1} is not directory'.format(curr_path, current_dir))

  state_data = [a for a in std_o.split(' ') if a != '']

  privileges = ''
  for i in range(0, 3):
    privileges_tmp = 0
    tmp = 4
    for j in range(0, 3):
      if std_o[1 + i * 3 + j] != '-':
        privileges_tmp += tmp
      tmp /= 2
    privileges += str(privileges_tmp)

  if privileges != mode and mode is not None:
    std_o, err_o = executehdfs('chmod {0} hdfs:{1}{2}'.format(mode, curr_path, current_dir))
    if err_o != '' and err_o is not None:
      module.fail_json(msg='Folder {0}{1} chmod error. Error: {2}'.format(curr_path, current_dir, err_o))
    changed = True

  if (owner != state_data[2] and owner is not None) or (group != state_data[3] and group is not None):
    if owner is None:
      owner = state_data[2]
    if group is None:
      group = state_data[3]
    std_o, err_o = executehdfs('chown {0}:{1} hdfs:{2}{3}'.format(owner, group, curr_path, current_dir))
    if err_o != '' and err_o is not None:
      module.fail_json(msg='Folder {0}{1} chown error. Error: {2}'.format(curr_path, current_dir, err_o))
    changed = True

  return changed

def hdfs_put_file(module, source, destination, owner=None, group=None, mode=None):
  """Puts a local file to an existing directory in hdfs and optionally sets ownership and permissions for it"""
  changed = False
  put_needed = False
  if not os.path.isfile(source):
    module.fail_json(msg='Local file {0} does not exist'.format(source))
  std_o, err_o = executehdfs('ls hdfs://{0}'.format(destination))
  if err_o is not None:
    put_needed = True
  elif err_o is None:
    std_o_2, err_o_2 = executehdfs('du hdfs://{0}'.format(destination))
    if err_o_2 != '' and err_o_2 is not None:
      module.fail_json(msg='File hdfs://{0} du error. Error: {1}'.format(destination, err_o_2))
    du_size_hdfs = int(std_o_2.split(' ')[0])
    du_size_local = os.path.getsize(source)
    if du_size_hdfs != du_size_local:
      put_needed = True
      std_o_2, err_o_2 = executehdfs('rm hdfs://{0}'.format(destination))
  elif err_o != '':
    module.fail_json(msg='File hdfs://{0} ls file. Error: {1}'.format(destination, err_o))

  if put_needed:
    std_o, err_o = executehdfs('put {0} hdfs://{1}'.format(source, destination))
    if err_o != '' and err_o is not None:
      module.fail_json(msg='Put of local {0} to hdfs://{1} error. Error: {2}'.format(source, destination, err_o))
    changed = True

  if owner is not None or group is not None or mode is not None:
    std_o, err_o = executehdfs('ls hdfs://{0}'.format(destination))
    if err_o is not None and err_o != '':
      module.fail_json(msg='File hdfs://{0} ls file. Error: {1}'.format(destination, err_o))
    ls_data = std_o
    state_data = [a for a in std_o.split(' ') if a != '']

    if (owner != state_data[2] and owner is not None) or (group != state_data[3] and group is not None):
      if owner is None:
        owner = state_data[2]
      if group is None:
        group = state_data[3]
      std_o, err_o = executehdfs('chown {0}:{1} hdfs://{2}'.format(owner, group, destination))
      if err_o != '' and err_o is not None:
        module.fail_json(msg='File hdfs://{0} chown error. Error: {1}'.format(destination, err_o))
      changed = True

    if mode is not None:
      privileges = ''
      for i in range(0, 3):
        privileges_tmp = 0
        tmp = 4
        for j in range(0, 3):
          if ls_data[1 + i * 3 + j] != '-':
            privileges_tmp += tmp
          tmp /= 2
        privileges += str(privileges_tmp)

      if privileges != mode:
        std_o, err_o = executehdfs('chmod {0} hdfs://{1}'.format(mode, destination))
        if err_o != '' and err_o is not None:
          module.fail_json(msg='Fle hdfs://{0} chmod error. Error: {1}'.format(destination, err_o))
        changed = True

  return changed

def main():
  module = AnsibleModule(argument_spec=MODULE_ARGUMENTS)

  changed = False
  dir_a = module.params.get('dir', None)
  owner_a = module.params.get('owner', None)
  group_a = module.params.get('group', None)
  mode_a = module.params.get('mode', None)
  src_a = module.params.get('src', None)
  dst_a = module.params.get('dst', None)

  if dir_a is not None:
    changed = hdfs_create_directory(module, dir_a, owner_a, group_a, mode_a)
  elif src_a is not None and dst_a is not None:
    changed = hdfs_put_file(module, src_a, dst_a, owner_a, group_a, mode_a)
  else:
    module.fail_json(msg='At least dir or src/dst parameters should be set for module')

  module.exit_json(changed=changed, msg='Everything is done')

main()


text:
@charset "UTF-8";
/*****************************************************************************/
/*
/* Tufte Jekyll blog theme
/* Based on Tufte CSS by Dave Liepmann ( https://github.com/edwardtufte/tufte-css )
/*
/* The README.md will show you how to set up your site along with other goodies
/*****************************************************************************/
@font-face {
  font-family: ETbook;
  src: url("../fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot");
  src: url("../fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot?#iefix") format("embedded-opentype"), url("../fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff") format("woff"), url("../fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.ttf") format("truetype"), url("../fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.svg#etbemboromanosf") format("svg");
  font-weight: normal;
  font-style: normal; }
@font-face {
  font-family: ETbook;
  src: url("../fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot");
  src: url("../fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot?#iefix") format("embedded-opentype"), url("../fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff") format("woff"), url("../fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.ttf") format("truetype"), url("../fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.svg#etbemboromanosf") format("svg");
  font-weight: normal;
  font-style: italic; }
@font-face {
  font-family: ETbook;
  src: url("../fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot");
  src: url("../fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot?#iefix") format("embedded-opentype"), url("../fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff") format("woff"), url("../fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.ttf") format("truetype"), url("../fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.svg#etbemboromanosf") format("svg");
  font-weight: bold;
  font-style: normal; }
@font-face {
  font-family: ETbookRomanOldStyle;
  src: url("../fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot");
  src: url("../fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.eot?#iefix") format("embedded-opentype"), url("../fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.woff") format("woff"), url("../fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.ttf") format("truetype"), url("../fonts/et-book/et-book-roman-old-style-figures/et-book-roman-old-style-figures.svg#etbemboromanosf") format("svg");
  font-weight: normal;
  font-style: normal; }
/* This file contains all the constants for colors and font styles */
/**
 * Syntax highlighting styles
 */
.highlight {
  margin-bottom: 15px; }

.highlight {
  background: #fffff8; }
  .highlight .c {
    color: #998;
    font-style: italic; }
  .highlight .err {
    color: #a61717;
    background-color: #e3d2d2; }
  .highlight .k {
    font-weight: bold; }
  .highlight .o {
    font-weight: bold; }
  .highlight .cm {
    color: #998;
    font-style: italic; }
  .highlight .cp {
    color: #999;
    font-weight: bold; }
  .highlight .c1 {
    color: #998;
    font-style: italic; }
  .highlight .cs {
    color: #999;
    font-weight: bold;
    font-style: italic; }
  .highlight .gd {
    color: #000;
    background-color: #fdd; }
  .highlight .gd .x {
    color: #000;
    background-color: #faa; }
  .highlight .ge {
    font-style: italic; }
  .highlight .gr {
    color: #a00; }
  .highlight .gh {
    color: #999; }
  .highlight .gi {
    color: #000;
    background-color: #dfd; }
  .highlight .gi .x {
    color: #000;
    background-color: #afa; }
  .highlight .go {
    color: #888; }
  .highlight .gp {
    color: #555; }
  .highlight .gs {
    font-weight: bold; }
  .highlight .gu {
    color: #aaa; }
  .highlight .gt {
    color: #a00; }
  .highlight .kc {
    font-weight: bold; }
  .highlight .kd {
    font-weight: bold; }
  .highlight .kp {
    font-weight: bold; }
  .highlight .kr {
    font-weight: bold; }
  .highlight .kt {
    color: #458;
    font-weight: bold; }
  .highlight .m {
    color: #099; }
  .highlight .s {
    color: #d14; }
  .highlight .na {
    color: #008080; }
  .highlight .nb {
    color: #0086B3; }
  .highlight .nc {
    color: #458;
    font-weight: bold; }
  .highlight .no {
    color: #008080; }
  .highlight .ni {
    color: #800080; }
  .highlight .ne {
    color: #900;
    font-weight: bold; }
  .highlight .nf {
    color: #900;
    font-weight: bold; }
  .highlight .nn {
    color: #555; }
  .highlight .nt {
    color: #000080; }
  .highlight .nv {
    color: #008080; }
  .highlight .ow {
    font-weight: bold; }
  .highlight .w {
    color: #bbb; }
  .highlight .mf {
    color: #099; }
  .highlight .mh {
    color: #099; }
  .highlight .mi {
    color: #099; }
  .highlight .mo {
    color: #099; }
  .highlight .sb {
    color: #d14; }
  .highlight .sc {
    color: #d14; }
  .highlight .sd {
    color: #d14; }
  .highlight .s2 {
    color: #d14; }
  .highlight .se {
    color: #d14; }
  .highlight .sh {
    color: #d14; }
  .highlight .si {
    color: #d14; }
  .highlight .sx {
    color: #d14; }
  .highlight .sr {
    color: #009926; }
  .highlight .s1 {
    color: #d14; }
  .highlight .ss {
    color: #990073; }
  .highlight .bp {
    color: #999; }
  .highlight .vc {
    color: #008080; }
  .highlight .vg {
    color: #008080; }
  .highlight .vi {
    color: #008080; }
  .highlight .il {
    color: #099; }

* {
  margin: 0;
  padding: 0; }

/* clearfix hack after Cederholm (group class name) */
.group:after {
  content: "";
  display: table;
  clear: both; }

html, body {
  height: 100%; }

html {
  text-align: baseline;
  font-size: 11px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale; }

@media screen and (min-width: 800px) {
  html {
    font-size: 12px; } }
@media screen and (min-width: 900px) {
  html {
    font-size: 13px; } }
@media screen and (min-width: 1000px) {
  html {
    font-size: 14px; } }
@media screen and (min-width: 1100px) {
  html {
    font-size: 15px; } }
@media screen and (min-width: 1200px) {
  html {
    font-size: 16px; } }
@media screen and (min-width: 1300px) {
  html {
    font-size: 17px; } }
.mathblock {
  font-size: 1.3rem; }

a {
  color: #a00000;
  text-decoration: none; }

p > a {
  color: #a00000;
  text-decoration: none; }

body {
  width: 87.5%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 12.5%;
  font-family: et-bembo, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
  background-color: #fffff8;
  color: #111;
  max-width: 1400px;
  counter-reset: sidenote-counter; }

h1 {
  font-weight: 400;
  margin-top: 1.568rem;
  margin-bottom: 1.568rem;
  font-size: 2.5rem;
  line-height: 0.784; }

h2 {
  font-style: italic;
  font-weight: 400;
  margin-top: 1.866666666666667rem;
  margin-bottom: 0;
  font-size: 2.1rem;
  line-height: 0.933333333333333; }

h3 {
  font-style: italic;
  font-weight: 400;
  font-size: 1.8rem;
  margin-top: 2.1777777777777778rem;
  margin-bottom: 0;
  line-height: 1.08888888888889; }

p .subtitle {
  font-style: italic;
  margin-top: 2.1777777777777778rem;
  margin-bottom: 2.1777777777777778rem;
  font-size: 1.8rem;
  display: block;
  line-height: 1.08888888888889; }

p, ol, ul {
  font-size: 1.4rem; }

p, li {
  line-height: 2rem;
  margin-top: 1.4rem;
  padding-right: 2rem;
  vertical-align: baseline; }

blockquote p {
  font-size: 1.1rem;
  line-height: 1.78181818;
  margin-top: 1.78181818rem;
  margin-bottom: 1.78181818rem;
  width: 45%;
  padding-left: 2.5%;
  padding-right: 2.5%; }

blockquote footer {
  width: 45%;
  text-align: right; }

.sans {
  font-family: "Gill Sans", "Gill Sans MT", "Lato", Calibri, sans-serif;
  letter-spacing: .03em; }

pre, pre code, p code, p pre code {
  font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 1.2rem;
  line-height: 1.71428571;
  margin-top: 1.71428571rem; }

h1 code, h2 code, h3 code {
  font-size: 0.80em; }

/*-- Table styling section - For Tufte-Jekyll, booktabs style is default for Markdown tables  --*/
table, table.booktabs {
  width: auto;
  margin: 0 auto;
  border-spacing: 0px;
  border-top: 2px solid #333333;
  border-bottom: 2px solid #333333; }

.booktabs th, th {
  border-bottom: 1px solid #333333;
  padding: 0.65ex 0.5em 0.4ex 0.5em;
  font-weight: normal;
  text-align: center; }

th, td {
  font-size: 1.2rem;
  line-height: 1.71428571; }

.booktabs th.cmid, th {
  border-bottom: 1px solid #737373; }

.booktabs th.nocmid {
  border-bottom: none; }

.booktabs tbody tr:first-child td, tr:first-child td {
  padding-top: 0.65ex; }

/* add space between thead row and tbody */
.booktabs td, td {
  padding-left: 0.5em;
  padding-right: 0.5em;
  text-align: left; }

.booktabs caption, caption {
  font-size: 90%;
  text-align: left;
  width: auto;
  margin-left: auto;
  margin-right: auto;
  margin-top: 1ex;
  caption-side: top; }

.booktabs tbody tr td.l {
  text-align: left !important; }

.booktabs tbody tr td.c {
  text-align: center !important; }

.booktabs tbody tr td.r {
  text-align: right !important; }

.table-caption {
  float: right;
  clear: right;
  margin-right: -60%;
  width: 50%;
  margin-top: 0;
  margin-bottom: 0;
  font-size: 1.0rem;
  line-height: 1.96; }

/* -- End of Table Styling section --*/
/* Basic Layout stuff --*/
article {
  position: relative;
  padding: 1 rem 0rem 2.5rem 0rem; }

section {
  padding-top: 1rem;
  padding-bottom: 1rem; }

ul, ol {
  width: 45%;
  -webkit-padding-start: 5%;
  -webkit-padding-end: 5%;
  list-style-type: none; }

figure, figure img.maincolumn {
  max-width: 55%;
  -webkit-margin-start: 0;
  -webkit-margin-end: 0;
  margin-bottom: 3em; }

figcaption {
  float: right;
  clear: right;
  margin-right: -48%;
  margin-top: 0;
  margin-bottom: 0;
  font-size: 1.0rem;
  line-height: 1.6;
  vertical-align: baseline;
  position: relative;
  max-width: 40%; }

figure.fullwidth figcaption {
  float: left;
  margin-right: 0%;
  margin-left: 36%; }

img {
  max-width: 100%; }

.sidenote, .marginnote {
  float: right;
  clear: right;
  margin-right: -60%;
  width: 50%;
  margin-top: 0;
  margin-bottom: 1.96rem;
  font-size: 1.0rem;
  line-height: 1.96;
  vertical-align: baseline;
  position: relative; }

li .sidenote, li .marginnote {
  margin-right: -80%; }

blockquote .sidenote, blockquote .marginnote {
  margin-right: -79%; }

.sidenote-number {
  counter-increment: sidenote-counter; }

.sidenote-number:after, .sidenote:before {
  content: counter(sidenote-counter) " ";
  font-family: et-bembo-roman-old-style;
  color: #a00000;
  position: relative;
  vertical-align: baseline; }

.sidenote-number:after {
  content: counter(sidenote-counter);
  font-size: 1rem;
  top: -0.5rem;
  left: 0.1rem; }

.sidenote:before {
  content: counter(sidenote-counter) ". ";
  color: #a00000;
  top: 0rem; }

p, footer, div.table-wrapper, div.mathblock {
  width: 55%; }

div.table-wrapper {
  overflow-x: auto; }

@media screen and (max-width: 760px) {
  p, footer, div.mathblock {
    width: 90%; }

  pre code {
    width: 87.5%; }

  ul {
    width: 85%; }

  figure {
    max-width: 90%; }

  figcaption, figure.fullwidth figcaption {
    margin-right: 0%;
    max-width: none; }

  blockquote p, blockquote footer {
    width: 80%;
    padding-left: 5%;
    padding-right: 5%; } }
.marginnote code, .sidenote code {
  font-size: 1rem; }

pre, pre code, p pre code {
  width: 52.5%;
  padding-left: 2.5%;
  overflow-x: auto; }

.fullwidth, li.listing div {
  max-width: 90%; }

.full-width .sidenote, .full-width .sidenote-number, .full-width .marginnote {
  display: none; }

span.newthought {
  font-variant: small-caps;
  font-size: 1.2em;
  letter-spacing: 0.05rem; }

input.margin-toggle {
  display: none; }

label.sidenote-number {
  display: inline; }

label.margin-toggle:not(.sidenote-number) {
  display: none; }

@media (max-width: 760px) {
  label.margin-toggle:not(.sidenote-number) {
    display: inline;
    color: #a00000; }

  .sidenote, .marginnote {
    display: none; }

  .margin-toggle:checked + .sidenote,
  .margin-toggle:checked + .marginnote {
    display: block;
    float: left;
    left: 1rem;
    clear: both;
    width: 95%;
    margin: 1rem 2.5%;
    vertical-align: baseline;
    position: relative; }

  label {
    cursor: pointer; }

  pre, pre code, p code, p pre code {
    width: 90%;
    padding: 0; }

  .table-caption {
    display: block;
    float: right;
    clear: both;
    width: 98%;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    margin-left: 1%;
    margin-right: 1%;
    vertical-align: baseline;
    position: relative; }

  div.table-wrapper, table, table.booktabs {
    width: 85%; }

  div.table-wrapper {
    border-right: 1px solid #efefef; }

  img {
    max-width: 100%; } }
/*--- End of Basic Layout stuff from tufte.css ---*/
/* -- Jekyll specific styling --*/
.contrast {
  color: #a00000; }

.smaller {
  font-size: 80%; }

header > nav.group, body footer {
  width: 95%;
  padding-top: 2rem; }

nav.group a.active:before {
  content: "\0003c\000a0"; }

nav.group a.active:after {
  content: " >"; }

header > nav a {
  font-size: 1.2rem;
  font-family: "Gill Sans", "Gill Sans MT", "Lato", Calibri, sans-serif;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #a00000;
  padding-top: 1.5rem;
  text-decoration: none;
  display: inline-block;
  float: left;
  margin-top: 0;
  margin-bottom: 0;
  padding-right: 2rem;
  vertical-align: baseline; }

header > nav a img {
  height: 5rem;
  position: relative;
  max-width: 100%;
  top: -1.5rem; }

ul.footer-links, .credits {
  list-style: none;
  text-align: center;
  margin: 0 auto; }

ul.footer-links li {
  display: inline;
  padding: 0.5rem 0.25rem; }

.credits {
  padding: 1rem 0rem; }

.credits {
  font-family: "Gill Sans", "Gill Sans MT", "Lato", Calibri, sans-serif; }
  .credits a {
    color: #a00000; }

body.full-width, .content-listing, ul.content-listing li.listing {
  width: 90%;
  margin-left: auto;
  margin-right: auto;
  padding: 0% 5%; }

.full-width article p {
  width: 90%; }

h1.content-listing-header {
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.2rem;
  font-size: 1.8rem; }

li.listing hr {
  width: 100%; }

.listing, .listing h3 {
  display: inline-block;
  margin: 0; }

li.listing {
  margin: 0; }
  li.listing p {
    width: 100%; }

li.listing:last-of-type {
  border-bottom: none;
  margin-bottom: 1.4rem; }

li.listing h3.new {
  text-transform: uppercase;
  font-style: normal; }

hr.slender {
  border: 0;
  height: 1px;
  margin-top: 1.4rem;
  margin-bottom: 1.4rem;
  background-image: -webkit-linear-gradient(left, transparent, rgba(0, 0, 0, 0.75), transparent);
  background-image: -moz-linear-gradient(left, transparent, rgba(0, 0, 0, 0.75), transparent);
  background-image: -ms-linear-gradient(left, transparent, rgba(0, 0, 0, 0.75), transparent);
  background-image: -o-linear-gradient(left, transparent, rgba(0, 0, 0, 0.75), transparent); }

@media screen {
  .print-footer {
    display: none; } }
@media print {
  * {
    -webkit-transition: none !important;
    transition: none !important; }

  *,
  *:before,
  *:after {
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important; }

  @page {
    margin: 0.75in 0.5in 0.75in 0.5in;
    orphans: 4;
    widows: 2; }
  body {
    font-size: 12pt; }

  html body span.print-footer {
    font-family: "Gill Sans", "Gill Sans MT", "Lato", Calibri, sans-serif;
    font-size: 9pt;
    margin-top: 22.4pt;
    padding-top: 4pt;
    border-top: 1px solid #000; }

  thead {
    display: table-header-group; }

  tr,
  img {
    page-break-inside: avoid; }

  img {
    max-width: 100% !important; }

  p,
  h2,
  h3 {
    orphans: 4;
    widows: 4; }

  article h2, article h2 h3, article h3, article h3 h4, article h4, article h4 h5 {
    page-break-after: avoid; }

  body header, body footer {
    display: none; } }
/* --- Icomoon icon fonts CSS --*/
@font-face {
  font-family: 'icomoon';
  src: url("../fonts/icomoon.eot?rgwlb8");
  src: url("../fonts/icomoon.eot?#iefixrgwlb8") format("embedded-opentype"), url("../fonts/icomoon.woff?rgwlb8") format("woff"), url("../fonts/icomoon.ttf?rgwlb8") format("truetype"), url("../fonts/icomoon.svg?rgwlb8#icomoon") format("svg");
  font-weight: normal;
  font-style: normal; }
[class^="icon-"], [class*=" icon-"] {
  font-family: 'icomoon';
  speak: none;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  color: #a00000;
  /* Better Font Rendering =========== */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale; }

.icon-pencil:before {
  content: "\e600"; }

.icon-film:before {
  content: "\e60f"; }

.icon-calendar:before {
  content: "\e601"; }

.icon-link:before {
  content: "\e602"; }

.icon-info:before {
  content: "\e603"; }

.icon-cancel-circle:before {
  content: "\e604"; }

.icon-checkmark-circle:before {
  content: "\e605"; }

.icon-spam:before {
  content: "\e606"; }

.icon-mail:before {
  content: "\e607"; }

.icon-googleplus:before {
  content: "\e608"; }

.icon-facebook:before {
  content: "\e609"; }

.icon-twitter:before {
  content: "\e60a"; }

.icon-feed:before {
  content: "\e60b"; }

.icon-flickr:before {
  content: "\e60c"; }

.icon-github:before {
  content: "\e60d"; }

.icon-box-add:before {
  content: "\e60e"; }

/*-- End of Icomoon icon font section --*/


text:
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="kony" basedir="." default="main">

	<target name="main">
	    <property name="antjar.file" value="${basedir}/ant-contrib-0.6.jar"/>
		<echo message="Looking for JAR antcontrib.jar at : ${antjar.file}"/>
		<taskdef resource="net/sf/antcontrib/antcontrib.properties">
		<classpath>
			<pathelement location="${antjar.file}"/>
		</classpath>
		</taskdef>
		<osfamily property="os.family"/>
	<echo message="Started script..."/>
	<property name="input.file" location="${basedir}/build.properties"/>

	<if>
    <available file="${basedir}/global.properties"/>
    <then>
      <property name="global.available" value="true"/>
    </then>
	<else>
	  <property name="global.available" value="false"/>
	</else>
	</if>

	<if>
	 <equals arg1="${global.available}" arg2="true"/>
		<then>
			<property name="global.file" location="${basedir}/global.properties"/>
		</then>
		<else>
			<property name="global.file" location="../global.properties"/>
		</else>
	</if>

	<echo message="Global properties file LOCATION: ${global.file}"/>
	<echo message="Build properties file LOCATION: ${input.file}"/>

	<if>
		<or>
			<not>
				<available file="${input.file}"/>
			</not>
			<not>
				<available file="${global.file}"/>
			</not>
		</or>
		<then>
			<fail message="Either ${input.file}
				or
				${global.file}
				doesn't exist"/>
		</then>
	</if>
	<property file="${input.file}"/>
	<property file="${global.file}"/>

	<if>
		<equals arg1="${workspace.location}" arg2=""/>
		<then>
			<property name = "ws.location" value ="../" />
		</then>
		<else>
			<property name = "ws.location" value ="${workspace.location}"/>
		</else>
	</if>
	<echo message="WORKSPACE LOCATION: ${ws.location}"/>
	<if>
		<equals arg1="${project.name}" arg2=""/>
		<then>
			<fail message="Project name  is not given.
				Please set 'project.name' property in ${input.file}"/>
		</then>
		<else>
			<if>
				<not>
					<available file="${ws.location}/${project.name}" type="dir"/>
				</not>
				<then>
					<fail message="Project '${project.name}' doesn't exist in  ${ws.location}"/>
				</then>
			</if>
		</else>
	</if>

	<if>
		<equals arg1="${eclipse.equinox.path}" arg2=""/>
		<then>
			<fail message="Please set 'eclipse.equinox.path' property in ${global.file}"/>
		</then>
		<else>
			<if>
				<not>
					<available file="${eclipse.equinox.path}"/>
				</not>
				<then>
					<fail message="The path provided for 'eclipse.equinox.path' property in ${global.file} is not present.."/>
				</then>
			</if>
		</else>
	</if>

    <if>
    	<equals arg1="${os.family}" arg2="windows"/>
    	<then>
    		<exec dir="." executable="cmd" failonerror="true">
    			<arg value="/c"/>
    			<arg value="run.bat"/>
    			<arg value="${input.file}"/>
    			<arg value="${ws.location}"/>
    			<arg value="${eclipse.equinox.path}"/>
    			<arg value="${global.file}"/>
    		</exec>
    	</then>
    	<else>
	        <exec dir="." executable="/bin/bash" failonerror="true">
	        	<arg line='-c "chmod 777 run.sh"'/>
	        </exec>
	        <exec dir="." executable="/bin/bash" failonerror="true">
	        	<arg line='-c "sh run.sh ${input.file} ${ws.location} ${eclipse.equinox.path} ${global.file}"'/>
	        </exec>
    	</else>
    </if>

	<echo message="Ending script..."/>

	</target>

</project>


text:
% This code reproduces the analyses in the paper
% Urai AE, Braun A, Donner THD (2016) Pupil-linked arousal is driven
% by decision uncertainty and alters serial choice bias.
%
% Permission is hereby granted, free of charge, to any person obtaining a
% copy of this software and associated documentation files (the "Software"),
% to deal in the Software without restriction, including without limitation
% the rights to use, copy, modify, merge, publish, distribute, sublicense,
% and/or sell copies of the Software, and to permit persons to whom the
% Software is furnished to do so, subject to the following conditions:
%
% The above copyright notice and this permission notice shall be included
% in all copies or substantial portions of the Software.
% If you use the Software for your own research, cite the paper.
%
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
% FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
% DEALINGS IN THE SOFTWARE.
%
% Anne Urai, 2016
% anne.urai@gmail.com

global mypath;
close; figure;

% first, illustrate shift
sigmoid = @(x, mu) 1 ./ (1 + exp(-x + mu));
x = -5:0.01:5;
subplot(441); % tiny!
hold on;
plot(x, sigmoid(x, 0), 'k');
plot([-5 5], [0.5 0.5], 'k');
plot([0 0], [0 1], 'k');
axis tight; axis square;
ylabel('P(choice = 1)');
xlabel('Sensory evidence (a.u.)');
ylim([-0.05 1]);

subplot(442); examplePsychFunc(20); title(sprintf('Participant %d', 20));
subplot(443); examplePsychFunc(13); title(sprintf('Participant %d', 13));
subplot(444); examplePsychFuncShift(10); title('Participant 10');

print(gcf, '-dpdf', sprintf('%s/Figures/FigureS4.pdf', mypath));


text:
Hi! I'm Joey Heflich - a freelance front-end developer.

I help small companies and organizations build websites that are usable, useful, responsive and easy to update. From the feedback I get from you and your team to the information we learn about your users, it's all about us making something that satisfies your wants and your audience's needs.

I can help you set goals, plan content updates and improve how you interact with your users, all the way from our first meeting to the project's completion. And no matter how complicated things get, it will always be important to me that your users can find what they need quickly and easily, and that your new intern can post a photo gallery and check on your site's stats while on the way to the afternoon meeting.

How I Do What I Do

HTML, CSS, Javascript, jQuery, AJAX, PHP, MySQL, Sass, Bower, Gulp, Wordpress, Bootstrap, Foundation, Photoshop

What I'm Learning

React, ES6, Laravel

Want to Work Together?

Send me an e-mail.

Youth Outlook

Youth Outlook needed a redesign to made their site easier to use, both for their staff and the community they support. I worked with them to streamline their content, simplify their posting process and create a custom Wordpress theme that could better convey their organization's message.

			View Website
			<a href="<?php echo SITE_URL; ?>projects/#youth-outlook" class="button featured-button">Learn More

Erin DeMoss Creative

From design to deployment in two weeks, I was able to work with Erin to quickly transform her ideas and .PSDs into a custom Wordpress theme that we can build on as her business changes and grows. Now, she can e-mail me whenever she has a new idea, and the changes will be made by end-of-day.

			View Website
			<a href="<?php echo SITE_URL; ?>projects/#erin" class="button featured-button">Learn More

King Bone Press

Over the years, I've worked with King Bone Press to create websites that screamed indie comics out onto the Internet. Their most recent update was the biggest yet - a complete content and site overhaul that'll help the company's fans get the newest books under their art-loving fingers.

			View Website
			<a href="<?php echo SITE_URL; ?>projects/#kbp" class="button featured-button">Learn More

Robert Hafferman

Rob wanted a website that was capable of showcasing his art, without overshadowing it, but also insisted that it couldn't look like the same Bootstrap template everyone else used. In response, I designed and developed a site that was colorful and unique like him, while also being minimalist like me.

			View Website
			<a href="<?php echo SITE_URL; ?>projects/#rob" class="button featured-button">Learn More

A Little About Me

I'm a (lanky) nerd that's been making stuff on the web ever since I coded my first Geocities site. After a few post-college years of writing articles and doing the content creation thing, I went to doing web development full-time, because I wanted to help others create sites, experiences and communities that improved things for users like you. On a hourly basis, it might all look like code to anyone else, but to me, it's my way of providing help and maybe a sense of belonging for somebody, somewhere. And that's a great reason for me to plop down in front of my laptop every morning.

But when I'm away from work, I'm either reading, biking, podcasting, gaming or sipping an overpriced beer at a concert.