text:
// render window manager plugin
#include "QmitkRenderWindowManagerView.h"

// mitk core
#include <mitkBaseRenderer.h>
#include <mitkDataNode.h>
#include <QmitkRenderWindow.h>

// mitk qt widgets
#include <QmitkAbstractMultiWidget.h>
#include <QmitkRenderWindowWidget.h>

// mitk gui qt common plugin
#include <QmitkAbstractMultiWidgetEditor.h>

const std::string QmitkRenderWindowManagerView::VIEW_ID = "org.mitk.views.renderwindowmanager";

void QmitkRenderWindowManagerView::RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart)
{
  if (m_RenderWindowPart != renderWindowPart)
  {
    m_RenderWindowPart = renderWindowPart;
    this->SetControlledRenderer();

    // if the render window part is an abstract multi widget editor we can receive the abstract multi widget and listen to the signal
    auto abstractMultiWidgetEditor = dynamic_cast<QmitkAbstractMultiWidgetEditor*>(m_RenderWindowPart);
    if (nullptr != abstractMultiWidgetEditor)
    {
      connect(abstractMultiWidgetEditor->GetMultiWidget(), &QmitkAbstractMultiWidget::ActiveRenderWindowChanged,
              this, &QmitkRenderWindowManagerView::RenderWindowChanged);
    }
  }
}

void QmitkRenderWindowManagerView::RenderWindowPartDeactivated(mitk::IRenderWindowPart* renderWindowPart)
{
  if (m_RenderWindowPart == renderWindowPart)
  {
    // if the render window part is an abstract multi widget editor we need to disconnect the signal before release the render window part
    auto abstractMultiWidgetEditor = dynamic_cast<QmitkAbstractMultiWidgetEditor*>(m_RenderWindowPart);
    if (nullptr != abstractMultiWidgetEditor)
    {
      disconnect(abstractMultiWidgetEditor->GetMultiWidget(), &QmitkAbstractMultiWidget::ActiveRenderWindowChanged,
                 this, &QmitkRenderWindowManagerView::RenderWindowChanged);
    }

    m_RenderWindowPart = nullptr;
    this->SetControlledRenderer();
  }
}

void QmitkRenderWindowManagerView::RenderWindowPartInputChanged(mitk::IRenderWindowPart* renderWindowPart)
{
  if (m_RenderWindowPart == renderWindowPart)
  {
    this->SetControlledRenderer();
  }
}

void QmitkRenderWindowManagerView::CreateQtPartControl(QWidget* parent)
{
  m_Parent = parent;
  // create GUI widgets
  m_Controls.setupUi(parent);

  // add custom render window manager UI widget to the 'renderWindowManagerTab'
  m_RenderWindowInspector = new QmitkRenderWindowDataStorageInspector(parent);
  m_RenderWindowInspector->SetDataStorage(GetDataStorage());
  m_RenderWindowInspector->setObjectName(QStringLiteral("m_RenderWindowManipulatorWidget"));
  m_Controls.verticalLayout->addWidget(m_RenderWindowInspector);

  // data node context menu and menu actions
  m_InspectorView = m_RenderWindowInspector->GetView();
  m_DataNodeContextMenu = new QmitkDataNodeContextMenu(GetSite(), m_InspectorView);
  m_DataNodeContextMenu->SetDataStorage(GetDataStorage());
  //m_DataNodeContextMenu->SetSurfaceDecimation(m_SurfaceDecimation);

  // connect objects
  connect(m_Controls.comboBoxRenderWindowSelection, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
          this, &QmitkRenderWindowManagerView::OnRenderWindowSelectionChanged);
  connect(m_InspectorView, &QAbstractItemView::customContextMenuRequested,
          m_DataNodeContextMenu, &QmitkDataNodeContextMenu::OnContextMenuRequested);

  auto renderWindowPart = GetRenderWindowPart();
  if (nullptr != renderWindowPart)
  {
    this->RenderWindowPartActivated(renderWindowPart);
  }

  // also sets the controlled renderer
  this->SetControlledRenderer();
}

void QmitkRenderWindowManagerView::SetControlledRenderer()
{
  QHash<QString, QmitkRenderWindow*> renderWindows;
  if (nullptr != m_RenderWindowPart)
  {
    renderWindows = m_RenderWindowPart->GetQmitkRenderWindows();
  }

  mitk::RenderWindowLayerUtilities::RendererVector controlledRenderer;
  QStringList rendererNames;
  m_Controls.comboBoxRenderWindowSelection->clear();
  mitk::BaseRenderer* baseRenderer = nullptr;
  for (const auto& renderWindow : renderWindows.values())
  {
    baseRenderer = mitk::BaseRenderer::GetInstance(renderWindow->GetVtkRenderWindow());
    if (nullptr != baseRenderer)
    {
      controlledRenderer.push_back(baseRenderer);
      rendererNames.append(baseRenderer->GetName());
    }
  }

  m_RenderWindowInspector->SetControlledRenderer(controlledRenderer);
  rendererNames.sort();
  m_Controls.comboBoxRenderWindowSelection->addItems(rendererNames);
}

void QmitkRenderWindowManagerView::OnRenderWindowSelectionChanged(const QString& renderWindowId)
{
  m_RenderWindowInspector->SetActiveRenderWindow(renderWindowId);
  mitk::BaseRenderer* selectedRenderer = mitk::BaseRenderer::GetByName(renderWindowId.toStdString());
  if (nullptr != selectedRenderer)
  {
    m_DataNodeContextMenu->SetBaseRenderer(selectedRenderer);
  }

  // if the render window part is an abstract multi widget editor we can set the active render window
  auto abstractMultiWidgetEditor = dynamic_cast<QmitkAbstractMultiWidgetEditor*>(m_RenderWindowPart);
  if (nullptr != abstractMultiWidgetEditor)
  {

    auto renderWindowWidget = abstractMultiWidgetEditor->GetMultiWidget()->GetRenderWindowWidget(renderWindowId);
    abstractMultiWidgetEditor->GetMultiWidget()->SetActiveRenderWindowWidget(renderWindowWidget);
  }
}

void QmitkRenderWindowManagerView::RenderWindowChanged()
{
  auto abstractMultiWidget = dynamic_cast<QmitkAbstractMultiWidget*>(sender());
  if (nullptr != abstractMultiWidget)
  {
    auto activeRenderWindowWidget = abstractMultiWidget->GetActiveRenderWindowWidget();
    if (nullptr != activeRenderWindowWidget)
    {
      m_Controls.comboBoxRenderWindowSelection->setCurrentText(activeRenderWindowWidget->GetWidgetName());
    }
  }
}

QItemSelectionModel* QmitkRenderWindowManagerView::GetDataNodeSelectionModel() const
{
  return m_InspectorView->selectionModel();
}


text:
using Structure.Sketching.Colors;
using Structure.Sketching.ExtensionMethods;
using Structure.Sketching.Formats.Png.Format.ColorFormats.Interfaces;

