text:
package org.apache.xbean.command;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NameClassPair;
import javax.naming.NameNotFoundException;
import javax.naming.NamingEnumeration;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;

public class Lookup implements Command {

    private final javax.naming.Context ctx;

    public Lookup() throws Exception {
        this(new InitialContext());
    }

    public Lookup(Context ctx) {
        this.ctx = ctx;
    }

    public static void register() {
        try {
            Lookup cmd = new Lookup();
            CommandRegistry.register("lookup", cmd);
        } catch (Exception e) {
        }
    }

    private static String PWD = "";

    // execute jndi lookups
    public int main(String[] args, InputStream in, PrintStream out) {
        try {
            String name = "";
            if (args == null || args.length == 0) {
                name = PWD;
            } else {
                name = args[0];
            }
            Object obj = null;
            try {
                obj = ctx.lookup(name);
            } catch (NameNotFoundException e) {
                out.print("lookup: ");
                out.print(name);
                out.println(": No such object or subcontext");
                return -1;
            } catch (Throwable e) {
                out.print("lookup: error: ");
                e.printStackTrace(new PrintStream(out));
                return -1;
            }
            if (obj instanceof Context) {
                list(name, in, out);
                return 0;
            }
            // TODO:1: Output the different data types differently
            out.println("" + obj);
            return 0;

        } catch (Exception e) {
            e.printStackTrace(new PrintStream(out));
            return -2;
        }
    }

    public void list(String name, InputStream in, PrintStream out) throws IOException {
        try {
            NamingEnumeration names = null;
            try {
                names = ctx.list(name);
            } catch (NameNotFoundException e) {
                out.print("lookup: ");
                out.print(name);
                out.println(": No such object or subcontext");
                return;
            } catch (Throwable e) {
                out.print("lookup: error: ");
                e.printStackTrace(new PrintStream(out));
                return;
            }
            if (names == null) {
                return;
            }
            while (names.hasMore()) {
                NameClassPair entry = (NameClassPair) names.next();
                out.println(entry.getName());
            }
        } catch (Exception e) {
            e.printStackTrace(new PrintStream(out));
        }
    }
}


text:
using Newtonsoft.Json;

namespace IBM.WatsonDeveloperCloud.Discovery.v1.Model
{
    /// <summary>
    /// QueryNoticesResult.
    /// </summary>
    public class QueryNoticesResult
    {
        /// <summary>
        /// The unique identifier of the document.
        /// </summary>
        /// <value>The unique identifier of the document.</value>
        [JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)]
        public dynamic Id { get; set; }
        /// <summary>
        /// *Deprecated* This field is now part of the `result_metadata` object.
        /// </summary>
        /// <value>*Deprecated* This field is now part of the `result_metadata` object.</value>
        [JsonProperty("score", NullValueHandling = NullValueHandling.Ignore)]
        public dynamic Score { get; set; }
        /// <summary>
        /// Metadata of the document.
        /// </summary>
        /// <value>Metadata of the document.</value>
        [JsonProperty("metadata", NullValueHandling = NullValueHandling.Ignore)]
        public dynamic Metadata { get; set; }
        /// <summary>
        /// The collection ID of the collection containing the document for this result.
        /// </summary>
        /// <value>The collection ID of the collection containing the document for this result.</value>
        [JsonProperty("collection_id", NullValueHandling = NullValueHandling.Ignore)]
        public dynamic CollectionId { get; set; }
        /// <summary>
        /// Gets or Sets ResultMetadata
        /// </summary>
        [JsonProperty("result_metadata", NullValueHandling = NullValueHandling.Ignore)]
        public dynamic ResultMetadata { get; set; }
    }

}

redpajama_set_name: RedPajamaGithub


text:
#region License

#endregion
using System.Linq;
using System.Collections.Generic;
using System.Abstract.Fakes;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace System.Abstract.EventSourcing
{
	[TestClass]
	public abstract class AggregateRootSnapshotStoreIntegrationTestsBase
	{
		protected IAggregateRootSnapshotStore AggregateRootSnapshotStore { get; private set; }
		protected abstract IAggregateRootSnapshotStore CreateAggregateRootSnapshotStore();

		[TestInitialize]
		public void Initialize()
		{
			AggregateRootSnapshotStore = CreateAggregateRootSnapshotStore();
		}

		[TestMethod]
		public void CreateMessage_Should_Return_Valid_Instance()
		{
		}
	}
}


text:
fMRI_Connectivity_Unified_process
=================================
Overview:

Versions:

.. toctree::
   :maxdepth: 5

   spider_level/fMRI_Connectivity_Unified_process_v1_0_0


text:
import React, { Component, PropTypes } from 'react';
import {
  Keyboard,
  LayoutAnimation,
  View,
  Platform,
  StyleSheet
} from 'react-native';

export default class KeyboardSpacer extends Component {

  static propTypes = {
    topSpacing: PropTypes.number,
    height: PropTypes.number,
    onToggle: PropTypes.func,
    style: View.propTypes.style,
    animationConfig: PropTypes.object,
  };

  static defaultProps = {
    topSpacing: 0,
    // From: https://medium.com/man-moon/writing-modern-react-native-ui-e317ff956f02
    animationConfig: {
      duration: 500,
      create: {
        duration: 300,
        type: LayoutAnimation.Types.easeInEaseOut,
        property: LayoutAnimation.Properties.opacity
      },
      update: {
        type: LayoutAnimation.Types.spring,
        springDamping: 200
      }
    },
    onToggle: () => null,
  };

  constructor(props, context) {
    super(props, context);
    this.state = {
      keyboardSpace: 0,
      isKeyboardOpened: false
    };
    this._listeners = null;
    this.updateKeyboardSpace = this.updateKeyboardSpace.bind(this);
    this.resetKeyboardSpace = this.resetKeyboardSpace.bind(this);
  }

  componentDidMount() {
    const updateListener = Platform.OS === 'android' ? 'keyboardDidShow' : 'keyboardWillShow';
    const resetListener = Platform.OS === 'android' ? 'keyboardDidHide' : 'keyboardWillHide';
    this._listeners = [
      Keyboard.addListener(updateListener, this.updateKeyboardSpace),
      Keyboard.addListener(resetListener, this.resetKeyboardSpace)
    ];
  }

  componentWillUpdate(props, state) {
    if (state.isKeyboardOpened !== this.state.isKeyboardOpened) {
      LayoutAnimation.configureNext(props.animationConfig);
    }
  }

  componentWillUnmount() {
    this._listeners.forEach(listener => listener.remove());
  }

  updateKeyboardSpace(frames) {
    if (!frames.endCoordinates) {
      return;
    }
    let keyboardSpace = this.props.height ? this.props.height : frames.endCoordinates.height + this.props.topSpacing;
    this.setState({
      keyboardSpace,
      isKeyboardOpened: true
    }, this.props.onToggle(true, keyboardSpace));
  }

  resetKeyboardSpace() {
    this.setState({
      keyboardSpace: 0,
      isKeyboardOpened: false
    }, this.props.onToggle(false, 0));
  }

  render() {
    return (
      <View style={[styles.container, { height: this.state.keyboardSpace }, this.props.style]} />);
  }
}

const styles = StyleSheet.create({
  container: {
    left: 0,
    right: 0,
    bottom: 0,
  },
});


text:
require 'json'
require 'uri'
require 'net/http'
require 'net/https'

module NewRelic
  module Binding
    class Connection
      attr_reader :license_key, :url

      def initialize(context)
        @url = Config.endpoint + Config.uri
        @license_key = context.license_key
      end

      def send_request(data)
        begin
          PlatformLogger.debug("JSON payload: #{data}")
          uri = URI.parse(url)
          if Config.proxy.nil?
            http = Net::HTTP.new(uri.host, uri.port)
          else
            proxy = Config.proxy
            http = Net::HTTP.new(uri.host, uri.port, proxy['address'], proxy['port'], proxy['user'], proxy['password'])
          end
          if Config.use_ssl?
            http.use_ssl = true
            http.verify_mode = OpenSSL::SSL::VERIFY_NONE if Config.skip_ssl_host_verification?
          end
          http.open_timeout = 20
          http.read_timeout = 20
          request = Net::HTTP::Post.new(uri.path)
          request['content-type'] = 'application/json'
          request['X-License-Key'] = @license_key
          request.body = data
          response = http.request(request)
          return evaluate_response(response)
        rescue Timeout::Error => err
          PlatformLogger.warn "Connection Timeout Error: #{err.inspect} #{err.message}"
          return false
        rescue => err
          PlatformLogger.warn "HTTP Connection Error: #{err.inspect} #{err.message}"
          return false
        end
      end

    private
      def evaluate_response(response)
        return_status = nil
        begin
          if response.nil?
            last_result = { "error" => "no response" }
            return_status = "FAILED: No response"
          elsif response && response.code == '200'
            last_result = JSON.parse(response.body)
            if last_result["status"] != "ok"
              return_status = "FAILED[#{response.code}] <#{url}>: #{last_result["error"]}"
            end
          elsif response && response.code == '403' && response.body == "DISABLE_NEW_RELIC"
            PlatformLogger.fatal "Agent has been disabled remotely by New Relic"
            abort "Agent has been disabled remotely by New Relic"
          else
            if response.body.size > 0
              last_result = JSON.parse(response.body)
            else
              last_result = {"error" => "no data returned"}
            end
            return_status = "FAILED[#{response.code}] <#{url}>: #{last_result["error"]}"
          end
        rescue => err
          return_status = "FAILED[#{response.code}] <#{url}>: Could not parse response: #{err.message}"
        end
        if return_status
          if response and response.code == '503'
            PlatformLogger.warn("Collector temporarily unavailable. Continuing.")
          else
            PlatformLogger.error("#{return_status}")
          end
        end

        return_status.nil?
      end

    end
  end
