text:
using System;

namespace PdfSharp.Charting.Renderers
{
  /// <summary>
  /// Represents the base class for all Y axis renderer.
  /// </summary>
  internal abstract class YAxisRenderer : AxisRenderer
  {
    /// <summary>
    /// Initializes a new instance of the YAxisRenderer class with the specified renderer parameters.
    /// </summary>
    internal YAxisRenderer(RendererParameters parms)
      : base(parms)
    { }

    /// <summary>
    /// Calculates optimal minimum/maximum scale and minor/major tick based on yMin and yMax.
    /// </summary>
    protected void FineTuneYAxis(AxisRendererInfo rendererInfo, double yMin, double yMax)
    {
      if (yMin == double.MaxValue && yMax == double.MinValue)
      {
        // No series data given.
        yMin = 0.0f;
        yMax = 0.9f;
      }

      if (yMin == yMax)
      {
        if (yMin == 0)
          yMax = 0.9f;
        else if (yMin < 0)
          yMax = 0;
        else if (yMin > 0)
          yMax = yMin + 1;
      }

      // If the ratio between yMax to yMin is more than 1.2, the smallest number will be set too zero.
      // It's Excel's behavior.
      if (yMin != 0)
      {
        if (yMin < 0 && yMax < 0)
        {
          if (yMin / yMax >= 1.2)
            yMax = 0;
        }
        else if (yMax / yMin >= 1.2)
          yMin = 0;
      }

      double deltaYRaw = yMax - yMin;

      int digits = (int)(Math.Log(deltaYRaw, 10) + 1);
      double normed = deltaYRaw / Math.Pow(10, digits) * 10;

      double normedStepWidth = 1;
      if (normed < 2)
        normedStepWidth = 0.2f;
      else if (normed < 5)
        normedStepWidth = 0.5f;

      AxisRendererInfo yari = rendererInfo;
      double stepWidth = normedStepWidth * Math.Pow(10.0, digits - 1.0);
      if (yari.axis == null || double.IsNaN(yari.axis.majorTick))
        yari.MajorTick = stepWidth;
      else
        yari.MajorTick = yari.axis.majorTick;

      double roundFactor = stepWidth * 0.5;
      if (yari.axis == null || double.IsNaN(yari.axis.minimumScale))
      {
        double signumMin = (yMin != 0) ? yMin / Math.Abs(yMin) : 0;
        yari.MinimumScale = (int)(Math.Abs((yMin - roundFactor) / stepWidth) - (1 * signumMin)) * stepWidth * signumMin;
      }
      else
        yari.MinimumScale = yari.axis.minimumScale;

      if (yari.axis == null || double.IsNaN(yari.axis.maximumScale))
      {
        double signumMax = (yMax != 0) ? yMax / Math.Abs(yMax) : 0;
        yari.MaximumScale = (int)(Math.Abs((yMax + roundFactor) / stepWidth) + (1 * signumMax)) * stepWidth * signumMax;
      }
      else
        yari.MaximumScale = yari.axis.maximumScale;

      if (yari.axis == null || double.IsNaN(yari.axis.minorTick))
        yari.MinorTick = yari.MajorTick / 5;
      else
        yari.MinorTick = yari.axis.minorTick;
    }

    /// <summary>
    /// Returns the default tick labels format string.
    /// </summary>
    protected override string GetDefaultTickLabelsFormat()
    {
      return "0.0";
    }
  }
}


text:
 /************************************************************************/
 /*                                                                      */
 /*                Centre for Speech Technology Research                 */
 /*                     University of Edinburgh, UK                      */
 /*                        Copyright (c) 1997                            */
 /*                        All Rights Reserved.                          */
 /*                                                                      */
/*  Permission is hereby granted, free of charge, to use and distribute  */
/*  this software and its documentation without restriction, including   */
/*  without limitation the rights to use, copy, modify, merge, publish,  */
/*  distribute, sublicense, and/or sell copies of this work, and to      */
/*  permit persons to whom this work is furnished to do so, subject to   */
/*  the following conditions:                                            */
/*   1. The code must retain the above copyright notice, this list of    */
/*      conditions and the following disclaimer.                         */
/*   2. Any modifications must be clearly marked as such.                */
/*   3. Original authors' names are not deleted.                         */
/*   4. The authors' names are not used to endorse or promote products   */
/*      derived from this software without specific prior written        */
/*      permission.                                                      */
 /*                                                                      */
 /*  THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK       */
 /*  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING     */
 /*  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT  */
 /*  SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE    */
 /*  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES   */
 /*  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN  */
 /*  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,         */
 /*  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF      */
 /*  THIS SOFTWARE.                                                      */
 /*                                                                      */
 /************************************************************************/

#ifndef __EST_REGEX_H__
#define __EST_REGEX_H__

class EST_Regex;

#include "EST_String.h"

/** A Regular expression class to go with the CSTR EST_String class.
  *
  * The regular expression syntax is the FSF syntax used in emacs and
  * in the FSF String library. This is translated into the syntax supported
  * by Henry Spensor's regular expression library, this translation is a place
  * to look if you find regular expressions not matching where expected.
  *
  * @see EST_String
  * @see string_example
  * @author Richard Caley <rjc@cstr.ed.ac.uk>
  * @author (regular expression library by Henry Spencer, University of Toronto)
  * @version $Id: EST_Regex.h,v 1.3 2004/05/04 00:00:16 awb Exp $
  */

class EST_Regex : protected EST_String {

private:
    /// The compiled form.
    void *compiled;
    /// Compiled form for whole string match.
    void *compiled_match;

protected:
    /// Compile expression.
    void compile();
    /// Compile expression in a form which only matches whole string.
    void compile_match();
    /// Translate the expression into the internally used syntax.
    char *regularize(int match) const;

public:
    /// Empty constructor, just for form.
    EST_Regex(void);

    /// Construct from EST_String.
    EST_Regex(EST_String s);

    /// Construct from C string.
    EST_Regex(const char *ex);

    /// Copy constructor.
    EST_Regex(const EST_Regex &ex);

    /// Destructor.
    ~EST_Regex();

    /// Size of the expression.
    int  size() const { return EST_String::size; };

    /// Run to find a matching substring
    int  run(const char *on, int from, int &start, int &end, int *starts=NULL, int *ends=NULL);
    /// Run to see if it matches the entire string.
    int  run_match(const char *on, int from=0, int *starts=NULL, int *ends=NULL);

    /// Get the expression as a string.
    EST_String tostring(void) const {return (*this);};

    /// Cast operator, disambiguates it for some compilers
    operator const char *() const { return (const char *)tostring(); }

    int operator == (const EST_Regex ex) const
    { return (const EST_String)*this == (const EST_String)ex; }

    int operator != (const EST_Regex ex) const
    { return (const EST_String)*this != (const EST_String)ex; }

    /**@name Assignment */
    //@{
    ///
    EST_Regex &operator = (const EST_Regex ex);
    ///
    EST_Regex &operator = (const EST_String s);
    ///
    EST_Regex &operator = (const char *s);
    //@}

    /// Stream output of regular expression.
    friend ostream &operator << (ostream &s, const EST_Regex &str);
};

ostream &operator << (ostream &s, const EST_Regex &str);

/**@name Predefined_regular_expressions
  * Some regular expressions matching common things are predefined
  */
//@{
/// White space
extern EST_Regex RXwhite;	// "[ \n\t\r]+"
/// Sequence of alphabetic characters.
extern EST_Regex RXalpha;	// "[A-Za-z]+"
/// Sequence of lower case alphabetic characters.
extern EST_Regex RXlowercase;	// "[a-z]+"
/// Sequence of upper case alphabetic characters.
extern EST_Regex RXuppercase;	// "[A-Z]+"
/// Sequence of letters and/or digits.
extern EST_Regex RXalphanum;	// "[0-9A-Za-z]+"
/// Initial letter or underscore followed by letters underscores or digits.
extern EST_Regex RXidentifier;	// "[A-Za-z_][0-9A-Za-z_]+"
/// Integer.
extern EST_Regex RXint;		// "-?[0-9]+"
/// Floating point number.
extern EST_Regex RXdouble;	// "-?\\(\\([0-9]+\\.[0-9]*\\)\\|\\([0-9]+\\)\\|\\(\\.[0-9]+\\)\\)\\([eE][---+]?[0-9]+\\)?"
//@}

// GCC lets us use the static constant to declare arrays, Sun CC
// doesn't, so for a quiet, if ugly, life we declare it here with a suitable
// value and check in EST_Regex.cc to make sure it`s OK

#define  EST_Regex_max_subexpressions 10

#endif

redpajama_set_name: RedPajamaGithub


text:
"""
ITE: Information Theoretical Estimators Toolbox in Python
=========================================================

Subpackages
-----------
cost   - Estimators for entropy, mutual information, divergence,
         association measures, cross quantities, kernels on distributions
shared - Shared functions

"""

# automatically load submodules:
from . import cost

# explicitly tilt "from ite import *"; use "import ite".
__all__ = []


text:
package com.android.bluetooth.hfp;

/* Constants for extended AT error codes specified by the Handsfree profile. */
public class BluetoothCmeError {
    public static final int AG_FAILURE = 0;
    public static final int NO_CONNECTION_TO_PHONE = 1;
    public static final int OPERATION_NOT_ALLOWED = 3;
    public static final int OPERATION_NOT_SUPPORTED = 4;
    public static final int PIN_REQUIRED = 5;
    public static final int SIM_MISSING = 10;
    public static final int SIM_PIN_REQUIRED = 11;
    public static final int SIM_PUK_REQUIRED = 12;
    public static final int SIM_FAILURE = 13;
    public static final int SIM_BUSY = 14;
    public static final int WRONG_PASSWORD = 16;
    public static final int SIM_PIN2_REQUIRED = 17;
    public static final int SIM_PUK2_REQUIRED = 18;
    public static final int MEMORY_FULL = 20;
    public static final int INVALID_INDEX = 21;
    public static final int MEMORY_FAILURE = 23;
    public static final int TEXT_TOO_LONG = 24;
    public static final int TEXT_HAS_INVALID_CHARS = 25;
    public static final int DIAL_STRING_TOO_LONG = 26;
    public static final int DIAL_STRING_HAS_INVALID_CHARS = 27;
    public static final int NO_SERVICE = 30;
    public static final int ONLY_911_ALLOWED = 32;
}


text:
https://sunlightmedia.org/bash-vs-zsh/

https://wilsonmar.github.io/zsh/

https://github.com/sharkdp/shell-functools

zsh: Re: Ignore insecure directories and continue
http://www.zsh.org/mla/users/2008/msg00566.html


text:
package org.jkiss.dbeaver.ui.editors.sql;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

/**
 * Presentation panel. Displayed in the same tab folder as SQL results and other panels
 */
public interface SQLEditorPresentationPanel {

    Control createPanel(Composite parent, SQLEditor editor, SQLEditorPresentation presentation);

    void activatePanel();

    void deactivatePanel();

}


text:
/**
 * @file
 * Abstract interrupt class.
 */

#ifndef HALM_INTERRUPT_H_
#define HALM_INTERRUPT_H_
/*----------------------------------------------------------------------------*/
#include <xcore/entity.h>
#include <stdbool.h>
#include <stdint.h>
/*----------------------------------------------------------------------------*/
/* Class descriptor */
struct InterruptClass
{
  CLASS_HEADER