namespace Structure.Sketching.Formats.Png.Format.ColorFormats
{
    /// <summary>
    /// True color without alpha channel reader
    /// </summary>
    /// <seealso cref="Structure.Sketching.Formats.Png.Format.ColorFormats.Interfaces.IColorReader"/>
    public class TrueColorNoAlphaReader : IColorReader
    {
        /// <summary>
        /// Reads the scanline.
        /// </summary>
        /// <param name="scanline">The scanline.</param>
        /// <param name="pixels">The pixels.</param>
        /// <param name="header">The header.</param>
        /// <param name="row">The row.</param>
        public unsafe void ReadScanline(byte[] scanline, Color[] pixels, Header header, int row)
        {
            scanline = scanline.ExpandArray(header.BitDepth);

            int BytesPerPixel = (header.BitDepth * 3) / 8;
            int BytesPerChannel = header.BitDepth / 8;

            fixed (Color* PixelPointer = &pixels[row * header.Width])
            {
                Color* PixelPointer2 = PixelPointer;
                fixed (byte* ScanlinePointer = &scanline[0])
                {
                    byte* ScanlinePointer2 = ScanlinePointer;
                    for (int x = 0; x < scanline.Length; x += BytesPerPixel)
                    {
                        (*PixelPointer2).Red = *ScanlinePointer2;
                        ScanlinePointer2 += BytesPerChannel;
                        (*PixelPointer2).Green = *ScanlinePointer2;
                        ScanlinePointer2 += BytesPerChannel;
                        (*PixelPointer2).Blue = *ScanlinePointer2;
                        ScanlinePointer2 += BytesPerChannel;
                        (*PixelPointer2).Alpha = 255;
                        ++PixelPointer2;
                    }
                }
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package tiller

import (
	"fmt"

	ctx "golang.org/x/net/context"

	"k8s.io/helm/pkg/hooks"
	"k8s.io/helm/pkg/proto/hapi/release"
	"k8s.io/helm/pkg/proto/hapi/services"
	"k8s.io/helm/pkg/timeconv"
)

// RollbackRelease rolls back to a previous version of the given release.
func (s *ReleaseServer) RollbackRelease(c ctx.Context, req *services.RollbackReleaseRequest) (*services.RollbackReleaseResponse, error) {
	s.Log("preparing rollback of %s", req.Name)
	currentRelease, targetRelease, err := s.prepareRollback(req)
	if err != nil {
		return nil, err
	}

	if !req.DryRun {
		s.Log("creating rolled back release for %s", req.Name)
		if err := s.env.Releases.Create(targetRelease); err != nil {
			return nil, err
		}
	}
	s.Log("performing rollback of %s", req.Name)
	res, err := s.performRollback(currentRelease, targetRelease, req)
	if err != nil {
		return res, err
	}

	if !req.DryRun {
		s.Log("updating status for rolled back release for %s", req.Name)
		if err := s.env.Releases.Update(targetRelease); err != nil {
			return res, err
		}
	}

	return res, nil
}

// prepareRollback finds the previous release and prepares a new release object with
// the previous release's configuration
func (s *ReleaseServer) prepareRollback(req *services.RollbackReleaseRequest) (*release.Release, *release.Release, error) {
	if err := validateReleaseName(req.Name); err != nil {
		s.Log("prepareRollback: Release name is invalid: %s", req.Name)
		return nil, nil, err
	}

	if req.Version < 0 {
		return nil, nil, errInvalidRevision
	}

	currentRelease, err := s.env.Releases.Last(req.Name)
	if err != nil {
		return nil, nil, err
	}

	previousVersion := req.Version
	if req.Version == 0 {
		previousVersion = currentRelease.Version - 1
	}

	s.Log("rolling back %s (current: v%d, target: v%d)", req.Name, currentRelease.Version, previousVersion)

	previousRelease, err := s.env.Releases.Get(req.Name, previousVersion)
	if err != nil {
		return nil, nil, err
	}

	// Store a new release object with previous release's configuration
	targetRelease := &release.Release{
		Name:      req.Name,
		Namespace: currentRelease.Namespace,
		Chart:     previousRelease.Chart,
		Config:    previousRelease.Config,
		Info: &release.Info{
			FirstDeployed: currentRelease.Info.FirstDeployed,
			LastDeployed:  timeconv.Now(),
			Status: &release.Status{
				Code:  release.Status_PENDING_ROLLBACK,
				Notes: previousRelease.Info.Status.Notes,
			},
			// Because we lose the reference to previous version elsewhere, we set the
			// message here, and only override it later if we experience failure.
			Description: fmt.Sprintf("Rollback to %d", previousVersion),
		},
		Version:  currentRelease.Version + 1,
		Manifest: previousRelease.Manifest,
		Hooks:    previousRelease.Hooks,
	}

	return currentRelease, targetRelease, nil
}

func (s *ReleaseServer) performRollback(currentRelease, targetRelease *release.Release, req *services.RollbackReleaseRequest) (*services.RollbackReleaseResponse, error) {
	res := &services.RollbackReleaseResponse{Release: targetRelease}

	if req.DryRun {
		s.Log("dry run for %s", targetRelease.Name)
		return res, nil
	}

	// pre-rollback hooks
	if !req.DisableHooks {
		if err := s.execHook(targetRelease.Hooks, targetRelease.Name, targetRelease.Namespace, hooks.PreRollback, req.Timeout); err != nil {
			return res, err
		}
	} else {
		s.Log("rollback hooks disabled for %s", req.Name)
	}

	if err := s.ReleaseModule.Rollback(currentRelease, targetRelease, req, s.env); err != nil {
		msg := fmt.Sprintf("Rollback %q failed: %s", targetRelease.Name, err)
		s.Log("warning: %s", msg)
		currentRelease.Info.Status.Code = release.Status_SUPERSEDED
		targetRelease.Info.Status.Code = release.Status_FAILED
		targetRelease.Info.Description = msg
		s.recordRelease(currentRelease, true)
		s.recordRelease(targetRelease, true)
		return res, err
	}

	// post-rollback hooks
	if !req.DisableHooks {
		if err := s.execHook(targetRelease.Hooks, targetRelease.Name, targetRelease.Namespace, hooks.PostRollback, req.Timeout); err != nil {
			return res, err
		}
	}

	deployed, err := s.env.Releases.DeployedAll(currentRelease.Name)
	if err != nil {
		return nil, err
	}
	// Supersede all previous deployments, see issue #2941.
	for _, r := range deployed {
		s.Log("superseding previous deployment %d", r.Version)
		r.Info.Status.Code = release.Status_SUPERSEDED
		s.recordRelease(r, true)
	}

	targetRelease.Info.Status.Code = release.Status_DEPLOYED

	return res, nil
}


text:
<?php

namespace onyx\HomeBundle\Controller\Tache;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use FOS\RestBundle\Controller\Annotations\Post;
use FOS\RestBundle\Controller\Annotations\Get;
use FOS\RestBundle\Controller\Annotations\View;
use onyx\HomeBundle\Entity\Utilisateur;
use onyx\HomeBundle\Entity\Projet;
use onyx\HomeBundle\Form\Type\ProjectType;
use Symfony\Component\HttpFoundation\JsonResponse;
use onyx\HomeBundle\Entity\Mecano;

class TacheController extends Controller
{
	/**
	 * @View()
	 * @Get("/taches")
	 */
	public function getAllMecanos(Request $request)
	{
		$taches = $this->get('doctrine.orm.entity_manager')
		->getRepository('onyxHomeBundle:Tache')
		->findAll();

		return $taches;
	}

	/**
	 * @View()
	 * @Get("/mecanos/{id}/taches")
	 */
	public function getMecanoAction(Request $request)
	{
		$mecano = $this->get('doctrine.orm.entity_manager')
		->getRepository('onyxHomeBundle:Mecano')
		->find($request->get('id')); // L'identifiant en tant que paramétre n'est plus nécessaire
		/* @var $mecano Mecano */

		if (empty($mecano)) {
			return $this->mecnaoNotFound();
		}

		return $mecano->getTaches();
	}

	private function mecnaoNotFound()
	{
		//return \FOS\RestBundle\View\View::create(['message' => 'User not found'], Response::HTTP_NOT_FOUND);
		return new JsonResponse(['message' => 'Mecano not found'], Response::HTTP_NOT_FOUND);

	}
}


text:
<?php

error_reporting(-1);

require __DIR__.'/../vendor/autoload.php';
require __DIR__.'/../db_handle/db_handler.php';

use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

//$config=['settings'=>['displayErrorDetails'=>true],];

$app=new \Slim\App(/*$config*/);

$app->post('/register', function (Request $req, Response $res) {
	$dbh=new db_handler();
	$body = $req->getParsedBody();
	$body=$dbh->newUser($body);
	// echo $body;
	return $res->withJson($body);
});

$app->post('/new-friend' , function (Request $req, Response $res) {
	// $id=$req->getAttribute('id');
	$dbh=new db_handler();
	$body=$req->getParsedBody();

	$body=$dbh->newFriend($body);
	return $res->withJson($body);
});

$app->post('/new-song' , function (Request $req, Response $res) {
	// $id=$req->getAttribute('id');
	$dbh=new db_handler();
	$body=$req->getParsedBody();

	$body=$dbh->newSong($body);
	return $res->withJson($body);
});

$app->get('/my-friends/{u_id}' , function (Request $req, Response $res) {
	$id=$req->getAttribute('u_id');
	$dbh=new db_handler();
	$body=$dbh->getFriends($id);
	return $res->withJson($body);//body is json_encoded
});

$app->get('/friend-songs/{f_id}' , function (Request $req, Response $res) {
	$id=$req->getAttribute('f_id');
	$dbh=new db_handler();
	$body=$dbh->getSongsOfFriend($id);
	return $res->withJson($body);//body is json_encoded
});

$app->post('/login' , function (Request $req, Response $res) {
	// $id=$req->getAttribute('id');
	$dbh=new db_handler();
	$body=$req->getParsedBody();
	// print_r($body['pass']);
	$body=$dbh->userLogin($body);
	return $res->withJson($body);
});

$app->run();


text:
package com.rackspacecloud.blueflood.io.serializers.json;

import com.rackspacecloud.blueflood.types.AbstractRollupStat;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.SerializerProvider;

import java.io.IOException;

public class AbstractRollupStatSerializer extends org.codehaus.jackson.map.JsonSerializer<com.rackspacecloud.blueflood.types.AbstractRollupStat> {
    @Override
    public void serialize(AbstractRollupStat value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
        if (value.isFloatingPoint()) {
            jgen.writeNumber(value.toDouble());
        } else {
            jgen.writeNumber(value.toLong());
        }
    }
}


text:
/**
 * @fileoverview Rule to flag missing semicolons.
 * @author Nicholas C. Zakas
 */
"use strict";

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

const FixTracker = require("./utils/fix-tracker");
const astUtils = require("./utils/ast-utils");

//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------

/** @type {import('../shared/types').Rule} */
module.exports = {
    meta: {
        type: "layout",

        docs: {
            description: "require or disallow semicolons instead of ASI",
            recommended: false,
            url: "https://eslint.org/docs/rules/semi"
        },

        fixable: "code",

        schema: {
            anyOf: [
                {
                    type: "array",
                    items: [
                        {
                            enum: ["never"]
                        },
                        {
                            type: "object",
                            properties: {
                                beforeStatementContinuationChars: {
                                    enum: ["always", "any", "never"]
                                }
                            },
                            additionalProperties: false
                        }
                    ],
                    minItems: 0,
                    maxItems: 2
                },
                {
                    type: "array",
                    items: [
                        {
                            enum: ["always"]
                        },
                        {
                            type: "object",
                            properties: {
                                omitLastInOneLineBlock: { type: "boolean" }
                            },
                            additionalProperties: false
                        }
                    ],
                    minItems: 0,
                    maxItems: 2
                }
            ]
        },

        messages: {
            missingSemi: "Missing semicolon.",
            extraSemi: "Extra semicolon."
        }
    },

    create(context) {

        const OPT_OUT_PATTERN = /^[-[(/+`]/u; // One of [(/+-`
        const unsafeClassFieldNames = new Set(["get", "set", "static"]);
        const unsafeClassFieldFollowers = new Set(["*", "in", "instanceof"]);
        const options = context.options[1];
        const never = context.options[0] === "never";
        const exceptOneLine = Boolean(options && options.omitLastInOneLineBlock);
        const beforeStatementContinuationChars = options && options.beforeStatementContinuationChars || "any";
        const sourceCode = context.getSourceCode();

        //--------------------------------------------------------------------------
        // Helpers
        //--------------------------------------------------------------------------

        /**
         * Reports a semicolon error with appropriate location and message.
         * @param {ASTNode} node The node with an extra or missing semicolon.
         * @param {boolean} missing True if the semicolon is missing.
         * @returns {void}
         */
        function report(node, missing) {
            const lastToken = sourceCode.getLastToken(node);
            let messageId,
                fix,
                loc;

            if (!missing) {
                messageId = "missingSemi";
                loc = {
                    start: lastToken.loc.end,
                    end: astUtils.getNextLocation(sourceCode, lastToken.loc.end)
                };
                fix = function(fixer) {
                    return fixer.insertTextAfter(lastToken, ";");
                };
            } else {
                messageId = "extraSemi";
                loc = lastToken.loc;
                fix = function(fixer) {

                    /*
                     * Expand the replacement range to include the surrounding
                     * tokens to avoid conflicting with no-extra-semi.
                     * https://github.com/eslint/eslint/issues/7928
                     */
                    return new FixTracker(fixer, sourceCode)
                        .retainSurroundingTokens(lastToken)
                        .remove(lastToken);
                };
            }

            context.report({
                node,
                loc,
                messageId,
                fix
            });

        }

        /**
         * Check whether a given semicolon token is redundant.
         * @param {Token} semiToken A semicolon token to check.
         * @returns {boolean} `true` if the next token is `;` or `}`.
         */
        function isRedundantSemi(semiToken) {
            const nextToken = sourceCode.getTokenAfter(semiToken);

            return (
                !nextToken ||
                astUtils.isClosingBraceToken(nextToken) ||
                astUtils.isSemicolonToken(nextToken)
            );
        }

        /**
         * Check whether a given token is the closing brace of an arrow function.
         * @param {Token} lastToken A token to check.
         * @returns {boolean} `true` if the token is the closing brace of an arrow function.
         */
        function isEndOfArrowBlock(lastToken) {
            if (!astUtils.isClosingBraceToken(lastToken)) {
                return false;
            }
            const node = sourceCode.getNodeByRangeIndex(lastToken.range[0]);

            return (
                node.type === "BlockStatement" &&
                node.parent.type === "ArrowFunctionExpression"
            );
        }

        /**
         * Checks if a given PropertyDefinition node followed by a semicolon
         * can safely remove that semicolon. It is not to safe to remove if
         * the class field name is "get", "set", or "static", or if
         * followed by a generator method.
         * @param {ASTNode} node The node to check.
         * @returns {boolean} `true` if the node cannot have the semicolon
         *      removed.
         */
        function maybeClassFieldAsiHazard(node) {

            if (node.type !== "PropertyDefinition") {
                return false;
            }

            /*
             * Computed property names and non-identifiers are always safe
             * as they can be distinguished from keywords easily.
             */
            const needsNameCheck = !node.computed && node.key.type === "Identifier";

            /*
             * Certain names are problematic unless they also have a
             * a way to distinguish between keywords and property
             * names.
             */
            if (needsNameCheck && unsafeClassFieldNames.has(node.key.name)) {

                /*
                 * Special case: If the field name is `static`,
                 * it is only valid if the field is marked as static,
                 * so "static static" is okay but "static" is not.
                 */
                const isStaticStatic = node.static && node.key.name === "static";

                /*
                 * For other unsafe names, we only care if there is no
                 * initializer. No initializer = hazard.
                 */
                if (!isStaticStatic && !node.value) {
                    return true;
                }
            }

            const followingToken = sourceCode.getTokenAfter(node);

            return unsafeClassFieldFollowers.has(followingToken.value);
        }

        /**
         * Check whether a given node is on the same line with the next token.
         * @param {Node} node A statement node to check.
         * @returns {boolean} `true` if the node is on the same line with the next token.
         */
        function isOnSameLineWithNextToken(node) {
            const prevToken = sourceCode.getLastToken(node, 1);
            const nextToken = sourceCode.getTokenAfter(node);

            return !!nextToken && astUtils.isTokenOnSameLine(prevToken, nextToken);
        }

        /**
         * Check whether a given node can connect the next line if the next line is unreliable.
         * @param {Node} node A statement node to check.
         * @returns {boolean} `true` if the node can connect the next line.
         */
        function maybeAsiHazardAfter(node) {
            const t = node.type;

            if (t === "DoWhileStatement" ||
                t === "BreakStatement" ||
                t === "ContinueStatement" ||
                t === "DebuggerStatement" ||
                t === "ImportDeclaration" ||
                t === "ExportAllDeclaration"
            ) {
                return false;
            }
            if (t === "ReturnStatement") {
                return Boolean(node.argument);
            }
            if (t === "ExportNamedDeclaration") {
                return Boolean(node.declaration);
            }
            if (isEndOfArrowBlock(sourceCode.getLastToken(node, 1))) {
                return false;
            }

            return true;
        }

        /**
         * Check whether a given token can connect the previous statement.
         * @param {Token} token A token to check.
         * @returns {boolean} `true` if the token is one of `[`, `(`, `/`, `+`, `-`, ```, `++`, and `--`.
         */
        function maybeAsiHazardBefore(token) {
            return (
                Boolean(token) &&
                OPT_OUT_PATTERN.test(token.value) &&
                token.value !== "++" &&
                token.value !== "--"
            );
        }

        /**
         * Check if the semicolon of a given node is unnecessary, only true if:
         *   - next token is a valid statement divider (`;` or `}`).
         *   - next token is on a new line and the node is not connectable to the new line.
         * @param {Node} node A statement node to check.
         * @returns {boolean} whether the semicolon is unnecessary.
         */
        function canRemoveSemicolon(node) {
            if (isRedundantSemi(sourceCode.getLastToken(node))) {
                return true; // `;;` or `;}`
            }
            if (maybeClassFieldAsiHazard(node)) {
                return false;
            }
            if (isOnSameLineWithNextToken(node)) {
                return false; // One liner.
            }

            // continuation characters should not apply to class fields
            if (
                node.type !== "PropertyDefinition" &&
                beforeStatementContinuationChars === "never" &&
                !maybeAsiHazardAfter(node)
            ) {
                return true; // ASI works. This statement doesn't connect to the next.
            }
            if (!maybeAsiHazardBefore(sourceCode.getTokenAfter(node))) {
                return true; // ASI works. The next token doesn't connect to this statement.
            }

            return false;
        }

        /**
         * Checks a node to see if it's the last item in a one-liner block.
         * Block is any `BlockStatement` or `StaticBlock` node. Block is a one-liner if its
         * braces (and consequently everything between them) are on the same line.
         * @param {ASTNode} node The node to check.
         * @returns {boolean} whether the node is the last item in a one-liner block.
         */
        function isLastInOneLinerBlock(node) {
            const parent = node.parent;
            const nextToken = sourceCode.getTokenAfter(node);

            if (!nextToken || nextToken.value !== "}") {
                return false;
            }

            if (parent.type === "BlockStatement") {
                return parent.loc.start.line === parent.loc.end.line;
            }

            if (parent.type === "StaticBlock") {
                const openingBrace = sourceCode.getFirstToken(parent, { skip: 1 }); // skip the `static` token

                return openingBrace.loc.start.line === parent.loc.end.line;
            }

            return false;
        }

        /**
         * Checks a node to see if it's followed by a semicolon.
         * @param {ASTNode} node The node to check.
         * @returns {void}
         */
        function checkForSemicolon(node) {
            const isSemi = astUtils.isSemicolonToken(sourceCode.getLastToken(node));

            if (never) {
                if (isSemi && canRemoveSemicolon(node)) {
                    report(node, true);
                } else if (
                    !isSemi && beforeStatementContinuationChars === "always" &&
                    node.type !== "PropertyDefinition" &&
                    maybeAsiHazardBefore(sourceCode.getTokenAfter(node))
                ) {
                    report(node);
                }
            } else {
                const oneLinerBlock = (exceptOneLine && isLastInOneLinerBlock(node));

                if (isSemi && oneLinerBlock) {
                    report(node, true);
                } else if (!isSemi && !oneLinerBlock) {
                    report(node);
                }
            }
        }

        /**
         * Checks to see if there's a semicolon after a variable declaration.
         * @param {ASTNode} node The node to check.
         * @returns {void}
         */
        function checkForSemicolonForVariableDeclaration(node) {
            const parent = node.parent;

            if ((parent.type !== "ForStatement" || parent.init !== node) &&
                (!/^For(?:In|Of)Statement/u.test(parent.type) || parent.left !== node)
            ) {
                checkForSemicolon(node);
            }
        }

        //--------------------------------------------------------------------------
        // Public API
        //--------------------------------------------------------------------------

        return {
            VariableDeclaration: checkForSemicolonForVariableDeclaration,
            ExpressionStatement: checkForSemicolon,
            ReturnStatement: checkForSemicolon,
            ThrowStatement: checkForSemicolon,
            DoWhileStatement: checkForSemicolon,
            DebuggerStatement: checkForSemicolon,
            BreakStatement: checkForSemicolon,
            ContinueStatement: checkForSemicolon,
            ImportDeclaration: checkForSemicolon,
            ExportAllDeclaration: checkForSemicolon,
            ExportNamedDeclaration(node) {
                if (!node.declaration) {
                    checkForSemicolon(node);
                }
            },
            ExportDefaultDeclaration(node) {
                if (!/(?:Class|Function)Declaration/u.test(node.declaration.type)) {
                    checkForSemicolon(node);
                }
            },
            PropertyDefinition: checkForSemicolon
        };

    }
};


text:
            Get Started Now

Find out how to install PhoneGap, then create and preview an app on your device — almost as fast as a robot could do it.

            Read Our Blog

Have you read our latest blog post yet? If not, go now…there is solid gold in that post.

About

Project Overview

License

FAQs

Apache Cordova

Logo

Stickers

Contact Us

Docs & Resources

Documentation

Community Forum

Third Party Tools

Events

Books

Plugin Library

We're Everywhere

GitHub

IRC

Twitter

Facebook

Google+

YouTube

Instagram

Stay Connected to PhoneGap

If you'd like us to keep in touch with the latest news and updates, subscribe now.

      <form class="subscribe__form" action="http://nitobi.createsend.com/t/y/s/htjuyh/" method="post">
        <input class="subscribe__form__text-input" type="email" name="cm-htjuyh-htjuyh" id="htjuyh-htjuyh" placeholder="Enter your email address" required/>
        <input class="subscribe__form__submit" type="submit" value="Sign up"/>
      </form>

Copyright © 2016 Adobe Systems Inc. All rights reserved.
Use of this website signifies your agreement to the Terms of Use and Privacy Policy and Cookies.

{% include analytics.html %}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Select. fung. carpol. (Paris) 3: 37 (1865)

#### Original name
Sphaeria torminosa Mont.

### Remarks
null


text:
@interface ViewController ()<UITableViewDataSource,UITableViewDelegate,UIScrollViewDelegate>

@property (weak, nonatomic) IBOutlet UITextField *inputTextField;
@property (weak, nonatomic) IBOutlet UITableView *taskTableView;

@property(strong,nonatomic) NSMutableArray *taskArray;

@property(strong,nonatomic) NSArray *arr;

@end

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];

  //应用启动的时候加载数据库文件;
  NSManagedObjectContext *context = [(AppDelegate*)[[UIApplication sharedApplication] delegate] managedObjectContext];
  NSFetchRequest *fetchData = [[NSFetchRequest alloc] initWithEntityName:@"Task"];
  self.arr = [context executeFetchRequest:fetchData error:nil];

  self.taskArray = [[NSMutableArray alloc] initWithArray:[self.arr valueForKey:@"taskname"]];
}

#pragma mark - UITableViewDataSource
//每一个section有几个cell;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  return self.taskArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyCell" forIndexPath:indexPath];
  cell.textLabel.text = [self.taskArray objectAtIndex:indexPath.row];

  return cell;
}

#pragma mark - 点击增加按钮
- (IBAction)addTaskButtonClick:(id)sender {

  NSString *inputStr = [[NSMutableString alloc] initWithFormat:@"%@",self.inputTextField.text];
  inputStr = [inputStr stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];

  //判断如果输入的为空,则不添加;
  if ([inputStr  isEqual: @""]) {

    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"输入的内容不能为空" preferredStyle:UIAlertControllerStyleAlert];
    [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil]];
    [self presentViewController:alert animated:true completion:nil];
  } else {

    //每点击一次"确定"按钮后,就把该数据存储到CoreData中;
    [self saveToCoreData:inputStr];

    //把一个文本存储到taskArray数组中;
    [self.taskArray insertObject:self.inputTextField.text atIndex:self.taskArray.count];
    [self.taskTableView reloadData];

    //清空输入框;
    self.inputTextField.text = nil;

    //点击确定后消失软键盘;
    [self.inputTextField resignFirstResponder];

  }

}

#pragma mark - 保存数据到CoreData;
- (void) saveToCoreData:(NSString *)taskName{

  NSManagedObjectContext *context = [(AppDelegate*)[[UIApplication sharedApplication] delegate] managedObjectContext];
  NSManagedObject *row = [NSEntityDescription insertNewObjectForEntityForName:@"Task" inManagedObjectContext:context];

  [row setValue:taskName forKey:@"taskname"];
  [context save:nil];
  NSLog(@"已保存到数据库");
}

#pragma mark - UIScrollViewDelegate
//滚动TableView的时候隐藏软键盘;
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{

  [self.inputTextField resignFirstResponder];

}

@end


text:
import React from 'react';

const Todo = ({onClick, text, completed }) => {
  return (
    <li
      onClick={onClick}
      style={{ textDecoration : completed ? 'line-through' : 'none'}}
    >
      {text}
    </li>
  )
};

export default Todo;


text:
// Karma configuration
// Generated on Mon Jan 13 2014 16:18:53 GMT+0100 (W. Europe Standard Time)

module.exports = function (config) {
    var configObj = {

        // base path, that will be used to resolve files and exclude
        basePath: '',

        // frameworks to use
        // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
        frameworks: ['jasmine'],

        // list of files / patterns to load in the browser
        files: [
            '..//node_modules/jquery/dist/jquery.js',
            '../node_modules/angular/angular.js',
            '../node_modules/angular-mocks/angular-mocks.js',
            '../node_modules/jquery-mockjax/jquery.mockjax.js',
            './angular/src/**/*.js',
            './angular/tests/**/*.js',
            './jquery/src/**/*.js',
            './jquery/tests/**/*.js'
        ],

        // list of files to exclude
        exclude: [
        ],

        plugins: [
            'karma-jasmine',
            'karma-phantomjs-launcher'
        ],

        // test results reporter to use
        // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
        //reporters: ['progress', 'coverage'],
        reporters: ['progress'],

        // preprocess matching files before serving them to the browser
        // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
        //preprocessors: {
        //},

        // web server port
        port: 9876,

        // enable / disable colors in the output (reporters and logs)
        colors: true,

        // level of logging
        // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
        logLevel: config.LOG_INFO,

        // enable / disable watching file and executing tests whenever any file changes
        autoWatch: true,
        // Start these browsers, currently available:
        // - Chrome
        // - ChromeCanary
        // - Firefox
        // - Opera (has to be installed with `npm install karma-opera-launcher`)
        // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
        // - PhantomJS
        // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
        browsers: ['PhantomJS'],

        // If browser does not capture in given timeout [ms], kill it
        captureTimeout: 60000,

        // Continuous Integration mode
        // if true, it capture browsers, run tests and exit
        singleRun: false
    };

    config.set(configObj);
};


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Syntax Highlighting Test • Skinny Bones</title>
    <meta name="description" content="Demo post to test the various ways of using syntax highlighting.">
    <meta name="keywords" content="">

