text:
"""Supports webkitpy logging."""

# FIXME: Move this file to webkitpy/python24 since logging needs to
#        be configured prior to running version-checking code.

import logging
import os
import sys

import webkitpy

_log = logging.getLogger(__name__)

# We set these directory paths lazily in get_logger() below.
_scripts_dir = ""
"""The normalized, absolute path to the ...Scripts directory."""

_webkitpy_dir = ""
"""The normalized, absolute path to the ...Scripts/webkitpy directory."""

def _normalize_path(path):
    """Return the given path normalized.

    Converts a path to an absolute path, removes any trailing slashes,
    removes any extension, and lower-cases it.

    """
    path = os.path.abspath(path)
    path = os.path.normpath(path)
    path = os.path.splitext(path)[0]  # Remove the extension, if any.
    path = path.lower()

    return path

# Observe that the implementation of this function does not require
# the use of any hard-coded strings like "webkitpy", etc.
#
# The main benefit this function has over using--
#
# _log = logging.getLogger(__name__)
#
# is that get_logger() returns the same value even if __name__ is
# "__main__" -- i.e. even if the module is the script being executed
# from the command-line.
def get_logger(path):
    """Return a logging.logger for the given path.

    Returns:
      A logger whose name is the name of the module corresponding to
      the given path.  If the module is in webkitpy, the name is
      the fully-qualified dotted module name beginning with webkitpy....
      Otherwise, the name is the base name of the module (i.e. without
      any dotted module name prefix).

    Args:
      path: The path of the module.  Normally, this parameter should be
            the __file__ variable of the module.

    Sample usage:

      from webkitpy.common.system import logutils

      _log = logutils.get_logger(__file__)

    """
    # Since we assign to _scripts_dir and _webkitpy_dir in this function,
    # we need to declare them global.
    global _scripts_dir
    global _webkitpy_dir

    path = _normalize_path(path)

    # Lazily evaluate _webkitpy_dir and _scripts_dir.
    if not _scripts_dir:
        # The normalized, absolute path to ...Scripts/webkitpy/__init__.
        webkitpy_path = _normalize_path(webkitpy.__file__)

        _webkitpy_dir = os.path.split(webkitpy_path)[0]
        _scripts_dir = os.path.split(_webkitpy_dir)[0]

    if path.startswith(_webkitpy_dir):
        # Remove the initial Scripts directory portion, so the path
        # starts with /webkitpy, for example "/webkitpy/init/logutils".
        path = path[len(_scripts_dir):]

        parts = []
        while True:
            (path, tail) = os.path.split(path)
            if not tail:
                break
            parts.insert(0, tail)

        logger_name = ".".join(parts)  # For example, webkitpy.common.system.logutils.
    else:
        # The path is outside of webkitpy.  Default to the basename
        # without the extension.
        basename = os.path.basename(path)
        logger_name = os.path.splitext(basename)[0]

    return logging.getLogger(logger_name)

def _default_handlers(stream, logging_level):
    """Return a list of the default logging handlers to use.

    Args:
      stream: See the configure_logging() docstring.

    """
    # Create the filter.
    def should_log(record):
        """Return whether a logging.LogRecord should be logged."""
        # FIXME: Enable the logging of autoinstall messages once
        #        autoinstall is adjusted.  Currently, autoinstall logs
        #        INFO messages when importing already-downloaded packages,
        #        which is too verbose.
        if record.name.startswith("webkitpy.thirdparty.autoinstall"):
            return False
        return True

    logging_filter = logging.Filter()
    logging_filter.filter = should_log

    # Create the handler.
    handler = logging.StreamHandler(stream)
    if logging_level == logging.DEBUG:
        formatter = logging.Formatter("%(name)s: [%(levelname)s] %(message)s")
    else:
        formatter = logging.Formatter("%(message)s")

    handler.setFormatter(formatter)
    handler.addFilter(logging_filter)

    return [handler]

def configure_logging(logging_level=None, logger=None, stream=None,
                      handlers=None):
    """Configure logging for standard purposes.

    Returns:
      A list of references to the logging handlers added to the root
      logger.  This allows the caller to later remove the handlers
      using logger.removeHandler.  This is useful primarily during unit
      testing where the caller may want to configure logging temporarily
      and then undo the configuring.

    Args:
      logging_level: The minimum logging level to log.  Defaults to
                     logging.INFO.
      logger: A logging.logger instance to configure.  This parameter
              should be used only in unit tests.  Defaults to the
              root logger.
      stream: A file-like object to which to log used in creating the default
              handlers.  The stream must define an "encoding" data attribute,
              or else logging raises an error.  Defaults to sys.stderr.
      handlers: A list of logging.Handler instances to add to the logger
                being configured.  If this parameter is provided, then the
                stream parameter is not used.

    """
    # If the stream does not define an "encoding" data attribute, the
    # logging module can throw an error like the following:
    #
    # Traceback (most recent call last):
    #   File "/System/Library/Frameworks/Python.framework/Versions/2.6/...
    #         lib/python2.6/logging/__init__.py", line 761, in emit
    #     self.stream.write(fs % msg.encode(self.stream.encoding))
    # LookupError: unknown encoding: unknown
    if logging_level is None:
        logging_level = logging.INFO
    if logger is None:
        logger = logging.getLogger()
    if stream is None:
        stream = sys.stderr
    if handlers is None:
        handlers = _default_handlers(stream, logging_level)

    logger.setLevel(logging_level)

    for handler in handlers:
        logger.addHandler(handler)

    _log.debug("Debug logging enabled.")

    return handlers


text:
{cyan}──────────────────────────────────────────────────────────────────────{/cyan}

## Description

We've learned how to get other peoples changes with git fetch. It's time to share with them your own work using `git push`. This command will send your changes to a Git server for others to see.

First things first, you won't be able to push to the remote you added previously. That is because `https://github.com/karumi/learnyougit` have restricted write access; only us, the karumies, can upload stuff there. In order to learn how the push command works and pass this lesson, you will need to fork that repository. In short, forking a repository means creating a copy of that repository under your control where you will have access to freely push your changes!

To fork a repository you can follow the official GitHub guide: `https://help.github.com/articles/fork-a-repo/`. Once you successfully forked the `learnyougit` repository, add it to your remotes with `git remote add my-fork git@github.com:{your-user}/learnyougit.git` and you are ready to go! Let's continue with the lesson.

There are several options to configure what changes you are going to upload but in general, you usually want to send a single branch. This can be done with the command `git push {remote-name} {branch-name}`. Try it now, once it finishes, you will see your branch and all its commits directly from GitHub. By default, Git will use the "smart" protocol to upload only the things that are not already uploaded.

Is this it? That's everything you need to know to push things? Well... it's not. If you are working completely alone in a project you probably won't need anything else, but, if you work with other people you will probably end up having conflicts with their work. What happens if Alice and Bob are working in the same branch and in the same file? Imagine Alice has pushed her changes to server and right after that, Bob wants to do the same. Git will warn him that it's not possible with a message like:

```
To git@github.com:Karumi/learnyougit.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:Karumi/learnyougit.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
```

In this situation, Bob will need to solve the conflicts in his computer (we will see how to do this in the following lesson) before retrying the push operation. There is another possibility, Bob can discard Alice work and upload only his changes with the `-f` or `--force` option. This option should be used carefully and only when you know that the commits you are discarding can be safely removed.

In the following lessons we will learn how to solve this kind of conflicts so that you don't have to discard others work.

{cyan}──────────────────────────────────────────────────────────────────────{/cyan}

## In-depth

When you push a branch, Git will compare which commits are already present in the remote and ignore them. There are two possibilities with the remaining commits:
* All new commits are on top of the remote branch history, meaning you can safely push everything to make new changes visible to everyone.

```
                 +---------------+
                 | REMOTE BRANCH |
                 +-------+-------+
                         |
                         V
+-----------+      +-----------+      +-----------+
| COMMIT #1 |<-----+ COMMIT #2 |<-----+ COMMIT #3 |
+-----------+      +-----------+      +-----------+
                                            A
                                            |
                                    +-------+------+
                                    | LOCAL BRANCH |
                                    +--------------+
```
{green}BEFORE PUSHING{/green}
{green}- - - - - - - - - - - - - - - - - - - - - - - - - - - -{/green}
{green}AFTER PUSHING{/green}
```
                                    +---------------+
                                    | REMOTE BRANCH |
                                    +-------+-------+
                                            |
                                            V
+-----------+      +-----------+      +-----------+
| COMMIT #1 |<-----+ COMMIT #2 |<-----+ COMMIT #3 |
+-----------+      +-----------+      +-----------+
                                            A
                                            |
                                    +-------+------+
                                    | LOCAL BRANCH |
                                    +--------------+
```
* Your local branch doesn't share all its history with the remote branch. That'd mean that your history diverges at some point from the one stored in server. Git will ask you to either solve the issue locally, respecting the server history, or to forget server's history and use yours instead.

```
                 +---------------+
                 | REMOTE BRANCH |
                 +-------+-------+
                         |
                         V
+-----------+      +-----------+
| COMMIT #1 |<--+--+ COMMIT #2 |
+-----------+   |  +-----------+
                |
                |  +-----------+
                +--+ COMMIT #4 |
                   +-----------+
                         A
                         |
                 +-------+------+
                 | LOCAL BRANCH |
                 +--------------+
```
{green}BEFORE PUSH --FORCE{/green}
{green}- - - - - - - - - - - - - - - - - - - - - - - - - - - -{/green}
{green}AFTER PUSH --FORCE{/green}
```
                 +---------------+
                 | REMOTE BRANCH |
                 +-------+-------+
                         |
                         V
+-----------+      +-----------+
| COMMIT #1 |<-----+ COMMIT #4 |
+-----------+      +-----------+
                         A
                         |
                 +-------+------+
                 | LOCAL BRANCH |
                 +--------------+
```

{cyan}──────────────────────────────────────────────────────────────────────{/cyan}

## Task

Push your changes to your own forked repository
```
git remote add my-fork {fork-url}
git push my-fork my-branch
```

{cyan}──────────────────────────────────────────────────────────────────────{/cyan}

redpajama_set_name: RedPajamaGithub