  void (*enable)(void *);
  void (*disable)(void *);

  void (*setCallback)(void *, void (*)(void *), void *);
};

struct Interrupt
{
  struct Entity base;
};
/*----------------------------------------------------------------------------*/
BEGIN_DECLS

/**
 * Enable the interrupt generation.
 * @param interrupt Pointer to an Interrupt object.
 */
static inline void interruptEnable(void *interrupt)
{
  ((const struct InterruptClass *)CLASS(interrupt))->enable(interrupt);
}

/**
 * Disable the interrupt generation.
 * @param interrupt Pointer to an Interrupt object.
 */
static inline void interruptDisable(void *interrupt)
{
  ((const struct InterruptClass *)CLASS(interrupt))->disable(interrupt);
}

/**
 * Set a callback function for an interrupt.
 * @param interrupt Pointer to an Interrupt object.
 * @param callback Callback function.
 * @param argument Callback function argument.
 */
static inline void interruptSetCallback(void *interrupt,
    void (*callback)(void *), void *argument)
{
  ((const struct InterruptClass *)CLASS(interrupt))->setCallback(interrupt,
      callback, argument);
}

END_DECLS
/*----------------------------------------------------------------------------*/
#endif /* HALM_INTERRUPT_H_ */


text:
require 'git_tracker/branch'
require 'git_tracker/commit_message'

module GitTracker
  class PrepareCommitMessage
    attr_reader :file, :source, :commit_sha

    def self.run(file, source=nil, commit_sha=nil)
      new(file, source, commit_sha).run
    end

    def initialize(file, source=nil, commit_sha=nil)
      @file = file
      @source = source
      @commit_sha = commit_sha
    end

    def run
      exit_when_commit_exists

      story = story_number_from_branch
      message = CommitMessage.new(file)
      exit if message.mentions_story?(story)
      keyword = message.keyword

      message_addition = [keyword, "##{story}"].compact.join(' ')
      message.append("[#{message_addition}]")
    end

    private

    def exit_when_commit_exists
      exit if source == 'commit'
    end

    def story_number_from_branch
      story = Branch.story_number
      exit unless story
      story
    end
  end
end


text:
<!DOCTYPE html>

    <meta charset="utf-8"/>

    <title>NB Login required</title>
    <link type="text/css" href="/content/compiled/login.css" rel="stylesheet" />
    <link type="text/css" href="/content/lib/font-awesome/font-awesome-4.6.1/css/font-awesome.min.css" rel="stylesheet" />

Log in to nb to continue...

                Email
                <input type='text'  id='login_user_email' ></input>

                Password
                <input type='password'  id='login_user_password' ></input>

                  <button id="auth_submit">OK</button>
                  Lost password ?

                Or use
                <button title='Login using your Google account' onclick='document.location='" + nbhostname + '/openid/login?next=' + (document.location.pathname === '/login' ? '/' : document.location.pathname) + "'></button><button style='display: none' title='Login using your Facebook account' onclick='document.location='/facebook/login?next=" + (document.location.pathname === '/login' ? '/' : document.location.pathname) + "'></button>

Or, sign up to nb

... by creating a new group.

          At this time, regular users wishing to join a site cannot sign up without receiving an invite to join a reading group. If you want to create a new reading group
          (for a class or otherwise), click the link above.


text:
(written by Victoria Lacroix)

These are blocks to be used with the i3blocks status updater. They're relatively
simple scripts in bash scripting that cue up certain information for the user.

All colors are tuned to LXTerminal's defaults.

# Blocks

## cmus

Gets the artist, title and track position from cmus. Also has a small aside for
sending notifications with notify-send.

Colors are (by state):

* Playing = Green
* Paused = Blue
* Stopped/Not Running = Red

## cpu

Guts total CPU usage by counting usage for each process. Then, divides the total
by a given CPU count for the machine.

Colors are (by usage):

* 0-19% = Blue
* 20-39% = Cyan
* 40-59% = Green
* 60-79% = Yellow
* 80-100% = Red

## disk

Gets the total free space (with a percentage) left on the disk specified by the
mount point.

Colors are (by remaining):

* 80-100% = Blue
* 60-79% = Cyan
* 20-39% = Yellow
* 40-59% = Green
* 0-19% = Red

## mem

Gets the RAM usage.

Colors are (by remaining):

* 80-100% = Blue
* 60-79% = Cyan
* 20-39% = Yellow
* 40-59% = Green
* 0-19% = Red

## vol

Gets volume levels (using pulseaudio-ctl).

Colors are (by state):

* Not muted = Green
* Muted = Red

# License

All files here are MIT-licensed. See COPYING for details.


text:
<?xml version="1.0"?>
<!--

-->
<tabs>
    <settings>
        <class>\Mage\Adminhtml\Test\Block\Catalog\Product\Edit\Tab\ProductSettings</class>
        <selector>#product_info_tabs_set</selector>
        <fields>
            <attribute_set_id>
                <selector>#attribute_set_id</selector>
                <input>select</input>
            </attribute_set_id>
            <product_type>
                <selector>[name="type"]</selector>
                <input>select</input>
            </product_type>
        </fields>
    </settings>
    <general>
        <class>\Mage\Adminhtml\Test\Block\Widget\Tab</class>
        <selector>//ul[@id="product_info_tabs"]/li[1]/a</selector>
        <strategy>xpath</strategy>
        <wrapper>product</wrapper>
        <fields>
            <name />
            <description />
            <short_description />
            <sku />
            <weight />
            <status>
                <input>select</input>
            </status>
            <url_key />
            <visibility>
                <input>select</input>
            </visibility>
        </fields>
    </general>
    <prices>
        <class>\Mage\Adminhtml\Test\Block\Catalog\Product\Edit\Tab\Prices</class>
        <selector>//ul[@id="product_info_tabs"]/li[2]/a</selector>
        <strategy>xpath</strategy>
        <wrapper>product</wrapper>
        <fields>
            <price />
            <tax_class_id>
                <input>select</input>
            </tax_class_id>
            <tier_price />
            <group_price />
            <special_price />
        </fields>
    </prices>
    <inventory>
        <class>\Mage\Adminhtml\Test\Block\Widget\Tab</class>
        <selector>#product_info_tabs_inventory</selector>
        <wrapper>product</wrapper>
        <fields>
            <stock_data composite="1">
                <qty>
                    <selector>[name="product[stock_data][qty]"]</selector>
                </qty>
                <is_in_stock>
                    <selector>[name="product[stock_data][is_in_stock]"]</selector>
                    <input>select</input>
                </is_in_stock>
                <use_config_manage_stock>
                    <selector>[name="product[stock_data][use_config_manage_stock]"]</selector>
                    <input>checkbox</input>
                </use_config_manage_stock>
                <manage_stock>
                    <selector>[name="product[stock_data][manage_stock]"]</selector>
                    <input>select</input>
                </manage_stock>
                <use_config_min_qty>
                    <selector>[name='product[stock_data][use_config_min_qty]']</selector>
                    <input>checkbox</input>
                </use_config_min_qty>
                <min_qty>
                    <selector>[name='product[stock_data][min_qty]']</selector>
                </min_qty>
            </stock_data>
        </fields>
    </inventory>
    <categories>
        <class>\Mage\Adminhtml\Test\Block\Catalog\Product\Edit\Tab\Categories</class>
        <selector>#product_info_tabs_categories</selector>
        <wrapper>product</wrapper>
        <fields>
            <category_ids>
                <selector>#product-categories</selector>
            </category_ids>
        </fields>
    </categories>
    <custom-options>
        <class>\Mage\Adminhtml\Test\Block\Catalog\Product\Edit\Tab\CustomOptions</class>
        <selector>#product_info_tabs_customer_options</selector>
        <strategy>css selector</strategy>
        <fields>
            <title>
                <selector>input[id$='_title']</selector>
                <strategy>css selector</strategy>
            </title>
            <is_require>
                <selector>select[id$='_is_require']</selector>
                <strategy>css selector</strategy>
                <input>select</input>
            </is_require>
            <type>
                <selector>select[id$='_type']</selector>
                <strategy>css selector</strategy>
                <input>optgroupselect</input>
            </type>
        </fields>
    </custom-options>
    <super-settings>
        <class>\Mage\Adminhtml\Test\Block\Catalog\Product\Edit\Tab\SuperSettings</class>
        <selector>#product_info_tabs_super_settings</selector>
        <strategy>css selector</strategy>
        <fields>
            <attribute>
                <selector>//tr[td[@class="label" and label[text()="%s"]]]//td[@class="value"]/input</selector>
                <input>checkbox</input>
                <strategy>xpath</strategy>
            </attribute>
        </fields>
    </super-settings>
    <configurable>
        <class>\Mage\Adminhtml\Test\Block\Catalog\Product\Edit\Tab\Configurable</class>
        <selector>#product_info_tabs_configurable</selector>
        <strategy>css selector</strategy>
    </configurable>
    <related-products>
        <class>\Mage\Adminhtml\Test\Block\Catalog\Product\Edit\Tab\Related</class>
        <selector>#product_info_tabs_related</selector>
        <strategy>css selector</strategy>
    </related-products>
    <crosssells>
        <class>\Mage\Adminhtml\Test\Block\Catalog\Product\Edit\Tab\Crosssell</class>
        <selector>#product_info_tabs_crosssell</selector>
        <strategy>css selector</strategy>
    </crosssells>
    <up-sells>
        <class>\Mage\Adminhtml\Test\Block\Catalog\Product\Edit\Tab\Upsell</class>
        <selector>#product_info_tabs_upsell</selector>
        <strategy>css selector</strategy>
    </up-sells>
    <gift-options>
        <class>\Mage\Adminhtml\Test\Block\Widget\Tab</class>
        <selector>#product_info_tabs_group_17</selector>
        <strategy>css selector</strategy>
        <wrapper>product</wrapper>
        <fields>
            <use_config_gift_message_available>
                <input>checkbox</input>
            </use_config_gift_message_available>
            <gift_message_available>
                <input>select</input>
            </gift_message_available>
            <gift_wrapping_available>
                <input>select</input>
            </gift_wrapping_available>
            <gift_wrapping_price />
        </fields>
    </gift-options>
    <websites>
        <class>\Mage\Adminhtml\Test\Block\Catalog\Product\Edit\Tab\Websites</class>
        <selector>#product_info_tabs_websites</selector>
        <strategy>css selector</strategy>
        <fields>
            <website>
                <selector>//*[@class="website-name" and .//label[text()="%s"]]/input</selector>
                <input>checkbox</input>
                <strategy>xpath</strategy>
            </website>
        </fields>
    </websites>
    <associated>
        <class>\Mage\Adminhtml\Test\Block\Catalog\Product\Edit\Tab\AssociatedProducts</class>
        <selector>#product_info_tabs_super</selector>
        <strategy>css selector</strategy>
    </associated>
</tabs>