	<meta name="twitter:title" content="Syntax Highlighting Test">
	<meta name="twitter:description" content="Demo post to test the various ways of using syntax highlighting.">
	<meta name="twitter:site" content="@mmistakes">
	<meta name="twitter:creator" content="@mmistakes">

	<meta name="twitter:card" content="summary">
	<meta name="twitter:image" content="//mmistakes.github.io/skinny-bones-jekyll/images/120x120.gif">

	<meta property="og:locale" content="en_US">
	<meta property="og:type" content="article">
	<meta property="og:title" content="Syntax Highlighting Test">
	<meta property="og:description" content="Demo post to test the various ways of using syntax highlighting.">
	<meta property="og:url" content="//mmistakes.github.io/skinny-bones-jekyll/articles/syntax-highlighting-test/">
	<meta property="og:site_name" content="Skinny Bones">

    <link rel="canonical" href="//mmistakes.github.io/skinny-bones-jekyll/articles/syntax-highlighting-test/">

    <link href="//mmistakes.github.io/skinny-bones-jekyll/atom.xml" type="application/atom+xml" rel="alternate" title="Skinny Bones Atom Feed">
    <link href="//mmistakes.github.io/skinny-bones-jekyll/sitemap.xml" type="application/xml" rel="sitemap" title="Sitemap">

