text:
using blink::WebMIDIPermissionRequest;
using blink::WebSecurityOrigin;

namespace content {

MidiDispatcher::MidiDispatcher(RenderFrame* render_frame)
    : RenderFrameObserver(render_frame) {
}

MidiDispatcher::~MidiDispatcher() {}

void MidiDispatcher::requestSysexPermission(
      const WebMIDIPermissionRequest& request) {
  if (!permission_service_.get()) {
    render_frame()->GetServiceRegistry()->ConnectToRemoteService(
        &permission_service_);
  }

  int permission_request_id =
      requests_.Add(new WebMIDIPermissionRequest(request));

  permission_service_->RequestPermission(
      PERMISSION_NAME_MIDI_SYSEX,
      request.securityOrigin().toString().utf8(),
      blink::WebUserGestureIndicator::isProcessingUserGesture(),
      base::Bind(&MidiDispatcher::OnSysExPermissionSet,
                 base::Unretained(this),
                 permission_request_id));
}

void MidiDispatcher::cancelSysexPermissionRequest(
    const WebMIDIPermissionRequest& request) {
  for (Requests::iterator it(&requests_); !it.IsAtEnd(); it.Advance()) {
    WebMIDIPermissionRequest* value = it.GetCurrentValue();
    if (!value->equals(request))
      continue;
    requests_.Remove(it.GetCurrentKey());
    break;
  }
}

void MidiDispatcher::OnSysExPermissionSet(int request_id,
                                          PermissionStatus status) {
  // |request| can be NULL when the request is canceled.
  WebMIDIPermissionRequest* request = requests_.Lookup(request_id);
  if (!request)
    return;
  request->setIsAllowed(status == PERMISSION_STATUS_GRANTED);
  requests_.Remove(request_id);
}

}  // namespace content


text:
package io.renren.service.impl;

import io.renren.dao.YlOrganizationDao;
import io.renren.entity.YlOrganizationEntity;
import io.renren.service.YlOrganizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;

@Service("ylOrganizationService")
public class YlOrganizationServiceImpl implements YlOrganizationService {
	@Autowired
	private YlOrganizationDao ylOrganizationDao;

	@Override
	public void save(YlOrganizationEntity org) {
		ylOrganizationDao.save(org);
	}

	@Override
	public void update(YlOrganizationEntity org) {
		ylOrganizationDao.update(org);
	}

	@Override
	public void deleteBatch(Integer[] ids) {
		ylOrganizationDao.deleteBatch(ids);
	}

	@Override
	public List<YlOrganizationEntity> queryList(Map<String, Object> map) {
		return ylOrganizationDao.queryList(map);
	}

	@Override
	public int queryTotal(Map<String, Object> map) {
		return ylOrganizationDao.queryTotal(map);
	}

	@Override
	public YlOrganizationEntity queryObject(Integer id) {
		return ylOrganizationDao.queryObject(id);
	}
}

redpajama_set_name: RedPajamaGithub


text:
package com.innovatian.idea.powershell;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.fileTypes.FileTypeConsumer;
import com.intellij.openapi.fileTypes.FileTypeFactory;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.fileTypes.LanguageFileType;
import org.jetbrains.annotations.NotNull;

public class PsFileTypeLoader extends FileTypeFactory {
    public void createFileTypes(@NotNull FileTypeConsumer consumer) {
        consumer.consume(PsFileType.PS_FILE_TYPE, PsFileType.DEFAULT_EXTENSION);
    }
}


text:
package org.nbone.persistence;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.nbone.persistence.annotation.FieldLevel;
import org.nbone.persistence.annotation.FieldProperty;

/**
 * This class  was database table entity mapping (ORM)
 * @author thinking
 * @since 2016-06-16
 */
@Entity
@Table(name="ts_project")
public class TsProjectDTO implements Serializable {
    /**
     * ts_project.id id
     */
    @Id
    @GeneratedValue(generator="id")
    @Column(name="id")
    private Long id;

    /**
     * ts_project.type_id 项目类型ID
     */
    @Column(name="type_id")
    private Integer typeId;

    /**
     * ts_project.name 服务项目名称
     */
    @FieldProperty(FieldLevel.ONE)
    @Column(name="name")
    private String name;

    /**
     * ts_project.code 服务项目编码
     */
    @Column(name="code")
    private String code;

    /**
     * ts_project.sort 服务项目排序
     */
    @Column(name="sort")
    private Integer sort;

    /**
     * ts_project.is_enable 是否启用
     */
    @Column(name="is_enable")
    private Boolean isEnable;

    /**
     * ts_project.is_open 是否展开
     */
    @Column(name="is_open")
    private Boolean isOpen;

    /**
     * ts_project.create_dt 创建时间
     */
    @Column(name="create_dt")
    private Date createDt;

    /**
     * ts_project.create_by 创建者
     */
    @Column(name="create_by")
    private Long createBy;

    /**
     * ts_project.modify_dt 修改时间
     */
    @Column(name="modify_dt")
    private Date modifyDt;

    /**
     * ts_project.modify_by 修改者
     */
    @Column(name="modify_by")
    private Long modifyBy;

    /**
     * ts_project.del_flag del_flag(0:正常,1:删除)
     */
    @Column(name="del_flag")
    private Boolean delFlag;

    /**
     * ts_project.remark 备注
     */
    @Column(name="remark")
    private String remark;

    private static final long serialVersionUID = 1L;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getTypeId() {
        return typeId;
    }

    public void setTypeId(Integer typeId) {
        this.typeId = typeId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code == null ? null : code.trim();
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Boolean getIsEnable() {
        return isEnable;
    }

    public void setIsEnable(Boolean isEnable) {
        this.isEnable = isEnable;
    }

    public Boolean getIsOpen() {
        return isOpen;
    }

    public void setIsOpen(Boolean isOpen) {
        this.isOpen = isOpen;
    }

    public Date getCreateDt() {
        return createDt;
    }

    public void setCreateDt(Date createDt) {
        this.createDt = createDt;
    }

    public Long getCreateBy() {
        return createBy;
    }

    public void setCreateBy(Long createBy) {
        this.createBy = createBy;
    }

    public Date getModifyDt() {
        return modifyDt;
    }

    public void setModifyDt(Date modifyDt) {
        this.modifyDt = modifyDt;
    }

    public Long getModifyBy() {
        return modifyBy;
    }

    public void setModifyBy(Long modifyBy) {
        this.modifyBy = modifyBy;
    }

    public Boolean getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(Boolean delFlag) {
        this.delFlag = delFlag;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark == null ? null : remark.trim();
    }
}


text:
<!DOCTYPE html>

    <title>substation:Action#run documentation</title>
    <link rel="stylesheet" type="text/css" href="../../../../../../index.css" />
    <link rel="stylesheet" type="text/css" href="../../../../../../highlight.css" />

            member

                Function

                |

                :substation:Action#run

Arguments

                    station

                    agent

                    request

                    reply