end


text:
function getLastLine(input) {
  var lines = [], nextLine;
  while ((nextLine = readNextLine(input)))
    lines.push(nextLine);
  if (!lines)
    throw new Error("No lines!");
  return lines[lines.length-1];
}


text:
package com.gs.fw.common.mithra.test.domain.evo;

public abstract class EvoTypeTime extends EvoTypeTimeAbstract
{
}


text:
table.sortable-table
{
    border: thin #ccc solid;
    margin: 1em;
    border-collapse: collapse;
}
table.indexed  {
    counter-reset: rowNumber;
}
table.indexed tr.indexed{
    counter-increment: rowNumber;
}

table.indexed tr.indexed td.indexed span::before{
    content: counter(rowNumber);
}
table.sortable-table th{
    padding-left: 26px;
    background-color: #ddd;
}
table.sortable-table th.ascending,
table.sortable-table th.descending{
    background-repeat: no-repeat;
    background-position-x: left;
    background-position-y: center;
}
table.sortable-table th.ascending {
    background-image: url(./../img/icons/icon-arrow-down.svg);
}
table.sortable-table th.descending{
    background-image: url(./../img/icons/icon-arrow-up.svg);
}
table.sortable-table tr.highlight-row {
    background-color: paleturquoise;
}
table.sortable-table tr td,
table.sortable-table tr th
{
    border: thin #ccc solid;
    padding: 0.5em;

}


text:
@interface PodsDummy_EmailPicker : NSObject
@end
@implementation PodsDummy_EmailPicker
@end


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

<title>DiscoveryManagement (River-Internet vtrunk API Documentation (internals))</title>
<meta name="date" content="2016-03-28">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

net.jini.discovery

Interface DiscoveryManagement

All Known Implementing Classes:

AbstractLookupDiscovery, AbstractLookupDiscoveryManager, AbstractLookupLocatorDiscovery, LookupDiscovery, LookupDiscoveryManager, LookupLocatorDiscovery

public interface DiscoveryManagement

This interface defines methods related to the discovery event mechanism
 and discovery process termination. Through this interface an entity can
 register or un-register for discovery events, discard a lookup service,
 or terminate the discovery process.

Author:

Sun Microsystems, Inc.

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method and Description

void
addDiscoveryListener(DiscoveryListener listener)

Adds an instance of DiscoveryListener to the set of
 objects listening for discovery events.

void
discard(ServiceRegistrar proxy)

Removes an instance of ServiceRegistrar from the
 managed set of lookup services, making the corresponding lookup
 service eligible for re-discovery.

ServiceRegistrar[]
getRegistrars()

Returns an array of instances of ServiceRegistrar, each
 corresponding to a proxy to one of the currently discovered lookup
 services.

void
removeDiscoveryListener(DiscoveryListener listener)

Removes a listener from the set of objects listening for discovery
 events.

void
terminate()

Ends all discovery processing being performed by the current
 implementation of this interface.

Method Detail

addDiscoveryListener

void addDiscoveryListener(DiscoveryListener listener)

Adds an instance of DiscoveryListener to the set of
 objects listening for discovery events. Once the listener is
 registered, it will be notified of all lookup services discovered
 to date, and will then be notified as new lookup services are
 discovered or existing lookup services are discarded.

 If null is input to this method, a
 NullPointerException is thrown. If the listener
 input to this method duplicates (using the equals
 method) another element in the current set of listeners, no action
 is taken.

Parameters:

listener - an instance of DiscoveryListener
                 corresponding to the listener to add to the set of
                 listeners.

Throws:

NullPointerException - if null is
         input to the listener parameter

See Also:

removeDiscoveryListener(net.jini.discovery.DiscoveryListener),
DiscoveryListener

removeDiscoveryListener

void removeDiscoveryListener(DiscoveryListener listener)

Removes a listener from the set of objects listening for discovery
 events. If the listener object input to this method does not exist
 in the set of listeners, then this method will take no action.

Parameters:

listener - an instance of DiscoveryListener
                 corresponding to the listener to remove from the set
                 of listeners.

See Also:

addDiscoveryListener(net.jini.discovery.DiscoveryListener),
DiscoveryListener

getRegistrars

ServiceRegistrar[] getRegistrars()

Returns an array of instances of ServiceRegistrar, each
 corresponding to a proxy to one of the currently discovered lookup
 services. For each invocation of this method, a new array is returned.

Returns:

array of instances of ServiceRegistrar, each
         corresponding to a proxy to one of the currently discovered
         lookup services

See Also:

ServiceRegistrar

discard

void discard(ServiceRegistrar proxy)

Removes an instance of ServiceRegistrar from the
 managed set of lookup services, making the corresponding lookup
 service eligible for re-discovery. This method takes no action if
 the parameter input to this method is null, or if it
 does not match (using equals) any of the elements in
 the managed set.

Parameters:

proxy - the instance of ServiceRegistrar to remove
              from the managed set of lookup services

See Also:

ServiceRegistrar

terminate

void terminate()

Ends all discovery processing being performed by the current
 implementation of this interface. After this method is invoked,
 no new lookup services will be discovered, and the effect of any
 new operations performed on the current implementation object are
 undefined. Any additional termination semantics must be defined
 by the implementation class itself.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.


text:
package raw.settings;

import javax.json.Json;
import javax.json.JsonObject;

import raw.db.SupportedDataBases;

public class DataBaseProperties implements Properties {

	private SupportedDataBases dbEngine;
	private String dbEngineJsonKey = "DataBase Engine";

	private String dbDir;
	private String dbDirJsonKey = "DataBase Directory";

	private String fileSeparator;

	private int port;
	private String portJsonKey = "DataBase port";

	public DataBaseProperties() {
		PropertiesManager manager = PropertiesManager.getManager();

		dbEngine = SupportedDataBases.HSQLDB;

		dbDir = manager.getGeneralBaseDir()+dbEngine+manager.getFileSeparator();

		fileSeparator = manager.getFileSeparator();

		defaultPort();
	}

	public DataBaseProperties(JsonObject json) {
		dbEngine = SupportedDataBases.fromDbName(json.getString(dbEngineJsonKey));

		dbDir = json.getString(dbDirJsonKey);

		boolean updatedSettings = false;

		try {
			port = json.getInt(portJsonKey);
		} catch (NullPointerException e) {
			defaultPort();
			updatedSettings = true;
		}

		if(updatedSettings){
			notifyChanged();
		}
	}

	@Override
	public JsonObject toJsonObject() {
		JsonObject json = Json.createObjectBuilder().
				add(dbEngineJsonKey, dbEngine.getDbName()).
				add(dbDirJsonKey, dbDir).
				add(portJsonKey, port).
				build();
		return json;
	}

	private void defaultPort(){
		port = 15000;
	}

	/**
	 * @return the dbEngine
	 */
	public SupportedDataBases getDbEngine() {
		return dbEngine;
	}

	/**
	 * @param dbEngine the dbEngine to set
	 */
	protected void setDbEngine(SupportedDataBases dbEngine) {
		this.dbEngine = dbEngine;
		notifyChanged();
	}

	/**
	 * @return the dbDir
	 */
	public String getDbDir() {
		return dbDir;
	}

	/**
	 * @param dbDir the dbDir to set
	 */
	protected void setDbDir(String dbDir) {
		this.dbDir = dbDir;
		notifyChanged();
	}

	/**
	 * @return the fileSeparator
	 */
	public String getFileSeparator() {
		return fileSeparator;
	}

	private void notifyChanged(){
		PropertiesManager.getManager().notifyPropertiesChanged(ModuleProperty.DATABASE);
		return;
	}

	/**
	 * @return the port
	 */
	public int getPort() {
		return port;
	}

	/**
	 * @param port the port to set
	 */
	public void setPort(int port) {
		this.port = port;
		notifyChanged();
	}

}


text:
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.IO;
using System.Linq;
using System.Xml.Linq;
using FluentAssertions;
using Microsoft.DotNet.Tools.Test.Utilities;
using Microsoft.Extensions.DependencyModel;
using Xunit;

namespace Microsoft.DotNet.New.Tests
{
    public class GivenThatIWantANewApp : TestBase
    {
        [Fact]
        public void When_dotnet_new_is_invoked_mupliple_times_it_should_fail()
        {
            var rootPath = TestAssets.CreateTestDirectory().FullName;

            new NewCommand()
                .WithWorkingDirectory(rootPath)
                .Execute($"console --debug:ephemeral-hive --no-restore");

            DateTime expectedState = Directory.GetLastWriteTime(rootPath);

            var result = new NewCommand()
                .WithWorkingDirectory(rootPath)
                .ExecuteWithCapturedOutput($"console --debug:ephemeral-hive --no-restore");

            DateTime actualState = Directory.GetLastWriteTime(rootPath);

            Assert.Equal(expectedState, actualState);

            result.Should().Fail();
        }