    <meta name="HandheldFriendly" content="True">
    <meta name="MobileOptimized" content="320">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="cleartype" content="on">

    <link rel="stylesheet" href="//mmistakes.github.io/skinny-bones-jekyll/css/main.css">

    Skinny Bones

Skinny Bones

Getting Started

Sample Articles

Media

About

Skinny Bones

Getting Started

Everything you need to know to get started with Skinny Bones and Jekyll.

Sample Articles

Examples of long form posts.

Media

Examples of media posts perfect for showcasing work, photographs, etc.

About

All about Skinny Bones for Jekyll.

<button type="button" id="js-menu-trigger" class="sliding-menu-button lines-button x2" role="button" aria-label="Toggle Navigation">

</button>

        Home
       ›

        Articles

Syntax Highlighting Test

Syntax highlighting is a feature that displays source code, in different colors and fonts according to the category of terms. This feature facilitates writing in a structured language such as a programming language or a markup language as both structures and syntax errors are visually distinct. Highlighting does not affect the meaning of the text itself; it is intended only for human readers.

<code> Blocks

.site-title {
	@include row;
	@include media($large) {
		@include span-columns(4);
	}
	padding: (.25 * $masthead-height) 0; // fourth the height to center vertically
	height: $masthead-height;
	text-decoration: none;
	color: $black;
	font-family: $alt-font;
	font-weight: 700;
	@include font-size(20,no);
	line-height: .5 * $masthead-height; // half the height to center vertically
	text-transform: uppercase;
}

Pygments Code Blocks

To modify styling and highlight colors edit /assets/less/pygments.less and compile main.less with your favorite preprocessor. Or edit main.css if that's your thing, the classes you want to modify all begin with .highlight.

#container {
    float: left;
    margin: 0 -240px 0 0;
    width: 100%;
}

Line numbering enabled:

1 <nav class="pagination" role="navigation">
2     {% if page.previous %}
3         <a href="{{ site.url }}{{ page.previous.url }}" class="btn" title="{{ page.previous.title }}">Previous article</a>
4     {% endif %}
5     {% if page.next %}
6         <a href="{{ site.url }}{{ page.next.url }}" class="btn" title="{{ page.next.title }}">Next article</a>
7     {% endif %}
8 </nav><!-- /.pagination -->

module Jekyll
  class TagIndex < Page
    def initialize(site, base, dir, tag)
      @site = site
      @base = base
      @dir = dir
      @name = 'index.html'
      self.process(@name)
      self.read_yaml(File.join(base, '_layouts'), 'tag_index.html')
      self.data['tag'] = tag
      tag_title_prefix = site.config['tag_title_prefix'] || 'Tagged: '
      tag_title_suffix = site.config['tag_title_suffix'] || '&#8211;'
      self.data['title'] = "#{tag_title_prefix}#{tag}"
      self.data['description'] = "An archive of posts tagged #{tag}."
    end
  end
end

Standard Code Block

<nav class="pagination" role="navigation">
    {% if page.previous %}
        <a href="{{ site.url }}{{ page.previous.url }}" class="btn" title="{{ page.previous.title }}">Previous article</a>
    {% endif %}
    {% if page.next %}
        <a href="{{ site.url }}{{ page.next.url }}" class="btn" title="{{ page.next.title }}">Next article</a>
    {% endif %}
</nav><!-- /.pagination -->

Fenced Code Blocks

To modify styling and highlight colors edit /assets/less/coderay.less and compile main.less with your favorite preprocessor. Or edit main.css if that's your thing, the classes you want to modify all begin with .coderay. Line numbers and a few other things can be modified in _config.yml under coderay.

#container {
    float: left;
    margin: 0 -240px 0 0;
    width: 100%;
}