                    run (

            |
            substation

            station

    ,

            |
            submergence:Agent

            |
            substation:RemoteAgent

            agent

    ,

            |
            submergence:Request

            request

    ,

            |
            submergence:Reply

            reply

    ,

                    ) {

Try to perform this Action as a given Agent using a particular Request and wrap the result in a Reply.. Subject to immediate failure conditions
if the body or query fail schema
validation, if the agent is not sufficiently authenticated,
if the body's content-type is not acceptable, or if the reaction
Function synchronously throws an Error. Error conditions are routed through the templates
by the http codes 403 and 406.

Arguments

            |
            substation

            station

The substation instance managing this request.

            |
            submergence:Agent

            |
            substation:RemoteAgent

            agent

Authentication manager for the requesting user and their device. Used to view or change the
User's login status.

            |
            submergence:Request

            request

Details of the request. The request Object is consistent across network transports to help
similar requests be holistically similar.

            |
            submergence:Reply

            reply

Return a JSON body document associated with the request, automatically rendered by templates
when required, and/or emit events on the client device that are not associated with the request
in any way. Events emitted by a reply are not distinct from those produced by
station.sendEvent.

        This document was generated with
        doczar
        at 3:55pm on 8/14/2015


text:
import logging
from typing import Dict

from tests.functional.services.catalog.utils.api import objects
from tests.functional.services.utils import http_utils

def add_or_replace_document(bucket: str, archiveid: str, object: Dict) -> None:
    """
    Deletes document from object store if it exists before inserting it.
    :param bucket: bucket name
    :type bucket: str
    :param archiveid: archive ID
    :type archiveid: str
    :param object: object to insert
    :type object: Dict
    """
    try:
        objects.delete_document(bucket, archiveid)
    except http_utils.RequestFailedError as err:
        logging.error(err)
    objects.add_document(bucket, archiveid, object)


text:
from django.db import models
from cyder.cydhcp.group.models import Group

class Group_Option( models.Model ):
    #TODO Hard code all options? Stick in option_choices?
    id              = models.AutoField(primary_key=True)
    option          = models.CharField(max_length=500)
    groups           = models.ManyToManyField(Group)

    class Meta:
        db_table = 'group_option'


text:
'use strict';

var CrudStore = require('../lib/index').Store;
var CrudStoreActions = require('../lib/index').Actions;
var Record = require('immutable').Record;
var Collection = require('backbone').Collection;

var chai = require('chai');
chai.use(require('dirty-chai'));
var expect = chai.expect;
var sinon = require('sinon');
chai.use(require('sinon-chai'));

var Backbone = require('backbone');

describe('crud_store_actions', function () {
  var store;
  var actions;
  var ViewModel;
  var ModelCollection;

  beforeEach(function () {
    ViewModel = Record({ id: null, value: '' });
    ModelCollection = Collection.extend({ url: '/models' });
    store = CrudStore.extend({
      viewModel: ViewModel,
      collection: ModelCollection
    }).instance();
    actions = CrudStoreActions.boundTo(store);

    Backbone.ajax = sinon.stub();
  });

  describe('#create', function () {
    beforeEach(function () {
      actions.create({ id: 77 });
    });

    it('creates a new model with the attributes', function () {
      expect(store.get(77).id).equal(77);
    });

    it('does not make a server call', function () {
      expect(Backbone.ajax).not.to.have.been.called();
    });
  });

  describe('#createAndSave', function () {
    beforeEach(function () {
      actions.createAndSave({ value: 'new value' });
    });

    it('issues a server call', function () {
      expect(Backbone.ajax).to.have.been.called();
      expect(Backbone.ajax.getCall(0).args[0].url).to.equal('/models');
      expect(Backbone.ajax.getCall(0).args[0].type).to.equal('POST');

      var data = global.JSON.parse(Backbone.ajax.getCall(0).args[0].data);
      expect(data).to.deep.equal({ value: 'new value' });
    });
  });

  describe('#update', function () {
    beforeEach(function () {
      actions.create({ id: 77 });
      actions.update(77, { value: 'new value' });
    });

    it('updates the specified model with the attributes', function () {
      expect(store.get(77).value).equal('new value');
    });

    it('does not make a server call', function () {
      expect(Backbone.ajax).not.to.have.been.called();
    });

    it('throws an error if model does not exist', function () {
      expect(function () {
        actions.update(7, { value: 'new value' });
      }).to.throw('Cannot call update action with id: 7');
    });
  });

  describe('#updateAndSave', function () {
    beforeEach(function () {
      actions.create({ id: 77 });
      actions.updateAndSave(77, { value: 'new value' });
    });

    it('makes a server call', function () {
      expect(Backbone.ajax).to.have.been.called();
      expect(Backbone.ajax.getCall(0).args[0].url).to.equal('/models/77');
      expect(Backbone.ajax.getCall(0).args[0].type).to.equal('PUT');

      var data = global.JSON.parse(Backbone.ajax.getCall(0).args[0].data);
      expect(data).to.deep.equal({ id: 77, value: 'new value' });
    });

    it('throws an error if model does not exist', function () {
      expect(function () {
        actions.updateAndSave(7, { value: 'new value' });
      }).to.throw('Cannot call updateAndSave action with id: 7');
    });
  });

  describe('#destroy', function () {
    beforeEach(function () {
      actions.create({ id: 77 });
      actions.destroy(77);
    });

    it('destroys model from storage', function () {
      expect(store.get(77)).be.null();
    });

    it('does not make a server call', function () {
      expect(Backbone.ajax).not.to.have.been.called();
    });

    it('throws an error if model does not exist', function () {
      expect(function () {
        actions.destroy(7);
      }).to.throw('Cannot call destroy action with id: 7');
    });
  });

  describe('#destroyAndSave', function () {
    beforeEach(function () {
      actions.create({ id: 77 });
      actions.destroyAndSave(77);
    });

    it('makes a server call', function () {
      expect(Backbone.ajax).to.have.been.called();
      expect(Backbone.ajax.getCall(0).args[0].url).to.equal('/models/77');
      expect(Backbone.ajax.getCall(0).args[0].type).to.equal('DELETE');
    });

    it('throws an error if model does not exist', function () {
      expect(function () {
        actions.destroyAndSave(7);
      }).to.throw('Cannot call destroyAndSave action with id: 7');
    });
  });

  describe('#save', function () {
    beforeEach(function () {
      actions.create({ id: 77, value: 'new value' });
      actions.save(77);
    });

    it('makes a server call', function () {
      expect(Backbone.ajax).to.have.been.called();
      expect(Backbone.ajax.getCall(0).args[0].url).to.equal('/models/77');
      expect(Backbone.ajax.getCall(0).args[0].type).to.equal('PUT');

      var data = global.JSON.parse(Backbone.ajax.getCall(0).args[0].data);
      expect(data).to.deep.equal({ id: 77, value: 'new value' });
    });

    it('throws an error if model does not exist', function () {
      expect(function () {
        actions.save(7);
      }).to.throw('Cannot call save action with id: 7');
    });
  });

  describe('#load', function () {
    it('loads in models', function () {
      actions.load({ id: 77, value: 'new value' });
      expect(store.get(77).value).to.equal('new value');
    });
  });

  describe('#fetch', function () {
    beforeEach(function () {
      actions.fetch(8);
    });

    it('throws an error if a collection does not have url', function () {
      store = CrudStore.extend({ viewModel: ViewModel }).instance();
      actions = CrudStoreActions.boundTo(store);
      expect(function () {
        actions.fetch(8);
      }).to.throw('fetch action requires \'url\' to be set');
    });

    it('makes get return a loading response', function () {
      expect(store.get(8).isLoading).be.true();
    });

    it('issues a server call', function () {
      expect(Backbone.ajax).to.have.been.called();
      expect(Backbone.ajax.getCall(0).args[0].url).to.equal('/models/8');
    });

    it('makes get() return the view model on success', function () {
      Backbone.ajax.getCall(0).args[0].success({ id: 8 });
      expect(store.get(8).id).to.equal(8);
    });

    it('grabs the existing model when necessary', function () {
      actions.create({ id: 77 });
      actions.fetch(77);
      expect(Backbone.ajax.getCall(1).args[0].url).to.equal('/models/77');
    });
  });

  describe('#fetchAll', function () {
    it('throws an error if a collection does not have url', function () {
      store = CrudStore.extend({ viewModel: ViewModel }).instance();
      actions = CrudStoreActions.boundTo(store);
      expect(function () {
        actions.fetchAll();
      }).to.throw('fetchAll action requires \'url\' to be set');
    });

    it('makes get() return a loading response', function () {
      actions.fetchAll();
      expect(store.get(8).isLoading).be.true();
    });

    it('makes getAll() return a loading response', function () {
      actions.fetchAll();
      expect(store.getAll().isLoading).be.true();
    });

    it('makes getAll() return the view model iterable on success', function () {
      actions.fetchAll();
      Backbone.ajax.getCall(0).args[0].success([{ id: 8 }]);
      expect(store.getAll().first().id).to.equal(8);
    });
  });
});


text:
package com.github.staslev.storm.metrics.yammer;

import com.yammer.metrics.core.Gauge;

public class SettableGauge<T> extends Gauge<T> {

    protected volatile T value;

    public SettableGauge(T value) {
        this.value = value;
    }

    public void setValue(T value) {
        this.value = value;
    }

    @Override
    public T value() {
        return value;
    }
}


text:
local common = require('test_scripts/API/VehicleData/common')

--[[ Local Constants ]]
local testTypes = {
  common.testType.MANDATORY_ONLY,
  common.testType.MANDATORY_MISSING
}

--[[ Scenario ]]
common.runner.Title("Preconditions")
common.runner.Step("Clean environment and update preloaded_pt file", common.preconditions)
common.runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
common.runner.Step("Register App", common.registerApp)
common.runner.Step("Activate App", common.activateApp)

common.runner.Title("Test")
common.runner.getTestsForGetVD(testTypes)

common.runner.Title("Postconditions")
common.runner.Step("Stop SDL", common.postconditions)


text:
namespace content {

// This class is exposed in JS as window.statsCollectionController and provides
// functionality to read out statistics from the browser.
// Its use must be enabled specifically via the
// --enable-stats-collection-bindings command line flag.
class StatsCollectionController : public webkit_glue::CppBoundClass {
 public:
  StatsCollectionController();

  void set_message_sender(IPC::Sender* sender) {
    sender_ = sender;
  }

  // Retrieves a histogram and returns a JSON representation of it.
  void GetHistogram(const webkit_glue::CppArgumentList& args,
                    webkit_glue::CppVariant* result);

  // Retrieves a histogram from the browser process and returns a JSON
  // representation of it.
  void GetBrowserHistogram(const webkit_glue::CppArgumentList& args,
                           webkit_glue::CppVariant* result);

  // Returns JSON representation of tab timing information for the current tab.
  void GetTabLoadTiming(const webkit_glue::CppArgumentList& args,
                        webkit_glue::CppVariant* result);
 private:
  IPC::Sender* sender_;
};

}  // namespace content

#endif  // CONTENT_RENDERER_STATS_COLLECTION_CONTROLLER_H_


text:
package org.cethos.tools.ninebatch.tests.tasks;

import org.cethos.tools.ninebatch.tasks.io.StreamProvider;

import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.OutputStream;

public class ResourceStreamProvider implements StreamProvider
{
    private final String basePath;
    private int totalOutputStreamAccessCount;
    private int totalInputStreamAccessCount;

    public ResourceStreamProvider(final String basePath)
    {
        this.basePath = basePath;
    }

    @Override
    public OutputStream getOutputStreamFor(final String fileName) throws FileNotFoundException
    {
        ++totalOutputStreamAccessCount;
        return new ByteArrayOutputStream();
    }

    @Override
    public InputStream getInputStreamFor(final String fileName) throws FileNotFoundException
    {
        ++totalInputStreamAccessCount;

        final InputStream stream = getClass().getResourceAsStream(basePath + "/" + fileName);
        if(stream == null)
        {
            throw new FileNotFoundException("File not found: " + fileName);
        }
        else
        {
            return stream;
        }
    }

    public int getTotalOutputStreamAccessCount()
    {
        return totalOutputStreamAccessCount;
    }

    public int getTotalInputStreamAccessCount()
    {
        return totalInputStreamAccessCount;
    }
}


text:
require 'spec_helper'
require 'pact/matchers/unexpected_key'

module Pact
  describe UnexpectedKey do

    describe "#as_json" do
      it "returns a string representation of the object" do
        expect(subject.as_json).to eq subject.to_s
      end
    end

    describe "#to_json" do
      it "serialises the object to JSON" do
        expect(subject.to_json).to eq "\"#{subject.to_s}\""
      end
    end

  end
end


text:
#pragma once

#ifndef GEODE_DISTRIBUTEDSYSTEM_H_
#define GEODE_DISTRIBUTEDSYSTEM_H_

/**
 * @file
 */
#include <memory>

#include <geode/ExceptionTypes.hpp>
#include <geode/Properties.hpp>
#include <geode/internal/geode_globals.hpp>

namespace apache {
namespace geode {

namespace statistics {
class StatisticsManager;
}  // namespace statistics

namespace client {
/**
 * @class DistributedSystem DistributedSystem.hpp
 * DistributedSystem encapsulates this applications "connection" into the
 * Geode Java servers distributed system. In order to participate in the
 * Geode Java servers distributed system, each application needs to connect to
 * the DistributedSystem.
 * Each application can only be connected to one DistributedSystem.
 */
class SystemProperties;
class DistributedSystemImpl;
class CacheRegionHelper;

class APACHE_GEODE_EXPORT DistributedSystem {
  /**
   * @brief public methods
   */
 public:
  DistributedSystem() = delete;
  ~DistributedSystem() noexcept;
  DistributedSystem(const DistributedSystem&) = delete;
  DistributedSystem& operator=(const DistributedSystem&) = delete;
  DistributedSystem(DistributedSystem&&);
  DistributedSystem& operator=(DistributedSystem&&) = delete;

  /**
   * Initializes the Native Client system to be able to connect to the
   * Geode Java servers. If the name string is empty, then the default
   * "NativeDS" is used as the name of distributed system.
   * @throws IllegalStateException if GEODE_NATIVE_HOME variable is not set and
   *   product installation directory cannot be determined
   **/
  static DistributedSystem create(
      const std::string& name,
      const std::shared_ptr<Properties>& configPtr = nullptr);

  /**
   * @brief connects from the distributed system
   * @throws AlreadyConnectedException if this call has succeeded once before
   */
  void connect();

  /**
   * @brief disconnect from the distributed system
   * @throws IllegalStateException if not connected
   */
  void disconnect();

  /** Returns the SystemProperties that were used to create this instance of the
   *  DistributedSystem
   *  @return  SystemProperties
   */
  SystemProperties& getSystemProperties() const;

  /** Returns the name that identifies the distributed system instance
   * @return  name
   */
  const std::string& getName() const;

 protected:
  /**
   * @brief constructors
   */
  DistributedSystem(const std::string& name,
                    std::unique_ptr<SystemProperties> sysProps);

 private:
  std::unique_ptr<DistributedSystemImpl> m_impl;

  friend class CacheRegionHelper;
  friend class DistributedSystemImpl;
};
}  // namespace client
}  // namespace geode
}  // namespace apache

#endif  // GEODE_DISTRIBUTEDSYSTEM_H_


text:
using base::android::JavaParamRef;
using base::android::ScopedJavaLocalRef;

namespace infobars {

ConfirmInfoBar::ConfirmInfoBar(std::unique_ptr<ConfirmInfoBarDelegate> delegate)
    : InfoBarAndroid(std::move(delegate)) {}

ConfirmInfoBar::~ConfirmInfoBar() = default;

std::u16string ConfirmInfoBar::GetTextFor(
    ConfirmInfoBarDelegate::InfoBarButton button) {
  ConfirmInfoBarDelegate* delegate = GetDelegate();
  return (delegate->GetButtons() & button) ? delegate->GetButtonLabel(button)
                                           : std::u16string();
}

ConfirmInfoBarDelegate* ConfirmInfoBar::GetDelegate() {
  return delegate()->AsConfirmInfoBarDelegate();
}

ScopedJavaLocalRef<jobject> ConfirmInfoBar::CreateRenderInfoBar(
    JNIEnv* env,
    const ResourceIdMapper& resource_id_mapper) {
  ScopedJavaLocalRef<jstring> ok_button_text =
      base::android::ConvertUTF16ToJavaString(
          env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_OK));
  ScopedJavaLocalRef<jstring> cancel_button_text =
      base::android::ConvertUTF16ToJavaString(
          env, GetTextFor(ConfirmInfoBarDelegate::BUTTON_CANCEL));
  ConfirmInfoBarDelegate* delegate = GetDelegate();
  ScopedJavaLocalRef<jstring> message_text =
      base::android::ConvertUTF16ToJavaString(env, delegate->GetMessageText());
  ScopedJavaLocalRef<jstring> link_text =
      base::android::ConvertUTF16ToJavaString(env, delegate->GetLinkText());

  ScopedJavaLocalRef<jobject> java_bitmap;
  if (delegate->GetIconId() == infobars::InfoBarDelegate::kNoIconID &&
      !delegate->GetIcon().IsEmpty()) {
    java_bitmap = gfx::ConvertToJavaBitmap(
        *delegate->GetIcon().Rasterize(nullptr).bitmap());
  }

  return Java_ConfirmInfoBar_create(
      env, resource_id_mapper.Run(delegate->GetIconId()), java_bitmap,
      message_text, link_text, ok_button_text, cancel_button_text);
}

void ConfirmInfoBar::OnLinkClicked(JNIEnv* env,
                                   const JavaParamRef<jobject>& obj) {
  if (!owner())
    return;  // We're closing; don't call anything, it might access the owner.

  if (GetDelegate()->LinkClicked(WindowOpenDisposition::NEW_FOREGROUND_TAB))
    RemoveSelf();
}

void ConfirmInfoBar::ProcessButton(int action) {
  if (!owner())
    return;  // We're closing; don't call anything, it might access the owner.

  DCHECK((action == InfoBarAndroid::ACTION_OK) ||
         (action == InfoBarAndroid::ACTION_CANCEL));
  ConfirmInfoBarDelegate* delegate = GetDelegate();
  if ((action == InfoBarAndroid::ACTION_OK) ? delegate->Accept()
                                            : delegate->Cancel())
    RemoveSelf();
}

}  // namespace infobars


text:
module Garterbelt
  class View
    attr_accessor :output, :_buffer, :_level, :_escape, :block, :initialization_options, :render_style
    attr_reader :_curator

