text:
package android.particles.com.retrofit.modules.search.ui;

import android.content.ContentValues;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.particles.com.retrofit.R;
import android.particles.com.retrofit.base.BaseApplication;
import android.particles.com.retrofit.base.BaseFragment;
import android.particles.com.retrofit.common.RetrofitSingleton;
import android.particles.com.retrofit.component.util.MyDatabaseHelper;
import android.particles.com.retrofit.modules.search.SearchActivity;
import android.particles.com.retrofit.modules.search.adapter.SearchAdapter;
import android.particles.com.retrofit.modules.search.domin.BackImg;
import android.particles.com.retrofit.modules.search.domin.Translation;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;

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

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.schedulers.Schedulers;

/**
 * Created by YLM on 2016/10/15.
 */
public class SearchFragment extends BaseFragment {
    private View view;
    private Button search_button;
    private EditText search_edit;
    private TextView search_result;
    private TextView search_n;
    private TextView search_phonetic;
    private RecyclerView search_web;
    private String text;
    private List<Translation.WebBean> mData;
    private SearchAdapter adapter;
    private SQLiteDatabase db;
    private ContentValues values;

    @Override
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup parent, Bundle savedInstanceState){
        super.onCreateView(layoutInflater,parent,savedInstanceState);
        view = layoutInflater.inflate(R.layout.fragmentsearch,parent,false);
        initData();
        initView();
        return view;
    }
    private void initView(){

        search_button = (Button)view.findViewById(R.id.search_button);
        search_edit = (EditText)view.findViewById(R.id.search_editText);
        search_result = (TextView)view.findViewById(R.id.search_result);
        search_n = (TextView)view.findViewById(R.id.search_n);
        search_phonetic = (TextView)view.findViewById(R.id.search_phonetic);
        search_web = (RecyclerView)view.findViewById(R.id.search_web);

        search_web.setLayoutManager(new LinearLayoutManager(getContext()));
        search_web.setAdapter(adapter = new SearchAdapter(getContext(),mData));

        search_button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                text = search_edit.getText().toString();
                getTraslation(text);

            }
        });

    }
    private void initData(){

        mData = new ArrayList<>();
        db = BaseApplication.getDbHelper().getWritableDatabase();
        values = new ContentValues();

    }

    private void getTraslation(String text){
        RetrofitSingleton.getApiService()
                .getTranslation("lifanyi","169409030","data","json","1.1",text)
                .subscribeOn(Schedulers.io())
                .observeOn(Schedulers.io())
                .doOnNext(new Action1<Translation>() {
                    @Override
                    public void call(Translation translation) {

                        values.put("query",translation.getQuery());
                        values.put("translation",translation.getTranslation().get(0));
                        if (translation.getBasic()!=null){
                            values.put("basic",translation.getBasic().getExplains().get(0));
                            values.put("phonetic",translation.getBasic().getPhonetic());
                        }else {
                            values.put("phonetic","");
                            values.put("basic","");
                        }

                        db.insert("translate",null,values);
                        values.clear();
                    }
                })
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<Translation>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {
                        e.printStackTrace();
                    }

                    @Override
                    public void onNext(Translation translation) {
                        search_result.setText(translation.getTranslation().get(0));

                        if (translation.getBasic()!=null){
                            search_phonetic.setText(translation.getBasic().getPhonetic());
                            search_n.setText(translation.getBasic().getExplains().get(0));
                            mData.clear();
                            for (Translation.WebBean item : translation.getWeb()){
                                mData.add(item);
                            }
                            adapter.notifyDataSetChanged();
                        }
                    }
                });
    }

}


text:
package org.webcurator.ui.admin.command;

import java.util.List;

/**
 * The create user command object.
 * @author bprice
 */
public class CreateUserCommand {
	/** the name of the agencies model object. */
    public static final String MDL_AGENCIES = "agencies";
	/** the name of the assigned roles model object. */
    public static final String MDL_ASSIGNED_ROLES = "assignedRoles";
    /** The name of the save role action. */
    public static final String ACTION_SAVE = "save";
    /** The name of the New Role action */
    public static final String ACTION_NEW ="new";
    /** The name of the View user action */
    public static final String ACTION_VIEW ="view";
    /** The name of the Edit user action */
    public static final String ACTION_EDIT ="edit";

    /** the constant name of the user oid object. */
    public static final String PARAM_OID = "oid";
    /** the constant name of the action command object. */
    public static final String PARAM_ACTION = "action";
    /** the constant name of the user name object. */
    public static final String PARAM_USERNAME = "username";
    /** the constant name of the emial address object. */
    public static final String PARAM_EMAIL = "email";
    /** the constant name of the notify by email flag object. */
    public static final String PARAM_NOTIFICATIONS_BY_EMAIL = "notificationsByEmail";
    /** the constant name of the notify by email flag object. */
    public static final String PARAM_TASKS_BY_EMAIL = "tasksByEmail";
    /** the constant name of the title object. */
    public static final String PARAM_TITLE = "title";
    /** the constant name of the first name object. */
    public static final String PARAM_FIRSTNAME = "firstname";
    /** the constant name of the last name object. */
    public static final String PARAM_LASTNAME = "lastname";
    /** the constant name of the active object. */
    public static final String PARAM_ACTIVE = "active";
    /** the constant name of the external authorisation flag object. */
    public static final String PARAM_EXTERNAL_AUTH = "externalAuth";
    /** the constant name of the password object. */
    public static final String PARAM_PASSWORD = "password";
    /** the constant name of the confirm password object. */
    public static final String PARAM_CONFIRM_PASSWORD = "confirmPassword";
    /** the constant name of the phone number object. */
    public static final String PARAM_PHONE = "phone";
    /** the constant name of the address object. */
    public static final String PARAM_ADDRESS = "address";
    /** the constant name of the agency oid object. */
    public static final String PARAM_AGENCY_OID = "agencyOid";
    /** the constant name of the mode object. */
    public static final String PARAM_MODE = "mode";

    /** the unique user oid field. */
    private Long oid;
    /** the action field. */
    private String action;
    /** the user name field. */
    private String username;
    /** the email address field. */
    private String email;
    /** the notify by email flag field. */
    private boolean notificationsByEmail;
    /** the tasks by email flag field. */
    private boolean tasksByEmail;
    /** the title field. */
    private String title;
    /** the first name field. */
    private String firstname;
    /** the last name field. */
    private String lastname;
    /** the user is active field. */
    private boolean active;
    /** the external authorisation flag field. */
    private boolean externalAuth;
    /** the password field. */
    private String password;
    /** the password confirmation field. */
    private String confirmPassword;
    /** the phone number field. */
    private String phone;
    /** the address field. */
    private String address;
    /** the users agency oid field. */
    private Long agencyOid;
    /** the agencies field. */
    private List agencies;
    /** the mode field. */
    private String mode;
    /** the command field. */
    /** Enable notifications for changes to objects the user owns */
    private boolean notifyOnGeneral = false;
    /** Enable notifications for harvester warnings. */
    private boolean notifyOnHarvestWarnings = false;

    private CreateUserCommand command;

	/**
	 * @return the action
	 */
	public String getAction() {
		return action;
	}
	/**
	 * @param action the action to set
	 */
	public void setAction(String action) {
		this.action = action;
	}
	/**
	 * @return the active
	 */
	public boolean isActive() {
		return active;
	}
	/**
	 * @param active the active to set
	 */
	public void setActive(boolean active) {
		this.active = active;
	}
	/**
	 * @return the address
	 */
	public String getAddress() {
		return address;
	}
	/**
	 * @param address the address to set
	 */
	public void setAddress(String address) {
		this.address = address;
	}
	/**
	 * @return the agencies
	 */
	public List getAgencies() {
		return agencies;
	}
	/**
	 * @param agencies the agencies to set
	 */
	public void setAgencies(List agencies) {
		this.agencies = agencies;
	}
	/**
	 * @return the agencyOid
	 */
	public Long getAgencyOid() {
		return agencyOid;
	}
	/**
	 * @param agencyOid the agencyOid to set
	 */
	public void setAgencyOid(Long agencyOid) {
		this.agencyOid = agencyOid;
	}
	/**
	 * @return the command
	 */
	public CreateUserCommand getCommand() {
		return command;
	}
	/**
	 * @param command the command to set
	 */
	public void setCommand(CreateUserCommand command) {
		this.command = command;
	}
	/**
	 * @return the confirmPassword
	 */
	public String getConfirmPassword() {
		return confirmPassword;
	}
	/**
	 * @param confirmPassword the confirmPassword to set
	 */
	public void setConfirmPassword(String confirmPassword) {
		this.confirmPassword = confirmPassword;
	}
	/**
	 * @return the email
	 */
	public String getEmail() {
		return email;
	}
	/**
	 * @param email the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}
	/**
	 * @return the externalAuth
	 */
	public boolean isExternalAuth() {
		return externalAuth;
	}
	/**
	 * @param externalAuth the externalAuth to set
	 */
	public void setExternalAuth(boolean externalAuth) {
		this.externalAuth = externalAuth;
	}
	/**
	 * @return the firstname
	 */
	public String getFirstname() {
		return firstname;
	}
	/**
	 * @param firstname the firstname to set
	 */
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}
	/**
	 * @return the lastname
	 */
	public String getLastname() {
		return lastname;
	}
	/**
	 * @param lastname the lastname to set
	 */
	public void setLastname(String lastname) {
		this.lastname = lastname;
	}
	/**
	 * @return the mode
	 */
	public String getMode() {
		return mode;
	}
	/**
	 * @param mode the mode to set
	 */
	public void setMode(String mode) {
		this.mode = mode;
	}
	/**
	 * @return the notificationsByEmail
	 */
	public boolean isNotificationsByEmail() {
		return notificationsByEmail;
	}
	/**
	 * @param notificationsByEmail the notificationsByEmail to set
	 */
	public void setNotificationsByEmail(boolean notifyByEmail) {
		this.notificationsByEmail = notifyByEmail;
	}
	/**
	 * @return the oid
	 */
	public Long getOid() {
		return oid;
	}
	/**
	 * @param oid the oid to set
	 */
	public void setOid(Long oid) {
		this.oid = oid;
	}
	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}
	/**
	 * @param password the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}
	/**
	 * @return the phone
	 */
	public String getPhone() {
		return phone;
	}
	/**
	 * @param phone the phone to set
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}
	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}
	/**
	 * @param title the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}
	/**
	 * @return the username
	 */
	public String getUsername() {
		return username;
	}
	/**
	 * @param username the username to set
	 */
	public void setUsername(String username) {
		this.username = username;
	}
	public boolean isTasksByEmail() {
		return tasksByEmail;
	}
	public void setTasksByEmail(boolean tasksByEmail) {
		this.tasksByEmail = tasksByEmail;
	}
	public boolean isNotifyOnGeneral() {
		return notifyOnGeneral;
	}
	public void setNotifyOnGeneral(boolean notifyOnChanges) {
		this.notifyOnGeneral = notifyOnChanges;
	}
	public boolean isNotifyOnHarvestWarnings() {
		return notifyOnHarvestWarnings;
	}
	public void setNotifyOnHarvestWarnings(boolean notifyOnHarvestWarnings) {
		this.notifyOnHarvestWarnings = notifyOnHarvestWarnings;
	}

}