text:
module.exports = function(grunt) {

  grunt.loadNpmTasks('grunt-mocha-test');
  grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.initConfig({
    mochaTest: {
      test: {
        options: {
          reporter: 'spec',
          clearRequireCache: true,
        },
        src: ['test/*.js'],
      },
    },

    watch: {
      js: {
        options: {
          spawn: false,
        },
        files: ['build.js', 'test/*.js'],
        tasks: ['default'],
      },
    },
  });

  // On watch events, if the changed file is a test file then configure mochaTest to only
  // run the tests from that file. Otherwise run all the tests
  const defaultTestSrc = grunt.config('mochaTest.test.src');
  grunt.event.on('watch', function(action, filepath) {
    grunt.config('mochaTest.test.src', defaultTestSrc);
    if (filepath.match('test/')) {
      grunt.config('mochaTest.test.src', filepath);
    }
  });

  grunt.registerTask('default', 'mochaTest');
};


text:
clevertap-ruby
==============

Module providing access to the [CleverTap](https://clevertap.com/) API

## Install
Add to your Gemfile

```ruby
gem 'clever_tap', github: 'tradeo/clevertap-ruby'
```

## Usage

### Configure the client

Create an instance of `CleverTap` object:
__Available in v0.2.0 but will be depricated as of v1.0.0__
```ruby
CLEVER_TAP = CleverTap.new(account_id: '<your account ID>', passcode: '<your passcode>')
```

You can add configuration settings as parameters like above and/or using a block.
```ruby
CLEVER_TAP = CleverTap.new do |config|
  config.account_id = '<your account ID>' # mandatory
  config.passcode = '<your passcode>' # mandatory
  config.identity_field = 'ID' # default value "identity"

  config.configure_faraday do |faraday_config| # optional
    faraday_config.adapter :httpclient # default adapter "net_http"
  end
end
```

__As of v0.3.0 the new way of setting up CleverTap is:__
```ruby
CleverTap.setup do |config|
  # Default ID could be reset later
  # case by case when uploading Profile/Event
  config.identity_field = 'ID'

  config.account_id = 'the-account-id'
  config.account_passcode = 'the-passcode'
end
```

Then creating a shared instance to use trough the app (v0.3.0 and above)
```ruby
clevertap = CleverTap::Client.new

# You can add callbacks for successfull and failed calls as so:
clevertap.on_successful_upload do |response|
  # log the response as response.to_s
  # response is of type CleverTap::Response
  # having methods `success` (true or false)
  # and `failures` (empty if success == true)
  # contains hash with errors returned from CleverTap endpoint
end

clevertap.on_failed_upload do |response|
  ...
end
```

### Upload a profile

`.upload_profile` accepts as a first argument an object responding to `#to_h` and `#[]`.
```ruby
profile = {
  'identity' => '666',
  'Name' => 'John Bravo'
}

client = CleverTap.new(account_id: '<your account ID>', passcode: '<your passcode>')
response = client.upload_profile(profile)

response.success # => true / false
response.status # => 'success' / 'partial' / 'fail'
response.errors # => [ {  }, ...]
```

__Date field__ used as a time stamp is optional.
If it's missing the current time stamp will be send instead.
The value should respond to `.to_i` and return epoch time.

```ruby
profile = CleverTap::Profile.new(
  data: { 'ID' => 1, 'Name' => 'John Doe' }, # MANDATORY, expects to receive a hash containing the identity field specified in `CleverTap.setup`, or below
  identity_field: 'field_name' | false,      # optional
  fbid: '34322423',                          # optional, facebook id, can replace original identity
  gpid: '34322423',                          # optional, google plus id, can replace original identity
  objectId: '0f5d5fff698245f1ac5f192c',      # optional, uniq CleverTap identifier
  timestamp_field: 'Created At',             # optional, has to be present in the `data` hash, else it throws
  custom_timestamp: 1468308340               # optional, custom time stamp if user needs to set a particular timestamp, not presented in the object, takes precedence
)

clever_tap.upload(profile)
clever_tap.upload(profiles) # works as well with [CleverTap::Profile]
```

### Upload an event

__Available in v0.2.0 but will be depricated as of v1.0.0__
`.upload_event` accepts as a first argument an object responding to `#to_h` and `#[]` and a second parameter keyword argument `name: <name>`.
```ruby
event = {
  'identity' => '666',
  'Name' => 'Jonh Bravo',
  'Cookie ID' => '424242'
}

client = CleverTap.new(account_id: '<your account ID>', passcode: '<your passcode>')
response = client.upload_event(event, name: 'registration')

response.success # => true / false
response.status # => 'success' / 'partial' / 'fail'
response.errors # => [ {  }, ...]
```
__As of v0.3.0 the new way of uploading Event(s) is:__
```ruby
event = CleverTap::Event.new(
  data: { 'ID' => 1, 'Field' => 'Value' } # MANDATORY, expects to receive a hash containing the identity field specified in `CleverTap.setup`, or below
  name: 'Event Name',                     # MANDATORY
  identity_field: 'field_name' | false,   # optional, has to be present in the `data` hash, else it throws
  fbid: '34322423',                       # optional, facebook id, can replace original identity
  gpid: '34322423',                       # optional, google plus id, can replace original identity
  objectId: '0f5d5fff698245f1ac5f192c',   # optional, uniq CleverTap identifier, can replace identity
  timestamp_field: 'Open Time',           # optional, has to be present in the `data` hash, else it throws
  custom_timestamp: 1468308340,           # optional, custom time stamp if user needs to set a particular timestamp, not presented in the object
)

clevertap.upload(event)
clevertap.upload(events) # Works as well with [CleverTap::Event]
```

### Send requests as *Dry Run*

Passing parameter `dry_run: true` to upload methods you can test the data submitted for a validation errors.
The record won't be persisted.

__Available in v0.2.0 but will be depricated as of v1.0.0__
```ruby
  client = CleverTap.new(account_id: '<your account ID>', passcode: '<your passcode>')
  client.upload_profile(profile, dry_run: true)
```

__As of v0.3.0 the new way of using a Dry Run is :__
```ruby
clevertap.upload(event, dry_run: true)
```

### Handle the response

The CleverTap response object has the following interface:
  1. `#status` - __"success"__ / __"partial"__ / __"fail"__
  2. `#success` - `true` when is the status is __"success"__ and `false` otherwise
  3. `#errors` - it's actually `unprocessed` synonym returned when the request is successful(code 200), but will contains the failed records even when the code is different than 200.
  4. `#code` - codes from 200-500. When it's __200__, errors can contains a validation
   error codes. When it's __-1__ the error is custom and more info can be found in the message. More info about the codes can find [CleverTap Docs](https://support.clevertap.com/docs/api/working-with-user-profiles.html#uploading-user-profiles)

####  __More documentation you can find in the specs__


text:
(function() {
  'use strict';

  function Preloader() {
    this.asset = null;
    this.ready = false;
  }

  Preloader.prototype = {
    preload: function () {
      this.asset = this.add.sprite(this.game.width * 0.5 - 110, this.game.height * 0.5 - 10, 'preloader');
      this.load.setPreloadSprite(this.asset);

      this.load.onLoadComplete.addOnce(this.onLoadComplete, this);
      this.loadResources();

      this.ready = true;
    },
    loadResources: function () {
      // load your assets here
      this.game.load.image('menu', './assets/images/menu.png');
      this.game.load.image('gameover', './assets/images/gameover.png');
      this.game.load.image('snake', './assets/images/snake.png');
      this.game.load.image('apple', './assets/images/apple.png');
    },
    create: function () {

    },
    update: function () {
      if (!!this.ready) {
        this.game.state.start('menu');
      }
    },
    onLoadComplete: function () {
      this.ready = true;
    }
  };

  window['snake'] = window['snake'] || {};
  window['snake'].Preloader = Preloader;
}());


text:
django-face-off
===============

A Django application to provide a user switch for admin users without exposing the actual users
passwords.

Features
--
* Admin form to activate the user switch

Supports
--
* Django >= 1.4

Installation
--

``django-face-off`` is currently in development. There aren't any PyPi packages yet.

Get the latest version:

    $ git clone git@github.com:hkage/django-face-off.git#egg=django-face-off

and run the installation via setup.py:

    $ python setup.py install

Usage
--

Add ``face-off`` to the list of installed apps in your settings:

    INSTALLED_APPS = (
        'face_off'
    )

Add the middleware:

    MIDDLEWARE_CLASSES = (
        'face_off.middleware.UserRepresentationMiddleware',
    )

Run the migration:

    $ python manage.py migrate

Testing
--

    $ py.test

Settings
--


text:
import React, {Component} from 'react';
import {StyleSheet, Text, View, Navigator, TouchableHighlight} from 'react-native';

import Login from './Login';
import Home from './Home';
import Team from './Team';
import Profile from './Profile';

const routes = [
  { component: Login,
    title: 'Login to access NBA data'
  },
  { component: Home,
    title: 'Pick a team'
  },
  { component: Team,
    title: 'Show charts'
  },
  { component: Profile,
    title: 'User Profile'
  }
];

export default class App extends Component {
  constructor(props) {
    super(props);
  }

  render() {
    return (
      <Navigator
        style={styles.navigator}
        initialRoute={routes[0]}
        initialRouteStack={routes}
        renderScene={(route, navigator) => {
        let RouteComponent = route.component;
        return (<RouteComponent { ...route } navigator={navigator}/>)
      }}
        navigationBar={< Navigator.NavigationBar style = {
        styles.nav
      }
      routeMapper = { NavigationBarRouteMapper } />}/>
    );
  }
}

var NavigationBarRouteMapper = {
  LeftButton(route, navigator) {
    if (route.title === "Login to access NBA data") {
      return null
    }
    if (route.title !== "User Profile") {
      return (
        <TouchableHighlight
          onPress={() => navigator.push({component: Profile, title: "User Profile"})}>
          <Text style={styles.prevButton}>Profile</Text>
        </TouchableHighlight>
      )
    }
    if (route.title === "User Profile") {
      return (
        <TouchableHighlight
          onPress={() => navigator.push({component: Login, title: 'Login to access NBA data'})}>
          <Text style={styles.prevButton}>Logout</Text>
        </TouchableHighlight>
      )
    } else {
      return null
    }
  },

  RightButton(route, navigator) {
    if (route.title === "Login to access NBA data") {
      return null
    }
    if (route.title !== "Pick a team") {
      return (
        <TouchableHighlight
          onPress={(index) => navigator.push({component: Home, title: "Pick a team"})}>
          <Text style={styles.nextButton}>Search</Text>
        </TouchableHighlight>
      )
    } else {
      return null
    }
  },

  Title(route, navigator, index, navState) {
    return <Text style={styles.navTitle}>Hoop Dreams</Text>
  }
};

const styles = StyleSheet.create({
  navigator: {
    flex: 1
  },
  navTitle: {
    color: '#FFFFFF',
    marginTop: 4,
    fontSize: 16
  },
  prevButton: {
    color: '#FFFFFF',
    fontSize: 16,
    marginLeft: 15,
    marginTop: 2
  },
  nextButton: {
    color: '#FFFFFF',
    fontSize: 16,
    marginRight: 15,
    marginTop: 2
  },
  nav: {
    height: 50,
    backgroundColor: '#00459E'
  }
});


text:
<?php

require(__DIR__ . '/vendor/autoload.php');

Httpful\Bootstrap::init();
RESTful\Bootstrap::init();
Balanced\Bootstrap::init();

Balanced\Settings::$api_key = "ak-test-25ZY8HQwZPuQtDecrxb671LilUya5t5G0";

$reversal = Balanced\Reversal::get("/reversals/RV5Fc1aJCtoFdUKBVdErGJed");
$reversal->description = 'update this description';
$reversal->meta = array(
    "refund.reason" => "user not happy with product",
    "user.notes" => "very polite on the phone",
    "user.satisfaction" => "6",
);
$reversal->save();

?>


text:
<?php

if (!defined('PHPUnit_MAIN_METHOD')) {
    define('PHPUnit_MAIN_METHOD', 'Zend_Controller_Router_Route_ChainTest::main');
}

/** Zend_Config */
require_once 'Zend/Config.php';

/** Zend_Controller_Router_Rewrite */
require_once 'Zend/Controller/Router/Rewrite.php';

/** Zend_Controller_Dispatcher_Standard */
require_once 'Zend/Controller/Dispatcher/Standard.php';

/** Zend_Controller_Router_Route_Chain */
require_once 'Zend/Controller/Router/Route/Chain.php';

/** Zend_Controller_Router_Route */
require_once 'Zend/Controller/Router/Route.php';

/** Zend_Controller_Router_Route_Module */
require_once 'Zend/Controller/Router/Route/Module.php';

/** Zend_Controller_Router_Route_Static */
require_once 'Zend/Controller/Router/Route/Static.php';

/** Zend_Controller_Router_Route_Regex */
require_once 'Zend/Controller/Router/Route/Regex.php';

/** Zend_Controller_Router_Route_Hostname */
require_once 'Zend/Controller/Router/Route/Hostname.php';

/** Zend_Controller_Request_Http */
require_once 'Zend/Controller/Request/Http.php';

/** Zend_Uri_Http */
require_once 'Zend/Uri/Http.php';

/** Zend_Config */
require_once 'Zend/Config.php';

/**
 * @category   Zend
 * @package    Zend_Controller
 * @subpackage UnitTests
 * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @group      Zend_Controller
 * @group      Zend_Controller_Router
 */
class Zend_Controller_Router_Route_ChainTest extends PHPUnit_Framework_TestCase
{
    /**
     * Runs the test methods of this class.
     *
     * @access public
     * @static
     */
    public static function main()
    {

        $suite  = new PHPUnit_Framework_TestSuite("Zend_Controller_Router_Route_ChainTest");
        $result = PHPUnit_TextUI_TestRunner::run($suite);
    }

    public function testChaining()
    {
        $request = new Zend_Controller_Router_ChainTest_Request('http://localhost/foo/bar');

        $foo = new Zend_Controller_Router_Route('foo');
        $bar = new Zend_Controller_Router_Route('bar');

        $chain = $foo->chain($bar);

        $this->assertTrue($chain instanceof Zend_Controller_Router_Route_Chain);
    }

    public function testChainingMatch()
    {
        $chain = new Zend_Controller_Router_Route_Chain();
        $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('foo' => 1));
        $bar = new Zend_Controller_Router_Route_Static('bar', array('bar' => 2));

        $chain->chain($foo)->chain($bar);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/bla');
        $res = $chain->match($request);

        $this->assertFalse($res);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/bar');
        $res = $chain->match($request);

        $this->assertEquals(1, $res['foo']);
        $this->assertEquals(2, $res['bar']);
    }

    /**
     * @group ZF-8812
     */
    public function testChainingMatchToDefaultValues()
    {
        $foo = new Zend_Controller_Router_Route(
            ':foo',
            array('foo' => 'bar'),
            array('foo' => '[a-z]{3}')
        );

        $bar = new Zend_Controller_Router_Route_Module(array(
            'module' => 0,
            'controller' => 1,
            'action' => 2
        ));

        $chain = $foo->chain($bar);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/');
        $res = $chain->match($request);

        $this->assertTrue(is_array($res), 'Route did not match to default values.');
    }

    public function testChainingShortcutMatch()
    {
        $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('foo' => 1));
        $bar = new Zend_Controller_Router_Route_Static('bar', array('bar' => 2, 'controller' => 'foo', 'action' => 'bar'));

        $chain = $foo->chain($bar);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/bar');
        $res = $chain->match($request);

        $this->assertEquals(1, $res['foo']);
        $this->assertEquals(2, $res['bar']);
    }

    public function testChainingMatchFailure()
    {
        $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('foo' => 1));
        $bar = new Zend_Controller_Router_Route_Static('bar', array('bar' => 2, 'controller' => 'foo', 'action' => 'bar'));

        $chain = $foo->chain($bar);

        $request = new Zend_Controller_Router_ChainTest_Request('http://nope.zend.com/bar');
        $res = $chain->match($request);

        $this->assertFalse($res);
    }

    public function testChainingVariableOverriding()
    {
        $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('foo' => 1, 'controller' => 'foo', 'module' => 'foo'));
        $bar = new Zend_Controller_Router_Route('bar', array('bar' => 2, 'controller' => 'bar', 'action' => 'bar'));

        $chain = $foo->chain($bar);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/bar');
        $res = $chain->match($request);

        $this->assertEquals('foo', $res['module']);
        $this->assertEquals('bar', $res['controller']);
        $this->assertEquals('bar', $res['action']);
    }

    public function testChainingTooLongPath()
    {
        $foo = new Zend_Controller_Router_Route_Static('foo', array('foo' => 1));
        $bar = new Zend_Controller_Router_Route_Static('bar', array('bar' => 2));

        $chain = $foo->chain($bar);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/foo/bar/baz');
        $res = $chain->match($request);

        $this->assertFalse($res);
    }

    public function testChainingRegex()
    {
        $foo = new Zend_Controller_Router_Route_Regex('f..', array('foo' => 1));
        $bar = new Zend_Controller_Router_Route_Regex('b..', array('bar' => 2));

        $chain = $foo->chain($bar);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/foo/bar');
        $res = $chain->match($request);

        $this->assertEquals(1, $res['foo']);
        $this->assertEquals(2, $res['bar']);
    }

    public function testChainingModule()
    {
        $foo = new Zend_Controller_Router_Route_Static('foo', array('foo' => 'bar'));
        $bar = new Zend_Controller_Router_Route_Module();

        $chain = $foo->chain($bar);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/foo/bar/baz/var/val');
        $res = $chain->match($request);

        $this->assertEquals('bar', $res['foo']);
        $this->assertEquals('bar', $res['controller']);
        $this->assertEquals('baz', $res['action']);
        $this->assertEquals('val', $res['var']);
    }

    public function testVariableOmittingWhenPartial()
    {
        $foo = new Zend_Controller_Router_Route(':foo', array('foo' => 'foo'));
        $bar = new Zend_Controller_Router_Route(':bar', array('bar' => 'bar'));

        $chain = $foo->chain($bar);

        $path = $chain->assemble(array());

        $this->assertEquals('foo/', $path);
    }

    public function testVariableUnsettingRoute()
    {
        $foo = new Zend_Controller_Router_Route(':foo');
        $bar = new Zend_Controller_Router_Route_Module(array('controller' => 'ctrl', 'action' => 'act'));

        $chain = $foo->chain($bar);

        $path = $chain->assemble(array('foo' => 'bar', 'baz' => 'bat'));

        $this->assertEquals('bar/ctrl/act/baz/bat', $path);
    }

    public function testVariableUnsettingRegex()
    {
        $foo = new Zend_Controller_Router_Route_Regex('([^/]+)', array(), array(1 => 'foo'), '%s');
        $bar = new Zend_Controller_Router_Route_Module(array('controller' => 'ctrl', 'action' => 'act'));

        $chain = $foo->chain($bar);

        $path = $chain->assemble(array('foo' => 'bar', 'baz' => 'bat'));

        $this->assertEquals('bar/ctrl/act/baz/bat', $path);
    }

    public function testChainingSeparatorOverriding()
    {
        $foo = new Zend_Controller_Router_Route_Static('foo', array('foo' => 1));
        $bar = new Zend_Controller_Router_Route_Static('bar', array('bar' => 2));
        $baz = new Zend_Controller_Router_Route_Static('baz', array('baz' => 3));

        $chain = $foo->chain($bar, '.');

        $res = $chain->match(new Zend_Controller_Router_ChainTest_Request('http://localhost/foo.bar'));

        $this->assertTrue(is_array($res));

        $res = $chain->match(new Zend_Controller_Router_ChainTest_Request('http://localhost/foo/bar'));
        $this->assertEquals(false, $res);

        $chain->chain($baz, ':');

        $res = $chain->match(new Zend_Controller_Router_ChainTest_Request('http://localhost/foo.bar:baz'));
        $this->assertTrue(is_array($res));
    }

    public function testI18nChaining()
    {
        $lang = new Zend_Controller_Router_Route(':lang', array('lang' => 'en'));
        $profile = new Zend_Controller_Router_Route('user/:id', array('controller' => 'foo', 'action' => 'bar'));

        $chain = $lang->chain($profile);

        $res = $chain->match(new Zend_Controller_Router_ChainTest_Request('http://localhost/en/user/1'));

        $this->assertEquals('en', $res['lang']);
        $this->assertEquals('1', $res['id']);
    }

    public function testChainingAssembleWithRoutePlaceholder()
    {
        $chain = new Zend_Controller_Router_Route_Chain();

        $foo = new Zend_Controller_Router_Route_Hostname(':account.zend.com');
        $bar = new Zend_Controller_Router_Route('bar/*');

        $chain->chain($foo)->chain($bar);

        $request = new Zend_Controller_Router_ChainTest_Request('http://foobar.zend.com/bar');
        $res = $chain->match($request);

        $this->assertTrue(is_array($res));
        $this->assertRegexp('#[^a-z0-9]?foobar\.zend\.com/bar/foo/bar#i', $chain->assemble(array('account' => 'foobar', 'foo' => 'bar')));
    }

    public function testChainingAssembleWithStatic()
    {
        $chain = new Zend_Controller_Router_Route_Chain();

        $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('foo' => 'foo'));
        $bar = new Zend_Controller_Router_Route_Static('bar', array('bar' => 'bar'));

        $chain->chain($foo)->chain($bar);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/bar');
        $res = $chain->match($request);

        $this->assertTrue(is_array($res));
        $this->assertRegexp('#[^a-z0-9]?www\.zend\.com/bar$#i', $chain->assemble());
    }

    public function testChainingAssembleWithRegex()
    {
        $chain = new Zend_Controller_Router_Route_Chain();

        $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('foo' => 'foo'));
        $bar = new Zend_Controller_Router_Route_Regex('bar', array('bar' => 'bar'), array(), 'bar');

        $chain->chain($foo)->chain($bar);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/bar');
        $res = $chain->match($request);

        $this->assertTrue(is_array($res));
        $this->assertRegexp('#[^a-z0-9]?www\.zend\.com/bar$#i', $chain->assemble());
    }

    public function testChainingReuse()
    {
        $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('foo' => 'foo'));
        $profile = new Zend_Controller_Router_Route('user/:id', array('controller' => 'prof'));
        $article = new Zend_Controller_Router_Route('article/:id', array('controller' => 'art', 'action' => 'art'));

        $profileChain = $foo->chain($profile);
        $articleChain = $foo->chain($article);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/user/1');
        $res = $profileChain->match($request);

        $this->assertTrue(is_array($res));
        $this->assertEquals('prof', $res['controller']);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/article/1');
        $res = $articleChain->match($request);

        $this->assertTrue(is_array($res));
        $this->assertEquals('art', $res['controller']);
        $this->assertEquals('art', $res['action']);
    }

    public function testConfigChaining()
    {
        $routes = array(

            /** Abstract routes */

            'www' => array(
                'type'  => 'Zend_Controller_Router_Route_Hostname',
                'route' => 'www.example.com',
                'abstract' => true
            ),
            'user' => array(
                'type'  => 'Zend_Controller_Router_Route_Hostname',
                'route' => 'user.example.com',
                'abstract' => true
            ),
            'index' => array(
                'type'  => 'Zend_Controller_Router_Route_Static',
                'route' => '',
                'abstract' => true,
                'defaults' => array(
                    'module'     => 'default',
                    'controller' => 'index',
                    'action'     => 'index'
                )
            ),
            'imprint' => array(
                'type'  => 'Zend_Controller_Router_Route_Static',
                'route' => 'imprint',
                'abstract' => true,
                'defaults' => array(
                    'module'     => 'default',
                    'controller' => 'index',
                    'action'     => 'imprint'
                )
            ),
            'profile' => array(
                'type'  => 'Zend_Controller_Router_Route_Static',
                'route' => 'profile',
                'abstract' => true,
                'defaults' => array(
                    'module'     => 'user',
                    'controller' => 'profile',
                    'action'     => 'index'
                )
            ),
            'profile-edit' => array(
                'type'  => 'Zend_Controller_Router_Route_Static',
                'route' => 'profile/edit',
                'abstract' => true,
                'defaults' => array(
                    'module'     => 'user',
                    'controller' => 'profile',
                    'action'     => 'edit'
                )
            ),

            /** Chains */

            'www-index' => array(
                'type'  => 'Zend_Controller_Router_Route_Chain',
                'chain' => 'www, index' // or array('www-subdomain', 'index'); / maybe both
            ),
            'www-imprint' => array(
                'type'  => 'Zend_Controller_Router_Route_Chain',
                'chain' => 'www, imprint'
            ),
            'user-index' => array(
                'type'  => 'Zend_Controller_Router_Route_Chain',
                'chain' => 'user, index'
            ),
            'user-profile' => array(
                'type'  => 'Zend_Controller_Router_Route_Chain',
                'chain' => 'user, profile'
            ),
            'user-profile-edit' => array(
                'type'  => 'Zend_Controller_Router_Route_Chain',
                'chain' => 'user, profile-edit'
            )
        );

        $router = new Zend_Controller_Router_Rewrite();
        $front = Zend_Controller_Front::getInstance();
        $front->resetInstance();
        $front->setDispatcher(new Zend_Controller_Router_ChainTest_Dispatcher());
        $front->setRequest(new Zend_Controller_Router_ChainTest_Request());
        $router->setFrontController($front);

        $router->addConfig(new Zend_Config($routes));

        $request = new Zend_Controller_Router_ChainTest_Request('http://user.example.com/profile');
        $token   = $router->route($request);

        $this->assertEquals('user',    $token->getModuleName());
        $this->assertEquals('profile', $token->getControllerName());
        $this->assertEquals('index',   $token->getActionName());

        $request = new Zend_Controller_Router_ChainTest_Request('http://foo.example.com/imprint');
        $token   = $router->route($request);

        $this->assertEquals('default', $token->getModuleName());
        $this->assertEquals('imprint', $token->getControllerName());
        $this->assertEquals('defact',  $token->getActionName());
    }

    public function testConfigChainingAlternative()
    {
        $routes = array(
            'www' => array(
                'type'  => 'Zend_Controller_Router_Route_Hostname',
                'route' => 'www.example.com',
                'chains' => array(
                    'index' => array(
                        'type'  => 'Zend_Controller_Router_Route_Static',
                        'route' => '',
                        'defaults' => array(
                            'module'     => 'default',
                            'controller' => 'index',
                            'action'     => 'index'
                        )
                    ),
                    'imprint' => array(
                        'type'  => 'Zend_Controller_Router_Route_Static',
                        'route' => 'imprint',
                        'defaults' => array(
                            'module'     => 'default',
                            'controller' => 'index',
                            'action'     => 'imprint'
                        )
                    ),
                )
            ),
            'user' => array(
                'type'  => 'Zend_Controller_Router_Route_Hostname',
                'route' => 'user.example.com',
                'chains' => array(
                    'profile' => array(
                        'type'  => 'Zend_Controller_Router_Route_Static',
                        'route' => 'profile',
                        'defaults' => array(
                            'module'     => 'user',
                            'controller' => 'profile',
                            'action'     => 'index'
                        ),
                        'chains' => array(
                            'standard' => array(
                                'type'  => 'Zend_Controller_Router_Route_Static',
                                'route' => 'standard2',
                                'defaults' => array(
                                    'mode' => 'standard'
                                )
                            ),
                            'detail' => array(
                                'type'  => 'Zend_Controller_Router_Route_Static',
                                'route' => 'detail',
                                'defaults' => array(
                                    'mode' => 'detail'
                                )
                            )
                        )
                    ),
                    'profile-edit' => array(
                        'type'  => 'Zend_Controller_Router_Route_Static',
                        'route' => 'profile/edit',
                        'defaults' => array(
                            'module'     => 'user',
                            'controller' => 'profile',
                            'action'     => 'edit'
                        )
                    ),
                )
            ),
        );

        $router = $this->_getRouter();
        $router->addConfig(new Zend_Config($routes));

        $request = new Zend_Controller_Router_ChainTest_Request('http://user.example.com/profile/edit');
        $token   = $router->route($request);

        $this->assertEquals('user',    $token->getModuleName());
        $this->assertEquals('profile', $token->getControllerName());
        $this->assertEquals('edit',    $token->getActionName());

        $request = new Zend_Controller_Router_ChainTest_Request('http://user.example.com/profile/detail');
        $token   = $router->route($request);

        $this->assertEquals('user',    $token->getModuleName());
        $this->assertEquals('profile', $token->getControllerName());
        $this->assertEquals('index',   $token->getActionName());
        $this->assertEquals('detail',  $token->getParam('mode'));

        $request = new Zend_Controller_Router_ChainTest_Request('http://user.example.com/profile');
        $token   = $router->route($request);
    }

    public function testConfigChainingMixed()
    {
        $routes = array(
            'index' => array(
                'type'  => 'Zend_Controller_Router_Route_Static',
                'route' => '',
                'defaults' => array(
                    'module'     => 'default',
                    'controller' => 'index',
                    'action'     => 'index'
                )
            ),
            'www' => array(
                'type'  => 'Zend_Controller_Router_Route_Hostname',
                'route' => 'www.example.com',
                'chains' => array(
                    'index',
                    'imprint' => array(
                        'type'  => 'Zend_Controller_Router_Route_Static',
                        'route' => 'imprint',
                        'defaults' => array(
                            'module'     => 'default',
                            'controller' => 'index',
                            'action'     => 'imprint'
                        )
                    ),
                )
            ),
            'user' => array(
                'type'  => 'Zend_Controller_Router_Route_Hostname',
                'route' => 'user.example.com',
                'chains' => array(
                    'index',
                    'profile' => array(
                        'type'  => 'Zend_Controller_Router_Route_Static',
                        'route' => 'profile',
                        'defaults' => array(
                            'module'     => 'user',
                            'controller' => 'profile',
                            'action'     => 'index'
                        )
                    ),
                    'profile-edit' => array(
                        'type'  => 'Zend_Controller_Router_Route_Static',
                        'route' => 'profile/edit',
                        'defaults' => array(
                            'module'     => 'user',
                            'controller' => 'profile',
                            'action'     => 'edit'
                        )
                    ),
                )
            ),
        );

        $router = $this->_getRouter();

        $router->addConfig(new Zend_Config($routes));

        $request = new Zend_Controller_Router_ChainTest_Request('http://user.example.com');
        $token   = $router->route($request);

        $this->assertEquals('default',    $token->getModuleName());
        $this->assertEquals('index', $token->getControllerName());
        $this->assertEquals('index',   $token->getActionName());

        $this->assertTrue($router->getRoute('user-profile') instanceof Zend_Controller_Router_Route_Chain);
        $this->assertTrue($router->getRoute('www-imprint') instanceof Zend_Controller_Router_Route_Chain);
        $this->assertTrue($router->getRoute('www-index') instanceof Zend_Controller_Router_Route_Chain);
        $this->assertTrue($router->getRoute('www-index') instanceof Zend_Controller_Router_Route_Chain);
    }

    public function testChainingWorksWithWildcardAndNoParameters()
    {
        $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('module' => 'simple', 'controller' => 'bar', 'action' => 'bar'));
        $bar = new Zend_Controller_Router_Route(':controller/:action/*', array('controller' => 'index', 'action' => 'index'));

        $chain = $foo->chain($bar);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/foo/bar/');
        $res = $chain->match($request);

        $this->assertEquals('simple', $res['module']);
        $this->assertEquals('foo', $res['controller']);
        $this->assertEquals('bar', $res['action']);
    }

    public function testChainingWorksWithWildcardAndOneParameter()
    {
        $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('module' => 'simple', 'controller' => 'foo', 'action' => 'bar'));
        $bar = new Zend_Controller_Router_Route(':controller/:action/*', array('controller' => 'index', 'action' => 'index'));

        $chain = $foo->chain($bar);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/foo/bar/id/12');
        $res = $chain->match($request);

        $this->assertEquals('simple', $res['module']);
        $this->assertEquals('foo', $res['controller']);
        $this->assertEquals('bar', $res['action']);
    }

    /**
     * @group ZF-7848
     */
    public function testChainingWithEmptyStaticRoutesMatchesCorrectly()
    {
        $adminRoute = new Zend_Controller_Router_Route('admin', array(
            'module'     => 'admin',
            'controller' => 'index',
            'action'     => 'index',
        ));
        $indexRoute = new Zend_Controller_Router_Route_Static('', array(
            'module'     => 'admin',
            'controller' => 'index',
            'action'     => 'index',
        ));
        $loginRoute = new Zend_Controller_Router_Route('login', array(
            'module'     => 'admin',
            'controller' => 'login',
            'action'     => 'index',
        ));
        $emptyRoute    = $adminRoute->chain($indexRoute);
        $nonEmptyRoute = $adminRoute->chain($loginRoute);

        $request = new Zend_Controller_Request_Http();
        $request->setPathInfo('/admin');
        $values = $emptyRoute->match($request);
        $this->assertEquals(array(
            'module'     => 'admin',
            'controller' => 'index',
            'action'     => 'index',
        ), $values);

        $request->setPathInfo('/admin/');
        $values = $emptyRoute->match($request);
        $this->assertEquals(array(
            'module'     => 'admin',
            'controller' => 'index',
            'action'     => 'index',
        ), $values);

        $request->setPathInfo('/admin/login');
        $values = $nonEmptyRoute->match($request);
        $this->assertEquals(array(
            'module'     => 'admin',
            'controller' => 'login',
            'action'     => 'index',
        ), $values);
    }

    /**
     * @group ZF-7848
     */
    public function testChainingWithConfiguredEmptyStaticRoutesMatchesCorrectly()
    {
        $routes = array(
            'admin' => array(
                'route' => 'admin',
                'defaults' => array(
                    'module'     => 'admin',
                    'controller' => 'index',
                    'action'     => 'index',
                ),
                'chains' => array(
                    'index' => array(
                        'type'  => 'Zend_Controller_Router_Route_Static',
                        'route' => '',
                        'defaults' => array(
                            'module'     => 'admin',
                            'controller' => 'index',
                            'action'     => 'index',
                        ),
                    ),
                    'login' => array(
                        'route' => 'login',
                        'defaults' => array(
                            'module'     => 'admin',
                            'controller' => 'login',
                            'action'     => 'index',
                        ),
                    ),

                ),
            ),
        );
        $config = new Zend_Config($routes);
        $rewrite = new Zend_Controller_Router_Rewrite();
        $rewrite->addConfig($config);
        $routes = $rewrite->getRoutes();
        $indexRoute = $rewrite->getRoute('admin-index');
        $loginRoute = $rewrite->getRoute('admin-login');

        $request = new Zend_Controller_Request_Http();
        $request->setPathInfo('/admin');
        $values = $indexRoute->match($request);
        $this->assertEquals(array(
            'module'     => 'admin',
            'controller' => 'index',
            'action'     => 'index',
        ), $values);

        $request->setPathInfo('/admin/');
        $values = $indexRoute->match($request);
        $this->assertEquals(array(
            'module'     => 'admin',
            'controller' => 'index',
            'action'     => 'index',
        ), $values);

        $request->setPathInfo('/admin/login');
        $values = $loginRoute->match($request);
        $this->assertEquals(array(
            'module'     => 'admin',
            'controller' => 'login',
            'action'     => 'index',
        ), $values);
    }

    /**
     * @group ZF-7368
     */
    public function testChainingStaticDynamicMatchToDefaults()
    {
        $foo = new Zend_Controller_Router_Route_Static('foo');
        $bar = new Zend_Controller_Router_Route(':bar', array('bar' => 0));
        $chain = $foo->chain($bar);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/foo');
        $res = $chain->match($request);

        $this->assertTrue(is_array($res), 'Route did not match');
        $this->assertEquals(0, $res['bar']);
    }

    /**
     * @group ZF-7368
     */
    public function testChainingStaticDynamicMatchToParams()
    {
        $foo = new Zend_Controller_Router_Route_Static('foo');
        $bar = new Zend_Controller_Router_Route(':bar', array('bar' => 1));
        $chain = $foo->chain($bar);

        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/foo/2');
        $res = $chain->match($request);

        $this->assertTrue(is_array($res), 'Route did not match');
        $this->assertEquals(2, $res['bar']);
    }

    public function testMultipleChainsWithVersion2Routes()
    {

        $foo = new Zend_Controller_Router_Route_SubclassTest('foo');
        $bar = new Zend_Controller_Router_Route_SubclassTest('bar', array('baz' => 'no'));

        $chain = $foo->chain($bar);

        $foo2 = new Zend_Controller_Router_Route_SubclassTest('foo');
        $baz = new Zend_Controller_Router_Route_SubclassTest('baz', array('baz' => 'baz'));

        $chain2 = $foo2->chain($baz);

        $rewrite = new Zend_Controller_Router_Rewrite();
        $rewrite->addRoute('chain2', $chain2); // First In Last Out, we want this to be matched against second
        $rewrite->addRoute('chain1', $chain);
        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/foo/baz');

        $res = $rewrite->route($request);
        $this->assertEquals('baz', $res->getParam('baz'), 'Route did not match');
        $this->assertEquals('chain2', $rewrite->getCurrentRouteName(), 'Routing did not match expected route');
    }

    /**
     * @throws Zend_Controller_Router_Exception
     */
    public function testMultipleChainsResettingPathInfoInSegmentBlock()
    {
        $foo = new Zend_Controller_Router_Route_SubclassTest('notfoo');
        $bar = new Zend_Controller_Router_Route_SubclassTest('bar', array('baz' => 'no'));

        $chain = $foo->chain($bar);

        $static = new Zend_Controller_Router_Route_SimpleSubclassTest('/foo', array('foo' => 'foo'));

        $rewrite = new Zend_Controller_Router_Rewrite();
        $rewrite->addRoute('static', $static); // First In Last Out, we want this to be matched against second
        $rewrite->addRoute('chain', $chain);
        $request = new Zend_Controller_Router_ChainTest_Request('http://www.zend.com/foo');

        $res = $rewrite->route($request);
        $this->assertEquals('foo', $res->getParam('foo'), 'Route did not match');
        $this->assertEquals('static', $rewrite->getCurrentRouteName(), 'Routing did not match expected route');

    }

    /**
     * @group ZF-11443
     */
    public function testGetDefault()
    {
        // Create chained route
        $chain = new Zend_Controller_Router_Route_Chain();

        $foo = new Zend_Controller_Router_Route_Hostname(
            'www.example.com', array('foo' => 'foo')
        );
        $bar = new Zend_Controller_Router_Route_Regex(
            'bar', array('bar' => 'bar'), array(), 'bar'
        );
        $baz = new Zend_Controller_Router_Route_Static(
            'baz', array('baz' => 'baz')
        );

        $chain->chain($foo)->chain($bar)->chain($baz);

        // Test
        $this->assertSame('foo', $chain->getDefault('foo'));
        $this->assertSame('bar', $chain->getDefault('bar'));
        $this->assertSame('baz', $chain->getDefault('baz'));
    }

    /**
     * @group ZF-11443
     */
    public function testGetDefaultPriority()
    {
        // Create chained route
        $chain = new Zend_Controller_Router_Route_Chain();

        $foo = new Zend_Controller_Router_Route_Hostname(
            'www.example.com', array('priority' => 1)
        );
        $bar = new Zend_Controller_Router_Route_Regex(
            'bar', array('priority' => 2), array(), 'bar'
        );
        $baz = new Zend_Controller_Router_Route_Static(
            'baz', array('priority' => 3)
        );

        $chain->chain($foo)->chain($bar)->chain($baz);

        // Test
        $this->assertSame(3, $chain->getDefault('priority'));
    }

    /**
     * @group ZF-11443
     */
    public function testGetDefaults()
    {
        // Create chained route
        $chain = new Zend_Controller_Router_Route_Chain();

        $foo = new Zend_Controller_Router_Route_Hostname(
            'www.example.com', array('foo' => 'foo')
        );
        $bar = new Zend_Controller_Router_Route_Regex(
            'bar', array('bar' => 'bar'), array(), 'bar'
        );
        $baz = new Zend_Controller_Router_Route_Static(
            'baz', array('baz' => 'baz')
        );

        $chain->chain($foo)->chain($bar)->chain($baz);

        // Get defaults
        $values = $chain->getDefaults();

        // Test
        $this->assertTrue(is_array($values));
        $this->assertSame('foo', $values['foo']);
        $this->assertSame('bar', $values['bar']);
        $this->assertSame('baz', $values['baz']);
    }

    /**
     * @group ZF-11443
     */
    public function testGetDefaultsPriority()
    {
        // Create chained route
        $chain = new Zend_Controller_Router_Route_Chain();

        $foo = new Zend_Controller_Router_Route_Hostname(
            'www.zend.com', array('priority' => 1)
        );
        $bar = new Zend_Controller_Router_Route_Regex(
            'bar', array('priority' => 2), array(), 'bar'
        );
        $baz = new Zend_Controller_Router_Route_Static(
            'baz', array('priority' => 3)
        );

        $chain->chain($foo)->chain($bar)->chain($baz);

        // Get defaults
        $values = $chain->getDefaults();

        // Test
        $this->assertSame(3, $values['priority']);
    }

    protected function _getRouter()
    {
        $router = new Zend_Controller_Router_Rewrite();
        $front = Zend_Controller_Front::getInstance();
        $front->resetInstance();
        $front->setRequest(new Zend_Controller_Router_ChainTest_Request());
        $router->setFrontController($front);

        return $router;
    }
}