    def initialize(opts={}, &block)
      self.initialization_options =  opts
      self._buffer = []
      self._level =  initialization_options.delete(:_level) || 0
      self.render_style = initialization_options.delete(:style) || :pretty
      self.output = ""
      self._escape = true
      self.block = block if block_given?

      self._curator = initialization_options.delete(:_curator) || self

      params = self.class.default_variables.merge(opts)
      keys = params.keys

      unless (self.class.required - keys).empty?
        raise ArgumentError, "#{(self.class.required - keys).inspect} required as an initialization option"
      end

      if self.class.selective_require && keys != self.class.required
        raise ArgumentError, "Allowed initalization options are only #{self.class.required.inspect}"
      end

      params.each do |key, value|
        self.class.add_accessor(key) unless respond_to?(key)
        instance_variable_set "@#{key}", value
      end
    end

    def _curator=(parent_view)
      @_curator = parent_view
      if parent_view != self
        self._buffer = parent_view._buffer
        self._level = parent_view._level
        self.output = parent_view.output
        self._escape = parent_view._escape
        self.render_style = parent_view.render_style
      end
    end

    def curated?
      _curator === self
    end

    # VARIABLE ACCESS -----------------------------
    class << self
      attr_writer :required
      attr_accessor :selective_require
    end

    def self.required
      @required ||= []
    end