<nav class="pagination" role="navigation">
    {% if page.previous %}
        <a href="{{ site.url }}{{ page.previous.url }}" class="btn" title="{{ page.previous.title }}">Previous article</a>
    {% endif %}
    {% if page.next %}
        <a href="{{ site.url }}{{ page.next.url }}" class="btn" title="{{ page.next.title }}">Next article</a>
    {% endif %}
</nav><!-- /.pagination -->

module Jekyll
  class TagIndex < Page
    def initialize(site, base, dir, tag)
      @site = site
      @base = base
      @dir = dir
      @name = 'index.html'
      self.process(@name)
      self.read_yaml(File.join(base, '_layouts'), 'tag_index.html')
      self.data['tag'] = tag
      tag_title_prefix = site.config['tag_title_prefix'] || 'Tagged: '
      tag_title_suffix = site.config['tag_title_suffix'] || '&#8211;'
      self.data['title'] = "#{tag_title_prefix}#{tag}"
      self.data['description'] = "An archive of posts tagged #{tag}."
    end
  end
end

GitHub Gist Embed

An example of a Gist embed below.

---
layout: page
title: Tag Index
description: "An archive of posts sorted by tag."
---

{% capture tags %}
  {% for tag in site.tags %}
    {{ tag[0] | replace: ' ', '&nbsp;' }}
  {% endfor %}
{% endcapture %}
{% assign sortedtags = tags | split: ' ' | sort %}

<ul class="tag-box inline">
{% for tag in sortedtags %}
  {% for post in site.tags[tag] %}
		<li><a href="#{{ tag }}">{{ tag }}</a></li>
	{% endfor %}
{% endfor %}
</ul>

{% for tag in sortedtags %}
	<h2 id="{{ tag }}">{{ tag }}</h2>
	<ul class="post-list">
	{% for post in site.tags[tag] %}
		<li><a href="{{ site.url }}{{ post.url }}">{{ post.title }}<span class="entry-date"><time datetime="{{ post.date | date_to_xmlschema }}" itemprop="datePublished">{{ post.date | date: "%B %d, %Y" }}</time></span></a></li>
	{% endfor %}
	</ul>
{% endfor %}

400: Invalid request

 Michael Rose

Just another boring, tattooed, time traveling designer.

	  Twitter
	  Facebook
	  Google+

 <time datetime="2014-11-30T08:38:14Z" itemprop="datePublished">November 30, 2014</time>

Home

Getting Started

About

Terms

© 2015 Skinny Bones powered by Jekyll + Skinny Bones.


text:
var searchData=
[
  ['commandutil',['CommandUtil',['../class_command_util.html',1,'']]],
  ['common',['Common',['../class_common.html',1,'']]],
  ['config',['Config',['../class_config.html',1,'']]],
  ['constructionmanager',['ConstructionManager',['../class_construction_manager.html',1,'']]],
  ['constructionplacefinder',['ConstructionPlaceFinder',['../class_construction_place_finder.html',1,'']]],
  ['constructionplacesearchmethod',['ConstructionPlaceSearchMethod',['../enum_construction_place_finder_1_1_construction_place_search_method.html',1,'ConstructionPlaceFinder']]],
  ['constructionstatus',['ConstructionStatus',['../enum_construction_task_1_1_construction_status.html',1,'ConstructionTask']]],
  ['constructiontask',['ConstructionTask',['../class_construction_task.html',1,'']]]
];


text:
package com.rrajath.transittracker.data.api.model;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

import java.util.ArrayList;
import java.util.List;

public class Stop {

    @SerializedName("code")
    @Expose
    public String code;
    @SerializedName("direction")
    @Expose
    public String direction;
    @SerializedName("id")
    @Expose
    public String id;
    @SerializedName("lat")
    @Expose
    public Double lat;
    @SerializedName("locationType")
    @Expose
    public Integer locationType;
    @SerializedName("lon")
    @Expose
    public Double lon;
    @SerializedName("name")
    @Expose
    public String name;
    @SerializedName("routeIds")
    @Expose
    public List<String> routeIds = new ArrayList<String>();
    @SerializedName("wheelchairBoarding")
    @Expose
    public String wheelchairBoarding;

}


text:
<!DOCTYPE html>

	{% include head.html %}

		{% comment %}

Skip to main content

		{% endcomment %}

		{% include header.html %}

			{% include menu-docs.html %}

{{ page.title }}

					{{ content }}

			{% include footer.html %}


text:
package com.whut.util;

import java.io.UnsupportedEncodingException;
import java.util.Comparator;

import com.whut.database.entiy.Song;

/**
 * 对歌曲名比较大小
 *
 * @author chenfu
 *
 */
public class PinyinComparator implements Comparator<Song> {

	@Override
	public int compare(Song lhs, Song rhs) {

		String lFirstLetter = lhs.getFirstLetter();
		String rFirstLetter = rhs.getFirstLetter();

		String lFirstWord = lhs.getSongName().substring(0, 1);
		String rFirstWord = rhs.getSongName().substring(0, 1);

		String lName = lhs.getSongName().replace("-", "").replace("(", "")
				.replace(")", "").replace(" ", "");
		String rName = rhs.getSongName().replace("-", "").replace("(", "")
				.replace(")", "").replace(" ", "");

		String lPinYin = "";
		String rPinYin = "";
		try {
			if (lFirstWord.getBytes("gbk").length == 1) { // 英文
				lPinYin = lName;
			} else { // 汉字
				for (int i=0; i<lName.length(); i++) {
					lPinYin += HanZi2PinYin.getPinYin(lName.substring(i, i+1));
				}
			}
			if (rFirstWord.getBytes("gbk").length == 1) { // 英文
				rPinYin = rName;
			} else { // 汉字
				for (int i=0; i<rName.length(); i++) {
					rPinYin += HanZi2PinYin.getPinYin(rName.substring(i, i+1));
				}
			}

		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		//System.out.println(lPinYin + "\n" + rPinYin);

		if (lFirstLetter.equals("#")) {
			return -1;
		} else if (rFirstLetter.equals("#")) {
			return 1;
		} else {
			return lPinYin.toLowerCase().compareTo(rPinYin.toLowerCase());
		}
	}
}


text:
package com.ibm.watson.developer_cloud.personality_insights.v3.model;

import com.ibm.watson.developer_cloud.service.model.GenericModel;
import com.ibm.watson.developer_cloud.util.Validator;

/**
 * ContentItem.
 */
public class ContentItem extends GenericModel {

  /**
   * MIME type of the content. The default is plain text. The tags are stripped from HTML content before it is analyzed;
   * plain text is processed as submitted.
   */
  public interface Contenttype {
    /** text/plain. */
    String TEXT_PLAIN = "text/plain";
    /** text/html. */
    String TEXT_HTML = "text/html";
  }

  /**
   * Language identifier (two-letter ISO 639-1 identifier) for the language of the content item. The default is `en`
   * (English). Regional variants are treated as their parent language; for example, `en-US` is interpreted as `en`. A
   * language specified with the `Content-Type` header overrides the value of this parameter; any content items that
   * specify a different language are ignored. Omit the `Content-Type` header to base the language on the most prevalent
   * specification among the content items; again, content items that specify a different language are ignored. You can
   * specify any combination of languages for the input and response content.
   */
  public interface Language {
    /** ar. */
    String AR = "ar";
    /** en. */
    String EN = "en";
    /** es. */
    String ES = "es";
    /** ja. */
    String JA = "ja";
  }

  private String content;
  private String id;
  private Long created;
  private Long updated;
  private String contenttype;
  private String language;
  private String parentid;
  private Boolean reply;
  private Boolean forward;

