text:
require 'rimportor/active_record/sql_builder'
require 'rimportor/active_record/import'
require 'rimportor/plugin'
require 'rimportor/error/bulk_validation'
require 'rimportor/error/invalid_adapter'
require 'rimportor/active_record/adapter/mysql2'
require 'rimportor/util/connection'
require 'generators/install_generator'

module Rimportor
  class << self
    attr_accessor :configuration
  end

  def self.configure
    self.configuration ||= Configuration.new
    yield(configuration) if block_given?
  end

  class Configuration
    attr_accessor :threads

    def initialize
      @threads = 4
    end
  end
end

ActiveRecord::Base.send :include, Rimportor::Plugin


text:
@implementation YAMLKit

+ (id)loadFromString:(NSString *)str
{
    YKParser *p = [[[YKParser alloc] init] autorelease];
	[p readString:str];
    NSArray *result = [p parse];
    // If parse returns a one-element array, extract it.
    if([result count] == 1) {
        return [result objectAtIndex:0];
    }
    return result;
}

+ (id)loadFromFile:(NSString *)path
{
	NSString *contents = [NSString stringWithContentsOfFile:path
												   encoding:NSUTF8StringEncoding
													  error:NULL];
	if(contents == nil) return nil; // if there was an error reading from the file
	return [self loadFromString:contents];
}

+ (id)loadFromURL:(NSURL *)url
{
	NSString *contents = [NSString stringWithContentsOfURL:url
												  encoding:NSUTF8StringEncoding
													 error:NULL];
	if(contents == nil) return nil; // if there was an error reading from the URL
	return [self loadFromString:contents];
}

+ (NSString *)dumpObject:(id)object
{
    YKEmitter *e = [[[YKEmitter alloc] init] autorelease];
    [e emitItem:object];
    return [e emittedString];
}

+ (BOOL)dumpObject:(id)object toFile:(NSString *)path
{
	YKEmitter *e = [[[YKEmitter alloc] init] autorelease];
	[e emitItem:object];
	return [[e emittedString] writeToFile:path
							   atomically:YES
								 encoding:NSUTF8StringEncoding
									error:NULL];
}

+ (BOOL)dumpObject:(id)object toURL:(NSURL *)path
{
	YKEmitter *e = [[[YKEmitter alloc] init] autorelease];
	[e emitItem:object];
	return [[e emittedString] writeToURL:path
							  atomically:YES
								encoding:NSUTF8StringEncoding
								   error:NULL];
}

@end

redpajama_set_name: RedPajamaGithub


text:
from pyvisdk.thirdparty import Enum

PortGroupConnecteeType = Enum(
    'host',
    'systemManagement',
    'unknown',
    'virtualMachine',

)


text:
<?php  namespace redhotmayo\billing\plan;

use Illuminate\Support\Facades\Config;
use redhotmayo\exception\NullArgumentException;
use redhotmayo\utility\Arrays;

class BillingPlan {
    /** Config path to grab plan data */
    const ALL_PLANS = 'billing.plans';

    /** array fields for plans within config data */
    const PLAN_ID                = 'id';
    const PLAN_NAME              = 'name';
    const PLAN_PRICE             = 'price';
    const PLAN_SUBSCRIPTION_TERM = 'subscription_term';
    const PLAN_TRIAL_PERIOD      = 'trial_period';

    private $id;
    private $name;
    private $price;
    private $subscriptionTerm;
    private $trialPeriod;

    /**
     * @param int $population
     *
     * @return BillingPlan
     *
     * @author Craig Giles < craig@gilesc.com >
     */
    public static function CreateFromPopulation($population) {
        return self::CreateFromId(PlanMapper::Map($population));
    }

    /**
     * Load the given $planId's plan and return a new object with the plan details.
     *
     * @param int $planId
     * @return BillingPlan
     *
     * @author Craig Giles < craig@gilesc.com >
     */
    public static function CreateFromId($planId) {
        $plans = Config::get(self::ALL_PLANS);
        $plan  = Arrays::GetValue($plans, (int)$planId, null);

        return self::CreateWithData($plan);
    }

    /**
     * Create a new object with the given plan details
     *
     * @param array $plan
     * @return BillingPlan
     *
     * @author Craig Giles < craig@gilesc.com >
     */
    public static function CreateWithData(array $plan) {
        $id    = Arrays::GetValue($plan, self::PLAN_ID, null);
        $name  = Arrays::GetValue($plan, self::PLAN_NAME, null);
        $price = Arrays::GetValue($plan, self::PLAN_PRICE, null);
        $term  = Arrays::GetValue($plan, self::PLAN_SUBSCRIPTION_TERM, null);
        $trial = Arrays::GetValue($plan, self::PLAN_TRIAL_PERIOD, null);

        return new self($id, $name, $price, $term, $trial);
    }

    public function __construct($id, $name, $price, $term, $trial) {
        $this->filterNull($id);
        $this->filterNull($name);
        $this->filterNull($price);
        $this->filterNull($term);
        $this->filterNull($trial);

        $this->id               = $id;
        $this->name             = $name;
        $this->price            = $price;
        $this->subscriptionTerm = $term;
        $this->trialPeriod      = $trial;
    }

    /**
     * The unique id that identifies this plan with our billing provider
     *
     * @return string
     *
     * @author Craig Giles < craig@gilesc.com >
     */
    public function getId() {
        return $this->id;
    }

    /**
     * Human readable name associated with this plan
     *
     * @return string
     *
     * @author Craig Giles < craig@gilesc.com >
     */
    public function getName() {
        return $this->name;
    }

    /**
     * How much will the customer be charged
     *
     * @return double
     *
     * @author Craig Giles < craig@gilesc.com >
     */
    public function getPrice() {
        return $this->price;
    }

    /**
     * How often the customer will be charged
     *
     * @return string
     *
     * @author Craig Giles < craig@gilesc.com >
     */
    public function getSubscriptionTerm() {
        return $this->subscriptionTerm;
    }