    def self.add_accessor key
      key = key.to_sym
      i_methods = instance_methods.first.is_a?(String) ? instance_methods.map{|m| m.to_sym} : instance_methods
      return if (accessories + i_methods).include?(key)
      accessories << key
      attr_accessor key
    end

    def self.accessories
      @accessories ||= superclass? ? superclass.accessories.dup : []
    end

    def self.superclass?
      @superclassed ||= superclass.respond_to?( :required )
    end

    def self.super_required
      superclass? ? superclass.required : []
    end

    def self.default_variables
      @default_variables ||= superclass? ? superclass.default_variables.dup : Hash.new
    end

    def self.requires *args
      if args.last.is_a?(Hash)
        self.default_variables.merge!(args.pop)
        args += default_variables.keys.map{ |x| x.to_sym }
      end

      args = super_required + args
      self.required += args.uniq
      build_accessors
      required
    end

    def self.requires_only(*args)
      self.selective_require = true
      requires(*args)
    end

    class << self
      alias :needs :requires
      alias :needs_only :requires_only
    end

    def self.build_accessors
      required.each do |m|
        add_accessor m
      end
    end

    # TAG HELPERS -----------------------

    def add_to_buffer(renderer)
      _buffer << renderer
      renderer
    end

    def tag(type, *args, &block)
      t = if block_given?
        ContentTag.new(parse_tag_arguments(type, args), &block)
      else
        ContentTag.new(parse_tag_arguments(type, args))
      end
      add_to_buffer t
    end

    def simple_tag(type, *args)
      add_to_buffer SimpleTag.new(parse_tag_arguments(type, args))
    end

    def non_escape_tag(*args, &block)
      if _escape
        _curator._escape = false
        t = block_given? ? tag(*args, &block) : tag(*args)
        _curator._escape = true
        t
      else
        block_given? ? tag(*args, &block) : tag(*args)
      end
    end

    def compact_tag(type, *args, &block)
      args << {} unless args.last.is_a?(Hash)
      args.last[:render_style] = :compact

      if block_given?
        tag(type, *args, &block)
      else
        tag(type, *args)
      end
    end

    def text(content)
      add_to_buffer Text.new(:view => _curator, :content => content)
    end

    alias :h :text

    def raw_text(content)
      if _escape
        _curator._escape = false
        t = text(content)
        _curator._escape = true
        t
      else
        text(content)
      end
    end
    alias :raw :raw_text
    alias :rawtext :raw_text

    def comment_tag(content)
      add_to_buffer Comment.new(:view => _curator, :content => content)
    end

    def doctype(type=:transitional)
      add_to_buffer Doctype.new(:view => _curator, :type => type)
    end

    def xml(opts={})
      opts = {:version => 1.0, :encoding => 'utf-8'}.merge(opts)
      add_to_buffer Xml.new(parse_tag_arguments(:xml, [opts]))
    end

    def parse_tag_arguments(type, args)
      opts = {:type => type, :view => _curator}
      if args.size == 2
        opts[:content] = args.shift
        opts[:attributes] = args.first
      else
        if args.first.is_a?(Hash)
          opts[:attributes] = args.first
        else
          opts[:content] = args.first
        end
      end
      opts[:render_style] = opts[:attributes].delete(:render_style) if opts[:attributes] && opts[:attributes][:render_style]
      opts
    end