redpajama_set_name: RedPajamaGithub


text:
using System.IO;
using Newtonsoft.Json;

namespace PiDashcam
{
	public class AppSettings<T> where T : new()
	{
		private const string DEFAULT_FILENAME = "settings.json";

		public void Save(string fileName = DEFAULT_FILENAME)
		{
			string json = JsonConvert.SerializeObject(this, Formatting.Indented);
			File.WriteAllText(fileName, json);
		}

		public static void Save(T pSettings, string fileName = DEFAULT_FILENAME)
		{
			string json = JsonConvert.SerializeObject(pSettings, Formatting.Indented);
			File.WriteAllText(fileName, json);
		}

		public static T Load(string fileName = DEFAULT_FILENAME)
		{
			T t = default(T);
			if (File.Exists(fileName))
				using (StreamReader file = File.OpenText(fileName))
				{
					JsonSerializer serializer = new JsonSerializer();
					t = (T)serializer.Deserialize(file, typeof(T));
				}
			return t;
		}
	}
}


text:
<?xml version="1.0" encoding="utf-8" ?>
<importProgress>
    <currentChannel></currentChannel>
    <progress>0</progress>
    <percentage></percentage>
    <totalPercentage></totalPercentage>
    <finished>false</finished>
    <running></running>
    <status>
            <message>Import of 37 fields for channel 'de'.</message>
            <message>Start time: 03-Nov-2013 17:13:43</message>
            <message>17,760 records imported for channel 'de' in 15 seconds.</message>
            <message>A total of 17,760 records imported in 15 seconds.</message>
            <message>1,184 records per second.</message>
            <message>Finished: 03-Nov-2013 17:13:58</message>
    </status>
    <errors></errors>
</importProgress>


text:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = removePropertiesDeep;

var _traverseFast = require("../traverse/traverseFast");

var _removeProperties = require("./removeProperties");

function removePropertiesDeep(tree, opts) {
  (0, _traverseFast.default)(tree, _removeProperties.default, opts);
  return tree;
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Ascochyta phlogis Voglino

### Remarks
null


text:
export default function compose( ...funcs ) {
  if ( funcs.length === 0 ) {
    return arg => arg;
  }

  if ( funcs.length === 1 ) {
    return funcs[0];
  }

  const last = funcs[funcs.length - 1];
  const rest = funcs.slice( 0, -1 );
  return ( ...args ) => rest.reduceRight(( composed, f ) => f( composed ), last( ...args ));
}


text:
require 'spec_helper'

RSpec.describe Straight::ExchangeRate::AverageRateAdapter do

  before :all do
    VCR.insert_cassette 'exchange_rate_average_rate_adapter'
  end

  after :all do
    VCR.eject_cassette
  end

  before(:each) do
    @average_rates_adapter = Straight::ExchangeRate::AverageRateAdapter.instance(
      Straight::ExchangeRate::BitstampAdapter,
      Straight::ExchangeRate::BitpayAdapter.instance,
    )
  end

  it "calculates average rate" do
    json_response_bistamp = '{"high": "232.89", "last": "100", "timestamp": "1423457015", "bid": "224.00", "vwap": "224.57", "volume": "14810.41127494", "low": "217.28", "ask": "224.13"}'
    json_response_bitpay = '[{"code":"USD","name":"US Dollar","rate":200},{"code":"EUR","name":"Eurozone Euro","rate":197.179544}]'
    uri_mock = double('uri mock')
    allow(uri_mock).to receive(:read).with(read_timeout: 4).and_return(json_response_bistamp, json_response_bitpay)
    allow(URI).to      receive(:parse).and_return(uri_mock)
    expect(@average_rates_adapter.rate_for('USD')).to eq 150
  end

  it "fetches rates for all adapters" do
    expect(@average_rates_adapter.fetch_rates!).not_to be_empty
  end

  it 'raises error if all adapters failed to fetch rates' do
    adapter_mocks = [double('adapter_1'), double('adapter_2')]
    adapter_mocks.each do |adapter|
      expect(adapter).to receive(:fetch_rates!).and_raise(Straight::ExchangeRate::Adapter::FetchingFailed)
    end
    average_rates_adapter = Straight::ExchangeRate::AverageRateAdapter.instance(*adapter_mocks)
    expect( -> { average_rates_adapter.fetch_rates! }).to raise_error(Straight::ExchangeRate::Adapter::FetchingFailed)
  end

  it "raises exception if all adapters fail to get rates" do
    expect( -> { @average_rates_adapter.rate_for('FEDcoin') }).to raise_error(Straight::ExchangeRate::Adapter::CurrencyNotSupported)
  end

  it "raises exception if unallowed method is called" do # fetch_rates! is not to be used in AverageRateAdapter itself
    expect( -> { @average_rates_adapter.get_rate_value_from_hash(nil, 'nothing') }).to raise_error("This method is not supposed to be used in #{@average_rates_adapter.class}.")
    expect( -> { @average_rates_adapter.rate_to_f(nil) }).to raise_error("This method is not supposed to be used in #{@average_rates_adapter.class}.")
  end

end


text:
"""Plot to test line styles"""
import matplotlib.pyplot as plt
import numpy as np
from mpld3_rewrite import plugins

def main():
    fig, ax = plt.subplots()
    colors = plt.rcParams['axes.color_cycle']
    points = []
    for i, color in enumerate(colors):
        points = ax.plot(i, 0, 'o', c=color, ms=20)
        plugins.connect(fig,
                        plugins.PointLabelTooltip(points[0], [color]))
    ax.set_xlim(-1, len(colors) + 1)

    return fig

if __name__ == '__main__':
    fig = main()
    plt.show()


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

namespace AH.ACCMS.MODEL
{
   public class rptBalanceSheetNew
    {
       public string grName;
       public string grParent;
       public int intPrimaryType;
       public double gr_amount;

    }
}


text:
#ifndef MediaStreamAudioSourceNode_h
#define MediaStreamAudioSourceNode_h

#if ENABLE(WEB_AUDIO)

#include "platform/audio/AudioSourceProvider.h"
#include "platform/audio/AudioSourceProviderClient.h"
#include "modules/mediastream/MediaStream.h"
#include "modules/webaudio/AudioSourceNode.h"
#include "wtf/OwnPtr.h"
#include "wtf/PassRefPtr.h"
#include "wtf/Threading.h"

namespace blink {

class AudioContext;

class MediaStreamAudioSourceNode FINAL : public AudioSourceNode, public AudioSourceProviderClient {
    WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaStreamAudioSourceNode);
public:
    static PassRefPtrWillBeRawPtr<MediaStreamAudioSourceNode> create(AudioContext*, MediaStream*, MediaStreamTrack*, PassOwnPtr<AudioSourceProvider>);

    virtual ~MediaStreamAudioSourceNode();

    MediaStream* mediaStream() { return m_mediaStream.get(); }

    // AudioNode
    virtual void dispose() OVERRIDE;
    virtual void process(size_t framesToProcess) OVERRIDE;

    // AudioSourceProviderClient
    virtual void setFormat(size_t numberOfChannels, float sampleRate) OVERRIDE;

    AudioSourceProvider* audioSourceProvider() const { return m_audioSourceProvider.get(); }

    virtual void trace(Visitor*) OVERRIDE;

private:
    MediaStreamAudioSourceNode(AudioContext*, MediaStream*, MediaStreamTrack*, PassOwnPtr<AudioSourceProvider>);

    // As an audio source, we will never propagate silence.
    virtual bool propagatesSilence() const OVERRIDE { return false; }

    PersistentWillBeMember<MediaStream> m_mediaStream;
    PersistentWillBeMember<MediaStreamTrack> m_audioTrack;
    OwnPtr<AudioSourceProvider> m_audioSourceProvider;

    Mutex m_processLock;

    unsigned m_sourceNumberOfChannels;
};

} // namespace blink

#endif // ENABLE(WEB_AUDIO)

#endif // MediaStreamAudioSourceNode_h


text:
import './index-fd92abaa.js';
import { C as ComponentBehavior } from './component-8ee18bc6.js';

class DatePickerBehaviour extends ComponentBehavior {
  static get params() {
    return {
      input: true,
      localized: true,
      component: 'datepicker',
      provideValue: false,
      props: ['value', 'begin', 'end', 'mode', 'lang', 'host'],
    };
  }
}

export default DatePickerBehaviour;


text:
define(['backbone.paginator', 'models/attachment', 'utils/kvcollection'], function(PageableCollection, Attachment, KVCollection) {

    return PageableCollection.extend(_.extend({
        model: Attachment,
        mode: 'client',
        url: '/download/attachments',

        keyAttribute: 'NAME',
        valueAttribute: 'DATACOLLECTIONFILEATTACHMENTID',

        state: {
            pageSize: 15,
        },
    }, KVCollection))
})