    /**
     * Number of days this plan has for a trial period
     *
     * @return string
     *
     * @author Craig Giles < craig@gilesc.com >
     */
    public function getTrialPeriod() {
        return $this->trialPeriod;
    }

    /**
     * Filter out any values that are null
     *
     * @param $value
     *
     * @throws \redhotmayo\exception\NullArgumentException
     * @author Craig Giles < craig@gilesc.com >
     */
    private function filterNull($value) {
        if (!isset($value)) {
            throw new NullArgumentException('No Billing Plan value can be null');
        }
    }
}


text:
layout: default
title: Transition to Github
---
{% include site-links.md %}

To: EDK2 Community

This message is to notify you that near the end of January 2016 the active repository for EDK2 development
will switch from using SourceForge to GitHub.  The repository found at SourceForge will continue to be a
read-only mirror of the master branch on GitHub.

A number of reasons have prompted us to switch to git most notably the communities request for us to make
this change.  Other reasons include the ability to have better commit logs and the use of branching to aid
in reviewing larger changes and the addition of new features.

As part of this change a number of process changes will be adopted to support better use of git.
This includes the method for sending out patches for review and other minor changes.
Information regarding these changes will be found on  tianocore.org in the following weeks.  In addition to the process changes documentation for users new to git will also be provided.

Please post any comments or questions related to this transition to [{{adminemail}}](mailto:{{adminemail}}?Subject=Github%20Question) mailing list.

Thanks,
Tianocore.org Administration


text:
bst
===

C++ binary search tree implementation


text:
<?php

namespace Guzzle\Tests\Http;

use Guzzle\Http\Exception\BadResponseException;
use Guzzle\Common\Exception\RuntimeException;
use Guzzle\Http\Message\Request;
use Guzzle\Http\Message\Response;
use Guzzle\Http\Message\RequestInterface;
use Guzzle\Http\Message\RequestFactory;
use Guzzle\Http\Client;

/**
 * The Server class is used to control a scripted webserver using node.js that
 * will respond to HTTP requests with queued responses.
 *
 * Queued responses will be served to requests using a FIFO order.  All requests
 * received by the server are stored on the node.js server and can be retrieved
 * by calling {@see Server::getReceivedRequests()}.
 *
 * Mock responses that don't require data to be transmitted over HTTP a great
 * for testing.  Mock response, however, cannot test the actual sending of an
 * HTTP request using cURL.  This test server allows the simulation of any
 * number of HTTP request response transactions to test the actual sending of
 * requests over the wire without having to leave an internal network.
 */
class Server
{
    const DEFAULT_PORT = 8124;
    const REQUEST_DELIMITER = "\n----[request]\n";

    /** @var int Port that the server will listen on */
    private $port;

    /** @var bool Is the server running */
    private $running = false;

    /** @var Client */
    private $client;

    /**
     * Create a new scripted server
     *
     * @param int $port Port to listen on (defaults to 8124)
     */
    public function __construct($port = null)
    {
        $this->port = $port ?: self::DEFAULT_PORT;
        $this->client = new Client($this->getUrl());
    }

    /**
     * Flush the received requests from the server
     * @throws RuntimeException
     */
    public function flush()
    {
        $this->client->delete('guzzle-server/requests')->send();
    }

    /**
     * Queue an array of responses or a single response on the server.
     *
     * Any currently queued responses will be overwritten.  Subsequent requests
     * on the server will return queued responses in FIFO order.
     *
     * @param array|Response $responses A single or array of Responses to queue
     * @throws BadResponseException
     */
    public function enqueue($responses)
    {
        $data = array();
        foreach ((array) $responses as $response) {

            // Create the response object from a string
            if (is_string($response)) {
                $response = Response::fromMessage($response);
            } elseif (!($response instanceof Response)) {
                throw new BadResponseException('Responses must be strings or implement Response');
            }

            $data[] = array(
                'statusCode'   => $response->getStatusCode(),
                'reasonPhrase' => $response->getReasonPhrase(),
                'headers'      => $response->getHeaders()->toArray(),
                'body'         => $response->getBody(true)
            );
        }

        $request = $this->client->put('guzzle-server/responses', null, json_encode($data));
        $request->send();
    }

    /**
     * Check if the server is running
     *
     * @return bool
     */
    public function isRunning()
    {
        if ($this->running) {
            return true;
        }

        try {
            $this->client->get('guzzle-server/perf', array(), array('timeout' => 5))->send();
            return $this->running = true;
        } catch (\Exception $e) {
            return false;
        }
    }

    /**
     * Get the URL to the server
     *
     * @return string
     */
    public function getUrl()
    {
        return 'http://127.0.0.1:' . $this->getPort() . '/';
    }

    /**
     * Get the port that the server is listening on
     *
     * @return int
     */
    public function getPort()
    {
        return $this->port;
    }

    /**
     * Get all of the received requests
     *
     * @param bool $hydrate Set to TRUE to turn the messages into
     *      actual {@see RequestInterface} objects.  If $hydrate is FALSE,
     *      requests will be returned as strings.
     *
     * @return array
     * @throws RuntimeException
     */
    public function getReceivedRequests($hydrate = false)
    {
        $response = $this->client->get('guzzle-server/requests')->send();
        $data = array_filter(explode(self::REQUEST_DELIMITER, $response->getBody(true)));
        if ($hydrate) {
            $data = array_map(function($message) {
                return RequestFactory::getInstance()->fromMessage($message);
            }, $data);
        }

        return $data;
    }

    /**
     * Start running the node.js server in the background
     */
    public function start()
    {
        if (!$this->isRunning()) {
            exec('node ' . __DIR__ . \DIRECTORY_SEPARATOR . 'server.js ' . $this->port . ' >> /tmp/server.log 2>&1 &');
            // Wait at most 5 seconds for the server the setup before proceeding
            $start = time();
            while (!$this->isRunning() && time() - $start < 5);
            if (!$this->running) {
                throw new RuntimeException(
                    'Unable to contact server.js. Have you installed node.js v0.5.0+? node must be in your path.'
                );
            }
        }
    }