class Zend_Controller_Router_Route_SimpleSubclassTest extends Zend_Controller_Router_Route_Abstract
{
    /**
     * @var string
     */
    protected $path;

    /**
     * @var array
     */
    protected $params = array();

    public function __construct($path, $params)
    {
        $this->path = $path;
        $this->params = $params;
    }

    public function match($path, $partial = false)
    {
        $path = $path->getPathInfo();
        if ($path == $this->path) {
            $this->setMatchedPath($this->path);
            return $this->params;
        }
        return false;
    }

    public function getVersion()
    {
        return 2;
    }

    public function assemble($data = array(), $reset = false, $encode = false)
    {}

    public static function getInstance(Zend_Config $config)
    {}

}

class Zend_Controller_Router_Route_SubclassTest extends Zend_Controller_Router_Route_Static
{
    public function match($path, $partial = false)
    {
        $path = $path->getPathInfo();
        $match = parent::match($path, $partial);
        if (is_array($match)) {
            $this->setMatchedPath($this->_route);
        }
        return $match;
    }

    public function getVersion()
    {
        return 2;
    }

    public function assemble($data = array(), $reset = false, $encode = false)
    {}

    public static function getInstance(Zend_Config $config)
    {}

}

/**
 * Zend_Controller_Router_ChainTest_Request - request object for router testing
 *
 * @uses Zend_Controller_Request_Interface
 */