text:
<bill session="110" type="h" number="7327" updated="2009-01-09T07:52:45-05:00">
	<status><enacted date="1230008400" datetime="2008-12-23" /></status>

	<introduced date="1228885200" datetime="2008-12-10"/>
	<titles>
		<title type="short" as="introduced">Worker, Retiree, and Employer Recovery Act of 2008</title>
		<title type="official" as="introduced">To make technical corrections related to the Pension Protection Act of 2006, and for other purposes.</title>
	</titles>
	<sponsor id="400333"/>
	<cosponsors>
		<cosponsor id="400267" joined="2008-12-10"/>
		<cosponsor id="400261" joined="2008-12-10"/>
		<cosponsor id="400278" joined="2008-12-10"/>
	</cosponsors>
	<actions>
		<action date="1228885200" datetime="2008-12-10"><text>Referred to the Committee on Ways and Means, and in addition to the Committee on Education and Labor, for a period to be subsequently determined by the Speaker, in each case for consideration of such provisions as fall within the jurisdiction of the committee concerned.</text></action>
		<action date="1228885200" datetime="2008-12-10"><text>Referred to House Ways and Means</text></action>
		<action date="1228885200" datetime="2008-12-10"><text>Referred to House Education and Labor</text></action>
		<action date="1228956660" datetime="2008-12-10T20:51:00-05:00"><text>Committee on Ways and Means discharged.</text></action>
		<action date="1228956660" datetime="2008-12-10T20:51:00-05:00"><text>Committee on Education and Labor discharged.</text></action>
		<action date="1228956660" datetime="2008-12-10T20:51:00-05:00"><text>Mr. Pomeroy asked unanimous consent to discharge from committee and consider.</text></action>
		<action date="1228956660" datetime="2008-12-10T20:51:00-05:00"><text>Considered by unanimous consent.</text><reference label="consideration" ref="CR H10935-10943"/></action>
		<vote date="1228956660" how="without objection" datetime="2008-12-10T20:51:00-05:00" where="h" type="vote" result="pass" ><text>On passage Passed without objection.</text><reference label="text" ref="CR H10935-10943"/></vote>
		<vote date="1228971600" how="by Unanimous Consent" datetime="2008-12-11" where="s" type="vote2" result="pass" ><text>Received in the Senate, read twice, considered, read the third time, and passed without amendment by Unanimous Consent.</text><reference label="consideration" ref="CR S10914-10915"/></vote>
		<topresident date="1228971600" datetime="2008-12-11" ><text>Cleared for White House.</text></topresident>
		<action date="1229058000" datetime="2008-12-12"><text>Message on Senate action sent to the House.</text></action>
		<topresident date="1229490000" datetime="2008-12-17" ><text>Presented to President.</text></topresident>
		<signed date="1230008400" datetime="2008-12-23" ><text>Signed by President.</text></signed>
		<enacted number="110-458" date="1230008400" datetime="2008-12-23" type="public" ><text>Became Public Law No: 110-458.</text></enacted>
	</actions>
	<committees>

	</committees>
	<relatedbills>

	</relatedbills>
	<subjects>

	</subjects>
	<amendments>

	</amendments>
	<summary>

	</summary>
</bill>


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:layout_gravity="center">

    <LinearLayout
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:layout_width="0px"
        android:layout_height="0px" />

    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <EditText
            android:id="@+id/username"
            android:textSize="@dimen/text_size"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/username_hint"
            android:inputType="text"
            android:maxLines="1"/>

    </android.support.design.widget.TextInputLayout>

    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <EditText
            android:id="@+id/password"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="@dimen/text_size"
            android:hint="@string/password_hint"
            android:inputType="textPassword"
            android:maxLines="1"/>

    </android.support.design.widget.TextInputLayout>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/forgot_password"
        android:textSize="@dimen/text_size"
        android:text="@string/forgot_password"
        android:textColor="@color/colorCyan"
        android:gravity="center"
        android:onClick="goToResetFragment"/>

    <CheckBox android:id="@+id/remember_me"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="@dimen/text_size"
        android:text="@string/remember_me" />

    <Button
        android:textSize="@dimen/text_size"
        android:layout_width="match_parent"
        android:layout_height="@dimen/button_height"
        android:text="@string/login"
        android:id="@+id/login" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="@dimen/text_size"
        android:id="@+id/login_error_messages"/>

</LinearLayout>


text:
<!doctype html>

		<title>Zabuun - Learn Egyptian Arabic for English speakers</title>
		<meta name="description" content="">
		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/head.php';?>

		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/ie8.php';?>
		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/header.php';?>

			<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/side.php';?>

Essays > Airplanes Are Safer Than Cars

						Expand All | Collapse All

Airplanes Are Safer Than Cars

 Donald ignored his friend. He was going to drive for three days. Halfway through the trip, Donald got very sleepy. He was on a highway. He crashed into a giant trailer.

		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/footer.php';?>
		<?php include $_SERVER['DOCUMENT_ROOT'].'/layout/scripts.php';?>


text:
class Network
{
	int size, rank; // MPI related variables
	static const size_t bufSize;
	size_t restBufSizeSend;
	char *bufSend, *pSend;
	size_t restBufSizeRecv;
	char *bufRecv, *pRecv;
public:
	Network();
	~Network();

	int getSize() const;
	int getRank() const;

	void sendMotif(const int target, const Motif& m);
	bool readMotif(Motif& res, int& source);

	void sendCount(const int target, const std::pair<int, int>& c);
	bool readCount(std::pair<int, int>& res, int& source);
	void sendCountPos(const int target, const int c);
	bool readCountPos(int& res, int& source);
	void sendCountNeg(const int target, const int c);
	bool readCountNeg(int& res, int& source);

	void sendVecInt(const int target, const std::vector<int>& vec);
	bool readVecInt(std::vector<int>& res, int& source);

	void sendEnd(const int target);
	void sendEnd();

private:

public:
	static constexpr int TAG_END = 0;
	static constexpr int TAG_MOTIF = 1;
	static constexpr int TAG_COUNT_PAIR = 2;
	static constexpr int TAG_COUNT_POS = 3;
	static constexpr int TAG_COUNT_NEG = 4;
	static constexpr int TAG_VEC_INT = 5;

};


text:
<?php

namespace JanDolata\CrudeCRUD\Engine\CrudeSetupTrait;

trait ExtraColumn
{
    /**
     * Extra column
     *
     * @var array
     */
    protected $extraColumn = [];

    /**
     * Gets the Extra column.
     *
     * @return array
     */
    public function getExtraColumn()
    {
        return $this->extraColumn;
    }

    /**
     * Sets the Extra column.
     *
     * @param array|sting $name
     * @param sting $description = true
     * @param boolean $visible = false
     *
     * @return self
     */
    public function setExtraColumn($name, $visible = false, $description = '')
    {
        $extraColumns = is_array($name)
            ? $name
            : [[$name, $visible, $description]];

        foreach ($extraColumns as $column) {
            if (! is_array($column))
                $column = [$column];

            $this->extraColumn[$column[0]] = [
                'name' => $column[0],
                'visible' => isset($column[1]) ? $column[1] : false,
                'description' => isset($column[2]) ? $column[2] : ''
            ];
        }

        return $this;
    }
}


text:
package ru.job4j.lambda.references;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;

public class UserConvert {
    public static class User {
        private final String name;

        public User(String name) {
            this.name = name;
        }

        @Override
        public String toString() {
            return "User{" +
                    "name='" + name + '\'' +
                    '}';
        }
    }

    public List<User> convert(List<String> names, Function<String, User> op) {
        List<User> users = new ArrayList<>();
        names.forEach(n -> users.add(op.apply(n)));
        return users;
    }