text:
#ifndef InterThresholdCalibration_H
#define InterThresholdCalibration_H
#include <JPetUserTask/JPetUserTask.h>
#include <JPetHit/JPetHit.h>
#include <JPetRawSignal/JPetRawSignal.h>
#include <JPetGeomMapping/JPetGeomMapping.h>
#include <JPetTimer/JPetTimer.h>
class JPetWriter;
class InterThresholdCalibration: public JPetUserTask
{
public:
  InterThresholdCalibration(const char* name);
  virtual ~InterThresholdCalibration();
  virtual bool init()override;
  virtual bool exec()override;
  virtual bool terminate()override;
protected:
  const char* formatUniqueSlotDescription(const JPetBarrelSlot& slot, int threshold, const char* prefix);
  void fillHistosForHit(const JPetHit& hit);
  JPetGeomMapping* fBarrelMap = nullptr;
  std::string fOutputFile = "TimeConstantsInterThrCalib.txt";
  const std::string fOutputFileKey = "InterThresholdCalibration_TimeConstantsInterThrCalibOutputFile_std::string";
  const std::string fCalibRunKey = "InterThresholdCalibration_TimeCalibRunNumber_int";
  int fCalibRun = 4; //Number of calibration run associated with Acquisition Campaign
  double fFrac_err = 0.3; //maximal fractional uncertainty of parameters accepted by calibration
  const std::string fFrac_errKey = "InterThresholdCalibration_Frac_err_double";
  int fMin_ev = 100;     //minimal number of events for a distribution to be fitted
  const std::string fMin_evKey = "InterThresholdCalibration_Min_ev_int";
  std::vector<double> kSl_max; //amount of slots per each layer
  double fThr_time_diff_t_A[5], fThr_time_diff_A[5];
  double fThr_time_diff_t_B[5], fThr_time_diff_B[5];

};
#endif /*  !InterThresholdCalibration_H */


text:
package org.foxlabs.validation.constraint;

import java.util.regex.Pattern;

/**
 * This class provides RegexConstraint implementation that checks
 * whether a string is valid MIME type representation.
 *
 * @author Fox Mulder
 * @see MimeType
 * @see ConstraintFactory#mimetype()
 */
public final class MimeTypeConstraint extends RegexConstraint {

    /**
     * MimeTypeConstraint single instance.
     */
    public static final MimeTypeConstraint DEFAULT = new MimeTypeConstraint();

    /**
     * Constructs default MimeTypeConstraint.
     */
    private MimeTypeConstraint() {
        super("^[a-z]([a-z0-9_\\-\\.]*[a-z0-9_])*/[a-z]([a-z0-9_\\-\\.]*[a-z0-9_])*$",
              Pattern.CASE_INSENSITIVE);
    }

}


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

    <!--  Header -->
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:background="#FBFBFB"
        android:layout_height="50dp">

            <ImageView
                android:id="@+id/turn_left"
                android:clickable="true"
                android:layout_gravity="center_vertical"
                android:paddingLeft="10dp"
                android:src="@drawable/turn_left_blue"
                android:layout_width="28dp"
                android:layout_height="28dp"/>

        <TextView
            android:gravity="center"
            android:layout_gravity="center_vertical"
            android:layout_width="wrap_content"
            android:layout_weight="1"
            android:layout_height="fill_parent"
            android:text="@string/apply_person"
            android:textSize="20sp"/>

        <TextView
            android:layout_width="30dp"
            android:layout_height="wrap_content" />

    </LinearLayout>

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#0080fe"/>

    <!--  Content -->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="15dp"
        android:paddingBottom="15dp"
        android:gravity="center"
        android:id="@+id/applyHeader_layout"
        android:clickable="true"
        android:background="#fafafa"
        android:orientation="horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingRight="5dp"
            android:textColor="#0080fe"
            android:textSize="16sp"
            android:id="@+id/applyHeader_text"
            android:text="@string/fit_position" />

        <ImageView
            android:id="@+id/applyHeader_Img"
            android:src="@drawable/turn_down"
            android:layout_width="20dp"
            android:layout_height="20dp" />

    </LinearLayout>

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#c9c9c9" />
    <ListView
        android:id="@+id/lv_pull_down"
        android:background="#ffffff"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"></ListView>
    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swiperefresh"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    <ListView
        android:id="@+id/lv_all"

        android:layout_width="match_parent"
        android:layout_height="wrap_content"></ListView>
</android.support.v4.widget.SwipeRefreshLayout>
    <ListView
        android:id="@+id/lv_one"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"></ListView>

</LinearLayout>


text:
require_relative 'base'

module Fog
  module OpenStack
    class  ContainerInfra
      class Bay < Fog::OpenStack::ContainerInfra::Base
        identity :uuid

        attribute :api_address
        attribute :coe_version
        attribute :baymodel_id
        attribute :create_timeout
        attribute :created_at
        attribute :discovery_url
        attribute :master_addresses
        attribute :master_count
        attribute :name
        attribute :node_addresses
        attribute :node_count
        attribute :stack_id
        attribute :status
        attribute :status_reason
        attribute :updated_at

        def create
          requires :name, :baymodel_id
          merge_attributes(service.create_bay(attributes).body)
          self
        end

        def update
          requires :uuid, :name, :baymodel_id
          attrs = attributes.select{|k,_| allowed_update_attributes.include? k}
          attrs = convert_update_params(attrs)
          merge_attributes(service.update_bay(uuid, attrs).body)
          self
        end

        def destroy
          requires :uuid
          service.delete_bay(uuid)
          true
        end

        private

        def allowed_update_attributes
          [
            :node_count
          ]
        end

      end
    end
  end
end


text:
<?php

class Services_Twilio_Rest_IpAddresses extends Services_Twilio_SIPListResource {

    public function __construct($client, $uri) {
        $this->instance_name = "Services_Twilio_Rest_IpAddress";
        parent::__construct($client, $uri);
    }

    /**
     * Creates a new IpAddress instance
     *
     * Example usage:
     *
     * .. code-block:: php
     *
     *      $client->account->sip->ip_access_control_lists->get('ALXXX')->ip_addresses->create(
     *          "FriendlyName", "127.0.0.1"
     *      );
     *
     * :param string $friendly_name: the friendly name for the new IpAddress object
     * :param string $ip_address: the ip address for the new IpAddress object
     * :param array $params: a single array of parameters which is serialized and
     *      sent directly to the Twilio API.
     */
    public function create($friendly_name, $ip_address, $params = array()) {
        return parent::_create(array(
            'FriendlyName' => $friendly_name,
            'IpAddress' => $ip_address,
        ) + $params);
    }
}


text:
/**
 * Get the index of a declaration's value
 *
 * @param {Decl} decl
 * @return {int} The index
 */
export default function(decl) {
  const beforeColon = decl.toString().indexOf(":");
  const afterColon =
    decl.raw("between").length - decl.raw("between").indexOf(":");

  return beforeColon + afterColon;
}


text:
package com.test.plugin;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CallbackContext;
import org.json.JSONObject;
import org.json.JSONArray;
import org.json.JSONException;

public class Hello extends CordovaPlugin {
    public static final String ACTION_DEMO = "sampleAction";

    @Override
    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
        try {
            if (ACTION_DEMO.equals(action)) {
                JSONObject argObject = args.getJSONObject(0);

                // 'argObject' contains all the passed arguments. Use the getter method to grab them.
                // eg:  argObject.getString("my-param")

                // Here goes our custom code

                callbackContext.success();
                return true;
            }
            callbackContext.error("No such action defined");
            return false;
        } catch(Exception e) {
            callbackContext.error(e.getMessage());
            return false;
        }
    }
}


text:
sh/download_data.sh

# Process the data
python3 generate_schema_and_tmcf.py
# process_data.py depends on artifacts produced by generate_schema_and_tmcf.py
python3 process_data.py


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title>MDInsider ♥ Open Source / Welcome Jenny Leahy!</title>

    <meta name="author" content="MDInsider, Inc.">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="shortcut icon" href="/assets/themes//img/favicon.ico">
    <link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Sitewide ATOM Feed">
    <link href="/rss.xml" type="application/rss+xml" rel="alternate" title="Sitewide RSS Feed">

    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="/assets/themes//css/github-light.css">
    <link rel="stylesheet/less" href="/assets/themes//css/style.less">

    Join MD Insider Tech
    MDInsider.com

            Categories

              <input type="search" placeholder="Search …" title="Search for:" />

            <menu id="categories-menu">

              <menuitem>
                AWS
              </menuitem>

              <menuitem>
                Leadership
              </menuitem>

              <menuitem>
                agile
              </menuitem>

              <menuitem>
                analytics
              </menuitem>

              <menuitem>
                aws
              </menuitem>

              <menuitem>
                blog
              </menuitem>

              <menuitem>
                conferences
              </menuitem>

              <menuitem>
                culture
              </menuitem>

              <menuitem>
                deployment
              </menuitem>

              <menuitem>
                front-end
              </menuitem>

              <menuitem>
                mobile
              </menuitem>

              <menuitem>
                scala
              </menuitem>

              <menuitem>
                swift
              </menuitem>

              <menuitem>
                tech
              </menuitem>

              <menuitem>
                tvOS
              </menuitem>

            </menu>
            <menu id="search-results">
            </menu>

Tech Blog

Welcome Jenny Leahy!

    <time>15 August 2013</time>

We’re excited to welcome Jenny Leahy to the Gilt technology team! Jenny will be working in our Dublin office as a software engineer, and will initially focus on email delivery. A longtime Java developer with experience working in the financial software field, she’s moving into the world of Scala and is intrigued by our use of the Typesafe platform. When she’s not working, she loves to read (sci-fi, psychology and anthropology) and travel.

    dublin 10

    gilttech 332

    people 40

    womenintech 6

    software engineering 66

    Jenny Leahy 2

    gilt 87

    hiring 30

    Join MD Insider Tech
    MDInsider.com

          © 2015 MDInsider, Inc. • Archives


text:
"""
make the index page for all OpenMDAO downloads, per version.
"""
import os
import re
import stat
import sys
import time

_digit_rgx = re.compile('([0-9]+)')

def _keyfunct(val):
    def cvtdigits(val):
        if val.isdigit():
            return int(val)
        return val

    parts = [s for s in re.split(_digit_rgx, val) if s]
    return tuple(map(cvtdigits, parts))

"""make a list of versioned directories within downloads"""

def list_dirs(startdir):
    results = os.listdir(startdir)
    dir_results = []
    excludes = ["misc", "dev_docs", "user_guides"]
    for name in results:
        if os.path.isdir(os.path.join(startdir, name)) and (name not in excludes):
            dir_results.append(name)

    return sorted(dir_results, key=_keyfunct, reverse=True)