class Zend_Controller_Router_ChainTest_Request extends Zend_Controller_Request_Http
{
    protected $_host;
    protected $_port;

    public function __construct($uri = null)
    {
        if (null === $uri) {
            $uri = 'http://localhost/foo/bar/baz/2';
        }

        $uri = Zend_Uri_Http::fromString($uri);
        $this->_host = $uri->getHost();
        $this->_port = $uri->getPort();

        parent::__construct($uri);
    }

    public function getHttpHost() {
        $return = $this->_host;
        if ($this->_port)  $return .= ':' . $this->_port;
        return $return;
    }
}

/**
 * Zend_Controller_Router_ChainTest_Dispatcher - dispatcher object for router testing
 */
class Zend_Controller_Router_ChainTest_Dispatcher extends Zend_Controller_Dispatcher_Standard
{
    public function getDefaultControllerName()
    {
        return 'defctrl';
    }

    public function getDefaultAction()
    {
        return 'defact';
    }
}

if (PHPUnit_MAIN_METHOD == "Zend_Controller_Router_Route_ChainTest::main") {
    Zend_Controller_Router_Route_ChainTest::main();
}


text:
package edu.vt.cbil.visda.view;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.math.plot.Plot2DPanel;
import static org.math.array.DoubleArray.*;

/**
 * Created with Eclipse
 * Author: Jiajing Wang
 * Date: July 19, 2005
 *
 */