    public static void main(String[] args) {
        List<String> names = Arrays.asList("Mike", "John", "Ted");
        UserConvert users = new UserConvert();
        List<User> data = users.convert(names, User::new);
        data.forEach(System.out::println);
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using GoldenEye.Dapper.Mappings;
using Microsoft.Extensions.DependencyInjection;
using Xunit;

namespace GoldenEye.Dapper.Tests.Mappings;

public class RegistrationTests
{
    private class User
    {
        public Guid Id { get; set; }
        public string Name { get; set; }
    }

    private class UserDapperMapping: IDapperMapping<User>
    {
        public string Add => "INSERT INTO Users (Id, Name) VALUES ('{0}', '{1}')";

        public string Update => "UPDATE Users Set Name = '{1}' WHERE Id = '{0}'";

        public string Delete => "DELETE FROM Users WHERE Id = '{0}'";

        public string Query => "SELECT Id, Name FROM Users";

        public string FindById => "SELECT Id, Name FROM Users WHERE Id = '{0}'";
    }

    private class Address
    {
        public Guid Id { get; set; }
        public string Street { get; set; }
    }

    private class AddressDapperMapping: IDapperMapping<User>
    {
        public string Add => "INSERT INTO Addresses (Id, Street) VALUES ('{0}', '{1}')";

        public string Update => "UPDATE Addresses Set Street = '{1}' WHERE Id = '{0}'";

        public string Delete => "DELETE FROM Addresses WHERE Id = '{0}'";

        public string Query => "SELECT Id, Street FROM Addresses";

        public string FindById => "SELECT Id, Street FROM Addresses WHERE Id = '{0}'";
    }

    [Fact]
    public void GivenTwoMappingsForEntityTypes_WhenAddAllDapperMappingsCalled_ThenAllDapperMappingsAreRegistered()
    {
        //Given
        var services = new ServiceCollection();

        //When
        services.AddAllDapperMappings();

        using (var sp = services.BuildServiceProvider())
        {
            var mappings = sp.GetServices<IDapperMapping>().ToList();
            var mappingsReadonlyCollection = sp.GetService<IReadOnlyCollection<IDapperMapping>>();

            mappings.Should().HaveCountGreaterOrEqualTo(2);
            mappingsReadonlyCollection.Should().HaveSameCount(mappings);

            mappings.Should().Contain(v => v is UserDapperMapping);
            mappings.Should().Contain(v => v is AddressDapperMapping);
        }
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>冒泡和捕获</title>
    <meta name="description" content="" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no, minimal-ui" />

    div1

        div2

            div3

                div4

点我不会跳转


text:
@import GLKit;

#import "IMPieChartView.h"
#import "IMMacroToolbox.h"

@interface IMPieChartView ()
{
   GLKVector3              _origin;
   BOOL                    _userIsDragging;
   CGPoint                 _selectionPoint;
   IMPieChartSelectionType _selectionType;
}

@property (nonatomic, strong) IMPieChartLayer * pieChart;
@property (nonatomic, strong) IMPieChartView * pieChartView;

@end

@implementation IMPieChartView

#pragma mark - Initialization and construction

-(id)initWithCoder:(NSCoder *)aDecoder {
   if ((self = [super initWithCoder:aDecoder]) != nil) {
      [self basicInitialization];
   }
   return self;
}

-(id)initWithFrame:(CGRect)frame {
   if ((self = [super initWithFrame:frame]) != nil) {
      [self basicInitialization];
   }
   return self;
}

-(void)basicInitialization {

   // Initialize the pie chart layer
   self.pieChart = [[IMPieChartLayer alloc] init];
   self.pieChart.pieChartView = self;
   self.enableShadow = YES;
   self.radiusFactor = 1.0f;
   self.animationType = IMPieChartAnimationTypeMechanicGear;
   self.selectionType = IMPieChartSelectionTypeBottom;
   self.pieChart.frame = CGRectMake(0, (self.frame.size.height - self.frame.size.width) / 2, self.frame.size.width, self.frame.size.width);
   [self.layer addSublayer:self.pieChart];
   _userIsDragging = NO;
}

-(void)layoutSubviews {
   self.pieChart.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height);
   [self.pieChart setNeedsDisplay];
   _origin = GLKVector3Make(self.pieChart.position.x, self.pieChart.position.y, 0);

   im_log(@"pieChart.size = (%5.2f, %5.2f)", self.pieChart.bounds.size.width, self.pieChart.bounds.size.height);
   im_log(@"pieChart.origin = (%5.2f, %5.2f)", self.pieChart.position.x, self.pieChart.position.y);

   switch (_selectionType) {
      case IMPieChartSelectionTypeBottom:
         _selectionPoint = CGPointMake(self.pieChart.frame.size.width / 2.0, self.pieChart.frame.size.height - 5);
         break;

      case IMPieChartSelectionTypeTop:
         _selectionPoint = CGPointMake(self.pieChart.frame.size.width / 2.0, self.pieChart.frame.origin.y + 5);
         break;

      case IMPieChartSelectionTypeLeft:
         _selectionPoint = CGPointMake(self.pieChart.frame.origin.x + 5, self.pieChart.frame.size.height / 2.0);
         break;

      case IMPieChartSelectionTypeRight:
         _selectionPoint = CGPointMake(self.pieChart.frame.size.width - 5, self.pieChart.frame.size.height / 2.0);
         break;
   }

   im_log(@"bottomSelPoint (%2.2f, %2.2f)", _selectionPoint.x, _selectionPoint.y);
}

#pragma mark - Public methods

-(void)rotateToSlice:(NSUInteger)sliceIndex animated:(BOOL)animated {
   // get the slice at the provided index...
   IMPieSliceDescriptor * slice = [self.pieChartDataSource pieChart:self sliceForIndex:sliceIndex];
   // rotate...
   [self autoRotateToSlice:slice withAnimation:animated];
   // inform current selection...
   [self.pieChartDelegate pieChart:self didSelectSlice:slice];
}

-(void)reloadData {
   [self setNeedsDisplay];
}

#pragma mark - Properties

-(IMPieChartSelectionType)selectionType {
   return _selectionType;
}

-(void)setSelectionType:(IMPieChartSelectionType)selectionType {
   _selectionType = selectionType;
}

#pragma mark - Rotation math methods

-(GLKVector3)pointToVector:(CGPoint)point {
   // convert the point into a vector assuming Z at 0 due to we are not handling perspective
   // but as a convinient value used when calculating the direction of the rotation.
   GLKVector3 vectorPoint = GLKVector3Make(point.x, point.y, 0);

   // translate the point to the new origin and normilize the resulting vector to the magnitud is always 1.
   return GLKVector3Normalize(GLKVector3Subtract(_origin, vectorPoint));
}

-(CGFloat)rotationAngleFromPoint:(CGPoint)startPoint toPoint:(CGPoint)endPoint {
   GLKVector3 startPointVec = [self pointToVector:startPoint];
   GLKVector3 endPointVec = [self pointToVector:endPoint];

   // IMPORTANT NOTE:
   //    Compute the displacement angle using the resulting magnitud of substracting the vector point at the
   //    end of the movement with the start point and whe use the magnitud of the resulting vector as the angle
   //    value.
   GLKVector3 displacement = GLKVector3Subtract(endPointVec, startPointVec);
   CGFloat rotationAngle = GLKVector3Length(displacement);

   // Calculate the rotation direction using the cross product of the end and start vectors and if the value of Z
   // is negative, then the rotation goes clockwise otherwise goes conterclockwise.
   GLKVector3 crossPorduct = GLKVector3CrossProduct(endPointVec, startPointVec);
   CGFloat rotationDirection = crossPorduct.z > 0 ? -1 : 1;
   im_log(@"rotation direction %f", rotationDirection);

   // compute the rotation angle including the direction.
   return rotationAngle * rotationDirection;
}

-(CGFloat)distanceToCenter:(CGPoint)touchPoint {
   CGFloat deltaX = touchPoint.x - _origin.x;
   CGFloat deltaY = touchPoint.y - _origin.y;

   // calculate the distance between two points.
   return sqrtf((deltaX * deltaX) + (deltaY * deltaY));
}

-(CGFloat)calculateAngleAtSelectionPoint:(CGPoint)selectionPoint {
   // Normalizing the selection point vector provides us with a vector of magnitud 1.
   GLKVector2 direction = GLKVector2Normalize(GLKVector2Make(-selectionPoint.y, selectionPoint.x));

   //
   // IMPORTANT NOTE:
   //     From trigonometry we know that cos(angle) = adjacent / hypotenuse; additionally (as in the line above)
   //     we normalize the selectionPoint which becomes in our direction vector which is the hypotenuse (of magnitud = 1)
   //     of the triangle formed between the touchpoint, the origin and the coordinate in Y (the adjacent).
   //     So by value substitution we have that:
   //
   //     cos(angle) = Y / 1 so cos(angle) = Y and the acos(Y) = angle and the angle is what we need ;)
   //
   //     check out here a clearer explanation in case you need it:
   //     http://chimera.labs.oreilly.com/books/1234000001814/ch03.html#OnFingerMove
   //
   CGFloat angle = acos(direction.y);
   if (direction.x > 0)
      angle = -angle;
   return angle;
}

-(CGPoint)calculateTouchInPie:(CGPoint)touchPoint {
   if ([self.pieChart hitTest:touchPoint] == self.pieChart) {
      CGPoint pointInPie = [self.layer convertPoint:touchPoint toLayer:self.pieChart];
      // convert touch point into a vector
      GLKVector2 touchVector = GLKVector2Make(pointInPie.x, pointInPie.y);
      // calculate the pivot point which acts as our origin where the touches move in a circular orbit
      GLKVector2 pivotVector = GLKVector2Make(self.pieChart.bounds.size.width / 2.0f, self.pieChart.bounds.size.height / 2.0f);
      // calculate the point in vector by performing a verctor subtraction between the touchVector and the pivotVector
      GLKVector2 pointInPieVector = GLKVector2Subtract(touchVector, pivotVector);
      return CGPointMake(pointInPieVector.x, pointInPieVector.y);
   }
   return CGPointZero;
}

-(void)autoRotateToSlice:(IMPieSliceDescriptor *)slice withAnimation:(BOOL)animation {
   CGPoint touchInPie = [self calculateTouchInPie:_selectionPoint];
   CGFloat centerAngle = slice.startAngle + (slice.endAngle - slice.startAngle) / 2;
   CGFloat angleAtSelectionPoint = [self calculateAngleAtSelectionPoint:touchInPie];
   CGFloat displacementAngle = angleAtSelectionPoint - centerAngle;
   CATransform3D fromTrans = self.layer.sublayerTransform;
   CATransform3D toTrans = CATransform3DRotate(fromTrans, displacementAngle, 0, 0, 1);
   self.layer.sublayerTransform = toTrans;

   if (animation) {
      CAAnimation * autoselectionAnimation = [self selectedAnimationTypeWithTransform:fromTrans toTrans:toTrans];//[self createAutoselectionMechanicAnimationFrom:fromTrans to:toTrans];
      if (autoselectionAnimation != nil) {
         [self.layer addAnimation:autoselectionAnimation forKey:nil];
      }
   }
}

#pragma mark - Touch handling code

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
#ifdef DEBUG
   UITouch * touch = [touches anyObject];
   CGPoint touchPoint = [touch locationInView:self];
   im_log(@"touch point (x: %f, y: %f)", touchPoint.x, touchPoint.y);
#endif
}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
   // the user started to rotate the pie ...
   im_log(@"origin (%f, %f)", _origin.x, _origin.y);
   // get the touch information.
   UITouch * touch = [touches anyObject];
   // get the previous touch in our view
   CGPoint startPoint = [touch previousLocationInView:self];

   // avoid passing through the center or out of the cicle perimeter, so the rotation keeps stady.
   CGFloat distance = [self distanceToCenter:startPoint];
   CGFloat outterLimit = (self.bounds.size.width / 2);
   CGFloat innerLimit = outterLimit / 4;
   if (distance < innerLimit || distance > outterLimit) {
      return;
   }

   // get current touch point on our view
   CGPoint endPoint = [touch locationInView:self];

   // test the touch hits our view's sublayer
   if ([self.layer.sublayers[0] hitTest:endPoint]) {
      // if we reach this point in code then is official, the user is starting to rotate the pie
      _userIsDragging = YES;
      // get current transform which contains current rotation transform so we rotate from here to the next angle
      CATransform3D currentTransform = self.layer.sublayerTransform;
      // compute rotation angle.
      CGFloat rotationAngle = [self rotationAngleFromPoint:startPoint toPoint:endPoint];

      // compute the slice selected by a fixed selection point...
      IMPieSliceDescriptor * slice = [self.pieChart pieSliceDescriptorAtPoint:[self calculateTouchInPie:_selectionPoint]];
      if (slice != nil) {
         im_log(@"slice %@", slice.caption);
         if ([self.pieChartDelegate respondsToSelector:@selector(pieChart:didSelectSlice:)]) {
            [self.pieChartDelegate pieChart:self didSelectSlice:slice];
         }
      }

      // compute new rotation transform (we pass 1 on z because we rotate on that axis)
      CATransform3D rotationTransform = CATransform3DRotate(currentTransform, rotationAngle, 0, 0, 1);

      // apply rotation transform to our view's layer
      self.layer.sublayerTransform = rotationTransform;
   }
}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
   if (_userIsDragging) { // handle end of dragging
      // compute touch in pie passing a fixed selection point...
      CGPoint touchInPie = [self calculateTouchInPie:_selectionPoint];
      IMPieSliceDescriptor * slice = [self.pieChart pieSliceDescriptorAtPoint:touchInPie];
      // perform roation animation
      [self autoRotateToSlice:slice withAnimation:YES];
   }
   else { // handle end of touch
      UITouch * touch = [touches anyObject];
      CGPoint touchPoint = [touch locationInView:self];
      CGPoint touchInPie = [self calculateTouchInPie:touchPoint];
      IMPieSliceDescriptor * slice = [self.pieChart pieSliceDescriptorAtPoint:touchInPie];
      if (slice) {
         // perform rotation animation
         [self autoRotateToSlice:slice withAnimation:YES];

         // compute the slice selected by a fixed selection point...
         IMPieSliceDescriptor * slice = [self.pieChart pieSliceDescriptorAtPoint:[self calculateTouchInPie:_selectionPoint]];
         if (slice != nil) {
            im_log(@"slice %@", slice.caption);
            if ([self.pieChartDelegate respondsToSelector:@selector(pieChart:didSelectSlice:)]) {
               [self.pieChartDelegate pieChart:self didSelectSlice:slice];
            }
         }

      }
   }
   _userIsDragging = NO;
}