def make_download_index(url):
    # this file is assumed to live in the downloads directory, so use __file__ to get the path
    startdir = os.path.abspath(os.path.dirname(__file__))
    out = open('index.html', 'w')
    out.write('\n\n')
    out.write('\n')
    out.write('  <title>OpenMDAO Downloads by Version</title>\n')
    out.write('  <link rel="stylesheet" href="/chrome/common/css/trac.css" type="text/css" />\n')
    out.write('  <link rel="stylesheet" href="/chrome/tracfullblog/css/fullblog.css" type="text/css" />\n')
    out.write('
\n')
    out.write('    \n' % url)
    out.write('      \n')
    out.write('    \n')
    out.write('
\n')
    out.write('\n\n')
    out.write('\n')
    out.write('

\n')
    out.write('
\n')
    out.write('    OpenMDAO Downloads by Version\n')
    out.write('
\n')

    dirs = list_dirs(startdir)
    if len(dirs): out.write('
\n')
    for d in dirs:
        base_d = os.path.basename(d)
        # following lines get the date of each directory's creation.
        stats = os.stat(d)
        create_date = time.localtime(stats[stat.ST_MTIME])
        dir_date = time.strftime("%m/%d/%y %H:%M:%S", create_date)
        out.write('
%s&nbsp&nbsp&nbsp&nbsp %s(CST)\n' % (base_d, base_d, dir_date))
    if len(dirs): out.write('
\n')

    # This section is meant to display everything in the misc folder at this level.
    miscdir = os.path.join(startdir, 'misc')
    out.write('\n
Miscellaneous Downloads
\n')
    files = os.listdir(miscdir)
    if len(files): out.write('
\n')
    for f in files:
        base_f = os.path.basename(f)
        linkpath = os.path.join('misc', base_f)
        statspath = os.path.join(miscdir, f)
        stats = os.stat(statspath)
        create_date = time.localtime(stats[9])
        create_date1 = time.localtime(stats[8])
        create_date2 = time.localtime(stats[7])
        # print "times "+ time.localtime(stats[9]) + " " + time.localtime(stats[8]) + " " + time.localtime(stats[7])
        # dir_date = time.strftime("%m/%d/%y %H:%M:%S", create_date)
        # dir_date1 = time.strftime("%m/%d/%y %H:%M:%S", create_date1)
        # dir_date2 = time.strftime("%m/%d/%y %H:%M:%S", create_date2)
        # print "\n 1.  " + dir_date
        # print "\n 2.  " + dir_date1
        # print "\n 3.  " + dir_date2
        out.write('
%s&nbsp&nbsp&nbsp&nbsp %s(CST)\n' % (linkpath, base_f, dir_date))
    if len(dirs): out.write('
\n')
    # END MISC SECTION

    out.write('\n')
    out.write('\n')
    out.close()

if __name__ == '__main__':
    if len(sys.argv) > 1:
        url = sys.argv[1]
    else:
        url = 'http://openmdao.org'
    make_download_index(url)


text:
namespace policy {

namespace {

const char kSubkeyURL[] = "url";
const char kSubkeyHash[] = "hash";

bool GetSubkeyString(const base::DictionaryValue& dict,
                     policy::PolicyErrorMap* errors,
                     const std::string& policy,
                     const std::string& subkey,
                     std::string* value) {
  const base::Value* raw_value = NULL;
  if (!dict.GetWithoutPathExpansion(subkey, &raw_value)) {
    errors->AddError(policy, subkey, IDS_POLICY_NOT_SPECIFIED_ERROR);
    return false;
  }
  std::string string_value;
  if (!raw_value->GetAsString(&string_value)) {
    errors->AddError(policy, subkey, IDS_POLICY_TYPE_ERROR, "string");
    return false;
  }
  if (string_value.empty()) {
    errors->AddError(policy, subkey, IDS_POLICY_NOT_SPECIFIED_ERROR);
    return false;
  }
  *value = string_value;
  return true;
}

const char kScreenDimDelayAC[] = "AC.Delays.ScreenDim";
const char kScreenOffDelayAC[] = "AC.Delays.ScreenOff";
const char kIdleWarningDelayAC[] = "AC.Delays.IdleWarning";
const char kIdleDelayAC[] = "AC.Delays.Idle";
const char kIdleActionAC[] = "AC.IdleAction";

const char kScreenDimDelayBattery[] = "Battery.Delays.ScreenDim";
const char kScreenOffDelayBattery[] = "Battery.Delays.ScreenOff";
const char kIdleWarningDelayBattery[] = "Battery.Delays.IdleWarning";
const char kIdleDelayBattery[] = "Battery.Delays.Idle";
const char kIdleActionBattery[] = "Battery.IdleAction";

const char kScreenLockDelayAC[] = "AC";
const char kScreenLockDelayBattery[] = "Battery";

const char kActionSuspend[] = "Suspend";
const char kActionLogout[] = "Logout";
const char kActionShutdown[]  = "Shutdown";
const char kActionDoNothing[] = "DoNothing";

scoped_ptr<base::Value> GetValue(const base::DictionaryValue* dict,
                                 const char* key) {
  const base::Value* value = NULL;
  if (!dict->Get(key, &value))
    return scoped_ptr<base::Value>();
  return scoped_ptr<base::Value>(value->DeepCopy());
}

scoped_ptr<base::Value> GetAction(const base::DictionaryValue* dict,
                                  const char* key) {
  scoped_ptr<base::Value> value = GetValue(dict, key);
  std::string action;
  if (!value || !value->GetAsString(&action))
    return scoped_ptr<base::Value>();
  if (action == kActionSuspend) {
    return scoped_ptr<base::Value>(new base::FundamentalValue(
        chromeos::PowerPolicyController::ACTION_SUSPEND));
  }
  if (action == kActionLogout) {
    return scoped_ptr<base::Value>(new base::FundamentalValue(
        chromeos::PowerPolicyController::ACTION_STOP_SESSION));
  }
  if (action == kActionShutdown) {
    return scoped_ptr<base::Value>(new base::FundamentalValue(
        chromeos::PowerPolicyController::ACTION_SHUT_DOWN));
  }
  if (action == kActionDoNothing) {
    return scoped_ptr<base::Value>(new base::FundamentalValue(
        chromeos::PowerPolicyController::ACTION_DO_NOTHING));
  }
  return scoped_ptr<base::Value>();
}

}  // namespace

ExternalDataPolicyHandler::ExternalDataPolicyHandler(const char* policy_name)
    : TypeCheckingPolicyHandler(policy_name, base::Value::TYPE_DICTIONARY) {
}

ExternalDataPolicyHandler::~ExternalDataPolicyHandler() {
}

bool ExternalDataPolicyHandler::CheckPolicySettings(const PolicyMap& policies,
                                                    PolicyErrorMap* errors) {
  if (!TypeCheckingPolicyHandler::CheckPolicySettings(policies, errors))
    return false;

  const std::string policy = policy_name();
  const base::Value* value = policies.GetValue(policy);
  if (!value)
    return true;

  const base::DictionaryValue* dict = NULL;
  value->GetAsDictionary(&dict);
  if (!dict) {
    NOTREACHED();
    return false;
  }
  std::string url_string;
  std::string hash_string;
  if (!GetSubkeyString(*dict, errors, policy, kSubkeyURL, &url_string) ||
      !GetSubkeyString(*dict, errors, policy, kSubkeyHash, &hash_string)) {
    return false;
  }

  const GURL url(url_string);
  if (!url.is_valid()) {
    errors->AddError(policy, kSubkeyURL, IDS_POLICY_VALUE_FORMAT_ERROR);
    return false;
  }

  std::vector<uint8> hash;
  if (!base::HexStringToBytes(hash_string, &hash) ||
      hash.size() != crypto::kSHA256Length) {
    errors->AddError(policy, kSubkeyHash, IDS_POLICY_VALUE_FORMAT_ERROR);
    return false;
  }

  return true;
}

void ExternalDataPolicyHandler::ApplyPolicySettings(const PolicyMap& policies,
                                                    PrefValueMap* prefs) {
}

// static
NetworkConfigurationPolicyHandler*
NetworkConfigurationPolicyHandler::CreateForUserPolicy() {
  return new NetworkConfigurationPolicyHandler(
      key::kOpenNetworkConfiguration,
      onc::ONC_SOURCE_USER_POLICY,
      prefs::kOpenNetworkConfiguration);
}

// static
NetworkConfigurationPolicyHandler*
NetworkConfigurationPolicyHandler::CreateForDevicePolicy() {
  return new NetworkConfigurationPolicyHandler(
      key::kDeviceOpenNetworkConfiguration,
      onc::ONC_SOURCE_DEVICE_POLICY,
      prefs::kDeviceOpenNetworkConfiguration);
}

NetworkConfigurationPolicyHandler::~NetworkConfigurationPolicyHandler() {}

bool NetworkConfigurationPolicyHandler::CheckPolicySettings(
    const PolicyMap& policies,
    PolicyErrorMap* errors) {
  const base::Value* value;
  if (!CheckAndGetValue(policies, errors, &value))
    return false;

  if (value) {
    std::string onc_blob;
    value->GetAsString(&onc_blob);
    scoped_ptr<base::DictionaryValue> root_dict =
        chromeos::onc::ReadDictionaryFromJson(onc_blob);
    if (root_dict.get() == NULL) {
      errors->AddError(policy_name(), IDS_POLICY_NETWORK_CONFIG_PARSE_FAILED);
      return false;
    }

    // Validate the ONC dictionary. We are liberal and ignore unknown field
    // names and ignore invalid field names in kRecommended arrays.
    chromeos::onc::Validator validator(
        false,  // Ignore unknown fields.
        false,  // Ignore invalid recommended field names.
        true,   // Fail on missing fields.
        true);  // Validate for managed ONC
    validator.SetOncSource(onc_source_);

    // ONC policies are always unencrypted.
    chromeos::onc::Validator::Result validation_result;
    root_dict = validator.ValidateAndRepairObject(
        &chromeos::onc::kToplevelConfigurationSignature, *root_dict,
        &validation_result);
    if (validation_result == chromeos::onc::Validator::VALID_WITH_WARNINGS)
      errors->AddError(policy_name(), IDS_POLICY_NETWORK_CONFIG_IMPORT_PARTIAL);
    else if (validation_result == chromeos::onc::Validator::INVALID)
      errors->AddError(policy_name(), IDS_POLICY_NETWORK_CONFIG_IMPORT_FAILED);

    // In any case, don't reject the policy as some networks or certificates
    // could still be applied.
  }

  return true;
}

void NetworkConfigurationPolicyHandler::ApplyPolicySettings(
    const PolicyMap& policies,
    PrefValueMap* prefs) {
  const base::Value* value = policies.GetValue(policy_name());
  if (!value)
    return;

  std::string onc_blob;
  value->GetAsString(&onc_blob);

  scoped_ptr<base::ListValue> network_configs(new base::ListValue);
  base::ListValue certificates;
  base::DictionaryValue global_network_config;
  chromeos::onc::ParseAndValidateOncForImport(onc_blob,
                                              onc_source_,
                                              "",
                                              network_configs.get(),
                                              &global_network_config,
                                              &certificates);

  // Currently, only the per-network configuration is stored in a pref. Ignore
  // |global_network_config| and |certificates|.
  prefs->SetValue(pref_path_, network_configs.release());
}

void NetworkConfigurationPolicyHandler::PrepareForDisplaying(
    PolicyMap* policies) const {
  const PolicyMap::Entry* entry = policies->Get(policy_name());
  if (!entry)
    return;
  base::Value* sanitized_config = SanitizeNetworkConfig(entry->value);
  if (!sanitized_config)
    sanitized_config = base::Value::CreateNullValue();

  policies->Set(policy_name(), entry->level, entry->scope,
                sanitized_config, NULL);
}

NetworkConfigurationPolicyHandler::NetworkConfigurationPolicyHandler(
    const char* policy_name,
    onc::ONCSource onc_source,
    const char* pref_path)
    : TypeCheckingPolicyHandler(policy_name, base::Value::TYPE_STRING),
      onc_source_(onc_source),
      pref_path_(pref_path) {
}

// static
base::Value* NetworkConfigurationPolicyHandler::SanitizeNetworkConfig(
    const base::Value* config) {
  std::string json_string;
  if (!config->GetAsString(&json_string))
    return NULL;

  scoped_ptr<base::DictionaryValue> toplevel_dict =
      chromeos::onc::ReadDictionaryFromJson(json_string);
  if (!toplevel_dict)
    return NULL;

  // Placeholder to insert in place of the filtered setting.
  const char kPlaceholder[] = "********";

  toplevel_dict = chromeos::onc::MaskCredentialsInOncObject(
      chromeos::onc::kToplevelConfigurationSignature,
      *toplevel_dict,
      kPlaceholder);

  base::JSONWriter::WriteWithOptions(toplevel_dict.get(),
                                     base::JSONWriter::OPTIONS_PRETTY_PRINT,
                                     &json_string);
  return new base::StringValue(json_string);
}

PinnedLauncherAppsPolicyHandler::PinnedLauncherAppsPolicyHandler()
    : ExtensionListPolicyHandler(key::kPinnedLauncherApps,
                                 prefs::kPinnedLauncherApps,
                                 false) {}

PinnedLauncherAppsPolicyHandler::~PinnedLauncherAppsPolicyHandler() {}

void PinnedLauncherAppsPolicyHandler::ApplyPolicySettings(
    const PolicyMap& policies,
    PrefValueMap* prefs) {
  PolicyErrorMap errors;
  const base::Value* policy_value = policies.GetValue(policy_name());
  const base::ListValue* policy_list = NULL;
  if (policy_value && policy_value->GetAsList(&policy_list) && policy_list) {
    base::ListValue* pinned_apps_list = new base::ListValue();
    for (base::ListValue::const_iterator entry(policy_list->begin());
         entry != policy_list->end(); ++entry) {
      std::string id;
      if ((*entry)->GetAsString(&id)) {
        base::DictionaryValue* app_dict = new base::DictionaryValue();
        app_dict->SetString(ash::kPinnedAppsPrefAppIDPath, id);
        pinned_apps_list->Append(app_dict);
      }
    }
    prefs->SetValue(pref_path(), pinned_apps_list);
  }
}

ScreenMagnifierPolicyHandler::ScreenMagnifierPolicyHandler()
    : IntRangePolicyHandlerBase(key::kScreenMagnifierType,
                                0, ui::MAGNIFIER_FULL, false) {
}

ScreenMagnifierPolicyHandler::~ScreenMagnifierPolicyHandler() {
}

void ScreenMagnifierPolicyHandler::ApplyPolicySettings(
    const PolicyMap& policies,
    PrefValueMap* prefs) {
  const base::Value* value = policies.GetValue(policy_name());
  int value_in_range;
  if (value && EnsureInRange(value, &value_in_range, NULL)) {
    prefs->SetValue(prefs::kAccessibilityScreenMagnifierEnabled,
                    new base::FundamentalValue(value_in_range != 0));
    prefs->SetValue(prefs::kAccessibilityScreenMagnifierType,
                    new base::FundamentalValue(value_in_range));
  }
}

LoginScreenPowerManagementPolicyHandler::
    LoginScreenPowerManagementPolicyHandler(const Schema& chrome_schema)
    : SchemaValidatingPolicyHandler(key::kDeviceLoginScreenPowerManagement,
                                    chrome_schema.GetKnownProperty(
                                        key::kDeviceLoginScreenPowerManagement),
                                    SCHEMA_ALLOW_UNKNOWN) {
}

LoginScreenPowerManagementPolicyHandler::
    ~LoginScreenPowerManagementPolicyHandler() {
}

void LoginScreenPowerManagementPolicyHandler::ApplyPolicySettings(
    const PolicyMap& policies,
    PrefValueMap* prefs) {
}

DeprecatedIdleActionHandler::DeprecatedIdleActionHandler()
    : IntRangePolicyHandlerBase(
          key::kIdleAction,
          chromeos::PowerPolicyController::ACTION_SUSPEND,
          chromeos::PowerPolicyController::ACTION_DO_NOTHING,
          false) {}

DeprecatedIdleActionHandler::~DeprecatedIdleActionHandler() {}

void DeprecatedIdleActionHandler::ApplyPolicySettings(const PolicyMap& policies,
                                                      PrefValueMap* prefs) {
  const base::Value* value = policies.GetValue(policy_name());
  if (value && EnsureInRange(value, NULL, NULL)) {
    if (!prefs->GetValue(prefs::kPowerAcIdleAction, NULL))
      prefs->SetValue(prefs::kPowerAcIdleAction, value->DeepCopy());
    if (!prefs->GetValue(prefs::kPowerBatteryIdleAction, NULL))
      prefs->SetValue(prefs::kPowerBatteryIdleAction, value->DeepCopy());
  }
}

PowerManagementIdleSettingsPolicyHandler::
    PowerManagementIdleSettingsPolicyHandler(const Schema& chrome_schema)
    : SchemaValidatingPolicyHandler(
          key::kPowerManagementIdleSettings,
          chrome_schema.GetKnownProperty(key::kPowerManagementIdleSettings),
          SCHEMA_ALLOW_UNKNOWN) {
}

PowerManagementIdleSettingsPolicyHandler::
    ~PowerManagementIdleSettingsPolicyHandler() {
}

void PowerManagementIdleSettingsPolicyHandler::ApplyPolicySettings(
    const PolicyMap& policies,
    PrefValueMap* prefs) {
  scoped_ptr<base::Value> policy_value;
  if (!CheckAndGetValue(policies, NULL, &policy_value))
    return;
  const base::DictionaryValue* dict = NULL;
  if (!policy_value->GetAsDictionary(&dict)) {
    NOTREACHED();
    return;
  }
  scoped_ptr<base::Value> value;

  value = GetValue(dict, kScreenDimDelayAC);
  if (value)
    prefs->SetValue(prefs::kPowerAcScreenDimDelayMs, value.release());
  value = GetValue(dict, kScreenOffDelayAC);
  if (value)
    prefs->SetValue(prefs::kPowerAcScreenOffDelayMs, value.release());
  value = GetValue(dict, kIdleWarningDelayAC);
  if (value)
    prefs->SetValue(prefs::kPowerAcIdleWarningDelayMs, value.release());
  value = GetValue(dict, kIdleDelayAC);
  if (value)
    prefs->SetValue(prefs::kPowerAcIdleDelayMs, value.release());
  value = GetAction(dict, kIdleActionAC);
  if (value)
    prefs->SetValue(prefs::kPowerAcIdleAction, value.release());

  value = GetValue(dict, kScreenDimDelayBattery);
  if (value)
    prefs->SetValue(prefs::kPowerBatteryScreenDimDelayMs, value.release());
  value = GetValue(dict, kScreenOffDelayBattery);
  if (value)
    prefs->SetValue(prefs::kPowerBatteryScreenOffDelayMs, value.release());
  value = GetValue(dict, kIdleWarningDelayBattery);
  if (value)
    prefs->SetValue(prefs::kPowerBatteryIdleWarningDelayMs, value.release());
  value = GetValue(dict, kIdleDelayBattery);
  if (value)
    prefs->SetValue(prefs::kPowerBatteryIdleDelayMs, value.release());
  value = GetAction(dict, kIdleActionBattery);
  if (value)
    prefs->SetValue(prefs::kPowerBatteryIdleAction, value.release());
}

ScreenLockDelayPolicyHandler::ScreenLockDelayPolicyHandler(
    const Schema& chrome_schema)
    : SchemaValidatingPolicyHandler(
          key::kScreenLockDelays,
          chrome_schema.GetKnownProperty(key::kScreenLockDelays),
          SCHEMA_ALLOW_UNKNOWN) {
}

ScreenLockDelayPolicyHandler::~ScreenLockDelayPolicyHandler() {
}

void ScreenLockDelayPolicyHandler::ApplyPolicySettings(
    const PolicyMap& policies,
    PrefValueMap* prefs) {
  scoped_ptr<base::Value> policy_value;
  if (!CheckAndGetValue(policies, NULL, &policy_value))
    return;
  const base::DictionaryValue* dict = NULL;
  if (!policy_value->GetAsDictionary(&dict)) {
    NOTREACHED();
    return;
  }
  scoped_ptr<base::Value> value;

  value = GetValue(dict, kScreenLockDelayAC);
  if (value)
    prefs->SetValue(prefs::kPowerAcScreenLockDelayMs, value.release());
  value = GetValue(dict, kScreenLockDelayBattery);
  if (value)
    prefs->SetValue(prefs::kPowerBatteryScreenLockDelayMs, value.release());
}

}  // namespace policy


text:
package com.opengamma.financial.security.future;

import java.util.Map;

import org.joda.beans.Bean;
import org.joda.beans.BeanBuilder;
import org.joda.beans.BeanDefinition;
import org.joda.beans.JodaBeanUtils;
import org.joda.beans.MetaProperty;
import org.joda.beans.Property;
import org.joda.beans.PropertyDefinition;
import org.joda.beans.impl.direct.DirectMetaProperty;
import org.joda.beans.impl.direct.DirectMetaPropertyMap;

import com.opengamma.financial.security.FinancialSecurity;
import com.opengamma.master.security.SecurityDescription;
import com.opengamma.util.money.Currency;
import com.opengamma.util.time.Expiry;

/**
 * An abstract base class for future securities.
 */
@BeanDefinition
@SecurityDescription(type = FutureSecurity.SECURITY_TYPE, description = "Future")
public abstract class FutureSecurity extends FinancialSecurity {

  /** Serialization version. */
  private static final long serialVersionUID = 1L;

  /**
   * The security type.
   */
  public static final String SECURITY_TYPE = "FUTURE";

  /**
   * The expiry.
   */
  @PropertyDefinition(validate = "notNull")
  private Expiry _expiry;
  /**
   * The trading exchange.
   */
  @PropertyDefinition(validate = "notNull")
  private String _tradingExchange;
  /**
   * The settlement exchange.
   */
  @PropertyDefinition(validate = "notNull")
  private String _settlementExchange;
  /**
   * The currency.
   */
  @PropertyDefinition(validate = "notNull")
  private Currency _currency;
  /**
   * The unit amount. This represents the PNL of a single long contract if its price increases by 1.0. Also known as the 'Point Value'.
   */
  @PropertyDefinition
  private double _unitAmount;

  /**
   * The future category.
   */
  @PropertyDefinition(validate = "notNull")
  private String _contractCategory;

  /**
   * Creates an empty instance.
   * <p>
   * The security details should be set before use.
   */
  protected FutureSecurity() {
    super(SECURITY_TYPE);
  }

  /**
   * @param expiry
   *          the expiry of the future, not null
   * @param tradingExchange
   *          the name of the trading exchange, not null
   * @param settlementExchange
   *          the name of the settlement exchange, not null
   * @param currency
   *          the currency, not null
   * @param unitAmount
   *          the unit amount, not null. This represents the PNL of a single long contract if its price increases by 1.0. Also known as the 'Point Value'.
   * @param category
   *          the future category, not null
   */
  protected FutureSecurity(final Expiry expiry, final String tradingExchange, final String settlementExchange, final Currency currency, final double unitAmount,
      final String category) {
    super(SECURITY_TYPE);
    setExpiry(expiry);
    setTradingExchange(tradingExchange);
    setSettlementExchange(settlementExchange);
    setCurrency(currency);
    setUnitAmount(unitAmount);
    setContractCategory(category);
  }

  //------------------------- AUTOGENERATED START -------------------------
  ///CLOVER:OFF
  /**
   * The meta-bean for {@code FutureSecurity}.
   * @return the meta-bean, not null
   */
  public static FutureSecurity.Meta meta() {
    return FutureSecurity.Meta.INSTANCE;
  }

  static {
    JodaBeanUtils.registerMetaBean(FutureSecurity.Meta.INSTANCE);
  }

  @Override
  public FutureSecurity.Meta metaBean() {
    return FutureSecurity.Meta.INSTANCE;
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the expiry.
   * @return the value of the property, not null
   */
  public Expiry getExpiry() {
    return _expiry;
  }

  /**
   * Sets the expiry.
   * @param expiry  the new value of the property, not null
   */
  public void setExpiry(Expiry expiry) {
    JodaBeanUtils.notNull(expiry, "expiry");
    this._expiry = expiry;
  }

  /**
   * Gets the the {@code expiry} property.
   * @return the property, not null
   */
  public final Property<Expiry> expiry() {
    return metaBean().expiry().createProperty(this);
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the trading exchange.
   * @return the value of the property, not null
   */
  public String getTradingExchange() {
    return _tradingExchange;
  }

  /**
   * Sets the trading exchange.
   * @param tradingExchange  the new value of the property, not null
   */
  public void setTradingExchange(String tradingExchange) {
    JodaBeanUtils.notNull(tradingExchange, "tradingExchange");
    this._tradingExchange = tradingExchange;
  }

  /**
   * Gets the the {@code tradingExchange} property.
   * @return the property, not null
   */
  public final Property<String> tradingExchange() {
    return metaBean().tradingExchange().createProperty(this);
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the settlement exchange.
   * @return the value of the property, not null
   */
  public String getSettlementExchange() {
    return _settlementExchange;
  }

  /**
   * Sets the settlement exchange.
   * @param settlementExchange  the new value of the property, not null
   */
  public void setSettlementExchange(String settlementExchange) {
    JodaBeanUtils.notNull(settlementExchange, "settlementExchange");
    this._settlementExchange = settlementExchange;
  }

  /**
   * Gets the the {@code settlementExchange} property.
   * @return the property, not null
   */
  public final Property<String> settlementExchange() {
    return metaBean().settlementExchange().createProperty(this);
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the currency.
   * @return the value of the property, not null
   */
  public Currency getCurrency() {
    return _currency;
  }

  /**
   * Sets the currency.
   * @param currency  the new value of the property, not null
   */
  public void setCurrency(Currency currency) {
    JodaBeanUtils.notNull(currency, "currency");
    this._currency = currency;
  }

  /**
   * Gets the the {@code currency} property.
   * @return the property, not null
   */
  public final Property<Currency> currency() {
    return metaBean().currency().createProperty(this);
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the unit amount. This represents the PNL of a single long contract if its price increases by 1.0. Also known as the 'Point Value'.
   * @return the value of the property
   */
  public double getUnitAmount() {
    return _unitAmount;
  }

  /**
   * Sets the unit amount. This represents the PNL of a single long contract if its price increases by 1.0. Also known as the 'Point Value'.
   * @param unitAmount  the new value of the property
   */
  public void setUnitAmount(double unitAmount) {
    this._unitAmount = unitAmount;
  }

  /**
   * Gets the the {@code unitAmount} property.
   * @return the property, not null
   */
  public final Property<Double> unitAmount() {
    return metaBean().unitAmount().createProperty(this);
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the future category.
   * @return the value of the property, not null
   */
  public String getContractCategory() {
    return _contractCategory;
  }

  /**
   * Sets the future category.
   * @param contractCategory  the new value of the property, not null
   */
  public void setContractCategory(String contractCategory) {
    JodaBeanUtils.notNull(contractCategory, "contractCategory");
    this._contractCategory = contractCategory;
  }

  /**
   * Gets the the {@code contractCategory} property.
   * @return the property, not null
   */
  public final Property<String> contractCategory() {
    return metaBean().contractCategory().createProperty(this);
  }

  //-----------------------------------------------------------------------
  @Override
  public boolean equals(Object obj) {
    if (obj == this) {
      return true;
    }
    if (obj != null && obj.getClass() == this.getClass()) {
      FutureSecurity other = (FutureSecurity) obj;
      return JodaBeanUtils.equal(getExpiry(), other.getExpiry()) &&
          JodaBeanUtils.equal(getTradingExchange(), other.getTradingExchange()) &&
          JodaBeanUtils.equal(getSettlementExchange(), other.getSettlementExchange()) &&
          JodaBeanUtils.equal(getCurrency(), other.getCurrency()) &&
          JodaBeanUtils.equal(getUnitAmount(), other.getUnitAmount()) &&
          JodaBeanUtils.equal(getContractCategory(), other.getContractCategory()) &&
          super.equals(obj);
    }
    return false;
  }

  @Override
  public int hashCode() {
    int hash = 7;
    hash = hash * 31 + JodaBeanUtils.hashCode(getExpiry());
    hash = hash * 31 + JodaBeanUtils.hashCode(getTradingExchange());
    hash = hash * 31 + JodaBeanUtils.hashCode(getSettlementExchange());
    hash = hash * 31 + JodaBeanUtils.hashCode(getCurrency());
    hash = hash * 31 + JodaBeanUtils.hashCode(getUnitAmount());
    hash = hash * 31 + JodaBeanUtils.hashCode(getContractCategory());
    return hash ^ super.hashCode();
  }

  @Override
  public String toString() {
    StringBuilder buf = new StringBuilder(224);
    buf.append("FutureSecurity{");
    int len = buf.length();
    toString(buf);
    if (buf.length() > len) {
      buf.setLength(buf.length() - 2);
    }
    buf.append('}');
    return buf.toString();
  }

  @Override
  protected void toString(StringBuilder buf) {
    super.toString(buf);
    buf.append("expiry").append('=').append(JodaBeanUtils.toString(getExpiry())).append(',').append(' ');
    buf.append("tradingExchange").append('=').append(JodaBeanUtils.toString(getTradingExchange())).append(',').append(' ');
    buf.append("settlementExchange").append('=').append(JodaBeanUtils.toString(getSettlementExchange())).append(',').append(' ');
    buf.append("currency").append('=').append(JodaBeanUtils.toString(getCurrency())).append(',').append(' ');
    buf.append("unitAmount").append('=').append(JodaBeanUtils.toString(getUnitAmount())).append(',').append(' ');
    buf.append("contractCategory").append('=').append(JodaBeanUtils.toString(getContractCategory())).append(',').append(' ');
  }

  //-----------------------------------------------------------------------
  /**
   * The meta-bean for {@code FutureSecurity}.
   */
  public static class Meta extends FinancialSecurity.Meta {
    /**
     * The singleton instance of the meta-bean.
     */
    static final Meta INSTANCE = new Meta();

    /**
     * The meta-property for the {@code expiry} property.
     */
    private final MetaProperty<Expiry> _expiry = DirectMetaProperty.ofReadWrite(
        this, "expiry", FutureSecurity.class, Expiry.class);
    /**
     * The meta-property for the {@code tradingExchange} property.
     */
    private final MetaProperty<String> _tradingExchange = DirectMetaProperty.ofReadWrite(
        this, "tradingExchange", FutureSecurity.class, String.class);
    /**
     * The meta-property for the {@code settlementExchange} property.
     */
    private final MetaProperty<String> _settlementExchange = DirectMetaProperty.ofReadWrite(
        this, "settlementExchange", FutureSecurity.class, String.class);
    /**
     * The meta-property for the {@code currency} property.
     */
    private final MetaProperty<Currency> _currency = DirectMetaProperty.ofReadWrite(
        this, "currency", FutureSecurity.class, Currency.class);
    /**
     * The meta-property for the {@code unitAmount} property.
     */
    private final MetaProperty<Double> _unitAmount = DirectMetaProperty.ofReadWrite(
        this, "unitAmount", FutureSecurity.class, Double.TYPE);
    /**
     * The meta-property for the {@code contractCategory} property.
     */
    private final MetaProperty<String> _contractCategory = DirectMetaProperty.ofReadWrite(
        this, "contractCategory", FutureSecurity.class, String.class);
    /**
     * The meta-properties.
     */
    private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap(
        this, (DirectMetaPropertyMap) super.metaPropertyMap(),
        "expiry",
        "tradingExchange",
        "settlementExchange",
        "currency",
        "unitAmount",
        "contractCategory");

    /**
     * Restricted constructor.
     */
    protected Meta() {
    }

    @Override
    protected MetaProperty<?> metaPropertyGet(String propertyName) {
      switch (propertyName.hashCode()) {
        case -1289159373:  // expiry
          return _expiry;
        case -661485980:  // tradingExchange
          return _tradingExchange;
        case 389497452:  // settlementExchange
          return _settlementExchange;
        case 575402001:  // currency
          return _currency;
        case 1673913084:  // unitAmount
          return _unitAmount;
        case -666828752:  // contractCategory
          return _contractCategory;
      }
      return super.metaPropertyGet(propertyName);
    }

    @Override
    public BeanBuilder<? extends FutureSecurity> builder() {
      throw new UnsupportedOperationException("FutureSecurity is an abstract class");
    }

    @Override
    public Class<? extends FutureSecurity> beanType() {
      return FutureSecurity.class;
    }

    @Override
    public Map<String, MetaProperty<?>> metaPropertyMap() {
      return _metaPropertyMap$;
    }

    //-----------------------------------------------------------------------
    /**
     * The meta-property for the {@code expiry} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<Expiry> expiry() {
      return _expiry;
    }

    /**
     * The meta-property for the {@code tradingExchange} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<String> tradingExchange() {
      return _tradingExchange;
    }

    /**
     * The meta-property for the {@code settlementExchange} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<String> settlementExchange() {
      return _settlementExchange;
    }

    /**
     * The meta-property for the {@code currency} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<Currency> currency() {
      return _currency;
    }

    /**
     * The meta-property for the {@code unitAmount} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<Double> unitAmount() {
      return _unitAmount;
    }

    /**
     * The meta-property for the {@code contractCategory} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<String> contractCategory() {
      return _contractCategory;
    }

    //-----------------------------------------------------------------------
    @Override
    protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
      switch (propertyName.hashCode()) {
        case -1289159373:  // expiry
          return ((FutureSecurity) bean).getExpiry();
        case -661485980:  // tradingExchange
          return ((FutureSecurity) bean).getTradingExchange();
        case 389497452:  // settlementExchange
          return ((FutureSecurity) bean).getSettlementExchange();
        case 575402001:  // currency
          return ((FutureSecurity) bean).getCurrency();
        case 1673913084:  // unitAmount
          return ((FutureSecurity) bean).getUnitAmount();
        case -666828752:  // contractCategory
          return ((FutureSecurity) bean).getContractCategory();
      }
      return super.propertyGet(bean, propertyName, quiet);
    }

    @Override
    protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
      switch (propertyName.hashCode()) {
        case -1289159373:  // expiry
          ((FutureSecurity) bean).setExpiry((Expiry) newValue);
          return;
        case -661485980:  // tradingExchange
          ((FutureSecurity) bean).setTradingExchange((String) newValue);
          return;
        case 389497452:  // settlementExchange
          ((FutureSecurity) bean).setSettlementExchange((String) newValue);
          return;
        case 575402001:  // currency
          ((FutureSecurity) bean).setCurrency((Currency) newValue);
          return;
        case 1673913084:  // unitAmount
          ((FutureSecurity) bean).setUnitAmount((Double) newValue);
          return;
        case -666828752:  // contractCategory
          ((FutureSecurity) bean).setContractCategory((String) newValue);
          return;
      }
      super.propertySet(bean, propertyName, newValue, quiet);
    }

    @Override
    protected void validate(Bean bean) {
      JodaBeanUtils.notNull(((FutureSecurity) bean)._expiry, "expiry");
      JodaBeanUtils.notNull(((FutureSecurity) bean)._tradingExchange, "tradingExchange");
      JodaBeanUtils.notNull(((FutureSecurity) bean)._settlementExchange, "settlementExchange");
      JodaBeanUtils.notNull(((FutureSecurity) bean)._currency, "currency");
      JodaBeanUtils.notNull(((FutureSecurity) bean)._contractCategory, "contractCategory");
      super.validate(bean);
    }

  }

  ///CLOVER:ON
  //-------------------------- AUTOGENERATED END --------------------------
}


text:
namespace Fixtures.AcceptanceTestsBodyComplex
{
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;
    using Microsoft.Rest;
    using Models;

    /// <summary>
    /// Extension methods for Inheritance.
    /// </summary>
    public static partial class InheritanceExtensions
    {
            /// <summary>
            /// Get complex types that extend others
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            public static Siamese GetValid(this IInheritance operations)
            {
                return Task.Factory.StartNew(s => ((IInheritance)s).GetValidAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Get complex types that extend others
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task<Siamese> GetValidAsync(this IInheritance operations, CancellationToken cancellationToken = default(CancellationToken))
            {
                using (var _result = await operations.GetValidWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
                {
                    return _result.Body;
                }
            }

            /// <summary>
            /// Put complex types that extend others
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='complexBody'>
            /// Please put a siamese with id=2, name="Siameee", color=green,
            /// breed=persion, which hates 2 dogs, the 1st one named "Potato" with id=1
            /// and food="tomato", and the 2nd one named "Tomato" with id=-1 and
            /// food="french fries".
            /// </param>
            public static void PutValid(this IInheritance operations, Siamese complexBody)
            {
                Task.Factory.StartNew(s => ((IInheritance)s).PutValidAsync(complexBody), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
            }

            /// <summary>
            /// Put complex types that extend others
            /// </summary>
            /// <param name='operations'>
            /// The operations group for this extension method.
            /// </param>
            /// <param name='complexBody'>
            /// Please put a siamese with id=2, name="Siameee", color=green,
            /// breed=persion, which hates 2 dogs, the 1st one named "Potato" with id=1
            /// and food="tomato", and the 2nd one named "Tomato" with id=-1 and
            /// food="french fries".
            /// </param>
            /// <param name='cancellationToken'>
            /// The cancellation token.
            /// </param>
            public static async Task PutValidAsync(this IInheritance operations, Siamese complexBody, CancellationToken cancellationToken = default(CancellationToken))
            {
                await operations.PutValidWithHttpMessagesAsync(complexBody, null, cancellationToken).ConfigureAwait(false);
            }

    }
}


text:
package eu.reactivesystems.league.impl

import com.lightbend.lagom.scaladsl.persistence.{
  AggregateEvent,
  AggregateEventTag
}
import play.api.libs.json.{Format, Json}

/**
  * This interface defines all the events that the LeagueEntity supports.
  */
sealed trait LeagueEvent extends AggregateEvent[LeagueEvent] {
  override val aggregateTag = LeagueEvent.Tag
}

object LeagueEvent {
  val Tag: AggregateEventTag[LeagueEvent] = AggregateEventTag[LeagueEvent]
}

case class ClubRegistered(club: ClubData) extends LeagueEvent

object ClubRegistered {
  implicit val format: Format[ClubRegistered] = Json.format
}

case class GamePlayed(game: GameData) extends LeagueEvent

object GamePlayed {
  implicit val format: Format[GamePlayed] = Json.format
}

case class ResultRevoked(game: GameData) extends LeagueEvent

object ResultRevoked {
  implicit val format: Format[ResultRevoked] = Json.format
}


text:
#include <nan.h>

using namespace Nan;  // NOLINT(build/namespaces)

class MyObject : public ObjectWrap {
 public:
  static NAN_MODULE_INIT(Init) {
    v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
    tpl->SetClassName(Nan::New("MyObject").ToLocalChecked());
    tpl->InstanceTemplate()->SetInternalFieldCount(1);

    SetPrototypeMethod(tpl, "getHandle", GetHandle);
    SetPrototypeMethod(tpl, "getHandleConst", GetHandleConst);
    SetPrototypeMethod(tpl, "getValue", GetValue);

    constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked());
    Set(target, Nan::New("MyObject").ToLocalChecked(),
      Nan::GetFunction(tpl).ToLocalChecked());
  }

 private:
  explicit MyObject(double value = 0) : value_(value) {}
  ~MyObject() {}

  static NAN_METHOD(New) {
    if (info.IsConstructCall()) {
      double value =
          info[0]->IsUndefined() ? 0 : Nan::To<double>(info[0]).FromJust();
      MyObject *obj = new MyObject(value);
      obj->Wrap(info.This());
      info.GetReturnValue().Set(info.This());
    } else {
      const int argc = 1;
      v8::Local<v8::Value> argv[argc] = {info[0]};
      v8::Local<v8::Function> cons = Nan::New(constructor());
      info.GetReturnValue().Set(
          Nan::NewInstance(cons, argc, argv).ToLocalChecked());
    }
  }

  static NAN_METHOD(GetHandle) {
    MyObject* obj = ObjectWrap::Unwrap<MyObject>(info.Holder());
    info.GetReturnValue().Set(obj->handle());
  }

  static NAN_METHOD(GetHandleConst) {
    MyObject const *obj = ObjectWrap::Unwrap<MyObject>(info.Holder());
    info.GetReturnValue().Set(obj->handle());
  }

  static NAN_METHOD(GetValue) {
    MyObject* obj = ObjectWrap::Unwrap<MyObject>(info.Holder());
    info.GetReturnValue().Set(obj->value_);
  }

  static inline Persistent<v8::Function> & constructor() {
    static Persistent<v8::Function> my_constructor;
    return my_constructor;
  }

  double value_;
};

NODE_MODULE(objectwraphandle, MyObject::Init)


text:
<?php

namespace Dingo\Api\Routing;

use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Illuminate\Container\Container;
use Dingo\Api\Contract\Routing\Adapter;

class Route extends \Illuminate\Routing\Route
{
    /**
     * Routing adapter instance.
     *
     * @var \Dingo\Api\Contract\Routing\Adapter
     */
    protected $adapter;

    /**
     * Array of versions this route will respond to.
     *
     * @var array
     */
    protected $versions;

    /**
     * Array of scopes for OAuth 2.0 authentication.
     *
     * @var array
     */
    protected $scopes;

    /**
     * Array of authentication providers.
     *
     * @var array
     */
    protected $authenticationProviders;

    /**
     * The rate limit for this route.
     *
     * @var int
     */
    protected $rateLimit;

    /**
     * The expiration time for any rate limit set on this rate.
     *
     * @var int
     */
    protected $rateExpiration;

    /**
     * The throttle used by the route, takes precedence over rate limits.
     *
     * @return string|\Dingo\Api\Contract\Http\RateLimit\Throttle
     */
    protected $throttle;

    /**
     * Controller class name.
     *
     * @var string
     */
    protected $controllerClass;

    /**
     * Indicates if the request is conditional.
     *
     * @var bool
     */
    protected $conditionalRequest = true;

    /**
     * Middleware applied to route.
     *
     * @var array
     */
    protected $middleware;
    private $route;

    /**
     * Create a new route instance.
     *
     * @param \Dingo\Api\Contract\Routing\Adapter $adapter
     * @param \Illuminate\Container\Container     $container
     * @param \Illuminate\Http\Request            $request
     * @param array|\Illuminate\Routing\Route     $route
     */
    public function __construct(Adapter $adapter, Container $container, Request $request, $route)
    {
        $this->adapter = $adapter;
        $this->container = $container;
        $this->route = $route;

        $this->setupRouteProperties($request, $route);

        parent::__construct($this->methods, $this->uri, $this->action);
    }

    /**
     * Setup the route properties.
     *
     * @param Request $request
     * @param         $route
     *
     * @return void
     */
    protected function setupRouteProperties(Request $request, $route)
    {
        [$this->uri, $this->methods, $this->action] = $this->adapter->getRouteProperties($route, $request);

        $this->versions = Arr::pull($this->action, 'version');
        $this->conditionalRequest = Arr::pull($this->action, 'conditionalRequest', true);
        $this->middleware = (array) Arr::pull($this->action, 'middleware', []);
        $this->throttle = Arr::pull($this->action, 'throttle');
        $this->scopes = Arr::pull($this->action, 'scopes', []);
        $this->authenticationProviders = Arr::pull($this->action, 'providers', []);
        $this->rateLimit = Arr::pull($this->action, 'limit', 0);
        $this->rateExpiration = Arr::pull($this->action, 'expires', 0);

        // Now that the default route properties have been set we'll go ahead and merge
        // any controller properties to fully configure the route.
        $this->mergeControllerProperties();

        // If we have a string based throttle then we'll new up an instance of the
        // throttle through the container.
        if (is_string($this->throttle)) {
            $this->throttle = $this->container->make($this->throttle);
        }
    }

    /**
     * Merge the controller properties onto the route properties.
     */
    protected function mergeControllerProperties()
    {
        if (isset($this->action['uses']) && is_string($this->action['uses']) && Str::contains($this->action['uses'],
                '@')) {
            $this->action['controller'] = $this->action['uses'];

            $this->makeControllerInstance();
        }

        if (! $this->controllerUsesHelpersTrait()) {
            return;
        }

        $controller = $this->getControllerInstance();

        $controllerMiddleware = [];

        if (method_exists($controller, 'getMiddleware')) {
            $controllerMiddleware = $controller->getMiddleware();
        } elseif (method_exists($controller, 'getMiddlewareForMethod')) {
            $controllerMiddleware = $controller->getMiddlewareForMethod($this->controllerMethod);
        }

        $this->middleware = array_merge($this->middleware, $controllerMiddleware);

        if ($property = $this->findControllerPropertyOptions('throttles')) {
            $this->throttle = $property['class'];
        }

        if ($property = $this->findControllerPropertyOptions('scopes')) {
            $this->scopes = array_merge($this->scopes, $property['scopes']);
        }

        if ($property = $this->findControllerPropertyOptions('authenticationProviders')) {
            $this->authenticationProviders = array_merge($this->authenticationProviders, $property['providers']);
        }

        if ($property = $this->findControllerPropertyOptions('rateLimit')) {
            $this->rateLimit = $property['limit'];
            $this->rateExpiration = $property['expires'];
        }
    }

    /**
     * Find the controller options and whether or not it will apply to this routes controller method.
     *
     * @param string $name
     *
     * @return array
     */
    protected function findControllerPropertyOptions($name)
    {
        $properties = [];

        foreach ($this->getControllerInstance()->{'get'.ucfirst($name)}() as $property) {
            if (isset($property['options']) && ! $this->optionsApplyToControllerMethod($property['options'])) {
                continue;
            }

            unset($property['options']);

            $properties = array_merge_recursive($properties, $property);
        }

        return $properties;
    }

    /**
     * Determine if a controller method is in an array of options.
     *
     * @param array $options
     *
     * @return bool
     */
    protected function optionsApplyToControllerMethod(array $options)
    {
        if (empty($options)) {
            return true;
        } elseif (isset($options['only']) && in_array($this->controllerMethod,
                $this->explodeOnPipes($options['only']))) {
            return true;
        } elseif (isset($options['except'])) {
            return ! in_array($this->controllerMethod, $this->explodeOnPipes($options['except']));
        } elseif (in_array($this->controllerMethod, $this->explodeOnPipes($options))) {
            return true;
        }

        return false;
    }

    /**
     * Explode a value on a pipe delimiter.
     *
     * @param string|array $value
     *
     * @return array
     */
    protected function explodeOnPipes($value)
    {
        return is_string($value) ? explode('|', $value) : $value;
    }

    /**
     * Determine if the controller instance uses the helpers trait.
     *
     * @return bool
     */
    protected function controllerUsesHelpersTrait()
    {
        if (! $controller = $this->getControllerInstance()) {
            return false;
        }

        $traits = [];

        do {
            $traits = array_merge(class_uses($controller, false), $traits);
        } while ($controller = get_parent_class($controller));

        foreach ($traits as $trait => $same) {
            $traits = array_merge(class_uses($trait, false), $traits);
        }

        return isset($traits[Helpers::class]);
    }

    /**
     * Get the routes controller instance.
     *
     * @return null|\Illuminate\Routing\Controller|\Laravel\Lumen\Routing\Controller
     */
    public function getControllerInstance()
    {
        return $this->controller;
    }

    /**
     * Make a new controller instance through the container.
     *
     * @return \Illuminate\Routing\Controller|\Laravel\Lumen\Routing\Controller
     */
    protected function makeControllerInstance()
    {
        [$this->controllerClass, $this->controllerMethod] = explode('@', $this->action['uses']);

        $this->container->instance($this->controllerClass,
            $this->controller = $this->container->make($this->controllerClass));

        return $this->controller;
    }

    /**
     * Determine if the route is protected.
     *
     * @return bool
     */
    public function isProtected()
    {
        if (isset($this->middleware['api.auth']) || in_array('api.auth', $this->middleware)) {
            if ($this->controller && isset($this->middleware['api.auth'])) {
                return $this->optionsApplyToControllerMethod($this->middleware['api.auth']);
            }

            return true;
        }

        return false;
    }

    /**
     * Determine if the route has a throttle.
     *
     * @return bool
     */
    public function hasThrottle()
    {
        return ! is_null($this->throttle);
    }

    /**
     * Get the route throttle.
     *
     * @return string|\Dingo\Api\Http\RateLimit\Throttle\Throttle
     */
    public function throttle()
    {
        return $this->throttle;
    }

    /**
     * Get the route throttle.
     *
     * @return string|\Dingo\Api\Http\RateLimit\Throttle\Throttle
     */
    public function getThrottle()
    {
        return $this->throttle;
    }

    /**
     * Get the route scopes.
     *
     * @return array
     */
    public function scopes()
    {
        return $this->scopes;
    }

    /**
     * Get the route scopes.
     *
     * @return array
     */
    public function getScopes()
    {
        return $this->scopes;
    }

    /**
     * Check if route requires all scopes or any scope to be valid.
     *
     * @return bool
     */
    public function scopeStrict()
    {
        return Arr::get($this->action, 'scopeStrict', false);
    }

    /**
     * Get the route authentication providers.
     *
     * @return array
     */
    public function authenticationProviders()
    {
        return $this->authenticationProviders;
    }

    /**
     * Get the route authentication providers.
     *
     * @return array
     */
    public function getAuthenticationProviders()
    {
        return $this->authenticationProviders;
    }

    /**
     * Get the rate limit for this route.
     *
     * @return int
     */
    public function rateLimit()
    {
        return $this->rateLimit;
    }

    /**
     * Get the rate limit for this route.
     *
     * @return int
     */
    public function getRateLimit()
    {
        return $this->rateLimit;
    }

    /**
     * Get the rate limit expiration time for this route.
     *
     * @return int
     */
    public function rateLimitExpiration()
    {
        return $this->rateExpiration;
    }

    /**
     * Get the rate limit expiration time for this route.
     *
     * @return int
     */
    public function getRateLimitExpiration()
    {
        return $this->rateExpiration;
    }

    /**
     * Get the name of the route.
     *
     * @return string
     */
    public function getName()
    {
        return Arr::get($this->action, 'as', null);
    }

    /**
     * Determine if the request is conditional.
     *
     * @return bool
     */
    public function requestIsConditional()
    {
        return $this->conditionalRequest === true;
    }

    /**
     * Get the versions for the route.
     *
     * @return array
     */
    public function getVersions()
    {
        return $this->versions;
    }

    /**
     * Get the versions for the route.
     *
     * @return array
     */
    public function versions()
    {
        return $this->getVersions();
    }

    /**
     * Get the URI associated with the route.
     *
     * @return string
     */
    public function getPath()
    {
        return $this->uri();
    }

    /**
     * Get the URI associated with the route.
     *
     * @return string
     */
    public function uri()
    {
        return $this->uri;
    }

    /**
     * Get the HTTP verbs the route responds to.
     *
     * @return array
     */
    public function getMethods()
    {
        return $this->methods();
    }

    /**
     * Get the HTTP verbs the route responds to.
     *
     * @return array
     */
    public function methods()
    {
        return $this->methods;
    }

    /**
     * Determine if the route only responds to HTTP requests.
     *
     * @return bool
     */
    public function httpOnly()
    {
        return in_array('http', $this->action, true)
            || (array_key_exists('http', $this->action) && $this->action['http']);
    }

    /**
     * Determine if the route only responds to HTTPS requests.
     *
     * @return bool
     */
    public function httpsOnly()
    {
        return $this->secure();
    }

    /**
     * Determine if the route only responds to HTTPS requests.
     *
     * @return bool
     */
    public function secure()
    {
        return in_array('https', $this->action, true)
            || (array_key_exists('https', $this->action) && $this->action['https']);
    }

    /**
     * Return the middlewares for this route.
     *
     * @return array
     */
    public function getMiddleware()
    {
        return $this->middleware;
    }
}