/**
 * the class to choose center pointer with mouse-click on projection plot
 *
 */

public class Proj2DClickPanel extends JPanel implements MouseListener{

	   public double cluster2DCenters[][];
	   int clickedNum = 0;
	   int totalNum;

	   //protected JLabel label;
	   protected Plot2DPanel plotPanel;

	   public Proj2DClickPanel(String title, Plot2DPanel Panel, int numPoints) {
		  totalNum = numPoints;
		  //cluster2DCenters = new double[numPoints][2];

	      plotPanel = Panel;
	      plotPanel.removePlotToolBar();
		  plotPanel.plotCanvas.addMouseListener(this);
		  setBorder(BorderFactory.createTitledBorder(title));
		  add(plotPanel);
	   }

	   public void mousePressed(MouseEvent e){}
	   // dont use these so leave them empty
	   public void mouseClicked(MouseEvent e){
		   int[] mouseCurent = new int[2];
		   mouseCurent[0] = e.getX();
		   mouseCurent[1] = e.getY();

		   //if (clickedNum > totalNum-1) {
		   //	   JOptionPane.showMessageDialog(new JFrame(),
			//		    "No more clicked points are wanted.",
			//		    "Inane error",
			//		    JOptionPane.ERROR_MESSAGE);
		   //} else {
			   double d[][] = plotPanel.plotCanvas.centerData;
			   plotPanel.addPlot("SCATTER", "Cluster Center", Color.BLACK, d);

			   // increase the center data storage memory
			   if (clickedNum == 0) {
				   cluster2DCenters = new double[1][2];
				   cluster2DCenters[0] = d[0];
				   clickedNum++;
			   } else {
				   double bak[][] = new double[clickedNum][2];
				   bak = copy(cluster2DCenters);
				   clickedNum++;
				   cluster2DCenters = new double[clickedNum][2];
				   for (int i=0; i<clickedNum-1; i++) {
					   cluster2DCenters[i] = copy(bak[i]);
				   }
				   cluster2DCenters[clickedNum-1] = d[0];
			   }
		   //}
	   }
	   public void mouseEntered(MouseEvent e){}
	   public void mouseExited(MouseEvent e){}
	   public void mouseReleased(MouseEvent e){}

}