    CONTENT_TAGS = [
      'abbr', 'acronym', 'address',
      'b', 'bdo', 'big', 'blockquote', 'body', 'button',
      'caption', 'center', 'cite', 'colgroup',
      'dd', 'del', 'dfn', 'div', 'dl', 'dt', 'em',
      'embed',
      'fieldset', 'form', 'frameset',
      'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'html', 'i',
      'iframe', 'ins', 'kbd', 'label', 'legend', 'li', 'map',
      'noframes', 'noscript',
      'object', 'ol', 'optgroup', 'option', 'p', 'param',
      'q', 's',
      'samp', 'select', 'small', 'span',
      'strong', 'sub', 'sup',
      'table', 'tbody', 'td', 'tfoot',
      'th', 'thead', 'tr', 'tt', 'u', 'ul', 'var'
    ]
    CONTENT_TAGS.each do |type|
      class_eval <<-RUBY
        def #{type}(*args, &block)
          block_given? ? tag(:#{type}, *args, &block) : tag(:#{type}, *args)
        end
      RUBY
    end

    NON_ESCAPE_TAGS = ['code', 'pre', 'script', 'style']
    NON_ESCAPE_TAGS.each do |type|
      class_eval <<-RUBY
        def #{type}(*args, &block)
          block_given? ? non_escape_tag(:#{type}, *args, &block) : non_escape_tag(:#{type}, *args)
        end
      RUBY
    end

    SIMPLE_TAGS = ['area', 'br', 'col', 'frame', 'hr', 'img', 'input']
    SIMPLE_TAGS.each do |type|
      class_eval <<-RUBY
        def #{type}(*args)
          simple_tag(:#{type}, *args)
        end
      RUBY
    end

    HEAD_TAGS = ['_base', '_meta', '_link']
    HEAD_TAGS.each do |type|
      class_eval <<-RUBY
        def #{type}(*args)
          simple_tag(:#{type}, *args)
        end
      RUBY
    end

    COMPACTED_TAGSS = ['textarea', 'a']
    COMPACTED_TAGSS.each do |type|
      class_eval <<-RUBY
        def #{type}(*args, &block)
          block_given? ? compact_tag(:#{type}, *args, &block) : compact_tag(:#{type}, *args)
        end
      RUBY
    end

    def page_title(*args, &block)
      block_given? ? tag(:title, *args, &block) : tag(:title, *args)
    end

    def stylesheet_link(path)
      _link(:rel => "stylesheet", 'type' => "text/css", :href => "#{path}.css")
    end

    def javascript_link(path)
      script(:src => "#{path}.js", 'type' => "text/javascript")
    end

    # RENDERING -------------------------

    def content
      raise NotImplementedError, "Implement #content in #{self.class}!"
    end

    class << self
      attr_writer :default_render_style, :default_content_method
    end

    def self.default_render_style
      @default_render_style ||= :pretty
    end

    def self.default_content_method
      @default_content_method ||= :content
    end

    def render(*args)
      if args.first.is_a?(Hash)
        initialization_options = args.shift
        content_method = initialization_options[:method]
      else
        content_method = args.shift
        initialization_options = args.shift || {}
      end

      content_method ||= self.class.default_content_method
      self.render_style = initialization_options[:style] || self.class.default_render_style

      self.output = "" if curated?

      if block
        send(content_method, &block)
      else
        send(content_method)
      end

      render_buffer
      output
    end

    alias :to_s :render
    alias :to_html :render

    def render_block
      return output unless block
      block.call
      render_buffer
      output
    end

    def call_block
      block.call if block
    end

    def render_buffer
      array = _buffer.dup
      _buffer.clear
      array.each do |item|
        if item.respond_to?(:render)
          item.render
        else
          output << item.to_s
        end
      end
    end

    def self.render(opts={}, &block)
      content_method = opts.delete(:method)
      view = block_given? ? new(opts, &block) : new(opts)
      output = content_method ? view.render(content_method) : view.render
      output
    end

    def partial(*args, &block)
      view = if (klass = args.first).is_a?(Class)
        args.shift
        partial_opts = args.shift || {}
        available_opts = self.class.default_variables.merge(initialization_options)
        opts = if klass.selective_require
          klass.required.each do |key|
            partial_opts[key] ||= available_opts[key]
          end
          partial_opts
        else
          available_opts.merge(partial_opts)
        end
        klass.new(opts)
      else
        args.first
      end
      view.block = block if block
      view._curator = _curator
      self._buffer << view
      view
    end

    alias :widget :partial

    # CACHING ---------------------------

    class << self
      attr_writer :cache_store_key, :cache_key_base
    end

    attr_writer :cache_store_key, :cache_key_base

    def self.cache_store_key
      @cache_store_key ||= :default
    end

    def cache_store_key
      @cache_store_key ||= self.class.cache_store_key
    end

    def cache_store
      @cache ||= Garterbelt.cache(cache_store_key)
    end

    def self.cache_key_base
      @cache_key_base ||= self.to_s.underscore
    end

    def cache_key_base
      @cache_key_base ||= self.class.cache_key_base
    end

    CACHE_DETAIL_DEFAULT = 'default'

    def cache_key(detail = CACHE_DETAIL_DEFAULT)
      detail ||= CACHE_DETAIL_DEFAULT
      "#{cache_key_base}_#{detail}"
    end

    def cache(key, opts={}, &block)
      opts = opts.merge(:key => cache_key(key), :view => _curator)
      add_to_buffer Cache.new(opts, &block)
    end
  end
end


text:
package org.gradle.initialization;

import org.gradle.StartParameter;
import org.gradle.api.internal.GradleInternal;
import org.gradle.api.internal.SettingsInternal;
import org.gradle.api.internal.initialization.ClassLoaderScope;
import org.gradle.caching.internal.controller.BuildCacheController;
import org.gradle.caching.internal.controller.RootBuildCacheControllerRef;

public class RootBuildCacheControllerSettingsProcessor implements SettingsProcessor {

    public static void process(GradleInternal gradle) {
        // The strategy for sharing build cache configuration across included builds in a composite,
        // requires that the cache configuration be finalized (and cache controller available)
        // before configuring them. This achieves that.
        if (gradle.isRootBuild()) {
            BuildCacheController rootController = gradle.getServices().get(BuildCacheController.class);
            RootBuildCacheControllerRef rootControllerRef = gradle.getServices().get(RootBuildCacheControllerRef.class);
            rootControllerRef.set(rootController);
        }
    }

    private final SettingsProcessor delegate;

    public RootBuildCacheControllerSettingsProcessor(SettingsProcessor delegate) {
        this.delegate = delegate;
    }

    @Override
    public SettingsInternal process(GradleInternal gradle, SettingsLocation settingsLocation, ClassLoaderScope buildRootClassLoaderScope, StartParameter startParameter) {
        SettingsInternal settings = delegate.process(gradle, settingsLocation, buildRootClassLoaderScope, startParameter);
        process(gradle);
        return settings;
    }
}


text:
<!--
  ~ Copyright 2017 The Bazel Authors. All rights reserved.
  ~
  ~ 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.
  -->
<idea-plugin>
  <extensions defaultExtensionNs="com.google.idea.blaze">
    <SyncPlugin implementation="com.google.idea.blaze.golang.sync.AlwaysPresentGoSyncPlugin"/>
    <TargetKindProvider implementation="com.google.idea.blaze.golang.GoBlazeRules"/>
  </extensions>
</idea-plugin>


text:
<?php
namespace Platformsh\Cli\Command\Environment;

use Platformsh\Cli\Command\CommandBase;
use Platformsh\Cli\Service\Ssh;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class EnvironmentSshCommand extends CommandBase
{
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this
            ->setName('environment:ssh')
            ->setAliases(['ssh'])
            ->addArgument('cmd', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'A command to run on the environment.')
            ->addOption('pipe', null, InputOption::VALUE_NONE, 'Output the SSH URL only.')
            ->addOption('all', null, InputOption::VALUE_NONE, 'Output all SSH URLs (for every app).')
            ->setDescription('SSH to the current environment');
        $this->addProjectOption()
             ->addEnvironmentOption()
             ->addRemoteContainerOptions();
        Ssh::configureInput($this->getDefinition());
        $this->addExample('Open a shell over SSH');
        $this->addExample('List files', 'ls');
        $this->addExample("Monitor the app log (use '--' before options)", 'tail /var/log/app.log -- -n50 -f');
        $envPrefix = $this->config()->get('service.env_prefix');
        $this->addExample('Display relationships (use quotes for complex syntax)', "'echo \${$envPrefix}RELATIONSHIPS | base64 --decode'");
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->validateInput($input);
        $environment = $this->getSelectedEnvironment();

        if ($input->getOption('all')) {
            $output->writeln(array_values($environment->getSshUrls()));

            return 0;
        }

        $container = $this->selectRemoteContainer($input);
        $sshUrl = $container->getSshUrl($input->getOption('instance'));

        if ($input->getOption('pipe')) {
            $output->write($sshUrl);
            return 0;
        }

        $remoteCommand = $input->getArgument('cmd');
        if (is_array($remoteCommand)) {
            $remoteCommand = implode(' ', $remoteCommand);
        }
        if (!$remoteCommand && $this->runningViaMulti) {
            throw new InvalidArgumentException('The cmd argument is required when running via "multi"');
        }

        /** @var \Platformsh\Cli\Service\Ssh $ssh */
        $ssh = $this->getService('ssh');
        $sshOptions = [];
        if ($this->isTerminal(STDIN)) {
            $sshOptions['RequestTTY'] = 'force';
        }
        $command = $ssh->getSshCommand($sshOptions, $sshUrl, $remoteCommand);

        /** @var \Platformsh\Cli\Service\Shell $shell */
        $shell = $this->getService('shell');

        $start = \time();

        $exitCode = $shell->executeSimple($command);
        if ($exitCode !== 0) {
            /** @var \Platformsh\Cli\Service\SshDiagnostics $diagnostics */
            $diagnostics = $this->getService('ssh_diagnostics');
            $diagnostics->diagnoseFailureWithTest($sshUrl, $start, $exitCode);
        }

        return $exitCode;
    }
}


text:
class PlayerGlobal
{
	static PlayerGlobal * ptr;

	unsigned int points;
public:

	static PlayerGlobal * getPtr();
	static void destroy();

	PlayerGlobal();
	~PlayerGlobal();

	unsigned int getPoints();
	void setPoints(unsigned int points);

	void reducePoints(unsigned int amount);
	void addPoints(unsigned int amount);

	void calculateAllPoints();
};


text:
==================

Full rework on the make for this website


text:
How to write tests for gqlgen
===

Testing generated code is a little tricky, heres how its currently set up.

### Testing responses from a server

There is a server in `codegen/testserver` that is generated as part
of `go generate ./...`, and tests written against it.

There are also a bunch of tests in against the examples, feel free to take examples from there.

### Testing the errors generated by the binary

These tests are **really** slow, because they need to run the whole codegen step. Use them very sparingly. If you can, find a way to unit test it instead.

Take a look at `codegen/testserver/input_test.go` for an example.

### Testing introspection

Introspection is tested by diffing the output of `graphql get-schema` against an expected output.

Setting up the integration environment is a little tricky:
```bash
cd integration
go generate ./...
go run ./server/server.go
```
in another terminal
```bash
cd integration
npm install
./node_modules/.bin/graphql-codegen
```

will write the schema to `integration/schema-fetched.graphql`, compare that with `schema-expected.graphql`

CI will run this and fail the build if the two files dont match.


text:
<?php

namespace LaravelColors\tests\stubs;

use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;

class TestServiceProvider extends ServiceProvider
{
    /**
     * Register any other events for your application.
     *
     * @param  \Illuminate\Contracts\Events\Dispatcher  $events
     * @return void
     */
    public function boot(DispatcherContract $events)
    {
        if (! $this->app->routesAreCached()) {
            require __DIR__.'/testRoute.php';
        }

        $this->app->router->group(['namespace' => 'LaravelColors\Http\Controllers'], function () {
            require __DIR__.'/testRoute.php';
        });

        $this->loadViewsFrom(__DIR__.'/../../src/resources/views', 'laravel-colors');

        $this->mergeConfigFrom(__DIR__.'/config.php', 'laravel-colors');
    }

    /**
     * Register bindings in the container.
     *
     * @return void
     */
    public function register()
    {

    }

}


text:
import { PaymentHighwayUtility } from '../../PaymentHighwayUtility';

export class Request {
    public requestId: string;

    constructor() {
        this.requestId = PaymentHighwayUtility.createRequestId();
    }
}


text:
import { isFunction } from './utils/utils';
import Vue, { VueConstructor } from 'vue';
import decorators from './decorators'

/**
 * Static functions for testing page permissions and firing the ready page function
 * @class
 */
class PageHelper
{
    /**
     * Check if exists then Fire Page.ready()
     * @function pageReady
     * @param {Page} page - Page class
     * @static
     */
    static pageReady(page: Page)
    {
        if (isFunction(page.ready))
        {
            page.ready();
        }
    }
}

/**
 * Creates the Page class to extend Vue. Adds routeName, pageName, permissions and everflowPageLoadChange()
 * @class Page
 */
@decorators.Component({})
class Page extends Vue
{
    ready()
    {

    }
}

/**
 * Adds support for permisisons and triggering ready function
 * @mixin
 * @mixes Vue
 */
var mixIns: object = {
    $refs: '',
    created()
    {
        // document.getElementById(this.$app.config.mountId).className += ` ${this.pageName}-everflow-page`;
    },
    mounted()
    {
        this.$app.readyPermission = true;
        PageHelper.pageReady(this);
        // document.title = this.pageName;
    }
}
export default Page.extend({ mixins: [mixIns] }) as VueConstructor;


text:
using Newtonsoft.Json;
using System.Net.Http;
using System.Collections.Generic;

namespace NetCoreForce.Client.Models
{
    public class TokenRequest
    {
        [JsonProperty(PropertyName = "grant_type")]
        public string GrantType { get; set; }

        [JsonProperty(PropertyName = "client_secret")]
        public string ClientSecret { get; set; }

        [JsonProperty(PropertyName = "client_id")]
        public string ClientId { get; set; }

        [JsonProperty(PropertyName = "redirect_uri")]
        public string RedirectUri { get; set; }

        [JsonProperty(PropertyName = "code")]
        public string Code { get; set; }

        public FormUrlEncodedContent GetUrlEncoded ()
        {
            return new System.Net.Http.FormUrlEncodedContent(new[]
                {
                    new KeyValuePair<string, string>("grant_type", GrantType),
                    new KeyValuePair<string, string>("client_id", ClientId),
                    new KeyValuePair<string, string>("client_secret", ClientSecret),
                    new KeyValuePair<string, string>("redirect_uri", RedirectUri),
                    new KeyValuePair<string, string>("code", Code)
                });
        }
    }
}


text:
@implementation ImageDetailController

@synthesize clutchView = _clutchView;
@synthesize image = _image;

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - Other Stuff

- (void)setupLoginButton
{
    PFUser *user = [PFUser currentUser];

    // If there's a user, set the right nav button to nothing
    if(user) {
        self.navigationItem.rightBarButtonItem = nil;
        return;
    }

    // Otherwise there's no logged in user, so show a login button
    UIBarButtonItem *loginButton = [[UIBarButtonItem alloc] initWithTitle:@"Log In"
                                                                    style:UIBarButtonItemStyleBordered
                                                                   target:self
                                                                   action:@selector(ensureUser)];
    self.navigationItem.rightBarButtonItem = loginButton;
    [loginButton release];
}

- (PFUser *)ensureUser
{
    PFUser *user = [PFUser currentUser];
    // If there's a current, logged-in user, then return it
    if(user) {
        return user;
    }

    // Otherwise pop up a login screen
    LoginOptionController *login = [[[LoginOptionController alloc] init] autorelease];
    [ClutchView prepareForAnimation:login success:^{
        UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:login];
        [nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"top-bar-blank.png"]
                                                    forBarMetrics:UIBarMetricsDefault];
        nav.navigationBar.translucent = YES;
        [self presentModalViewController:nav animated:YES];
        [nav release];
    }];

    // Since there is no user, we return nil
    return nil;
}

- (NSDictionary *)getUserData:(PFUser *)user
{
    // First we check if they have a Facebook username
    NSString *username = [user objectForKey:@"fb_username"];
    // If they don't have one of those, then we see if they entered in their name
    if(!username) {
        username = [user objectForKey:@"name"];
    }
    // If they don't have one of those, then we just use their username
    if(!username) {
        username = [user objectForKey:@"username"];
    }
    // If they somehow don't have a username, then we just write "Unknown User"
    if(!username) {
        username = @"Unknown User";
    }

    // Return the chosen name along with the user ID
    return [NSDictionary dictionaryWithObjectsAndKeys:
            username, @"username",
            user.objectId, @"id",
            nil];
}

- (void)likeTappedForImage:(NSDictionary *)image callback:(void(^)(id))callback
{
    // If there's no logged-in user, then we shouldn't do anything
    PFUser *user = [self ensureUser];
    if(!user) {
        return;
    }

    // Clicking like counts as a "significant event" in my eyes
    [Appirater userDidSignificantEvent:YES];

    // Query to find an existing like for this image by this user
    PFQuery *query = [PFQuery queryWithClassName:@"Like"];
    [query whereKey:@"hash" equalTo:[image objectForKey:@"hash"]];
    [query whereKey:@"user" equalTo:user];

    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        // If there was an error, log it, and move on
        if(error) {
            NSLog(@"Error saving like: %@ %@", error, [error userInfo]);
            return;
        }

        if([objects count]) {
            // If we find one, then we delete it
            PFObject *like = [objects objectAtIndex:0];
            [like deleteInBackground];
            NSDictionary *resp = [NSDictionary dictionaryWithObjectsAndKeys:
                                  @"deleted", @"action",
                                  nil];
            callback(resp);
        } else {
            // Otherwise, we create one
            PFObject *like = [PFObject objectWithClassName:@"Like"];
            [like setObject:user forKey:@"user"];
            [like setObject:[image objectForKey:@"hash"] forKey:@"hash"];
            [like saveInBackground];
            NSDictionary *resp = [NSDictionary dictionaryWithObjectsAndKeys:
                                  @"created", @"action",
                                  nil];
            callback(resp);
        }
    }];
}

- (void)likeSummaryTappedForImage:(NSDictionary *)image
{
    // Open up the like summary screen
    LikeSummaryController *likeSummary = [[[LikeSummaryController alloc] init] autorelease];
    likeSummary.image = image;
    [ClutchView prepareForAnimation:likeSummary success:^{
        [self.navigationController pushViewController:likeSummary animated:YES];
    }];
}

- (void)commentTappedForImage:(NSDictionary *)image callback:(void(^)(id))callback
{
    // If there's no logged-in user, then we shouldn't do anything
    PFUser *user = [self ensureUser];
    if(!user) {
        return;
    }

    // Adding a new comment counts as a "significant event" in my eyes
    [Appirater userDidSignificantEvent:YES];

    CommentController *commentController = [[CommentController alloc] init];
    commentController.callbackBlock = callback;
    commentController.image = image;
    [self presentViewController:commentController animated:YES completion:^{
        [commentController.textView becomeFirstResponder];
        [commentController release];
    }];
}

- (void)moreTappedForImage:(NSDictionary *)image
{
    // First we show the loading view
    [self.clutchView.loadingView show:nil];

    // We construct the URL to the full-sized image
    NSString *url = [NSString stringWithFormat:@"http://i.imgur.com/%@%@",
                     [image objectForKey:@"hash"],
                     [image objectForKey:@"ext"]];

    // Now we download the full-sized image
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
    [request setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"];
    AFHTTPRequestOperation *operation = [[[AFHTTPRequestOperation alloc] initWithRequest:request] autorelease];
    [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation , id responseObject) {
        // If loading the image succeeded, we shut down the loading view and pop up a sharing dialog
        [self.clutchView.loadingView hide];
        UIImage *img = [UIImage imageWithData:operation.responseData];
        SHKItem *item = [SHKItem image:img title:[image objectForKey:@"title"]];
        SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
        [actionSheet showFromTabBar:self.navigationController.tabBarController.tabBar];
    } failure:^(AFHTTPRequestOperation *operation , NSError *error) {
        // If downloading the image failed, then we pop up an alert dialog
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Could not share"
                                                        message:@"Sorry, there was an error preparing the image to be shared. Please try again."
                                                       delegate:nil
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil];
        [alert show];
        [alert release];
    }];
    NSOperationQueue *queue = [[[NSOperationQueue alloc] init] autorelease];
    [queue addOperation:operation];
}