        [Fact]
        public void RestoreDoesNotUseAnyCliProducedPackagesOnItsTemplates()
        {
            string[] cSharpTemplates = new[] { "console", "classlib", "mstest", "xunit", "web", "mvc", "webapi" };

            var rootPath = TestAssets.CreateTestDirectory().FullName;
            var packagesDirectory = Path.Combine(rootPath, "packages");

            // For testing the 2.1 templates - some of their packages are currently only in private feeds.
            var configFile = Path.Combine(rootPath, "NuGet.Config");
            AspNetNuGetConfiguration.WriteNuGetConfigWithAspNetPrivateFeeds(configFile);
			      // For "normal" builds, once the packages needed for 2.1 templates are in the public feeds
            //var configFile = Path.Combine(RepoDirectoriesProvider.RepoRoot, "NuGet.Config");

            foreach (string cSharpTemplate in cSharpTemplates)
            {
                var projectFolder = Path.Combine(rootPath, cSharpTemplate + "1");
                Directory.CreateDirectory(projectFolder);
                CreateAndRestoreNewProject(cSharpTemplate, projectFolder, packagesDirectory, configFile);
            }

            Directory.EnumerateFiles(packagesDirectory, $"*.nupkg", SearchOption.AllDirectories)
                .Should().NotContain(p => p.Contains("Microsoft.DotNet.Cli.Utils"));
        }

        private void CreateAndRestoreNewProject(
            string projectType,
            string projectFolder,
            string packagesDirectory,
            string configFile)
        {
            new NewCommand()
                .WithWorkingDirectory(projectFolder)
                .Execute($"{projectType} --debug:ephemeral-hive --no-restore")
                .Should().Pass();

            new RestoreCommand()
                .WithWorkingDirectory(projectFolder)
                .Execute($"--configfile {configFile} --packages {packagesDirectory}")
                .Should().Pass();
        }

        [Theory]
        [InlineData("console", "microsoft.netcore.app")]
        // re-enable when this bug is resolved: https://github.com/dotnet/cli/issues/7574
        //[InlineData("classlib", "netstandard.library")]
        public void NewProjectRestoresCorrectPackageVersion(string type, string packageName)
        {
            var rootPath = TestAssets.CreateTestDirectory(identifier: $"_{type}").FullName;
            var packagesDirectory = Path.Combine(rootPath, "packages");
            var projectName = "Project";
            var expectedVersion = GetFrameworkPackageVersion();
            var repoRootNuGetConfig = Path.Combine(RepoDirectoriesProvider.RepoRoot, "NuGet.Config");

            new NewCommand()
                .WithWorkingDirectory(rootPath)
                .Execute($"{type} --name {projectName} -o . --debug:ephemeral-hive --no-restore")
                .Should().Pass();

            new RestoreCommand()
                .WithWorkingDirectory(rootPath)
                .Execute($"--configfile {repoRootNuGetConfig} --packages {packagesDirectory}")
                .Should().Pass();

            new DirectoryInfo(Path.Combine(packagesDirectory, packageName))
                .Should().Exist()
                .And.HaveDirectory(expectedVersion);

            string GetFrameworkPackageVersion()
            {
                var dotnetDir = new FileInfo(DotnetUnderTest.FullName).Directory;
                var sharedFxDir = dotnetDir
                    .GetDirectory("shared", "Microsoft.NETCore.App")
                    .EnumerateDirectories()
                    .Single(d => d.Name.StartsWith("2.1.0"));

                if (packageName == "microsoft.netcore.app")
                {
                    return sharedFxDir.Name;
                }

                var depsFile = Path.Combine(sharedFxDir.FullName, "Microsoft.NETCore.App.deps.json");
                using (var stream = File.OpenRead(depsFile))
                using (var reader = new DependencyContextJsonReader())
                {
                    var context = reader.Read(stream);
                    var dependency = context
                        .RuntimeLibraries
                        .Single(library => string.Equals(library.Name, packageName, StringComparison.OrdinalIgnoreCase));

                    return dependency.Version;
                }
            }
        }
    }
}


text:
/* { dg-do run } */
/* { dg-require-alias "" } */
/* { dg-options "-O2" } */

extern void abort (void);

#define ASMNAME(cname)  ASMNAME2 (__USER_LABEL_PREFIX__, cname)
#define ASMNAME2(prefix, cname) STRING (prefix) cname
#define STRING(x)    #x

int foo __asm__ (ASMNAME ("foo")) __attribute__((nocommon));
extern __typeof (foo) bar __attribute__ ((weak, alias ("foo")));

int
main (void)
{
  if (&foo != &bar || foo || bar)
    abort ();
  return bar;
}


text:
using System.Runtime.InteropServices;

namespace Gee.External.Capstone.PowerPc {
    /// <summary>
    ///     Native PowerPC Operand Value.
    /// </summary>
    [StructLayout(LayoutKind.Explicit)]
    internal struct NativePowerPcOperandValue {
        /// <summary>
        ///     Register Value.
        /// </summary>
        [FieldOffset(0)]
        public PowerPcRegisterId Register;

        /// <summary>
        ///     Immediate Value.
        /// </summary>
        [FieldOffset(0)]
        public long Immediate;

        /// <summary>
        ///     Memory Value.
        /// </summary>
        [FieldOffset(0)]
        public NativePowerPcMemoryOperandValue Memory;

        /// <summary>
        ///     Condition Register Value.
        /// </summary>
        [FieldOffset(0)]
        public NativePowerPcConditionRegisterOperandValue ConditionRegister;
    }
}


text:
class ItemSerializer < ActiveModel::Serializer
  format_keys :lower_camel
  attributes :id,
             :target_id,
             :target_type,
             :description,
             :image,
             :caption,
             :twitter_id

  def target_type
    object[:target_type]
  end

  def description
    target_column(:description)
  end

  def image
    target_column(:image_url)
  end

  def caption
    target_column(:caption)
  end

  def twitter_id
    target_column(:twitter_id)
  end

  def filter(keys)
    case object.target_type
    when 'twitter' then keys - [:description, :caption, :image]
    when 'image' then keys - [:description, :twitter_id]
    when 'text' then keys - [:caption, :image, :twitter_id]
    end
  end

  private

  def target_column(column_name)
    object.target.try(column_name)
  end
end


text:
shared_examples_for 'comment ability' do
  describe 'Authenticated user' do
    before do
      sign_in(user)
      visit commentable_path
      # save_and_open_page
    end

    scenario 'can see add_comment link' do
      within commentable_container do
        expect(page).to have_link('+Add comment')
      end
    end

    scenario 'can add comment to resource with valid data', js: true do
      within commentable_container do
        click_on '+Add comment'

        fill_in 'Your comment', with: 'Comment body'
        click_on 'Add comment'

        within('.comments-list') do
          expect(page).to have_content('Comment body')
        end
      end
    end

    scenario 'tries add comment with invalid data', js: true do
      within commentable_container do
        click_on '+Add comment'

        fill_in 'Your comment', with: ''
        click_on 'Add comment'
      end
      expect(page).to have_content 'Body can\'t be blank'
    end
  end

  describe 'Author of comment' do
    let!(:comment) { create(:comment, commentable: commentable, user: user) }

    before do
      sign_in(user)
      visit commentable_path
    end

    scenario 'can see remove comment link', js: true do
      within commentable_container do
        wait_for_ajax
        expect(page).to have_selector '.comment-delete'
      end
    end

    scenario 'can remove comment', js: true do
      within commentable_container do
        expect(page).to have_content comment.body

        find('.comment-delete').click
        wait_for_ajax

        expect(page).to_not have_content(comment.body)
      end
    end
  end

  describe 'Non-author of comment' do
    scenario 'does not see remove link', js: true do
      sign_in(create(:user))
      visit commentable_path

      expect(page).to_not have_selector '.comment-delete'
    end
  end

  scenario 'Non-authenticated user tries add comment' do
    visit commentable_path

    expect(page).to_not have_link('+Add comment')
  end

  context 'multiple sessions' do
    scenario "comment appears on another user's page", js: true do
      Capybara.using_session('user') do
        sign_in(user)
        visit question_path(question)
      end

      Capybara.using_session('quest') do
        visit question_path(question)
      end

      Capybara.using_session('user') do
        within commentable_container do
          click_on '+Add comment'
          fill_in 'Your comment', with: 'My awesome comment'
          click_on 'Add comment'
        end

        expect(page).to have_content('My awesome comment')
      end

      Capybara.using_session('quest') do
        wait_for_ajax
        expect(page).to have_content('My awesome comment')
      end
    end
  end
end


text:
using Nwazet.Commerce.Models;
using Orchard.Events;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Nwazet.Commerce.Services {
    public interface ICartLifeCycleEventHandler : IEventHandler {
        void Updated();
        void ItemAdded(ShoppingCartItem item);
        void ItemRemoved(ShoppingCartItem item);
        void Finalized();
        void Updated(IEnumerable<ShoppingCartItem> addedItems, IEnumerable<ShoppingCartItem> removedItems);
    }
}


text:
diff between today and yesterday