#pragma mark - Animations

-(CAAnimation *) selectedAnimationTypeWithTransform:(CATransform3D)fromTrans toTrans:(CATransform3D)toTrans {
   switch (self.animationType) {
      case IMPieChartAnimationTypeMechanicGear:
         return [self createAutoselectionMechanicAnimationFrom:fromTrans to:toTrans];

      case IMPieChartAnimationTypeBouncing:
         return [self createAutoselectionBouncingAnimationFrom:fromTrans to:toTrans];
   }
}

-(CABasicAnimation *) createAutoselectionMechanicAnimationFrom:(CATransform3D)fromTans to:(CATransform3D)toTrans {
   CABasicAnimation * animation = [CABasicAnimation animationWithKeyPath:@"sublayerTransform"];
   animation.fromValue = [NSValue valueWithCATransform3D:fromTans];
   animation.toValue = [NSValue valueWithCATransform3D:toTrans];
   animation.duration = 0.25;
   animation.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.9 :0.1 :0.7 :0.9];
   return animation;
}

-(CABasicAnimation *) createAutoselectionBouncingAnimationFrom:(CATransform3D)fromTrans to:(CATransform3D)toTrans {
   CABasicAnimation * animation = [CABasicAnimation animationWithKeyPath:@"sublayerTransform"];
   animation.fromValue = [NSValue valueWithCATransform3D:fromTrans];
   animation.toValue = [NSValue valueWithCATransform3D:toTrans];
   animation.duration = 0.30;
   animation.timingFunction = [CAMediaTimingFunction functionWithControlPoints:.5 :1.8 :.8 :0.8];
   return animation;
}

@end


text:
package com.wenym.grooo.util;

import com.google.gson.Gson;
import com.wenym.grooo.model.app.Address;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

/**
 * 小工具,乱七八糟
 * Created by Wouldyou on 2015/5/29.
 */
public class SmallTools {

    public static String resourceIdToUri(int id) {
        return "android.resource://" + GroooAppManager.getAppContext().getPackageName() + "/" + id;
    }

    private static Gson gson = new Gson();

    public static String toGsonString(Object object) {
        return gson.toJson(object);
    }

    public static <T> T fromGson(String jsonString, Class<T> classOfT) {
        return gson.fromJson(jsonString, classOfT);
    }

    private static final SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm");

    public static String formatDate(Date date) {
        return format.format(date);
    }

}


text:
/* 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.
 */
package org.flowable.editor.language.json.converter;

import java.util.Map;

import org.flowable.bpmn.model.BaseElement;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.ServiceTask;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

/**
 * @author Tijs Rademakers
 */
public class MailTaskJsonConverter extends BaseBpmnJsonConverter {

    public static void fillTypes(Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap, Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap) {

        fillJsonTypes(convertersToBpmnMap);
        fillBpmnTypes(convertersToJsonMap);
    }

    public static void fillJsonTypes(Map<String, Class<? extends BaseBpmnJsonConverter>> convertersToBpmnMap) {
        convertersToBpmnMap.put(STENCIL_TASK_MAIL, MailTaskJsonConverter.class);
    }

    public static void fillBpmnTypes(Map<Class<? extends BaseElement>, Class<? extends BaseBpmnJsonConverter>> convertersToJsonMap) {
        // will be handled by ServiceTaskJsonConverter
    }

    @Override
    protected String getStencilId(BaseElement baseElement) {
        return STENCIL_TASK_MAIL;
    }

    @Override
    protected void convertElementToJson(ObjectNode propertiesNode, BaseElement baseElement,
        BpmnJsonConverterContext converterContext) {
        // will be handled by ServiceTaskJsonConverter
    }

    @Override
    protected FlowElement convertJsonToElement(JsonNode elementNode, JsonNode modelNode, Map<String, JsonNode> shapeMap,
        BpmnJsonConverterContext converterContext) {
        ServiceTask task = new ServiceTask();
        task.setType(ServiceTask.MAIL_TASK);
        addField(PROPERTY_MAILTASK_HEADERS, elementNode, task);
        addField(PROPERTY_MAILTASK_TO, elementNode, task);
        addField(PROPERTY_MAILTASK_FROM, elementNode, task);
        addField(PROPERTY_MAILTASK_SUBJECT, elementNode, task);
        addField(PROPERTY_MAILTASK_CC, elementNode, task);
        addField(PROPERTY_MAILTASK_BCC, elementNode, task);
        addField(PROPERTY_MAILTASK_TEXT, elementNode, task);
        addField(PROPERTY_MAILTASK_HTML, elementNode, task);
        addField("htmlVar", PROPERTY_MAILTASK_HTML_VAR, elementNode, task);
        addField("textVar", PROPERTY_MAILTASK_TEXT_VAR, elementNode, task);
        addField(PROPERTY_MAILTASK_CHARSET, elementNode, task);

        return task;
    }
}


text:
package com.netopyr.reduxfx.examples.todo.actions;

import com.netopyr.reduxfx.examples.todo.state.TodoEntry;
import com.netopyr.reduxfx.examples.todo.updater.Updater;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Objects;

/**
 * An {@code EditTodoAction} is passed to the {@link Updater} when the {@code text} of a {@link TodoEntry} needs to
 * be changed.
 * <p>
 * Actions are an implementation of the Command pattern. They describe what should happen within the application,
 * but they do not do any changes themselves. Every time we want to change something in the application-state,
 * we have to generate an Action and pass it to the {@link Updater}, which performs the actual change.
 */
public final class EditTodoAction {

    private final int id;
    private final String text;

    EditTodoAction(int id, String text) {
        Objects.requireNonNull(text, "The parameter 'text' must not be null");
        this.id = id;
        this.text = text;
    }

    /**
     * This is the getter for the {@code id} of the {@link TodoEntry} which {@code text} needs to be changed.
     *
     * @return the {@code id}
     */
    public int getId() {
        return id;
    }

    /**
     * This is the getter of the new text
     *
     * @return the new text
     */
    public String getText() {
        return text;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
                .append("id", id)
                .append("text", text)
                .toString();
    }
}


text:
namespace Ui {
class DirectoryDialog;
}

class DirectoryDialog : public QDialog
{
    Q_OBJECT

public:
    explicit DirectoryDialog(QWidget *parent = 0);
    ~DirectoryDialog();

    QString getDirectory();

public slots:
    void okBtnClicked();

signals:
    void output(QString);

private:
    Ui::DirectoryDialog *ui;
};

#endif // DIRECTORYDIALOG_H


text:
<!doctype html>

	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="stylesheet" href="./../../assets/css/combined.css">
	<link rel="shortcut icon" href="./../../favicon.ico" />

	<title>Theme Methods - Classes - FuelPHP Documentation</title>

					FuelPHP, a PHP 5.3 Framework
					Documentation

				<form id="google_search">

						<input type="submit" name="search_submit" id="search_submit" value="search" />
						<input type="text" value="" id="search_input" name="search_input" />

				</form>

			table of contents

Theme Class Methods

				The Theme class provides theming to your application.

instance($name = '_default_', array $config = array())

					The instance method acts as a multiton. It will return the instance identified by $name. If this
					instance does not exist, it will create a new Theme instance, using the configuration array passed. If no
					parameters are passed, instance will create the default Theme instance, using the default configuration
					specified in the theme config file.

						Static
						Yes

						Parameters

									Param
									Type
									Default
									Description

									$name
									string

'_default_'

									The Theme class instance name.

									$config
									array

array()

									The theme instance configuration. Will be ignored if the instance already exists.

						Returns
						A Theme instance

						Example

// Get the default instance
$theme = \Theme::instance();

// Get a custom instance
$theme = \Theme::instance(
	'custom',
	array(
		'active' => 'custom',
		'view_ext' => '.twig'
	)
);

forge(array $config = array())

					The forge method returns a new Theme instance.

					If no configuration is passed, the configuration is loaded from the global configuration file.
					Note that if you pass a partial configuration, it will be merged with the defaults shown
					in the introduction, NOT with the defaults in your configuration file!

						Static
						Yes

						Parameters

									Param
									Type
									Default
									Description

									$config
									array

array()

									The theme instance configuration.

						Returns
						A Theme instance

						Example

// Get a Theme instance
$theme = \Theme::forge(array(
	'active' => 'custom',
	'fallback' => 'default',
	'view_ext' => '.html',
));

view($view, $data = array(), $auto_filter = null)

					The view method loads a view from the currently loaded theme.
					It will try to load it from the active theme first. If it doesn't exist in the active theme, and a fallback
					theme is defined, it will load it from the fallback theme instead. If it can't be found there either, the
					request is passed to the View class where it follows the normal flow of locating the view file.

This uses View::forge() to return the view. This means that the Parser package is supported for views defined in themes too.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$view
									string

null

									The view filename. View file names should be given relative to the theme path.

									$data
									array

array()

									array of values

									$auto_filter
									boolean

null

									set to true or false to set auto encoding, defaults to main config setting (app/config/config.php)

						Returns
						A new View object

						Throws
						\ThemeException, when the requested view file could not be found.

						Example

// Get the default instance
$theme = \Theme::instance();

// will load THEMEDIR.'/template/homepage.php' with the default settings
$view = $theme->view('template/homepage');

viewmodel($view, $method = 'view', $auto_filter = null)

					The viewmodel method loads and return a Viewmodel object based on the $view string passed. It
					will use the view method documented above to pass the theme view to the Viewmodel.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$view
									string

null

									The viewmodel name. See the Viewmodel for more information.

									$method
									string

'view'

									name of the method in the Viewmodel instance that will be called to process the data prior to rendering the view.

									$auto_filter
									boolean

null

									set to true or false to set auto encoding, defaults to main config setting (app/config/config.php)

						Returns
						A new ViewModel object

						Throws
						\ThemeException, when the requested view file could not be found.

						Example

// Get the default instance
$theme = \Theme::instance();

/**
 * with the default settings, will load the ViewModel defined in
 * APPPATH.'classes/view/template/homepage.php', using the
 * THEMEDIR.'/template/homepage.php' view file
 */
$viewmodel = $theme->viewmodel('template/homepage');

asset_path($path)

					The asset_path method returns the path to the asset requested in $path, relative to the DOCROOT.
					If the configured asset folder is a URL to the requested $path is returned.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$path
									string
									required
									The asset requested.

						Returns
						string

						Example

// Get the default instance
$theme = \Theme::instance();

// will return <img src="/THEMEDIR/assets/img/test.png" />
$img = \Html::img($theme->asset_path('img/test.png'));

Note that to every Theme class instance, an instance of the Asset class assigned. See the advanced page on how the use the Asset class instance.

