text:
using System;
using NetRuntimeSystem = System;
using System.ComponentModel;
using NetOffice.Attributes;

namespace NetOffice.WordApi
{
	/// <summary>
	/// DispatchInterface TableStyle
	/// SupportByVersion Word, 10,11,12,14,15,16
	/// </summary>
	/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle"/> </remarks>
	[SupportByVersion("Word", 10,11,12,14,15,16)]
	[EntityType(EntityType.IsDispatchInterface)]
 	public class TableStyle : COMObject
	{
		#pragma warning disable

		#region Type Information

		/// <summary>
		/// Instance Type
		/// </summary>
		[EditorBrowsable(EditorBrowsableState.Advanced), Browsable(false), Category("NetOffice"), CoreOverridden]
		public override Type InstanceType
		{
			get
			{
				return LateBindingApiWrapperType;
			}
		}

        private static Type _type;

		[EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
        public static Type LateBindingApiWrapperType
        {
            get
            {
                if (null == _type)
                    _type = typeof(TableStyle);
                return _type;
            }
        }

        #endregion

		#region Ctor

		/// <param name="factory">current used factory core</param>
		/// <param name="parentObject">object there has created the proxy</param>
		/// <param name="proxyShare">proxy share instead if com proxy</param>
		public TableStyle(Core factory, ICOMObject parentObject, COMProxyShare proxyShare) : base(factory, parentObject, proxyShare)
		{
		}

		///<param name="factory">current used factory core</param>
		///<param name="parentObject">object there has created the proxy</param>
        ///<param name="comProxy">inner wrapped COM proxy</param>
		public TableStyle(Core factory, ICOMObject parentObject, object comProxy) : base(factory, parentObject, comProxy)
		{

		}

        ///<param name="parentObject">object there has created the proxy</param>
        ///<param name="comProxy">inner wrapped COM proxy</param>
        [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
		public TableStyle(ICOMObject parentObject, object comProxy) : base(parentObject, comProxy)
		{
		}

		///<param name="factory">current used factory core</param>
		///<param name="parentObject">object there has created the proxy</param>
        ///<param name="comProxy">inner wrapped COM proxy</param>
        ///<param name="comProxyType">Type of inner wrapped COM proxy"</param>
		[EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
		public TableStyle(Core factory, ICOMObject parentObject, object comProxy, NetRuntimeSystem.Type comProxyType) : base(factory, parentObject, comProxy, comProxyType)
		{

		}

		///<param name="parentObject">object there has created the proxy</param>
        ///<param name="comProxy">inner wrapped COM proxy</param>
        ///<param name="comProxyType">Type of inner wrapped COM proxy"</param>
        [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
		public TableStyle(ICOMObject parentObject, object comProxy, NetRuntimeSystem.Type comProxyType) : base(parentObject, comProxy, comProxyType)
		{
		}

		///<param name="replacedObject">object to replaced. replacedObject are not usable after this action</param>
		[EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
		public TableStyle(ICOMObject replacedObject) : base(replacedObject)
		{
		}

		[EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
		public TableStyle() : base()
		{
		}

		/// <param name="progId">registered progID</param>
		[EditorBrowsable(EditorBrowsableState.Never), Browsable(false)]
		public TableStyle(string progId) : base(progId)
		{
		}

		#endregion

		#region Properties

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.Application"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public NetOffice.WordApi.Application Application
		{
			get
			{
				return Factory.ExecuteKnownReferencePropertyGet<NetOffice.WordApi.Application>(this, "Application", NetOffice.WordApi.Application.LateBindingApiWrapperType);
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.Creator"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public Int32 Creator
		{
			get
			{
				return Factory.ExecuteInt32PropertyGet(this, "Creator");
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get
		/// Unknown COM Proxy
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.Parent"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16), ProxyResult]
		public object Parent
		{
			get
			{
				return Factory.ExecuteReferencePropertyGet(this, "Parent");
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get/Set
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.AllowPageBreaks"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public bool AllowPageBreaks
		{
			get
			{
				return Factory.ExecuteBoolPropertyGet(this, "AllowPageBreaks");
			}
			set
			{
				Factory.ExecuteValuePropertySet(this, "AllowPageBreaks", value);
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get/Set
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.Borders"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public NetOffice.WordApi.Borders Borders
		{
			get
			{
				return Factory.ExecuteKnownReferencePropertyGet<NetOffice.WordApi.Borders>(this, "Borders", NetOffice.WordApi.Borders.LateBindingApiWrapperType);
			}
			set
			{
				Factory.ExecuteReferencePropertySet(this, "Borders", value);
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get/Set
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.BottomPadding"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public Single BottomPadding
		{
			get
			{
				return Factory.ExecuteSinglePropertyGet(this, "BottomPadding");
			}
			set
			{
				Factory.ExecuteValuePropertySet(this, "BottomPadding", value);
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get/Set
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.LeftPadding"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public Single LeftPadding
		{
			get
			{
				return Factory.ExecuteSinglePropertyGet(this, "LeftPadding");
			}
			set
			{
				Factory.ExecuteValuePropertySet(this, "LeftPadding", value);
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get/Set
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.TopPadding"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public Single TopPadding
		{
			get
			{
				return Factory.ExecuteSinglePropertyGet(this, "TopPadding");
			}
			set
			{
				Factory.ExecuteValuePropertySet(this, "TopPadding", value);
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get/Set
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.RightPadding"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public Single RightPadding
		{
			get
			{
				return Factory.ExecuteSinglePropertyGet(this, "RightPadding");
			}
			set
			{
				Factory.ExecuteValuePropertySet(this, "RightPadding", value);
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get/Set
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.Alignment"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public NetOffice.WordApi.Enums.WdRowAlignment Alignment
		{
			get
			{
				return Factory.ExecuteEnumPropertyGet<NetOffice.WordApi.Enums.WdRowAlignment>(this, "Alignment");
			}
			set
			{
				Factory.ExecuteEnumPropertySet(this, "Alignment", value);
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get/Set
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.Spacing"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public Single Spacing
		{
			get
			{
				return Factory.ExecuteSinglePropertyGet(this, "Spacing");
			}
			set
			{
				Factory.ExecuteValuePropertySet(this, "Spacing", value);
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get/Set
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.TableDirection"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public NetOffice.WordApi.Enums.WdTableDirection TableDirection
		{
			get
			{
				return Factory.ExecuteEnumPropertyGet<NetOffice.WordApi.Enums.WdTableDirection>(this, "TableDirection");
			}
			set
			{
				Factory.ExecuteEnumPropertySet(this, "TableDirection", value);
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get/Set
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.AllowBreakAcrossPage"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public Int32 AllowBreakAcrossPage
		{
			get
			{
				return Factory.ExecuteInt32PropertyGet(this, "AllowBreakAcrossPage");
			}
			set
			{
				Factory.ExecuteValuePropertySet(this, "AllowBreakAcrossPage", value);
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get/Set
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.LeftIndent"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public Single LeftIndent
		{
			get
			{
				return Factory.ExecuteSinglePropertyGet(this, "LeftIndent");
			}
			set
			{
				Factory.ExecuteValuePropertySet(this, "LeftIndent", value);
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.Shading"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public NetOffice.WordApi.Shading Shading
		{
			get
			{
				return Factory.ExecuteKnownReferencePropertyGet<NetOffice.WordApi.Shading>(this, "Shading", NetOffice.WordApi.Shading.LateBindingApiWrapperType);
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get/Set
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.RowStripe"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public Int32 RowStripe
		{
			get
			{
				return Factory.ExecuteInt32PropertyGet(this, "RowStripe");
			}
			set
			{
				Factory.ExecuteValuePropertySet(this, "RowStripe", value);
			}
		}

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// Get/Set
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.ColumnStripe"/> </remarks>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public Int32 ColumnStripe
		{
			get
			{
				return Factory.ExecuteInt32PropertyGet(this, "ColumnStripe");
			}
			set
			{
				Factory.ExecuteValuePropertySet(this, "ColumnStripe", value);
			}
		}

		#endregion

		#region Methods

		/// <summary>
		/// SupportByVersion Word 10, 11, 12, 14, 15, 16
		/// </summary>
		/// <remarks> Docs: <see href="https://docs.microsoft.com/en-us/office/vba/api/Word.TableStyle.Condition"/> </remarks>
		/// <param name="conditionCode">NetOffice.WordApi.Enums.WdConditionCode conditionCode</param>
		[SupportByVersion("Word", 10,11,12,14,15,16)]
		public NetOffice.WordApi.ConditionalStyle Condition(NetOffice.WordApi.Enums.WdConditionCode conditionCode)
		{
			return Factory.ExecuteKnownReferenceMethodGet<NetOffice.WordApi.ConditionalStyle>(this, "Condition", NetOffice.WordApi.ConditionalStyle.LateBindingApiWrapperType, conditionCode);
		}

		#endregion

		#pragma warning restore
	}
}


text:
[![NuGet Badge](https://buildstats.info/nuget/Toxy)](https://www.nuget.org/packages/Toxy)
[![Ko-Fi](https://img.shields.io/static/v1?style=flat-square&message=Support%20the%20Project&color=success&style=plastic&logo=ko-fi&label=$$)](https://ko-fi.com/tonyqus)
[![netstandard2.0](https://img.shields.io/badge/netstandard-2.0-brightgreen.svg)](https://img.shields.io/badge/netstandard-2.0-brightgreen.svg)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square&logo=Apache)](License.md)

What's Toxy
============
Toxy is a .NET data/text extraction framework similar to Apache Tika in Java. It supports a lot of popular formats such as docx, xlsx, xls, pdf, csv, txt, epub, html and so on.

![image](https://user-images.githubusercontent.com/772561/131231873-e22b4170-1dd5-4e35-b928-7732c80065ea.png)

Why Toxy
============
In the past, we have to use IFilter to extract texts from other documents. But Toxy is platform independent. It will try to support not only Windows but also Linux. Toxy is very easy to use and friendly. You don't need to care much about what extension you are extracting because it is a clever framework to help identify the file formats and extract the data/text into a unified structure.

Toxy Objects
==================
- ToxyDocument - the data structure extracted for documents
- ToxySpreadsheet - the data structure extracted for spreadsheets
- ToxyEmail - the data structure extracted for emails
- ToxyBusinessCard - the data structure extracted for business cards
- ToxyDom - the data structure extracted for DOM based document
- ToxyMetadata - the data structure extracted for other files with meta data

redpajama_set_name: RedPajamaGithub


text:
package com.google.cloud.networksecurity.v1beta1.samples;

// [START networksecurity_v1beta1_generated_NetworkSecurity_GetAuthorizationPolicy_async]
import com.google.api.core.ApiFuture;
import com.google.cloud.networksecurity.v1beta1.AuthorizationPolicy;
import com.google.cloud.networksecurity.v1beta1.AuthorizationPolicyName;
import com.google.cloud.networksecurity.v1beta1.GetAuthorizationPolicyRequest;
import com.google.cloud.networksecurity.v1beta1.NetworkSecurityClient;

public class AsyncGetAuthorizationPolicy {

  public static void main(String[] args) throws Exception {
    asyncGetAuthorizationPolicy();
  }

  public static void asyncGetAuthorizationPolicy() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (NetworkSecurityClient networkSecurityClient = NetworkSecurityClient.create()) {
      GetAuthorizationPolicyRequest request =
          GetAuthorizationPolicyRequest.newBuilder()
              .setName(
                  AuthorizationPolicyName.of("[PROJECT]", "[LOCATION]", "[AUTHORIZATION_POLICY]")
                      .toString())
              .build();
      ApiFuture<AuthorizationPolicy> future =
          networkSecurityClient.getAuthorizationPolicyCallable().futureCall(request);
      // Do something.
      AuthorizationPolicy response = future.get();
    }
  }
}
// [END networksecurity_v1beta1_generated_NetworkSecurity_GetAuthorizationPolicy_async]


text:
#include "rbosl_state.h"
#include "rbosl_piece.h"

using namespace osl;

VALUE cSimpleState;

void
rbosl_simpleState_free(state::SimpleState* ptr)
{
  ptr->~SimpleState();
  ruby_xfree(ptr);
}

static VALUE
rbosl_simpleState_s_new(VALUE self)
{
  state::SimpleState* ptr = new state::SimpleState(HIRATE);
  return Data_Wrap_Struct(self, NULL, rbosl_simpleState_free, ptr);
}

static VALUE
rbosl_simpleState_show(VALUE self)
{
  state::SimpleState* ptr;
  Data_Get_Struct(self, state::SimpleState, ptr);
  std::cout << *ptr << std::endl;
  return Qnil;
}

static VALUE
rbosl_simpleState_pieceAt(VALUE self, VALUE rb_square)
{
  state::SimpleState* ptr;
  Data_Get_Struct(self, state::SimpleState, ptr);

  Square* c_square;
  if (TYPE(rb_square) == T_STRING) {
    Square tmp_square = record::csa::strToPos(StringValuePtr(rb_square));
    c_square = &tmp_square;
  } else {
    Data_Get_Struct(rb_square, Square, c_square);
  }

  Piece c_piece = ptr->pieceAt(*c_square);
  VALUE rb_piece = Data_Wrap_Struct(cPiece, NULL, NULL, &c_piece);

  return rb_piece;
}

#ifdef __cplusplus
extern "C" {
#endif
void
rbosl_simpleState_init(VALUE mState)
{
  cSimpleState = rb_define_class_under(mState, "SimpleState", rb_cObject);
  rb_define_singleton_method(cSimpleState, "new", RUBY_METHOD_FUNC(rbosl_simpleState_s_new), 0);
  rb_define_method(cSimpleState, "show", RUBY_METHOD_FUNC(rbosl_simpleState_show), 0);
  rb_define_method(cSimpleState, "pieceAt", RUBY_METHOD_FUNC(rbosl_simpleState_pieceAt), 1);
  rb_define_alias(cSimpleState, "at", "pieceAt");
}
#ifdef __cplusplus
} /* extern "C" */
#endif


text:
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
 * The initial value of Boolean.prototype is the Boolean
 * prototype object
 *
 * @path ch15/15.6/15.6.3/15.6.3.1/S15.6.3.1_A1.js
 * @description Checking Boolean.prototype property
 */

//CHECK#1
if (typeof Boolean.prototype !== "object") {
  $ERROR('#1: typeof Boolean.prototype === "object"');
}

//CHECK#2
if (Boolean.prototype != false) {
  $ERROR('#2: Boolean.prototype == false');
}

delete Boolean.prototype.toString;

if (Boolean.prototype.toString() !== "[object Boolean]") {
  $ERROR('#3: The [[Class]] property of the Boolean prototype object is set to "Boolean"');
}


text:
namespace RS {

    // Difference algorithm
    // Implementation of the Myers algorithm
    // http://xmailserver.org/diff2.pdf

    template <typename RandomAccessRange>
    struct DiffEntry {
        using iterator = Meta::RangeIterator<const RandomAccessRange>;
        using subrange = Irange<iterator>;
        subrange del, ins;
    };

    template <typename RandomAccessRange> using DiffList = std::vector<DiffEntry<RandomAccessRange>>;

    namespace RS_Detail {

        struct DiffHelper {
            using match_function = std::function<bool(ptrdiff_t, ptrdiff_t)>;
            using insert_function = std::function<void(size_t, size_t, size_t, size_t)>;
            using offset_pair = std::pair<ptrdiff_t, ptrdiff_t>;
            using offset_list = std::vector<ptrdiff_t>;
            using offset_iterator = offset_list::iterator;
            offset_list fwdpath, revpath;
            offset_iterator fwd, rev;
            std::vector<bool> lchanges, rchanges;
            size_t lsize, rsize;
            match_function match;
            insert_function insert;
            DiffHelper(size_t lcount, size_t rcount):
                fwdpath(2 * (lcount + rcount + 1)), revpath(2 * (lcount + rcount + 1)),
                fwd(fwdpath.begin() + lcount + rcount + 1), rev(revpath.begin() + lcount + rcount + 1),
                lchanges(lcount, false), rchanges(rcount, false),
                lsize(lcount), rsize(rcount),
                match(), insert() {}
            void collect_diffs() {
                size_t lpos = 0, rpos = 0;
                for (; lpos != lsize && rpos != rsize; ++lpos, ++rpos) {
                    size_t lstart = lpos, rstart = rpos;
                    for (; lpos != lsize && lchanges[lpos]; ++lpos) {}
                    for (; rpos != rsize && rchanges[rpos]; ++rpos) {}
                    if (lstart != lpos || rstart != rpos)
                        insert(lstart, lpos, rstart, rpos);
                }
                if (lpos != lsize || rpos != rsize)
                    insert(lpos, lsize, rpos, rsize);
            }
            void longest_common(ptrdiff_t l1, ptrdiff_t l2, ptrdiff_t r1, ptrdiff_t r2) {
                for (; l1 < l2 && r1 < r2 && match(l1, r1); ++l1, ++r1) {}
                for (; l1 < l2 && r1 < r2 && match(l2 - 1, r2 - 1); --l2, --r2) {}
                if (l1 == l2) {
                    std::fill(rchanges.begin() + r1, rchanges.begin() + r2, true);
                    return;
                }
                if (r1 == r2) {
                    std::fill(lchanges.begin() + l1, lchanges.begin() + l2, true);
                    return;
                }
                fwd[1] = l1;
                rev[-1] = l2;
                ptrdiff_t d1 = l1 - r1, d2 = l2 - r2, delta = d2 - d1;
                for (ptrdiff_t d = 0;; ++d) {
                    for (ptrdiff_t k = - d; k <= d; k = k + 2) {
                        ptrdiff_t i = k == - d ? fwd[k + 1] : fwd[k - 1] + 1;
                        if (k < d)
                            i = std::max(i, fwd[k + 1]);
                        for (ptrdiff_t j = i - k - d1; i < l2 && j < r2 && match(i, j); ++i, ++j) {}
                        fwd[k] = i;
                        if ((delta & 1) && k > delta - d && k < delta + d && rev[k - delta] <= fwd[k]) {
                            longest_common(l1, fwd[k], r1, fwd[k] - k - d1);
                            longest_common(fwd[k], l2, fwd[k] - k - d1, r2);
                            return;
                        }
                    }
                    for (ptrdiff_t k = - d; k <= d; k = k + 2) {
                        ptrdiff_t i = k == d ? rev[k - 1] : rev[k + 1] - 1;
                        if (k > - d)
                            i = std::min(i, rev[k - 1]);
                        for (ptrdiff_t j = i - k - d2; i > l1 && j > r1 && match(i - 1, j - 1); --i, --j) {}
                        rev[k] = i;
                        if (! (delta & 1) && k >= - d - delta && k <= d - delta && rev[k] <= fwd[k + delta]) {
                            longest_common(l1, fwd[k + delta], r1, fwd[k + delta] - k - d2);
                            longest_common(fwd[k + delta], l2, fwd[k + delta] - k - d2, r2);
                            return;
                        }
                    }
                }
            }
        };

    }

    template <typename RandomAccessRange, typename EqualityPredicate>
    DiffList<RandomAccessRange> diff(const RandomAccessRange& lhs, const RandomAccessRange& rhs, EqualityPredicate eq) {
        using std::begin;
        using std::end;
        auto lbegin = begin(lhs), rbegin = begin(rhs);
        DiffList<RandomAccessRange> diffs;
        RS_Detail::DiffHelper d(range_count(lhs), range_count(rhs));
        d.match = [=] (ptrdiff_t i, ptrdiff_t j) { return eq(lbegin[i], rbegin[j]); };
        d.insert = [=,&diffs] (size_t lpos1, size_t lpos2, size_t rpos1, size_t rpos2) { diffs.push_back({{lbegin + lpos1, lbegin + lpos2}, {rbegin + rpos1, rbegin + rpos2}}); };
        d.longest_common(0, d.lsize, 0, d.rsize);
        d.collect_diffs();
        return diffs;
    }

    template <typename RandomAccessRange>
    DiffList<RandomAccessRange> diff(const RandomAccessRange& lhs, const RandomAccessRange& rhs) {
        return diff(lhs, rhs, std::equal_to<Meta::RangeValue<RandomAccessRange>>());
    }

    // Edit distance (Levenshtein distance)
    // Based on code by JuniorCompressor
    // http://stackoverflow.com/questions/29017600

    template <typename ForwardRange1, typename ForwardRange2, typename T>
    T edit_distance(const ForwardRange1& range1, const ForwardRange2& range2, T ins, T del, T sub) {
        static_assert(std::is_arithmetic<T>::value);
        using std::begin;
        const size_t n1 = range_count(range1), n2 = range_count(range2);
        std::vector<T> buf1(n2 + 1), buf2(n2 + 1);
        for (size_t j = 1; j <= n2; ++j)
            buf1[j] = buf1[j - 1] + ins;
        auto p = begin(range1);
        for (size_t i = 1; i <= n1; ++i, ++p) {
            buf2[0] = del * static_cast<T>(i);
            auto q = begin(range2);
            for (size_t j = 1; j <= n2; ++j, ++q)
                buf2[j] = std::min({buf2[j - 1] + ins, buf1[j] + del, buf1[j - 1] + (*p == *q ? T() : sub)});
            buf1.swap(buf2);
        }
        return buf1[n2];
    }

    template <typename ForwardRange1, typename ForwardRange2>
    size_t edit_distance(const ForwardRange1& range1, const ForwardRange2& range2) {
        return edit_distance(range1, range2, size_t(1), size_t(1), size_t(1));
    }

    // Find optimum

    template <typename ForwardRange, typename UnaryFunction, typename Compare>
    Meta::RangeIterator<ForwardRange> find_optimum(ForwardRange& range, UnaryFunction f, Compare c) {
        using std::begin;
        using std::end;
        auto i = begin(range), i_end = end(range);
        if (i == i_end)
            return i_end;
        auto opt = i;
        auto opt_value = f(*i);
        for (++i; i != i_end; ++i) {
            auto test_value = f(*i);
            if (c(test_value, opt_value)) {
                opt = i;
                opt_value = test_value;
            }
        }
        return opt;
    }

    template <typename ForwardRange, typename UnaryFunction>
    Meta::RangeIterator<ForwardRange> find_optimum(ForwardRange& range, UnaryFunction f) {
        return find_optimum(range, f, std::less<>());
    }

    // Order by index

    template <typename RandomAccessRange1, typename RandomAccessRange2>
    void order_by_index(RandomAccessRange1& range, RandomAccessRange2& index) {
        using std::begin;
        using std::end;
        using T = std::decay_t<decltype(*begin(range))>;
        using I = std::decay_t<decltype(*begin(index))>;
        I len = I(end(range) - begin(range));
        I i, j;
        T t;
        for (i = 0; i < len; ++i) {
            if (i != index[i]) {
                t = range[i];
                for (j = i; index[j] != i; std::swap(j, index[j]))
                    range[j] = range[index[j]];
                range[j] = t;
                index[j] = j;
            }
        }
    }

    // Paired for each

    template <typename InputRange1, typename InputRange2, typename BinaryFunction>
    void paired_for_each(InputRange1& range1, InputRange2& range2, BinaryFunction f) {
        using std::begin;
        using std::end;
        auto i = begin(range1), i_end = end(range1);
        auto j = begin(range2), j_end = end(range2);
        for (; i != i_end && j != j_end; ++i, ++j)
            f(*i, *j);
    }

    // Paired sort

    namespace RS_Detail {

        template <bool Stable, typename RandomAccessRange1, typename RandomAccessRange2, typename Compare>
        void paired_sort(RandomAccessRange1& range1, RandomAccessRange2& range2, Compare cmp) {
            using std::begin;
            using std::end;
            auto beg1 = begin(range1), end1 = end(range1);
            auto beg2 = begin(range2), end2 = end(range2);
            using T1 = std::decay_t<decltype(*beg1)>;
            using T2 = std::decay_t<decltype(*beg2)>;
            ptrdiff_t len = std::min(end1 - beg1, end2 - beg2);
            std::vector<ptrdiff_t> index(len);
            std::iota(index.begin(), index.end(), ptrdiff_t(0));
            auto cmp_index = [&] (ptrdiff_t i, ptrdiff_t j) { return cmp(beg1[i], beg1[j]); };
            if (Stable)
                std::stable_sort(index.begin(), index.end(), cmp_index);
            else
                std::sort(index.begin(), index.end(), cmp_index);
            ptrdiff_t i, j;
            T1 t1;
            T2 t2;
            for (i = 0; i < len; ++i) {
                if (i != index[i]) {
                    t1 = range1[i];
                    t2 = range2[i];
                    j = i;
                    for (j = i; index[j] != i; std::swap(j, index[j])) {
                        range1[j] = range1[index[j]];
                        range2[j] = range2[index[j]];
                    }
                    range1[j] = t1;
                    range2[j] = t2;
                    index[j] = j;
                }
            }
        }

    }

    template <typename RandomAccessRange1, typename RandomAccessRange2>
    void paired_sort(RandomAccessRange1& range1, RandomAccessRange2& range2) {
        using std::begin;
        using T1 = std::decay_t<decltype(*begin(range1))>;
        RS_Detail::paired_sort<false>(range1, range2, std::less<T1>());
    }

    template <typename RandomAccessRange1, typename RandomAccessRange2, typename Compare>
    void paired_sort(RandomAccessRange1& range1, RandomAccessRange2& range2, Compare cmp) {
        RS_Detail::paired_sort<false>(range1, range2, cmp);
    }

    template <typename RandomAccessRange1, typename RandomAccessRange2>
    void paired_stable_sort(RandomAccessRange1& range1, RandomAccessRange2& range2) {
        using std::begin;
        using T1 = std::decay_t<decltype(*begin(range1))>;
        RS_Detail::paired_sort<true>(range1, range2, std::less<T1>());
    }

    template <typename RandomAccessRange1, typename RandomAccessRange2, typename Compare>
    void paired_stable_sort(RandomAccessRange1& range1, RandomAccessRange2& range2, Compare cmp) {
        RS_Detail::paired_sort<true>(range1, range2, cmp);
    }

    // Paired transform

    template <typename InputRange1, typename InputRange2, typename OutputIterator, typename BinaryFunction>
    void paired_transform(const InputRange1& range1, const InputRange2& range2, OutputIterator out, BinaryFunction f) {
        using std::begin;
        using std::end;
        auto i = begin(range1), i_end = end(range1);
        auto j = begin(range2), j_end = end(range2);
        for (; i != i_end && j != j_end; ++i, ++j, ++out)
            *out = f(*i, *j);
    }

    // Tuple algorithms

    namespace RS_Detail {

        template <size_t Index, typename UnaryFunction, typename... TS>
        void tuple_for_each_helper(std::tuple<TS...>& tuple, UnaryFunction f) {
            if constexpr (Index < sizeof...(TS)) {
                f(std::get<Index>(tuple));
                tuple_for_each_helper<Index + 1>(tuple, f);
            }
            // Compiler brain damage
            (void)tuple;
            (void)f;
        }

    }

    template <typename UnaryFunction, typename... TS>
    void tuple_for_each(std::tuple<TS...>& tuple, UnaryFunction f) {
        RS_Detail::tuple_for_each_helper<0>(tuple, f);
    }

}


text:
// <copyright file="PropertyInfoExtensions.cs" company="Matt Brailsford">
// Copyright (c) 2019 Matt Brailsford and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>

using System.Reflection;
using Umbraco.Core;
using Umbraco.Core.Persistence;

namespace Fluidity.Extensions
{
    internal static class PropertyInfoExtensions
    {
        public static string GetColumnName(this PropertyInfo propertyInfo)
        {
            var columnAttr = propertyInfo.GetCustomAttribute<ColumnAttribute>();
            if (columnAttr != null && !columnAttr.Name.IsNullOrWhiteSpace())
            {
                return columnAttr.Name.Trim('[', ']');
            }

            return propertyInfo.Name;
        }
    }
}


text:
import { assign } from 'ember-utils';
import {
  runInDebug,
  Error as EmberError,
  _addBeforeObserver
} from 'ember-metal';

import hasElement from './has_element';
/**
@module ember
@submodule ember-views
*/

const inDOM = Object.create(hasElement);

assign(inDOM, {
  enter(view) {
    // Register the view for event handling. This hash is used by
    // Ember.EventDispatcher to dispatch incoming events.
    view.renderer.register(view);

    runInDebug(() => {
      _addBeforeObserver(view, 'elementId', () => {
        throw new EmberError('Changing a view\'s elementId after creation is not allowed');
      });
    });
  },

  exit(view) {
    view.renderer.unregister(view);
  }
});

export default inDOM;


text:
var log = require('winston');
var moment = require('moment');
var config = require('./config/config.js');
var fitbitConnector = require('./fitbitconnector.js');
var mysql = require('./mysql.js');
var processingFlag = false;
var quitFlag = false;

function retrieveData() {
  if(!processingFlag && !quitFlag) {
    processingFlag = true;
    fitbitConnector.tokenRefresh()
    .then(() => mysql.query(['SELECT table_name, time FROM completeness'])) // queryAsync will run asynchronous to the promise chain if called directly with static arguments
    .then(function(rows) {
      return new Promise(function(fulfill, reject){
        completeness = {};
        for(var i=0;i<rows.length;i++)
        {
          let startTime;
          if (rows[i].time === null) startTime = moment(config.FITBIT_ACCOUNT_CREATION);
          else startTime = moment(rows[i].time);
          let startDay = moment(startTime).startOf('day');
          completeness[rows[i].table_name] = {
            'startTime': startTime,
            'startDay': startDay,
            'currentDay': moment().startOf('day'),
            'nextDay': moment(startDay).add(1, 'd')
          };
        }
        var itemList = [processItem('fat'), processItem('weight'), processItem('hr'), processItem('activity'), processItem('sleep')];
        // processItem('fat'), processItem('weight'), processItem('hr'), processItem('activity'), processItem('sleep')
        Promise.all(itemList)
        .then(() => { log.info('Work unit processed.'); if (process.argv[2] != 'notinteractive') log.info('Press "r" to retrieve another day or "q" to quit.'); processingFlag = false; })
        .then(() => { abortPoint(quitFlag, processingFlag); })
        .catch(function(err) { processingFlag = false; reject(err); return; });
        fulfill();
      });
    })
    .catch(function(err) { log.error(err); processingFlag = false; });
  }
  else {
    if(processingFlag) log.warn('retrieveData() is already running.');
    abortPoint(quitFlag, processingFlag)
    .catch(log.error);
  }
};

function abortPoint(quit, processing) {
  return new Promise(function(fulfill, reject){
    if(!quit) { Promise.resolve(); return; }
    if (!processing)
    {
      log.info('fitjunction shutting down.');
      mysql.close()
      .then(() => process.exit(0))
      .catch(function(err) { log.error(err); process.exit(1); });
    }
    else { log.info('Exit requested but tasks are still running. Fitjunction will shutdown after tasks are finished.'); Promise.resolve(); }
  });
};

function setQuitFlag() {
  quitFlag = true;
};

function processItem(dataType) {
  switch(dataType) {
    case 'fat':
      return fitbitConnector.apiRequest('body/log/fat/date/' + completeness.body_fat.startDay.format('YYYY-MM-DD') + '.json')
      .then(fitbitDataWriter)
      .catch(log.error);
      break;
    case 'weight':
      return fitbitConnector.apiRequest('body/log/weight/date/' + completeness.weight.startDay.format('YYYY-MM-DD') + '.json')
      .then(fitbitDataWriter)
      .catch(log.error);
      break;
    case 'hr':
      return fitbitConnector.apiRequest('activities/heart/date/' + completeness.hr_intraday.startDay.format('YYYY-MM-DD') + '/1d/1sec.json')
      .then(fitbitDataWriter)
      .catch(log.error);
      break;
    case 'activity':
      let getActivities = [
        fitbitConnector.apiRequest('activities/steps/date/' + completeness.activity_intraday.startDay.format('YYYY-MM-DD') + '/1d/1min.json'),
        fitbitConnector.apiRequest('activities/distance/date/' + completeness.activity_intraday.startDay.format('YYYY-MM-DD') + '/1d/1min.json'),
        fitbitConnector.apiRequest('activities/floors/date/' + completeness.activity_intraday.startDay.format('YYYY-MM-DD') + '/1d/1min.json'),
        fitbitConnector.apiRequest('activities/elevation/date/' + completeness.activity_intraday.startDay.format('YYYY-MM-DD') + '/1d/1min.json'),
        fitbitConnector.apiRequest('activities/calories/date/' + completeness.activity_intraday.startDay.format('YYYY-MM-DD') + '/1d/1min.json')
      ];
      return Promise.all(getActivities)
      .then(function(result) {
        return Promise.resolve({
            'steps': result[0]['activities-steps-intraday']['dataset'],
            'distance': result[1]['activities-distance-intraday']['dataset'],
            'floors': result[2]['activities-floors-intraday']['dataset'],
            'elevation': result[3]['activities-elevation-intraday']['dataset'],
            'calories': result[4]['activities-calories-intraday']['dataset']
        });
      })
      .then(fitbitDataWriter)
      .catch(log.error);
      break;
    case 'sleep':
      return fitbitConnector.apiRequest('sleep/date/' + completeness.sleep.startDay.format('YYYY-MM-DD') + '.json')
      .then(fitbitDataWriter)
      .catch(log.error);
      break;
    default:
      log.error('unknown data type requested');
      return Promise.resolve();
  }
};

function updateCompleteness(tableName, currentEntry, connection) {
  if (currentEntry == 'false') log.info('No "' + tableName + '" data for ' + completeness[tableName].startDay.format('YYYY-MM-DD') + ', updating completeness table.');
  else log.info('"' + tableName + '" data for ' + completeness[tableName].startDay.format('YYYY-MM-DD') + ' written, updating completeness table.');
  if (completeness[tableName].startDay < completeness[tableName].currentDay) return mysql.query(['UPDATE completeness SET time = ? WHERE table_name = ?', [completeness[tableName].nextDay.format('YYYY-MM-DD'), tableName]], connection);
  else
  {
    if (currentEntry == 'false') return mysql.query(['UPDATE completeness SET time = ? WHERE table_name = ?', [completeness[tableName].currentDay.format('YYYY-MM-DD'), tableName]], connection);
    else {
      log.debug('Setting completeness to ' + currentEntry.format('YYYY-MM-DD HH:mm:ss') + ' for table ' + tableName);
      return mysql.query(['UPDATE completeness SET time = ? WHERE table_name = ?', [currentEntry.format('YYYY-MM-DD HH:mm:ss'), tableName]], connection);
    }
  }
};

function fitbitDataWriter(result) {
  switch(Object.keys(result)[0]) {
    case 'fat':
      log.verbose('Start processing body fat data.');
      let fat = result['fat'];
      if (Object.keys(fat).length == 0) return updateCompleteness('body_fat','false');
      else {
        let rows = [];
        let newestEntry = moment(completeness.body_fat.startTime);
        let currentEntry;
        Object.keys(fat).forEach(function(key) {
          currentEntry = moment(fat[key]['date'] + ' ' + fat[key]['time']);
          if (currentEntry > completeness.body_fat.startTime)
          {
            rows.push('("' + currentEntry.format('YYYY-MM-DD HH:mm:ss') + '", "' + fat[key]['fat'] + '")');
            if (currentEntry > newestEntry) newestEntry = moment(currentEntry);
          }
        });
        if (Object.keys(rows).length == 0) return;
        let allRows = rows.join(', ');
        return mysql.startTransaction()
        .then(function(connection) {
          return mysql.query(['INSERT INTO body_fat (time, fat) VALUES ' + allRows], connection)
          .then(() => updateCompleteness('body_fat', newestEntry, connection))
          .then(() => mysql.commit(connection))
          .catch((err) => mysql.rollback(connection, err));
        })
        .catch(log.error);
      }
      break;
    case 'weight':
      log.verbose('Start processing weight data.');
      let weight = result['weight'];
      if (Object.keys(weight).length == 0) return updateCompleteness('weight','false');
      else {
        let rows = [];
        let newestEntry = moment(completeness.weight.startTime);
        let currentEntry;
        Object.keys(weight).forEach(function(key) {
          currentEntry = moment(weight[key]['date'] + ' ' + weight[key]['time']);
          if (currentEntry > completeness.weight.startTime)
          {
            rows.push('("' + currentEntry.format('YYYY-MM-DD HH:mm:ss') + '", "' + weight[key]['weight'] + '", "' + weight[key]['bmi'] + '")');
            if (currentEntry > newestEntry) newestEntry = moment(currentEntry);
          }
        });
        if (Object.keys(rows).length == 0) return;
        let allRows = rows.join(', ');
        return mysql.startTransaction()
        .then(function(connection) {
          return mysql.query(['INSERT INTO weight (time, weight, bmi) VALUES ' + allRows], connection)
          .then(() => updateCompleteness('weight', newestEntry, connection))
          .then(() => mysql.commit(connection))
          .catch((err) => mysql.rollback(connection, err));
        })
        .catch(log.error);
      }
      break;
    case 'activities-heart':
      log.verbose('Start processing hr data.');
      let restingHeartRate = result['activities-heart'][0]['value']['restingHeartRate'];  // value might still be undefined even if there's Intraday Data
      let heartRateIntraday = result['activities-heart-intraday']['dataset'];
      if (Object.keys(heartRateIntraday).length == 0) return updateCompleteness('hr_intraday','false');
      else {
        let rows = [];
        let currentEntry;
        if(completeness.hr_intraday.startTime.get('h')+completeness.hr_intraday.startTime.get('m')+completeness.hr_intraday.startTime.get('s') == 0) {
          // subtract 1 second if the day starts at 00:00:00 in case the first value is also 00:00:00
          completeness.hr_intraday.startTime.subtract(1, 's');
        }
        Object.keys(heartRateIntraday).forEach(function(key) {
          currentEntry = moment(completeness.hr_intraday.startDay.format('YYYY-MM-DD') + ' ' + heartRateIntraday[key]['time']);
          if(currentEntry > completeness.hr_intraday.startTime && currentEntry.format('HH:mm:ss') == heartRateIntraday[key]['time']) rows.push('("' + currentEntry.format('YYYY-MM-DD HH:mm:ss') + '", "' + heartRateIntraday[key]['value'] + '")'); // second condition of if detects if time has been adjusted for begin of DST
          else if(currentEntry.format('HH:mm:ss') != heartRateIntraday[key]['time']) log.debug('Skipping over DST transition (hr_intraday time: ' + heartRateIntraday[key]['time'] + ')');
        });
        let allRows = rows.join(', ');
        return mysql.startTransaction()
        .then(function(connection) {
          function writeIntraday(connection) {
            if(allRows.length > 0) return mysql.query(['INSERT INTO hr_intraday (time, hr) VALUES ' + allRows], connection);
            else return Promise.resolve();
          };
          function writeResting(connection) {
            if(restingHeartRate) return mysql.query(['INSERT INTO hr_resting (date, hr) VALUES (?, ?) ON DUPLICATE KEY UPDATE hr = ?', [completeness.hr_intraday.startDay.format('YYYY-MM-DD'), restingHeartRate, restingHeartRate]], connection);
            else return Promise.resolve();
          };

          return Promise.resolve()
          .then(() => writeIntraday(connection))
          .then(() => writeResting(connection))
          .then(() => updateCompleteness('hr_intraday', currentEntry, connection))
          .then(() => mysql.commit(connection))
          .catch((err) => mysql.rollback(connection, err));
        })
        .catch(log.error);
      }
      break;
    case 'steps':
      let rows = [];
      let currentEntry = moment(completeness.activity_intraday.startTime);
      let lastWrittenEntry = moment(completeness.activity_intraday.startTime);
      let lastKey = 0;
      Object.keys(result.steps).forEach(function(key) {
        currentEntry = moment(completeness.activity_intraday.startDay.format('YYYY-MM-DD') + ' ' + result.steps[key]['time']);
        if (currentEntry > completeness.activity_intraday.startTime && result.steps[key]['value'] > 0 && currentEntry.format('HH:mm:ss') == result.steps[key]['time'])  // third condition of if detects if time has been adjusted for begin of DST
        {
          lastKey = key;
          lastWrittenEntry = moment(currentEntry);
          rows.push('("' + currentEntry.format('YYYY-MM-DD HH:mm:ss') + '", "'
          + result.steps[key]['value'] + '", "'
          + result.distance[key]['value'] + '", "'
          + result.floors[key]['value'] + '", "'
          + result.elevation[key]['value'] + '", "'
          + result.calories[key]['level'] + '")');
        }
        else if(currentEntry.format('HH:mm:ss') != result.steps[key]['time']) log.debug('Skipping over DST transition (activity_intraday time: ' + result.steps[key]['time'] + ')');
      });
      log.debug('*** After activity loop');
      if (rows.length == 0) return updateCompleteness('activity_intraday', lastWrittenEntry);
      else {
        if (completeness.activity_intraday.startDay == completeness.activity_intraday.currentDay)
        {
          // reset currentEntry to the minute before the last row and remove last row. This is to make sure only complete minutes are written to the db
          // only if the day isn't over yet
          lastWrittenEntry = moment(completeness.activity_intraday.startDay.format('YYYY-MM-DD') + ' ' + result.steps[lastKey]['time']);
          lastWrittenEntry = moment(lastWrittenEntry).subtract(30, 'seconds');
          rows.splice(-1,1);
        }
        let allRows = rows.join(', ');
        return mysql.startTransaction()
        .then(function(connection) {
          return mysql.query(['INSERT INTO activity_intraday (time, steps, distance, floors, elevation, activity_level) VALUES ' + allRows], connection)
          .then(() => updateCompleteness('activity_intraday', lastWrittenEntry, connection))
          .then(() => mysql.commit(connection))
          .catch((err) => mysql.rollback(connection, err));
        })
        .catch(log.error);
      }
      break;
    case 'sleep':
      log.verbose('Start processing sleep data.');
      let sleep = result['sleep'];
      if (Object.keys(sleep).length == 0) return updateCompleteness('sleep','false');
      else {
        let currentEntry;
        let newestEntry = moment(completeness.sleep.startTime);
        let insertSleep = [];
        function sleepLog(key, connection) {
          let isMainSleep, startTime, endTime;
          if (sleep[key]['isMainSleep'] == true) isMainSleep = 1;
          else isMainSleep = 0;
          startTime = moment(sleep[key]['startTime']);
          endTime = moment(sleep[key]['startTime']);
          endTime.add(sleep[key]['timeInBed'], 'minutes');
          return mysql.query(['INSERT INTO sleep (is_main_sleep, efficiency, start_time, end_time, minutes_to_sleep, minutes_awake, minutes_after_wake, awake_count, awake_duration, restless_count, restless_duration, minutes_in_bed) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [isMainSleep, sleep[key]['efficiency'], startTime.format('YYYY-MM-DD HH:mm:ss'), endTime.format('YYYY-MM-DD HH:mm:ss'), sleep[key]['minutesToFallAsleep'], sleep[key]['minutesAwake'], sleep[key]['minutesAfterWakeup'], sleep[key]['awakeCount'], sleep[key]['awakeDuration'], sleep[key]['restlessCount'], sleep[key]['restlessDuration'], sleep[key]['timeInBed']]], connection)
          .then(function(result) {
            let rows = [];
            let minuteData = sleep[key]['minuteData'];
            let currentMinute = moment(startTime); // incrementing from the startTime value instead of using the dateTime value from minuteData so we don't have to deal with changing from one day another
            var previousDst = currentMinute.isDST();
            Object.keys(minuteData).forEach(function(sleepMinute) {
              rows.push('("' + currentMinute.format('YYYY-MM-DD HH:mm:ss') + '", "' + result.insertId + '", "' + minuteData[sleepMinute]['value'] + '")');
              currentMinute.add(1, 'minutes');
              if(previousDst == true && currentMinute.isDST() == false) currentMinute.add(1, 'hours'); // Adjust for switch from DST to no DST. For lack of a better solution we push the sleep 1 hour ahead. Wakeup time will be off by one hour but the sleep by minute data will be complete
            	previousDst = currentMinute.isDST();
            });
            let allRows = rows.join(', ');
            return Promise.resolve(['INSERT INTO sleep_by_minute (time, id_sleep, id_sleep_states) VALUES ' + allRows]);
          })
          .then((query) => mysql.query(query, connection));
          // No catch to prevent mysql.rollback from being called twice on the same connection
        };
        return mysql.startTransaction()
        .then(function(connection) {
          Object.keys(sleep).forEach(function(key) {
            currentEntry = moment(sleep[key]['startTime']).add(sleep[key]['timeInBed'], 'minutes'); // using endTime because the start time of the sleep will usually be the day before
            if (currentEntry > completeness.sleep.startTime) insertSleep.push(sleepLog(key, connection));
            if (currentEntry > newestEntry) newestEntry = moment(currentEntry);
          });
          return Promise.all(insertSleep)
          .then(() => updateCompleteness('sleep', newestEntry, connection))
          .then(() => mysql.commit(connection))
          .catch((err) => mysql.rollback(connection, err));
        })
        .catch(log.error);
      }
      break;
    default:
      Promise.reject('Data type of API result not recognized.');
  }
};

module.exports = {
  retrieveData: retrieveData,
  setQuitFlag: setQuitFlag,
};


text: A awesome jsdoc3 template


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.8" />
<title>git-describe(1)</title>

git-describe(1) Manual Page

NAME

git-describe -
   Show the most recent tag that is reachable from a commit

SYNOPSIS

git describe [--all] [--tags] [--contains] [--abbrev=<n>] <committish>…
git describe [--all] [--tags] [--contains] [--abbrev=<n>] --dirty[=<mark>]

DESCRIPTION

The command finds the most recent tag that is reachable from a
commit.  If the tag points to the commit, then only the tag is
shown.  Otherwise, it suffixes the tag name with the number of
additional commits on top of the tagged object and the
abbreviated object name of the most recent commit.

By default (without --all or --tags) git describe only shows
annotated tags.  For more information about creating annotated tags
see the -a and -s options to git-tag(1).

OPTIONS

<committish>…

        Committish object names to describe.

--dirty[=<mark>]

        Describe the working tree.
        It means describe HEAD and appends <mark> (-dirty by
        default) if the working tree is dirty.

--all

        Instead of using only the annotated tags, use any ref
        found in refs/ namespace.  This option enables matching
        any known branch, remote-tracking branch, or lightweight tag.

--tags

        Instead of using only the annotated tags, use any tag
        found in refs/tags namespace.  This option enables matching
        a lightweight (non-annotated) tag.

--contains

        Instead of finding the tag that predates the commit, find
        the tag that comes after the commit, and thus contains it.
        Automatically implies --tags.

--abbrev=<n>

        Instead of using the default 7 hexadecimal digits as the
        abbreviated object name, use <n> digits, or as many digits
        as needed to form a unique object name.  An <n> of 0
        will suppress long format, only showing the closest tag.

--candidates=<n>

        Instead of considering only the 10 most recent tags as
        candidates to describe the input committish consider
        up to <n> candidates.  Increasing <n> above 10 will take
        slightly longer but may produce a more accurate result.
        An <n> of 0 will cause only exact matches to be output.

--exact-match

        Only output exact matches (a tag directly references the
        supplied commit).  This is a synonym for --candidates=0.

--debug

        Verbosely display information about the searching strategy
        being employed to standard error.  The tag name will still
        be printed to standard out.

--long

        Always output the long format (the tag, the number of commits
        and the abbreviated commit name) even when it matches a tag.
        This is useful when you want to see parts of the commit object name
        in "describe" output, even when the commit in question happens to be
        a tagged version.  Instead of just emitting the tag name, it will
        describe such a commit as v1.2-0-gdeadbee (0th commit since tag v1.2
        that points at object deadbee….).

--match <pattern>

        Only consider tags matching the given pattern (can be used to avoid
        leaking private tags made from the repository).

--always

        Show uniquely abbreviated commit object as fallback.

EXAMPLES

With something like git.git current tree, I get:

[torvalds@g5 git]$ git describe parent
v1.0.4-14-g2414721

i.e. the current head of my "parent" branch is based on v1.0.4,
but since it has a few commits on top of that,
describe has added the number of additional commits ("14") and
an abbreviated object name for the commit itself ("2414721")
at the end.

The number of additional commits is the number
of commits which would be displayed by "git log v1.0.4..parent".
The hash suffix is "-g" + 7-char abbreviation for the tip commit
of parent (which was 2414721b194453f058079d897d13c4e377f92dc6).
The "g" prefix stands for "git" and is used to allow describing the version of
a software depending on the SCM the software is managed with. This is useful
in an environment where people may use different SCMs.

Doing a git describe on a tag-name will just show the tag name:

[torvalds@g5 git]$ git describe v1.0.4
v1.0.4

With --all, the command can use branch heads as references, so
the output shows the reference path as well:

[torvalds@g5 git]$ git describe --all --abbrev=4 v1.0.5^2
tags/v1.0.0-21-g975b

[torvalds@g5 git]$ git describe --all --abbrev=4 HEAD^
heads/lt/describe-7-g975b

With --abbrev set to 0, the command can be used to find the
closest tagname without any suffix:

[torvalds@g5 git]$ git describe --abbrev=0 v1.0.5^2
tags/v1.0.0

Note that the suffix you get if you type these commands today may be
longer than what Linus saw above when he ran these commands, as your
git repository may have new commits whose object names begin with
975b that did not exist back then, and "-g975b" suffix alone may not
be sufficient to disambiguate these commits.

SEARCH STRATEGY

For each committish supplied, git describe will first look for
a tag which tags exactly that commit.  Annotated tags will always
be preferred over lightweight tags, and tags with newer dates will
always be preferred over tags with older dates.  If an exact match
is found, its name will be output and searching will stop.

If an exact match was not found, git describe will walk back
through the commit history to locate an ancestor commit which
has been tagged.  The ancestor’s tag will be output along with an
abbreviation of the input committish’s SHA1.

If multiple tags were found during the walk then the tag which
has the fewest commits different from the input committish will be
selected and output.  Here fewest commits different is defined as
the number of commits which would be shown by git log tag..input
will be the smallest number of commits possible.

GIT

Part of the git(1) suite

Last updated 2012-08-22 12:54:47 PDT


text:
using System.Data.Entity.ModelConfiguration;
using ReMi.DataEntities.ProductRequests;

namespace ReMi.DataEntityMaps.ProductRequests
{
    public class ProductRequestRegistrationMap : EntityTypeConfiguration<ProductRequestRegistration>
    {
        public ProductRequestRegistrationMap()
        {
            HasRequired(x => x.ProductRequestType)
                .WithMany(x => x.Registrations)
                .HasForeignKey(x => x.ProductRequestTypeId)
                .WillCascadeOnDelete(false);

            HasRequired(o => o.CreatedBy).WithMany().HasForeignKey(o => o.CreatedByAccountId).WillCascadeOnDelete(false);

            HasOptional(x => x.RemovingReason)
                .WithRequired(x => x.ProductRequestRegistration)
                .WillCascadeOnDelete(true);
        }
    }
}


text:
require 'spec_helper'

RSpec.describe RailsAdmin::Config::Proxyable do
  class ProxyableTest
    include RailsAdmin::Config::Proxyable

    def boo
      sleep 0.15
      bindings[:foo]
    end

    def qux
      'foobar'
    end
  end

  let!(:proxyable_test) { ProxyableTest.new }
  subject do
    proxyable_test.bindings = {foo: 'bar'}
    proxyable_test
  end

  it 'proxies method calls to @object' do
    expect(subject.bindings).to eq foo: 'bar'
  end

  it 'preserves initially set @bindings' do
    expect(subject.with(foo: 'baz').tap(&:qux).bindings).to eq foo: 'bar'
  end

  context 'when a method is defined in Kernel' do
    before do
      Kernel.module_eval do
        def qux
          'quux'
        end
      end
    end

    after do
      Kernel.module_eval do
        undef qux
      end
    end

    it 'proxies calls for the method to @object' do
      expect(subject.qux).to eq 'foobar'
    end
  end

  describe 'with parallel execution' do
    it 'ensures thread-safety' do
      threads = Array.new(2) do |i|
        Thread.new do
          value = %w(a b)[i]
          proxy = proxyable_test.with foo: value
          sleep i * 0.1
          expect(proxy.boo).to eq value
        end
      end
      threads.each(&:join)
    end
  end
end


text:
<?php
namespace phtamas\yii2\mailer;

use yii\base\Object;
use yii\base\View;
use yii\base\ViewContextInterface;
use yii\helpers\FileHelper;

/**
 * @property string|array $from
 * @property string|array $sender
 * @property string|array $to
 * @property string|array $cc
 * @property string|array $bcc
 * @property bool $isHtml
 */
class Mail extends Object implements ViewContextInterface
{
    private $id;

    private $mailer;

    private $_viewPath;

    private $isHtml = true;

    private $_message;

    private $_view;

    private $_viewName;

    /**
     * @param string $id
     * @param \Swift_Mailer $mailer
     * @param array $config
     */
    public function __construct($id, \Swift_Mailer $mailer, $config = [])
    {
        $this->id = $id;
        $this->mailer = $mailer;
        parent::__construct($config);
    }

    /**
     * @return string
     */
    public function getViewPath()
    {
        if (!isset($this->_viewPath)) {
            $this->_viewPath =  \Yii::$app->viewPath . DIRECTORY_SEPARATOR . 'mails';
        }
        return $this->_viewPath;
    }

    /**
     * @param string $viewPath
     */
    public function setViewPath($viewPath)
    {
        $this->_viewPath = $viewPath;
    }

    /**
     * @return \Swift_Message
     */
    public function getMessage()
    {
        if (!isset($this->_message)) {
            $this->_message = new \Swift_Message();
        }
        return $this->_message;
    }

    /**
     * @return View
     */
    public function getView()
    {
        if (!isset($this->_view)) {
            $this->_view = \Yii::$app->view;
        }
        return $this->_view;
    }

    public function setView(View $view)
    {
        $this->_view = $view;
    }

    /**
     * @return string
     */
    public function getViewName()
    {
        return isset($this->_viewName) ? $this->_viewName : $this->id;
    }

    /**
     * @param string $viewName
     */
    public function setViewName($viewName)
    {
        $this->_viewName = $viewName;
    }

    /**
     * @return string|array
     */
    public function getForm()
    {
        return $this->getMessage()->getFrom();
    }

    /**
     * @param string|array $addresses
     * @param string $name
     * @return $this
     */
    public function setFrom($addresses, $name = null)
    {
        $this->getMessage()->setFrom($addresses, $name);
        return $this;
    }

    /**
     * @return string
     */
    public function getSender()
    {
        return $this->getMessage()->getSender();
    }

    /**
     * @param string $address
     * @param string $name
     * @return $this
     */
    public function setSender($address, $name = null)
    {
        $this->getMessage()->setSender($address, $name);
        return $this;
    }

    /**
     * @return array
     */
    public function getTo()
    {
        return $this->getMessage()->getTo();
    }

    /**
     * @param string|array $addresses
     * @param string $name
     * @return $this
     */
    public function setTo($addresses, $name = null)
    {
        $this->getMessage()->setTo($addresses, $name);
        return $this;
    }

    /**
     * @return array
     */
    public function getCc()
    {
        return $this->getMessage()->getCc();
    }

    /**
     * @param string|array $addresses
     * @param string $name
     * @return $this
     */
    public function setCc($addresses, $name = null)
    {
        $this->getMessage()->setCc($addresses, $name);
        return $this;
    }

    /**
     * @return array
     */
    public function getBcc()
    {
        return $this->getMessage()->getBcc();
    }

    /**
     * @param string|array $addresses
     * @param string $name
     * @return $this
     */
    public function setBcc($addresses, $name = null)
    {
        $this->getMessage()->setBcc($addresses, $name);
        return $this;
    }

    /**
     * @return string
     */
    public function getSubject()
    {
        return $this->getMessage()->getSubject();
    }

    /**
     * @param string $subject
     * @return $this
     */
    public function setSubject($subject)
    {
        $this->getMessage()->setSubject($subject);
        return $this;
    }

    /**
     * @param string $path
     * @param string $mimeType
     * @return $this
     */
    public function attachFile($path, $mimeType = null)
    {
        if (is_null($mimeType)) {
            $mimeType = FileHelper::getMimeType($path);
        }
        $this->getMessage()->attach(\Swift_Attachment::fromPath($path, $mimeType));
        return $this;
    }

    /**
     * @return bool
     */
    public function getIsHtml()
    {
        return $this->isHtml;
    }

    /**
     * @param bool $isHtml
     * @return $this
     */
    public function setIsHtml($isHtml)
    {
        $this->isHtml = $isHtml;
        return $this;
    }

    public function beginPlainTextBody()
    {
        if (!$this->isHtml) {
            throw new \BadMethodCallException('Plain tex mail cannot have additional plain text body.');
        }
        $this->getView()->beginBlock('mail.plainTextBody');
    }

    public function endPlainTextBody()
    {
        $this->getView()->endBlock();
    }

    /**
     * @param array $data
     */
    public function send(array $data = [])
    {
        if ($this->isHtml) {
            $htmlBody = $this->getView()->render($this->getViewName(), $data, $this);
            if (isset($this->getView()->blocks['mail.plainTextBody'])) {
                $plainTextBody = $this->getView()->blocks['mail.plainTextBody'];
                unset($this->getView()->blocks['mail.plainTextBody']);
            } else {
                $plainTextBody = strip_tags($htmlBody);
            }
            $this->getMessage()
                ->setContentType('text/html')
                ->setBody($htmlBody);
            $this->getMessage()
                ->addPart($plainTextBody, 'text/plain');
        } else {
            $this->getMessage()
                ->setContentType('text/plain')
                ->setBody($this->getView()->render($this->getViewName(), $data, $this));
        }
        $this->mailer->send($this->getMessage());
    }
}


text:
<?php

namespace mageekguy\atoum\tests\units\asserters;

use
	mageekguy\atoum,
	mageekguy\atoum\asserter,
	mageekguy\atoum\asserters,
	mageekguy\atoum\tools\diffs
;

require_once __DIR__ . '/../../runner.php';

class hash extends atoum\test
{
	public function testClass()
	{
		$this->testedClass->isSubclassOf('mageekguy\atoum\asserters\string');
	}

	public function testIsSha1()
	{
		$this
			->if($asserter = new asserters\hash($generator = new asserter\generator()))
			->and($asserter->setWith($value = hash('sha1', 'hello')))
			->then
				->object($asserter->isSha1())->isIdenticalTo($asserter)
			->if($asserter->setWith($value = strtoupper($value)))
			->then
				->object($asserter->isSha1())->isIdenticalTo($asserter)
			->if($asserter->setWith($newvalue = substr($value, 1)))
			->and($diff = new diffs\variable())
			->and($diff->setReference( $newvalue )->setData($value))
			->then
				->exception(function() use ($asserter, & $line) { $line = __LINE__; $asserter->isSha1(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage(sprintf($this->getLocale()->_('%s should be a string of %d characters'), $asserter, strlen($value)))
			->if($asserter->setWith($newvalue = 'z'.substr($value, 1) ))
			->and($diff = new diffs\variable())
			->and($diff->setReference($newvalue)->setData($value))
			->then
				->exception(function() use ($asserter, & $line) { $line = __LINE__; $asserter->isSha1(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage(sprintf($generator->getLocale()->_('%s does not match given pattern'), $asserter))
		;
	}

	public function testIsSha256()
	{
		$this
			->if($asserter = new asserters\hash($generator = new asserter\generator()))
			->and($asserter->setWith($value = hash('sha256', 'hello')))
			->then
				->object($asserter->isSha256())->isIdenticalTo($asserter)
			->if($asserter->setWith($value = strtoupper($value)))
			->then
				->object($asserter->isSha256())->isIdenticalTo($asserter)
			->if($asserter->setWith($newvalue = substr($value, 1)))
			->and($diff = new diffs\variable())
			->and($diff->setReference( $newvalue )->setData($value))
			->then
				->exception(function() use ($asserter, & $line) { $line = __LINE__; $asserter->isSha256(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage(sprintf($this->getLocale()->_('%s should be a string of %d characters'), $asserter, strlen($value)))
			->if($asserter->setWith($newvalue = 'z'.substr($value, 1) ))
			->and($diff = new diffs\variable())
			->and($diff->setReference($newvalue)->setData($value))
			->then
				->exception(function() use ($asserter, & $line) { $line = __LINE__; $asserter->isSha256(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage(sprintf($generator->getLocale()->_('%s does not match given pattern'), $asserter))
		;
	}

	public function testIsSha512()
	{
		$this
			->if($asserter = new asserters\hash($generator = new asserter\generator()))
			->and($asserter->setWith($value = hash('sha512', 'hello')))
			->then
				->object($asserter->isSha512())->isIdenticalTo($asserter)
			->if($asserter->setWith($value = strtoupper($value)))
			->then
				->object($asserter->isSha512())->isIdenticalTo($asserter)
			->if($asserter->setWith($newvalue = substr($value, 1)))
			->and($diff = new diffs\variable())
			->and($diff->setReference( $newvalue )->setData($value))
			->then
				->exception(function() use ($asserter, & $line) { $line = __LINE__; $asserter->isSha512(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage(sprintf($this->getLocale()->_('%s should be a string of %d characters'), $asserter, strlen($value)))
			->if($asserter->setWith($newvalue = 'z'.substr($value, 1) ))
			->and($diff = new diffs\variable())
			->and($diff->setReference($newvalue)->setData($value))
			->then
				->exception(function() use ($asserter, & $line) { $line = __LINE__; $asserter->isSha512(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage(sprintf($generator->getLocale()->_('%s does not match given pattern'), $asserter))
		;
	}

	public function testIsMd5()
	{
		$this
			->if($asserter = new asserters\hash($generator = new asserter\generator()))
			->and($asserter->setWith($value = hash('md5', 'hello')))
			->then
				->object($asserter->isMd5())->isIdenticalTo($asserter)
			->if($asserter->setWith($value = strtoupper($value)))
			->then
				->object($asserter->isMd5())->isIdenticalTo($asserter)
			->if($asserter->setWith($newvalue = substr($value, 1)))
			->and($diff = new diffs\variable())
			->and($diff->setReference( $newvalue )->setData($value))
			->then
				->exception(function() use ($asserter, & $line) { $line = __LINE__; $asserter->isMd5(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage(sprintf($this->getLocale()->_('%s should be a string of %d characters'), $asserter, strlen($value)))
			->if($asserter->setWith($newvalue = 'z'.substr($value, 1) ))
			->and($diff = new diffs\variable())
			->and($diff->setReference($newvalue)->setData($value))
			->then
				->exception(function() use ($asserter, & $line) { $line = __LINE__; $asserter->isMd5(); })
					->isInstanceOf('mageekguy\atoum\asserter\exception')
					->hasMessage(sprintf($generator->getLocale()->_('%s does not match given pattern'), $asserter))
		;
	}
}


text:
package org.jboss.pnc.spi.notifications.model;

public enum EventType {
    BUILD_STATUS_CHANGED, BUILD_SET_STATUS_CHANGED
}


text:
create table user
(
  id integer
    constraint user_pk
      primary key autoincrement,
  fullName text,
  email text
);

INSERT INTO user VALUES ('1', 'Marco Pivetta', 'adf@sdfsd.com');
INSERT INTO user VALUES ('2', 'Marco Pivetta', 'adf@sdfsd.com');
INSERT INTO user VALUES ('3', 'Marco Pivetta', 'adf@sdfsd.com');


text:
package org.webcurator.ui.admin.controller;

import static org.junit.Assert.*;

import java.util.List;

import org.acegisecurity.providers.dao.salt.SystemWideSaltSource;
import org.acegisecurity.providers.encoding.PasswordEncoder;
import org.acegisecurity.providers.encoding.ShaPasswordEncoder;
import org.junit.Test;
import org.springframework.context.MockMessageSource;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.validation.BindException;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.servlet.ModelAndView;
import org.webcurator.auth.AuthorityManager;
import org.webcurator.auth.AuthorityManagerImpl;
import org.webcurator.core.agency.AgencyUserManager;
import org.webcurator.core.agency.MockAgencyUserManagerImpl;
import org.webcurator.domain.model.auth.Agency;
import org.webcurator.test.BaseWCTTest;
import org.webcurator.ui.admin.command.*;

public class ChangePasswordControllerTest extends BaseWCTTest<ChangePasswordController>{

	public ChangePasswordControllerTest()
	{
		super(ChangePasswordController.class,
				"src/test/java/org/webcurator/ui/admin/controller/CreateUserControllerTest.xml");
	}

	@Test
	public final void testChangePasswordController() {
		assertTrue(testInstance != null);
	}

	@Test
	public final void testInitBinder() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestDataBinder binder = new ServletRequestDataBinder(new CreateUserCommand(), "command");
		try
		{
			testInstance.initBinder(request, binder);
		}
		catch (Exception e)
		{
			String message = e.getClass().toString() + " - " + e.getMessage();
			log.debug(message);
			fail(message);
		}
	}

	@Test
	public final void testShowForm() {
		try
		{
			MockHttpServletRequest request = new MockHttpServletRequest();
			MockHttpServletResponse response = new MockHttpServletResponse();
			BindException aError = new BindException(new CreateUserCommand(), CreateUserCommand.ACTION_EDIT);
			AgencyUserManager manager = new MockAgencyUserManagerImpl(testFile);
			testInstance.setAgencyUserManager(manager);
			testInstance.showForm(request, response, aError);
		}
		catch (Exception e)
		{
			String message = e.getClass().toString() + " - " + e.getMessage();
			log.debug(message);
			fail(message);
		}
	}

	@Test
	public final void testProcessFormSubmission() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		MockHttpServletResponse response = new MockHttpServletResponse();
		BindException aError = new BindException(new CreateUserCommand(), CreateUserCommand.ACTION_EDIT);
		testSetAgencyUserManager();
		testSetAuthorityManager();
		testSetMessageSource();
		testSetEncoder();
		testSetSalt();

		try
		{
			ChangePasswordCommand aCommand = new ChangePasswordCommand();
			aCommand.setAction(ChangePasswordCommand.ACTION_SAVE);
			aCommand.setUserOid(1000L);
			aCommand.setNewPwd("Pa55word");
			aCommand.setConfirmPwd("Pa55word");
			ModelAndView mav = testInstance.processFormSubmission(request, response, aCommand, aError);
			assertTrue(mav != null);
			assertTrue(mav.getViewName().equals("viewUsers"));
			List<Agency> agencies = (List<Agency>)mav.getModel().get("agencies");
			assertTrue(agencies != null);
			assertTrue(agencies.size() > 0);
		}
		catch (Exception e)
		{
			String message = e.getClass().toString() + " - " + e.getMessage();
			log.debug(message);
			fail(message);
		}

	}

	@Test
	public final void testSetEncoder() {
		PasswordEncoder passwordEncoder = new ShaPasswordEncoder();
		testInstance.setEncoder(passwordEncoder);
	}

	@Test
	public final void testSetSalt() {
		SystemWideSaltSource saltSource = new SystemWideSaltSource();
		saltSource.setSystemWideSalt("Rand0mS4lt");
		testInstance.setSalt(saltSource);
	}

	@Test
	public final void testSetAgencyUserManager() {
		try
		{
			AgencyUserManager manager = new MockAgencyUserManagerImpl(testFile);
			testInstance.setAgencyUserManager(manager);
		}
		catch(Exception e)
		{
			String message = e.getClass().toString() + " - " + e.getMessage();
			log.debug(message);
			fail(message);
		}
	}

	@Test
	public final void testSetAuthorityManager() {
		try
		{
			AuthorityManager manager = new AuthorityManagerImpl();
			testInstance.setAuthorityManager(manager);
		}
		catch(Exception e)
		{
			String message = e.getClass().toString() + " - " + e.getMessage();
			log.debug(message);
			fail(message);
		}
	}

	@Test
	public final void testSetMessageSource() {
		try
		{
			testInstance.setMessageSource(new MockMessageSource());
		}
		catch(Exception e)
		{
			String message = e.getClass().toString() + " - " + e.getMessage();
			log.debug(message);
			fail(message);
		}
	}

}


text:
class UsersController < ApplicationController
  def show
    @user = User.find(params[:id])
    @listings = @user.listings.active
  end
end


text:
function(keys, values) {
  return null;
}


text:
/*@file AGSMapViewBase.h */

@class AGSSpatialReference;
@class AGSPolygon;
@class AGSPoint;
@class AGSEnvelope;
@class AGSTimeExtent;
@class AGSGeometry;
@class AGSGraphic;
@class AGSLayer;
@class AGSGraphicsLayer;
@class AGSLocationDisplay;
@class AGSCallout;
@protocol AGSMapViewLayerDelegate;
@protocol AGSMapViewCalloutDelegate;
@protocol AGSMapViewTouchDelegate;

/** Notification that indicates that an AGSMapView finished zooming.
 @since 10.1.1
 */
AGS_EXTERN NSString *const AGSMapViewDidEndZoomingNotification;

/** Notification that indicates that an AGSMapView finished panning.
 @since 10.1.1
 */
AGS_EXTERN NSString *const AGSMapViewDidEndPanningNotification;

/** @class AGSMapViewBase
 @brief A base class for AGSMapView

 A base class for @c AGSMapView to facilitate code reuse between iOS and Mac platforms
 */

@interface AGSMapViewBase : UIView
{
@protected
    CGFloat _screenScale;
    CGFloat _screenScaleInverse;
}

/** @property id<AGSMapViewLayerDelegate> layerDelegate
 Delegate to be notified when map layer actions occur. The delegate class must
 adopt the @c AGSMapViewLayerDelegate protocol.
 @since 1.8
 */
@property (nonatomic, weak) id<AGSMapViewLayerDelegate> layerDelegate;

/** Delegate to be notified when touch events occur on the map.The delegate class must
 adopt the @c AGSMapViewTouchDelegate protocol.
 @since 1.8
 */
@property (nonatomic, weak) id<AGSMapViewTouchDelegate> touchDelegate;

/** Delegate to be notified when map callout actions occur.The delegate class must
 adopt the @c AGSMapViewCalloutDelegate protocol.
 @since 1.8
 */
@property (nonatomic, weak) id<AGSMapViewCalloutDelegate> calloutDelegate;

/** Array of @c AGSLayer objects representing the layers in the map. Depending upon the type of layer, each object
 will be specific sub-class of @c AGSLayer.
 @since 1.8
 */
@property (nonatomic, copy, readonly) NSArray *mapLayers;

/** After the first layer added to the map is loaded, this value is set to true.
 @since 1.0
 */
@property (nonatomic, readonly) BOOL loaded;

/** The map's current resolution (map units per Point).
 @since 1.0
 */
@property (nonatomic, assign, readonly) double resolution;

/** The current scale of the map. Will return 0 if it cannot be calculated.
 @since 1.0
 */
@property (nonatomic, assign, readonly) double mapScale;

/** The spatial reference of the map. Defined by the basemap layer.
 @since 1.0
 */
@property (nonatomic, strong, readonly) AGSSpatialReference *spatialReference;

/** The time extent for the map. Will be used only for time-aware layers.
 @avail{10.0}
 @see @concept{Viewing_Temporal_data/00pw00000051000000/, Viewing Temporal Data}
 @see @sample{5603382f9f77482098398e01c8d276cc, Temporal}
 @since 1.0
 */
@property (nonatomic, strong, readwrite) AGSTimeExtent *timeExtent;

/** Flag to indicate if the map should show the magnifier when the user performs a tap
 and hold gesture on the map. Default is @c NO
 */
@property (nonatomic, assign, readwrite) BOOL showMagnifierOnTapAndHold;

/** Flag to indicate if the map should pan when the magnifer gets near the edge of the map's
 bounds. The default is YES.
 @since 10.1.1
 */
@property (nonatomic, assign, readwrite) BOOL allowMagnifierToPanMap;

/**The rotation angle (in degrees). The map is rotated in a counter-clockwise direction by the amount specified. To specify a new angle, see
 @see #setRotationAngle:animated:
 @see #setRotationAngle:aroundMapPoint:animated:
 @see #setRotationAngle:aroundScreenPoint:animated:
 @since 2.1
 */
@property (nonatomic, assign) double rotationAngle;

/** Flag to indicate if a user should be allowed to rotate the map using a two finger twist gesture.
 Default is @c NO.
 @since 2.1
 */
@property (nonatomic, assign) BOOL allowRotationByPinching;

/** A polygon representing the map's visible area.
 The polygon always contains 1 ring with 4 vertices, each representing a corner of the map.

 An envelope is no longer be used to represent the visible area because the map may be rotated and each corner of the map may contain unique x-y coordinates, where as an envelope only permits 2 unique x coordinates (xmin, xmax) and 2 unique y coordinates (ymin, ymax).
 @since 2.1
 */
- (AGSPolygon*)visibleArea;

/** An bounding envelope for the map's #visibleArea. The envelope and the visible area will
 be the same if the map has not been rotated. Otherwise, the envelope will be slightly larger to fully contain the visible area.
 @since 10.1.1
 */
@property (nonatomic, copy, readonly) AGSEnvelope *visibleAreaEnvelope;

/** The map coordinates of where the map display is anchored.
 Usually this is the center of the map. However it could be different. For example, if the map is anchored on the location display, this will be the coordinate
 of the location display.
 @since 10.1.1
 */
@property (nonatomic, copy, readonly) AGSPoint *mapAnchor;

/** Limits the amount by which the map can be panned such that its anchor point (typically the center) never goes outside
 this envelope. By default, this is the full envelope of the basemap layer. If you set a custom extent,
 the envelope must have the same spatial reference as the map.
 @since 2.1
 */
@property (nonatomic, strong, readwrite) AGSEnvelope *maxEnvelope;

/** Display's a location on the map from a datasource such as a gps feed.
 @since 10.1.1
 */
@property (nonatomic, strong, readonly) AGSLocationDisplay *locationDisplay;

/** A callout view for displaying information on the map.
 @since 1.0
 */
@property (nonatomic, strong, readonly) AGSCallout *callout;

/**
 The first layer added to the map.
 @since 10.1.1
 */
@property (nonatomic, strong, readonly) AGSLayer *baseLayer;

/** The background color of the map.
 @since 10.1.1
 */
@property (nonatomic, strong, readwrite) AGSColor *backgroundColor;

/** The size of the grid squares.
 @since 10.1.1
 */
@property (nonatomic, assign) CGFloat gridSize;

/**
 The width of the grid lines.
 @since 10.1.1
 */
@property (nonatomic, assign) CGFloat gridLineWidth;

/** The color of the grid lines.
 @since 10.1.1
 */
@property (nonatomic, strong) AGSColor *gridLineColor;

/** Whether the map is currently being dragged, pinched, rotated or scrolled by the user.
 @since 10.1.1
 */
@property (nonatomic, assign, readonly) BOOL interacting;

/** Whether the map is in a state of animating.
 @since 10.1.1
 */
@property (nonatomic, assign, readonly) BOOL animating;

/** Whether the last change to the map's scale, resolution, extent or angle was due to user interaction
 (panning, pinching, etc).
 @since 10.1.1
 */
@property (nonatomic, assign, readonly) BOOL lastChangeFromInteraction;

/** Convert the specified point in screen units to a point in map units.
 @param point Point in screen units.
 @return Point in map units. Point will have the same spatial reference as the map.
 @since 1.0
 */
- (AGSPoint *)toMapPoint:(CGPoint)point;

/** Convert the specified point in map units to a point in screen units.
 @param point Point in map units. Point must have the same spatial reference as the map.
 @return Point in screen units.
 @since 1.0
 */
- (CGPoint)toScreenPoint:(AGSPoint *)point;

/** Convert the specified envelope in map units to a @c CGRect in screen units.
 @param envelope Envelope in map units. Envelope must have the same spatial reference as the map.
 @return @c CGRect in screen coordinates
 @since 1.0
 */
- (CGRect)toScreenRect:(AGSEnvelope *)envelope;

/** Converts a rectangle in screen coordinates to an envelope in map units.
 @param rect Rectangle in screen coordinates to convert from.
 @return Envelope in map units. Envelope will have the same spatial reference as the map.
 @since 1.0
 */
- (AGSEnvelope *)toMapEnvelope:(CGRect)rect;

/** Zoom/Pan the map to specified envelope.
 @param envelope Map envelope to zoom/pan to. Envelope must have the same spatial reference as the map.
 Envelope must be in map units.
 @param animated Determines if the scrolling should be animated or immediate.
 @since 1.0
 */
- (void)zoomToEnvelope:(AGSEnvelope *)envelope animated:(BOOL)animated;

/** Zooms map by a factor. Anchor Point is in screen coordinates of the map view.
 @param factor Used to determine the amount to zoom. For example, use 0.5 to
 zoom in twice as far and 2.0 to zoom out twice as far.
 @param anchorPoint Point in screen coordinates around which to zoom. This is ignored if the location display @link AGSLocationDisplay::autoPanMode autoPanMode @endlink is @c AGSLocationDisplayAutoPanModeNavigation or @c AGSLocationDisplayAutoPanModeCompassNavigation in which case map zooms around the location symbol.
 @param animated Determines if the zooming should be animated or immediate.
 @since 1.0
 */
-(void)zoomWithFactor:(double)factor atAnchorPoint:(CGPoint)anchorPoint animated:(BOOL)animated;

/** Zooms in to the current center of the map by a factor of .5.
 @param animated Determines if the zooming in should be animated or immediate.
 @since 1.0
 */
-(void)zoomIn:(BOOL)animated;

/** Zooms out to the current center of the map by a factor of 2.
 @param animated Determines if the zooming out should be animated or immediate.
 @since 1.0
 */
-(void)zoomOut:(BOOL)animated;

/** Center map at specified location.
 @param point Map point to center map. Point must have the same spatial reference as the map.
 Point must be in map units.
 @param animated Determines if the centering should be animated or immediate.
 @since 1.0
 */
- (void)centerAtPoint:(AGSPoint *)point animated:(BOOL)animated;

/** Zooms the map such that the given geometry fits the bounds of the map.
 @param geometry to zoom to
 @param padding in points so that the geometry may not touch any edges of the map
 @param animated flag indicating whether to animate the zoom action
 @since 2.1
 */
-(void)zoomToGeometry:(AGSGeometry*)geometry withPadding:(float)padding animated:(BOOL)animated;

/** Zooms the map to the given resolution
 @param res The resolution (map units per pixel) to zoom to
 @param centerPoint to zoom around. If nil and the location display @link AGSLocationDisplay::autoPanMode autoPanMode @endlink is @c AGSLocationDisplayAutoPanModeNavigation or @c AGSLocationDisplayAutoPanModeCompassNavigation, the map zooms around the location symbol.
 If the locationDisplay is not in those modes, but the centerPoint is nil, map zooms around its center.
 @param animated flag indicating whether to animate the zoom action
 @since 2.1
 @see @c AGSTiledLayer#convertedResolutionForLodResolution: to convert @c AGSLOD#resolution to map resolution.

 */
-(void)zoomToResolution:(double)res withCenterPoint:(AGSPoint*)centerPoint animated:(BOOL)animated;

/** Zooms the map to the given scale
 @param scale to zoom to
 @param centerPoint to zoom around. If nil and the locationDisplay @link AGSLocationDisplay::autoPanMode autoPanMode @endlink is @c AGSLocationDisplayAutoPanModeNavigation or @c AGSLocationDisplayAutoPanModeCompassNavigation, the map zooms around the location symbol.
 If the locationDisplay is not in those modes, but the centerPoint is nil, map zooms around its center.
 @param animated flag indicating whether to animate the zoom action
 @since 2.1
 @see @c AGSTiledLayer#convertedScaleForLodScale: to convert @c AGSLOD#scale to map scale.

 */
-(void)zoomToScale:(double)scale withCenterPoint:(AGSPoint*)centerPoint animated:(BOOL)animated;

/** Zooms the map to the given resolution
 @param res The resolution (map units per pixel) to zoom to. See
 @param animated flag indicating whether to animate the zoom action
 @since 10.1.1
 @see @c AGSTiledLayer#convertedResolutionForLodResolution: to convert @c AGSLOD#resolution to map resolution.
 */
-(void)zoomToResolution:(double)res animated:(BOOL)animated;

/** Zooms the map to the given scale
 @param scale to zoom to
 @param animated flag indicating whether to animate the zoom action
 @since 10.1.1
 @see @c AGSTiledLayer#convertedScaleForLodScale: to convert @c AGSLOD#scale to map scale.
 */
-(void)zoomToScale:(double)scale animated:(BOOL)animated;

/** Resets the map to an original and unloaded state. Will remove any and all layers from the map. The spatial reference,
 extents, and othe properties related to the layer will be cleared. The first
 layer subsequently added to the map after invoking this method will be treated as a basemap layer.
 @since 1.8
 */
-(void)reset;

/** Rotate the map in counter-clockwise direction based on the angle (degrees) specified.
 @param angle to rotate the map by
 @param animated flag indicating if the map should animate to new rotation angle
 @since 2.1
 */
-(void)setRotationAngle:(double)angle animated:(BOOL)animated;

/** Rotate the map in counter-clockwise direction based on the angle (degrees) specified.
 @param angle to rotate the map by
 @param screenPoint the location on screen around which the map should be rotated
 @param animated flag indicating if the map should animate to new rotation angle
 @since 2.1
 */
-(void)setRotationAngle:(double)angle aroundScreenPoint:(CGPoint)screenPoint animated:(BOOL)animated;

/** Rotate the map in counter-clockwise direction based on the angle (degrees) specified.
 @param angle to rotate the map by
 @param mapPoint the location on the map around which the map should be rotated. The point
 should have the same spatial reference as the map.
 @param animated flag indicating if the map should animate to new rotation angle
 @since 2.1
 */
-(void)setRotationAngle:(double)angle aroundMapPoint:(AGSPoint*)mapPoint animated:(BOOL)animated;

/** Add a layer to the map using the specified name. The first layer added to
 the map is treated as a basemap layer. It defines the full extent and
 #spatialReference of the map.
 @param mapLayer Map Layer to be added to the map.
 @param name Name of layer. You can pass nil, in which case a name will be provided.
 If specified and the name is not unique, the layer will be given a uniqe name.
 @since 1.0
 */
- (void)addMapLayer:(AGSLayer *)mapLayer withName:(NSString *)name;

/** Remove a layer from the map with specified name. Even when the basemap
 layer is removed, the map's #visibleArea , #fullEnvelope, and #spatialReference
 properties remain unchanged.
 @param name Name of the layer to be removed.
 @since 1.0
 */
- (void)removeMapLayerWithName: (NSString *)name;

/** Inserts a layer to the map with specified name at @p index.
 @param mapLayer Map Layer of type @c AGSLayer to be added to map.
 @param name Name of layer. You can pass nil, in which case a name will be provided.
 If specified and the name is not unique, the layer will be given a uniqe name.
 @param index Index where layer will be inserted.
 @since 1.0
 */
- (void)insertMapLayer:(AGSLayer *)mapLayer withName:(NSString *)name atIndex:(NSUInteger)index;

/** Adds a layer to the map. The layer is added on top of existing layers.
 @param lyr layer to add
 @since 10.1.1
 */
-(void)addMapLayer:(AGSLayer*)lyr;

/** Inserts a layer at the specified index
 @param lyr Layer to insert
 @param index at which to insert. 0 is bottom most.
 @since 10.1.1
 */
-(void)insertMapLayer:(AGSLayer*)lyr atIndex:(NSInteger)index;

/** Removes the given layer from the map
 @param lyr Layer to remove
 @since 10.1.1
 */
-(void)removeMapLayer:(AGSLayer*)lyr;

/** A convenience method to retrieve a layer in the map based on its name.
 @param name of layer to retrieve from the map
 @since 10.1.1
 */
-(AGSLayer*)mapLayerForName:(NSString*)name;

/**
 Attempts to enable wrap around on the map. Please check the wrapAroundStatus to see if
 the attempt was successful.
 @since 10.1.1
 */
-(void)enableWrapAround;

/**
 Disables wrap around on the map.
 @since 10.1.1
 */
-(void)disableWrapAround;

/**
 Returns the wrap around status of the map.
 @since 10.1.1
 */
-(AGSMapViewWrapAroundStatus)wrapAroundStatus;

#if (TARGET_OS_IPHONE)
/** If set to YES then all the hardware resources will be released when the application is backgrounded.
This will default to NO because it takes a few seconds to recreate these resources.
Based on this document http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/ImplementingaMultitasking-awareOpenGLESApplication/ImplementingaMultitasking-awareOpenGLESApplication.html
you should not set this to YES except under extreme cases.
@since 10.1.1
*/
@property (nonatomic, assign) BOOL releaseHardwareResourcesWhenBackgrounded;
#endif

@end


text:
/**
 * Created by Ivan Dmitriev on /30/15.
 */
/*eslint max-nested-callbacks:[0]*/
'use strict';
require('coffee-script/register');

var hubot = require('hubot'),
    Robot = hubot.Robot,
    Message = hubot.TextMessage,
    utils = require('../utils'),
    assert = require('chai').assert,
    Conversation = require('../../'),
    testUser = new hubot.User('Lenny', {room: 'The Lounge'}),
    testUserSameRoom = new hubot.User('Jonny', {room: 'The Lounge'}),
    testUserDiffRoom = new hubot.User('Lenny', {room: 'Another room'})
    ;

describe('#Hubot Room Conversation', function () {
    var bot, roomSwitchBoard, roomMessages, messenger;

    beforeEach(function () {
        //reset the bot;
        bot = new Robot('hubot/src/adapters', 'shell');
        roomSwitchBoard = new Conversation(bot, 'room');
    });

    afterEach(function () {
        bot.shutdown();
    });

    it('Starts a conversation in room', function (done) {
        bot.respond(/FooBar/i, function (msg) {
            roomSwitchBoard.startDialog(msg);
            assert.ok(roomSwitchBoard.talkingTo(msg.message.room), 'Conversation has begun');
            done();
        });
        bot.receive(new Message(testUser, 'hubot FooBar', '123'));
    });

    it('Dialog can recognize next input from different users in a room', function (done) {
        roomMessages = [
            new Message(testUser, 'hubot clean the house', '123'),
            new Message(testUserSameRoom, 'the kitchen', '456'),
            new Message(testUser, 'yes', '789')
        ];
        messenger = new utils.Messenger(bot, roomMessages);

        bot.respond(/clean the house/i, function (msg) {
            var dialog = roomSwitchBoard.startDialog(msg);
            msg.reply('Should I start with the kitchen or the bathroom?');

            dialog.addChoice(/(kit)chen/, function (msg2) {
                msg2.reply('Ok! Cleaning the kitchen');
                done();
            });

            messenger.next();
        });

        messenger.next();
    });

    it('Dialog can recognize next input from the same room only', function (done) {
        roomMessages = [
            new Message(testUser, 'hubot clean the house', '123'),
            new Message(testUserDiffRoom, 'the kitchen', 'diff room 456'),
            new Message(testUserSameRoom, 'the kitchen', '456'),
            new Message(testUser, 'yes', '789')
        ];
        messenger = new utils.Messenger(bot, roomMessages);

        bot.respond(/clean the house/i, function (msg) {
            var dialog = roomSwitchBoard.startDialog(msg);
            msg.reply('Should I start with the kitchen or the bathroom?');

            dialog.addChoice(/(kit)chen/, function (msg2) {
                msg2.reply('Ok! Cleaning the kitchen');
                if (msg2.message.id !== '456') {
                    throw new Error('This user message from different room, it should be ignored.');
                }
                done();
            });

            messenger.next();
            messenger.next();
        });

        messenger.next();
    });

});


text:
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Aurelia</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <base href="/">
  </head>

  <body aurelia-app="main">
    <script src="scripts/vendor-bundle.js" data-main="aurelia-bootstrapper"></script>
  </body>
</html>


text:
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
 * String.prototype.toLocaleLowerCase()
 *
 * @path ch15/15.5/15.5.4/15.5.4.17/S15.5.4.17_A1_T1.js
 * @description Arguments is true, and instance is object
 */

var __instance = new Object(true);

__instance.toLocaleLowerCase = String.prototype.toLocaleLowerCase;

//////////////////////////////////////////////////////////////////////////////
//CHECK#1
if (__instance.toLocaleLowerCase() !== "true") {
  $ERROR('#1: __instance = new Object(true); __instance.toLocaleLowerCase = String.prototype.toLocaleLowerCase;  __instance.toLocaleLowerCase() === "true". Actual: '+__instance.toLocaleLowerCase() );
}
//
//////////////////////////////////////////////////////////////////////////////