  /**
   * Builder.
   */
  public static class Builder {
    private String content;
    private String id;
    private Long created;
    private Long updated;
    private String contenttype;
    private String language;
    private String parentid;
    private Boolean reply;
    private Boolean forward;

    private Builder(ContentItem contentItem) {
      content = contentItem.content;
      id = contentItem.id;
      created = contentItem.created;
      updated = contentItem.updated;
      contenttype = contentItem.contenttype;
      language = contentItem.language;
      parentid = contentItem.parentid;
      reply = contentItem.reply;
      forward = contentItem.forward;
    }

    /**
     * Instantiates a new builder.
     */
    public Builder() {
    }

    /**
     * Instantiates a new builder with required properties.
     *
     * @param content the content
     */
    public Builder(String content) {
      this.content = content;
    }

    /**
     * Builds a ContentItem.
     *
     * @return the contentItem
     */
    public ContentItem build() {
      return new ContentItem(this);
    }

    /**
     * Set the content.
     *
     * @param content the content
     * @return the ContentItem builder
     */
    public Builder content(String content) {
      this.content = content;
      return this;
    }

    /**
     * Set the id.
     *
     * @param id the id
     * @return the ContentItem builder
     */
    public Builder id(String id) {
      this.id = id;
      return this;
    }

    /**
     * Set the created.
     *
     * @param created the created
     * @return the ContentItem builder
     */
    public Builder created(long created) {
      this.created = created;
      return this;
    }

    /**
     * Set the updated.
     *
     * @param updated the updated
     * @return the ContentItem builder
     */
    public Builder updated(long updated) {
      this.updated = updated;
      return this;
    }

    /**
     * Set the contenttype.
     *
     * @param contenttype the contenttype
     * @return the ContentItem builder
     */
    public Builder contenttype(String contenttype) {
      this.contenttype = contenttype;
      return this;
    }

    /**
     * Set the language.
     *
     * @param language the language
     * @return the ContentItem builder
     */
    public Builder language(String language) {
      this.language = language;
      return this;
    }

    /**
     * Set the parentid.
     *
     * @param parentid the parentid
     * @return the ContentItem builder
     */
    public Builder parentid(String parentid) {
      this.parentid = parentid;
      return this;
    }

    /**
     * Set the reply.
     *
     * @param reply the reply
     * @return the ContentItem builder
     */
    public Builder reply(Boolean reply) {
      this.reply = reply;
      return this;
    }

    /**
     * Set the forward.
     *
     * @param forward the forward
     * @return the ContentItem builder
     */
    public Builder forward(Boolean forward) {
      this.forward = forward;
      return this;
    }
  }

  private ContentItem(Builder builder) {
    Validator.notNull(builder.content, "content cannot be null");
    content = builder.content;
    id = builder.id;
    created = builder.created;
    updated = builder.updated;
    contenttype = builder.contenttype;
    language = builder.language;
    parentid = builder.parentid;
    reply = builder.reply;
    forward = builder.forward;
  }

  /**
   * New builder.
   *
   * @return a ContentItem builder
   */
  public Builder newBuilder() {
    return new Builder(this);
  }

  /**
   * Gets the content.
   *
   * Content that is to be analyzed. The service supports up to 20 MB of content for all items combined.
   *
   * @return the content
   */
  public String content() {
    return content;
  }

  /**
   * Gets the id.
   *
   * Unique identifier for this content item.
   *
   * @return the id
   */
  public String id() {
    return id;
  }

  /**
   * Gets the created.
   *
   * Timestamp that identifies when this content was created. Specify a value in milliseconds since the UNIX Epoch
   * (January 1, 1970, at 0:00 UTC). Required only for results that include temporal behavior data.
   *
   * @return the created
   */
  public Long created() {
    return created;
  }

  /**
   * Gets the updated.
   *
   * Timestamp that identifies when this content was last updated. Specify a value in milliseconds since the UNIX Epoch
   * (January 1, 1970, at 0:00 UTC). Required only for results that include temporal behavior data.
   *
   * @return the updated
   */
  public Long updated() {
    return updated;
  }

  /**
   * Gets the contenttype.
   *
   * MIME type of the content. The default is plain text. The tags are stripped from HTML content before it is analyzed;
   * plain text is processed as submitted.
   *
   * @return the contenttype
   */
  public String contenttype() {
    return contenttype;
  }

  /**
   * Gets the language.
   *
   * Language identifier (two-letter ISO 639-1 identifier) for the language of the content item. The default is `en`
   * (English). Regional variants are treated as their parent language; for example, `en-US` is interpreted as `en`. A
   * language specified with the `Content-Type` header overrides the value of this parameter; any content items that
   * specify a different language are ignored. Omit the `Content-Type` header to base the language on the most prevalent
   * specification among the content items; again, content items that specify a different language are ignored. You can
   * specify any combination of languages for the input and response content.
   *
   * @return the language
   */
  public String language() {
    return language;
  }

  /**
   * Gets the parentid.
   *
   * Unique ID of the parent content item for this item. Used to identify hierarchical relationships between
   * posts/replies, messages/replies, and so on.
   *
   * @return the parentid
   */
  public String parentid() {
    return parentid;
  }

  /**
   * Gets the reply.
   *
   * Indicates whether this content item is a reply to another content item.
   *
   * @return the reply
   */
  public Boolean reply() {
    return reply;
  }

  /**
   * Gets the forward.
   *
   * Indicates whether this content item is a forwarded/copied version of another content item.
   *
   * @return the forward
   */
  public Boolean forward() {
    return forward;
  }
}


text:
package eu.fusepool.p3.geo.enriching.test;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Iterator;
import java.util.List;

import junit.framework.Assert;

import org.apache.clerezza.rdf.core.TripleCollection;
import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
import org.apache.clerezza.rdf.core.serializedform.Parser;
import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
import org.apache.jena.atlas.lib.StrUtils;
import org.apache.jena.atlas.logging.LogCtl;
import org.apache.jena.query.spatial.*;
import org.apache.jena.riot.RDFDataMgr;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.hp.hpl.jena.query.*;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ResourceFactory;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.sparql.util.QueryExecUtils;
import com.hp.hpl.jena.tdb.TDBFactory;

import eu.fusepool.p3.geo.enriching.SpatialDataEnhancer;
import eu.fusepool.p3.geo.enriching.WGS84Point;

import org.junit.Test;

/**
 * Build a spatial search dataset
 */
public class JenaSpatialTest {

    final String TEST_DATASET = "spatial-data-latlong.ttl";
    final String TEST_DATASET_URI = "http://airport.com/";

    static SpatialDataEnhancer jenas = null;

    static {
        LogCtl.setLog4j();
    }
    static Logger log = LoggerFactory.getLogger("JenaSpatialTest");

    @BeforeClass
    public static void init() throws IOException{
        jenas = new SpatialDataEnhancer();
    }

    @Before
    public void setUp() throws Exception {
        URL testFile = getClass().getResource(TEST_DATASET);
        jenas.loadKnowledgeBase(jenas.getDataset(), testFile.toString(), TEST_DATASET_URI);
    }

    @Test
    public void testQueryKnowledgebase() throws Exception {

        queryData(jenas.getDataset());
    }

    @Test
    public void testGetPoint() throws IOException {
        TripleCollection graph = Parser.getInstance().parse(getClass().getResourceAsStream(TEST_DATASET), SupportedFormat.TURTLE);
        WGS84Point point = jenas.getPoint(graph);
        Assert.assertTrue(point != null);
    }

    @Test
    public void testEnhanceNullClientGraph() {
    	String errorMessage = "";
    	try {
    	   TripleCollection resultGraph = jenas.enhance(TEST_DATASET_URI, null);

    	}
    	catch(NullPointerException npe){
    		errorMessage = npe.getMessage();

    	}
    	Assert.assertEquals("A null object has been passed instead of a graph.", errorMessage);

    }

    @Test
    public void testEnhanceEmptyClientGraph() {
    	String errorMessage = "";
    	try {
    	   TripleCollection resultGraph = jenas.enhance(TEST_DATASET_URI, new SimpleMGraph());

    	}
    	catch(IllegalArgumentException iae){
    		errorMessage = iae.getMessage();

    	}

    	Assert.assertEquals("An empty graph cannot be enhanced", errorMessage);

    }

    @Test
    public void testQueryNearby() throws Exception {
        WGS84Point point = new WGS84Point();
        point.setUri("http://geo.org/?lat=41.79,lon=12.24");
        point.setLat(41.79);
        point.setLong(12.24);
        TripleCollection pois = jenas.queryNearby(point, TEST_DATASET_URI, 10000.0);
        Assert.assertTrue(! pois.isEmpty());
    }