add_path($path)

					The add_path method allows you to add a theme path at runtime.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$path
									string
									required
									The path to a folder containing themes.

						Returns
						void

						Example

// Get the default instance
$theme = \Theme::instance();

// add the 'mythemes' folder to the theme search paths
$theme->add_path(DOCROOT.'mythemes');

add_paths(array $paths)

					The add_paths method allows you to add multiple theme paths at runtime.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$paths
									array
									required
									The path to a folder containing themes.

						Returns
						void

						Example

// Get the default instance
$theme = \Theme::instance();

// add the 'mythemes' folder to the theme search paths
$theme->add_paths(
	array(
		DOCROOT.'mythemes'
	),
);

active($theme = null)

					The active method allows you to set the active theme. It will return the active theme definition array.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$theme
									string

null

									The name of the active theme to select. If null, it will return the current active theme.

						Returns
						array

						Throws
						\ThemeException, when the requested theme could not be found.

						Example

// Get the default instance
$theme = \Theme::instance();

// set the active theme to 'darkglow', and return its definition
$active = $theme->active('darkglow');

fallback($theme = null)

					The fallback method allows you to set the fallback theme. It will return the fallback theme definition array.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$theme
									string

null

									The name of the fallback theme to select. If null, it will return the current fallback theme.

						Returns
						array

						Throws
						\ThemeException, when the requested theme could not be found.

						Example

// Get the default instance
$theme = \Theme::instance();

// set the fallback theme to 'basic', and return its definition
$fallback = $theme->fallback('basic');

get_template()

					The get_template() method will return the View instance of the currently loaded theme template.

						Static
						No

						Parameters
						None

						Returns
						View

						Example

// Get the default instance
$theme = \Theme::instance();

// Retrieve the current template to set the page title
$theme->get_template()->set('title', 'This is the page title');

set_template($template)

					The set_template method allow you to set the theme template for the page.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$template
									string
									required
									The name of the theme template view to load.

						Returns
						View

						Example

// Get the default instance
$theme = \Theme::instance();

// set the page template to the subpage layout, and set the page title
$theme->set_template('layouts/subpage')->set('title', 'Subpage title');

get_partial($section, $view)

					The get_partial method allow you to get the view instance of a previously set partial in a named section of your page template.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$section
									string
									required
									The name of page template section you want to get the partial from.

									$view
									string
									required
									The name of view to use for the partial

						Returns
						View

						Example

// Get the default instance
$theme = \Theme::instance();

/**
 * Get the View instance of the 'partials/menu' view in the 'sidebar' section of the
 * currently loaded page template, and assign a variable to it.
 */
$theme->get_partial('sidebar', 'partials/menu')->set('class', 'menu green');

					When you get a partial, use the name of the view you used to set it. If you assign the same view to the same
					section multiple times, the first one will be returned. If you have passed a View instance to set_partial(),
					you can get it using the number of the partial, prefixed with 'partial_'.
					Example: you retrieve the second partial using the view name 'partial_2'.

set_partial($section, $view, $overwrite = false)

					The set_partial method allow you to set a view partial for a named section of your page template.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$section
									string
									required
									The name of page template section you want to add this partial to.

									$view
									string|View
									required
									The name of view to use for the partial, or a View object.

									$overwrite
									boolean

false

									If false, append the partial to any partials already defined for this section. If true, existing contents will be deleted.

						Returns
						View

						Example

// Get the default instance
$theme = \Theme::instance();

/**
 * Assign the 'partials/menu' view to the 'sidebar' section of the
 * currently loaded page template.
 *
 * In the template, this partial is echo'd out as $partials['sidebar'];
 */
$theme->set_partial('sidebar', 'partials/menu');

partial_count($section)

					The partial_count method returns a count of the number of partials defined for the given section.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$section
									string
									required
									The name of page template section you want to check for defined partials.

						Returns
						Integer

						Example

// Get the default instance
$theme = \Theme::instance();

// Get the number of partials assigned to the sidebar
$partials = $theme->partial_count('sidebar');

has_partials($section)

					The has_partials method allows you to check if a template section has any partials defined.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$section
									string
									required
									The name of page template section you want to check for defined partials.

						Returns
						Boolean

						Example

// Get the default instance
$theme = \Theme::instance();

// Check if we have sidebar partials defined
if ( ! $theme->has_partials('sidebar'))
{
	// some code here to hide the sidebar...
}

get_chrome($section)

					The get_chrome method allow you to get the view instance of a previously set partial chrome.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$section
									string
									required
									The name of section you want to get the partial chrome from.

						Returns
						View

						Example

// Get the default instance
$theme = \Theme::instance();

/**
 * Get the View instance for the chrome assigned to the 'sidebar' of the
 * template and assign a variable to it.
 */
$theme->get_chrome('sidebar')->set('title', 'This is a sidebar');

set_chrome($section, $view, $var = 'content')

					The set_chrome method allow you to define chrome for a partial section of your page template.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$section
									string
									required
									The name of page template section you want to add this partial to.

									$view
									string|View
									required
									The name of view to use for the chome of the partial, or a View object.

									$var
									string

'content'

									The name of the variable in the chrome view used to output the partial content.

						Returns
						View

						Example

// Get the default instance
$theme = \Theme::instance();

/**
 * Assign the 'chrome/roundedcorners' view to the 'sidebar' section of the
 * currently loaded page template to give the partial section a border with
 * rounded corners.
 *
 * In the chrome view, the partial output is echo'd out as $body;
 */
$theme->set_chrome('sidebar', 'chrome/roundedcorners', 'body');

find($theme)

					The find method will iterate over the defined search paths to find the theme requested.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$theme
									string
									required
									The name of the theme to find.

						Returns
						mixed. Returns the path to the theme if found, or false if not.

						Example

// Get the default instance
$theme = \Theme::instance();

// find the 'darkglow' theme
if ($path = $theme->find('darkglow'))
{
	// the theme can be found in $path
}
else
{
	// unable to find the theme
}

all()

					The all method returns an array of all themes in all theme paths, sorted alphabetically.

						Static
						No

						Parameters
						None

						Returns
						array

						Example

// Get the default instance
$theme = \Theme::instance();

// fetch all installed themes
$themes = $theme->all();

use_modules($enable = true)

					The use_modules method enables or disables the prefixing feature for views loaded from a
					module. If true, the views loaded via the Theme class will be prefixed by the current active module
					name (if any). If a string is passed, it will be prefixed as well, allowing you to store all modules in a
					separate directory, to avoid name conficts between module names and non-prefixed view names. If the view can
					not be found, it's checked again without the prefix, allowing for global views from inside a module. If that
					doesn't exist either, the View class will be called to load the view the regular way.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$enable
									boolean | string

true

									True or a string containing a folder name to enable the feature, false to disable it.

						Returns
						Theme

						Example

// Get the default instance
$theme = \Theme::instance();

// when in the module 'test', this will load the theme view 'test/controller/view'
$info = $theme->use_modules()->set_partial('content', 'controller/view')->use_modules(false);

// when in the module 'test', this will load the theme view 'modules/test/controller/view'
$info = $theme->use_modules('modules')->set_partial('content', 'controller/view')->use_modules(false);

					You can set a global default value through the use_modules key of the theme.php configuration file.

load_info($theme = null)

					The load_info method returns the complete info array for a theme.
					If no theme is specified, the info of the active theme is returned.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$theme
									string

null

									The name of the theme.

						Returns
						array

						Throws
						\ThemeException, when the requested theme could not be found.

						Example

// Get the default instance
$theme = \Theme::instance();

// get the information array for the 'basic' theme.
$info = $theme->load_info('basic');

					If no theme info file could be found, this method Throws \ThemeException if require_info_file is
					set to true, or an empty array is returned if require_info_file is
					set to false.

save_info($type = 'active')

					The save_info saves the contents of the theme info array
					back to the theme info file.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$type
									string

'active'

									Whether the active or fallback theme info should be saved.

						Returns
						boolean

						Throws
						\ThemeException, when the requested theme could not be found.

						Example

// Get the default instance
$theme = \Theme::instance();

// save the information array for the active theme.
$info = $theme->save_info('active');

					If no theme info file could be found, this method Throws \ThemeException if require_info_file is
					set to true, or an empty array is returned if require_info_file is
					set to false.

get_info($var, $default = null, $theme = null)

					The get_info method returns a specific variable from the theme info array.
					If no theme is specified, the info array of the active theme is used.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$var
									string
									required
									The name of the info variable to retrieve.

									$default
									mixed

null

									The value to return if the requested $var does not exist.

									$theme
									string

null

									The name of the theme whose info file should be searched.

						Returns
						mixed

						Throws
						\ThemeException, when the requested theme could not be found.

						Example

// Get the default instance
$theme = \Theme::instance();

// get the color defined the the 'basic' theme, and if not set, use 'blue'
$var = $theme->get_info('color', 'blue', 'basic');

					If you specify a theme, the value is loaded from the theme info file. This is true even if the theme specified
					is currently set as active or passive theme. For those, the loaded (and possibly modified) info is not used!

set_info($var, $value = null, $type = 'active')

					The set_info method allows you to set a varaible in the active or fallback theme info array.
					If no theme is specified, the info array of the active theme is used.

						Static
						No

						Parameters

									Param
									Type
									Default
									Description

									$var
									string
									required
									The name of the info variable to set.

									$value
									mixed

null

									The value to set.

									$type
									string

'active'

									Whether the variable should be set in the active or fallback theme.

						Returns
						Theme

						Example

// Get the default instance
$theme = \Theme::instance();

// set the color to blue of the fallback theme
$theme->set_info('color', 'blue', 'fallback');

				© FuelPHP Development Team 2010-2013 - FuelPHP is released under the MIT license.


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Heterochaete sublivida Pat.

### Remarks
null


text:
"""
ACASX Study comparing performance of CE under different paramaters
Usage:
Use script.jl
then combine_and_plot()
"""
module ACASX_CE_ParamStudy

export combine_logs
export master_log, master_plot
export combine_and_plot

import Compat: ASCIIString, UTF8String
using GrammarExpts
using ExprSearch: CE
using ACASX_CE

using RLESUtils, Loggers, MathUtils, LatexUtils, Sweeper, LogJoiner
using DataFrames
using PGFPlots, TikzPictures

const STUDYNAME = "ACASX_CE_ParamStudy"

const CONFIGDIR = joinpath(dirname(@__FILE__), "..", "config")
const RESULTDIR = joinpath(dirname(@__FILE__), "..", "..", "..", "results")

const MASTERLOG_FILE = joinpath(RESULTDIR, STUDYNAME, "masterlog.csv.gz")
const PLOTLOG_FILE =  joinpath(RESULTDIR, STUDYNAME, "plotlog.csv.gz")
const PLOTFILEROOT = joinpath(RESULTDIR, STUDYNAME, "plots")