text:
var utp = require('../index');
var assert = require('assert');

utp.createServer(function(socket) {
	socket.on('data', function(data) {
		assert(data.toString() === 'client');
		socket.write('server');
	});
}).listen(53454);

var socket = utp.connect(53454);
socket.write('client');
socket.on('data', function(data) {
	assert(data.toString() === 'server');
	process.exit(0);
});

setTimeout(process.exit.bind(process, 1), 5000);


text:
/** @file
 *
 * @defgroup low_power_pwm_example_main main.c
 * @{
 * @ingroup low_power_pwm_example
 * @brief Low Power PWM Example Application main file.
 *
 *
 */

#include <stdbool.h>
#include <stdint.h>
#include "nrf_delay.h"
#include "nrf_gpio.h"
#include "boards.h"
#include "app_error.h"
#include "sdk_errors.h"
#include "app_timer.h"
#include "nrf_drv_clock.h"
#include "app_util_platform.h"
#include "low_power_pwm.h"
#include "nordic_common.h"
#ifdef SOFTDEVICE_PRESENT
#include "softdevice_handler.h"
#endif

/*Timer initialization parameters*/
#define OP_QUEUES_SIZE          3
#define APP_TIMER_PRESCALER     0

/*Ticks before change duty cycle of each LED*/
#define TICKS_BEFORE_CHANGE_0   500
#define TICKS_BEFORE_CHANGE_1   400

static low_power_pwm_t low_power_pwm_0;
static low_power_pwm_t low_power_pwm_1;
static low_power_pwm_t low_power_pwm_2;

/**
 * @brief Function to be called in timer interrupt.
 *
 * @param[in] p_context     General purpose pointer (unused).
 */
void pwm_handler(void * p_context)
{
    uint8_t new_duty_cycle;
    static uint16_t led_0, led_1;
    uint32_t err_code;
    UNUSED_PARAMETER(p_context);

    low_power_pwm_t * pwm_instance = (low_power_pwm_t*)p_context;

    if(pwm_instance->bit_mask == BSP_LED_0_MASK)
    {
        led_0++;

        if(led_0 > TICKS_BEFORE_CHANGE_0)
        {
            new_duty_cycle = pwm_instance->period - pwm_instance->duty_cycle;
            err_code = low_power_pwm_duty_set(pwm_instance, new_duty_cycle);
            led_0 = 0;
            APP_ERROR_CHECK(err_code);
        }
    }
    else if(pwm_instance->bit_mask == BSP_LED_1_MASK)
    {
        led_1++;

        if(led_1 > TICKS_BEFORE_CHANGE_1)
        {
            new_duty_cycle = pwm_instance->period - pwm_instance->duty_cycle;
            err_code = low_power_pwm_duty_set(pwm_instance, new_duty_cycle);
            led_1 = 0;
            APP_ERROR_CHECK(err_code);
        }
    }
    else
    {
        /*empty else*/
    }
}
/**
 * @brief Function to initalize low_power_pwm instances.
 *
 */

void low_power_init(void)
{
    uint32_t err_code;
    low_power_pwm_config_t low_power_pwm_config;

    APP_TIMER_DEF(lpp_timer_0);
    low_power_pwm_config.active_high = false;
    low_power_pwm_config.period = 220;
    low_power_pwm_config.bit_mask = BSP_LED_0_MASK;
    low_power_pwm_config.p_timer_id = &lpp_timer_0;

    err_code = low_power_pwm_init((&low_power_pwm_0), &low_power_pwm_config, pwm_handler);
    APP_ERROR_CHECK(err_code);
    err_code = low_power_pwm_duty_set(&low_power_pwm_0, 20);
    APP_ERROR_CHECK(err_code);

    APP_TIMER_DEF(lpp_timer_1);
    low_power_pwm_config.active_high = false;
    low_power_pwm_config.period = 200;
    low_power_pwm_config.bit_mask = BSP_LED_1_MASK;
    low_power_pwm_config.p_timer_id = &lpp_timer_1;

    err_code = low_power_pwm_init((&low_power_pwm_1), &low_power_pwm_config, pwm_handler);
    APP_ERROR_CHECK(err_code);
    err_code = low_power_pwm_duty_set(&low_power_pwm_1, 150);
    APP_ERROR_CHECK(err_code);

    APP_TIMER_DEF(lpp_timer_2);
    low_power_pwm_config.active_high = false;
    low_power_pwm_config.period = 100;
    low_power_pwm_config.bit_mask = BSP_LED_2_MASK;
    low_power_pwm_config.p_timer_id = &lpp_timer_2;

    err_code = low_power_pwm_init((&low_power_pwm_2), &low_power_pwm_config, pwm_handler);
    APP_ERROR_CHECK(err_code);
    err_code = low_power_pwm_duty_set(&low_power_pwm_2, 20);
    APP_ERROR_CHECK(err_code);

    err_code = low_power_pwm_start((&low_power_pwm_0), low_power_pwm_0.bit_mask);
    APP_ERROR_CHECK(err_code);
    err_code = low_power_pwm_start((&low_power_pwm_1), low_power_pwm_1.bit_mask);
    APP_ERROR_CHECK(err_code);
    err_code = low_power_pwm_start((&low_power_pwm_2), low_power_pwm_2.bit_mask);
    APP_ERROR_CHECK(err_code);
}

#ifndef SOFTDEVICE_PRESENT
static void lfclk_init(void)
{
    uint32_t err_code;
    nrf_drv_clock_config_t nrf_drv_clock_config = NRF_DRV_CLOCK_DEAFULT_CONFIG;

    err_code = nrf_drv_clock_init(&nrf_drv_clock_config);
    APP_ERROR_CHECK(err_code);

    nrf_drv_clock_lfclk_request();
}
#endif

/**
 * @brief Function for application main entry.
 */
int main(void)
{
    uint8_t new_duty_cycle;
    uint32_t err_code;

    // We need the LFCK running for APP_TIMER. In case SoftDevice is in use
    // it will start the LFCK during initialization, otherwise we have to
    // start it manually.
#ifdef SOFTDEVICE_PRESENT
    SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, false);
#else
    lfclk_init();
#endif

    // Start APP_TIMER to generate timeouts.
    APP_TIMER_INIT(APP_TIMER_PRESCALER, OP_QUEUES_SIZE, NULL);

    /*Initialize low power PWM for all 3  channels of RGB or 3 channels of leds on pca10028*/
    low_power_init();

    while (true)
    {
        /* Duty cycle can also be changed from main context. */
        new_duty_cycle = low_power_pwm_2.period - low_power_pwm_2.duty_cycle;
        err_code = low_power_pwm_duty_set(&low_power_pwm_2, new_duty_cycle);
        APP_ERROR_CHECK(err_code);
        nrf_delay_ms(500);

        new_duty_cycle = low_power_pwm_2.period - low_power_pwm_2.duty_cycle;
        err_code = low_power_pwm_duty_set(&low_power_pwm_2, new_duty_cycle);
        APP_ERROR_CHECK(err_code);
        nrf_delay_ms(500);
    }
}

/** @} */


text:
package org.insightech.er.preference.page.translation;

import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.insightech.er.ResourceString;
import org.insightech.er.Resources;
import org.insightech.er.common.widgets.CompositeFactory;
import org.insightech.er.preference.PreferenceInitializer;

public class TranslationPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {

    private TranslationFileListEditor fileListEditor;

    @Override
    public void init(final IWorkbench workbench) {}

    @Override
    protected Control createContents(final Composite parent) {
        final Composite composite = new Composite(parent, SWT.NONE);
        final GridLayout layout = new GridLayout();
        layout.numColumns = 2;
        composite.setLayout(layout);

        CompositeFactory.fillLine(composite, Resources.PREFERENCE_PAGE_MARGIN_TOP);

        fileListEditor = new TranslationFileListEditor(PreferenceInitializer.TRANSLATION_FILE_LIST, ResourceString.getResourceString("label.custom.dictionary.for.translation"), composite);
        fileListEditor.load();

        CompositeFactory.fillLine(composite);

        CompositeFactory.createLabel(composite, "dialog.message.translation.file.store", 2);

        CompositeFactory.createLabel(composite, "dialog.message.translation.file.encode", 2);

        return composite;
    }

    @Override
    protected void performDefaults() {
        fileListEditor.loadDefault();

        super.performDefaults();
    }

    @Override
    public boolean performOk() {
        fileListEditor.store();

        return super.performOk();
    }

}


text:
#ifndef QTDCMIMAGE_H_
#define QTDCMIMAGE_H_

#include <QtGui>

class QtDcmSerie;

/**
 * This class is a representation of a dicom image. It contains dicom id and filename of the image.
 * There is also a pointer to the parent serie (not used for the moment)
 *
 */

class QtDcmImage
{

public:
    /**
     * Default constructor
     */
    QtDcmImage();

    /**
     * Default destructor
     */
    virtual ~QtDcmImage();

    /**
     * Id getter
     *
     * @return _id
     */
    QString id() const;
    /**
     * Id setter
     *
     * @param id a QString
     */
    void setId ( const QString & id );

    /**
     * Image filename getter
     *
     * @return _filename
     */
    QString filename() const;

    /**
     * Image filename setter
     *
     * @param filename a QString containing absolute path
     */
    void setFilename ( const QString & filename );

    /**
     * Parent serie getter
     *
     * @return _p_serie the pointer on the parent serie object
     * @see QtDcmSerie
     */
    QtDcmSerie serie() const;

    /**
     * Parent serie setter
     *
     * @param serie a pointer on the parent serie object
     * @see QtDcmSerie
     */
    void setSerie ( const QtDcmSerie & serie );

private:
    class Private;
    Private * d;
};

#endif /* QTDCMIMAGE_H_ */


text:
<?php
namespace WorkorderEmail\Listener;

class WorkorderEmailListener
{
}

?>


text:
import wx
from libs.gui.hardware_control import HardwareGUIControl