    private void queryData(Dataset spatialDataset) {
        log.info("queryData()");
        long startTime = System.nanoTime();
        String pre = StrUtils.strjoinNL("PREFIX spatial: <http://jena.apache.org/spatial#>",
                "PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>",
                "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>");
        // NEARBY
        log.info("nearby");
        String qs = StrUtils.strjoinNL("SELECT * ",
                "FROM NAMED <" + TEST_DATASET_URI + ">",
                "WHERE { ",
                "GRAPH <" + TEST_DATASET_URI + "> ",
                " { ?s spatial:nearby (41.79 12.24 10 'km') ;",
                "   geo:lat ?lat ;" ,
                "   geo:long ?long ; ",
                "      rdfs:label ?label .", " }",
                "}");

        log.info(pre + "\n" + qs);
        spatialDataset.begin(ReadWrite.READ);
        try {
            Query q = QueryFactory.create(pre + "\n" + qs);
            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
            QueryExecUtils.executeQuery(q, qexec);
        } finally {
            spatialDataset.end();
        }
        long finishTime = System.nanoTime();
        double time = (finishTime - startTime) / 1.0e6;
        log.info(String.format("FINISH - %.2fms", time));

        // WITHIN CIRCLE
        log.info("withinCircle");
        startTime = System.nanoTime();
        qs = StrUtils.strjoinNL("SELECT * ",
                "{ GRAPH <" + TEST_DATASET_URI + "> ",
                " { ?s spatial:withinCircle (51.3000 -2.71000 100.0 'miles' 3) ;",
                "      rdfs:label ?label", " }}");

        log.info(pre + "\n" + qs);
        spatialDataset.begin(ReadWrite.READ);
        try {
            Query q = QueryFactory.create(pre + "\n" + qs);
            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
            QueryExecUtils.executeQuery(q, qexec);
        } finally {
            spatialDataset.end();
        }
        finishTime = System.nanoTime();
        time = (finishTime - startTime) / 1.0e6;
        log.info(String.format("FINISH - %.2fms", time));

        // WITHINBOX
        log.info("withinBox");
        startTime = System.nanoTime();
        qs = StrUtils.strjoinNL("SELECT * ",
                "{ GRAPH <" + TEST_DATASET_URI + "> ",
                " { ?s spatial:withinBox (51.1000 -4.0000 51.4000 0.0000 -1) ;",
                "      rdfs:label ?label", " }}");

        log.info(pre + "\n" + qs);
        spatialDataset.begin(ReadWrite.READ);
        try {
            Query q = QueryFactory.create(pre + "\n" + qs);
            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
            QueryExecUtils.executeQuery(q, qexec);
        } finally {
            spatialDataset.end();
        }
        finishTime = System.nanoTime();
        time = (finishTime - startTime) / 1.0e6;
        log.info(String.format("FINISH - %.2fms", time));

        // INTERSECTBOX
        log.info("interesectBox");
        startTime = System.nanoTime();
        qs = StrUtils.strjoinNL("SELECT * ",
                "{ GRAPH <" + TEST_DATASET_URI + "> ",
                " { ?s spatial:intersectBox (51.1000 -4.0000 51.4000 0.0000) ;",
                "      rdfs:label ?label", " }}");

        log.info(pre + "\n" + qs);
        spatialDataset.begin(ReadWrite.READ);
        try {
            Query q = QueryFactory.create(pre + "\n" + qs);
            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
            QueryExecUtils.executeQuery(q, qexec);
        } finally {
            spatialDataset.end();
        }
        finishTime = System.nanoTime();
        time = (finishTime - startTime) / 1.0e6;
        log.info(String.format("FINISH - %.2fms", time));

        // NORTH
        log.info("north");
        startTime = System.nanoTime();
        qs = StrUtils.strjoinNL("SELECT * ",
                "{ GRAPH <" + TEST_DATASET_URI + "> ",
                " { ?s spatial:north (51.3000 0.0000) ;",
                "      rdfs:label ?label", " }}");

        log.info(pre + "\n" + qs);
        spatialDataset.begin(ReadWrite.READ);
        try {
            Query q = QueryFactory.create(pre + "\n" + qs);
            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
            QueryExecUtils.executeQuery(q, qexec);
        } finally {
            spatialDataset.end();
        }
        finishTime = System.nanoTime();
        time = (finishTime - startTime) / 1.0e6;
        log.info(String.format("FINISH - %.2fms", time));

        // SOUTH
        log.info("south");
        startTime = System.nanoTime();
        qs = StrUtils.strjoinNL("SELECT * ",
                "{ GRAPH <" + TEST_DATASET_URI + "> ",
                " { ?s spatial:south (51.3000 0.0000) ;",
                "      rdfs:label ?label", " }}");

        spatialDataset.begin(ReadWrite.READ);
        try {
            Query q = QueryFactory.create(pre + "\n" + qs);
            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
            QueryExecUtils.executeQuery(q, qexec);
        } finally {
            spatialDataset.end();
        }
        finishTime = System.nanoTime();
        time = (finishTime - startTime) / 1.0e6;
        log.info(String.format("FINISH - %.2fms", time));

        // EAST
        log.info("east");
        startTime = System.nanoTime();
        qs = StrUtils.strjoinNL("SELECT * ",
                "{ GRAPH <" + TEST_DATASET_URI + "> ",
                " { ?s spatial:east (51.3000 0.0000) ;",
                "      rdfs:label ?label", " }}");

        log.info(pre + "\n" + qs);
        spatialDataset.begin(ReadWrite.READ);
        try {
            Query q = QueryFactory.create(pre + "\n" + qs);
            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
            QueryExecUtils.executeQuery(q, qexec);
        } finally {
            spatialDataset.end();
        }
        finishTime = System.nanoTime();
        time = (finishTime - startTime) / 1.0e6;
        log.info(String.format("FINISH - %.2fms", time));

        // WEST
        log.info("west");
        startTime = System.nanoTime();
        qs = StrUtils.strjoinNL("SELECT * ",
                "{ GRAPH <" + TEST_DATASET_URI + "> ",
                " { ?s spatial:west (51.3000 0.0000) ;",
                "      rdfs:label ?label", " }}");

        spatialDataset.begin(ReadWrite.READ);
        try {
            Query q = QueryFactory.create(pre + "\n" + qs);
            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
            QueryExecUtils.executeQuery(q, qexec);
        } finally {
            spatialDataset.end();
        }
        finishTime = System.nanoTime();
        time = (finishTime - startTime) / 1.0e6;
        log.info(String.format("FINISH - %.2fms", time));

        //WEST2
        log.info("west2");
        startTime = System.nanoTime();
        qs = StrUtils.strjoinNL("SELECT * ",
                "{ GRAPH <" + TEST_DATASET_URI + "> ",
                " { ?s spatial:withinBox (51.1 -180.0000 51.9 0.0000) ;",
                "      rdfs:label ?label", " }}");

        log.info(pre + "\n" + qs);
        spatialDataset.begin(ReadWrite.READ);
        try {
            Query q = QueryFactory.create(pre + "\n" + qs);
            QueryExecution qexec = QueryExecutionFactory.create(q, spatialDataset);
            QueryExecUtils.executeQuery(q, qexec);
        } finally {
            spatialDataset.end();
        }
        finishTime = System.nanoTime();
        time = (finishTime - startTime) / 1.0e6;
        log.info(String.format("FINISH - %.2fms", time));
    }

}


text:
<?php
    $title = "Pie Charts and Options 2";
    // $plotTargets = array (array('id'=>'chart1', 'width'=>600, 'height'=>400));
?>
<?php include "opener.php"; ?>

<?php include "commonScripts.html" ?>

<?php include "closer.php"; ?>


text:
/**
 * This class is generated by jOOQ
 */
package com.github.lburgazzoli.sandbox.jooq.db.tables.interfaces;

/**
 * This class is generated by jOOQ.
 */
@javax.annotation.Generated(
	value = {
		"http://www.jooq.org",
		"jOOQ version:3.5.4"
	},
	comments = "This class is generated by jOOQ"
)
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
public interface ITest extends java.io.Serializable {

	/**
	 * Getter for PUBLIC.TEST.ID.
	 */
	public java.lang.Integer getId();

	/**
	 * Getter for PUBLIC.TEST.DATA.
	 */
	public java.lang.String getData();
}


text:
package com.alexrnl.commons.arguments.parsers;

import static org.junit.Assert.assertEquals;

import java.lang.reflect.Field;

import org.junit.Before;
import org.junit.Test;

/**
 * Test suite for the {@link LongParser} class.
 * @author Alex
 */
public class LongParserTest {
	/** The long parser */
	private LongParser	parser;
	/** The field to set */
	private long		field;
	/** The reference to the field to set */
	private Field		fieldReference;

	/**
	 * Set up test attributes.
	 * @throws NoSuchFieldException
	 *         if the field does not exists.
	 * @throws SecurityException
	 *         if the field is not accessible.
	 */
	@Before
	public void setUp () throws NoSuchFieldException, SecurityException {
		parser = new LongParser();
		fieldReference = LongParserTest.class.getDeclaredField("field");
		fieldReference.setAccessible(true);
	}

	/**
	 * Test method for {@link LongParser#getFieldType()}.
	 */
	@Test
	public void testGetFieldType () {
		assertEquals(long.class, parser.getFieldType());
	}

	/**
	 * Test method for {@link LongParser#parse(Object, Field, String)}.
	 */
	@Test
	public void testParse () {
		parser.parse(this, fieldReference, "123456789");
		assertEquals(123456789, field);
	}

	/**
	 * Test method for error cases of {@link LongParser#parse(Object, Field, String)}.
	 */
	@Test(expected = IllegalArgumentException.class)
	public void testParseIllegalArgument () {
		parser.parse(this, fieldReference, "1a82");
	}
}


text:
/*
 * File Layout for: SA.SA_TYPE on 21-May-01
 *
 * SA Type File
 */

#pragma member_alignment save
#pragma nomember_alignment

struct sa_type_cdd
{
/* Element =
   Description = Type */
	char ttype[2];
/* Element = DESCRIPTION5
   Description = Description */
	char descr[30];
};
#pragma member_alignment restore


text:
struct EventMetadataKey {
    GUID guid_;
    EVENT_DESCRIPTOR desc_;
};

struct EventMetadataKeyHash { size_t operator()(EventMetadataKey const& k) const; };
struct EventMetadataKeyEqual { bool operator()(EventMetadataKey const& lhs, EventMetadataKey const& rhs) const; };

enum PropertyStatus {
    PROP_STATUS_NOT_FOUND       = 0,
    PROP_STATUS_FOUND           = 1 << 0,
    PROP_STATUS_CHAR_STRING     = 1 << 1,
    PROP_STATUS_WCHAR_STRING    = 1 << 2,
    PROP_STATUS_NULL_TERMINATED = 1 << 3,
    PROP_STATUS_POINTER_SIZE    = 1 << 4,
};

struct EventDataDesc {
    wchar_t const* name_;   // Property name
    uint32_t arrayIndex_;   // Array index (optional)
    void* data_;            // OUT pointer to property data
    uint32_t size_;         // OUT size of property data
    uint32_t status_;       // OUT PropertyStatus result of search