const PARAM_COLS = [:num_samples, :iterations, :elite_frac, :w_new, :w_prior, :maxsteps]
const REDUCE_COLS = [:seed, :fitness]
const MASTER_COLS = vcat(PARAM_COLS, REDUCE_COLS)

resultpath(dir::ASCIIString="") = joinpath(RESULTDIR, dir)
studypath(dir::ASCIIString="") = joinpath(RESULTDIR, STUDYNAME, dir)

function combine_logs()
    dir = studypath()
    logs = logjoin(dir, "acasx_ce_log.txt", ["result", "parameters"], joinpath(dir, "joined");
        transpose_syms=Union{Symbol,Void}[nothing, :parameter])
    logs
end

function master_log()
    dir = studypath()
    logs = load_log(TaggedDFLogger, joinpath(dir, "joined.txt"))
    master_log(logs)
end
function master_log(logs::TaggedDFLogger)
    masterlog = join(logs["parameters"], logs["result"], on=:name)
    masterlog = masterlog[[:num_samples,:iterations,:elite_frac,:w_new,:w_prior,:maxsteps,:seed,:fitness]]
    writetable(MASTERLOG_FILE, masterlog)
    masterlog
end

master_plot(; kwargs...) = master_plot(readtable(MASTERLOG_FILE); kwargs...)
"""
Subsamples the collected data at 'subsample' rate to plot at a lower rate than collected
"""
function master_plot(masterlog::DataFrame)
    D = masterlog

    #aggregate over seed
    D = aggregate(D[MASTER_COLS], PARAM_COLS,
        [mean, std, length, SEM]) #operations applied over :seed and :fitness

    #workaround for naming in julia 0.4
    rename!(D, Symbol("fitness_MathUtils.SEM"), :fitness_SEM)
    rename!(D, Symbol("seed_MathUtils.SEM"), :seed_SEM)

    writetable(PLOTLOG_FILE, D)

    #= td = TikzDocument() =#
    #= algo_names = unique(D[:algorithm]) =#
    #= n_algos = length(algo_names) =#
    #=  =#
    #= #nevals_vs_fitness =#
    #= plotarray = Plots.Plot[] =#
    #= for i = 1:n_algos  =#
    #=     D1 = D[D[:algorithm].==algo_names[i], [:nevals, :fitness_mean, :fitness_SEM]] =#
    #=     push!(plotarray, Plots.Linear(D1[:nevals], D1[:fitness_mean],  =#
    #=         errorBars=ErrorBars(; y=D1[:fitness_SEM]),    =#
    #=         legendentry=escape_latex(algo_names[i]))) =#
    #= end =#
    #= tp = PGFPlots.plot(Axis(plotarray, xlabel="Number of Evaluations", ylabel="Fitness", =#
    #=     title="Fitness vs. Number of Evaluations", legendPos="north east")) =#
    #= push!(td, tp)  =#
    #=  =#
    #= #nevals_vs_elapsed_cpu =#
    #= empty!(plotarray) =#
    #= for i = 1:n_algos =#
    #=     D1 = D[D[:algorithm].==algo_names[i], [:nevals, :elapsed_cpu_s_mean,  =#
    #=         :elapsed_cpu_s_SEM]] =#
    #=     push!(plotarray, Plots.Linear(D1[:nevals], D1[:elapsed_cpu_s_mean],  =#
    #=         errorBars=ErrorBars(;y=D1[:elapsed_cpu_s_SEM]),  =#
    #=         legendentry=escape_latex(algo_names[i]))) =#
    #= end =#
    #= tp = PGFPlots.plot(Axis(plotarray, xlabel="Number of Evaluations", ylabel="Elapsed CPU Time (s)", =#
    #=     title="Elapsed CPU Time vs. Number of Evaluations", legendPos="north west")) =#
    #= push!(td, tp) =#
    #=  =#
    #= save(PDF(PLOTFILEROOT * ".pdf"), td) =#
    #= save(TEX(PLOTFILEROOT * ".tex"), td) =#
end

function combine_and_plot()
    logs = combine_logs()
    mlog = master_log(logs)
    plog = master_plot(mlog)
end

end #module


text:
""" Update all the different version variables
"""
import os
from datetime import datetime
from functools import wraps

def read_and_write(func):
    @wraps(func)
    def wrapper(**kwargs):
        path = kwargs["path"]

        with open(path, "r") as fobj:
            data = fobj.readlines()

        func(data, **kwargs)

        with open(path, "w") as fobj:
            fobj.writelines(data)

    return wrapper

@read_and_write
def update_file(data, **kwargs):
    """Parse a file based on the key (k) and update it's value with the provided value (v)

    Args:
        path (str):
        k (str):
        v (str):
    """
    for i, line in enumerate(data):
        if line.startswith(kwargs["k"]):
            data[i] = """{} = "{}"\n""".format(kwargs["k"], kwargs["v"])

@read_and_write
def update_citation_file(data, **kwargs):
    """Parse the citation file and update it's values with the provide file

    Args:
        path (str):
        v (str):
    """
    for i, line in enumerate(data):
        if line.startswith("version:"):
            data[i] = "version: {}\n".format(kwargs["v"])
        if line.startswith("date-released:"):
            data[i] = "date-released: '{}'".format(datetime.today().strftime("%Y-%m-%d"))

def _parse_args():
    import argparse

    parser = argparse.ArgumentParser(description="Automate the version bump of the pyprobables project")
    parser.add_argument("new_version", help="The new version of the package")

    return parser.parse_args()

if __name__ == "__main__":

    args = _parse_args()

    # get current path to find where the script is currently
    script_path = os.path.dirname(os.path.abspath(__file__))

    module_path = os.path.abspath("{}/../".format(script_path))

    # update pyproject.toml
    pyproject = "{}/pyproject.toml".format(module_path)
    update_file(path=pyproject, k="version", v=args.new_version)

    # update the package __init__ file
    init_file = "{}/probables/__init__.py".format(module_path)
    update_file(path=init_file, k="__version__", v=args.new_version)

    # update the citation file
    citation_file = "{}/CITATION.cff".format(module_path)
    update_citation_file(path=citation_file, v=args.new_version)


text:
FROM alpine
COPY ./guble ./guble-cli/guble-cli /usr/local/bin/
RUN mkdir -p /var/lib/guble
VOLUME ["/var/lib/guble"]
ENTRYPOINT ["/usr/local/bin/guble"]
EXPOSE 8080


text:
Stripe API wrapper  for react native and a credit card information form generated with tcomb-form-native.

## Set up

- npm install
- Modify stripeConfig.js to use your configuration to get access to Stripe API.


text:
/**
 * Success Criterion 2.2.5: Re-authenticating
 *
 * @see http://www.w3.org/TR/UNDERSTANDING-WCAG20/time-limits-server-timeout.html
 */
quail.guidelines.wcag.successCriteria['2.2.5'] = (function (quail) {
  /**
   * Determines if this Success Criteria applies to the document.
   */
  function preEvaluator() {
    return true;
  }

  // Create a new SuccessCriteria and pass it the evaluation callbacks.
  var sc = quail.lib.SuccessCriteria({
    'name': 'wcag:2.2.5',
    preEvaluator: preEvaluator
  });

  // Techniques
  sc.techniques = {};

  // Failures
  sc.failures = {};

  return sc;
}(quail));


text:
.calendar, .calendar .monthView, .calendar  .week, .calendar  .weekday, .calendar  .otherWeekday, .calendar figure {
  border: 1px solid #ccc;
}

.calendar {
  width: 678px;
  background: white;
  font-family: Arial, Helvetica, sans-serif;
}

.calendar  a  {
  text-decoration: none;
}

.calendar .monthTitle {
  text-align: center;
  font-size: 30px;
  line-height: 40px;
  font-weight: bold;
  text-transform: uppercase;
  margin: 0 10px;
}

.calendar .navPrev, .calendar .navNext {
  font-size: 14px;
  line-height: 40px;
  display: inline-block;
  float: left;
  text-align: left;
  width: 120px;
}

.calendar .navNext {
  float: right;
  text-align: right;
}

.calendar .monthView {
  margin: 10px;
}

.calendar .header {
  text-transform: capitalize;
}

.calendar .week {
  display: block;
  border-right: none;
  border-bottom: none;
  border-left: none;
  width: 26px;
  height: 60px;
  float: left;
}

.calendar .weekday, .calendar .otherWeekday {
  display: block;
  border-right: none;
  border-bottom: none;
  width: 89px;          /* (calendar - monthView margin) / 7) - left border = ((678 - 10*2 - 1*2) - 24) / 7 - 1 */
  height: 60px;
  text-align: right;
  float: left;
}

.calendar .header .week, .calendar .header .weekday, .calendar .header .otherWeekday {
  height: inherit;
  text-align: center;
  background: #eee;
}

.calendar .sunday {
  color: red;
}

.calendar .monthView .header .week, .calendar .monthView .header .weekday, .calendar .monthView .header .otherWeekday {
  border-top: none;
}

.calendar .weekNr {
  text-align: center;
  display: block;
  margin-top: 4px;
  font-size: 14px;
  line-height: 14px;
}

.calendar .day {
  display: inline-block;
  margin-top: 4px;
  margin-right: 4px;
  font-size: 24px;
  line-height: 24px;
  float: right;
}

.calendar .otherWeekday .day {
  font-size: 14px;
  line-height: 14px;
  color: #999;
}

.calendar .nameDay {
  font-size: 8px;
  display: inline-block;
  text-align: left;
  float: left;
  margin-top: 4px;
  margin-left: 4px;
}

.calendar .flagDay {
  display: block;
  width: 20px;
  height: 15px;
  background-image: url(../img/calendar/flag.png);
  float: right;
  clear: right;
  margin-right: 4px;
  margin-top:4px;
}

.calendar .moon-1, .calendar .moon-3, .calendar .moon-5, .calendar .moon-7 {
  display: block;
  width: 15px;
  height: 15px;
  clear: left;
  float: left;
  margin-left: 4px;
  margin-top:4px;
}

.calendar .moon-1 {background-image: url(../img/calendar/moon-1.png);}
.calendar .moon-3 {background-image: url(../img/calendar/moon-3.png);}
.calendar .moon-5 {background-image: url(../img/calendar/moon-5.png);}
.calendar .moon-7 {background-image: url(../img/calendar/moon-7.png);}

.calendar .otherWeekday .nameDay, .calendar .otherWeekday .flagDay, .calendar .otherWeekday .moon-1, .calendar .otherWeekday .moon-3, .calendar .otherWeekday .moon-5, .calendar .otherWeekday .moon-7 {
  display: none;
}

/**
 * Figure
 */
.calendar figure {
  display: block;
  margin: 10px;
}

.calendar figure img {
  display: block;
  width: 100%;
  height: 410px;
}