- (void)imagePopup:(NSDictionary *)image
{
    // If the user clicked on an image, we show a nice scrollable image popup
    NSString *url = [NSString stringWithFormat:@"http://i.imgur.com/%@%@",
                     [image objectForKey:@"hash"],
                     [image objectForKey:@"ext"]];

    EGOPhotoViewController *photoController = [[EGOPhotoViewController alloc] initWithImageURL:[NSURL URLWithString:url]];
    [self.navigationController pushViewController:photoController animated:YES];

    [photoController release];
}

#pragma mark - ClutchViewDelegate

- (void)clutchView:(ClutchView *)clutchView methodCalled:(NSString *)method withParams:(NSDictionary *)params callback:(void(^)(id))callback
{
    // This is where we inspect the method called and handle callbacks
    if([method isEqualToString:@"getInitialData"]) {
        PFUser *user = [PFUser currentUser];
        callback([NSDictionary dictionaryWithObjectsAndKeys:
                  self.image, @"image",
                  user ? [self getUserData:user] : [NSNull null], @"user",
                  nil]);
    } else if([method isEqualToString:@"likeTapped"]) {
        [self likeTappedForImage:params callback:callback];
    } else if([method isEqualToString:@"likeSummaryTapped"]) {
        [self likeSummaryTappedForImage:params];
    } else if([method isEqualToString:@"commentTapped"]) {
        [self commentTappedForImage:params callback:callback];
    } else if([method isEqualToString:@"moreTapped"]) {
        [self moreTappedForImage:params];
    } else if([method isEqualToString:@"imagePopup"]) {
        [self imagePopup:params];
    }
}