    template<typename T> T GetData() const
    {
        assert(status_ & PROP_STATUS_FOUND);
        assert(data_ != nullptr);

        // Expect the correct size, except allow 32-bit pointer/size_t to promote to u64
        assert(
            size_ == sizeof(T) ||
            ((status_ & PROP_STATUS_POINTER_SIZE) != 0 && size_ == 4 && sizeof(T) == 8));

        T t {};
        memcpy(&t, data_, size_);
        return t;
    }
};

template<> std::string EventDataDesc::GetData<std::string>() const;
template<> std::wstring EventDataDesc::GetData<std::wstring>() const;

struct EventMetadata {
    std::unordered_map<EventMetadataKey, std::vector<uint8_t>, EventMetadataKeyHash, EventMetadataKeyEqual> metadata_;

    void AddMetadata(EVENT_RECORD* eventRecord);
    void GetEventData(EVENT_RECORD* eventRecord, EventDataDesc* desc, uint32_t descCount, uint32_t optionalCount=0);

    template<typename T> T GetEventData(EVENT_RECORD* eventRecord, wchar_t const* name, uint32_t arrayIndex = 0)
    {
        EventDataDesc desc = { name, arrayIndex, };
        GetEventData(eventRecord, &desc, 1);
        return desc.GetData<T>();
    }
};


text:
require "rubycas-strategy-token/version"
require "sequel"
require "addressable/uri"

module CASServer
  module Strategy
    module Token
      class Worker
        def initialize(config)
          raise "Expecting config" unless config.is_a?(::Hash)

          @config = config
          @connection = Sequel.connect(config['database'])
          @dataset = @connection.from config['user_table']
        end

        def match(token)
          return false if token.nil? || token.empty? # this should never happen, but what the hell, we're talking about authentication here
          matcher = @dataset.where(@config['token_column'].to_sym => token)
          matcher = matcher.filter("`#{@config['expire_column']}` >= ?", DateTime.now) if @config['expire_column']
          raise "Multiple matches, database tainted" if matcher.count > 1
          match = matcher.first
          matcher.update(@config['token_column'].to_sym => nil)
          match
        end
      end

      def self.registered(app)
        settings = app.workhorse

        app.set :token_worker, Worker.new(settings)

        app.get "#{app.uri_path}/auth/token/:token" do
          if match = app.settings.token_worker.match(params[:token])
            establish_session! match[:email], session["service"]
          end

          # Redirect to login page if we're still here. Preserve service and renew data
          redirector = Addressable::URI.new
          redirector.query_values = {
              :service => session[:service],
              :renew => session[:renew]
          }.delete_if{|_,v| v.nil? || v.empty?}
          redirector.path = "#{app.uri_path}/login"
          redirect to(redirector.to_s), 303
        end
      end
    end
  end
end


text:
            Operations

            Status

            Feed

 #{.Name}#

 Operations

                        Name

                        Session

                                <button type="button" nunchi-op="session"
                                        class="nunchi-op btn btn-success btn-gradient"></button>

                        Turn Off

                                <button type="button" nunchi-op="off"
                                        class="nunchi-op btn btn-success btn-gradient"></button>


text:
require 'rspec/core'

describe 'permit_all_actions matcher' do
  subject { policy_class.new }

  context 'no actions are specified' do
    let(:policy_class) { Class.new }

    it { is_expected.to permit_all_actions }
  end

  context 'one action is permitted' do
    let(:policy_class) do
      Class.new do
        def test?
          true
        end
      end
    end

    it { is_expected.to permit_all_actions }
  end

  context 'more than one action is specified' do
    context 'test1? and test2? are permitted' do
      let(:policy_class) do
        Class.new do
          def test1?
            true
          end

          def test2?
            true
          end
        end
      end

      it { is_expected.to permit_all_actions }
    end

    context 'test1? is permitted, test2? is forbidden' do
      let(:policy_class) do
        Class.new do
          def test1?
            true
          end

          def test2?
            false
          end
        end
      end

      it { is_expected.not_to permit_all_actions }
    end

    context 'test1? is forbidden, test2? is permitted' do
      let(:policy_class) do
        Class.new do
          def test1?
            false
          end

          def test2?
            true
          end
        end
      end

      it { is_expected.not_to permit_all_actions }
    end

    context 'test1? and test2? are both forbidden' do
      let(:policy_class) do
        Class.new do
          def test1?
            false
          end

          def test2?
            false
          end
        end
      end

      it { is_expected.not_to permit_all_actions }
    end
  end
end


text:
package com.sksamuel.elastic4s.searches.aggs

import org.elasticsearch.script.Script
import org.elasticsearch.search.aggregations.AggregationBuilders
import org.elasticsearch.search.aggregations.bucket.range.date.DateRangeAggregationBuilder

case class GeoBoundsAggregationDefinition(name: String)
  extends AggregationDefinition {

  type B = DateRangeAggregationBuilder
  val builder: B = AggregationBuilders.dateRange(name)

  def script(script: Script): GeoBoundsAggregationDefinition = {
    builder.script(script)
    this
  }

  def addRange(from: Double, to: Double): GeoBoundsAggregationDefinition = {
    builder.addRange(from, to)
    this
  }

  def addUnboundedTo(to: Double): GeoBoundsAggregationDefinition = {
    builder.addUnboundedTo(to)
    this
  }

  def addUnboundedFrom(from: Double): GeoBoundsAggregationDefinition = {
    builder.addUnboundedFrom(from)
    this
  }

  def field(field: String) = {
    builder.field(field)
    this
  }
}


text:
namespace Microsoft.Azure.Management.DataFactory.Models
{
    using Microsoft.Rest;
    using Microsoft.Rest.Serialization;
    using Newtonsoft.Json;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>
    /// Azure PostgreSQL linked service.
    /// </summary>
    [Newtonsoft.Json.JsonObject("AzurePostgreSql")]
    [Rest.Serialization.JsonTransformation]
    public partial class AzurePostgreSqlLinkedService : LinkedService
    {
        /// <summary>
        /// Initializes a new instance of the AzurePostgreSqlLinkedService
        /// class.
        /// </summary>
        public AzurePostgreSqlLinkedService()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the AzurePostgreSqlLinkedService
        /// class.
        /// </summary>
        /// <param name="additionalProperties">Unmatched properties from the
        /// message are deserialized this collection</param>
        /// <param name="connectVia">The integration runtime reference.</param>
        /// <param name="description">Linked service description.</param>
        /// <param name="connectionString">An ODBC connection string.</param>
        /// <param name="encryptedCredential">The encrypted credential used for
        /// authentication. Credentials are encrypted using the integration
        /// runtime credential manager. Type: string (or Expression with
        /// resultType string).</param>
        public AzurePostgreSqlLinkedService(IDictionary<string, object> additionalProperties = default(IDictionary<string, object>), IntegrationRuntimeReference connectVia = default(IntegrationRuntimeReference), string description = default(string), SecretBase connectionString = default(SecretBase), object encryptedCredential = default(object))
            : base(additionalProperties, connectVia, description)
        {
            ConnectionString = connectionString;
            EncryptedCredential = encryptedCredential;
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets or sets an ODBC connection string.
        /// </summary>
        [JsonProperty(PropertyName = "typeProperties.connectionString")]
        public SecretBase ConnectionString { get; set; }

        /// <summary>
        /// Gets or sets the encrypted credential used for authentication.
        /// Credentials are encrypted using the integration runtime credential
        /// manager. Type: string (or Expression with resultType string).
        /// </summary>
        [JsonProperty(PropertyName = "typeProperties.encryptedCredential")]
        public object EncryptedCredential { get; set; }

        /// <summary>
        /// Validate the object.
        /// </summary>
        /// <exception cref="ValidationException">
        /// Thrown if validation fails
        /// </exception>
        public override void Validate()
        {
            base.Validate();
        }
    }
}


text:
package com.joelapenna.foursquared;

import android.accounts.Account;
import android.app.Service;
import android.content.*;
import android.os.Bundle;
import android.os.IBinder;

public class ContactsSyncService extends Service {

    private static final Object sSyncAdapterLock = new Object();
    private static ContactsSyncAdapter sSyncAdapter = null;

    @Override
    public void onCreate() {
        synchronized(sSyncAdapterLock) {
            if (sSyncAdapter == null) {
                sSyncAdapter = new ContactsSyncAdapter((Foursquared)getApplication(), getApplication(), true);
            }
        }
    }

    @Override
    public IBinder onBind(Intent intent) {
        return sSyncAdapter.getSyncAdapterBinder();
    }

    final private class ContactsSyncAdapter extends AbstractThreadedSyncAdapter {

        final private Foursquared mFoursquared;

        public ContactsSyncAdapter(Foursquared foursquared, Context context, boolean autoInitialize) {
            super(context, autoInitialize);
            mFoursquared = foursquared;
        }

        @Override
        public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider,
                SyncResult syncResult) {
            mFoursquared.getSync().syncFriends(account);
        }
    }
}