/**
  * Small calendar
  */
.smallCalendar, .smallCalendar .monthView, .smallCalendar  .week, .smallCalendar  .weekday, .smallCalendar .otherWeekday, .smallCalendar figure {
  border: none;
}

.smallCalendar {
  width: 279px;
}

.smallCalendar  a  {
  text-decoration: none;
}

.smallCalendar .monthTitle {
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
}

.smallCalendar .navPrev, .smallCalendar .navNext {
  display: inline-block;
  float: left;
  text-align: left;
  width: 40px;
}

.smallCalendar .navNext {
  float: right;
  text-align: right;
}

.smallCalendar .monthView {
  margin: 0px;
  border: 1px solid #ccc;
}

.smallCalendar .header {
  text-transform: capitalize;
}

.smallCalendar .week {
  display: block;
  border-right: none;
  border-bottom: none;
  border-left: none;
  width: 25px;
  height: 28px;
  float: left;
}

.smallCalendar .weekday, .smallCalendar .otherWeekday {
  display: block;
  border-right: none;
  border-bottom: none;
  width: 36px;          /* (calendar - monthView border - week width) / 7 = (279 - 2*1 - 25) / 7 */
  height: 28px;
  text-align: right;
  float: left;
}

.smallCalendar .header .week, .smallCalendar .header .weekday, .smallCalendar .header .otherWeekday {
  height: inherit;
  text-align: center;
  background: #eee;
  font-size: 14px;
  border-bottom: 1px solid #ccc;
}

.smallCalendar .sunday {
  color: red;
}

.smallCalendar .monthView .header .week, .smallCalendar .monthView .header .weekday, .smallCalendar .monthView .header .otherWeekday {
  border-top: none;
}

.smallCalendar .weekNr {
  text-align: center;
  display: block;
  margin-top: 6px;
  font-size: 11px;
  line-height: 14px;
}

.smallCalendar .day {
  display: inline-block;
  margin-top: 6px;
  margin-right: 6px;
}

.smallCalendar .day {
  font-size: 16px;
  line-height: 16px;
}

.smallCalendar .otherWeekday .day {
  font-size: 10px;
  line-height: 10px;
  color: #999;
}

.smallCalendar .nameDay, .smallCalendar .flagDay, .smallCalendar .moon-1, .smallCalendar .moon-3, .smallCalendar .moon-5, .smallCalendar .moon-7  {
  display: none;
}

/**
 * Figure
 */
.smallCalendar figure {
  display: none;
}


text:
@implementation MZCroppableView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}
- (id)initWithImageView:(UIImageView *)imageView
{
    self = [super initWithFrame:imageView.frame];
    if (self) {
        self.lineWidth = 5.0f;
        [self setBackgroundColor:[UIColor clearColor]];
        [self setClipsToBounds:YES];
        [self setUserInteractionEnabled:YES];
        self.croppingPath = [[UIBezierPath alloc] init];
        [self.croppingPath setLineWidth:self.lineWidth];
        self.lineColor = [UIColor redColor];
    }
    return self;
}
#pragma mark - My Methods -
+ (CGRect)scaleRespectAspectFromRect1:(CGRect)rect1 toRect2:(CGRect)rect2
{
    CGSize scaledSize = rect2.size;

    float scaleFactor = 1.0;

    CGFloat widthFactor  = rect2.size.width / rect1.size.width;
    CGFloat heightFactor = rect2.size.height / rect1.size.width;

    if (widthFactor < heightFactor)
        scaleFactor = widthFactor;
    else
        scaleFactor = heightFactor;

    scaledSize.height = rect1.size.height *scaleFactor;
    scaledSize.width  = rect1.size.width  *scaleFactor;

    float y = (rect2.size.height - scaledSize.height)/2;

    return CGRectMake(0, y, scaledSize.width, scaledSize.height);
}
+ (CGPoint)convertCGPoint:(CGPoint)point1 fromRect1:(CGSize)rect1 toRect2:(CGSize)rect2
{
    point1.y = rect1.height - point1.y;
    CGPoint result = CGPointMake((point1.x*rect2.width)/rect1.width, (point1.y*rect2.height)/rect1.height);
    return result;
}
+ (CGPoint)convertPoint:(CGPoint)point1 fromRect1:(CGSize)rect1 toRect2:(CGSize)rect2
{
    CGPoint result = CGPointMake((point1.x*rect2.width)/rect1.width, (point1.y*rect2.height)/rect1.height);
    return result;
}
- (void)drawRect:(CGRect)rect
{
    // Drawing code
    [self.lineColor setStroke];
    [self.croppingPath strokeWithBlendMode:kCGBlendModeNormal alpha:1.0f];
}
- (UIImage *)deleteBackgroundOfImage:(UIImageView *)image
{
    NSArray *points = [self.croppingPath points];

    CGRect rect = CGRectZero;
    rect.size = image.image.size;

    UIBezierPath *aPath;
    UIGraphicsBeginImageContextWithOptions(rect.size, YES, 0.0);
    {
        [[UIColor blackColor] setFill];
        UIRectFill(rect);
        [[UIColor whiteColor] setFill];

        aPath = [UIBezierPath bezierPath];

        // Set the starting point of the shape.
        CGPoint p1 = [MZCroppableView convertCGPoint:[[points objectAtIndex:0] CGPointValue] fromRect1:image.frame.size toRect2:image.image.size];
        [aPath moveToPoint:CGPointMake(p1.x, p1.y)];

        for (uint i=1; i<points.count; i++)
        {
            CGPoint p = [MZCroppableView convertCGPoint:[[points objectAtIndex:i] CGPointValue] fromRect1:image.frame.size toRect2:image.image.size];
            [aPath addLineToPoint:CGPointMake(p.x, p.y)];
        }
        [aPath closePath];
        [aPath fill];
    }

    UIImage *mask = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0.0);

    {
        CGContextClipToMask(UIGraphicsGetCurrentContext(), rect, mask.CGImage);
        [image.image drawAtPoint:CGPointZero];
    }

    UIImage *maskedImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    CGRect croppedRect = aPath.bounds;
    croppedRect.origin.y = rect.size.height - CGRectGetMaxY(aPath.bounds);//This because mask become inverse of the actual image;

    croppedRect.origin.x = croppedRect.origin.x*2;
    croppedRect.origin.y = croppedRect.origin.y*2;
    croppedRect.size.width = croppedRect.size.width*2;
    croppedRect.size.height = croppedRect.size.height*2;

    CGImageRef imageRef = CGImageCreateWithImageInRect(maskedImage.CGImage, croppedRect);

    maskedImage = [UIImage imageWithCGImage:imageRef];

    return maskedImage;
}
#pragma mark - Touch Methods -
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *mytouch=[[touches allObjects] objectAtIndex:0];
    [self.croppingPath moveToPoint:[mytouch locationInView:self]];

}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *mytouch=[[touches allObjects] objectAtIndex:0];
    [self.croppingPath addLineToPoint:[mytouch locationInView:self]];

    [self setNeedsDisplay];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{

}
@end


text:
name 'bzip2'
default_version '1.0.8'

license 'BSD-2-Clause'
license_file 'LICENSE'

skip_transitive_dependency_licensing true

dependency 'zlib'
dependency 'openssl' unless Build::Check.use_system_ssl?

version '1.0.8' do
  source sha512: '083f5e675d73f3233c7930ebe20425a533feedeaaa9d8cc86831312a6581cefbe6ed0d08d2fa89be81082f2a5abdabca8b3c080bf97218a1bd59dc118a30b9f3'
end
source url: "https://sourceware.org/pub/bzip2/#{name}-#{version}.tar.gz"

relative_path "#{name}-#{version}"

build do
  env = with_standard_compiler_flags(with_embedded_path)

  # Avoid warning where .rodata cannot be used when making a shared object
  env['CFLAGS'] << ' -fPIC'

  # The list of arguments to pass to make
  args = "PREFIX='#{install_dir}/embedded' VERSION='#{version}'"

  patch source: 'makefile_take_env_vars.patch', env: env

  make args.to_s, env: env
  make "#{args} -f Makefile-libbz2_so", env: env
  make "#{args} install", env: env
end


text:
from django.conf.urls import patterns, url

from ownYourLife import views

urlpatterns = patterns('',
    url(r'^$', views.IndexView.as_view(), name='index'),
    url(r'^(?P<pk>\d+)/entry-detail/$', views.EntryDetailView.as_view(), name='entry-detail'),
)


text:
import numpy as np
from pyunicorn.timeseries import RecurrenceNetwork

x = np.sin(np.linspace(0, 10 * np.pi, 1000))
net = RecurrenceNetwork(x, recurrence_rate=0.05)
print net.transitivity()


text:
<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <TextView
        android:id="@android:id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:enabled="false"
        android:gravity="center"
        android:padding="@dimen/padding_16"
        android:textSize="@dimen/font_12"
        android:textStyle="bold"
        tools:text="@string/placeholder_title"/>

    <TextView
        android:id="@android:id/custom"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@android:id/title"
        android:layout_centerHorizontal="true"
        android:enabled="true"
        android:gravity="center"
        android:padding="@dimen/padding_16"
        android:textSize="@dimen/font_16"
        android:textStyle="bold"
        tools:text="@string/placeholder_year"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

    </LinearLayout>

    <SeekBar
        android:id="@android:id/progress"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@android:id/custom"
        android:layout_marginLeft="@dimen/padding_8"
        android:layout_marginRight="@dimen/padding_8"
        android:padding="@dimen/padding_16"/>

</RelativeLayout>


text:
@interface DSUserSyncRequest()
@property (nonatomic, retain) NSString *baseURL;
@property (nonatomic, retain) NSURLConnection *connection;
@property (nonatomic, retain) NSMutableData *buffer;
@property (nonatomic, retain) NSHTTPURLResponse *response;
@end

@implementation DSUserSyncRequest

@synthesize baseURL = _baseURL;
@synthesize connection = _connection;
@synthesize buffer = _buffer;
@synthesize response = _response;

-(id) initWithBaseURL:(NSString*)baseURL withQueue:(dispatch_queue_t)queue
{
	if ((self = [super init]))
	{
		self.baseURL = baseURL;
		self.buffer = [NSMutableData data];
		_queue = queue;
	}
	return self;
}

-(void) dealloc
{
	self.response = nil;
	self.baseURL = nil;
	self.buffer = nil;

	[super dealloc];
}

-(void) start
{
	NSLog(@"Starting user sync from the network");
	[[NSNotificationCenter defaultCenter] postNotificationName:@"network.start" object:nil];
	[[NSNotificationCenter defaultCenter] postNotificationName:@"usersync.start" object:nil];

	NSMutableURLRequest* req = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/users", _baseURL]]
												cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
											timeoutInterval:30.0];

	self.connection = [NSURLConnection connectionWithRequest:req delegate:self];
	// And we're off!
}

