text:
package main

import (
	"encoding/json"
	"flag"
	"fmt"
	"net/http"
	"time"

	"github.com/Sirupsen/logrus"
	"k8s.io/test-infra/boskos/ranch"
)

var configPath = flag.String("config", "resources.json", "Path to init resource file")
var storage = flag.String("storage", "", "Path to presistent volume to load the state")

func main() {
	flag.Parse()
	logrus.SetFormatter(&logrus.JSONFormatter{})

	r, err := ranch.NewRanch(*configPath, *storage)
	if err != nil {
		logrus.WithError(err).Fatal("Failed to create ranch! Config: %v, storage : %v", *configPath, *storage)
	}

	http.Handle("/", handleDefault(r))
	http.Handle("/acquire", handleAcquire(r))
	http.Handle("/release", handleRelease(r))
	http.Handle("/reset", handleReset(r))
	http.Handle("/update", handleUpdate(r))
	http.Handle("/metric", handleMetric(r))

	go func() {
		logTick := time.NewTicker(time.Minute).C
		saveTick := time.NewTicker(time.Minute).C
		configTick := time.NewTicker(time.Minute * 10).C
		for {
			select {
			case <-logTick:
				r.LogStatus()
			case <-saveTick:
				r.SaveState()
			case <-configTick:
				r.SyncConfig(*configPath)
			}
		}
	}()

	logrus.Info("Start Service")
	logrus.WithError(http.ListenAndServe(":8080", nil)).Fatal("ListenAndServe returned.")
}

// ErrorToStatus translates error into http code
func ErrorToStatus(err error) int {
	switch err.(type) {
	default:
		return http.StatusInternalServerError
	case *ranch.OwnerNotMatch:
		return http.StatusUnauthorized
	case *ranch.ResourceNotFound:
		return http.StatusNotFound
	case *ranch.StateNotMatch:
		return http.StatusConflict
	}
}

//  handleDefault: Handler for /, always pass with 200
func handleDefault(r *ranch.Ranch) http.HandlerFunc {
	return func(res http.ResponseWriter, req *http.Request) {
		logrus.WithField("handler", "handleDefault").Infof("From %v", req.RemoteAddr)
	}
}

//  handleAcquire: Handler for /acquire
//  Method: POST
// 	URLParams:
//		Required: type=[string]  : type of requested resource
//		Required: state=[string] : current state of the requested resource
//		Required: dest=[string] : destination state of the requested resource
//		Required: owner=[string] : requester of the resource
func handleAcquire(r *ranch.Ranch) http.HandlerFunc {
	return func(res http.ResponseWriter, req *http.Request) {
		logrus.WithField("handler", "handleStart").Infof("From %v", req.RemoteAddr)

		if req.Method != "POST" {
			msg := fmt.Sprintf("Method %v, /acquire only accepts POST.", req.Method)
			logrus.Warning(msg)
			http.Error(res, msg, http.StatusMethodNotAllowed)
			return
		}

		// TODO(krzyzacy) - sanitize user input
		rtype := req.URL.Query().Get("type")
		state := req.URL.Query().Get("state")
		dest := req.URL.Query().Get("dest")
		owner := req.URL.Query().Get("owner")
		if rtype == "" || state == "" || dest == "" || owner == "" {
			msg := fmt.Sprintf("Type: %v, state: %v, dest: %v, owner: %v, all of them must be set in the request.", rtype, state, dest, owner)
			logrus.Warning(msg)
			http.Error(res, msg, http.StatusBadRequest)
			return
		}

		logrus.Infof("Request for a %v %v from %v, dest %v", state, rtype, owner, dest)

		resource, err := r.Acquire(rtype, state, dest, owner)

		if err != nil {
			logrus.WithError(err).Errorf("No available resource")
			http.Error(res, err.Error(), ErrorToStatus(err))
			return
		}

		resJSON, err := json.Marshal(resource)
		if err != nil {
			logrus.WithError(err).Errorf("json.Marshal failed: %v, resource will be released", resource)
			http.Error(res, err.Error(), ErrorToStatus(err))
			resource.Owner = "" // release the resource, though this is not expected to happen.
			return
		}
		logrus.Infof("Resource leased: %v", string(resJSON))
		fmt.Fprint(res, string(resJSON))
		return
	}
}

//  handleRelease: Handler for /release
//  Method: POST
//	URL Params:
//		Required: name=[string]  : name of finished resource
//		Required: owner=[string] : owner of the resource
//		Required: dest=[string]  : dest state
func handleRelease(r *ranch.Ranch) http.HandlerFunc {
	return func(res http.ResponseWriter, req *http.Request) {
		logrus.WithField("handler", "handleDone").Infof("From %v", req.RemoteAddr)

		if req.Method != "POST" {
			msg := fmt.Sprintf("Method %v, /release only accepts POST.", req.Method)
			logrus.Warning(msg)
			http.Error(res, msg, http.StatusMethodNotAllowed)
			return
		}

		name := req.URL.Query().Get("name")
		dest := req.URL.Query().Get("dest")
		owner := req.URL.Query().Get("owner")
		if name == "" || dest == "" || owner == "" {
			msg := fmt.Sprintf("Name: %v, dest: %v, owner: %v, all of them must be set in the request.", name, dest, owner)
			logrus.Warning(msg)
			http.Error(res, msg, http.StatusBadRequest)
			return
		}

		if err := r.Release(name, dest, owner); err != nil {
			logrus.WithError(err).Errorf("Done failed: %v - %v (from %v)", name, dest, owner)
			http.Error(res, err.Error(), ErrorToStatus(err))
			return
		}

		logrus.Infof("Done with resource %v, set to state %v", name, dest)
	}
}

//  handleReset: Handler for /reset
//  Method: POST
//	URL Params:
//		Required: type=[string] : type of resource in interest
//		Required: state=[string] : original state
//		Required: dest=[string] : dest state, for expired resource
//		Required: expire=[durationStr*] resource has not been updated since before {expire}.
func handleReset(r *ranch.Ranch) http.HandlerFunc {
	return func(res http.ResponseWriter, req *http.Request) {
		logrus.WithField("handler", "handleReset").Infof("From %v", req.RemoteAddr)

		if req.Method != "POST" {
			msg := fmt.Sprintf("Method %v, /reset only accepts POST.", req.Method)
			logrus.Warning(msg)
			http.Error(res, msg, http.StatusMethodNotAllowed)
			return
		}

		rtype := req.URL.Query().Get("type")
		state := req.URL.Query().Get("state")
		expireStr := req.URL.Query().Get("expire")
		dest := req.URL.Query().Get("dest")

		logrus.Infof("%v, %v, %v, %v", rtype, state, expireStr, dest)

		if rtype == "" || state == "" || expireStr == "" || dest == "" {
			msg := fmt.Sprintf("Type: %v, state: %v, expire: %v, dest: %v, all of them must be set in the request.", rtype, state, expireStr, dest)
			logrus.Warning(msg)
			http.Error(res, msg, http.StatusBadRequest)
			return
		}

		expire, err := time.ParseDuration(expireStr)
		if err != nil {
			logrus.WithError(err).Errorf("Invalid expiration: %v", expireStr)
			http.Error(res, err.Error(), http.StatusBadRequest)
			return
		}

		rmap := r.Reset(rtype, state, expire, dest)
		resJSON, err := json.Marshal(rmap)
		if err != nil {
			logrus.WithError(err).Errorf("json.Marshal failed: %v", rmap)
			http.Error(res, err.Error(), ErrorToStatus(err))
			return
		}
		logrus.Infof("Resource %v reset successful, %d items moved to state %v", rtype, len(rmap), dest)
		fmt.Fprint(res, string(resJSON))
	}
}

//  handleUpdate: Handler for /update
//  Method: POST
//  URLParams
//		Required: name=[string]  : name of target resource
//		Required: owner=[string] : owner of the resource
//		Required: state=[string] : current state of the resource
func handleUpdate(r *ranch.Ranch) http.HandlerFunc {
	return func(res http.ResponseWriter, req *http.Request) {
		logrus.WithField("handler", "handleUpdate").Infof("From %v", req.RemoteAddr)

		if req.Method != "POST" {
			msg := fmt.Sprintf("Method %v, /update only accepts POST.", req.Method)
			logrus.Warning(msg)
			http.Error(res, msg, http.StatusMethodNotAllowed)
			return
		}

		name := req.URL.Query().Get("name")
		owner := req.URL.Query().Get("owner")
		state := req.URL.Query().Get("state")
		if name == "" || owner == "" || state == "" {
			msg := fmt.Sprintf("Name: %v, owner: %v, state : %v, all of them must be set in the request.", name, owner, state)
			logrus.Warning(msg)
			http.Error(res, msg, http.StatusBadRequest)
			return
		}

		if err := r.Update(name, owner, state); err != nil {
			logrus.WithError(err).Errorf("Update failed: %v - %v (%v)", name, state, owner)
			http.Error(res, err.Error(), ErrorToStatus(err))
			return
		}

		logrus.Info("Updated resource %v", name)
	}
}

//  handleMetric: Handler for /metric
//  Method: GET
func handleMetric(r *ranch.Ranch) http.HandlerFunc {
	return func(res http.ResponseWriter, req *http.Request) {
		logrus.WithField("handler", "handleMetric").Infof("From %v", req.RemoteAddr)

		if req.Method != "GET" {
			logrus.Warning("[BadRequest]method %v, expect GET", req.Method)
			http.Error(res, "/metric only accepts GET", http.StatusMethodNotAllowed)
			return
		}

		fmt.Fprint(res, "To be implemented.\n")
	}
}


text:
using System;
using System.Text;

namespace Hedy.Sys
{
    public static class TokenHelper
    {
        private const char Base64PadCharacter = '=';
        private const char Base64Character62 = '+';
        private const char Base64Character63 = '/';
        private const char Base64UrlCharacter62 = '-';
        private const char Base64UrlCharacter63 = '_';
        private static Encoding textEncoding = Encoding.UTF8;

        public static string ReturnPayLoadJson(string accessToken)
        {
            var tokenParts = accessToken.Split('.');

            if (tokenParts.Length != 3)
                throw new ApplicationException("JWT Token must have three parts separated by '.' characters.");

            return Base64Decode(tokenParts[1]);
        }

        private static void ValidateLifetime(int nbf, int exp)
        {
            DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

            TimeSpan padding = new TimeSpan(0, 5, 0);

            DateTime validFrom = unixEpoch.AddSeconds(nbf); // a partir de
            DateTime validTo = unixEpoch.AddSeconds(exp); // até

            DateTime now = DateTime.UtcNow;

            if (now < (validFrom - padding))
                throw new ApplicationException(string.Format("The token is not valid until {0}.", validFrom));

            if (now > (validTo + padding))
                throw new ApplicationException(string.Format("The token is not valid after {0}.", validFrom));
        }