    /**
     * Stop running the node.js server
     */
    public function stop()
    {
        if (!$this->isRunning()) {
            return false;
        }

        $this->running = false;
        $this->client->delete('guzzle-server')->send();
    }
}


text:
package org.onetwo.common.apiclient.impl;

import java.beans.PropertyDescriptor;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import org.onetwo.common.apiclient.ApiClientMethod;
import org.onetwo.common.apiclient.ApiClientResponseHandler;
import org.onetwo.common.apiclient.utils.ApiClientUtils;
import org.onetwo.common.reflect.ReflectUtils;
import org.onetwo.common.spring.SpringUtils;
import org.onetwo.common.utils.JFishProperty;
import org.onetwo.common.utils.JFishPropertyInfoImpl;
import org.onetwo.common.utils.LangUtils;
import org.slf4j.Logger;
import org.springframework.beans.BeanWrapper;
import org.springframework.http.ResponseEntity;
import org.springframework.util.Assert;
import org.springframework.web.client.RestClientException;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.Lists;

/**
 * @author wayshall
 * <br/>
 */
public class DefaultApiClientResponseHandler<M extends ApiClientMethod> implements ApiClientResponseHandler<M> {
	protected final Logger logger = ApiClientUtils.getApiclientlogger();

	@Override
	public Class<?> getActualResponseType(M invokeMethod) {
		return invokeMethod.getMethodReturnType();
	}

	@Override
	public Object handleResponse(M invokeMethod, ResponseEntity<?> responseEntity, Class<?> actualResponseType){
		Object resposne = responseEntity.getBody();
		if(responseEntity.getStatusCode().is2xxSuccessful()){
			if (List.class.isAssignableFrom(actualResponseType)) {
				return convert2List(invokeMethod, responseEntity);
			}
			return resposne;
		}
		throw new RestClientException("error response: " + responseEntity.getStatusCodeValue());
	}

	@SuppressWarnings("unchecked")
	protected Object convert2List(M invokeMethod, ResponseEntity<?> responseEntity) {
		List<?> dataList = (List<?>) responseEntity.getBody();
		if (LangUtils.isEmpty(dataList) || !Map.class.isAssignableFrom(dataList.get(0).getClass())) {
			return responseEntity.getBody();
		}

		List<Map<String, ?>> mapList = (List<Map<String,?>>) Lists.newArrayList((List<Map<String,?>>) responseEntity.getBody());
		List<Object> datas = (List<Object>) responseEntity.getBody();
		datas.clear();
		for(Map<String, ?> data : mapList) {
			Object bean = this.map2Bean(data, invokeMethod.getComponentType());
			datas.add(bean);
		}
		return responseEntity.getBody();
	}

	protected <T> T map2Bean(Map<String, ?> props, Class<T> beanClass){
		Assert.notNull(beanClass, "beanClass can not be null");
		Assert.notNull(props, "props can not be null");
		T bean = ReflectUtils.newInstance(beanClass);
		BeanWrapper bw = SpringUtils.newBeanWrapper(bean);
		for(PropertyDescriptor pd : bw.getPropertyDescriptors()){
			if(props.containsKey(pd.getName())){
				Object value = props.get(pd.getName());
				bw.setPropertyValue(pd.getName(), value);
			}else{
				JFishProperty jproperty = new JFishPropertyInfoImpl(pd);

//				if (pd.getName().contains("promotionDetail")) {
//					System.out.println("test");
//				}
				if (jproperty.hasAnnotation(JsonIgnore.class)) {
					continue;
				} else {
					Optional<JFishProperty> jfield = jproperty.getCorrespondingJFishProperty();
					if (!jfield.isPresent() || jfield.get().hasAnnotation(JsonIgnore.class)) {
						continue;
					}
				}

				JsonProperty jsonProperty = jproperty.getAnnotation(JsonProperty.class);
				if(jsonProperty==null){
					jsonProperty = jproperty.getCorrespondingJFishProperty()
											.map(jp->jp.getAnnotation(JsonProperty.class))
											.orElse(null);
				}
				if(jsonProperty!=null && props.containsKey(jsonProperty.value())){
					Object value = props.get(jsonProperty.value());
					bw.setPropertyValue(pd.getName(), value);
				}
			}
		}
		return bean;
	}

}


text:
require 'hanami/utils/kernel'