-(void) parseBuffer
{
	if (_response.statusCode != 200)
	{
		NSLog(@"User sync request failed with non-200 status code of %d", _response.statusCode);
		[[NSNotificationCenter defaultCenter] postNotificationName:@"usersync.failed" object:nil];
		[[NSNotificationCenter defaultCenter] postNotificationName:@"network.stop" object:nil];
		return;
	}

	NSError* error;
	id data = [[CJSONDeserializer deserializer] deserialize:_buffer error:&error];
	if (!data)
	{
		NSLog(@"ACK! User sync had trouble\n%@", error);
		[[NSNotificationCenter defaultCenter] postNotificationName:@"usersync.failed" object:nil];
		[[NSNotificationCenter defaultCenter] postNotificationName:@"network.stop" object:nil];
		return;
	}

	NSLog(@"Um, got some data for users %@", data);

	[[NSNotificationCenter defaultCenter] postNotificationName:@"usersync.finished" object:nil];
	[[NSNotificationCenter defaultCenter] postNotificationName:@"network.stop" object:nil];
}

////////// NSURLConnection delegate

//- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response;
//- (NSInputStream *)connection:(NSURLConnection *)connection needNewBodyStream:(NSURLRequest *)request NS_AVAILABLE(10_6, 3_0);
//- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace NS_AVAILABLE(10_6, 3_0);
//- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
//- (void)connection:(NSURLConnection *)connection didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;
//- (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection NS_AVAILABLE(10_6, 3_0);
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSHTTPURLResponse *)response
{
	NSLog(@"user synch connection started: %d", response.statusCode);

	self.response = response;
}

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
	[_buffer appendData:data];
}

//- (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite NS_AVAILABLE(10_6, 3_0);
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
	NSLog(@"user sync did finish loading");

	dispatch_async(_queue, ^{
		[self parseBuffer];
	});
//	[[NSNotificationCenter defaultCenter] postNotificationName:@"usersync.finished" object:nil];
}

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
	NSLog(@"user sync did fail with error %@", error);
	[[NSNotificationCenter defaultCenter] postNotificationName:@"usersync.failed" object:nil];
	[[NSNotificationCenter defaultCenter] postNotificationName:@"network.stop" object:nil];
}

//- (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse;

@end


text:
// Copyright (c) Alexandre Mutel. All rights reserved.
// This file is licensed under the BSD-Clause 2 license.
// See the license.txt file in the project root for more information.
using System.Runtime.CompilerServices;
using Markdig.Helpers;

namespace Markdig.Parsers
{
    /// <summary>
    /// Extensions used by <see cref="BlockState"/>.
    /// </summary>
    public static class BlockStateExtensions
    {
        /// <summary>
        /// Determines whether this <see cref="BlockState"/> is discarded.
        /// </summary>
        /// <param name="blockState">State of the block.</param>
        /// <returns><c>true</c> if the block state is in discard state</returns>
        [MethodImpl(MethodImplOptionPortable.AggressiveInlining)]
        public static bool IsDiscard(this BlockState blockState)
        {
            return blockState == BlockState.ContinueDiscard || blockState == BlockState.BreakDiscard;
        }

        /// <summary>
        /// Determines whether this <see cref="BlockState"/> is in a continue state.
        /// </summary>
        /// <param name="blockState">State of the block.</param>
        /// <returns><c>true</c> if the block state is in continue state</returns>
        [MethodImpl(MethodImplOptionPortable.AggressiveInlining)]
        public static bool IsContinue(this BlockState blockState)
        {
            return blockState == BlockState.Continue || blockState == BlockState.ContinueDiscard;
        }

        /// <summary>
        /// Determines whether this <see cref="BlockState"/> is in a break state.
        /// </summary>
        /// <param name="blockState">State of the block.</param>
        /// <returns><c>true</c> if the block state is in break state</returns>
        [MethodImpl(MethodImplOptionPortable.AggressiveInlining)]
        public static bool IsBreak(this BlockState blockState)
        {
            return blockState == BlockState.Break || blockState == BlockState.BreakDiscard;
        }
    }
}


text:
package com.buynsell.accountoperations.buyeroperations.bidposting;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.buynsell.businessobjects.Auction;
import com.buynsell.businessobjects.Catalog;
import com.buynsell.businessobjects.ResponseMessage;
import com.buynsell.businessobjects.Users;
import com.buynsell.databaseconnection.JdbcData;
import com.buynsell.databaseconnection.JdbcUtil;
import com.buynsell.utils.GenerateID;

public class BidPostAction extends Action {
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		BidPostForm bidform = (BidPostForm) form;
		ResponseMessage m = new ResponseMessage();

		if (!bidform.validator()) {
			int noOfBids = Integer.parseInt(bidform.getno());
			Catalog c = (Catalog) request.getSession().getAttribute("selectedcatalog");
			String catID = c.getCatalogid();
			Users u = (Users) request.getSession().getAttribute("user");
			Auction auction = JdbcData.loadAuction(catID);
			GenerateID obj = new GenerateID();
			String bidid = obj.getBidID();

			String sql = "insert into bid values('" + bidid + "','" + auction.getAuctionid() + "','" + u.getUserid()
					+ "','" + bidform.getbp() + "')";
			JdbcUtil.updtQuery(sql);

			if (noOfBids > 0) {
				sql = "insert into biddetails values('" + bidid + "','" + bidform.getpi0() + "','" + bidform.getbq0()
						+ "')";
				JdbcUtil.updtQuery(sql);
				if (noOfBids > 1) {
					sql = "insert into biddetails values('" + bidid + "','" + bidform.getpi1() + "','"
							+ bidform.getbq1() + "')";
					JdbcUtil.updtQuery(sql);
					if (noOfBids > 2) {
						sql = "insert into biddetails values('" + bidid + "','" + bidform.getpi2() + "','"
								+ bidform.getbq2() + "')";
						JdbcUtil.updtQuery(sql);
						if (noOfBids > 3) {
							sql = "insert into biddetails values('" + bidid + "','" + bidform.getpi3() + "','"
									+ bidform.getbq3() + "')";
							JdbcUtil.updtQuery(sql);
							if (noOfBids > 4) {
								sql = "insert into biddetails values('" + bidid + "','" + bidform.getpi4() + "','"
										+ bidform.getbq4() + "')";
								JdbcUtil.updtQuery(sql);
							}
						}
					}
				}
			}

			m.setType("Success");
			m.setHeading("Bidding Success");
			m.setContent(
					"You have succesfully placed your bid and can view your
 bid items from the link - View Auctioned items -
 The details regarding the status of your success in the auction
 will be intimated through mail when the auction concludes.");
			m.setFooting("Thank You !");
		} else {
			m.setType("Failure");
			m.setHeading("Bidding Failure");
			m.setContent(
					"You have failed in placed your bid.
 You might have missed out on any of the following data :

You might have forgot to mention the Bidding Quantity.

You might have not entered the Package Bidding Price.");
			m.setFooting("Sorry ! Try Once Again !");
		}
		request.getSession().setAttribute("response", m);
		return (mapping.findForward("response"));
	}
}


text:
//
//  Simulation.hpp
//  MobileDetectorSim
//
//  Created by Jonas Nilsson on 2016-05-11.
//  Copyright © 2016 Jonas Nilsson. All rights reserved.
//

#ifndef Simulation_hpp
#define Simulation_hpp

#include <vector>
#include <boost/thread/thread.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/random.hpp>
#include <boost/circular_buffer.hpp>
#include "ConsolePrint.hpp"
#include "Response.h"
#include "concurrent_queue.h"

struct ReturnData {
	unsigned int value;
	unsigned int iterations;
};

struct SimulationParams {
	SimulationParams() : exit(false) {};
	double distance;
	double velocity;
	AngularResponse angResp;
	DistResponse distResp;
	double activityFactor;
	double background;
	unsigned int critical_limit;
	double startTime;
	double stopTime;
	double integrationTime;

	unsigned int iterations;
	bool exit;
	concurrent_queue<ReturnData> *threadOut;
};

class SimulatorThread {
public:
	SimulatorThread(int threadId, concurrent_queue<SimulationParams> *threadIn);
	void operator()();
private:
	concurrent_queue<SimulationParams> *threadIn;
	int threadId;
};

class ListModeSimulator {
public:
	ListModeSimulator(unsigned int iterations, bool use_multiple_threads);
	~ListModeSimulator();
	double PerformSimulation(SimulationParams params);
	void CloseThreads();
private:
	unsigned int iterations;
	bool use_multiple_threads;
	concurrent_queue<SimulationParams> threadIn;
	std::vector<boost::thread> threads;
};

#endif /* Simulation_hpp */


text:
"""urlconf for the base application"""

from django.conf.urls.defaults import url, patterns
from wtfhack.base.views import get_repo, add_repo

urlpatterns = patterns('wtfhack.base.views',
    url(r'^$', 'home', name='home'),
	url(r'^submit/choose/$', 'submit', name='submit'),
    # ex: language/scala/
    url(r'^(?P<language>[\w\-\+]+)/$', get_repo, name='get_repo'),
    # ex: add_repo/
    url(r'^submit/add_repo/$', add_repo, name='add_repo'),

)


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Greatness through Guidance</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/modern-business.css" rel="stylesheet">

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <link href="css/animate.css" rel="stylesheet">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>
                Greatness through Guidance

                        About

                        Donate

                        Contact

Greatness through Guidance

Technology

Financial Literacy

Career Advice

                    Equipping students for success

Technology

Our wish for the technology portion of our program is to inform our audience about the basic use of electronics like computers and smartphones. We also want to provide instruction about using Microsoft Office, managing and navigating the Internet, and internet safety.

 Financial Literacy

In the financial literacy aspect of our organization, we hope to educate students about crucial abilities needed to succeed in the 21st century workforce. We will teach them basic financial skills such as managing money wisely, making knowledgeable decisions when it comes to investments, and filing tax returns.

Career Advice

The career advice section of our program is to instruct students across the nation by equipping them with the necessary skills to make educated choices when deciding their career paths. We want to ensure that all students are content with the lifelong occupations that they choose for themselves and are able to create successful lives out of them.

Our Mission

Greatness through Guidance hopes to give all American students the ability to succeed by providing counseling in digital literacy, financial literacy, and career advice through partnering with local organizations.

Greatness through Guidance is a 501(c)(3) tax-exempt corporation, and we greatly appreciate any donations to our cause.

                    Donate

Copyright © Greatness through Guidance 2017


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.zhihu.stp</groupId>
  <artifactId>stp</artifactId>
  <version>1.--SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>stp</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.3.2</version>
          <configuration>
            <source>1.7</source>
            <target>1.7</target>
            <compilerArgument></compilerArgument>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>