text:
#region Nequeo Pty Ltd License
/*
    Permission is hereby granted, free of charge, to any person
    obtaining a copy of this software and associated documentation
    files (the "Software"), to deal in the Software without
    restriction, including without limitation the rights to use,
    copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following
    conditions:

    The above copyright notice and this permission notice shall be
    included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    OTHER DEALINGS IN THE SOFTWARE.
*/
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Nequeo.Wpf.Controls
{
    /// <summary>
    /// Specifies where to place the QuickAccessToolBar.
    /// </summary>
    public enum QAPlacement
    {
        Top,
        Bottom
    }
}

redpajama_set_name: RedPajamaGithub


text:
var fs = require('fs');
var path = require('path');
exports.comment = function(res, req){
  fs.readFile(path.join(__dirname, '../', 'AmazeUI/index.html'), function(err, html){
    res.writeHeader(200, {"Content-Type": "text/html"});
    res.write(html);
    res.end();
  });
}


text:
class wxWindow;

namespace faint{
class SpinButtonImpl;
class IntSize;

class SpinButton{
  // A wrapper around a wxWidgets Spinbutton
public:
  SpinButton(wxWindow* parent, const IntSize&, const std::string& toolTip);
  wxWindow* GetRaw();
private:
  SpinButton(const SpinButton&);
  SpinButtonImpl* m_impl;
};

} // namespace

#endif


text:
package com.gilt.gfc.concurrent

import java.util.concurrent.{ExecutorService => JExecutorService, ScheduledExecutorService => JScheduledExecutorService}

import com.gilt.gfc.concurrent.{ScheduledExecutorService => GScheduledExecutorService}

import org.scalatest.mockito.{MockitoSugar => ScalaTestMockitoSugar}
import org.scalatest.{WordSpecLike, Matchers => ScalaTestMatchers}

class JavaConversionsSpec extends WordSpecLike
  with ScalaTestMatchers
  with ScalaTestMockitoSugar {

  "When converting java `ScheduledExecutorService`, and JavaConversions is imported" must {
    "compile" in {

      import JavaConversions._

      val mockJavaSchExecService = mock[JScheduledExecutorService]

      val serviceUnderTest: GScheduledExecutorService = mockJavaSchExecService
    }
  }

  "When converting java `ExecutorService`, and JavaConversions is imported" must {
    "compile" in {

      import JavaConversions._

      val mockJavaService = mock[JExecutorService]

      val serviceUnderTest: ExecutorService = mockJavaService
    }
  }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>MovingCharacter</title>
<meta name="date" content="2016-01-15">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

pkg_Character

Class MovingCharacter

java.lang.Object

pkg_Character.Character

pkg_Character.MovingCharacter

public class MovingCharacter
extends Character

Version:

2016.01.15

Author:

Valentin Messias

Constructor Summary

Constructors

Constructor and Description

MovingCharacter(java.lang.String pName,
               java.lang.String pText,
               Room pLocation,
               java.util.HashMap<java.lang.String,Room> pRooms)

Method Summary

Methods

Modifier and Type
Method and Description

void
move()

Methods inherited from class pkg_Character.Character

getName, speak

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

MovingCharacter

public MovingCharacter(java.lang.String pName,
               java.lang.String pText,
               Room pLocation,
               java.util.HashMap<java.lang.String,Room> pRooms)

Method Detail

move

public void move()

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
package interfaces;

public interface Buyable {

    double getPrice();
}


text:
function [S, si] = segmeridian(s)
% segmeridian  Splits segments along the prime meridian.
%   SNEW = segmeridian(S) splits segments that cross the prime
%   meridian into two segments, each with one endpoint on the
%   prime meridian. All other segment properties are taken from
%   the original segment.
%

% Wrap to 360
s.lon1 = wrapTo360(s.lon1);
s.lon2 = wrapTo360(s.lon2);

% Get longitude differences
dlon = abs(s.lon1 - s.lon2);
pmcross = dlon > 180;

% Split those segments crossing the meridian
lat = gclatfind(s.lon1(pmcross), s.lat1(pmcross), s.lon2(pmcross), s.lat2(pmcross), 360*ones(sum(pmcross), 1));

% Replicate split segment properties and assign new endpoints

% Isolate split and whole segments
split = structsubset(s, pmcross);
whole = structsubset(s, ~pmcross);

% Replicate the split array
split = structmath(split, split, 'vertcat');

% Insert the split coordinates
split.lon2(1:sum(pmcross)) = 360;
split.lat2(1:sum(pmcross)) = lat;
split.lon1(sum(pmcross)+1:end) = 0;
split.lat1(sum(pmcross)+1:end) = lat;
[split.midLon, split.midLat] = segmentmidpoint(split.lon1, split.lat1, split.lon2, split.lat2);
[split.x1, split.y1, split.z1] = sph2cart(DegToRad(split.lon1), DegToRad(split.lat1), 6371);
[split.x2, split.y2, split.z2] = sph2cart(DegToRad(split.lon2), DegToRad(split.lat2), 6371);

% Stitch together the whole and split structures
S = structmath(split, whole, 'vertcat');

% Indices of split segments
si = find(pmcross);


text:
package com.pinterest.deployservice.bean;

public enum DeployState {
    /*
     * Active deploy yet to reach success or fail threshold
     */
    RUNNING,
    /*
     * Active deploy exceeded fail threshold
     */
    FAILING,
    /*
     * Active deploy exceeded success threshold
     */
    SUCCEEDING,
    /*
     * Inactive deploy completed successfully
     */
    SUCCEEDED,
    /*
     * Inactive deploy did not complete or failed
     */
    ABORTED
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeCleanup;
using Microsoft.CodeAnalysis.Formatting;
using Microsoft.CodeAnalysis.Formatting.Rules;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Simplification;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.ExtractMethod
{
    internal class ExtractMethodResult
    {
        /// <summary>
        /// True if the extract method operation succeeded.
        /// </summary>
        public bool Succeeded { get; }

        /// <summary>
        /// True if the extract method operation is possible if the original span is adjusted.
        /// </summary>
        public bool SucceededWithSuggestion { get; }

        /// <summary>
        /// The transformed document that was produced as a result of the extract method operation.
        /// </summary>
        public Document? DocumentWithoutFinalFormatting { get; }

        /// <summary>
        /// Formatting rules to apply to <see cref="DocumentWithoutFinalFormatting"/> to obtain the final formatted
        /// document.
        /// </summary>
        public ImmutableArray<AbstractFormattingRule> FormattingRules { get; }

        /// <summary>
        /// The reasons why the extract method operation did not succeed.
        /// </summary>
        public IEnumerable<string> Reasons { get; }

        /// <summary>
        /// the generated method node that contains the extracted code.
        /// </summary>
        public SyntaxNode? MethodDeclarationNode { get; }

        /// <summary>
        /// The name token for the invocation node that replaces the extracted code.
        /// </summary>
        public SyntaxToken InvocationNameToken { get; }

        internal ExtractMethodResult(
            OperationStatusFlag status,
            IEnumerable<string> reasons,
            Document? documentWithoutFinalFormatting,
            ImmutableArray<AbstractFormattingRule> formattingRules,
            SyntaxToken invocationNameToken,
            SyntaxNode? methodDeclarationNode)
        {
            Status = status;

            Succeeded = status.Succeeded() && !status.HasSuggestion();
            SucceededWithSuggestion = status.Succeeded() && status.HasSuggestion();

            Reasons = (reasons ?? SpecializedCollections.EmptyEnumerable<string>()).ToReadOnlyCollection();

            DocumentWithoutFinalFormatting = documentWithoutFinalFormatting;
            FormattingRules = formattingRules;
            InvocationNameToken = invocationNameToken;
            MethodDeclarationNode = methodDeclarationNode;
        }

        /// <summary>
        /// internal status of result. more fine grained reason why it is failed.
        /// </summary>
        internal OperationStatusFlag Status { get; }

        public async Task<(Document document, SyntaxToken invocationNameToken)> GetFormattedDocumentAsync(CodeCleanupOptions cleanupOptions, CancellationToken cancellationToken)
        {
            if (DocumentWithoutFinalFormatting is null)
                throw new InvalidOperationException();

            var annotation = new SyntaxAnnotation();

            var root = await DocumentWithoutFinalFormatting.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
            root = root.ReplaceToken(InvocationNameToken, InvocationNameToken.WithAdditionalAnnotations(annotation));

            var annotatedDocument = DocumentWithoutFinalFormatting.WithSyntaxRoot(root);
            var simplifiedDocument = await Simplifier.ReduceAsync(annotatedDocument, Simplifier.Annotation, cleanupOptions.SimplifierOptions, cancellationToken).ConfigureAwait(false);
            var simplifiedRoot = await simplifiedDocument.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);

            var services = DocumentWithoutFinalFormatting.Project.Solution.Workspace.Services;

            var formattedDocument = simplifiedDocument.WithSyntaxRoot(
                Formatter.Format(simplifiedRoot, Formatter.Annotation, services, cleanupOptions.FormattingOptions, FormattingRules, cancellationToken));

            var formattedRoot = await formattedDocument.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false);
            return (formattedDocument, formattedRoot.GetAnnotatedTokens(annotation).Single());
        }
    }
}