        private static byte[] DecodeBytes(string arg)
        {
            if (string.IsNullOrEmpty(arg))
                throw new ApplicationException("String to decode cannot be null or empty.");

            StringBuilder sb = new StringBuilder(arg);
            sb.Replace(Base64UrlCharacter62, Base64Character62);
            sb.Replace(Base64UrlCharacter63, Base64Character63);

            int pad = sb.Length % 4;
            sb.Append(Base64PadCharacter, (pad == 0) ? 0 : 4 - pad);

            return Convert.FromBase64String(sb.ToString());
        }

        private static string Base64Decode(string arg)
        {
            return textEncoding.GetString(DecodeBytes(arg));
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
Auth server is an authentication and authorization microservice. It's used to authenticate both users and services.
It also provides a mechanism for managing role based authorization.

Auth server currently implement Oauth2.

Implemented security features

* [x] [No Cleartext Storage of Credentials](https://tools.ietf.org/html/rfc6819#section-5.1.4.1.3)
* [x] [Encryption of Credentials](https://tools.ietf.org/html/rfc6819#section-5.1.4.1.4)
* [x] [Use Short Expiration Time](https://tools.ietf.org/html/rfc6819#section-5.1.5.3)
* [ ] [Limit Number of Usages or One-Time Usage](https://tools.ietf.org/html/rfc6819#section-5.1.5.4)
* [x] [Bind Token to Client id](https://tools.ietf.org/html/rfc6819#section-5.1.5.8)
* [ ] [Automatic Revocation of Derived Tokens If Abuse Is Detected](https://tools.ietf.org/html/rfc6819#section-5.2.1.1)
* [x] [Binding of Refresh Token to "client_id"](https://tools.ietf.org/html/rfc6819#section-5.2.2.2)
* [x] [Refresh Token Rotation](https://tools.ietf.org/html/rfc6819#section-5.2.2.3)
* [x] [Revocation of Refresh Tokens](https://tools.ietf.org/html/rfc6819#section-5.2.2.4)
* [ ] [Validate Pre-Registered "redirect_uri"](https://tools.ietf.org/html/rfc6819#section-5.2.3.5)
* [x] [Binding of Authorization "code" to "client_id"](https://tools.ietf.org/html/rfc6819#section-5.2.4.4)
* [x] [Binding of Authorization "code" to "redirect_uri"](https://tools.ietf.org/html/rfc6819#section-5.2.4.6)
* [x] [Opaque access tokens](https://tools.ietf.org/html/rfc6749#section-1.4)
* [x] [Opaque refresh tokens](https://tools.ietf.org/html/rfc6749#section-1.5)
* [x] [Ensure Confidentiality of Requests](https://tools.ietf.org/html/rfc6819#section-5.1.1)
  * ensures that redirect URIs use https **except localhost**

## Getting started

1. Install Consul

	Consul is the default registry/discovery for go-micro apps. It's however pluggable.
	[https://www.consul.io/intro/getting-started/install.html](https://www.consul.io/intro/getting-started/install.html)

2. Run Consul
	```
	$ consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul
	```

3. Start a mysql database

4. Download and start the service

	```shell
	go get github.com/micro/auth-srv
	auth-srv --database_url="root:root@tcp(192.168.99.100:3306)/auth"
	```

	OR as a docker container

	```shell
	docker run microhq/auth-srv --database_url="root:root@tcp(192.168.99.100:3306)/auth" --registry_address=YOUR_REGISTRY_ADDRESS
	```

## The API
Auth server implements the following RPC Methods

Account
- Read
- Create
- Update
- Delete
- Search

Oauth2
- Authorize
- Token
- Revoke
- Introspect

### Account.Create

```shell
micro query go.micro.srv.auth Account.Create '{"account": {"type": "user", "client_id": "asim", "client_secret": "foobar"}}'
```

### Account.Search

```shell
micro query go.micro.srv.auth Account.Search
{
	"accounts": [
		{
			"client_id": "asim",
			"created": 1.452816108e+09,
			"id": "2c02eea6-bb1b-11e5-9f39-68a86d0d36b6",
			"type": "user",
			"updated": 1.452816108e+09
		}
	]
}
```

### Oauth2.Authorize

Authorization Code Flow

```shell
micro query go.micro.srv.auth Oauth2.Authorize '{"response_type": "code", "client_id": "asim", "state": "mystatetoken", "redirect_uri": "https://foo.bar.com"}'
{
	"code": "cJMKdcx7iwAyhBLzNpmWQsSxpJOnuztB",
	"state": "mystatetoken"
}
```

### Oauth2.Token

Get Token

```shell
micro query go.micro.srv.auth Oauth2.Token '{"client_id": "asim", "client_secret": "foobar", "code": "cJMKdcx7iwAyhBLzNpmWQsSxpJOnuztB", "grant_type": "authorization_code", "redirect_uri": "https://foo.bar.com"}'
{
	"token": {
		"access_token": "V2swWmtsRm50WEtKSDhXSEtFdVlCNUo1WG5iTk9BYjh1dUVnT0JlOW9DS2FjWFg3c1FCaHBDbWFpaUhtQVUxUw==",
		"expires_at": 1.452819823e+09,
		"refresh_token": "OEZJUXBtdnNlTHNIWkhkRkQ4bTJFZkNNYlN6d0RQa2N6dkNwcDY1MkFCY0F5THdPZEFjdzB0a0JzNHpXYlJ4Ng==",
		"scopes": [
			"micro"
		],
		"token_type": "bearer"
	}
}
```

### Oauth2.Revoke

```shell
micro query go.micro.srv.auth Oauth2.Revoke '{"access_token": "V2swWmtsRm50WEtKSDhXSEtFdVlCNUo1WG5iTk9BYjh1dUVnT0JlOW9DS2FjWFg3c1FCaHBDbWFpaUhtQVUxUw=="}'
```


text:
@extends('app')
@section('content')

ERROR REPORTING

@endsection


text:
- [<- to contents...](readme.md)

### Injecting Aspects

In the AspectInjector, injection is done by applying the trigger attribute to a target.
Trigger is created by defining .net attribute class and marking it with ```[Injection]``` attribute.

```c#
// defining aspect
[Aspect(Scope.Global)]
class LogAspect {}

// defining a trigger
[Injection(typeof(LogAspect))]
class Log : Attribute {}
//
```

After the trigger is defined you can apply it to the target:

```c#
class TestClass {
    [Log]
    public void DoSomething() {}
}
```

However the trigger is only an "attempt" to inject something into the target. When the trigger is fired for an aspect and the target then it is up to the aspect to decide if anything is injected. **For instance if the aspect effects are configured to deal only with public members and the target doesn't have such then nothing is injected**.

#### Multi-trigger

Triggers can be defined to inject multiple aspects at a time.

```c#
// defining log aspect
[Aspect(Scope.Global)]
class LogAspect {}

// defining measure execution time aspect
[Aspect(Scope.Global)]
class MeasureAspect {}

// defining a trigger
[Injection(typeof(LogAspect))]
[Injection(typeof(MeasureAspect))]
class LogAll : Attribute {}
```

#### Injection propagation

Trigger propagates injection to submembers of a target. This behaviour will be customizable in future versions.

```c#
[Log]
class TestClass {
    public void DoSomething() {}
    public void DoSomethingElse() {}
}

// equals to

class TestClass {
    [Log]
    public void DoSomething() {}
    [Log]
    public void DoSomethingElse() {}
}

// and in case your dll has the only class - equals to
[assembly: Log]

```

#### Triggers and parameters

Triggers can carry parameters which can be read by an Aspect to execute additional logic.

```c#
[Injection(typeof(LogAspect))]
class Log : Attribute {

    public Level Level { get; }

    public Log (LogLevel level){
        Level = level;
    }
}

class TestClass {
    [Log(Level.Warning)]
    public void DoSomething() {}
}
```

#### Injection suppression

If there is a need to skip injection in some cases, there is an attribute ```SkipInjection```, which can annotate classes, constructors, methods, properties, and events. Once applied, it suppresses any injections to the target.

Please note that inheritance is not taken into account - applying the attribute to a base class doesn't suppress injections to its descendants.


text:
#pragma once
#include <aws/backup/Backup_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/backup/model/Conditions.h>
#include <aws/backup/model/Condition.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace Backup
{
namespace Model
{

  /**
   *
Used to specify a set of resources to a backup plan.

See Also:

   * AWS
   * API Reference

   */
  class AWS_BACKUP_API BackupSelection
  {
  public:
    BackupSelection();
    BackupSelection(Aws::Utils::Json::JsonView jsonValue);
    BackupSelection& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
The display name of a resource selection document. Must contain 1 to 50
     * alphanumeric or '-_.' characters.

     */
    inline const Aws::String& GetSelectionName() const{ return m_selectionName; }

    /**
     *
The display name of a resource selection document. Must contain 1 to 50
     * alphanumeric or '-_.' characters.

     */
    inline bool SelectionNameHasBeenSet() const { return m_selectionNameHasBeenSet; }

    /**
     *
The display name of a resource selection document. Must contain 1 to 50
     * alphanumeric or '-_.' characters.

     */
    inline void SetSelectionName(const Aws::String& value) { m_selectionNameHasBeenSet = true; m_selectionName = value; }

    /**
     *
The display name of a resource selection document. Must contain 1 to 50
     * alphanumeric or '-_.' characters.

     */
    inline void SetSelectionName(Aws::String&& value) { m_selectionNameHasBeenSet = true; m_selectionName = std::move(value); }

    /**
     *
The display name of a resource selection document. Must contain 1 to 50
     * alphanumeric or '-_.' characters.

     */
    inline void SetSelectionName(const char* value) { m_selectionNameHasBeenSet = true; m_selectionName.assign(value); }

    /**
     *
The display name of a resource selection document. Must contain 1 to 50
     * alphanumeric or '-_.' characters.

     */
    inline BackupSelection& WithSelectionName(const Aws::String& value) { SetSelectionName(value); return *this;}

    /**
     *
The display name of a resource selection document. Must contain 1 to 50
     * alphanumeric or '-_.' characters.

     */
    inline BackupSelection& WithSelectionName(Aws::String&& value) { SetSelectionName(std::move(value)); return *this;}

    /**
     *
The display name of a resource selection document. Must contain 1 to 50
     * alphanumeric or '-_.' characters.

     */
    inline BackupSelection& WithSelectionName(const char* value) { SetSelectionName(value); return *this;}

    /**
     *
The ARN of the IAM role that Backup uses to authenticate when backing up the
     * target resource; for example,
     * arn:aws:iam::123456789012:role/S3Access.

     */
    inline const Aws::String& GetIamRoleArn() const{ return m_iamRoleArn; }

    /**
     *
The ARN of the IAM role that Backup uses to authenticate when backing up the
     * target resource; for example,
     * arn:aws:iam::123456789012:role/S3Access.

     */
    inline bool IamRoleArnHasBeenSet() const { return m_iamRoleArnHasBeenSet; }

    /**
     *
The ARN of the IAM role that Backup uses to authenticate when backing up the
     * target resource; for example,
     * arn:aws:iam::123456789012:role/S3Access.

     */
    inline void SetIamRoleArn(const Aws::String& value) { m_iamRoleArnHasBeenSet = true; m_iamRoleArn = value; }

    /**
     *
The ARN of the IAM role that Backup uses to authenticate when backing up the
     * target resource; for example,
     * arn:aws:iam::123456789012:role/S3Access.

     */
    inline void SetIamRoleArn(Aws::String&& value) { m_iamRoleArnHasBeenSet = true; m_iamRoleArn = std::move(value); }

    /**
     *
The ARN of the IAM role that Backup uses to authenticate when backing up the
     * target resource; for example,
     * arn:aws:iam::123456789012:role/S3Access.

     */
    inline void SetIamRoleArn(const char* value) { m_iamRoleArnHasBeenSet = true; m_iamRoleArn.assign(value); }

    /**
     *
The ARN of the IAM role that Backup uses to authenticate when backing up the
     * target resource; for example,
     * arn:aws:iam::123456789012:role/S3Access.

     */
    inline BackupSelection& WithIamRoleArn(const Aws::String& value) { SetIamRoleArn(value); return *this;}

    /**
     *
The ARN of the IAM role that Backup uses to authenticate when backing up the
     * target resource; for example,
     * arn:aws:iam::123456789012:role/S3Access.

     */
    inline BackupSelection& WithIamRoleArn(Aws::String&& value) { SetIamRoleArn(std::move(value)); return *this;}

    /**
     *
The ARN of the IAM role that Backup uses to authenticate when backing up the
     * target resource; for example,
     * arn:aws:iam::123456789012:role/S3Access.

     */
    inline BackupSelection& WithIamRoleArn(const char* value) { SetIamRoleArn(value); return *this;}

    /**
     *
A list of Amazon Resource Names (ARNs) to assign to a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to assign many resources to a backup plan, consider a different
     * resource selection strategy, such as assigning all resources of a resource type
     * or refining your resource selection using tags.

     */
    inline const Aws::Vector<Aws::String>& GetResources() const{ return m_resources; }

    /**
     *
A list of Amazon Resource Names (ARNs) to assign to a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to assign many resources to a backup plan, consider a different
     * resource selection strategy, such as assigning all resources of a resource type
     * or refining your resource selection using tags.

     */
    inline bool ResourcesHasBeenSet() const { return m_resourcesHasBeenSet; }

    /**
     *
A list of Amazon Resource Names (ARNs) to assign to a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to assign many resources to a backup plan, consider a different
     * resource selection strategy, such as assigning all resources of a resource type
     * or refining your resource selection using tags.

     */
    inline void SetResources(const Aws::Vector<Aws::String>& value) { m_resourcesHasBeenSet = true; m_resources = value; }

    /**
     *
A list of Amazon Resource Names (ARNs) to assign to a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to assign many resources to a backup plan, consider a different
     * resource selection strategy, such as assigning all resources of a resource type
     * or refining your resource selection using tags.

     */
    inline void SetResources(Aws::Vector<Aws::String>&& value) { m_resourcesHasBeenSet = true; m_resources = std::move(value); }

    /**
     *
A list of Amazon Resource Names (ARNs) to assign to a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to assign many resources to a backup plan, consider a different
     * resource selection strategy, such as assigning all resources of a resource type
     * or refining your resource selection using tags.

     */
    inline BackupSelection& WithResources(const Aws::Vector<Aws::String>& value) { SetResources(value); return *this;}

    /**
     *
A list of Amazon Resource Names (ARNs) to assign to a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to assign many resources to a backup plan, consider a different
     * resource selection strategy, such as assigning all resources of a resource type
     * or refining your resource selection using tags.

     */
    inline BackupSelection& WithResources(Aws::Vector<Aws::String>&& value) { SetResources(std::move(value)); return *this;}

    /**
     *
A list of Amazon Resource Names (ARNs) to assign to a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to assign many resources to a backup plan, consider a different
     * resource selection strategy, such as assigning all resources of a resource type
     * or refining your resource selection using tags.

     */
    inline BackupSelection& AddResources(const Aws::String& value) { m_resourcesHasBeenSet = true; m_resources.push_back(value); return *this; }

    /**
     *
A list of Amazon Resource Names (ARNs) to assign to a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to assign many resources to a backup plan, consider a different
     * resource selection strategy, such as assigning all resources of a resource type
     * or refining your resource selection using tags.

     */
    inline BackupSelection& AddResources(Aws::String&& value) { m_resourcesHasBeenSet = true; m_resources.push_back(std::move(value)); return *this; }

    /**
     *
A list of Amazon Resource Names (ARNs) to assign to a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to assign many resources to a backup plan, consider a different
     * resource selection strategy, such as assigning all resources of a resource type
     * or refining your resource selection using tags.

     */
    inline BackupSelection& AddResources(const char* value) { m_resourcesHasBeenSet = true; m_resources.push_back(value); return *this; }

    /**
     *
A list of conditions that you define to assign resources to your backup plans
     * using tags. For example, "StringEquals": {"Department":
     * "accounting". Condition operators are case sensitive.

     * ListOfTags differs from Conditions as follows:

     *

When you specify more than one condition, you assign all resources
     * that match AT LEAST ONE condition (using OR logic).

     * ListOfTags only supports StringEquals.
     * Conditions supports StringEquals,
     * StringLike, StringNotEquals, and
     * StringNotLike.

     */
    inline const Aws::Vector<Condition>& GetListOfTags() const{ return m_listOfTags; }

    /**
     *
A list of conditions that you define to assign resources to your backup plans
     * using tags. For example, "StringEquals": {"Department":
     * "accounting". Condition operators are case sensitive.

     * ListOfTags differs from Conditions as follows:

     *

When you specify more than one condition, you assign all resources
     * that match AT LEAST ONE condition (using OR logic).

     * ListOfTags only supports StringEquals.
     * Conditions supports StringEquals,
     * StringLike, StringNotEquals, and
     * StringNotLike.

     */
    inline bool ListOfTagsHasBeenSet() const { return m_listOfTagsHasBeenSet; }

    /**
     *
A list of conditions that you define to assign resources to your backup plans
     * using tags. For example, "StringEquals": {"Department":
     * "accounting". Condition operators are case sensitive.

     * ListOfTags differs from Conditions as follows:

     *

When you specify more than one condition, you assign all resources
     * that match AT LEAST ONE condition (using OR logic).

     * ListOfTags only supports StringEquals.
     * Conditions supports StringEquals,
     * StringLike, StringNotEquals, and
     * StringNotLike.

     */
    inline void SetListOfTags(const Aws::Vector<Condition>& value) { m_listOfTagsHasBeenSet = true; m_listOfTags = value; }

    /**
     *
A list of conditions that you define to assign resources to your backup plans
     * using tags. For example, "StringEquals": {"Department":
     * "accounting". Condition operators are case sensitive.

     * ListOfTags differs from Conditions as follows:

     *

When you specify more than one condition, you assign all resources
     * that match AT LEAST ONE condition (using OR logic).

     * ListOfTags only supports StringEquals.
     * Conditions supports StringEquals,
     * StringLike, StringNotEquals, and
     * StringNotLike.

     */
    inline void SetListOfTags(Aws::Vector<Condition>&& value) { m_listOfTagsHasBeenSet = true; m_listOfTags = std::move(value); }

    /**
     *
A list of conditions that you define to assign resources to your backup plans
     * using tags. For example, "StringEquals": {"Department":
     * "accounting". Condition operators are case sensitive.

     * ListOfTags differs from Conditions as follows:

     *

When you specify more than one condition, you assign all resources
     * that match AT LEAST ONE condition (using OR logic).

     * ListOfTags only supports StringEquals.
     * Conditions supports StringEquals,
     * StringLike, StringNotEquals, and
     * StringNotLike.

     */
    inline BackupSelection& WithListOfTags(const Aws::Vector<Condition>& value) { SetListOfTags(value); return *this;}

    /**
     *
A list of conditions that you define to assign resources to your backup plans
     * using tags. For example, "StringEquals": {"Department":
     * "accounting". Condition operators are case sensitive.

     * ListOfTags differs from Conditions as follows:

     *

When you specify more than one condition, you assign all resources
     * that match AT LEAST ONE condition (using OR logic).

     * ListOfTags only supports StringEquals.
     * Conditions supports StringEquals,
     * StringLike, StringNotEquals, and
     * StringNotLike.

     */
    inline BackupSelection& WithListOfTags(Aws::Vector<Condition>&& value) { SetListOfTags(std::move(value)); return *this;}

    /**
     *
A list of conditions that you define to assign resources to your backup plans
     * using tags. For example, "StringEquals": {"Department":
     * "accounting". Condition operators are case sensitive.

     * ListOfTags differs from Conditions as follows:

     *

When you specify more than one condition, you assign all resources
     * that match AT LEAST ONE condition (using OR logic).

     * ListOfTags only supports StringEquals.
     * Conditions supports StringEquals,
     * StringLike, StringNotEquals, and
     * StringNotLike.

     */
    inline BackupSelection& AddListOfTags(const Condition& value) { m_listOfTagsHasBeenSet = true; m_listOfTags.push_back(value); return *this; }

    /**
     *
A list of conditions that you define to assign resources to your backup plans
     * using tags. For example, "StringEquals": {"Department":
     * "accounting". Condition operators are case sensitive.

     * ListOfTags differs from Conditions as follows:

     *

When you specify more than one condition, you assign all resources
     * that match AT LEAST ONE condition (using OR logic).

     * ListOfTags only supports StringEquals.
     * Conditions supports StringEquals,
     * StringLike, StringNotEquals, and
     * StringNotLike.

     */
    inline BackupSelection& AddListOfTags(Condition&& value) { m_listOfTagsHasBeenSet = true; m_listOfTags.push_back(std::move(value)); return *this; }

    /**
     *
A list of Amazon Resource Names (ARNs) to exclude from a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to exclude many resources from a backup plan, consider a
     * different resource selection strategy, such as assigning only one or a few
     * resource types or refining your resource selection using tags.

     */
    inline const Aws::Vector<Aws::String>& GetNotResources() const{ return m_notResources; }

    /**
     *
A list of Amazon Resource Names (ARNs) to exclude from a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to exclude many resources from a backup plan, consider a
     * different resource selection strategy, such as assigning only one or a few
     * resource types or refining your resource selection using tags.

     */
    inline bool NotResourcesHasBeenSet() const { return m_notResourcesHasBeenSet; }

    /**
     *
A list of Amazon Resource Names (ARNs) to exclude from a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to exclude many resources from a backup plan, consider a
     * different resource selection strategy, such as assigning only one or a few
     * resource types or refining your resource selection using tags.

     */
    inline void SetNotResources(const Aws::Vector<Aws::String>& value) { m_notResourcesHasBeenSet = true; m_notResources = value; }

    /**
     *
A list of Amazon Resource Names (ARNs) to exclude from a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to exclude many resources from a backup plan, consider a
     * different resource selection strategy, such as assigning only one or a few
     * resource types or refining your resource selection using tags.

     */
    inline void SetNotResources(Aws::Vector<Aws::String>&& value) { m_notResourcesHasBeenSet = true; m_notResources = std::move(value); }

    /**
     *
A list of Amazon Resource Names (ARNs) to exclude from a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to exclude many resources from a backup plan, consider a
     * different resource selection strategy, such as assigning only one or a few
     * resource types or refining your resource selection using tags.

     */
    inline BackupSelection& WithNotResources(const Aws::Vector<Aws::String>& value) { SetNotResources(value); return *this;}

    /**
     *
A list of Amazon Resource Names (ARNs) to exclude from a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to exclude many resources from a backup plan, consider a
     * different resource selection strategy, such as assigning only one or a few
     * resource types or refining your resource selection using tags.

     */
    inline BackupSelection& WithNotResources(Aws::Vector<Aws::String>&& value) { SetNotResources(std::move(value)); return *this;}

    /**
     *
A list of Amazon Resource Names (ARNs) to exclude from a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to exclude many resources from a backup plan, consider a
     * different resource selection strategy, such as assigning only one or a few
     * resource types or refining your resource selection using tags.

     */
    inline BackupSelection& AddNotResources(const Aws::String& value) { m_notResourcesHasBeenSet = true; m_notResources.push_back(value); return *this; }

    /**
     *
A list of Amazon Resource Names (ARNs) to exclude from a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to exclude many resources from a backup plan, consider a
     * different resource selection strategy, such as assigning only one or a few
     * resource types or refining your resource selection using tags.

     */
    inline BackupSelection& AddNotResources(Aws::String&& value) { m_notResourcesHasBeenSet = true; m_notResources.push_back(std::move(value)); return *this; }

    /**
     *
A list of Amazon Resource Names (ARNs) to exclude from a backup plan. The
     * maximum number of ARNs is 500 without wildcards, or 30 ARNs with wildcards.

     *
If you need to exclude many resources from a backup plan, consider a
     * different resource selection strategy, such as assigning only one or a few
     * resource types or refining your resource selection using tags.

     */
    inline BackupSelection& AddNotResources(const char* value) { m_notResourcesHasBeenSet = true; m_notResources.push_back(value); return *this; }

    /**
     *
A list of conditions that you define to assign resources to your backup plans
     * using tags. For example, "StringEquals": {"Department":
     * "accounting". Condition operators are case sensitive.

     * Conditions differs from ListOfTags as follows:

     *

When you specify more than one condition, you only assign the
     * resources that match ALL conditions (using AND logic).

     * Conditions supports StringEquals,
     * StringLike, StringNotEquals, and
     * StringNotLike. ListOfTags only supports
     * StringEquals.

     */
    inline const Conditions& GetConditions() const{ return m_conditions; }

    /**
     *
A list of conditions that you define to assign resources to your backup plans
     * using tags. For example, "StringEquals": {"Department":
     * "accounting". Condition operators are case sensitive.

     * Conditions differs from ListOfTags as follows:

     *

When you specify more than one condition, you only assign the
     * resources that match ALL conditions (using AND logic).

     * Conditions supports StringEquals,
     * StringLike, StringNotEquals, and
     * StringNotLike. ListOfTags only supports
     * StringEquals.

     */
    inline bool ConditionsHasBeenSet() const { return m_conditionsHasBeenSet; }

    /**
     *
A list of conditions that you define to assign resources to your backup plans
     * using tags. For example, "StringEquals": {"Department":
     * "accounting". Condition operators are case sensitive.

     * Conditions differs from ListOfTags as follows:

     *

When you specify more than one condition, you only assign the
     * resources that match ALL conditions (using AND logic).

     * Conditions supports StringEquals,
     * StringLike, StringNotEquals, and
     * StringNotLike. ListOfTags only supports
     * StringEquals.

     */
    inline void SetConditions(const Conditions& value) { m_conditionsHasBeenSet = true; m_conditions = value; }

    /**
     *
A list of conditions that you define to assign resources to your backup plans
     * using tags. For example, "StringEquals": {"Department":
     * "accounting". Condition operators are case sensitive.

     * Conditions differs from ListOfTags as follows:

     *

When you specify more than one condition, you only assign the
     * resources that match ALL conditions (using AND logic).

     * Conditions supports StringEquals,
     * StringLike, StringNotEquals, and
     * StringNotLike. ListOfTags only supports
     * StringEquals.

     */
    inline void SetConditions(Conditions&& value) { m_conditionsHasBeenSet = true; m_conditions = std::move(value); }

    /**
     *
A list of conditions that you define to assign resources to your backup plans
     * using tags. For example, "StringEquals": {"Department":
     * "accounting". Condition operators are case sensitive.

     * Conditions differs from ListOfTags as follows:

     *

When you specify more than one condition, you only assign the
     * resources that match ALL conditions (using AND logic).

     * Conditions supports StringEquals,
     * StringLike, StringNotEquals, and
     * StringNotLike. ListOfTags only supports
     * StringEquals.

     */
    inline BackupSelection& WithConditions(const Conditions& value) { SetConditions(value); return *this;}

    /**
     *
A list of conditions that you define to assign resources to your backup plans
     * using tags. For example, "StringEquals": {"Department":
     * "accounting". Condition operators are case sensitive.

     * Conditions differs from ListOfTags as follows:

     *

When you specify more than one condition, you only assign the
     * resources that match ALL conditions (using AND logic).

     * Conditions supports StringEquals,
     * StringLike, StringNotEquals, and
     * StringNotLike. ListOfTags only supports
     * StringEquals.

     */
    inline BackupSelection& WithConditions(Conditions&& value) { SetConditions(std::move(value)); return *this;}

  private:

    Aws::String m_selectionName;
    bool m_selectionNameHasBeenSet;

    Aws::String m_iamRoleArn;
    bool m_iamRoleArnHasBeenSet;

    Aws::Vector<Aws::String> m_resources;
    bool m_resourcesHasBeenSet;

    Aws::Vector<Condition> m_listOfTags;
    bool m_listOfTagsHasBeenSet;

    Aws::Vector<Aws::String> m_notResources;
    bool m_notResourcesHasBeenSet;

    Conditions m_conditions;
    bool m_conditionsHasBeenSet;
  };

} // namespace Model
} // namespace Backup
} // namespace Aws


text:
def ping_from_module(*args):
    """
    You can also call functions directly from modules, not just packages!
    Returns all the arguments passed to the function
    To execute this function, call:
    ["basic.module.ping_from_module", ["string", 1, 2.3, true]] call py3_fnc_callExtension
    """
    return args


text:
package org.sleuthkit.autopsy.keywordsearch;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumn;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT;
import org.sleuthkit.autopsy.guiutils.SimpleTableCellRenderer;
import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings;
import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel;
import org.sleuthkit.autopsy.keywordsearch.KeywordSearchIngestModule.StringsExtractOptions;

/**
 * Ingest job settings panel for keyword search file ingest modules.
 */
@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
public final class KeywordSearchJobSettingsPanel extends IngestModuleIngestJobSettingsPanel implements PropertyChangeListener {
    private final KeywordListsTableModel tableModel = new KeywordListsTableModel();
    private final List<String> keywordListNames = new ArrayList<>();
    private final Map<String, Boolean> keywordListStates = new HashMap<>();
    private final XmlKeywordSearchList keywordListsManager = XmlKeywordSearchList.getCurrent();

    KeywordSearchJobSettingsPanel(KeywordSearchJobSettings initialSettings) {
        initComponents();
        customizeComponents();
        initializeKeywordListSettings(initialSettings);
    }

    private void initializeKeywordListSettings(KeywordSearchJobSettings settings) {
        keywordListNames.clear();
        keywordListStates.clear();
        List<KeywordList> keywordLists = keywordListsManager.getListsL();
        for (KeywordList list : keywordLists) {
            String listName = list.getName();
            keywordListNames.add(listName);
            keywordListStates.put(listName, settings.keywordListIsEnabled(listName));
        }

        ocrCheckBox.setSelected(settings.isOCREnabled());
        limitedOcrCheckbox.setSelected(settings.isLimitedOCREnabled());
        ocrOnlyCheckbox.setSelected(settings.isOCROnly());

        handleOcrEnabled(settings.isOCREnabled());
    }

    /**
     * Handles setting enabled state of checkbox.
     * @param ocrEnabled Whether or not the ocr setting is enabled.
     */
    private void handleOcrEnabled(boolean ocrEnabled) {
        boolean platformSupported = PlatformUtil.isWindowsOS() && PlatformUtil.is64BitOS();
        ocrCheckBox.setEnabled(platformSupported);
        limitedOcrCheckbox.setEnabled(platformSupported && ocrEnabled);
        ocrOnlyCheckbox.setEnabled(platformSupported && ocrEnabled);
    }

    private void customizeComponents() {
        customizeKeywordListsTable();
        displayLanguages();
        displayEncodings();
        keywordListsManager.addPropertyChangeListener(this);
        languagesLabel.setText("" + org.openide.util.NbBundle.getMessage(KeywordSearchJobSettingsPanel.class, "KeywordSearchJobSettingsPanel.languagesLabel.text") + ""); // NOI18N NON-NLS

        // the gui builder does not explicitly set these to false.
        listsTable.setShowHorizontalLines(false);
        listsTable.setShowVerticalLines(false);
    }

    private void customizeKeywordListsTable() {
        listsTable.setModel(tableModel);
        listsTable.setTableHeader(null);
        listsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        final int width = listsScrollPane.getPreferredSize().width;
        listsTable.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN);
        TableColumn column;
        for (int i = 0; i < listsTable.getColumnCount(); i++) {
            column = listsTable.getColumnModel().getColumn(i);
            if (i == 0) {
                column.setPreferredWidth(((int) (width * 0.07)));
            } else {
                column.setPreferredWidth(((int) (width * 0.92)));
            }
        }
    }

    private void displayLanguages() {
        List


text:
<?php

namespace Llvdl\Domain;

interface Account
{
    const ROLE_PLAYER = 'player';

    public function getId() : string;
    public function getName() : string;
    public function getEmail() : string;
    public function setPassword(string $plainPassword) : void;
    public function verifyPassword(string $plainPassword) : bool;
    public function getCreatedAt() : \DateTime;
    public function activate();
    public function isActive() : bool;
}


text:
package fabrica;

public interface IFormato {
    public Imagem gerar();
}


text:
import xmlrpclib

class SafeTransportWithCert(xmlrpclib.SafeTransport):
    __cert_file = "grid.cert"
    __key_file  = "grid.key"

    def make_connection(self, host):
        host_with_cert = (host, {
                'key_file'  :  self.__key_file,
                'cert_file' :  self.__cert_file
                } )
        return  xmlrpclib.SafeTransport.make_connection(self, host_with_cert)

#server_url = "http://localhost:2633/RPC2"
#server_url = "https://onehost-172:8444/xmlrpc"
server_url = "https://localhost:8443/authn_proxy/xmlrpc"

transport = SafeTransportWithCert()

server = xmlrpclib.ServerProxy(server_url, transport = transport)
#server = xmlrpclib.ServerProxy(server_url)

rslt = server.one.vmpool.info("dummy:pass", -1)

print rslt


text:
    cd vendor/engines/writers
    gem build refinerycms-writers.gempspec
    gem install refinerycms-writers.gem

    # Sign up for a http://rubygems.org/ account and publish the gem
    gem push refinerycms-writers.gem


text:
const _ = require('lodash');
const moment = require('moment');

const TREND_DURATION = 1000;

const Trader = function() {
  this.name = 'Exchange Simulator';
  this.at = moment().subtract(30, 'minutes');

  // fake data
  this.price = 100;
  this.trend = 'up';
  this.tid = 0;
}

Trader.prototype.getTrades = function(since, cb) {
  const amount = moment().diff(this.at, 'seconds');

  const trades = _.range(amount).map(() => {

    this.tid++;

    if(this.tid % TREND_DURATION === 0) {
      if(this.trend === 'up')
        this.trend = 'down';
      else
        this.trend = 'up';
    }

    if(this.trend === 'up')
      this.price += Math.random();
    else
      this.price -= Math.random();

    return {
      date: this.at.add(1, 'seconds').unix(),
      price: this.price,
      amount: Math.random() * 100,
      tid: this.tid
    }
  });

  console.log(
    `[EXCHANGE SIMULATOR] emitted ${amount} fake trades, up until ${this.at.format('YYYY-MM-DD HH:mm:ss')}.`
  );

  cb(null, trades);
}

Trader.getCapabilities = function () {
  return {
    name: 'Exchange Simulator',
    slug: 'DEBUG_exchange-simulator',
    currencies: ['USD'],
    assets: ['BTC', 'BTC'],
    maxTradesAge: 60,
    maxHistoryFetch: null,
    markets: [
      { pair: ['USD', 'BTC'], minimalOrder: { amount: 5, unit: 'currency' } },
    ],
    requires: ['key', 'secret', 'username'],
    fetchTimespan: 60,
    tid: 'tid',
    tradable: false
  };
}

module.exports = Trader;


text:
RSpec::Matchers.define :permit_action do |action|
  match do |policy|
    policy.public_send("#{action}?")
  end

  failure_message do |policy|
    "#{policy.class} does not permit #{action} on #{policy.record} for #{policy.user.inspect}."
  end

  failure_message_when_negated do |policy|
    "#{policy.class} does not forbid #{action} on #{policy.record} for #{policy.user.inspect}."
  end
end

module PolicyViewSpecHelper
  def policy(*args); end
end

RSpec.configure do |c|
  c.before(:each, type: :view) do
    view.extend(PolicyViewSpecHelper)
  end
end


text:
class BagPropertyValue < ActiveRecord::Base
end


text:
class SkyrimClipTrigger final
{
public:
    SkyrimClipTrigger(qreal t = 0, const QString & trigname = "");
    SkyrimClipTrigger& operator=(const SkyrimClipTrigger&) = default;
    SkyrimClipTrigger(const SkyrimClipTrigger &) = default;
    ~SkyrimClipTrigger() = default;
public:
    QString name;
    qreal time;
};

#endif // SKYRIMCLIPTRIGGER_H


text:
require 'spec_helper'

module ObservaPoa
  describe Place do
    subject {
      Place.new(id: '5', name: "Viam\xe3o", type: "city")
    }

    describe "overall instantiation behaviour" do
      it "forces id to be an integer" do
        subject.id.should == 5
      end
      it "forces utf-8 for the name" do
        subject.name.should == "Viamão"
      end
      it "stores type as a symbol" do
        subject.type.should == :city
      end
    end

    describe "themes" do
      let(:mock_themes) { double('mock themes') }

      before :each do
        ThemeIndex.should_receive(:new).once.with(place: subject.id).and_return(mock_themes)
      end

      it "hits the theme index on the first time" do
        subject.themes.should == mock_themes
      end

      it "keeps it cached so that it does not hit the index again" do
        themes_first = subject.themes
        themes_second = subject.themes
        themes_first.should == mock_themes
        themes_first.should == themes_second
      end
    end

  end
end


text:
<?xml version='1.0' encoding='utf-8'?>
<!--
App-o-Mat jQuery Mobile Cordova starter template
Copyright 2014 Lou Franco
https://github.com/app-o-mat/jqm-cordova-template-project
http://app-o-mat.com

MIT License
https://github.com/app-o-mat/jqm-cordova-template-project/LICENSE.md
-->

<!-- change the widget id to your id and update the version as appropriate -->
<widget id="com.app-o-mat.bloglist" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

	<!-- Edit to match the details of your app -->
    <name>App-o-Mat</name>
    <description>
        App-o-Mat site app
    </description>
    <author email="lou@app-o-mat.com" href="http://app-o-mat.com">
        Lou Franco
    </author>
	<!-- END App Details -->

    <content src="index.html" />
    <access origin="*" />

	<!-- uses cordova plugin add org.apache.cordova.statusbar to make iOS7 statusbar look right-->
	<preference name="StatusBarOverlaysWebView" value="false" />
	<!-- edit this to the background color of your app -->
	<preference name="StatusBarBackgroundColor" value="#595b5b" />

</widget>


text:
$(function() {

	//DISABLE NAV TAB
	$.cms.disableNavTab();

	//TOOLTIP
	$.cms.toolTip();

	//FANCYBOX
	$.cms.fancyBox();

	//SORTABLE
	$.cms.sortableListBanner();

	//SAVE AND CONTINUE
	$.cms.saveContinue();

	//DATE PICKER
	$.cms.bannerDatePicker();

});


text:
=begin
#<
Manage rundeck jobs through rundeck api

@action create Create and update rundeck job
@action delete Delete the job

@section Examples

    rundeck_server_job 'uname_job' do
      project 'linux_servers'
      config({
        description: 'A simple job running uname on all servers',
        sequence: {
          keepgoing: false,
          strategy: 'node-first',
          commands: [
            { exec: 'uname -a', description: 'Display uname command output' }
          ],
        },
        nodefilters: { dispatch: { threadcount: 10 } },
        filter: '.*'
      })
    end
#>
=end

actions :create, :delete
default_action :create

#<> @attribute name Name of the job, will be used to identify the job when interacting with rundeck.
attribute :name,      name_attribute:  true, regex: /^[-_+.a-zA-Z0-9() ]+$/
#<> @attribute project Project in which the job will be defined
attribute :project,   kind_of: String, required: true
#<> @attribute config Job configuration, it is a hash version of yaml output from rundeck api
attribute :config,    kind_of: Hash,   default: {}
#<> @attribute endpoint
attribute :endpoint,  kind_of: String, default: 'https://localhost'
#<> @attribute api_token Token used to interact with the api. See rundeck documentation to generate a token.
attribute :api_token, kind_of: String, required: true


text: Rails.application.config.session_store :cookie_store, key: '_fantasy-finance-api_session'


text:
from office365.entity_collection import EntityCollection
from office365.onenote.entity_hierarchy_model import OnenoteEntityHierarchyModel
from office365.onenote.operations.onenote import OnenoteOperation
from office365.onenote.pages.page_links import PageLinks
from office365.runtime.queries.service_operation import ServiceOperationQuery
from office365.runtime.paths.resource_path import ResourcePath

class OnenoteSection(OnenoteEntityHierarchyModel):
    """A section in a OneNote notebook. Sections can contain pages."""

    def copy_to_section_group(self, group_id, _id, rename_as=None, site_collection_id=None, site_id=None):
        """For Copy operations, you follow an asynchronous calling pattern: First call the Copy action,
        and then poll the operation endpoint for the result.

        :param str group_id: The id of the group to copy to. Use only when copying to a Microsoft 365 group.
        :param str _id: Required. The id of the destination section group.
        :param str rename_as: The name of the copy. Defaults to the name of the existing item.
        :param str site_collection_id:
        :param str site_id:
        """
        return_type = OnenoteOperation(self.context)
        payload = {
            "groupId": group_id,
            "id": _id,
            "renameAs": rename_as,
            "siteCollectionId": site_collection_id,
            "siteId": site_id
        }
        qry = ServiceOperationQuery(self, "copyToSectionGroup", None, payload, None, return_type)
        self.context.add_query(qry)
        return return_type

    @property
    def is_default(self):
        """Indicates whether this is the user's default section. Read-only."""
        return self.properties.get("isDefault", None)

    @property
    def links(self):
        """Links for opening the section. The oneNoteClientURL link opens the section in the OneNote native client
        if it's installed. The oneNoteWebURL link opens the section in OneNote on the web.

        """
        return self.properties.get("links", PageLinks())

    @property
    def pages(self):
        """
        The collection of pages in the section. Read-only. Nullable.

        :rtype: EntityCollection
        """
        from office365.onenote.pages.page import OnenotePage
        return self.get_property('pages',
                                 EntityCollection(self.context, OnenotePage, ResourcePath("pages", self.resource_path)))

    @property
    def parent_notebook(self):
        """The notebook that contains the page. Read-only.

        :rtype: Notebook
        """
        from office365.onenote.notebooks.notebook import Notebook
        return self.get_property('parentNotebook',
                                 Notebook(self.context, ResourcePath("parentNotebook", self.resource_path)))

    @property
    def parent_section_group(self):
        """The section group that contains the section. Read-only.

        :rtype: SectionGroup
        """
        from office365.onenote.sectiongroups.section_group import SectionGroup
        return self.get_property('parentSectionGroup',
                                 SectionGroup(self.context, ResourcePath("parentSectionGroup", self.resource_path)))

    def get_property(self, name, default_value=None):
        if default_value is None:
            property_mapping = {
                "parentNotebook": self.parent_notebook,
                "parentSectionGroup": self.parent_section_group
            }
            default_value = property_mapping.get(name, None)
        return super(OnenoteSection, self).get_property(name, default_value)


text:
<?php
/**
 * Скрипт инициализации стореджей платежей пользователей
 * @author alxmsl
 */

$baseDir = realpath('.');
include $baseDir . '/source/ordr/payment/payment.php';
payment_initialize();


text:
package cloudprovider

import (
	"fmt"
	"math/rand"
	"time"

	apiv1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/api/resource"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/kubernetes/pkg/apis/scheduling"
	kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
)

const (
	// DefaultArch is the default Arch for GenericLabels
	DefaultArch = "amd64"
	// DefaultOS is the default OS for GenericLabels
	DefaultOS = "linux"
	// KubeProxyCpuRequestMillis is the amount of cpu requested by Kubeproxy
	KubeProxyCpuRequestMillis = 100
)

// BuildReadyConditions sets up mock NodeConditions
func BuildReadyConditions() []apiv1.NodeCondition {
	lastTransition := time.Now().Add(-time.Minute)
	return []apiv1.NodeCondition{
		{
			Type:               apiv1.NodeReady,
			Status:             apiv1.ConditionTrue,
			LastTransitionTime: metav1.Time{Time: lastTransition},
		},
		{
			Type:               apiv1.NodeNetworkUnavailable,
			Status:             apiv1.ConditionFalse,
			LastTransitionTime: metav1.Time{Time: lastTransition},
		},
		{
			Type:               apiv1.NodeDiskPressure,
			Status:             apiv1.ConditionFalse,
			LastTransitionTime: metav1.Time{Time: lastTransition},
		},
		{
			Type:               apiv1.NodeMemoryPressure,
			Status:             apiv1.ConditionFalse,
			LastTransitionTime: metav1.Time{Time: lastTransition},
		},
		/* This has been recently renamed. For compatibility with 1.6 lets don't populate it at all.
		{
			Type:               apiv1.NodeInodePressure,
			Status:             apiv1.ConditionFalse,
			LastTransitionTime: metav1.Time{Time: lastTransition},
		},
		*/
	}
}

// BuildKubeProxy builds a KubeProxy pod definition
func BuildKubeProxy(name string) *apiv1.Pod {
	// TODO: make cpu a flag.
	priority := scheduling.SystemCriticalPriority
	return &apiv1.Pod{
		ObjectMeta: metav1.ObjectMeta{
			Name:      fmt.Sprintf("kube-proxy-%s-%d", name, rand.Int63()),
			Namespace: "kube-system",
			Annotations: map[string]string{
				kubetypes.ConfigSourceAnnotationKey: kubetypes.FileSource,
				kubetypes.ConfigMirrorAnnotationKey: "1234567890abcdef",
			},
			Labels: map[string]string{
				"component": "kube-proxy",
				"tier":      "node",
			},
		},
		Spec: apiv1.PodSpec{
			Containers: []apiv1.Container{
				{
					Image: "kubeproxy",
					Resources: apiv1.ResourceRequirements{
						Requests: apiv1.ResourceList{
							apiv1.ResourceCPU: *resource.NewMilliQuantity(
								int64(KubeProxyCpuRequestMillis),
								resource.DecimalSI),
						},
					},
				},
			},
			Priority: &priority,
		},
		Status: apiv1.PodStatus{
			Phase: apiv1.PodRunning,
			Conditions: []apiv1.PodCondition{
				{
					Type:   apiv1.PodReady,
					Status: apiv1.ConditionTrue,
				},
			},
		},
	}
}

// JoinStringMaps joins node labels
func JoinStringMaps(items ...map[string]string) map[string]string {
	result := make(map[string]string)
	for _, m := range items {
		for k, v := range m {
			result[k] = v
		}
	}
	return result
}


text:
package edu.danc.newEngine;

/** Template for a lambda expression (java 6 compatible!) representing a rule for the genetic function **/
public interface ICostRule {
	/** Evaluates a specific chromosome returning a cost **/
	double eval(LsChromosome block);
}


text:
#include "../../SDL_internal.h"

#if SDL_VIDEO_DRIVER_WINRT

/* WinRT SDL video driver implementation

   Initial work on this was done by David Ludwig (dludwig@pobox.com), and
   was based off of SDL's "dummy" video driver.
 */

/* Windows includes */
#include <agile.h>
#include <wrl/client.h>
using namespace Windows::UI::Core;

/* SDL includes */
extern "C" {
#include "SDL_video.h"
#include "SDL_mouse.h"
#include "../SDL_sysvideo.h"
#include "../SDL_pixels_c.h"
#include "../../events/SDL_events_c.h"
#include "../../render/SDL_sysrender.h"
#include "SDL_syswm.h"
#include "SDL_winrtopengles.h"
}

#include "../../core/winrt/SDL_winrtapp_direct3d.h"
#include "../../core/winrt/SDL_winrtapp_xaml.h"
#include "SDL_winrtvideo_cpp.h"
#include "SDL_winrtevents_c.h"
#include "SDL_winrtmouse_c.h"
#include "SDL_main.h"
#include "SDL_system.h"
//#include "SDL_log.h"

/* Initialization/Query functions */
static int WINRT_VideoInit(_THIS);
static int WINRT_InitModes(_THIS);
static int WINRT_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode);
static void WINRT_VideoQuit(_THIS);

/* Window functions */
static int WINRT_CreateWindow(_THIS, SDL_Window * window);
static void WINRT_DestroyWindow(_THIS, SDL_Window * window);
static SDL_bool WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info);

/* SDL-internal globals: */
SDL_Window * WINRT_GlobalSDLWindow = NULL;

/* WinRT driver bootstrap functions */

static int
WINRT_Available(void)
{
    return (1);
}

static void
WINRT_DeleteDevice(SDL_VideoDevice * device)
{
    if (device->driverdata) {
        SDL_VideoData * video_data = (SDL_VideoData *)device->driverdata;
        if (video_data->winrtEglWindow) {
            video_data->winrtEglWindow->Release();
        }
        SDL_free(video_data);
    }

    SDL_free(device);
}

static SDL_VideoDevice *
WINRT_CreateDevice(int devindex)
{
    SDL_VideoDevice *device;
    SDL_VideoData *data;

    /* Initialize all variables that we clean on shutdown */
    device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
    if (!device) {
        SDL_OutOfMemory();
        if (device) {
            SDL_free(device);
        }
        return (0);
    }

    data = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
    if (!data) {
        SDL_OutOfMemory();
        return (0);
    }
    SDL_zerop(data);
    device->driverdata = data;

    /* Set the function pointers */
    device->VideoInit = WINRT_VideoInit;
    device->VideoQuit = WINRT_VideoQuit;
    device->CreateWindow = WINRT_CreateWindow;
    device->DestroyWindow = WINRT_DestroyWindow;
    device->SetDisplayMode = WINRT_SetDisplayMode;
    device->PumpEvents = WINRT_PumpEvents;
    device->GetWindowWMInfo = WINRT_GetWindowWMInfo;
#ifdef SDL_VIDEO_OPENGL_EGL
    device->GL_LoadLibrary = WINRT_GLES_LoadLibrary;
    device->GL_GetProcAddress = WINRT_GLES_GetProcAddress;
    device->GL_UnloadLibrary = WINRT_GLES_UnloadLibrary;
    device->GL_CreateContext = WINRT_GLES_CreateContext;
    device->GL_MakeCurrent = WINRT_GLES_MakeCurrent;
    device->GL_SetSwapInterval = WINRT_GLES_SetSwapInterval;
    device->GL_GetSwapInterval = WINRT_GLES_GetSwapInterval;
    device->GL_SwapWindow = WINRT_GLES_SwapWindow;
    device->GL_DeleteContext = WINRT_GLES_DeleteContext;
#endif
    device->free = WINRT_DeleteDevice;

    return device;
}

#define WINRTVID_DRIVER_NAME "winrt"
VideoBootStrap WINRT_bootstrap = {
    WINRTVID_DRIVER_NAME, "SDL WinRT video driver",
    WINRT_Available, WINRT_CreateDevice
};

int
WINRT_VideoInit(_THIS)
{
    if (WINRT_InitModes(_this) < 0) {
        return -1;
    }
    WINRT_InitMouse(_this);
    WINRT_InitTouch(_this);

    return 0;
}

int
WINRT_CalcDisplayModeUsingNativeWindow(SDL_DisplayMode * mode)
{
    SDL_DisplayModeData * driverdata;

    using namespace Windows::Graphics::Display;

    // Go no further if a native window cannot be accessed.  This can happen,
    // for example, if this function is called from certain threads, such as
    // the SDL/XAML thread.
    if (!CoreWindow::GetForCurrentThread()) {
        return SDL_SetError("SDL/WinRT display modes cannot be calculated outside of the main thread, such as in SDL's XAML thread");
    }

    //SDL_Log("%s, size={%f,%f}, current orientation=%d, native orientation=%d, auto rot. pref=%d, DPI = %f\n",
    //    __FUNCTION__,
    //    CoreWindow::GetForCurrentThread()->Bounds.Width, CoreWindow::GetForCurrentThread()->Bounds.Height,
    //    WINRT_DISPLAY_PROPERTY(CurrentOrientation),
    //    WINRT_DISPLAY_PROPERTY(NativeOrientation),
    //    WINRT_DISPLAY_PROPERTY(AutoRotationPreferences),
    //    WINRT_DISPLAY_PROPERTY(LogicalDpi));

    // Calculate the display size given the window size, taking into account
    // the current display's DPI:
    const float currentDPI = WINRT_DISPLAY_PROPERTY(LogicalDpi);
    const float dipsPerInch = 96.0f;
    const int w = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Width * currentDPI) / dipsPerInch);
    const int h = (int) ((CoreWindow::GetForCurrentThread()->Bounds.Height * currentDPI) / dipsPerInch);
    if (w == 0 || w == h) {
        return SDL_SetError("Unable to calculate the WinRT window/display's size");
    }

    // Create a driverdata field:
    driverdata = (SDL_DisplayModeData *) SDL_malloc(sizeof(*driverdata));
    if (!driverdata) {
        return SDL_OutOfMemory();
    }
    SDL_zerop(driverdata);

    // Fill in most fields:
    SDL_zerop(mode);
    mode->format = SDL_PIXELFORMAT_RGB888;
    mode->refresh_rate = 0;  // TODO, WinRT: see if refresh rate data is available, or relevant (for WinRT apps)
    mode->w = w;
    mode->h = h;
    mode->driverdata = driverdata;
    driverdata->currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation);

#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8)
    // On Windows Phone 8.0, the native window's size is always in portrait,
    // regardless of the device's orientation.  This is in contrast to
    // Windows 8.x/RT and Windows Phone 8.1, which will resize the native window as the device's
    // orientation changes.  In order to compensate for this behavior,
    // on Windows Phone, the mode's width and height will be swapped when
    // the device is in a landscape (non-portrait) mode.
    switch (driverdata->currentOrientation) {
        case DisplayOrientations::Landscape:
        case DisplayOrientations::LandscapeFlipped:
        {
            const int tmp = mode->h;
            mode->h = mode->w;
            mode->w = tmp;
            break;
        }

        default:
            break;
    }
#endif

    return 0;
}

int
WINRT_DuplicateDisplayMode(SDL_DisplayMode * dest, const SDL_DisplayMode * src)
{
    SDL_DisplayModeData * driverdata;
    driverdata = (SDL_DisplayModeData *) SDL_malloc(sizeof(*driverdata));
    if (!driverdata) {
        return SDL_OutOfMemory();
    }
    SDL_memcpy(driverdata, src->driverdata, sizeof(SDL_DisplayModeData));
    SDL_memcpy(dest, src, sizeof(SDL_DisplayMode));
    dest->driverdata = driverdata;
    return 0;
}

int
WINRT_InitModes(_THIS)
{
    // Retrieve the display mode:
    SDL_DisplayMode mode, desktop_mode;
    if (WINRT_CalcDisplayModeUsingNativeWindow(&mode) != 0) {
        return -1;	// If WINRT_CalcDisplayModeUsingNativeWindow fails, it'll already have set the SDL error
    }

    if (WINRT_DuplicateDisplayMode(&desktop_mode, &mode) != 0) {
        return -1;
    }
    if (SDL_AddBasicVideoDisplay(&desktop_mode) < 0) {
        return -1;
    }

    SDL_AddDisplayMode(&_this->displays[0], &mode);
    return 0;
}

static int
WINRT_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
{
    return 0;
}

void
WINRT_VideoQuit(_THIS)
{
    WINRT_QuitMouse(_this);
}

int
WINRT_CreateWindow(_THIS, SDL_Window * window)
{
    // Make sure that only one window gets created, at least until multimonitor
    // support is added.
    if (WINRT_GlobalSDLWindow != NULL) {
        SDL_SetError("WinRT only supports one window");
        return -1;
    }

    SDL_WindowData *data = new SDL_WindowData;
    if (!data) {
        SDL_OutOfMemory();
        return -1;
    }
    window->driverdata = data;
    data->sdlWindow = window;

    /* To note, when XAML support is enabled, access to the CoreWindow will not
       be possible, at least not via the SDL/XAML thread.  Attempts to access it
       from there will throw exceptions.  As such, the SDL_WindowData's
       'coreWindow' field will only be set (to a non-null value) if XAML isn't
       enabled.
    */
    if (!WINRT_XAMLWasEnabled) {
        data->coreWindow = CoreWindow::GetForCurrentThread();
    }

#if SDL_VIDEO_OPENGL_EGL
    /* Setup the EGL surface, but only if OpenGL ES 2 was requested. */
    if (!(window->flags & SDL_WINDOW_OPENGL)) {
        /* OpenGL ES 2 wasn't requested.  Don't set up an EGL surface. */
        data->egl_surface = EGL_NO_SURFACE;
    } else {
        /* OpenGL ES 2 was reuqested.  Set up an EGL surface. */
        SDL_VideoData * video_data = (SDL_VideoData *)_this->driverdata;

        /* Call SDL_EGL_ChooseConfig and eglCreateWindowSurface directly,
         * rather than via SDL_EGL_CreateSurface, as older versions of
         * ANGLE/WinRT may require that a C++ object, ComPtr<IUnknown>,
         * be passed into eglCreateWindowSurface.
         */
        if (SDL_EGL_ChooseConfig(_this) != 0) {
            char buf[512];
            SDL_snprintf(buf, sizeof(buf), "SDL_EGL_ChooseConfig failed: %s", SDL_GetError());
            return SDL_SetError("%s", buf);
        }

        if (video_data->winrtEglWindow) {   /* ... is the 'old' version of ANGLE/WinRT being used? */
            /* Attempt to create a window surface using older versions of
             * ANGLE/WinRT:
             */
            Microsoft::WRL::ComPtr<IUnknown> cpp_winrtEglWindow = video_data->winrtEglWindow;
            data->egl_surface = ((eglCreateWindowSurface_Old_Function)_this->egl_data->eglCreateWindowSurface)(
                _this->egl_data->egl_display,
                _this->egl_data->egl_config,
                cpp_winrtEglWindow, NULL);
            if (data->egl_surface == NULL) {
                return SDL_SetError("eglCreateWindowSurface failed");
            }
        } else if (data->coreWindow.Get() != nullptr) {
            /* Attempt to create a window surface using newer versions of
             * ANGLE/WinRT:
             */
            IInspectable * coreWindowAsIInspectable = reinterpret_cast<IInspectable *>(data->coreWindow.Get());
            data->egl_surface = _this->egl_data->eglCreateWindowSurface(
                _this->egl_data->egl_display,
                _this->egl_data->egl_config,
                coreWindowAsIInspectable,
                NULL);
            if (data->egl_surface == NULL) {
                return SDL_SetError("eglCreateWindowSurface failed");
            }
        } else {
            return SDL_SetError("No supported means to create an EGL window surface are available");
        }
    }
#endif

    /* Make sure the window is considered to be positioned at {0,0},
       and is considered fullscreen, shown, and the like.
    */
    window->x = 0;
    window->y = 0;
    window->flags =
        SDL_WINDOW_FULLSCREEN |
        SDL_WINDOW_SHOWN |
        SDL_WINDOW_BORDERLESS |
        SDL_WINDOW_MAXIMIZED |
        SDL_WINDOW_INPUT_GRABBED;

#if SDL_VIDEO_OPENGL_EGL
    if (data->egl_surface) {
        window->flags |= SDL_WINDOW_OPENGL;
    }
#endif

    /* WinRT does not, as of this writing, appear to support app-adjustable
       window sizes.  Set the window size to whatever the native WinRT
       CoreWindow is set at.

       TODO, WinRT: if and when non-fullscreen XAML control support is added to SDL, consider making those resizable via SDL_Window's interfaces.
    */
    window->w = _this->displays[0].current_mode.w;
    window->h = _this->displays[0].current_mode.h;

    /* For now, treat WinRT apps as if they always have focus.
       TODO, WinRT: try tracking keyboard and mouse focus state with respect to snapped apps
     */
    SDL_SetMouseFocus(window);
    SDL_SetKeyboardFocus(window);

    /* Make sure the WinRT app's IFramworkView can post events on
       behalf of SDL:
    */
    WINRT_GlobalSDLWindow = window;

    /* All done! */
    return 0;
}

void
WINRT_DestroyWindow(_THIS, SDL_Window * window)
{
    SDL_WindowData * data = (SDL_WindowData *) window->driverdata;

    if (WINRT_GlobalSDLWindow == window) {
        WINRT_GlobalSDLWindow = NULL;
    }

    if (data) {
        // Delete the internal window data:
        delete data;
        data = NULL;
        window->driverdata = NULL;
    }
}

SDL_bool
WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info)
{
    SDL_WindowData * data = (SDL_WindowData *) window->driverdata;

    if (info->version.major <= SDL_MAJOR_VERSION) {
        info->subsystem = SDL_SYSWM_WINRT;
        info->info.winrt.window = reinterpret_cast<IInspectable *>(data->coreWindow.Get());
        return SDL_TRUE;
    } else {
        SDL_SetError("Application not compiled with SDL %d.%d\n",
                     SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
        return SDL_FALSE;
    }
    return SDL_FALSE;
}

#endif /* SDL_VIDEO_DRIVER_WINRT */

/* vi: set ts=4 sw=4 expandtab: */


text:
var fs = require("fs");
var prompt = require("prompt");

//Public function to write text file
function json_to_text_writer(fileName, studentArray, textFileWriterCallback)
{
    try
    {
        if(fileName == "" ) {
            return textFileWriterCallback(null, "FileName not provided.");
        }
        if( !(studentArray) || studentArray == undefined ) {
            return textFileWriterCallback(null, "Invalid JSON object received.");
        }

        checkExistanceOfFile(fileName, function fileExistsCallback(error, exsist)
        {
            if(error) {
                console.log("Error: ", error);
                return textFileWriterCallback(null, "Failed " + fileName);
            }
            if(!exsist) {
                writeTextFile(fileName, studentArray, function writeTextHandler(error, success)
                {
                    if(error) {
                        console.log("Error: ", error);
                        return textFileWriterCallback(null, "Failed " + fileName);
                    }
                    return textFileWriterCallback(null, "Modified " + fileName);
                });
            } else {
                return textFileWriterCallback(null, "Not modified " + fileName);
            }
        });
    } catch (errorMessage) {
        console.log("json_to_text_writer terminated abnormally: " + errorMessage);
        return textFileWriterCallback(null, "process terminated.");
    }
}

//Private function to read exsistace of the file with the given name/path.
function checkExistanceOfFile(fileName, existstanceCallback)
{
    try
    {
        if(!fs.existsSync(fileName)) {
            return existstanceCallback(null, 0);
        }
        console.log(fileName+ " is already exists... Do you like to overWrite? (y/n)");
        prompt.start();
        prompt.get(['promptInput'], function promptReply(err, result) {
            if(err) {
                console.log(err);
                return existstanceCallback("Failed to get reply from user.", null);
            }
            if(result.promptInput === "n" || result.promptInput === "N") {
                console.log(fileName + " file will remain unchanged.");
                return existstanceCallback(null, 1);
            }
            if(result.promptInput === "y" || result.promptInput === "Y") {
                checkPermission(fileName, function filePermissionCallback(err, writeAccess) {
                    if(err) {
                        //console.log("Error :", err);
                        return existstanceCallback("Failed to read permissions of file " + fileName, null);
                    }
                    if(!writeAccess) {
                        return existstanceCallback(fileName + " is not writable.", null);
                    } else {
                        return existstanceCallback(null, 0);
                    }
                });
            } else {
                return existstanceCallback("Invalid input. Please enter only 'y' or 'n'... Currently " +fileName+ " will remain unchanged.", null);
            }
        });
    } catch (errorMessage) {
        console.log("Reading permissions failed: ", errorMessage);
        return existstanceCallback("Reading permissions for " + fileName + " terminated abnormally.", null);
    }

}

//Private function for accessing data from array and write in text file.
function writeTextFile(textFile, array, writeTextCallback)
{
    try
    {
        fs.writeFileSync(textFile, "First Name | Last Name | Score\n");
        for(var x = 0; x < array.length; ++x)
        {
            fs.appendFileSync(textFile, array[x].id +" | "+ array[x].fName +" | "+ array[x].lName +" | "+ array[x].score +"\n");
        }
        if(!fs.existsSync(textFile)) {
            return writeTextCallback(textFile + " not created successfully.", null);
        }
        return writeTextCallback(null, textFile + " is created successfully. Thank you.");
    } catch (errorMessage) {
        console.log("Writing text file failed: ", errorMessage);
        return writeTextCallback("Writing " + textFile + " terminated abnormally.", null);
    }
}

//Private function to check permission of file
function checkPermission(file, cb)
{
    try
    {
        //r,w,x ----> 4,2,1
        var mask = 2;
        fs.stat (file, function statResponce(error, stats){
            if(error){
                return cb (error, null);
            } else {
                return cb (null, !!(mask & parseInt ((stats.mode & parseInt ("777", 8)).toString (8)[0])));
            }
        });
    } catch (errorMessage) {
        console.log("Checking file permission failed: ", errorMessage);
        return cb("Checking file permission terminted abnormally.", null);
    }
};

module.exports.json_to_text_writer = json_to_text_writer;


text:
import _GHPromiser from '../gh-promiser';
import { LOGIN } from '../constants/action-types';
import { IN_PROGRESS, COMPLETED, FAILED } from '../constants/status-types';
import _load from './load';
import { failed } from '../utils';

export default function login({ accessToken } = {}, GHPromiser = _GHPromiser, load = _load, storage = localStorage) {
  return dispatch => {
    accessToken = backup('accessToken', accessToken, storage);

    if(accessToken) {
      dispatch({ type: LOGIN, status: IN_PROGRESS });

      const github = GHPromiser(accessToken);
      github.repos().then(completed(dispatch, github, load)).catch(failed(dispatch, LOGIN));
    }
  }
}

function backup(key, value, storage) {
  if(storage) {
    value = value || storage.getItem(key);

    if(value) {
      storage.setItem(key, value);
    } else {
      storage.removeItem(key);
    }
  }
  return value;
}

function completed(dispatch, github, load) {
  return (repos) => {
    dispatch({ type: LOGIN, status: COMPLETED, github, repos: repos.map(parseRepo) });
    dispatch(load());
  };
}

function parseRepo(repo) {
  return '/' + repo.full_name;
}


text:
package com.example.collections;

import arez.annotations.ArezComponent;
import arez.annotations.Memoize;
import java.util.ArrayList;
import java.util.List;

@ArezComponent
abstract class MemoizeListModel
{
  @Memoize
  public List<String> getMyValue()
  {
    return new ArrayList<>();
  }
}


text:
package com.arcgis.android.samples.oauth2sample;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.http.SslError;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.webkit.SslErrorHandler;

import com.esri.android.oauth.OAuthView;
import com.esri.android.oauth.OAuthView.OnSslErrorListener;
import com.esri.core.io.UserCredentials;
import com.esri.core.map.CallbackListener;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import javax.crypto.SecretKey;

/**
 * THIS SAMPLE APP DOES NOT IMPLEMENT AN ENCRYPTION PATTERN. THE USER CREDENTIALS ARE NOT ENCRYPTED WHEN
 * THEY ARE SAVED ON DISK.
 * IT IS THE RESPONSIBILITY OF THE APP DEVELOPER TO IMPLEMENT A SUITABLE ENCRYPTION PATTERN WHEN STORING USER
 * CREDENTIALS ON DISK TO MAKE SURE THE APP IS SECURE.
 */

/**
 * This sample shows how to use OAuth2 to authenticate against an ArcGIS Portal.
 * Follow these steps to get a client id:
 *

 *
Browse to https://developers.arcgis.com.

 *
Sign in with your ArcGIS developer account.

 *
Create an application. This will give you access to a client id string.

 *
Replace CLIENT_ID constant in your string resource file with the client
 * id string and run the sample.

 *

 */

public class OAuth2Sample extends FragmentActivity {

  protected static final String TAG = "OAuth2Sample";

  public static final String EXIT = "EXIT";

  SecretKey mSecretKey;

  // UI components
  private AlertDialog mAlertDialog;
  private AlertDialog mImplementEncryptionDialog;

  // File based componentes
  public static String mCredentialsFileName;

  // ArcGIS components

  private static UserCredentials mUserLoginCredentials;

  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // Intent sent from UserContentActivity to Quit the Activity and app
    if (getIntent().getBooleanExtra(EXIT, false)) {
      finish();
      return;
    }

    // Get the credentials file name
    mCredentialsFileName = getResources().getString(R.string.credentials_filename);

    // Setup the alert dialog for determining new login or login with
    // credentials from internal storage
    setupLoginTypeAlertDialog();

    // Setup the alert dialog to inform users to implement
    setupEncryptionPatternAlertDialog();

    // If the credentials file exists on internal storage, give user an option
    // to load those credentials
    if (fileExists(mCredentialsFileName)) {
      mAlertDialog.show();
    } else {
      // Prompt user to login
      showOAuth(OAuth2Sample.this);
    }
  }

  /**
   * display OAuthView in a popup and prompt user to login
   *
   * @param context
   */
  void showOAuth(Context context) {

    // Create an instance of OAuthView
    // set client_id in string resource
    OAuthView oAuthView = new OAuthView(context, getResources().getString(R.string.portal_url), getResources()
        .getString(R.string.client_id), new CallbackListener<UserCredentials>() {

      @Override
      public void onError(Throwable e) {
        Log.e(TAG, "", e);
      }

      @Override
      public void onCallback(UserCredentials credentials) {

        // set UserCredentials
        setCredentials(credentials);

        try {
          // Save the credentials on the internal storage
          encryptAndSaveCredentials();
        } catch (Exception e) {
          Log.e(TAG, "Exception while saving User Credentials.", e);
        }

        runOnUiThread(new Runnable() {
          public void run() {
            mImplementEncryptionDialog.show();
          }
        });

      }
    });

    // handle SSL errors
    oAuthView.setOnSslErrorListener(new OnSslErrorListener() {
      @Override
      public void onReceivedSslError(OAuthView view, SslErrorHandler handler, SslError error) {
        Log.d(TAG, "" + error);
      }

    });

    // add OAuthview to the Activity
    ((ViewGroup) findViewById(R.id.main)).addView(oAuthView, new LayoutParams(LayoutParams.MATCH_PARENT,
        LayoutParams.MATCH_PARENT));

  }

  public boolean fileExists(String fname) {
    File file = getBaseContext().getFileStreamPath(fname);
    return file.exists();
  }

  /**
   * Encrypt and save user credentials on internal storage
   *
   * THIS METHOD DOES NOT IMPLEMENT AN ENCRYPTION PATTERN. ITS THE RESPONSIBILITY OF THE
   * DEVELOPER TO IMPLEMENT A SUITABLE ENCRYPTION PATTERN TO MAKE SURE THE APP IS SECURE.
   * READ ABOUT ENCRYPTION PATTERNS HERE:
   * TODO : Paste blogpost link here
   *
   */
  void encryptAndSaveCredentials() throws Exception {

    // TODO : Implement encrypting the credentials before saving them to disk

    // write the encrypted user credentials to internal storage
    writeToFile(mCredentialsFileName, getCredentials());
  }

  /**
   * Method for writing object to a file
   *
   * @param filename
   * @param object
   * @throws Exception
   */
  private void writeToFile(String filename, Object object) throws Exception {
    FileOutputStream fos = null;
    ObjectOutputStream os = null;

    try {
      fos = openFileOutput(filename, Context.MODE_PRIVATE);
      os = new ObjectOutputStream(fos);
      os.writeObject(object);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      if (os != null) {
        try {
          os.close();
          fos.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }

  /**
   * Setter for UserCredentials
   *
   * @param credentials
   */
  public void setCredentials(UserCredentials credentials) {
    OAuth2Sample.mUserLoginCredentials = credentials;
  }

  /**
   * returns user credentials saved on internal storage
   *
   * @return UserCredentials
   */
  public static UserCredentials getCredentials() {
    return mUserLoginCredentials;
  }

  /**
   * Loads the saved credentials from internal storage for re-login
   *
   * THIS METHOD DOES NOT IMPLEMENT DECRYPTION PATTERN. ITS THE RESPONSIBILITY OF THE
   * DEVELOPER TO IMPLEMENT A SUITABLE DECRYPTION PATTERN TO MAKE SURE THE APP IS SECURE.
   * READ ABOUT ENCRYPTION PATTERNS HERE:
   * TODO : Paste blogpost link here
   *
   */
  void decryptAndloadCredentials() throws Exception {

    // TODO Decrypt the user credentials stored earlier on disk

    // set the credentials read from the file on interal storage
    setCredentials((UserCredentials) readFromFile(mCredentialsFileName));

  }

  /**
   * Method for reading object from a file
   *
   * @param filename
   * @return
   * @throws Exception
   */
  private Object readFromFile(String filename) throws Exception {

    Object object = null;
    FileInputStream fis = null;
    ObjectInputStream is = null;

    try {
      fis = openFileInput(filename);
      is = new ObjectInputStream(fis);
      object = is.readObject();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (is != null) {
        try {
          is.close();
          fis.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
    // }

    return object;
  }

  public void setupLoginTypeAlertDialog() {

    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(OAuth2Sample.this);

    // set title
    alertDialogBuilder.setTitle(getResources().getString(R.string.OAuth2_Sample));

    // set dialog message
    alertDialogBuilder.setMessage(getResources().getString(R.string.continue_with_saved_credentials))
        .setCancelable(false)
        .setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int id) {
            // if this button is clicked, load credentials
            // from internal storage
            try {
              decryptAndloadCredentials();
            } catch (Exception e) {
              e.printStackTrace();
            }
            // Start UserContentActivity
            Intent i = new Intent(getApplicationContext(), UserContentActivity.class);
            startActivity(i);

          }
        }).setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int id) {
            // close the dialog box and showOAuthview again
            dialog.cancel();
            // Start OAuthView again
            showOAuth(OAuth2Sample.this);
          }
        });

    // create alert dialog
    mAlertDialog = alertDialogBuilder.create();

  }

  public void setupEncryptionPatternAlertDialog() {

    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(OAuth2Sample.this);

    // set title
    alertDialogBuilder.setTitle(getResources().getString(R.string.OAuth2_Sample));

    // set dialog message
    alertDialogBuilder.setMessage(getResources().getString(R.string.implement_an_encryption_pattern))
        .setCancelable(false)
        .setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int id) {

            // Start UserContentActivity
            Intent i = new Intent(getApplicationContext(), UserContentActivity.class);
            startActivity(i);

          }
        });

    // create alert dialog
    mImplementEncryptionDialog = alertDialogBuilder.create();

  }

  @Override
  protected void onDestroy() {
    super.onDestroy();
  }

  @Override
  protected void onPause() {
    super.onPause();
    mAlertDialog.dismiss();
  }

  @Override
  protected void onResume() {
    super.onResume();
  }

}


text:
title: "Drinking wine in an argyle sweater"
excerpt: "PaperFaces portrait of @jkusunoki drawn with Paper by 53 on an iPad."
image:
  feature: paperfaces-jkusunoki-twitter-lg.jpg
  thumb: paperfaces-jkusunoki-twitter-150.jpg
tags: [portrait, illustration, Paper by 53]
---

PaperFaces portrait of [@jkusunoki](http://twitter.com/jkusunoki).

{% include boilerplate/paperfaces.html %}


text:
import {groupBy, sortBy, meanBy, includes, uniqBy} from 'lodash';
import {getMoviesRepository} from '../repository/movieRepository';

/*
 * All methods here must return a promise because relay consumes these methods.
 * */

const validClassifications = ['Unclassified', 'G','PG','PG-13','R'];

// Returns a promise which when resolves returns all movies for a given genre sorted by name.
// If genre is not specified, return all movies sorted by name.
// This method also sanitises erroneous classifications which are set to 'Unclassified'.
// This method also removes duplicates.
export const getMoviesLogic = (genre) => {
  return new Promise((resolve, reject) => {
    let movies = getMoviesRepository(genre);

    // Remove duplicates
    movies = uniqBy(movies, 'title');

    // Sanitise erroneous classifications and perform de-duplication and log it
    movies.forEach(m => {
      if (!includes(validClassifications, m.classification)) {
        console.warn(`Invalid classification detected for movie ${m.title}, classification: ${m.classification}. Setting to 'Unclassified'`);
        m.classification = 'Unclassified';
      }
    });

    // return sorted by title
    resolve(sortBy(movies, 'title'));
  });
};