module Hanami
  module Utils
    # A collection of loading paths.
    #
    # @since 0.2.0
    class LoadPaths
      # Initialize a new collection for the given paths
      #
      # @param paths [String, Pathname, Array<String>, Array<Pathname>] A single
      #   or a collection of objects that can be converted into a Pathname
      #
      # @return [Hanami::Utils::LoadPaths] self
      #
      # @since 0.2.0
      #
      # @see http://ruby-doc.org/stdlib/libdoc/pathname/rdoc/Pathname.html
      # @see Hanami::Utils::Kernel.Pathname
      def initialize(*paths)
        @paths = Utils::Kernel.Array(paths)
      end

      # It specifies the policy for initialize copies of the object, when #clone
      # or #dup are invoked.
      #
      # @api private
      # @since 0.2.0
      #
      # @see http://ruby-doc.org/core/Object.html#method-i-clone
      # @see http://ruby-doc.org/core/Object.html#method-i-dup
      #
      # @example
      #   require 'hanami/utils/load_paths'
      #
      #   paths  = Hanami::Utils::LoadPaths.new '.'
      #   paths2 = paths.dup
      #
      #   paths  << '..'
      #   paths2 << '../..'
      #
      #   paths
      #     # => #<Hanami::Utils::LoadPaths:0x007f84e0cad430 @paths=[".", ".."]>
      #
      #   paths2
      #     # => #<Hanami::Utils::LoadPaths:0x007faedc4ad3e0 @paths=[".", "../.."]>
      def initialize_copy(original)
        @paths = original.instance_variable_get(:@paths).dup
      end

      # Iterates thru the collection and yields the given block.
      # It skips duplications and raises an error in case one of the paths
      # doesn't exist.
      #
      # @yield [pathname] the block of code that acts on the collection
      # @yieldparam pathname [Pathname]
      #
      # @return [void]
      #
      # @raise [Errno::ENOENT] if one of the paths doesn't exist
      #
      # @since 0.2.0
      def each
        @paths.each do |path|
          yield realpath(path)
        end
      end

      # Adds the given path(s).
      #
      # It returns self, so that multiple operations can be performed.
      #
      # @param paths [String, Pathname, Array<String>, Array<Pathname>] A single
      #   or a collection of objects that can be converted into a Pathname
      #
      # @return [Hanami::Utils::LoadPaths] self
      #
      # @raise [RuntimeError] if the object was previously frozen
      #
      # @since 0.2.0
      #
      # @see http://ruby-doc.org/stdlib/libdoc/pathname/rdoc/Pathname.html
      # @see Hanami::Utils::Kernel.Pathname
      # @see Hanami::Utils::LoadPaths#freeze
      #
      # @example Basic usage
      #   require 'hanami/utils/load_paths'
      #
      #   paths = Hanami::Utils::LoadPaths.new
      #   paths.push '.'
      #   paths.push '..', '../..'
      #
      # @example Chainable calls
      #   require 'hanami/utils/load_paths'
      #
      #   paths = Hanami::Utils::LoadPaths.new
      #   paths.push('.')
      #        .push('..', '../..')
      #
      # @example Shovel alias (#<<)
      #   require 'hanami/utils/load_paths'
      #
      #   paths = Hanami::Utils::LoadPaths.new
      #   paths << '.'
      #   paths << ['..', '../..']
      #
      # @example Chainable calls with shovel alias (#<<)
      #   require 'hanami/utils/load_paths'
      #
      #   paths = Hanami::Utils::LoadPaths.new
      #   paths << '.' << '../..'
      def push(*paths)
        @paths.push(*paths)
        @paths = Kernel.Array(@paths)
        self
      end

      alias << push

      # It freezes the object by preventing further modifications.
      #
      # @since 0.2.0
      #
      # @see http://ruby-doc.org/core/Object.html#method-i-freeze
      #
      # @example
      #   require 'hanami/utils/load_paths'
      #
      #   paths = Hanami::Utils::LoadPaths.new
      #   paths.freeze
      #
      #   paths.frozen?  # => true
      #
      #   paths.push '.' # => RuntimeError
      def freeze
        super
        @paths.freeze
      end

      # @since 0.6.0
      # @api private
      def ==(other)
        case other
        when self.class
          other.paths == paths
        else
          other == paths
        end
      end

      protected

      # @since 0.6.0
      # @api private
      attr_reader :paths

      private

      # Allow subclasses to define their own policy to discover the realpath
      # of the given path.
      #
      # @since 0.2.0
      # @api private
      def realpath(path)
        Utils::Kernel.Pathname(path).realpath
      end
    end
  end
end


text:
title: Hope Sabbath School Outline
date: 10/07/2020
---

### Outline #2  Winsome Witnesses: The power of personal testimony

*  Unlikely witnesses
	* Mark 5:1-5, 6-13, 14-17, 18-20 (see also Luke 8:38-39). Why did Jesus send this former demoniac back to his people rather than allowing him to join the band of disciples who traveled with Jesus?
	* How did the personal testimony of this former demoniac impact those who heard his story?
	* Name some other unlikely witnesses whose stories are recorded in the New Testament.
	* Share a time when you heard a remarkable testimony from an unlikely witness.

*  Proclaiming the Risen Christ
	* Mark 16:9-11 (see also John 20:11-18) What was Mary Magdalene's reaction after she encountered Jesus risen from the dead?
	* What important lesson can we learn from Peter and John when instructed by the Sanhedrin to stop sharing their testimony about Jesus? Acts 5:26-29
	* Share a time when you felt compelled to give your testimony about Jesus, even when some didn't want to listen or actively opposed you.
	* What is an appropriate response when someone tells you, "I don't want to hear your testimony about Jesus"?

*  The testimony of a transformed life
	* Acts 4:5-13 Why was the testimony about Jesus given by Peter and John so compelling?
	* Acts 26:9-18 Why was the testimony of Paul before King Herod Agrippa so powerful?
	* What elements of Paul story, recorded in Acts 9:1-25, are omitted in his testimony before Herod Agrippa? Why?
	* How is the apostle John's testimony different from that of the apostle Paul? What do they have in common? 1 John 1:1-4
	* Share a testimony of a transformed life that made a profound impression on you.

*  Sharing your personal testimony
	* What key elements should be included every time we share our testimony as a follower of Jesus?
	* Think of a time when you shared your testimony, either with an individual or a group.  How did this experience impact your life?  How did your testimony impact your hearers?
	* Who would be willing to share a testimony today of how knowing Jesus has impacted your life?
	* How has your attitude about sharing your testimony changed as a result of this study?

Hope Sabbath School Outline is provided by Hope Channel. Learn more here: https://www.hopetv.org/hopess/


text:
layout: post
title: "Using ramda-redux"
author: "Jituan Lin"
categories: Function-programming
tags: [FrontEnd,Javascript]
image:
  feature: ramda-redux-normal.jpg
  teaser: ramda-redux-teaser.jpg
  credit:
  creditlink:
description: "Using Redux with Ramda"
---

## What is **ramda-redux**