text:
#ifndef TUI_COMMAND_H
#define TUI_COMMAND_H

extern unsigned int tui_dispatch_ctrl_char (unsigned int);

/* Refresh the command window.  */
extern void tui_refresh_cmd_win (void);

#endif


text:
package com.leader.spring04.autowritedtest;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class HelloWorldBean4 {
	@Autowired
	private HelloWorldbean anotherHelloBean;
	private ArrayList<String> t;
	public HelloWorldBean4() {
		System.out.println(new Date() + " create " + this);
	}

	public void hello() {
		anotherHelloBean.hello();
		System.out.println(Arrays.toString(t.toArray()));
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="cz.fely.weightedaverage">

    <application
        android:allowBackup="true"
        android:fullBackupContent="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:supportsRtl="true"
        android:name=".utils.WipeDataUtil"
        android:theme="@style/Light">
        <activity
            android:name=".activities.SettingsActivity"
            android:label="@string/title_activity_settings" />
        <activity
            android:name=".activities.LicenceActivity"
            android:label="@string/action_licenses"
            android:screenOrientation="portrait"
            android:permission="cz.fely.SHOW_LICENSES">
            <intent-filter>
                <action android:name="cz.fely.weightedaverage.SHOW_LICENSES" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".fragments.AboutFragment"
            android:label="@string/aboutAppMenuItem" />
        <activity
            android:name=".activities.SplashScreen">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".activities.MainActivity" />
    </application>
</manifest>


text:
import check                  from 'check-types';
import PermissionLayer        from './permission-layer';
import PermissionTestResult   from './permission-test-result';

let hastobe   = check.assert,
    _Promise  = Promise;

/**
 * Daddy constructor
 *
 * @param {Boolean} mad   If mad, will deny unknown permissions.
 */
export default function Daddy(mad) {

  if (mad) {
    hastobe.boolean(mad);
  }

  let _permissions          = [],
      _lookupTable          = {},
      _lookupCache          = {},
      _defaultParamsGetter  = () => [],
      _mad                  = !!mad;

  /**
   * Finds all satisfying permission layers, or an already cached list.
   *
   * @param   {String} name
   * @return  {Array}
   */
  let _parsePermissionLayers = function(name) {

    let cachedIndices = _lookupCache[name],

        matches       = !!cachedIndices
                        ? cachedIndices.map(
                            function(index) {
                              return _permissions[index];
                            }
                          )
                        : _permissions.filter(
                            function(permission) {
                              return !!permission.match(name);
                            }
                          );

    // cache fresh and matching lookups
    if (matches.length && !cachedIndices) {
      _lookupCache[name] =  matches.map(function(permission){
                              return _lookupTable[permission.toString()]
                            });
    }

    return matches;
  };

  /**
   * A convenience wrapper for results with no layers found.
   * Granted unless dad is mad.
   *
   * @return {Object}
   */
  var _notFoundResult = function() {
    return new PermissionTestResult(!_mad, 'No permission layers matched.')
  };

  /**
   * Run each handler on each permission layer.
   * Short circuit if handler does not return true.
   *
   * @param  {Array}  layers
   * @param  {any}    params
   * @return {Object}
   */
  var _performTest = function(layers, params) {

    let failingResult;

    let allPassed = layers.every(function(layer) {

      return layer.handlers().every(function(handler) {

        let pass = handler(...params);

        // every other value than explicit true is considered a failure
        if (pass !== true) {
          failingResult = new PermissionTestResult(false, pass);
          // short circuit
          return false;
        }

        return true;

      });

    });

    return !!allPassed
      ? new PermissionTestResult(true, 'All permissions granted.')
      : failingResult;

  };

  /**
   * Run handlers synchronously.
   *
   * @param   {Array}   layers
   * @param   {any}     params
   * @return  {Object}  The test result object
   */
  var _syncTester = function(layers, params) {

    // unknown permissions are granted unless dad is mad
    if (!layers.length) {
      return _notFoundResult();
    }

    // just return the result
    return _performTest(layers, params);

  };

  /**
   * Run handlers asynchronously
   *
   * @param   {Array}   layers
   * @param   {any}     params
   * @return  {Promise} A promise that resolves or rejects with a result object
   */
  var _asyncTester = function(layers, params) {

    // unknown permissions are granted unless dad is mad
    if (!layers.length) {
      let promiseMethod = !!_mad ? 'reject' : 'resolve';
      return _Promise[promiseMethod]( _notFoundResult() );
    }

    return new _Promise(function(resolve, reject) {

      let result = _performTest(layers, params);

      if (result.granted) {
        return resolve(result);
      }

      reject(result);

    });

  };

  /**
   * Get a desired check runner.
   *
   * @param   {Function} tester
   * @return  {Function}
   */
  var _getCheckRunner = function(tester) {

    return function(name, ...params) {

      hastobe.string(name, '´name´ parameter must be a string');

      let layers  = _parsePermissionLayers(name);

      params = _defaultParamsGetter().concat(params);

      return tester(layers, params);

    };

  };

  /**
   * Adds a permission handler to a daddy instance
   *
   * @param {(String|RegExp)} pattern
   * @param {[Function]}      handlers
   */
  this.permission = function(pattern, ...handlers) {

    hastobe
      .either.string(pattern)
      .or.instance(pattern, RegExp, 'A permission pattern must be string or regexp.');

    let regex           = check.string(pattern)
                          ? new RegExp('^' + pattern + '$')
                          : new RegExp(pattern),
        lookupTableKey  = regex.toString();

    hastobe.not.assigned( _lookupTable[lookupTableKey] );
    _lookupTable[lookupTableKey] = _permissions.length;

    _permissions.push(
      new PermissionLayer(regex, handlers)
    );

    return this;

  };

  /**
   * Run check synchronously. Returns the result.
   *
   * @param   {String}  name
   * @param   {any}   params
   * @return  {Object}
   * @api     public
   */
  this.check = _getCheckRunner(_syncTester);

  /**
   * Run check asynchronously. Returns a promise resolving or rejecting with the result.
   *
   * @param   {String}  name
   * @param   {any}   params
   * @return  {Promise}
   * @api     public
   */
  this.when = _getCheckRunner(_asyncTester);

  /**
   * Register a param getter function in a daddy instance.
   * It set, will head its' return value in params passed to check.
   * This is especially useful for user authorization when you know for sure
   * that the current user is always needed in checks.
   * e.g ´daddy.setParamsGetter(getCurrentUser)´
   *
   * Note that you can also return multiple params as an array.
   *
   * @param {Function} fn
   */
  this.defineParamsGetter = function(fn) {

    hastobe.function(fn, 'Params getter must be a function');

    _defaultParamsGetter = !!check.array(fn())
                            ? fn
                            : function() {
                                return [fn()];
                              };

    return this;
  };

  /**
   * Define a promise implementation to be used in async checks.
   * Defaults to ES6 Promise.
   *
   * eg. var Promise = require('bluebird');
   *     Daddy.setPromiseImplementation(Promise);
   *
   * Does not try to test if the passed implementation is correct.
   * Give it something odd and expect odd behaviour.
   *
   * @param  {Promise} constructor
   * @return {Promise} instance of constructor, that resolves
   */
  this.setPromiseImplementation = function(promiseConstructor) {

    _Promise = promiseConstructor;

    return _Promise.resolve('Promise implementation changed');

  };

  return this;
}


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

namespace puzzlegen.database {

	public class Database
	{
		private Dictionary<string, DBItem> _masterList;
		private Dictionary<string, DBItem> _spawnableItems;
		private Dictionary<string, DBItem> _nonSpawnableItems;

		private List<DatabaseExtension> _extensions;

		private static Database _instance = null;
		public static Database Instance {
			get {
				if (_instance == null)
					_instance = new Database();
				return _instance;
			}
		}

		public void clearDatabase()
		{
			_masterList = new Dictionary<string, DBItem>();
			_spawnableItems = new Dictionary<string, DBItem>();
			_nonSpawnableItems = new Dictionary<string, DBItem>();
		}

		public void addExtension(DatabaseExtension extension)
		{
			_extensions.Add(extension);
		}

		public void removeExtensions()
		{
			_extensions.Clear();
		}

		public void runExtensions()
		{
			foreach (DatabaseExtension extension in _extensions) {
				extension.runExtension(this);
			}
		}

		public List<string> spawnableItemNames()
		{
			return new List<string>(_spawnableItems.Keys);
		}

		public List<DBItem> getSpawnableItems()
		{
			return new List<DBItem>(_spawnableItems.Values);
		}

		public List<string> allItemNames()
		{
			return new List<string>(_masterList.Keys);
		}

		public List<DBItem> getAllItems()
		{
			return new List<DBItem>(_masterList.Values);
		}

		public Database()
		{
			if (_instance != null)
				throw new UnityException("Tried to spawn multiple item databases");

			_masterList = new Dictionary<string, DBItem>();
			_spawnableItems = new Dictionary<string, DBItem>();
			_nonSpawnableItems = new Dictionary<string, DBItem>();
			_extensions = new List<DatabaseExtension>();
		}

		public void addItem(DBItem item)
		{
			_masterList[item.ClassName] = item;
			if (item.Abstract)
				_nonSpawnableItems[item.ClassName] = item;
			else
				_spawnableItems[item.ClassName] = item;
		}

		public List<DBItem> getItemsWithProperty(string propertyName)
		{
			List<DBItem> filteredList = new List<DBItem>();
			foreach (DBItem item in _spawnableItems.Values)  {
				if (item.propertyExists(propertyName) && !item.Spawned)
					filteredList.Add(item);
			}
			return filteredList;
		}

		public List<string> filterListByProperty(List<string> itemNames, string propertyName)
		{
			List<string> filteredList = new List<string>();
			foreach(string itemName in itemNames) {
				DBItem item = getItem(itemName);
				if (item != null && item.propertyExists(propertyName) && !item.Spawned)
					filteredList.Add(itemName);
			}
			return filteredList;
		}

		public DBItem getItem(string itemName)
		{
			if (_spawnableItems.ContainsKey(itemName))
				return _spawnableItems[itemName];
			return null;
		}

		public bool itemExists(string itemName)
		{
			return _spawnableItems.ContainsKey(itemName);
		}

		public DBItem getItemFromMasterList(string itemName)
		{
			if (_masterList.ContainsKey(itemName))
				return _masterList[itemName];
			return null;
		}

		public bool itemExistsInMasterList(string itemName)
		{
			return _masterList.ContainsKey(itemName);
		}

		public DBItem copyItem(string itemToCopyName, string newItemName)
		{
			if (itemToCopyName == newItemName)
				throw new UnityException("Cannot create a copy of a database item with the same name");
			if (!_masterList.ContainsKey(itemToCopyName))
				throw new UnityException("Cannot create copy of database item " + itemToCopyName + ". Item does not exist in database.");
			if (_masterList.ContainsKey(newItemName))
				throw new UnityException("cannot create new copy " + newItemName + ". An item already exists with that name.");
			DBItem newDBItem = getItem(itemToCopyName).copyToNewName(newItemName);
			addItem(newDBItem);
			return newDBItem;
		}

	}

}


text:
#ifndef CUTOFFS_H
#define CUTOFFS_H

/**----------------------------------------------------------------------------
          Include Files and Type Defines
----------------------------------------------------------------------------**/
#include "matchdefs.h"

typedef uinT16 CLASS_CUTOFF_ARRAY[MAX_NUM_CLASSES];

/**----------------------------------------------------------------------------
          Public Function Prototypes
----------------------------------------------------------------------------**/
void ReadNewCutoffs(const char *Filename,
                    CLASS_TO_INDEX ClassMapper,
                    CLASS_CUTOFF_ARRAY Cutoffs);

/*
#if defined(__STDC__) || defined(__cplusplus)
# define _ARGS(s) s
#else
# define _ARGS(s) ()
#endif*/

/* cutoffs.c
void ReadNewCutoffs
  _ARGS((char *Filename,
  CLASS_TO_INDEX ClassMapper,
  CLASS_CUTOFF_ARRAY Cutoffs));
#undef _ARGS
*/
#endif


text:
**Awesome Suite is currently on hold as Matt pursues his other dreams. Maybe he'll revisit this someday.**

## What is the Awesome Suite?
The Awesome Suite, to be honest, is just me learning how to use electron and putting into action some really weird ideas. It's not meant to be serious, just lots of love and fun!

## What's in the Awesome Suite right now?
Right now, it's the DJ Khaled Button, four Math functions, a DNA Manipulator, Pong and the Settings Pane.

## What's in store for the Awesome Suite?
I'm looking to add a bunch more math functions (such as a Pi Generator, Quadratic solver, list of all prime/all factors, etc.), a DNA reverse/complement/reverse-complementer, a game, and more DJ Khaled stuff. Major key to success.


text:
(function (angular, $, _) {

  angular.module('crmAttachment', ['angularFileUpload']);

  // crmAttachment manages the list of files which are attached to a given entity
  angular.module('crmAttachment').factory('CrmAttachments', function (crmApi, crmStatus, FileUploader, $q) {
    // @param target an Object(entity_table:'',entity_id:'') or function which generates an object
    function CrmAttachments(target) {
      var crmAttachments = this;
      this._target = target;
      this.files = [];
      this.trash = [];
      this.uploader = new FileUploader({
        url: CRM.url('civicrm/ajax/attachment'),
        onAfterAddingFile: function onAfterAddingFile(item) {
          item.crmData = {
            description: ''
          };
        },
        onSuccessItem: function onSuccessItem(item, response, status, headers) {
          crmAttachments.files.push(response.file.values[response.file.id]);
          crmAttachments.uploader.removeFromQueue(item);
        },
        onErrorItem: function onErrorItem(item, response, status, headers) {
          var msg = (response && response.file && response.file.error_message) ? response.file.error_message : ts('Unknown error');
          CRM.alert(item.file.name + ' - ' + msg, ts('Attachment failed'));
          crmAttachments.uploader.removeFromQueue(item);
        }
      });
    }

    angular.extend(CrmAttachments.prototype, {
      // @return Object(entity_table:'',entity_id:'')
      getTarget: function () {
        return (angular.isFunction(this._target) ? this._target() : this._target);
      },
      // @return Promise<Attachment>
      load: function load() {
        var target = this.getTarget();
        var Attachment = this;

        if (target.entity_id) {
          var params = {
            entity_table: target.entity_table,
            entity_id: target.entity_id
          };
          return crmApi('Attachment', 'get', params).then(function (apiResult) {
            Attachment.files = _.values(apiResult.values);
            return Attachment;
          });
        }
        else {
          var dfr = $q.defer();
          Attachment.files = [];
          dfr.resolve(Attachment);
          return dfr.promise;
        }
      },
      // @return Promise
      save: function save() {
        var crmAttachments = this;
        var target = this.getTarget();
        if (!target.entity_table || !target.entity_id) {
          throw "Cannot save attachments: unknown entity_table or entity_id";
        }

        var params = _.extend({}, target);
        params.values = crmAttachments.files;
        return crmApi('Attachment', 'replace', params)
          .then(function () {
            var dfr = $q.defer();

            var newItems = crmAttachments.uploader.getNotUploadedItems();
            if (newItems.length > 0) {
              _.each(newItems, function (item) {
                item.formData = [_.extend({crm_attachment_token: CRM.crmAttachment.token}, target, item.crmData)];
              });
              crmAttachments.uploader.onCompleteAll = function onCompleteAll() {
                delete crmAttachments.uploader.onCompleteAll;
                dfr.resolve(crmAttachments);
              };
              crmAttachments.uploader.uploadAll();
            }
            else {
              dfr.resolve(crmAttachments);
            }

            return dfr.promise;
          });
      },
      // Compute a digest over the list of files. The signature should change if the attachment list has changed
      // (become dirty).
      getAutosaveSignature: function getAutosaveSignature() {
        var sig = [];
        // Attachments have a special lifecycle, and attachments.queue is not properly serializable, so
        // it takes some special effort to figure out a suitable signature. Issues which can cause gratuitous saving:
        //  - Files move from this.uploader.queue to this.files after upload.
        //  - File names are munged after upload.
        //  - Deletes are performed immediately (outside the save process).
        angular.forEach(this.files, function(item) {
          sig.push({f: item.name.replace(/[^a-zA0-Z0-9\.]/, '_'), d: item.description});
        });
        angular.forEach(this.uploader.queue, function(item) {
          sig.push({f: item.file.name.replace(/[^a-zA0-Z0-9\.]/, '_'), d: item.crmData.description});
        });
        angular.forEach(this.trash, function(item) {
          sig.push({f: item.name.replace(/[^a-zA0-Z0-9\.]/, '_'), d: item.description});
        });
        return _.sortBy(sig, 'name');
      },
      // @param Object file APIv3 attachment record (e.g. id, entity_table, entity_id, description)
      deleteFile: function deleteFile(file) {
        var crmAttachments = this;

        var idx = _.indexOf(this.files, file);
        if (idx != -1) {
          this.files.splice(idx, 1);
        }

        this.trash.push(file);

        if (file.id) {
          var p = crmApi('Attachment', 'delete', {id: file.id}).then(
            function () { // success
            },
            function (response) { // error; restore the file
              var msg = angular.isObject(response) ? response.error_message : '';
              CRM.alert(msg, ts('Deletion failed'));
              crmAttachments.files.push(file);

              var trashIdx = _.indexOf(crmAttachments.trash, file);
              if (trashIdx != -1) {
                crmAttachments.trash.splice(trashIdx, 1);
              }
            }
          );
          return crmStatus({start: ts('Deleting...'), success: ts('Deleted')}, p);
        }
      }
    });

    return CrmAttachments;
  });

  // example:
  //   $scope.myAttachments = new CrmAttachments({entity_table: 'civicrm_mailing', entity_id: 123});
  //

  angular.module('crmAttachment').directive('crmAttachments', function ($parse, $timeout) {
    return {
      scope: {
        crmAttachments: '@'
      },
      template: '

',
      link: function (scope, elm, attr) {
        var model = $parse(attr.crmAttachments);
        scope.att = model(scope.$parent);
        scope.ts = CRM.ts(null);
        scope.inclUrl = '~/crmAttachment/attachments.html';

        // delay rendering of child tree until after model has been populated
        scope.ready = true;
      }
    };
  });

})(angular, CRM.$, CRM._);


text:
package javax.swing.event;

import javax.swing.RowSorter;

/**
 * RowSorterEvent provides notification of changes to
 * a RowSorter.  Two types of notification are possible:
 *

 *
Type.SORT_ORDER_CHANGED: indicates the sort order has
 *     changed.  This is typically followed by a notification of:
 *
Type.SORTED: indicates the contents of the model have
 *     been transformed in some way.  For example, the contents may have
 *     been sorted or filtered.
 *

 *
 * @see javax.swing.RowSorter
 * @since 1.6
 */
public class RowSorterEvent extends java.util.EventObject {
    private Type type;
    private int[] oldViewToModel;

    /**
     * Enumeration of the types of RowSorterEvents.
     *
     * @since 1.6
     */
    public enum Type {
        /**
         * Indicates the sort order has changed.
         */
        SORT_ORDER_CHANGED,

        /**
         * Indicates the contents have been newly sorted or
         * transformed in some way.
         */
        SORTED
    }

    /**
     * Creates a RowSorterEvent of type
     * SORT_ORDER_CHANGED.
     *
     * @param source the source of the change
     * @throws IllegalArgumentException if source is
     *         null
     */
    public RowSorterEvent(RowSorter source) {
        this(source, Type.SORT_ORDER_CHANGED, null);
    }

    /**
     * Creates a RowSorterEvent.
     *
     * @param source the source of the change
     * @param type the type of event
     * @param previousRowIndexToModel the mapping from model indices to
     *        view indices prior to the sort, may be null
     * @throws IllegalArgumentException if source or type is
     *         null
     */
    public RowSorterEvent(RowSorter source, Type type,
                          int[] previousRowIndexToModel) {
        super(source);
        if (type == null) {
            throw new IllegalArgumentException("type must be non-null");
        }
        this.type = type;
        this.oldViewToModel = previousRowIndexToModel;
    }

    /**
     * Returns the source of the event as a RowSorter.
     *
     * @return the source of the event as a RowSorter
     */
    public RowSorter getSource() {
        return (RowSorter)super.getSource();
    }

    /**
     * Returns the type of event.
     *
     * @return the type of event
     */
    public Type getType() {
        return type;
    }

    /**
     * Returns the location of index in terms of the
     * model prior to the sort.  This method is only useful for events
     * of type SORTED.  This method will return -1 if the
     * index is not valid, or the locations prior to the sort have not
     * been provided.
     *
     * @param index the index in terms of the view
     * @return the index in terms of the model prior to the sort, or -1 if
     *         the location is not valid or the mapping was not provided.
     */
    public int convertPreviousRowIndexToModel(int index) {
        if (oldViewToModel != null && index >= 0 &&
                index < oldViewToModel.length) {
            return oldViewToModel[index];
        }
        return -1;
    }

    /**
     * Returns the number of rows before the sort.  This method is only
     * useful for events of type SORTED and if the
     * last locations have not been provided will return 0.
     *
     * @return the number of rows in terms of the view prior to the sort
     */
    public int getPreviousRowCount() {
        return (oldViewToModel == null) ? 0 : oldViewToModel.length;
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="at.fh.swengb.resifo_android">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="at.fh.swengb.android_resifo.EditActivity"></activity>
        <activity android:name="at.fh.swengb.android_resifo.PersonalActivity"></activity>
        <activity android:name="at.fh.swengb.android_resifo.AnmeldungActivity"></activity>
        <activity android:name="at.fh.swengb.android_resifo.AbmeldungActivity"></activity>
        <activity android:name="at.fh.swengb.android_resifo.InformationActivity"></activity>
        <activity android:name="at.fh.swengb.android_resifo.OverviewActivity"></activity>
        <activity android:name="at.fh.swengb.android_resifo.MyListActivity"></activity>
        <activity android:name="at.fh.swengb.android_resifo.HauptwohnsitzActivity"></activity>
        <activity android:name="at.fh.swengb.android_resifo.HauptWohnActivity"></activity>
    </application>

</manifest>


text:
var Swipe = require('./card-swipe').stdIn();

new Swipe(function(swipeData){
    console.log(swipeData);
});

console.log('number', Swipe.generate('track_data'))


text:
class Ability
  include CanCan::Ability

  def initialize(user, paper=nil, annotation=nil)
    # HEADS UP - ordering matters here because of how CanCan defines abilities

    if user
      initialize_annotation(user, annotation)
      initialize_author(user, paper)
      initialize_collaborator(user, paper)
      initialize_reviewer(user, paper)
      initialize_editor(user, paper)
      initialize_privileged(user)
    end
  end

  def initialize_collaborator(user, paper)
    if paper
      can :read, Paper if user.collaborator_on?(paper)

      # Can read someone else's annotations
      can :read, Annotation if user.collaborator_on?(paper)
    end
  end

  def initialize_author(user, paper)
    # Can create papers
    can :create, Paper

    if paper

      if user.author_of?(paper)
        # Can read papers if it's theirs or...
        can :read, Paper if user.author_of?(paper)

        # Can respond to annotations from reviewers
        # TODO this isn't actually defining a response to something
        can :create, Annotation

        # Can read their own annotations
        can :read, Annotation, user_id: user.id

        # Can read someone else's annotations
        can :read, Annotation

        can :update,   Paper unless paper.published? || paper.accepted?

      end

      can :destroy, Paper, user_id: user.id

      cannot :destroy, Paper

    end
  end

  def initialize_reviewer(user, paper)
    if paper && user.reviewer_of?(paper)
      # If they are a reviewer of the paper
      can :read, Paper

      can :create, Annotation
      can :read,   Annotation
    end

    can :complete,     Paper, assignments:{user_id:user.id, role:'reviewer'}
    can :make_public,  Paper, assignments:{user_id:user.id, role:'reviewer'}
  end

  def initialize_editor(user, paper)
    if paper && user.editor_of?(paper)
      can :create, Annotation

      # If they are an editor of the paper
      can :read,    Paper
      can :destroy, Paper
      can :update,  Paper

      can :read,   Annotation

      #Paper Transitions
      can :start_review, Paper
      can :accept,       Paper
      can :reject,       Paper

      can :create,       Assignment
      can :destroy,      Assignment

      can :destroy,      Annotation

      # State changes
      can [:start_review, :accept, :reject, :publish], Paper

      can [:unresolve, :dispute, :resolve],            Annotation
    end
  end

  def initialize_privileged(user)
    # Admins can do anything
    if user.admin?
      can :manage, :all
    end
  end

  def initialize_annotation(user, annotation)
    if annotation
      # They can change their annotations unless there are responses to it
      can :update, Annotation, :user_id => user.id unless annotation.has_responses?

      # Authors can't destroy annotations
      cannot :destroy, Annotation
    end

    can :view_annotations,  Paper, assignments:{user_id:user.id}
    can :annotate,          Paper, assignments:{user_id:user.id}
    can :comment,           Paper, assignments:{user_id:user.id}

    # State changes
    can [:unresolve, :dispute, :resolve],
        Annotation, assignment: { user_id: user.id }

  end

end


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.hoangphan.fragment1"
      android:versionCode="1"
      android:versionName="1.0">

    <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="23" />

    <application android:label="@string/app_name" android:theme="@android:style/Theme.Holo.Light"
                 android:icon="@drawable/ic_launcher">
        <activity android:name="CelebsActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name="QuotesActivity"
                  android:label="@string/app_name">
        </activity>
    </application>
</manifest>


text:
from __future__ import unicode_literals

"""This file is part of the django ERP project.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""

from django.test import TestCase

from ..models import Region
from ..utils import *

__author__ = 'Emanuele Bertoldi <emanuele.bertoldi@gmail.com>'
__copyright__ = 'Copyright (c) 2013-2015, django ERP Team'
__version__ = '0.0.1'

class DashboardForUserUtilTestCase(TestCase):
    def setUp(self):
        self.user_model = get_user_model()

    def test_dashboard_for_user(self):
        """Tests retrieving the dashboard owned by user with a given username.
        """
        u1, n = self.user_model.objects.get_or_create(username="u1")

        self.assertTrue(n)

        dashboard = Region.objects.get(slug="user_1_dashboard")

        self.assertEqual(get_dashboard_for(u1.username), dashboard)

    def test_raise_error_on_invalid_username(self):
        """Tests raising an error when an invalid username is given.
        """
        self.assertRaises(Region.DoesNotExist, lambda: get_dashboard_for("u2"))

class UserOfDashboardUtilTestCase(TestCase):
    def setUp(self):
        self.user_model = get_user_model()

    def test_user_of_dashboard(self):
        """Tests retrieving the user of dashboard identified by the given slug.
        """
        u1, n = self.user_model.objects.get_or_create(username="u1")
        dashboard = Region.objects.get(slug="user_1_dashboard")

        self.assertEqual(get_user_of(dashboard.slug), u1)

    def test_raise_error_on_invalid_dashboard(self):
        """Tests raising an error when an invalid dashboard slug is given.
        """
        self.assertRaises(self.user_model.DoesNotExist, lambda: get_user_of("user_2_dashboard"))


text:
permalink: /
variable: page variable
---

## Stats

* {{ site.pages.size }} Pages
* {{ site.posts.size }} Posts
* {{ site.static_files.size }} Static Files
* {{ site.html_pages.size }} HTML Pages
* {{ site.html_files.size }} HTML Files
* {{ site.pages.collections }} Collections

## Tests

* [Archive]({% link archive.md %})
* [Collections]({% link collections.md %})
* [Markdown]({% link markdown.md %})
* [Pages]({% link pages.md %})
* [Plugins]({% link plugins.md %})
* [Static file]({% link static.html %})
* [Tags]({% link tags.md %})
* [Variables]({% link variables.md %})
* {{ page.variable }}
* {{ site.variable }}
* {{ site.data.file_data.key }}


text:
YUI.add(
    "list-builder",
    function(Y, NAME){
        var ListBuilder = Y.namespace('Widgets').ListBuilder = Y.Base.create(
            'ListBuilder',
            Y.Widget,
            [],
            {

                CONTENT_TEMPLATE: '

',
                ITEM_CONTAINER: '

',
                ITEM_TEMPLATE: '{value}',
                ITEM_EDIT_TEMPLATE: '<input class="edit-item" type="text" value="{value}">',

                initializer: function(config){
                    if(config.delimiter){
                        this.set('delimiter', config.delimiter);
                    }
                    if(config.items){
                        this.set('items', config.items);
                    }
                    this.set('validatorFn', config.validatorFn);
                },

                renderUI: function(){
                    var rootNode = this.get('contentBox');
                    this._inputField = Y.Node.create('<input class="enter-item" type="text">');
                    this._inputLI = Y.Node.create('

');
                    this._inputLI.appendChild(this._inputField);
                    rootNode.appendChild(this._inputLI);
                    this._renderListItems(false);
                },

                _renderListItems: function(userChange){
                    var items = this.get('items');
                    if(items){
                        items.forEach(
                            function(item){
                                this._validateAndInsert(item, null, userChange);
                            },
                            this
                        );
                    }
                },

                bindUI: function(){
                    this.after(
                        'itemsChange',
                        function(evt){
                            if(!(evt.source && evt.source == 'UI')){
                                var itemNodes = this.get('contentBox').all('li.list-item');
                                itemNodes.remove(true);
                                this._renderListItems(false);
                            }
                        },
                        this
                    );

                    this.get('contentBox').delegate(
                        'valuechange',
                        function (evt) {
                            var lastChar = evt.newVal.charAt(evt.newVal.length - 1);
                            if(lastChar == this.get('delimiter')){
                                if(this._inputField === evt.target) {
                                    var items = evt.newVal.split(this.get('delimiter'));
                                    items.forEach(
                                        function(item){
                                            if(item.trim() != ''){
                                                this._validateAndInsert(item, null, true);
                                            }
                                        },
                                        this
                                    );
                                }
                                else{
                                    this._finishEditItem(evt);
                                }

                            }

                        },
                        'li input',
                        this
                    );

                    this.get('contentBox').delegate(
                        'click',
                        function(evt){
                            this._editItem(evt);
                            evt.stopPropagation();

                        },
                        '.list-item .item-content',
                        this
                    );

                    this.get('contentBox').delegate(
                        'click',
                        function(evt){
                            this._deleteItem(evt.target.get('parentNode'));
                            evt.stopPropagation();
                        },
                        '.list-item .item-delete',
                        this
                    );

                    this.get('contentBox').delegate(
                        'focus',
                        function(evt){
                            //A hack to put the cursor at the end of the input field
                            this.set('value', this.get('value'));
                        },
                        'input.edit-item'
                    );

                    this.get('contentBox').delegate(
                        'blur',
                        function(evt){
                            this._finishEditItem(evt);
                        },
                        'input.edit-item',
                        this
                    );

                    this.get('contentBox').on(
                        'click',
                        function(evt){
                            if(evt.target === this.get('contentBox')) {
                                this._inputField.focus();
                            }
                        },
                        this
                    );
                },

                _editItem: function(evt){
                    var item = evt.target;
                    var inputNode = Y.Node.create(Y.Lang.sub(this.ITEM_EDIT_TEMPLATE, {value: item.getHTML()}));
                    //inputNode.setAttribute('value', item.getHTML());
                    var liNode = item.get('parentNode');
                    liNode.empty();
                    liNode.removeClass('list-item');
                    liNode.removeClass('invalid');
                    liNode.appendChild(inputNode);
                    inputNode.focus();
                },

                _deleteItem: function(node){
                    var parent = node.get('parentNode');
                    var index = parent.get('children').indexOf(node);

                    var currentValue = this.get('items');
                    currentValue.splice(index, 1);
                    this.set('items', currentValue, {source: 'UI'});
                    node.remove();

                    this._refreshValidState();
                },

                _finishEditItem: function(evt){
                    var inputNode = evt.target;
                    var inputValue = inputNode.get('value');
                    if(inputValue.charAt(inputValue.length - 1) == this.get('delimiter')){
                        inputValue = inputValue.substr(0, inputValue.length - 1);
                    }
                    var liNode = inputNode.get('parentNode');
                    if(inputValue.trim() == ''){
                        _deleteItem(liNode);
                    }
                    this._validateAndInsert(inputValue, liNode, true);
                },

                _validateAndInsert: function(value, liNode, userChange){
                    var validator = this.get('validatorFn');
                    var currentValue = this.get('items').slice();

                    if(!liNode) {
                        liNode = Y.Node.create(this.ITEM_CONTAINER);
                        this.get('contentBox').insert(liNode, this._inputLI);
                        this._inputField.set('value', '');
                        currentValue.push(value);
                    }
                    else{
                        liNode.empty();
                        liNode.addClass('list-item');
                        var index = liNode.get('parentNode').get('children').indexOf(liNode);
                        currentValue.splice(index, 1, value);

                    }
                    liNode.append(Y.Lang.sub(this.ITEM_TEMPLATE, {value: value}));

                    if(userChange) {
                        this.set('items', currentValue, {source: 'UI'});
                    }

                    if(validator &&  validator.apply(this, [value]) !== true){
                        liNode.addClass("invalid");
                    }

                    this._refreshValidState();

                },

                _refreshValidState: function(){
                    var liNodeList = this.get('contentBox').all('li.list-item.invalid');
                    if(liNodeList.size() > 0){
                        this.set('valid', false);
                    }
                    else{
                        this.set('valid', true);
                    }
                }
            },
            {
                ATTRS: {
                    delimiter: {
                        value: ','
                    },
                    validatorFn: {},
                    items: {
                        value: []
                    },
                    valid: {
                        value: true
                    }
                }

            }

        );
    },
    "1.0.0",
    {
        requires: [
            'base',
            'node',
            'widget',
            "event-valuechange"
        ]
    }
);


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="wrap_content" android:layout_width="fill_parent">
        <ImageView android:id="@+id/icon" android:src="@drawable/reminder"
        android:layout_marginLeft="4px" android:layout_marginRight="8px"
        android:layout_height="40px" android:layout_marginTop="8px"
        android:layout_width="30px">
    </ImageView>
    <TextView android:text="@+id/TextView01" android:layout_height="wrap_content" android:id="@+id/label"
        android:textSize="40px" android:layout_marginTop="6px" android:layout_width="fill_parent" android:textColor="@color/black"></TextView>
</LinearLayout>


text:
/**
 * Created by mpbil on 4/11/2017.
 */
import * as types from '../constants/actionTypes';
import api from '../services/apiService';

export function getCurrentUser() {
  return function (dispatch) {
    dispatch({type:types.GET_CURRENT_USER});
    api.get('/user')
    .then(({data})=>dispatch({type:types.GET_CURRENT_USER_RETURNED,user:data}))
    .catch(err=>{
      console.log(err);
      dispatch({type:types.GET_CURRENT_USER_RETURNED,user:{}});
      dispatch({type:types.UNAUTHORIZED_EXCEPTION});
    });
  };
}


text:
.. _module-pw_rpc-py:

---------------------
pw_rpc Python package
---------------------
The ``pw_rpc`` Python package makes it possible to call Pigweed RPCs from
Python. The package includes a ``pw_rpc`` client library, as well as tools for
creating a ``pw_rpc`` console.

pw_rpc.client
=============
.. automodule:: pw_rpc.client
  :members: Client, ClientImpl

pw_rpc.callback_client
======================
.. automodule:: pw_rpc.callback_client
  :members:
    UnaryResponse,
    StreamResponse,
    UnaryCall,
    ServerStreamingCall,
    ClientStreamingCall,
    BidirectionalStreamingCall,

pw_rpc.descriptors
==================
.. automodule:: pw_rpc.descriptors
  :members:
    Channel,
    ChannelManipulator,

pw_rpc.console_tools
====================
.. automodule:: pw_rpc.console_tools
  :members:
     ClientInfo,
     Context,
     Watchdog,
     alias_deprecated_command,
     flattened_rpc_completions,
     help_as_repr,


text:
#if !PORTABLE
using System;
using System.Collections.Specialized;
using AutoMapper.Mappers;
using Should;
using Xunit;

namespace AutoMapper.UnitTests.Mappers
{
    public class NameValueCollectionMapperTests
    {
        public class IsMatch
        {
            [Fact]
            public void ReturnsTrueWhenBothSourceAndDestinationTypesAreNameValueCollection()
            {
                var tp = new TypePair(typeof(NameValueCollection), typeof(NameValueCollection));
                var nvcm = new NameValueCollectionMapper();

                var result = nvcm.IsMatch(tp);

                result.ShouldBeTrue();
            }

            [Fact]
            public void ReturnsIsFalseWhenDestinationTypeIsNotNameValueCollection()
            {
                var tp = new TypePair(typeof(NameValueCollection), typeof(Object));
                var nvcm = new NameValueCollectionMapper();

                var result = nvcm.IsMatch(tp);

                result.ShouldBeFalse();
            }

            [Fact]
            public void ReturnsIsFalseWhenSourceTypeIsNotNameValueCollection()
            {
                var tp = new TypePair(typeof(Object), typeof(NameValueCollection));
                var nvcm = new NameValueCollectionMapper();

                var result = nvcm.IsMatch(tp);

                result.ShouldBeFalse();
            }
        }
        public class Map
        {
            [Fact]
            public void ReturnsNullIfSourceValueIsNull()
            {
                var config = new MapperConfiguration(_ => { });
                var mapper = new Mapper(config);
                var rc = new ResolutionContext(null, new NameValueCollection(), typeof(NameValueCollection), typeof(NameValueCollection), null, new MappingOperationOptions(config.ServiceCtor), mapper);
                var nvcm = new NameValueCollectionMapper();

                var result = nvcm.Map(rc);

                result.ShouldBeNull();
            }

            [Fact]
            public void ReturnsEmptyCollectionWhenSourceCollectionIsEmpty()
            {
                var config = new MapperConfiguration(_ => { });
                var mapper = new Mapper(config);
                var sourceValue = new NameValueCollection();
                var rc = new ResolutionContext(sourceValue, null, typeof(NameValueCollection), typeof(NameValueCollection), null, new MappingOperationOptions(config.ServiceCtor), mapper);
                var nvcm = new NameValueCollectionMapper();

                var result = nvcm.Map(rc) as NameValueCollection;

                result.ShouldBeEmpty();
            }

            [Fact]
            public void ReturnsMappedObjectWithExpectedValuesWhenSourceCollectionHasOneItem()
            {
                var config = new MapperConfiguration(_ => { });
                var mapper = new Mapper(config);
                var sourceValue = new NameValueCollection() { { "foo", "bar" } };
                var rc = new ResolutionContext(sourceValue, new NameValueCollection(), typeof(NameValueCollection), typeof(NameValueCollection), null, new MappingOperationOptions(config.ServiceCtor), mapper);

                var nvcm = new NameValueCollectionMapper();

                var result = nvcm.Map(rc) as NameValueCollection;

                1.ShouldEqual(result.Count);
                "foo".ShouldEqual(result.AllKeys[0]);
                "bar".ShouldEqual(result["foo"]);
            }
        }

    }
}
#endif