#pragma mark - View lifecycle

- (void)loadView
{
    self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bkg.png"]];

    // Set up the Clutch view
    self.clutchView = [[ClutchView alloc] initWithFrame:CGRectMake(0, 0, 320, 411)
                                                andSlug:@"imagedetail"];
    [self.clutchView release];
    self.clutchView.scrollView.scrollIndicatorInsets = UIEdgeInsetsMake(44, 0, 0, 0);
    self.clutchView.delegate = self;
    [self.view addSubview:self.clutchView];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    self.clutchView = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"top-bar-blank.png"]
                                                  forBarMetrics:UIBarMetricsDefault];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [self.clutchView viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    [self.clutchView viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end


text:
package android.os;

@com.francetelecom.rd.stubs.annotation.ClassDone(0)
public class HandlerThread
  extends java.lang.Thread{
  // Constructors

  @com.francetelecom.rd.stubs.annotation.CallBackRegister("createHandler")
  public HandlerThread(java.lang.String arg1){
    super();
  }
  @com.francetelecom.rd.stubs.annotation.CallBackRegister("createHandler")
  public HandlerThread(java.lang.String arg1, int arg2){
    super();
  }
  // Methods

  @com.francetelecom.rd.stubs.annotation.UseSuper
  public void run(){
  }
  public Looper getLooper(){
    return (Looper) null;
  }
  public boolean quit(){
    return false;
  }
  @com.francetelecom.rd.stubs.annotation.CallBack("createHandler")
  protected void onLooperPrepared(){
  }
  public int getThreadId(){
    return 0;
  }
}


text:
'use strict';

// Uncomment the following lines to use the react test utilities
// import React from 'react/addons';
// const TestUtils = React.addons.TestUtils;

import createComponent from 'helpers/createComponent';
import Index from 'components/Index.js';

describe('Index', () => {
    let IndexComponent;

    beforeEach(() => {
        IndexComponent = createComponent(Index);
    });

    it('should have its component name as default className', () => {
        expect(IndexComponent._store.props.className).toBe('Index');
    });
});


text:
namespace ONVIF {
    class Capabilities : public QObject {
        Q_OBJECT
        Q_ENUMS(Category)
        Q_PROPERTY(QString ptzXAddr READ ptzXAddr WRITE setPtzXAddr)
        Q_PROPERTY(QString imagingXAddr READ imagingXAddr WRITE setImagingXAddr)
        Q_PROPERTY(QString mediaXAddr READ mediaXAddr WRITE setMediaXAddr)
        Q_PROPERTY(bool rtpMulticast READ rtpMulticast WRITE setRtpMulticast)
        Q_PROPERTY(bool rtpTcp READ rtpTcp WRITE setRtpTcp)
        Q_PROPERTY(bool rtpRtspTcp READ rtpRtspTcp WRITE setRtpRtspTcp)
        Q_PROPERTY(QString deviceXAddr READ deviceXAddr WRITE setDeviceXAddr)
        Q_PROPERTY(bool iPFilter READ iPFilter WRITE setIPFilter)
        Q_PROPERTY(bool zeroConfiguration READ zeroConfiguration WRITE setZeroConfiguration)
        Q_PROPERTY(bool iPVersion6 READ iPVersion6 WRITE setIPVersion6)
        Q_PROPERTY(bool dynDNS READ dynDNS WRITE setDynDNS)
        Q_PROPERTY(bool discoveryResolve READ disconveryResolve WRITE setDiscoveryResolve)
        Q_PROPERTY(bool discoveryBye READ discoveryBye WRITE setDiscoveryBye)
        Q_PROPERTY(bool remoteDiscovery READ remoteDiscovery WRITE setRemoteDiscovery)
        Q_PROPERTY(bool systemBackup READ systemBackup WRITE setSystemBackup)
        Q_PROPERTY(bool systemLogging READ systemLogging WRITE setSystemLogging)
        Q_PROPERTY(bool firmwareUpgrade READ firmwareUpgrade WRITE setFirmwareUpgrade)
        Q_PROPERTY(int major READ major WRITE setMajor)
        Q_PROPERTY(bool minor READ minor WRITE setMinor)
        Q_PROPERTY(bool httpFirmwareUpgrade READ httpFirmwareUpgrade WRITE setHttpFrimwareUpgrade)
        Q_PROPERTY(bool httpSystemBackup READ httpSystemBackup WRITE setHttpSystemBackup)
        Q_PROPERTY(bool httpSystemLogging READ httpSystemLogging WRITE setHttpSystemLogging)
        Q_PROPERTY(bool httpSupportInformation READ httpSupportInformation WRITE setHttpSupportInformation)
        Q_PROPERTY(int inputConnectors READ inputConnectors WRITE setInputConnectors)
        Q_PROPERTY(int relayOutputs READ relayOutputs WRITE setRelayOutputs)
        Q_PROPERTY(bool tls11 READ tls11  WRITE setTls11)
        Q_PROPERTY(bool tls22 READ tls22 WRITE setTls22)
        Q_PROPERTY(bool onboardKeyGeneration READ onboardKeyGeneration WRITE setOnboardKeyGeneration)
        Q_PROPERTY(bool accessPolicyConfig READ accessPolicyConfig WRITE setAccessPolicyConfig)
        Q_PROPERTY(bool x509Token READ x509Token WRITE setX509Token)
        Q_PROPERTY(bool samlToken READ samlToken WRITE setSamlToken)
        Q_PROPERTY(bool kerberosToken READ kerberosToken WRITE setKerberosToken)
        Q_PROPERTY(bool relToken READ relToken WRITE setRelToken)
        Q_PROPERTY(bool tls10 READ tls10 WRITE setTls10)
        Q_PROPERTY(bool dot1x READ dot1x WRITE setDot1x)
        Q_PROPERTY(bool remoteUserHanding READ remoteUserHanding WRITE setRemoteUserHanding)

    public:
        explicit Capabilities(QObject *parent = NULL);
        virtual ~Capabilities();
        enum Category {All,Analytics,Device,Events,Imaging,Media,PTZ};
        QString enumToString(Category category);
        QDomElement toxml();
        QString ptzXAddr() const
        {
            return m_ptzXAddr;
        }
        QString imagingXAddr() const
        {
            return m_imagingXAddr;
        }

        QString mediaXAddr() const
        {
            return m_mediaXAddr;
        }

        bool rtpMulticast() const
        {
            return m_rtpMulticast;
        }

        bool rtpTcp() const
        {
            return m_rtpTcp;
        }

        bool rtpRtspTcp() const
        {
            return m_rtpRtspTcp;
        }

        QString deviceXAddr() const
        {
            return m_deviceXAddr;
        }

        bool iPFilter() const
        {
            return m_iPFilter;
        }

        bool zeroConfiguration() const
        {
            return m_zeroConfiguration;
        }

        bool iPVersion6() const
        {
            return m_iPVersion6;
        }

        bool dynDNS() const
        {
            return m_dynDNS;
        }

        bool disconveryResolve() const
        {
            return m_discoveryResolve;
        }

        bool systemLogging() const
        {
            return m_systemLogging;
        }

        bool firmwareUpgrade() const
        {
            return m_firmwareUpgrade;
        }

        int major() const
        {
            return m_major;
        }

        bool minor() const
        {
            return m_minor;
        }

        bool httpFirmwareUpgrade() const
        {
            return m_httpFirmwareUpgrade;
        }

        bool httpSystemBackup() const
        {
            return m_httpSystemBackup;
        }

        bool httpSystemLogging() const
        {
            return m_httpSystemLogging;
        }

        bool httpSupportInformation() const
        {
            return m_httpSupportInformation;
        }

        int inputConnectors() const
        {
            return m_inputConnectors;
        }

        int relayOutputs() const
        {
            return m_relayOutputs;
        }

        bool tls11() const
        {
            return m_tls11;
        }

        bool tls22() const
        {
            return m_tls22;
        }

        bool onboardKeyGeneration() const
        {
            return m_onboardKeyGeneration;
        }

        bool accessPolicyConfig() const
        {
            return m_accessPolicyConfig;
        }

        bool x509Token() const
        {
            return m_x509Token;
        }

        bool samlToken() const
        {
            return m_samlToken;
        }

        bool kerberosToken() const
        {
            return m_kerberosToken;
        }

        bool relToken() const
        {
            return m_relToken;
        }

        bool tls10() const
        {
            return m_tls10;
        }

        bool dot1x() const
        {
            return m_dot1x;
        }

        bool remoteUserHanding() const
        {
            return m_remoteUserHanding;
        }

        bool systemBackup() const
        {
            return m_systemBackup;
        }

        bool discoveryBye() const
        {
            return m_discoveryBye;
        }

        bool remoteDiscovery() const
        {
            return m_remoteDiscovery;
        }

    public slots:
        void setPtzXAddr(QString arg)
        {
            m_ptzXAddr = arg;
        }
        void setImagingXAddr(QString arg)
        {
            m_imagingXAddr = arg;
        }

        void setMediaXAddr(QString arg)
        {
            m_mediaXAddr = arg;
        }

        void setRtpMulticast(bool arg)
        {
            m_rtpMulticast = arg;
        }

        void setRtpTcp(bool arg)
        {
            m_rtpTcp = arg;
        }

        void setRtpRtspTcp(bool arg)
        {
            m_rtpRtspTcp = arg;
        }

        void setDeviceXAddr(QString arg)
        {
            m_deviceXAddr = arg;
        }

        void setIPFilter(bool arg)
        {
            m_iPFilter = arg;
        }

        void setZeroConfiguration(bool arg)
        {
            m_zeroConfiguration = arg;
        }

        void setIPVersion6(bool arg)
        {
            m_iPVersion6 = arg;
        }

        void setDynDNS(bool arg)
        {
            m_dynDNS = arg;
        }

        void setDiscoveryResolve(bool arg)
        {
            m_discoveryResolve = arg;
        }

        void setSystemLogging(bool arg)
        {
            m_systemLogging = arg;
        }

        void setFirmwareUpgrade(bool arg)
        {
            m_firmwareUpgrade = arg;
        }

        void setMajor(int arg)
        {
            m_major = arg;
        }

        void setMinor(bool arg)
        {
            m_minor = arg;
        }

        void setHttpFrimwareUpgrade(bool arg)
        {
            m_httpFirmwareUpgrade = arg;
        }

        void setHttpSystemBackup(bool arg)
        {
            m_httpSystemBackup = arg;
        }

        void setHttpSystemLogging(bool arg)
        {
            m_httpSystemLogging = arg;
        }

        void setHttpSupportInformation(bool arg)
        {
            m_httpSupportInformation = arg;
        }

        void setInputConnectors(int arg)
        {
            m_inputConnectors = arg;
        }

        void setRelayOutputs(int arg)
        {
            m_relayOutputs = arg;
        }

        void setTls11(bool arg)
        {
            m_tls11 = arg;
        }

        void setTls22(bool arg)
        {
            m_tls22 = arg;
        }

        void setOnboardKeyGeneration(bool arg)
        {
            m_onboardKeyGeneration = arg;
        }

        void setAccessPolicyConfig(bool arg)
        {
            m_accessPolicyConfig = arg;
        }

        void setX509Token(bool arg)
        {
            m_x509Token = arg;
        }

        void setSamlToken(bool arg)
        {
            m_samlToken = arg;
        }

        void setKerberosToken(bool arg)
        {
            m_kerberosToken = arg;
        }

        void setRelToken(bool arg)
        {
            m_relToken = arg;
        }

        void setTls10(bool arg)
        {
            m_tls10 = arg;
        }

        void setDot1x(bool arg)
        {
            m_dot1x = arg;
        }

        void setRemoteUserHanding(bool arg)
        {
            m_remoteUserHanding = arg;
        }

        void setSystemBackup(bool arg)
        {
            m_systemBackup = arg;
        }

        void setDiscoveryBye(bool arg)
        {
            m_discoveryBye = arg;
        }

        void setRemoteDiscovery(bool arg)
        {
            m_remoteDiscovery = arg;
        }

    private:
        QString m_ptzXAddr;
        QString m_imagingXAddr;
        QString m_mediaXAddr;
        bool m_rtpMulticast;
        bool m_rtpTcp;
        bool m_rtpRtspTcp;
        QString m_deviceXAddr;
        bool m_iPFilter;
        bool m_zeroConfiguration;
        bool m_iPVersion6;
        bool m_dynDNS;
        bool m_discoveryResolve;
        bool m_systemLogging;
        bool m_firmwareUpgrade;
        int m_major;
        bool m_minor;
        bool m_httpFirmwareUpgrade;
        bool m_httpSystemBackup;
        bool m_httpSystemLogging;
        bool m_httpSupportInformation;
        int m_inputConnectors;
        int m_relayOutputs;
        bool m_tls11;
        bool m_tls22;
        bool m_onboardKeyGeneration;
        bool m_accessPolicyConfig;
        bool m_x509Token;
        bool m_samlToken;
        bool m_kerberosToken;
        bool m_relToken;
        bool m_tls10;
        bool m_dot1x;
        bool m_remoteUserHanding;
        bool m_systemBackup;
        bool m_discoveryBye;
        bool m_remoteDiscovery;
    };
}
#endif // CAPABILITIES_H


text:
(function ($, fluid) {
    "use strict";

    fluid.registerNamespace("gpii.prefs.merging");

    gpii.prefs.merging.arrayOverridePolicy = function (target, source) {
        source = fluid.makeArray(source);
        return source;
    };
})(jQuery, fluid);


text:
package com.linkedin.datahub.graphql.types.common.mappers;

import com.linkedin.datahub.graphql.generated.Status;
import com.linkedin.datahub.graphql.types.mappers.ModelMapper;

import javax.annotation.Nonnull;

public class StatusMapper implements ModelMapper<com.linkedin.common.Status, Status> {

    public static final StatusMapper INSTANCE = new StatusMapper();

    public static Status map(@Nonnull final com.linkedin.common.Status metadata) {
        return INSTANCE.apply(metadata);
    }

    @Override
    public Status apply(@Nonnull final com.linkedin.common.Status input) {
        final Status result = new Status();
        result.setRemoved(input.isRemoved());
        return result;
    }
}