class InfoTab (HardwareGUIControl) :
	"""
	This class represents a GUI for saving descriptions,
	and it is not connected to any hardware
	"""
	def __init__(self, parent=None, dev=None) :
		HardwareGUIControl.__init__(self, parent, dev)

		sizer = wx.BoxSizer(wx.VERTICAL)

		sizer.Add (wx.StaticText(self, label="Description"), flag=wx.LEFT, border=5)

		# Text entry field
		dw, dh = wx.DisplaySize()
		info_txt = wx.TextCtrl (self, style=wx.TE_MULTILINE|wx.TE_RICH2|wx.TE_AUTO_URL, size=(-1, 0.4*dh))
		info_txt.__label__ = "info_txt"
		sizer.Add (info_txt, flag=wx.EXPAND, border=5)

		self.SetSizer(sizer)
		############### GUI is created, now generate settings ######################
		self.CreateSettingsDict()


text:
void printFunction(int (*fPtr)(int)) {
  printf("func is at %p\n", fPtr);
}

int interestingFunc(int a) {
  printf("hai there!\n");
  return a * 2;
}

int main(int argc, char** argv) {
  printFunction(interestingFunc);
}


text:
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using Verse;

namespace RimFridge
{
    [StaticConstructorOnStartup]
    static class IconUtil
    {
        public static Texture2D Normal;
        public static Texture2D Dark;

        static IconUtil()
        {
            Normal = ContentFinder<Texture2D>.Get("UI/Icons/normal", true);
            Dark = ContentFinder<Texture2D>.Get("UI/Icons/dark", true);
        }
    }

    public class CompProperties_ToggleGlower : CompProperties_Glower
    {
        public CompProperties_ToggleGlower()
        {
            base.compClass = typeof(CompToggleGlower);
        }
    }

    class CompToggleGlower : CompGlower
    {
        bool isDarklight = false;

        public override IEnumerable<Gizmo> CompGetGizmosExtra()
        {
            foreach (var g in base.CompGetGizmosExtra())
                yield return g;
            if (ModsConfig.IdeologyActive)
            {
                Texture2D icon;

                if (isDarklight)
                    icon = IconUtil.Dark;
                else
                    icon = IconUtil.Normal;

                yield return new Command_Action
                {
                    action = delegate {
                        isDarklight = !isDarklight;
                        SetLightColor();
                        base.parent.Map.glowGrid.DeRegisterGlower(this);
                        base.parent.Map.glowGrid.RegisterGlower(this);
                        base.parent.Map.mapDrawer.MapMeshDirty(base.parent.Position, MapMeshFlag.Things);
                    },
                    defaultLabel = "RimFridge.ToggleGlowColor".Translate(),
                    defaultDesc = "RimFridge.ToggleGlowColorDesc".Translate(),
                    icon = icon
                };
            }
        }

        public override void PostSpawnSetup(bool respawningAfterLoad)
        {
            base.PostSpawnSetup(respawningAfterLoad);
            SetLightColor();

        }

        private void SetLightColor()
        {
            if (isDarklight)
                base.Props.glowColor = new ColorInt(78, 226, 229, 0);
            else
                base.Props.glowColor = new ColorInt(89, 188, 255, 0); // new ColorInt(252, 187, 113, 0);
        }

        public override void PostExposeData()
        {
            base.PostExposeData();
            Scribe_Values.Look(ref isDarklight, "isDarklight");
        }
    }
}


text:
<?php

use Nette\Http\Request;
use Nette\Http\UrlScript;
use Misiak\Application\Routers\Router;

/**
 * @author Michal Kvasničák <michal.kvasnicak@gmail.com>
 */
class RouterTest extends PHPUnit_Framework_TestCase
{

    public function testGetMethod()
    {
        $router = new Router();

        $router->get('test', 'Homepage:index');

        $this->assertCount(1, $router);

        $url = new UrlScript('http://localhost/test');
        $request = new Request($url, null, null, null, null, null, 'get');

        $this->assertTrue($router->match($request) !== null);
    }

    public function testPostMethod()
    {
        $router = new Router();

        $router->post('test', 'Homepage:index');

        $this->assertCount(1, $router);

        $url = new UrlScript('http://localhost/test');
        $request = new Request($url, null, null, null, null, null, 'post');

        $this->assertTrue($router->match($request) !== null);
    }

    public function testDeleteMethod()
    {
        $router = new Router();

        $router->delete('test', 'Homepage:index');

        $this->assertCount(1, $router);

        $url = new UrlScript('http://localhost/test');
        $request = new Request($url, null, null, null, null, null, 'delete');

        $this->assertTrue($router->match($request) !== null);
    }

    public function testPutMethod()
    {
        $router = new Router();

        $router->put('test', 'Homepage:index');

        $this->assertCount(1, $router);

        $url = new UrlScript('http://localhost/test');
        $request = new Request($url, null, null, null, null, null, 'put');

        $this->assertTrue($router->match($request) !== null);
    }

    public function testAnyMethod()
    {
        $router = new Router();

        $router->any('test', 'Homepage:index');

        $this->assertCount(1, $router);

        $url = new UrlScript('http://localhost/test');
        $request = new Request($url, null, null, null, null, null, 'get');

        $this->assertTrue($router->match($request) !== null);

        $url = new UrlScript('http://localhost/test');
        $request = new Request($url, null, null, null, null, null, 'post');

        $this->assertTrue($router->match($request) !== null);

        $url = new UrlScript('http://localhost/test');
        $request = new Request($url, null, null, null, null, null, 'put');

        $this->assertTrue($router->match($request) !== null);

        $url = new UrlScript('http://localhost/test');
        $request = new Request($url, null, null, null, null, null, 'delete');

        $this->assertTrue($router->match($request) !== null);
    }

    public function testMatchMethod()
    {
        $router = new Router();

        $router->matching('get|post', 'test', 'Homepage:index');

        $router->matching(['get', 'post'], 'test2', 'Homepage:index');

        $this->assertCount(2, $router);

        $url = new UrlScript('http://localhost/test');
        $request = new Request($url, null, null, null, null, null, 'get');

        $this->assertTrue($router->match($request) !== null);

        $url = new UrlScript('http://localhost/test2');
        $request = new Request($url, null, null, null, null, null, 'post');

        $this->assertTrue($router->match($request) !== null);
    }

}


text:
import styles from './list-item.css'
import MetricsBox from '../list-item/metrics-box/metrics-box.component'
import BuildBox from '../list-item/build-box/build-box.component'
import TestBox from '../list-item/test-box/test-box.component'
import ResultBox from '../list-item/result-box/result-box.component'

const name = 'listItem'
export default window.angular
  .module(name, ['ui.bootstrap', MetricsBox.name, BuildBox.name, TestBox.name, ResultBox.name])
  .component(name, {
    bindings: {
      item: '<',
      opened: '<',
      onCollapse: '&'
    },
    controller: class Ctrl {
      constructor () {
        'ngInject'
        this.typoFirewall = 'Firewall'
        this.typoBuild = 'Build'
        this.pendingCode = 1
        this.runningCode = 2
        this.completedCode = 3
        this.rejectedCode = 4
        this.isPending = (this.item.state.code === 1)
      }
      getColor (state) {
        const stateCode = state.code.toString()
        const types = {
          '1': null,
          '2': 'info',
          '3': 'success',
          '4': 'danger',
          'default': null
        }
        return types[stateCode] || types.default
      }
      hasError (boxState) {
        return (boxState.code === this.rejectedCode)
      }
      emitOnCollapse () {
        if (this.isPending) {
          return false
        }
        const id = this.isOpened() ? null : this.item.id
        this.onCollapse({'$event': { id: id }})
      }
      isOpened () {
        return (this.opened === this.item.id)
      }
      isBoxEnabled (state) {
        return (state.code > 1)
      }
    },
    template: `

{{ $ctrl.item.name }}

{{ $ctrl.item.owner }}

{{ $ctrl.item.time | date:'short' }}

{{ $ctrl.item.state.label }}

          <div ng-class="{
              'col-sm-1': $index < 3,
              'col-sm-2': $index === 3,
            }" ng-repeat="box in $ctrl.item.boxes | filter:{type: '!result'}" >
            <uib-progressbar class="${styles.stateBar}"
              ng-if="!$ctrl.isOpened()" value="box.value"
              type="{{ $ctrl.getColor(box) }}"></uib-progressbar>

            <metrics-box ng-switch-when="metrics"
              metrics="box.metrics"
              ng-if="$ctrl.isBoxEnabled(box)"
              ng-class="{ '${styles.fail}': $ctrl.hasError(box) }"></metrics-box>
            <build-box ng-switch-when="build"
              date="box.date"
              ng-if="$ctrl.isBoxEnabled(box)"
              ng-class="{ '${styles.fail}': $ctrl.hasError(box) }"></build-box>
            <test-box ng-switch-when="test"
              name="box.name"
              test="box.tests"
              ng-if="$ctrl.isBoxEnabled(box)"
              ng-class="{ '${styles.fail}': $ctrl.hasError(box) }"></test-box>
            <result-box ng-switch-when="result"
              type="$ctrl.item.type"
              data="box"></result-box>

    `
  })


text:
/**
 * Initialises Keystone's internal nav config
 *
 * @param {Object} nav
 * @api private
 */

var _ = require('underscore');
var debug = require('debug')('keystone:core:initNav');
var utils = require('keystone-utils');

function initNav(sections) {
	debug('initialising nav');
	var keystone = this;

	var nav = {
		sections: [],
		by: {
			list: {},
			section: {}
		}
	};

	if (!sections) {
		sections = {};
		nav.flat = true;
		_.each(this.lists, function(list) {
			if (list.get('hidden')) return;
			sections[list.path] = [list.path];
		});
	}

	_.each(sections, function(section, key) {
		if ('string' === typeof section) {
			section = [section];
		}
		section = {
			lists: section,
			label: nav.flat ? keystone.list(section[0]).label : utils.keyToLabel(key)
		};
		section.key = key;
		section.lists = _.map(section.lists, function(i) {
			if (_.isString(i)) {
				var list = keystone.list(i);
				if (!list) {
					throw new Error('Invalid Keystone Option (nav): list ' + i + ' has not been defined.\n');
				}
				if (list.get('hidden')) {
					throw new Error('Invalid Keystone Option (nav): list ' + i + ' is hidden.\n');
				}
				nav.by.list[list.key] = section;
				return {
					key: list.key,
					label: list.label,
					path: list.path
				};
			} else if (_.isObject(i)) {
				if (!_.has(i, 'key')) {
					throw new Error('Invalid Keystone Option (nav): object ' + i + ' requires a "key" property.\n');
				}
				i.label = i.label || utils.keyToLabel(key);
				i.path = i.path || utils.keyToPath(key);
				i.external = true;
				nav.by.list[i.key] = section;
				return i;
			}
			throw new Error('Invalid Keystone Option (nav): ' + i + ' is in an unrecognized format.\n');
		});
		if (section.lists.length) {
			nav.sections.push(section);
			nav.by.section[section.key] = section;
		}
	});

	return nav;
}

module.exports = initNav;


text:
      Sign up

      <form [formGroup]="signupForm" #f="ngForm" (ngSubmit)="signup()"
            layout="column" layout-fill layout-padding layout-margin>

        <input formControlName="email" type="email" placeholder="Email"></input>
        <input formControlName="password" type="password" placeholder="Password"></input>

          <button md-raised-button class="md-primary" type="submit" aria-label="login">Sign Up</button>

      </form>

{{ error }}

        Already a user?