[ramda-redux](https://github.com/jituanlin/ramda-redux) is a library for reducing **Redux** code.

github: [ramda-redux](https://github.com/jituanlin/ramda-redux)

npm: [ramda-redux](https://www.npmjs.com/package/ramda-redux)

sample:[ramda-redux-sample](https://github.com/jituanlin/ramda-redux-sample)

## How does **ramda-redux** reduce *Redux* template code:
With **ramda-redux**

  ```js
  //./reducer/index.js
  // create a reducer for createStore function
  import R from 'ramda'
  import {Pattern,Reducer,Matcher} from 'ramda-redux'

  const addNumberPattern = Pattern(
  	'addNumber',
  	(state, payload) => R.over(
  		R.lensProp('n'),
  		R.inc,
  		state
  	)
  )

  const reducer = Reducer(
  	{n: 0},
  	Matcher(
  		addNumberPattern
  	)
  )

  const store = createStore(reducer)
  ```

  ```js
  //./component/addNumber.js
  // create a React component
  import React from 'react'
  import {connect} from 'react-redux'
  import R from 'ramda'
  import {Action} from 'ramda-redux'
  import {Button} from 'antd'

  const Link = ({n, addNumber}) =>
  	<div style={{marginLeft:'200px',marginTop:'200px'}}>
  		<p>{n}</p>
  		<Button onClick={addNumber}        type="primary">addNumber</Button>
  	</div>

  export default connect(
  	R.pick(['n']),
  	dispatch => (
  		{
  			addNumber: () => dispatch(Action('addNumber'))
  		}
  	)
  )(Link)
  ```

## The *ramda-redux* way of organizing code

0. Using `Pattern` factory function to create some instances of **Pattern**.

1. Passing this instances(pattern) to `Matcher` factory function.

2. Passing the instance of `Matcher` to Reducer factory function, the return is a function that satisfy  `Redux.createStore`.

3. Using `connect` same as traditional `Redux` way

## *ramda-redux* way VS traditional way of *Redux*

* Using `Pattern` for handle action from `store.dispatch(someAction)` rather than the Javascript keyword `switch`. In this way, we could combine `reducer` without `combineReducers`,more concise. Consider follow code:
  ```js
  //./redux/pattern/increase.js
  export default Pattern(
    'increase',
    (state,{incremental})=>R.over(
      R.lensProp('number'),
      R.add(incremental),
      state
    )
  )

  //.redux/pattern/reduce.js
  export default Pattern(
    'reduce',
    (state,{reduction})=>R.over(
      R.lensProp('number'),
      R.add(reduction),
      state
    )
  )

  //.redux/index.js
  import increasePattern from './pattern/increase'
  import reducePattern from './pattern/reduce'

  export default Reducer(
    {number:0},
    Matcher(
      increasePattern,
      reducePattern
    )
  )
  ```

* Using `Action` factory function to **new** a action, and specify the `action` must has unite structure that:
  ```js
    {
      type: 'someType',
      payload: someData
    }
  ```
So we cound use **ramda** pure function generate a new state conveniently.

* **ramda-redux** API more friendly using **ramda** pure function to generate a new state.


text:
package ch.raffael.guards;

/**
 * Error thrown when a guard is not applicable to the element for some reason.
 *
 * @author Raffael Herzog
 */
public class GuardNotApplicableError extends Error {

    public GuardNotApplicableError() {
        super();
    }

    public GuardNotApplicableError(String message) {
        super(message);
    }

    public GuardNotApplicableError(Throwable cause) {
        super(cause);
    }

    public GuardNotApplicableError(String message, Throwable cause) {
        super(message, cause);
    }
}


text:
var FCKSpellCheckCommand = function()
{
	this.Name = 'SpellCheck' ;
	this.IsEnabled = ( FCKConfig.SpellChecker == 'SpellerPages' ) ;
}

FCKSpellCheckCommand.prototype.Execute = function()
{
	FCKDialog.OpenDialog( 'FCKDialog_SpellCheck', 'Spell Check', 'dialog/fck_spellerpages.html', 440, 480 ) ;
}

FCKSpellCheckCommand.prototype.GetState = function()
{
	return this.IsEnabled ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ;
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

class Calculate
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        double x = double.Parse(Console.ReadLine());
        double s = 1;
        for (int i = 1; i <= n; i++)
        {
            s += CalculateFactorial(i) / Math.Pow(x, i);
        }
        Console.WriteLine("{0:F5}", s);
    }
    static int CalculateFactorial(int i)
    {
        if (i <= 1)
        {
            return 1;
        }
        return i * CalculateFactorial(i - 1);
    }
}


text:
/**
  * @file newping_distance_sensor.h
  * @brief distance sensr driver for distance sensors supported bt the NewPing library
  * @author Mathijs Mortimer
  */

#include "distance_sensor.h"

namespace morTimmy {
  class DistanceSensor : public DistanceSensorDriver {
    public:
      DistanceSensor(int triggerPin, int echoPin, int maxDistance)
        : DistanceSensorDriver(maxDistance),
          sensor(triggerPin, echoPin, maxDistance)
      {
      }

      virtual unsigned int getDistance() {
        int distance = sensor.ping_cm();
        if (distance <= 0)
          return maxDistance;
        return distance;
      }

    private:
      NewPing sensor;
  };
};


text:
This weeks coding challenge is to use this code to classify 2 animals! You can use [this](http://tamaraberg.com/animalDataset/index.html) dataset. That's it. No one has ever tried to apply memory augmented networks to anything but the omniglot dataset, so just a simple attempt at this would be both an awesome learning exercise and hugely useful to the AI community. Document your results in your README, regardless of whether the accuracy is high or not. Good luck!

## Overview

This is the code for [this](https://youtu.be/tChcZpBbTTA) video on Youtube by Siraj Raval as part of the Udacity Deep Learning nanodegree. We're going to use a [Memory Augmented Neural Network](https://arxiv.org/abs/1605.06065) in Tensorflow to perform one-shot learning on the omniglot dataset. That means we'll be able to classify images by their labels after training on just a few samples.

The benchmark dataset is [Omniglot dataset](https://github.com/brendenlake/omniglot). All the datasets should be placed in the [`data/`](data/) folder.

## Dependencies

* tensorflow (Written for Tensorflow v0.12. Yet to add support for Tensorflow v1*.)
* numpy
* time

Install dependencies using [pip](https://pip.pypa.io/en/stable/)

## Usage

run `python omniglot.py` in terminal to train the model after installing the necessary dependencies.

## Credits

The credits for this code go to [hmishra2250](https://github.com/hmishra2250) i've merely created a wrapper to get people started.


text:
package privdata

import (
	"fmt"

	"github.com/golang/protobuf/proto"
	"github.com/hyperledger/fabric/core/ledger"
	"github.com/hyperledger/fabric/msp"
	"github.com/hyperledger/fabric/protos/common"
	pb "github.com/hyperledger/fabric/protos/peer"
	"github.com/hyperledger/fabric/protos/utils"
	"github.com/pkg/errors"
)

// Support is an interface used to inject dependencies
type Support interface {
	// GetQueryExecutorForLedger returns a query executor for the specified channel
	GetQueryExecutorForLedger(cid string) (ledger.QueryExecutor, error)

	// GetIdentityDeserializer returns an IdentityDeserializer
	// instance for the specified chain
	GetIdentityDeserializer(chainID string) msp.IdentityDeserializer
}

// StateGetter retrieves data from the state
type State interface {
	// GetState retrieves the value for the given key in the given namespace
	GetState(namespace string, key string) ([]byte, error)
}

type NoSuchCollectionError common.CollectionCriteria

func (f NoSuchCollectionError) Error() string {
	return fmt.Sprintf("collection %s/%s/%s could not be found", f.Channel, f.Namespace, f.Collection)
}

type simpleCollectionStore struct {
	s Support
}

// NewSimpleCollectionStore returns a collection stored backed
// by a ledger supplied by the specified ledgerGetter with
// an internal name formed as specified by the supplied
// collectionNamer function
func NewSimpleCollectionStore(s Support) CollectionStore {
	return &simpleCollectionStore{s}
}

func (c *simpleCollectionStore) retrieveCollectionConfigPackage(cc common.CollectionCriteria, qe ledger.QueryExecutor) (*common.CollectionConfigPackage, error) {
	if qe != nil {
		return RetrieveCollectionConfigPackageFromState(cc, qe)
	}

	qe, err := c.s.GetQueryExecutorForLedger(cc.Channel)
	if err != nil {
		return nil, errors.WithMessage(err, fmt.Sprintf("could not retrieve query executor for collection criteria %#v", cc))
	}
	defer qe.Done()
	return RetrieveCollectionConfigPackageFromState(cc, qe)
}

// RetrieveCollectionConfigPackageFromState retrieves the collection config package from the given key from the given state
func RetrieveCollectionConfigPackageFromState(cc common.CollectionCriteria, state State) (*common.CollectionConfigPackage, error) {
	cb, err := state.GetState("lscc", BuildCollectionKVSKey(cc.Namespace))
	if err != nil {
		return nil, errors.WithMessage(err, fmt.Sprintf("error while retrieving collection for collection criteria %#v", cc))
	}
	if cb == nil {
		return nil, NoSuchCollectionError(cc)
	}
	conf, err := ParseCollectionConfig(cb)
	if err != nil {
		return nil, errors.Wrapf(err, "invalid configuration for collection criteria %#v", cc)
	}
	return conf, nil
}

// ParseCollectionConfig parses the collection configuration from the given serialized representation
func ParseCollectionConfig(colBytes []byte) (*common.CollectionConfigPackage, error) {
	collections := &common.CollectionConfigPackage{}
	err := proto.Unmarshal(colBytes, collections)
	if err != nil {
		return nil, errors.WithStack(err)
	}

	return collections, nil
}

func (c *simpleCollectionStore) retrieveCollectionConfig(cc common.CollectionCriteria, qe ledger.QueryExecutor) (*common.StaticCollectionConfig, error) {
	collections, err := c.retrieveCollectionConfigPackage(cc, qe)
	if err != nil {
		return nil, err
	}
	if collections == nil {
		return nil, nil
	}
	for _, cconf := range collections.Config {
		switch cconf := cconf.Payload.(type) {
		case *common.CollectionConfig_StaticCollectionConfig:
			if cconf.StaticCollectionConfig.Name == cc.Collection {
				return cconf.StaticCollectionConfig, nil
			}
		default:
			return nil, errors.New("unexpected collection type")
		}
	}
	return nil, NoSuchCollectionError(cc)
}

func (c *simpleCollectionStore) retrieveSimpleCollection(cc common.CollectionCriteria, qe ledger.QueryExecutor) (*SimpleCollection, error) {
	staticCollectionConfig, err := c.retrieveCollectionConfig(cc, qe)
	if err != nil {
		return nil, err
	}
	sc := &SimpleCollection{}
	err = sc.Setup(staticCollectionConfig, c.s.GetIdentityDeserializer(cc.Channel))
	if err != nil {
		return nil, errors.WithMessage(err, fmt.Sprintf("error setting up collection for collection criteria %#v", cc))
	}
	return sc, nil
}

func (c *simpleCollectionStore) AccessFilter(channelName string, collectionPolicyConfig *common.CollectionPolicyConfig) (Filter, error) {
	sc := &SimpleCollection{}
	err := sc.setupAccessPolicy(collectionPolicyConfig, c.s.GetIdentityDeserializer(channelName))
	if err != nil {
		return nil, err
	}
	return sc.AccessFilter(), nil
}

func (c *simpleCollectionStore) RetrieveCollection(cc common.CollectionCriteria) (Collection, error) {
	return c.retrieveSimpleCollection(cc, nil)
}

func (c *simpleCollectionStore) RetrieveCollectionAccessPolicy(cc common.CollectionCriteria) (CollectionAccessPolicy, error) {
	return c.retrieveSimpleCollection(cc, nil)
}

func (c *simpleCollectionStore) RetrieveCollectionConfigPackage(cc common.CollectionCriteria) (*common.CollectionConfigPackage, error) {
	return c.retrieveCollectionConfigPackage(cc, nil)
}

// RetrieveCollectionPersistenceConfigs retrieves the collection's persistence related configurations
func (c *simpleCollectionStore) RetrieveCollectionPersistenceConfigs(cc common.CollectionCriteria) (CollectionPersistenceConfigs, error) {
	staticCollectionConfig, err := c.retrieveCollectionConfig(cc, nil)
	if err != nil {
		return nil, err
	}
	return &SimpleCollectionPersistenceConfigs{staticCollectionConfig.BlockToLive}, nil
}

func (c *simpleCollectionStore) HasReadAccess(cc common.CollectionCriteria, signedProposal *pb.SignedProposal, qe ledger.QueryExecutor) (bool, error) {
	accessPolicy, err := c.retrieveSimpleCollection(cc, qe)
	if err != nil {
		return false, err
	}

	if !accessPolicy.IsMemberOnlyRead() {
		return true, nil
	}

	signedData, err := getSignedData(signedProposal)
	if err != nil {
		return false, err
	}

	hasReadAccess := accessPolicy.AccessFilter()
	return hasReadAccess(signedData), nil
}

func getSignedData(signedProposal *pb.SignedProposal) (common.SignedData, error) {
	proposal, err := utils.GetProposal(signedProposal.ProposalBytes)
	if err != nil {
		return common.SignedData{}, err
	}

	creator, _, err := utils.GetChaincodeProposalContext(proposal)
	if err != nil {
		return common.SignedData{}, err
	}

	return common.SignedData{
		Data:      signedProposal.ProposalBytes,
		Identity:  creator,
		Signature: signedProposal.Signature,
	}, nil
}


text:
disable scroll
===

[![NPM version](https://badge.fury.io/js/disable-scroll.svg)](https://www.npmjs.com/package/disable-scroll) [![build status](https://travis-ci.org/gilbarbara/disable-scroll.svg)](https://travis-ci.org/gilbarbara/disable-scroll) [![Maintainability](https://api.codeclimate.com/v1/badges/6a4bbda8255037dca13f/maintainability)](https://codeclimate.com/github/gilbarbara/disable-scroll/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/6a4bbda8255037dca13f/test_coverage)](https://codeclimate.com/github/gilbarbara/disable-scroll/test_coverage)

**Prevent page scrolling like a boss.**
Supports `scroll, wheel, touchmove, keydown` events.

[Demo](https://codesandbox.io/s/github/gilbarbara/disable-scroll/tree/master/demo)

## Setup

### npm
```bash
npm install --save disable-scroll
```

and import it

```typescript
import disableScroll from 'disable-scroll';
```

## Usage

```typescript
disableScroll.on(); // prevent scrolling
...
disableScroll.off(); // re-enable scroll
```

> If you need to support legacy browsers you need to include the scrollingelement polyfill.

## API

### .on(element?: Element, options?: Options)
Disable page scroll by adding event listeners and locking the scroll position.

Options defaults to:

```typescript
{
    authorizedInInputs: [32, 37, 38, 39, 40],
    disableKeys: true,
    disableScroll: true,
    disableWheel: true,
    keyboardKeys: [32, 33, 34, 35, 36, 37, 38, 39, 40],
}
```

### .off()
Re-enable page scrolling and remove the listeners.

## Issues

If you find a bug, please file an issue on [our issue tracker on GitHub](https://github.com/gilbarbara/disable-scroll/issues).

## License

MIT

---

Inspired by [jquery-disablescroll](https://github.com/ultrapasty/jquery-disablescroll)


text:
package uk.gov.gchq.gaffer.federatedstore;

import uk.gov.gchq.gaffer.operation.Operation;

public final class FederatedStoreConstants {
    // Operation options
    public static final String KEY_OPERATION_OPTIONS_GRAPH_IDS = "gaffer.federatedstore.operation.graphIds";
    public static final String KEY_SKIP_FAILED_FEDERATED_STORE_EXECUTE = "gaffer.federatedstore.operation.skipFailedFederatedStoreExecute";
    public static final String DEFAULT_VALUE_KEY_SKIP_FAILED_FEDERATED_STORE_EXECUTE = String.valueOf(false);
    public static final String DEFAULT_VALUE_IS_PUBLIC = String.valueOf(false);
    public static final String KEY_FEDERATION_ADMIN = "gaffer.federatedstore.operation.admin";

    private FederatedStoreConstants() {
        // private constructor to prevent users instantiating this class as it
        // only contains constants.
    }

    public static String getSkipFailedFederatedStoreExecute(final Operation op) {
        return op.getOption(KEY_SKIP_FAILED_FEDERATED_STORE_EXECUTE, DEFAULT_VALUE_KEY_SKIP_FAILED_FEDERATED_STORE_EXECUTE);
    }
}


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

<introspection xmlns="http://www.wyona.org/neutron/1.0">
<edit mime-type="application/xhtml+xml" name="Testing Framework">
  <checkout url="testing-framework.xhtml?yanel.resource.usecase=checkout" method="GET"/>
  <checkin  url="testing-framework.xhtml?yanel.resource.usecase=checkin"  method="PUT"/>
</edit>
</introspection>


text:
{% comment %}
Sidebar menu for the "My Account" section. Intended to be rendered using
the storybase_menu tag.
{% endcomment %}

      {% for item in menu_items %}

{{ item.label }}

      {% endfor %}


text:
package email

import composition.RetainEmailServiceBinding
import helpers.UnitSpec
import helpers.TestWithApplication
import models.BusinessDetailsModel
import models.ConfirmFormModel
import models.EligibilityModel
import models.RetainModel
import uk.gov.dvla.vehicles.presentation.common.clientsidesession.TrackingId
import uk.gov.dvla.vehicles.presentation.common.model.VehicleAndKeeperDetailsModel
import uk.gov.dvla.vehicles.presentation.common.services.DateService
import webserviceclients.fakes.AddressLookupServiceConstants.addressWithoutUprn
import webserviceclients.fakes.AddressLookupServiceConstants.KeeperEmailValid
import webserviceclients.fakes.AddressLookupServiceConstants.TraderBusinessContactValid
import webserviceclients.fakes.AddressLookupServiceConstants.TraderBusinessEmailValid
import webserviceclients.fakes.AddressLookupServiceConstants.TraderBusinessNameValid
import webserviceclients.fakes.VrmRetentionRetainWebServiceConstants.CertificateNumberValid
import webserviceclients.fakes.VrmRetentionRetainWebServiceConstants.ReplacementRegistrationNumberValid
import webserviceclients.fakes.VrmRetentionRetainWebServiceConstants.TransactionTimestampValid
import webserviceclients.fakes.VehicleAndKeeperLookupWebServiceConstants.RegistrationNumberValid
import webserviceclients.fakes.VehicleAndKeeperLookupWebServiceConstants.VehicleMakeValid
import webserviceclients.fakes.VehicleAndKeeperLookupWebServiceConstants.VehicleModelValid

class EmailServiceImplSpec extends UnitSpec {

  "EmailRequest" should {
      "have an attachment if send pdf is true" in new TestWithApplication {
        val (dateService, emailService) = build

        val emailRequest = emailService.emailRequest(
          emailAddress = TraderBusinessEmailValid,
          vehicleAndKeeperDetailsModel = vehicleAndKeeperDetails,
          eligibilityModel = eligibility,
          EmailData(certificateNumber = CertificateNumberValid,
            transactionTimestamp = TransactionTimestampValid,
            transactionId = TransactionId
          ),
          confirmFormModel = Some(confirmFormModel),
          businessDetailsModel = Some(businessDetailsModel),
          EmailFlags(sendPdf = true, isKeeper = false),
          trackingId = TrackingId("123")
        )

        emailRequest shouldBe defined
        emailRequest.get.attachment shouldBe defined
      }

      "not have an attachment if send pdf is false" in new TestWithApplication {
        val (dateService, emailService) = build

        val emailRequest = emailService.emailRequest(
          emailAddress = KeeperEmailValid.get,
          vehicleAndKeeperDetailsModel = vehicleAndKeeperDetails,
          eligibilityModel = eligibility,
          EmailData(certificateNumber = CertificateNumberValid,
            transactionTimestamp = TransactionTimestampValid,
            transactionId = TransactionId
          ),
          confirmFormModel = Some(confirmFormModel),
          businessDetailsModel = None,
          EmailFlags(sendPdf = false, isKeeper = true),
          trackingId = TrackingId("123")
        )

        emailRequest shouldBe defined
        emailRequest.get.attachment shouldBe empty
      }
    }

  "htmlMessage" should {
    "return html with business details when user type is business" in new TestWithApplication {
      val (_, emailService) = build

      val result = emailService.htmlMessage(
        vehicleAndKeeperDetailsModel = vehicleAndKeeperDetails,
        eligibilityModel = eligibility,
        EmailData(certificateNumber = CertificateNumberValid,
          transactionTimestamp = TransactionTimestampValid,
          transactionId = TransactionId
        ),
        confirmFormModel = Some(confirmFormModel),
        businessDetailsModel = Some(businessDetailsModel),
        EmailFlags(sendPdf = true, isKeeper = false)
      )

      val message = result.toString

      message should include(vehicleAndKeeperDetails.registrationNumber)
      message should include(eligibility.replacementVRM)
      message should include(retain.certificateNumber)
      message should include(retain.transactionTimestamp)
      message should include(TransactionId)
      message should include(TraderBusinessNameValid)
      message should include(TraderBusinessEmailValid)
      message should include("V948")
    }

    "return html without business details html when user type is keeper" in new TestWithApplication {
      val (_, emailService) = build

      val result = emailService.htmlMessage(
        vehicleAndKeeperDetailsModel = vehicleAndKeeperDetails,
        eligibilityModel = eligibility,
        EmailData(certificateNumber = CertificateNumberValid,
          transactionTimestamp = TransactionTimestampValid,
          transactionId = TransactionId
        ),
        confirmFormModel = Some(confirmFormModel),
        businessDetailsModel = None,
        EmailFlags(sendPdf = false, isKeeper = true)
      )

      val message = result.toString

      message should include(vehicleAndKeeperDetails.registrationNumber)
      message should include(eligibility.replacementVRM)
      message should include(retain.certificateNumber)
      message should include(retain.transactionTimestamp)
      message should include(TransactionId)
      message shouldNot include(TraderBusinessNameValid)
      message shouldNot include(TraderBusinessEmailValid)
      message shouldNot include("V948")
    }
  }

  private def build = {
    val injector = testInjector(
      new RetainEmailServiceBinding
    )
    (injector.getInstance(classOf[DateService]), injector.getInstance(classOf[RetainEmailService]))
  }

  private def vehicleAndKeeperDetails = VehicleAndKeeperDetailsModel(
    registrationNumber = RegistrationNumberValid,
    make = VehicleMakeValid,
    model = VehicleModelValid,
    title = None,
    firstName = None,
    lastName = None,
    address = None,
    disposeFlag = None,
    keeperEndDate = None,
    keeperChangeDate = None,
    suppressedV5Flag = None
  )

  private def eligibility = EligibilityModel(replacementVRM = ReplacementRegistrationNumberValid)

  private def retain = RetainModel(
    certificateNumber = CertificateNumberValid,
    transactionTimestamp = TransactionTimestampValid
  )

  private val TransactionId = "stubTransactionId"

  private def confirmFormModel = ConfirmFormModel(keeperEmail = KeeperEmailValid)

  private def businessDetailsModel = BusinessDetailsModel(
    name = TraderBusinessNameValid,
    contact = TraderBusinessContactValid,
    email = TraderBusinessEmailValid,
    address = addressWithoutUprn
  )
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <attr name="state_active" format="boolean" />
</resources>