#### python
* [toodef/neural-pipeline](https://github.com/toodef/neural-pipeline): Neural networks training pipeline based on PyTorch
* [RasaHQ/rasa_core](https://github.com/RasaHQ/rasa_core):  Open source chatbot framework with machine learning-based dialogue management - Build contextual AI assistants
* [rg3/youtube-dl](https://github.com/rg3/youtube-dl): Command-line program to download videos from YouTube.com and other video sites
* [jabbalaci/PythonEXE](https://github.com/jabbalaci/PythonEXE): How to create an executable file from a Python script?
* [pallets/flask](https://github.com/pallets/flask): The Python micro framework for building web applications.
* [python/cpython](https://github.com/python/cpython): The Python programming language

#### go
* [filecoin-project/go-filecoin](https://github.com/filecoin-project/go-filecoin): Filecoin Full Node Implementation in Go
* [autonomy/talos](https://github.com/autonomy/talos): A modern Linux distribution for Kubernetes.
* [AdguardTeam/AdGuardHome](https://github.com/AdguardTeam/AdGuardHome): Network-wide ads & trackers blocking DNS server
* [elastic/go-elasticsearch](https://github.com/elastic/go-elasticsearch): The official Go client for Elasticsearch
* [GoogleContainerTools/skaffold](https://github.com/GoogleContainerTools/skaffold): Easy and Repeatable Kubernetes Development
* [wcharczuk/go-chart](https://github.com/wcharczuk/go-chart): go chart is a basic charting library in native golang.
* [schachmat/wego](https://github.com/schachmat/wego): weather app for the terminal
* [dgraph-io/dgraph](https://github.com/dgraph-io/dgraph): Fast, Distributed Graph DB
* [hashicorp/vault](https://github.com/hashicorp/vault): A tool for secrets management, encryption as a service, and privileged access management

#### cpp
* [ssloy/tinyraycaster](https://github.com/ssloy/tinyraycaster): 486 lines of C++: old-school FPS in a weekend
* [Coffee2CodeNL/gebaar-libinput](https://github.com/Coffee2CodeNL/gebaar-libinput): Gebaar, A Super Simple WM Independent Touchpad Gesture Daemon for libinput
* [retronx-team/sys-clk](https://github.com/retronx-team/sys-clk): sys-clk overclocking/underclocking system module
* [uglide/RedisDesktopManager](https://github.com/uglide/RedisDesktopManager):  Cross-platform GUI management tool for Redis
* [facebook/folly](https://github.com/facebook/folly): An open-source C++ library developed and used at Facebook.
* [facebook/rocksdb](https://github.com/facebook/rocksdb): A library that provides an embeddable, persistent key-value store for fast storage.
* [vergecurrency/VERGE](https://github.com/vergecurrency/VERGE): official source code repository for VERGE cryptocurrency
* [Tencent/mars](https://github.com/Tencent/mars): Mars is a cross-platform network component developed by WeChat.
* [nlohmann/json](https://github.com/nlohmann/json): JSON for Modern C++
* [yandex/ClickHouse](https://github.com/yandex/ClickHouse): ClickHouse is a free analytic DBMS for big data.
* [google/leveldb](https://github.com/google/leveldb): LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.

#### javascript
* [leon-ai/leon](https://github.com/leon-ai/leon):  Leon is your open-source personal assistant.
* [zadam/trilium](https://github.com/zadam/trilium): Build your personal knowledge base with Trilium Notes
* [NervJS/taro](https://github.com/NervJS/taro):  React ///H5React Native  https://taro.js.org/
* [be5invis/Sarasa-Gothic](https://github.com/be5invis/Sarasa-Gothic): Sarasa Gothic /  /  /
* [gatsbyjs/gatsby](https://github.com/gatsbyjs/gatsby): Build blazing fast, modern apps and websites with React
* [i0natan/nodebestpractices](https://github.com/i0natan/nodebestpractices): The largest Node.js best practices list (January 2019)

#### coffeescript
* [andruschka/pm2-meteor](https://github.com/andruschka/pm2-meteor): Simplest way to deploy, scale and run Meteor Apps with PM2.
* [avendael/atomic-emacs](https://github.com/avendael/atomic-emacs): An atomic implementation of emacs keybindings for the Atom text editor.
* [turbolinks/turbolinks-classic](https://github.com/turbolinks/turbolinks-classic): Classic version of Turbolinks. Now deprecated in favor of Turbolinks 5.
* [JoelBesada/activate-power-mode](https://github.com/JoelBesada/activate-power-mode): Atom package - Activate POWER MODE to write your code in style.
* [Leonidas-from-XIV/node-xml2js](https://github.com/Leonidas-from-XIV/node-xml2js): XML to JavaScript object converter.


text:
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/timer.h>
#include <linux/sched.h>
#include <linux/leds.h>
#include <linux/reboot.h>
#include "../leds.h"

static int panic_heartbeats;

struct heartbeat_trig_data {
	unsigned int phase;
	unsigned int period;
	struct timer_list timer;
	unsigned int invert;
};

static void led_heartbeat_function(unsigned long data)
{
	struct led_classdev *led_cdev = (struct led_classdev *) data;
	struct heartbeat_trig_data *heartbeat_data = led_cdev->trigger_data;
	unsigned long brightness = LED_OFF;
	unsigned long delay = 0;

	if (unlikely(panic_heartbeats)) {
		led_set_brightness_nosleep(led_cdev, LED_OFF);
		return;
	}

	/* acts like an actual heart beat -- ie thump-thump-pause... */
	switch (heartbeat_data->phase) {
	case 0:
		/*
		 * The hyperbolic function below modifies the
		 * heartbeat period length in dependency of the
		 * current (1min) load. It goes through the points
		 * f(0)=1260, f(1)=860, f(5)=510, f(inf)->300.
		 */
		heartbeat_data->period = 300 +
			(6720 << FSHIFT) / (5 * avenrun[0] + (7 << FSHIFT));
		heartbeat_data->period =
			msecs_to_jiffies(heartbeat_data->period);
		delay = msecs_to_jiffies(70);
		heartbeat_data->phase++;
		if (!heartbeat_data->invert)
			brightness = led_cdev->max_brightness;
		break;
	case 1:
		delay = heartbeat_data->period / 4 - msecs_to_jiffies(70);
		heartbeat_data->phase++;
		if (heartbeat_data->invert)
			brightness = led_cdev->max_brightness;
		break;
	case 2:
		delay = msecs_to_jiffies(70);
		heartbeat_data->phase++;
		if (!heartbeat_data->invert)
			brightness = led_cdev->max_brightness;
		break;
	default:
		delay = heartbeat_data->period - heartbeat_data->period / 4 -
			msecs_to_jiffies(70);
		heartbeat_data->phase = 0;
		if (heartbeat_data->invert)
			brightness = led_cdev->max_brightness;
		break;
	}

	led_set_brightness_nosleep(led_cdev, brightness);
	mod_timer(&heartbeat_data->timer, jiffies + delay);
}

static ssize_t led_invert_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	struct led_classdev *led_cdev = dev_get_drvdata(dev);
	struct heartbeat_trig_data *heartbeat_data = led_cdev->trigger_data;

	return sprintf(buf, "%u\n", heartbeat_data->invert);
}

static ssize_t led_invert_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t size)
{
	struct led_classdev *led_cdev = dev_get_drvdata(dev);
	struct heartbeat_trig_data *heartbeat_data = led_cdev->trigger_data;
	unsigned long state;
	int ret;

	ret = kstrtoul(buf, 0, &state);
	if (ret)
		return ret;

	heartbeat_data->invert = !!state;

	return size;
}

static DEVICE_ATTR(invert, 0644, led_invert_show, led_invert_store);

static void heartbeat_trig_activate(struct led_classdev *led_cdev)
{
	struct heartbeat_trig_data *heartbeat_data;
	int rc;

	heartbeat_data = kzalloc(sizeof(*heartbeat_data), GFP_KERNEL);
	if (!heartbeat_data)
		return;

	led_cdev->trigger_data = heartbeat_data;
	rc = device_create_file(led_cdev->dev, &dev_attr_invert);
	if (rc) {
		kfree(led_cdev->trigger_data);
		return;
	}

	setup_timer(&heartbeat_data->timer,
		    led_heartbeat_function, (unsigned long) led_cdev);
	heartbeat_data->phase = 0;
	led_heartbeat_function(heartbeat_data->timer.data);
	led_cdev->activated = true;
}

static void heartbeat_trig_deactivate(struct led_classdev *led_cdev)
{
	struct heartbeat_trig_data *heartbeat_data = led_cdev->trigger_data;

	if (led_cdev->activated) {
		del_timer_sync(&heartbeat_data->timer);
		device_remove_file(led_cdev->dev, &dev_attr_invert);
		kfree(heartbeat_data);
		led_cdev->activated = false;
	}
}

static struct led_trigger heartbeat_led_trigger = {
	.name     = "heartbeat",
	.activate = heartbeat_trig_activate,
	.deactivate = heartbeat_trig_deactivate,
};

static int heartbeat_reboot_notifier(struct notifier_block *nb,
				     unsigned long code, void *unused)
{
	led_trigger_unregister(&heartbeat_led_trigger);
	return NOTIFY_DONE;
}

static int heartbeat_panic_notifier(struct notifier_block *nb,
				     unsigned long code, void *unused)
{
	panic_heartbeats = 1;
	return NOTIFY_DONE;
}

static struct notifier_block heartbeat_reboot_nb = {
	.notifier_call = heartbeat_reboot_notifier,
};

static struct notifier_block heartbeat_panic_nb = {
	.notifier_call = heartbeat_panic_notifier,
};

static int __init heartbeat_trig_init(void)
{
	int rc = led_trigger_register(&heartbeat_led_trigger);

	if (!rc) {
		atomic_notifier_chain_register(&panic_notifier_list,
					       &heartbeat_panic_nb);
		register_reboot_notifier(&heartbeat_reboot_nb);
	}
	return rc;
}

static void __exit heartbeat_trig_exit(void)
{
	unregister_reboot_notifier(&heartbeat_reboot_nb);
	atomic_notifier_chain_unregister(&panic_notifier_list,
					 &heartbeat_panic_nb);
	led_trigger_unregister(&heartbeat_led_trigger);
}

module_init(heartbeat_trig_init);
module_exit(heartbeat_trig_exit);

MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>");
MODULE_DESCRIPTION("Heartbeat LED trigger");
MODULE_LICENSE("GPL");


text:
@extends('layout')

@section('title', 'Shota Saga - Team Graphical Graphics')
@section('description', 'Shota Sagaの動画一覧です。')
@section('keywords', 'ヨーヨー,yo-yo-,Team Graphical Graphics,Shota Saga')

@section('content')

Shota Saga

Shota Saga

      @foreach($movies as $title => $link)

{{{ $title }}}

      @endforeach

@endsection


text:
@interface PodsDummy_Pods_Noizio : NSObject
@end
@implementation PodsDummy_Pods_Noizio
@end


text:
package dk.lessismore.nojpa.db.statements.mysql;

import dk.lessismore.nojpa.db.statements.SQLStatement;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

/**
 * Mysql statement implementation
 *
 * @author LESS-IS-MORE
 * @version 1.0 25-7-02
 */
public abstract class MySqlStatement implements SQLStatement {

    protected List<String> tableNames = null;

    public void addTableName(String tableName) {
        if (!getTableNames().contains(tableName)) {
            getTableNames().add(tableName);
        }
    }

    protected List<String> getTableNames() {
        if (tableNames == null) {
            tableNames = new LinkedList<String>();
        }
        return tableNames;
    }

    public abstract String makeStatement();

    protected void preCheck(){
        if (getTableNames().isEmpty()) {
            throw new RuntimeException("Can't make statement without tablename");
        }
    }

    protected String tableList() {
        return makeList(tableNames.iterator());
    }

    protected String makeList(Iterator iterator) {
        return makeList(iterator, ", ");
    }

    protected String makeList(Iterator iterator, String separator) {
        StringBuilder list = new StringBuilder();

        for (int i = 0; iterator.hasNext(); i++) {
            if (i > 0) {
                list.append(separator);
            }
            list.append("\n\t").append(iterator.next());
        }
        return list.toString();
    }
}


text:
typedef NS_ENUM(NSUInteger, IMPopInAnimatedTransitionDirection) {
    IMPopInAnimatedTransitionDirectionLeft,
    IMPopInAnimatedTransitionDirectionRight,
    IMPopInAnimatedTransitionDirectionUp,
    IMPopInAnimatedTransitionDirectionDown
};

@interface IMPopInAnimatedTransition : NSObject <UIViewControllerAnimatedTransitioning>

@property(nonatomic) IMPopInAnimatedTransitionDirection transitionDirection;

@end


text:
<?php

namespace Greg\Support\Validation;

use Greg\Support\DateTime;

class DateTimeFromValidator implements ValidatorStrategy
{
    protected $from = null;

    protected $includeFrom = true;

    public function __construct($from, $includeFrom = null)
    {
        $this->setFrom($from);

        if ($includeFrom !== null) {
            $this->includeFrom($includeFrom);
        }

        return $this;
    }

    public function validate($value, array $values = [])
    {
        if (!$value) {
            return [];
        }

        $value = DateTime::timestamp($value);

        $from = DateTime::timestamp($this->getFrom());

        if ($this->includeFrom() ? $value < $from : $value <= $from) {
            return ['DateTimeFromError' => 'Value should be greater than ' . DateTime::dateTimeString($from) . '.'];
        }

        return [];
    }

    public function setFrom($datetime)
    {
        $this->from = (string) $datetime;

        return $this;
    }

    public function getFrom()
    {
        return $this->from;
    }

    public function includeFrom($value = null)
    {
        if (func_num_args()) {
            $this->includeFrom = (bool) $value;

            return $this;
        }

        return $this->includeFrom;
    }
}


text:
package com.microsoft.recognizers.text.number.french.extractors;

import com.microsoft.recognizers.text.number.Constants;
import com.microsoft.recognizers.text.number.extractors.BaseNumberExtractor;
import com.microsoft.recognizers.text.number.resources.FrenchNumeric;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;

public class FractionExtractor extends BaseNumberExtractor {
    private final Map<Pattern, String> regexes;

    @Override
    protected Map<Pattern, String> getRegexes() {
        return this.regexes;
    }

    @Override
    protected String getExtractType() {
        return Constants.SYS_NUM_FRACTION;
    }

    public FractionExtractor() {
        HashMap<Pattern, String> builder = new HashMap<>();
        builder.put(Pattern.compile(FrenchNumeric.FractionNotationWithSpacesRegex, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CHARACTER_CLASS), "FracNum");
        builder.put(Pattern.compile(FrenchNumeric.FractionNotationRegex, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CHARACTER_CLASS), "FracNum");
        builder.put(Pattern.compile(FrenchNumeric.FractionNounRegex, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CHARACTER_CLASS), "FracFr");
        builder.put(Pattern.compile(FrenchNumeric.FractionNounWithArticleRegex, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CHARACTER_CLASS), "FracFr");
        builder.put(Pattern.compile(FrenchNumeric.FractionPrepositionRegex, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CHARACTER_CLASS), "FracFr");
        this.regexes = Collections.unmodifiableMap(builder);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2016 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<vector
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:name="major_c_b"
    android:width="16dp"
    android:viewportWidth="16"
    android:height="8dp"
    android:viewportHeight="8" >
    <group
        android:name="dot_01"
        android:translateX="12.75"
        android:translateY="4" >
        <group
            android:name="dot_group" >
            <path
                android:name="dot"
                android:fillColor="#FFFFFFFF"
                android:pathData="M 0.0,-2.75 l 0.0,0.0 c 1.51878306195,0.0 2.75,1.23121693805 2.75,2.75 l 0.0,0.0 c 0.0,1.51878306195 -1.23121693805,2.75 -2.75,2.75 l 0.0,0.0 c -1.51878306195,0.0 -2.75,-1.23121693805 -2.75,-2.75 l 0.0,0.0 c 0.0,-1.51878306195 1.23121693805,-2.75 2.75,-2.75 Z" />
        </group>
    </group>
</vector>


text:
package ruleguard

import (
	"go/ast"
	"go/constant"
	"go/token"
	"go/types"
	"path/filepath"

	"github.com/quasilyte/gogrep"
	"github.com/quasilyte/gogrep/nodetag"
	"golang.org/x/tools/go/ast/astutil"

	"github.com/quasilyte/go-ruleguard/internal/xtypes"
	"github.com/quasilyte/go-ruleguard/ruleguard/quasigo"
	"github.com/quasilyte/go-ruleguard/ruleguard/textmatch"
	"github.com/quasilyte/go-ruleguard/ruleguard/typematch"
)

const filterSuccess = matchFilterResult("")

func filterFailure(reason string) matchFilterResult {
	return matchFilterResult(reason)
}

func exprListFilterApply(src string, list gogrep.ExprSlice, fn func(ast.Expr) bool) matchFilterResult {
	for i := 0; i < list.Len(); i++ {
		if !fn(list.At(i).(ast.Expr)) {
			return filterFailure(src)
		}
	}
	return filterSuccess
}

func makeNotFilter(src string, x matchFilter) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if x.fn(params).Matched() {
			return matchFilterResult(src)
		}
		return ""
	}
}

func makeAndFilter(lhs, rhs matchFilter) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if lhsResult := lhs.fn(params); !lhsResult.Matched() {
			return lhsResult
		}
		return rhs.fn(params)
	}
}

func makeOrFilter(lhs, rhs matchFilter) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if lhsResult := lhs.fn(params); lhsResult.Matched() {
			return filterSuccess
		}
		return rhs.fn(params)
	}
}

func makeDeadcodeFilter(src string) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if params.deadcode {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeFileImportsFilter(src, pkgPath string) filterFunc {
	return func(params *filterParams) matchFilterResult {
		_, imported := params.imports[pkgPath]
		if imported {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeFilePkgPathMatchesFilter(src string, re textmatch.Pattern) filterFunc {
	return func(params *filterParams) matchFilterResult {
		pkgPath := params.ctx.Pkg.Path()
		if re.MatchString(pkgPath) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeFileNameMatchesFilter(src string, re textmatch.Pattern) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if re.MatchString(filepath.Base(params.filename)) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makePureFilter(src, varname string) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if list, ok := params.subNode(varname).(gogrep.ExprSlice); ok {
			return exprListFilterApply(src, list, func(x ast.Expr) bool {
				return isPure(params.ctx.Types, x)
			})
		}

		n := params.subExpr(varname)
		if isPure(params.ctx.Types, n) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeConstFilter(src, varname string) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if list, ok := params.subNode(varname).(gogrep.ExprSlice); ok {
			return exprListFilterApply(src, list, func(x ast.Expr) bool {
				return isConstant(params.ctx.Types, x)
			})
		}

		n := params.subExpr(varname)
		if isConstant(params.ctx.Types, n) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeConstSliceFilter(src, varname string) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if list, ok := params.subNode(varname).(gogrep.ExprSlice); ok {
			return exprListFilterApply(src, list, func(x ast.Expr) bool {
				return isConstantSlice(params.ctx.Types, x)
			})
		}

		n := params.subExpr(varname)
		if isConstantSlice(params.ctx.Types, n) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeAddressableFilter(src, varname string) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if list, ok := params.subNode(varname).(gogrep.ExprSlice); ok {
			return exprListFilterApply(src, list, func(x ast.Expr) bool {
				return isAddressable(params.ctx.Types, x)
			})
		}

		n := params.subExpr(varname)
		if isAddressable(params.ctx.Types, n) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeComparableFilter(src, varname string) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if list, ok := params.subNode(varname).(gogrep.ExprSlice); ok {
			return exprListFilterApply(src, list, func(x ast.Expr) bool {
				return types.Comparable(params.typeofNode(x))
			})
		}

		if types.Comparable(params.typeofNode(params.subNode(varname))) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeVarContainsFilter(src, varname string, pat *gogrep.Pattern) filterFunc {
	return func(params *filterParams) matchFilterResult {
		params.gogrepSubState.CapturePreset = params.match.CaptureList()
		matched := false
		gogrep.Walk(params.subNode(varname), func(n ast.Node) bool {
			if matched {
				return false
			}
			pat.MatchNode(params.gogrepSubState, n, func(m gogrep.MatchData) {
				matched = true
			})
			return true
		})
		if matched {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeCustomVarFilter(src, varname string, fn *quasigo.Func) filterFunc {
	return func(params *filterParams) matchFilterResult {
		// TODO(quasilyte): what if bytecode function panics due to the programming error?
		// We should probably catch the panic here, print trace and return "false"
		// from the filter (or even propagate that panic to let it crash).
		params.varname = varname
		result := quasigo.Call(params.env, fn)
		if result.Value().(bool) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeTypeImplementsFilter(src, varname string, iface *types.Interface) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if list, ok := params.subNode(varname).(gogrep.ExprSlice); ok {
			return exprListFilterApply(src, list, func(x ast.Expr) bool {
				return xtypes.Implements(params.typeofNode(x), iface)
			})
		}

		typ := params.typeofNode(params.subExpr(varname))
		if xtypes.Implements(typ, iface) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeTypeHasMethodFilter(src, varname string, fn *types.Func) filterFunc {
	return func(params *filterParams) matchFilterResult {
		typ := params.typeofNode(params.subNode(varname))
		if typeHasMethod(typ, fn) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeTypeHasPointersFilter(src, varname string) filterFunc {
	return func(params *filterParams) matchFilterResult {
		typ := params.typeofNode(params.subExpr(varname))
		if typeHasPointers(typ) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeTypeIsIntUintFilter(src, varname string, underlying bool, kind types.BasicKind) filterFunc {
	return func(params *filterParams) matchFilterResult {
		typ := params.typeofNode(params.subExpr(varname))
		if underlying {
			typ = typ.Underlying()
		}
		if basicType, ok := typ.(*types.Basic); ok {
			first := kind
			last := kind + 4
			if basicType.Kind() >= first && basicType.Kind() <= last {
				return filterSuccess
			}
		}
		return filterFailure(src)
	}
}

func makeTypeIsSignedFilter(src, varname string, underlying bool) filterFunc {
	return func(params *filterParams) matchFilterResult {
		typ := params.typeofNode(params.subExpr(varname))
		if underlying {
			typ = typ.Underlying()
		}
		if basicType, ok := typ.(*types.Basic); ok {
			if basicType.Info()&types.IsInteger != 0 && basicType.Info()&types.IsUnsigned == 0 {
				return filterSuccess
			}
		}
		return filterFailure(src)
	}
}

func makeTypeOfKindFilter(src, varname string, underlying bool, kind types.BasicInfo) filterFunc {
	return func(params *filterParams) matchFilterResult {
		typ := params.typeofNode(params.subExpr(varname))
		if underlying {
			typ = typ.Underlying()
		}
		if basicType, ok := typ.(*types.Basic); ok {
			if basicType.Info()&kind != 0 {
				return filterSuccess
			}
		}
		return filterFailure(src)
	}
}

func makeTypesIdenticalFilter(src, lhsVarname, rhsVarname string) filterFunc {
	return func(params *filterParams) matchFilterResult {
		lhsType := params.typeofNode(params.subNode(lhsVarname))
		rhsType := params.typeofNode(params.subNode(rhsVarname))
		if xtypes.Identical(lhsType, rhsType) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeRootSinkTypeIsFilter(src string, pat *typematch.Pattern) filterFunc {
	return func(params *filterParams) matchFilterResult {
		// TODO(quasilyte): add variadic support?
		e, ok := params.match.Node().(ast.Expr)
		if ok {
			parent, kv := findSinkRoot(params)
			typ := findSinkType(params, parent, kv, e)
			if pat.MatchIdentical(params.typematchState, typ) {
				return filterSuccess
			}
		}
		return filterFailure(src)
	}
}

func makeTypeIsFilter(src, varname string, underlying bool, pat *typematch.Pattern) filterFunc {
	if underlying {
		return func(params *filterParams) matchFilterResult {
			if list, ok := params.subNode(varname).(gogrep.ExprSlice); ok {
				return exprListFilterApply(src, list, func(x ast.Expr) bool {
					return pat.MatchIdentical(params.typematchState, params.typeofNode(x).Underlying())
				})
			}
			typ := params.typeofNode(params.subNode(varname)).Underlying()
			if pat.MatchIdentical(params.typematchState, typ) {
				return filterSuccess
			}
			return filterFailure(src)
		}
	}

	return func(params *filterParams) matchFilterResult {
		if list, ok := params.subNode(varname).(gogrep.ExprSlice); ok {
			return exprListFilterApply(src, list, func(x ast.Expr) bool {
				return pat.MatchIdentical(params.typematchState, params.typeofNode(x))
			})
		}
		typ := params.typeofNode(params.subNode(varname))
		if pat.MatchIdentical(params.typematchState, typ) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeTypeConvertibleToFilter(src, varname string, dstType types.Type) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if list, ok := params.subNode(varname).(gogrep.ExprSlice); ok {
			return exprListFilterApply(src, list, func(x ast.Expr) bool {
				return types.ConvertibleTo(params.typeofNode(x), dstType)
			})
		}

		typ := params.typeofNode(params.subExpr(varname))
		if types.ConvertibleTo(typ, dstType) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeTypeAssignableToFilter(src, varname string, dstType types.Type) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if list, ok := params.subNode(varname).(gogrep.ExprSlice); ok {
			return exprListFilterApply(src, list, func(x ast.Expr) bool {
				return types.AssignableTo(params.typeofNode(x), dstType)
			})
		}

		typ := params.typeofNode(params.subExpr(varname))
		if types.AssignableTo(typ, dstType) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeLineFilter(src, varname string, op token.Token, rhsVarname string) filterFunc {
	// TODO(quasilyte): add variadic support.
	return func(params *filterParams) matchFilterResult {
		line1 := params.ctx.Fset.Position(params.subNode(varname).Pos()).Line
		line2 := params.ctx.Fset.Position(params.subNode(rhsVarname).Pos()).Line
		lhsValue := constant.MakeInt64(int64(line1))
		rhsValue := constant.MakeInt64(int64(line2))
		if constant.Compare(lhsValue, op, rhsValue) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeObjectIsGlobalFilter(src, varname string) filterFunc {
	return func(params *filterParams) matchFilterResult {
		obj := params.ctx.Types.ObjectOf(identOf(params.subExpr(varname)))
		globalScope := params.ctx.Pkg.Scope()
		if obj.Parent() == globalScope {
			return filterSuccess
		}

		return filterFailure(src)
	}
}

func makeGoVersionFilter(src string, op token.Token, version GoVersion) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if params.ctx.GoVersion.IsAny() {
			return filterSuccess
		}
		if versionCompare(params.ctx.GoVersion, op, version) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeLineConstFilter(src, varname string, op token.Token, rhsValue constant.Value) filterFunc {
	// TODO(quasilyte): add variadic support.
	return func(params *filterParams) matchFilterResult {
		n := params.subNode(varname)
		lhsValue := constant.MakeInt64(int64(params.ctx.Fset.Position(n.Pos()).Line))
		if constant.Compare(lhsValue, op, rhsValue) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeTypeSizeConstFilter(src, varname string, op token.Token, rhsValue constant.Value) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if list, ok := params.subNode(varname).(gogrep.ExprSlice); ok {
			return exprListFilterApply(src, list, func(x ast.Expr) bool {
				typ := params.typeofNode(x)
				lhsValue := constant.MakeInt64(params.ctx.Sizes.Sizeof(typ))
				return constant.Compare(lhsValue, op, rhsValue)
			})
		}

		typ := params.typeofNode(params.subExpr(varname))
		lhsValue := constant.MakeInt64(params.ctx.Sizes.Sizeof(typ))
		if constant.Compare(lhsValue, op, rhsValue) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeTypeSizeFilter(src, varname string, op token.Token, rhsVarname string) filterFunc {
	return func(params *filterParams) matchFilterResult {
		lhsTyp := params.typeofNode(params.subExpr(varname))
		lhsValue := constant.MakeInt64(params.ctx.Sizes.Sizeof(lhsTyp))
		rhsTyp := params.typeofNode(params.subExpr(rhsVarname))
		rhsValue := constant.MakeInt64(params.ctx.Sizes.Sizeof(rhsTyp))
		if constant.Compare(lhsValue, op, rhsValue) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeValueIntConstFilter(src, varname string, op token.Token, rhsValue constant.Value) filterFunc {
	return func(params *filterParams) matchFilterResult {
		if list, ok := params.subNode(varname).(gogrep.ExprSlice); ok {
			return exprListFilterApply(src, list, func(x ast.Expr) bool {
				lhsValue := intValueOf(params.ctx.Types, x)
				return lhsValue != nil && constant.Compare(lhsValue, op, rhsValue)
			})
		}

		lhsValue := intValueOf(params.ctx.Types, params.subExpr(varname))
		if lhsValue == nil {
			return filterFailure(src) // The value is unknown
		}
		if constant.Compare(lhsValue, op, rhsValue) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeValueIntFilter(src, varname string, op token.Token, rhsVarname string) filterFunc {
	// TODO(quasilyte): add variadic support.
	return func(params *filterParams) matchFilterResult {
		lhsValue := intValueOf(params.ctx.Types, params.subExpr(varname))
		if lhsValue == nil {
			return filterFailure(src)
		}
		rhsValue := intValueOf(params.ctx.Types, params.subExpr(rhsVarname))
		if rhsValue == nil {
			return filterFailure(src)
		}
		if constant.Compare(lhsValue, op, rhsValue) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeTextConstFilter(src, varname string, op token.Token, rhsValue constant.Value) filterFunc {
	// TODO(quasilyte): add variadic support.
	return func(params *filterParams) matchFilterResult {
		s := params.nodeText(params.subNode(varname))
		lhsValue := constant.MakeString(string(s))
		if constant.Compare(lhsValue, op, rhsValue) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeTextFilter(src, varname string, op token.Token, rhsVarname string) filterFunc {
	// TODO(quasilyte): add variadic support.
	return func(params *filterParams) matchFilterResult {
		s1 := params.nodeText(params.subNode(varname))
		lhsValue := constant.MakeString(string(s1))
		n, _ := params.match.CapturedByName(rhsVarname)
		s2 := params.nodeText(n)
		rhsValue := constant.MakeString(string(s2))
		if constant.Compare(lhsValue, op, rhsValue) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeTextMatchesFilter(src, varname string, re textmatch.Pattern) filterFunc {
	// TODO(quasilyte): add variadic support.
	return func(params *filterParams) matchFilterResult {
		if re.Match(params.nodeText(params.subNode(varname))) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeRootParentNodeIsFilter(src string, tag nodetag.Value) filterFunc {
	return func(params *filterParams) matchFilterResult {
		parent := params.nodePath.Parent()
		if nodeIs(parent, tag) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeNodeIsFilter(src, varname string, tag nodetag.Value) filterFunc {
	// TODO(quasilyte): add comment nodes support?
	// TODO(quasilyte): add variadic support.
	return func(params *filterParams) matchFilterResult {
		n := params.subNode(varname)
		if nodeIs(n, tag) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func makeObjectIsFilter(src, varname, objectName string) filterFunc {
	var predicate func(types.Object) bool
	switch objectName {
	case "Func":
		predicate = func(x types.Object) bool {
			_, ok := x.(*types.Func)
			return ok
		}
	case "Var":
		predicate = func(x types.Object) bool {
			_, ok := x.(*types.Var)
			return ok
		}
	case "Const":
		predicate = func(x types.Object) bool {
			_, ok := x.(*types.Const)
			return ok
		}
	case "TypeName":
		predicate = func(x types.Object) bool {
			_, ok := x.(*types.TypeName)
			return ok
		}
	case "Label":
		predicate = func(x types.Object) bool {
			_, ok := x.(*types.Label)
			return ok
		}
	case "PkgName":
		predicate = func(x types.Object) bool {
			_, ok := x.(*types.PkgName)
			return ok
		}
	case "Builtin":
		predicate = func(x types.Object) bool {
			_, ok := x.(*types.Builtin)
			return ok
		}
	case "Nil":
		predicate = func(x types.Object) bool {
			_, ok := x.(*types.Nil)
			return ok
		}
	}

	return func(params *filterParams) matchFilterResult {
		if list, ok := params.subNode(varname).(gogrep.ExprSlice); ok {
			return exprListFilterApply(src, list, func(x ast.Expr) bool {
				ident := identOf(x)
				return ident != nil && predicate(params.ctx.Types.ObjectOf(ident))
			})
		}

		ident := identOf(params.subExpr(varname))
		if ident == nil {
			return filterFailure(src)
		}
		object := params.ctx.Types.ObjectOf(ident)
		if predicate(object) {
			return filterSuccess
		}
		return filterFailure(src)
	}
}

func nodeIs(n ast.Node, tag nodetag.Value) bool {
	var matched bool
	switch tag {
	case nodetag.Expr:
		_, matched = n.(ast.Expr)
	case nodetag.Stmt:
		_, matched = n.(ast.Stmt)
	case nodetag.Node:
		matched = true
	default:
		matched = (tag == nodetag.FromNode(n))
	}
	return matched
}

func typeHasMethod(typ types.Type, fn *types.Func) bool {
	obj, _, _ := types.LookupFieldOrMethod(typ, true, fn.Pkg(), fn.Name())
	fn2, ok := obj.(*types.Func)
	if !ok {
		return false
	}
	return xtypes.Identical(fn.Type(), fn2.Type())
}

func typeHasPointers(typ types.Type) bool {
	switch typ := typ.(type) {
	case *types.Basic:
		switch typ.Kind() {
		case types.UnsafePointer, types.String, types.UntypedNil, types.UntypedString:
			return true
		}
		return false

	case *types.Named:
		return typeHasPointers(typ.Underlying())

	case *types.Struct:
		for i := 0; i < typ.NumFields(); i++ {
			if typeHasPointers(typ.Field(i).Type()) {
				return true
			}
		}
		return false

	case *types.Array:
		return typeHasPointers(typ.Elem())

	default:
		return true
	}
}

func findSinkRoot(params *filterParams) (ast.Node, *ast.KeyValueExpr) {
	for i := 1; i < params.nodePath.Len(); i++ {
		switch n := params.nodePath.NthParent(i).(type) {
		case *ast.ParenExpr:
			// Skip and continue.
			continue
		case *ast.KeyValueExpr:
			return params.nodePath.NthParent(i + 1).(ast.Expr), n
		default:
			return n, nil
		}
	}
	return nil, nil
}

func findContainingFunc(params *filterParams) *types.Signature {
	for i := 2; i < params.nodePath.Len(); i++ {
		switch n := params.nodePath.NthParent(i).(type) {
		case *ast.FuncDecl:
			fn, ok := params.ctx.Types.TypeOf(n.Name).(*types.Signature)
			if ok {
				return fn
			}
		case *ast.FuncLit:
			fn, ok := params.ctx.Types.TypeOf(n.Type).(*types.Signature)
			if ok {
				return fn
			}
		}
	}
	return nil
}

func findSinkType(params *filterParams, parent ast.Node, kv *ast.KeyValueExpr, e ast.Expr) types.Type {
	switch parent := parent.(type) {
	case *ast.ValueSpec:
		return params.ctx.Types.TypeOf(parent.Type)

	case *ast.ReturnStmt:
		for i, result := range parent.Results {
			if astutil.Unparen(result) != e {
				continue
			}
			sig := findContainingFunc(params)
			if sig == nil {
				break
			}
			return sig.Results().At(i).Type()
		}

	case *ast.IndexExpr:
		if astutil.Unparen(parent.Index) == e {
			switch typ := params.ctx.Types.TypeOf(parent.X).Underlying().(type) {
			case *types.Map:
				return typ.Key()
			case *types.Slice, *types.Array:
				return nil // TODO: some untyped int type?
			}
		}

	case *ast.AssignStmt:
		if parent.Tok != token.ASSIGN || len(parent.Lhs) != len(parent.Rhs) {
			break
		}
		for i, rhs := range parent.Rhs {
			if rhs == e {
				return params.ctx.Types.TypeOf(parent.Lhs[i])
			}
		}

	case *ast.CompositeLit:
		switch typ := params.ctx.Types.TypeOf(parent).Underlying().(type) {
		case *types.Slice:
			return typ.Elem()
		case *types.Array:
			return typ.Elem()
		case *types.Map:
			if astutil.Unparen(kv.Key) == e {
				return typ.Key()
			}
			return typ.Elem()
		case *types.Struct:
			fieldName, ok := kv.Key.(*ast.Ident)
			if !ok {
				break
			}
			for i := 0; i < typ.NumFields(); i++ {
				field := typ.Field(i)
				if field.Name() == fieldName.String() {
					return field.Type()
				}
			}
		}

	case *ast.CallExpr:
		switch typ := params.ctx.Types.TypeOf(parent.Fun).(type) {
		case *types.Signature:
			// A function call argument.
			for i, arg := range parent.Args {
				if astutil.Unparen(arg) != e {
					continue
				}
				isVariadicArg := (i >= typ.Params().Len()-1) && typ.Variadic()
				if isVariadicArg && !parent.Ellipsis.IsValid() {
					return typ.Params().At(typ.Params().Len() - 1).Type().(*types.Slice).Elem()
				}
				if i < typ.Params().Len() {
					return typ.Params().At(i).Type()
				}
				break
			}
		default:
			// Probably a type cast.
			return typ
		}
	}

	return invalidType
}


text:
<assembly
	xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
	<id>make-zip</id>
	<formats>
		<format>zip</format>
	</formats>
	<includeBaseDirectory>false</includeBaseDirectory>
	<files>
		<file>
			<source>${project.build.directory}/${project.artifactId}-${project.version}-jar-with-dependencies.jar</source>
			<outputDirectory>${project.artifactId}-${project.version}</outputDirectory>
			<destName>daris-femur-upload.jar</destName>
		</file>
	</files>
</assembly>


text:
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
    sudo apt-get -qq -y install build-essential software-properties-common zlib1g-dev
#    sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
	sudo add-apt-repository -y ppa:jonathonf/gcc
    sudo apt-get -qq update -y
    sudo apt-get -qq install gcc-7 g++-7 subversion make cmake python libtool zlib1g zlib1g-dev -y
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7
    sudo update-alternatives --config gcc
    sudo apt-get -qq -y install cppcheck
    sudo apt-get -y -qq install
    wget --no-check-certificate -q ${SDE_URL} -O sdetool.tar.bz2; tar -jxf sdetool.tar.bz2
fi


text:
[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)

[(demo)](http://jam3.github.io/touch-scroll-physics) - [(source)](test.js)

Physics for a touch-based scroll panel. Assumes a single dimension but could easily be extended to two or more.

Works best with scroll panes that have a fixed bounding region and need to "bounce" on either end. Can also "dip" into the cell edges (for example: carousels, list views, grids).

Makes no assumptions about the method of input or render engine (Canvas/DOM/WebGL/etc) but works well alongside [touches](https://github.com/Jam3/touches). Simple example:

```js
var scroller = require('touch-scroll-physics')({
    cellSize: 100,   //size of the content
    viewSize: 400    //size of the viewport / clip region
})

//tick the scroller
function render(dt) {
    scroller.update(dt)
}

//and hook up mouse to scroller start(x) / move(x) / end(x)
```

See [test.js](test.js) for a more complete example with cells.

## Demo

Run the demo [here](http://jam3.github.io/touch-scroll-physics) or build it yourself like so:

```sh
git clone https://github.com/Jam3/touch-scroll-physics.git
cd touch-scroll-physics
npm install
npm start
```

Then open `localhost:9966`. You can enter `npm run build` to build the distribution bundle.

## Usage

[![NPM](https://nodei.co/npm/touch-scroll-physics.png)](https://www.npmjs.com/package/touch-scroll-physics)

#### `scroller = ScrollPhysics([opt])`

Creates a new scroller with the given options.

- `cellSize` the size of each cell (default zero)
- `viewSize` the size of your viewport (default zero)
- `totalCells` total number of cells (default 1)
- `gutterSize` the size of the gutter (default 1/4 of viewSize)
- `dipToClosestCell` whether to smoothly snap to the edge of each cell (default false)

In the case of arbitrary scrolling (no "pages") you will typically just use a `totalCells` of 1 with the content size for `cellSize`.

#### `scroller.start(value)`

Called to initiate a scroll event with the given value (e.g. X mouse position).

#### `scroller.move(value)`

Called to signal a move event (e.g. mouse move X).

#### `scroller.end()`

Called to end the scroll state (e.g. mouse up).

#### `scroller.value`

The value of the scroller. Typically when rendering you would translate content by the negative of this.

#### `scroller.momentum`

The current momentum for the scroller. May be useful for triggering events on swipe.

## License

MIT, see [LICENSE.md](http://github.com/Jam3/touch-scroll-physics/blob/master/LICENSE.md) for details.


text:
YASSGen is Yet Another Static Site Generator

## Features

- Copies assets to the build folder
- Generates the blog with index and post templates
- Builds SASS to CSS and includes the CSS in the HTML files
- Parses metadata from Markdown files
- Converts Markdown to HTML and includes it in the HTML files
- Generates the navigation to the main page
- Automatically watches changes and updates the build accordingly

## Installing

1. Install [Node](http://nodejs.org/)
2. Install gulp.js client and development dependencies of the build tool by running these commands in this project's directory:

```sh
    npm install -g gulp-cli
    npm install
```

## Directory structure

The default directory structure that the build tool uses:

    assets/
      *.html
      *.png
      *.js
    build/
      <build result>
    src/
      posts/
        *.md
      views/
        index.html
        *.html
    styles/
      index.scss
      *.scss
    gulpfile.js
    package.json

This is easy to change by modifying the config object from gulpfile.js.

## Building

Here are the main commands to use when building the website. More can be found from gulpfile.js.

```sh
    gulp          - runs the default build command
    gulp clean    - removes the build folder
    gulp watch    - runs a webserver for static content on http://localhost:3000
```


text:
ScrollPagination
================

[React](http://reactjs.org/) component for handing infinite scroll without infinitely growing the DOM.

## Usage

```javascript
var Page = ScrollPagination.Page;
var manager = new ScrollPagination.Manager();
```
```
/** @jsx React.DOM */
<ScrollPagination
	manager={ manager }
	hasPrevPage={ Boolean() }
	hasNextPage={ Boolean() }
	loadPrevPage={ function(){} }
	loadNextPage={ function(){} }
	unloadPage={ function (pageId) {} }>

	<Page id="page-1" manager={ manager }>
		<h1>Render first page of content here</h1>
	</Page>

	<Page id="page-2" manager={ manager }>
		<h1>Render second page of content here</h1>
	</Page>
</ScrollPagination>
```

```javascript
var Page = ScrollPagination.Page;
var manager = new ScrollPagination.Manager();

React.createElement(ScrollPagination, {
	manager: manager,
	hasPrevPage: Boolean(),
	hasNextPage: Boolean(),
	loadPrevPage: function(){},
	loadNextPage: function(){},
},
	React.createElement(Page, {
		id: "page-1",
		manager: manager },
			React.createElement('h1', null, "Render first page of content here")),
	React.createElement(Page, {
		id: "page-2",
		manager: manager },
			React.createElement('h1', null, "Render second page of content here")))
```

**ScrollPagination:**

- `manager` must be an instance of `ScrollPagination.Manager`.

- `hasPrevPage` must be a boolean indicating if `loadPrevPage` should be called.

- `hasNextPage` must be a boolean indicating if `loadNextPage` should be called.

- `loadPrevPage` must be a function that causes a re-render with a single page prepended.

- `loadNextPage` must be a function that causes a re-render with a single page appended.

- `unloadPage` must be a function that causes a re-render with the specified page id removed.

**ScrollPagination.Page:**

- `manager` must be an instance of `ScrollPagination.Manager` and the same one passed to the `ScrollPagination` component.

- `id` must be the id of the page (used for `unloadPage`).

- `component` must be a component, defaults to `React.DOM.li`.

## What it does

The scroll container will be determined when the component is first mounted (any parent element with `overflow:auto` or `overflow:scroll`, defaults to `window`).

`loadPrevPage` and `loadNextPage` are called when there is one thrid or less of the current page height out of view above and below respectively.

`unloadPage` is called before `loadPrevPage` or `loadNextPage` if there is a page at the opposite end of the visible area entirely out of view.

Each page calculates it's own height and reports it to the `ScrollPagination` instance via the `ScrollPagination.Manager`. The `ScrollPagination` instance keeps track of what pages are added or removed from the top and adjusts the scroll position.

## Why

Infinite scroll implementations where DOM nodes are continually added without cleaning up cause the DOM to get __very__ slow the farther you scroll down (especially when you have any kind of dynamic content). Removing what you don't need from the DOM allows scrolling through pages without slowing down the DOM.

## How you can help

File an [issue](https://github.com/cupcake/react-scroll-pagination/issues) if you find anything isn't working as expected.

Pull requests are always welcome, but you should open an issue before working on a new feature (both to ensure it's within the scope of this project and that it's not already being worked on).


text:
set msBuildDir=%WINDIR%\Microsoft.NET\Framework\v4.0.30319
call %MSBuildDir%\msbuild WinFormsUI.Docking.vs2010.sln /t:build /p:Configuration=Release /p:TargetFrameworkVersion=v4.0 /p:OutputPath=..\bin\net40\
@IF %ERRORLEVEL% NEQ 0 PAUSE