text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>EmbASP-Java v7.1.0: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

EmbASP-Java v7.1.0

it

unical

mat

parsers

datalog

idlv

IDLVParserBaseVisitorImplementation

it.unical.mat.parsers.datalog.idlv.IDLVParserBaseVisitorImplementation Member List

This is the complete list of members for it.unical.mat.parsers.datalog.idlv.IDLVParserBaseVisitorImplementation, including all inherited members.

IDLVParserBaseVisitorImplementation(final DatalogDataCollection models)	it.unical.mat.parsers.datalog.idlv.IDLVParserBaseVisitorImplementation	inline

parse(DatalogDataCollection models, String atomsList, boolean two_stageParsing)	it.unical.mat.parsers.datalog.idlv.IDLVParserBaseVisitorImplementation	inlinestatic

visitMinimal_model(IDLVParser.Minimal_modelContext ctx)	it.unical.mat.parsers.datalog.idlv.IDLVParserBaseVisitorImplementation	inline

visitOutput(IDLVParser.OutputContext ctx)	it.unical.mat.parsers.datalog.idlv.IDLVParserBaseVisitor< Void >	inline

visitPredicate_atom(IDLVParser.Predicate_atomContext ctx)	it.unical.mat.parsers.datalog.idlv.IDLVParserBaseVisitorImplementation	inline

visitTerm(IDLVParser.TermContext ctx)	it.unical.mat.parsers.datalog.idlv.IDLVParserBaseVisitor< Void >	inline

<address class="footer">
Generated by  1.9.0
</address>

redpajama_set_name: RedPajamaGithub


text:
int main(int argc, char** argv)
{
  using namespace std;
  using namespace __gnu_test;

  time_counter time;
  resource_counter resource;

  int iters = 50000000;
  if (argc > 1)
    iters = atoi(argv[1]);

  ostringstream os_s, os_m;

  // setf
  start_counters(time, resource);
  for (int i = 0; i < iters; ++i)
    {
      os_s.setf(ios_base::uppercase);
      os_s.unsetf(ios_base::uppercase);
    }
  stop_counters(time, resource);
  report_performance(__FILE__, "setf", time, resource);
  clear_counters(time, resource);

  // manipulator
  start_counters(time, resource);
  for (int i = 0; i < iters; ++i)
    {
      os_m << uppercase;
      os_m << nouppercase;
    }
  stop_counters(time, resource);
  report_performance(__FILE__, "manipulator", time, resource);

  return 0;
}


text:
require "rails_helper"

describe ProjectChecks::HandleOverdue do
  let(:service) { described_class.new(check, days_diff, notifier) }
  let(:days_diff) { 10 }
  let(:project) do
    double(:project, name: "foo project", channel_name: "foo-project")
  end
  let(:init_deadline_text) { "deadline text for new project" }
  let(:deadline_text) { "foo bar baz" }
  let(:reminder) do
    double(:reminder, name: "bar baz", valid_for_n_days: 5, init_valid_for_n_days: 7,
                      init_deadline_text: init_deadline_text, deadline_text: deadline_text,
                      slack_channel: nil)
  end
  let(:checked) { true }
  let(:check) { double(:project_check, reminder: reminder, project: project, checked?: checked) }
  let(:notifier) { double(:notifier, send_message: true) }

  before do
    allow(project).to receive(:decorate) { project }

    allow(project).to receive(:email) { "foo-project@foo.com" }
    allow(check).to receive(:decorate) { check }
    allow(check).to receive(:slack_channels) { "foo-project" }
  end

  describe "#call" do
    context "when project was checked before" do
      let(:checked) { true }

      it "passes message with deadline text to notifier" do
        expect(notifier).to receive(:send_message).with(deadline_text, channels: "foo-project")
        service.call
      end
    end

    context "when project was not checked before" do
      let(:checked) { false }

      it "passes message with init deadline text to notifier" do
        expect(notifier).to receive(:send_message).with(init_deadline_text, channels: "foo-project")
        service.call
      end
    end

    context "sending email" do
      before do
        ActionMailer::Base.deliveries = []
      end

      it "sends one email" do
        expect { service.call }.to change { ActionMailer::Base.deliveries.count }.by(1)
      end

      it "sends email to project's email" do
        service.call
        expect(ActionMailer::Base.deliveries.last.to).to include "foo-project@foo.com"
      end
    end

    context "passing variables works correctly for" do
      after do
        service.call
      end

      context "when project was checked before" do
        let(:checked) { true }

        it "days_ago" do
          expect(reminder).to receive(:deadline_text).and_return("{{ days_ago }} days ago")
          expect(notifier).to receive(:send_message).with("10 days ago", anything)
        end

        it "project_name" do
          expect(reminder).to receive(:deadline_text).and_return("project {{ project_name }}")
          expect(notifier).to receive(:send_message).with("project foo project", anything)
        end

        it "reminder_name" do
          expect(reminder).to receive(:deadline_text).and_return("{{ reminder_name }} reminder")
          expect(notifier).to receive(:send_message).with("bar baz reminder", anything)
        end

        it "valid_for" do
          expect(reminder).to receive(:deadline_text)
            .and_return("is valid for {{ valid_for }} days")
          expect(notifier).to receive(:send_message).with("is valid for 5 days", anything)
        end
      end

      context "when project was not checked before" do
        let(:checked) { false }

        it "valid_for" do
          expect(reminder).to receive(:init_deadline_text)
            .and_return("is valid for {{ valid_for }} days")
          expect(notifier).to receive(:send_message).with("is valid for 7 days", anything)
        end
      end
    end
  end
end


text:
// By James Slattery     //
// GitHub: @jamslatt     //
///////////////////////////

import java.util.List;

/**
 * This class provides a convenient way to test shuffling methods.
 */
public class Shuffler {

    /**
     * The number of consecutive shuffle steps to be performed in each call
     * to each sorting procedure.
     */
    private static final int SHUFFLE_COUNT = 1;

    /**
     * The number of values to shuffle.
     */
    private static final int VALUE_COUNT = 4;

    /**
     * Tests shuffling methods.
     * @param args is not used.
     */
    public static void main(String[] args) {
        System.out.println("Results of " + SHUFFLE_COUNT +
                " consecutive perfect shuffles:");
        int[] values1 = new int[VALUE_COUNT];
        for (int i = 0; i < values1.length; i++) {
            values1[i] = i;
        }
        for (int j = 1; j <= SHUFFLE_COUNT; j++) {
            perfectShuffle(values1);
            System.out.print("  " + j + ":");
            for (int k = 0; k < values1.length; k++) {
                System.out.print(" " + values1[k]);
            }
            System.out.println();
        }
        System.out.println();

        System.out.println("Results of " + SHUFFLE_COUNT +
                " consecutive efficient selection shuffles:");
        int[] values2 = new int[VALUE_COUNT];
        for (int i = 0; i < values2.length; i++) {
            values2[i] = i;
        }
        for (int j = 1; j <= SHUFFLE_COUNT; j++) {
            selectionShuffle(values2);
            System.out.print("  " + j + ":");
            for (int k = 0; k < values2.length; k++) {
                System.out.print(" " + values2[k]);
            }
            System.out.println();
        }
        System.out.println();
    }

    /**
     * Apply a "perfect shuffle" to the argument.
     * The perfect shuffle algorithm splits the deck in half, then interleaves
     * the cards in one half with the cards in the other.
     * @param values is an array of integers simulating cards to be shuffled.
     */
    public static void perfectShuffle(int[] values) {
        // Set up 2 arrays for each half of deck
        int[] half1 = new int[ VALUE_COUNT / 2 ];
        int[] half2 = new int[ VALUE_COUNT - VALUE_COUNT / 2 ];

        // Copy first half deck
        for( int i = 0; i < VALUE_COUNT / 2; i++ ) {
            half1[i] = values[i];
        }

        // Copy second half of deck
        for( int i = 0; i < VALUE_COUNT - VALUE_COUNT / 2; i++ ) {
            half2[i] = values[ i + VALUE_COUNT / 2 ];
        }

        for( int i = 0; i < VALUE_COUNT / 2; i++ ) {
            values[ 2 * i ] = half2[i];
            values[ 2 * i + 1 ] = half1[i];
        }

        if( VALUE_COUNT % 2 != 0 ) {
            values[ VALUE_COUNT - 1 ] = half2[ VALUE_COUNT - VALUE_COUNT / 2 ];
        }

    }

    /**
     * Apply an "efficient selection shuffle" to the argument.
     * The selection shuffle algorithm conceptually maintains two sequences
     * of cards: the selected cards (initially empty) and the not-yet-selected
     * cards (initially the entire deck). It repeatedly does the following until
     * all cards have been selected: randomly remove a card from those not yet
     * selected and add it to the selected cards.
     * An efficient version of this algorithm makes use of arrays to avoid
     * searching for an as-yet-unselected card.
     * @param values is an array of integers simulating cards to be shuffled.
     */
    public static void selectionShuffle(int[] values) {
        for( int k = VALUE_COUNT - 1; k >= 0; k-- ) {
            int r = (int)(Math.random() * k);
            int tmp = values[r];
            values[r] = values[k];
            values[k] = tmp;
        }
    }
}


text:
export const ORIGIN = '//ppb-1251735385.cossh.myqcloud.com'
export const MAX_IMG_WIDTH = 500

export const MIN_PARTS_NUM = 2
export const MAX_PARTS_NUM = 8
export const INIT_PARTS_NUM = 3

export const GRID_LINE_WIDTH = 3

export const PUZZLE_MARGIN = 10
export const BLOCK_MARGIN = 2

export const BLOCK_MOVING_TIME = 300


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class VoicePlayer : MonoBehaviour
{
	[SerializeField]
	private AudioSource voiceSource;

	private List<AudioClip> victoryClips, lossClips;
	private bool soundQueued, victory;
	private AudioClip lastClip;

	public enum VoiceSet
	{
		None,
		Nitori
	}

	void Start()
	{
		soundQueued = false;
	}

	/// <summary>
	/// Loads clips and initiates character
	/// </summary>
	public void loadClips(VoiceSet voiceSet)
	{
		victoryClips = new List<AudioClip>();
		lossClips = new List<AudioClip>();
		if (voiceSet == VoiceSet.None)
			return;

		string set = voiceSet.ToString();
		int i = 0;
		AudioClip newClip;

		while (true)
		{
			newClip = Resources.Load<AudioClip>("Voices/" + set + "/Victory" + i.ToString());
			if (newClip == null)
				break;
			else
				victoryClips.Add(newClip);
			i++;
		}

		i = 0;
		while (true)
		{
			newClip = Resources.Load<AudioClip>("Voices/" + set + "/Loss" + i.ToString());
			if (newClip == null)
				break;
			else
				lossClips.Add(newClip);
			i++;
		}
	}

	/// <summary>
	/// Plays or schedules a voice clip
	/// </summary>
	/// <param name="victory"></param>
	/// <param name="delayTime"></param>
	public void playClip(bool victory, float delayTime)
	{
		soundQueued = false;
		this.victory = victory;

		//voiceSource.clip = victory ? victoryClips[Random.Range(0, victoryClips.Count)]
		//	: lossClips[Random.Range(0, lossClips.Count)];
		if (delayTime == 0f)
			playClipAudio();
		else
		{
			soundQueued = true;
			Invoke("playClipAudio", delayTime);
		}
	}

	/// <summary>
	/// Force play if play is scheduled, used when microgame ends
	/// </summary>
	public void forcePlay()
	{
		if (soundQueued)
		{
			CancelInvoke();
			playClipAudio();
		}
	}

	void playClipAudio()
	{
		if ((victory && victoryClips.Count == 0) || (!victory && lossClips.Count == 0))
			return;

		voiceSource.pitch = Mathf.Pow(Time.timeScale, .5f);
		List<AudioClip> clipPool = victory ? victoryClips : lossClips;

		AudioClip clipToPlay;
		do
		{
			clipToPlay = clipPool[Random.Range(0, clipPool.Count)];
		}
		while (clipToPlay == lastClip || clipPool.Count < 2);

		voiceSource.PlayOneShot(clipToPlay);
		lastClip = clipToPlay;
		soundQueued = false;
	}
}


text:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a resource generator.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using Windows.ApplicationModel.Resources;

namespace XboxMediaRemote.App.Resources
{
    public static class Strings
	{
        public static ResourceLoader ResourceLoader
		{
			get; private set;
		}

        static Strings()
		{
            ResourceLoader = new ResourceLoader();
        }

		public static string Get(string resource)
		{
			return ResourceLoader.GetString(resource);
		}

		public static string Format(string resource, params object[] args)
		{
			return String.Format(ResourceLoader.GetString(resource), args);
		}

        public static string AboutTitleText
		{
            get
			{
				return ResourceLoader.GetString("AboutTitle/Text");
			}
        }

        public static string AuthorCaptionText
		{
            get
			{
				return ResourceLoader.GetString("AuthorCaption/Text");
			}
        }

        public static string AuthorTitleText
		{
            get
			{
				return ResourceLoader.GetString("AuthorTitle/Text");
			}
        }

        public static string BrowseFolderEmptyText
		{
            get
			{
				return ResourceLoader.GetString("BrowseFolderEmpty/Text");
			}
        }

        public static string CreditsTitleText
		{
            get
			{
				return ResourceLoader.GetString("CreditsTitle/Text");
			}
        }

        public static string GroupFolders
		{
            get
			{
				return ResourceLoader.GetString("GroupFolders");
			}
        }

        public static string GroupMusic
		{
            get
			{
				return ResourceLoader.GetString("GroupMusic");
			}
        }

        public static string GroupOther
		{
            get
			{
				return ResourceLoader.GetString("GroupOther");
			}
        }

        public static string GroupsNumberTitle
		{
            get
			{
				return ResourceLoader.GetString("GroupsNumberTitle");
			}
        }

        public static string GroupsPictures
		{
            get
			{
				return ResourceLoader.GetString("GroupsPictures");
			}
        }

        public static string GroupsSymbolTitle
		{
            get
			{
				return ResourceLoader.GetString("GroupsSymbolTitle");
			}
        }

        public static string GroupVideos
		{
            get
			{
				return ResourceLoader.GetString("GroupVideos");
			}
        }

        public static string MediaHubTitleText
		{
            get
			{
				return ResourceLoader.GetString("MediaHubTitle/Text");
			}
        }

        public static string MediaSearchPlaceholderText
		{
            get
			{
				return ResourceLoader.GetString("MediaSearch/PlaceholderText");
			}
        }

        public static string MediaTypeAudio
		{
            get
			{
				return ResourceLoader.GetString("MediaTypeAudio");
			}
        }

        public static string MediaTypeImage
		{
            get
			{
				return ResourceLoader.GetString("MediaTypeImage");
			}
        }

        public static string MediaTypeVideo
		{
            get
			{
				return ResourceLoader.GetString("MediaTypeVideo");
			}
        }

        public static string PlayToInvalidMediaType
		{
            get
			{
				return ResourceLoader.GetString("PlayToInvalidMediaType");
			}
        }

        public static string PlayToNoFile
		{
            get
			{
				return ResourceLoader.GetString("PlayToNoFile");
			}
        }

        public static string PlayToNoMediaCaptionText
		{
            get
			{
				return ResourceLoader.GetString("PlayToNoMediaCaption/Text");
			}
        }

        public static string PlayToNoMediaTitleText
		{
            get
			{
				return ResourceLoader.GetString("PlayToNoMediaTitle/Text");
			}
        }

        public static string PrivacyPolicyContentText
		{
            get
			{
				return ResourceLoader.GetString("PrivacyPolicyContent/Text");
			}
        }

        public static string SearchResultsHeaderText
		{
            get
			{
				return ResourceLoader.GetString("SearchResultsHeader/Text");
			}
        }

        public static string SearchResultsNoneText
		{
            get
			{
				return ResourceLoader.GetString("SearchResultsNone/Text");
			}
        }

        public static string SettingsAbout
		{
            get
			{
				return ResourceLoader.GetString("SettingsAbout");
			}
        }

        public static string SettingsPrivacyPolicy
		{
            get
			{
				return ResourceLoader.GetString("SettingsPrivacyPolicy");
			}
        }

        public static string WelcomeAppText
		{
            get
			{
				return ResourceLoader.GetString("WelcomeApp/Text");
			}
        }

        public static string WelcomeSubheaderText
		{
            get
			{
				return ResourceLoader.GetString("WelcomeSubheader/Text");
			}
        }

        public static string WelcomeTitleText
		{
            get
			{
				return ResourceLoader.GetString("WelcomeTitle/Text");
			}
        }

        public static string MediaSortAlphabetical
		{
            get
			{
				return ResourceLoader.GetString("MediaSortAlphabetical");
			}
        }

        public static string MediaSortDateCreated
		{
            get
			{
				return ResourceLoader.GetString("MediaSortDateCreated");
			}
        }

        public static string MediaSortType
		{
            get
			{
				return ResourceLoader.GetString("MediaSortType");
			}
        }

    }
}


text:
require 'test_helper'

class UserTest < ActiveSupport::TestCase
    test "get boxes for user" do
        assert_equal 2, users(:one).boxes.count
    end
end


text:
class GPUAdder {
  // pointer to the GPU memory where the array is stored
  int* array_device;
  // pointer to the CPU memory where the array is stored
  int* array_host;
  // length of the array (number of elements)
  int length;

public:
  /* By using the swig default names INPLACE_ARRAY1, DIM1 in the header
     file (these aren't the names in the implementation file), we're giving
     swig the info it needs to cast to and from numpy arrays.

     If instead the constructor line said
       GPUAdder(int* myarray, int length);

     We would need a line like this in the swig.i file
       %apply (int* ARGOUT_ARRAY1, int DIM1) {(int* myarray, int length)}
   */

  GPUAdder(int* INPLACE_ARRAY1, int DIM1); // constructor (copies to GPU)

  ~GPUAdder(); // destructor

  void increment(); // does operation inplace on the GPU

  void retreive(); //gets results back from GPU, putting them in the memory that was passed in
  // the constructor

  //gets results back from the gpu, putting them in the supplied memory location
  void retreive_to (int* INPLACE_ARRAY1, int DIM1);

};


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright 2015 The Android Open Source Project
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
      http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:orientation="vertical"
    tools:context=".HelloTestActivity">

    <Button android:id="@+id/btn_hello_android_testing"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/btn_hello_test_text"
        android:onClick="onClick"
        android:contentDescription="@string/content_desc_hello_android_testing"/>

    <TextView android:id="@+id/text_view_rocks"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="@string/content_desc_rocks"/>

</LinearLayout>


text:
<!DOCTYPE html>

When its first line needs a column break, test that we push the entire float to the next column.

There should be a blue square below. It should be right-bottom aligned inside a cyan box.


text:
import { Component, Input, Output, EventEmitter, ElementRef, OnInit } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { SelectItem } from './select-item';
import { stripTags } from './select-pipes';
import { OptionsBehavior } from './select-interfaces';
import { escapeRegexp } from './common';

let styles = `
  .ui-select-toggle {
    position: relative;
  }

  /* Fix Bootstrap dropdown position when inside a input-group */
  .input-group > .dropdown {
    /* Instead of relative */
    position: static;
  }

  .ui-select-match > .btn {
    /* Instead of center because of .btn */
    text-align: left !important;
  }

  .ui-select-match > .caret {
    position: absolute;
    top: 45%;
    right: 15px;
  }

  .ui-disabled {
    background-color: #eceeef;
    border-radius: 4px;
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 5;
    opacity: 0.6;
    top: 0;
    left: 0;
    cursor: not-allowed;
  }

  .ui-select-choices {
    width: 100%;
    height: auto;
    max-height: 200px;
    overflow-x: hidden;
    margin-top: 0;
  }

  .ui-select-multiple .ui-select-choices {
    margin-top: 1px;
  }
  .ui-select-choices-row>a {
      display: block;
      padding: 3px 20px;
      clear: both;
      font-weight: 400;
      line-height: 1.42857143;
      color: #333;
      white-space: nowrap;
  }
  .ui-select-choices-row.active>a {
      color: #fff;
      text-decoration: none;
      outline: 0;
      background-color: #428bca;
  }

  .ui-select-multiple {
    height: auto;
    padding:3px 3px 0 3px;
  }

  .ui-select-multiple input.ui-select-search {
    background-color: transparent !important; /* To prevent double background when disabled */
    border: none;
    outline: none;
    box-shadow: none;
    height: 1.6666em;
    padding: 0;
    margin-bottom: 3px;

  }
  .ui-select-match .close {
      font-size: 1.6em;
      line-height: 0.75;
  }

  .ui-select-multiple .ui-select-match-item {
    outline: 0;
    margin: 0 3px 3px 0;
  }
  .ui-select-toggle > .caret {
      position: absolute;
      height: 10px;
      top: 50%;
      right: 10px;
      margin-top: -2px;
  }
`;

@Component({
  selector: 'ng-select',
  styles: [styles],
  template: `

        <span *ngIf="active.length <= 0" class="ui-select-placeholder text-muted">{{placeholder}}
         0" class="ui-select-match-text pull-left"
              [ngClass]="{'ui-select-allow-clear': allowClear && active.length > 0}"
              [innerHTML]="sanitize(active[0].text)">

        0" class="btn btn-xs btn-link pull-right" style="margin-right: 10px; padding: 0;" (click)="remove(activeOption)">

    <input type="text" autocomplete="false" tabindex="-1"
           (keydown)="inputEvent($event)"
           (keyup)="inputEvent($event, true)"
           [disabled]="disabled"
           class="form-control ui-select-search"
           *ngIf="inputMode"
           placeholder="{{active.length <= 0 ? placeholder : ''}}">

 0 && !firstItemHasChildren"
          class="ui-select-choices dropdown-menu" role="menu">

 0 && firstItemHasChildren"
          class="ui-select-choices dropdown-menu" role="menu">

 0">

{{c.text}}

               ×
               {{a.text}}

    <input type="text"
           (keydown)="inputEvent($event)"
           (keyup)="inputEvent($event, true)"
           (click)="matchClick($event)"
           [disabled]="disabled"
           autocomplete="false"
           autocorrect="off"
           autocapitalize="off"
           spellcheck="false"
           class="form-control ui-select-search"
           placeholder="{{active.length <= 0 ? placeholder : ''}}"
           role="combobox">

 0 && !firstItemHasChildren"
          class="ui-select-choices dropdown-menu" role="menu">

 0 && firstItemHasChildren"
          class="ui-select-choices dropdown-menu" role="menu">

 0">

{{c.text}}

  `
})
export class SelectComponent implements OnInit {
  @Input() public allowClear:boolean = false;
  @Input() public placeholder:string = '';
  @Input() public idField:string = 'id';
  @Input() public textField:string = 'text';
  @Input() public multiple:boolean = false;

  @Input()
  public set items(value:Array<any>) {
    if (!value) {
      this._items = this.itemObjects = [];
    } else {
      this._items = value.filter((item:any) => {
        // if ((typeof item === 'string' && item) || (typeof item === 'object' && item && item.text && item.id)) {
        if ((typeof item === 'string') || (typeof item === 'object' && item.text)) {
          return item;
        }
      });
      // this.itemObjects = this._items.map((item:any) => (typeof item === 'string' ? new SelectItem(item) : new SelectItem({id: item[this.idField], text: item[this.textField]})));
      this.itemObjects = this._items.map((item:any) => new SelectItem(item));
    }
  }

  @Input()
  public set disabled(value:boolean) {
    this._disabled = value;
    if (this._disabled === true) {
      this.hideOptions();
    }
  }

  public get disabled():boolean {
    return this._disabled;
  }

  @Input()
  public set active(selectedItems:Array<any>) {
    if (!selectedItems || selectedItems.length === 0) {
      this._active = [];
    } else {
      let areItemsStrings = typeof selectedItems[0] === 'string';

      this._active = selectedItems.map((item:any) => {
        let data = areItemsStrings
          ? item
          : {id: item[this.idField], text: item[this.textField]};

        return new SelectItem(data);
      });
    }
  }

  @Output() public data:EventEmitter<any> = new EventEmitter();
  @Output() public selected:EventEmitter<any> = new EventEmitter();
  @Output() public removed:EventEmitter<any> = new EventEmitter();
  @Output() public typed:EventEmitter<any> = new EventEmitter();

  public options:Array<SelectItem> = [];
  public itemObjects:Array<SelectItem> = [];
  public activeOption:SelectItem;
  public element:ElementRef;

  public get active():Array<any> {
    return this._active;
  }

  private inputMode:boolean = false;
  private optionsOpened:boolean = false;
  private behavior:OptionsBehavior;
  private inputValue:string = '';
  private _items:Array<any> = [];
  private _disabled:boolean = false;
  private _active:Array<SelectItem> = [];

  public constructor(element:ElementRef, private sanitizer:DomSanitizer) {
    this.element = element;
    this.clickedOutside = this.clickedOutside.bind(this);
  }

  public sanitize(html:string):SafeHtml {
    return this.sanitizer.bypassSecurityTrustHtml(html);
  }

  public inputEvent(e:any, isUpMode:boolean = false):void {
    // tab
    if (e.keyCode === 9) {
      return;
    }
    if (isUpMode && (e.keyCode === 37 || e.keyCode === 39 || e.keyCode === 38 ||
      e.keyCode === 40 || e.keyCode === 13)) {
      e.preventDefault();
      return;
    }
    // backspace
    if (!isUpMode && e.keyCode === 8) {
      let el:any = this.element.nativeElement
        .querySelector('div.ui-select-container > input');
      if (!el.value || el.value.length <= 0) {
        if (this.active.length > 0) {
          this.remove(this.active[this.active.length - 1]);
        }
        e.preventDefault();
      }
    }
    // esc
    if (!isUpMode && e.keyCode === 27) {
      this.hideOptions();
      this.element.nativeElement.children[0].focus();
      e.preventDefault();
      return;
    }
    // del
    if (!isUpMode && e.keyCode === 46) {
      if (this.active.length > 0) {
        this.remove(this.active[this.active.length - 1]);
      }
      e.preventDefault();
    }
    // left
    if (!isUpMode && e.keyCode === 37 && this._items.length > 0) {
      this.behavior.first();
      e.preventDefault();
      return;
    }
    // right
    if (!isUpMode && e.keyCode === 39 && this._items.length > 0) {
      this.behavior.last();
      e.preventDefault();
      return;
    }
    // up
    if (!isUpMode && e.keyCode === 38) {
      this.behavior.prev();
      e.preventDefault();
      return;
    }
    // down
    if (!isUpMode && e.keyCode === 40) {
      this.behavior.next();
      e.preventDefault();
      return;
    }
    // enter
    if (!isUpMode && e.keyCode === 13) {
      if (this.active.indexOf(this.activeOption) === -1) {
        this.selectActiveMatch();
        this.behavior.next();
      }
      e.preventDefault();
      return;
    }
    let target = e.target || e.srcElement;
    if (target && target.value) {
      this.inputValue = target.value;
      this.behavior.filter(new RegExp(escapeRegexp(this.inputValue), 'ig'));
      this.doEvent('typed', this.inputValue);
    }
  }

  public ngOnInit():any {
    this.behavior = (this.firstItemHasChildren) ?
      new ChildrenBehavior(this) : new GenericBehavior(this);
  }

  public remove(item:SelectItem):void {
    if (this._disabled === true) {
      return;
    }
    if (this.multiple === true && this.active) {
      let index = this.active.indexOf(item);
      this.active.splice(index, 1);
      this.data.next(this.active);
      this.doEvent('removed', item);
    }
    if (this.multiple === false) {
		let itemToRemove:SelectItem = this.active[0];
      this.active = [];
      this.data.next(this.active);
      this.doEvent('removed', item ? item : itemToRemove);
    }
  }

  public doEvent(type:string, value:any):void {
    if ((this as any)[type] && value) {
      (this as any)[type].next(value);
    }
  }

  public clickedOutside($event:any):void {
    var me = this.element['nativeElement'].firstElementChild,
      meNotInPath = function(){
        for (let i:number = 0; i < $event['path'].length; i++){
          if ($event['path'][i] == me){
            return false
          }
        }
        return true;
      };

    let docRef = (<any>document);

    if ( (!docRef.ng2selected || me != docRef.ng2selected) || (me == docRef.ng2selected && meNotInPath()) ) {
      this.inputMode = false;
      this.optionsOpened = false;
    }
  }

  public get firstItemHasChildren():boolean {
    return this.itemObjects[0] && this.itemObjects[0].hasChildren();
  }

  protected matchClick(e:any):void {
    if (this._disabled === true) {
      return;
    }
    this.inputMode = !this.inputMode;
    if (this.inputMode === true && ((this.multiple === true && e) || this.multiple === false)) {
      this.focusToInput();
      this.open();
    }
  }

  protected  mainClick(event:any):void {
    if (this.inputMode === true || this._disabled === true) {
      return;
    }
    if (event.keyCode === 46) {
      event.preventDefault();
      this.inputEvent(event);
      return;
    }
    if (event.keyCode === 8) {
      event.preventDefault();
      this.inputEvent(event, true);
      return;
    }
    if (event.keyCode === 9 || event.keyCode === 13 ||
      event.keyCode === 27 || (event.keyCode >= 37 && event.keyCode <= 40)) {
      event.preventDefault();
      return;
    }
    this.inputMode = true;
    let value = String
      .fromCharCode(96 <= event.keyCode && event.keyCode <= 105 ? event.keyCode - 48 : event.keyCode)
      .toLowerCase();
    this.focusToInput(value);
    this.open();
    let target = event.target || event.srcElement;
    target.value = value;
    this.inputEvent(event);
  }

  protected  selectActive(value:SelectItem):void {
    this.activeOption = value;
  }

  protected  isActive(value:SelectItem):boolean {
    return this.activeOption.text === value.text;
  }

  private focusToInput(value:string = ''):void {
    setTimeout(() => {
      let el = this.element.nativeElement.querySelector('div.ui-select-container > input');
      if (el) {
        el.focus();
        el.value = value;
      }
    }, 0);
  }

  private open():void {
    this.options = this.itemObjects
      .filter((option:SelectItem) => (this.multiple === false ||
      this.multiple === true && !this.active.find((o:SelectItem) => option.text === o.text)));

    if (this.options.length > 0) {
      this.behavior.first();
    }
    this.optionsOpened = true;
  }

  private hideOptions():void {
    this.inputMode = false;
    this.optionsOpened = false;
  }

  private selectActiveMatch():void {
    this.selectMatch(this.activeOption);
  }

  private selectMatch(value:SelectItem, e:Event = void 0):void {
    if (e) {
      e.stopPropagation();
      e.preventDefault();
    }
    if (this.options.length <= 0) {
      return;
    }
    if (this.multiple === true) {
      this.active.push(value);
      this.data.next(this.active);
    }
    if (this.multiple === false) {
      this.active[0] = value;
      this.data.next(this.active[0]);
    }
    this.doEvent('selected', value);
    this.hideOptions();
    if (this.multiple === true) {
      this.focusToInput('');
    } else {
      this.focusToInput(stripTags(value.text));
      this.element.nativeElement.querySelector('.ui-select-container').focus();
    }
  }
}

export class Behavior {
  public optionsMap:Map<string, number> = new Map<string, number>();

  public actor:SelectComponent;

  public constructor(actor:SelectComponent) {
    this.actor = actor;
  }

  public fillOptionsMap():void {
    this.optionsMap.clear();
    let startPos = 0;
    this.actor.itemObjects
      .map((item:SelectItem) => {
        startPos = item.fillChildrenHash(this.optionsMap, startPos);
      });
  }

  public ensureHighlightVisible(optionsMap:Map<string, number> = void 0):void {
    let container = this.actor.element.nativeElement.querySelector('.ui-select-choices-content');
    if (!container) {
      return;
    }
    let choices = container.querySelectorAll('.ui-select-choices-row');
    if (choices.length < 1) {
      return;
    }
    let activeIndex = this.getActiveIndex(optionsMap);
    if (activeIndex < 0) {
      return;
    }
    let highlighted:any = choices[activeIndex];
    if (!highlighted) {
      return;
    }
    let posY:number = highlighted.offsetTop + highlighted.clientHeight - container.scrollTop;
    let height:number = container.offsetHeight;
    if (posY > height) {
      container.scrollTop += posY - height;
    } else if (posY < highlighted.clientHeight) {
      container.scrollTop -= highlighted.clientHeight - posY;
    }
  }

  private getActiveIndex(optionsMap:Map<string, number> = void 0):number {
    let ai = this.actor.options.indexOf(this.actor.activeOption);
    if (ai < 0 && optionsMap !== void 0) {
      ai = optionsMap.get(this.actor.activeOption.id);
    }
    return ai;
  }
}

export class GenericBehavior extends Behavior implements OptionsBehavior {
  public constructor(actor:SelectComponent) {
    super(actor);
  }

  public first():void {
    this.actor.activeOption = this.actor.options[0];
    super.ensureHighlightVisible();
  }

  public last():void {
    this.actor.activeOption = this.actor.options[this.actor.options.length - 1];
    super.ensureHighlightVisible();
  }

  public prev():void {
    let index = this.actor.options.indexOf(this.actor.activeOption);
    this.actor.activeOption = this.actor
      .options[index - 1 < 0 ? this.actor.options.length - 1 : index - 1];
    super.ensureHighlightVisible();
  }

  public next():void {
    let index = this.actor.options.indexOf(this.actor.activeOption);
    this.actor.activeOption = this.actor
      .options[index + 1 > this.actor.options.length - 1 ? 0 : index + 1];
    super.ensureHighlightVisible();
  }

  public filter(query:RegExp):void {
    let options = this.actor.itemObjects
      .filter((option:SelectItem) => {
        return stripTags(option.text).match(query) &&
          (this.actor.multiple === false ||
          (this.actor.multiple === true && this.actor.active.map((item:SelectItem) => item.id).indexOf(option.id) < 0));
      });
    this.actor.options = options;
    if (this.actor.options.length > 0) {
      this.actor.activeOption = this.actor.options[0];
      super.ensureHighlightVisible();
    }
  }
}

export class ChildrenBehavior extends Behavior implements OptionsBehavior {
  public constructor(actor:SelectComponent) {
    super(actor);
  }

  public first():void {
    this.actor.activeOption = this.actor.options[0].children[0];
    this.fillOptionsMap();
    this.ensureHighlightVisible(this.optionsMap);
  }

  public last():void {
    this.actor.activeOption =
      this.actor
        .options[this.actor.options.length - 1]
        .children[this.actor.options[this.actor.options.length - 1].children.length - 1];
    this.fillOptionsMap();
    this.ensureHighlightVisible(this.optionsMap);
  }

  public prev():void {
    let indexParent = this.actor.options
      .findIndex((option:SelectItem) => this.actor.activeOption.parent && this.actor.activeOption.parent.id === option.id);
    let index = this.actor.options[indexParent].children
      .findIndex((option:SelectItem) => this.actor.activeOption && this.actor.activeOption.id === option.id);
    this.actor.activeOption = this.actor.options[indexParent].children[index - 1];
    if (!this.actor.activeOption) {
      if (this.actor.options[indexParent - 1]) {
        this.actor.activeOption = this.actor
          .options[indexParent - 1]
          .children[this.actor.options[indexParent - 1].children.length - 1];
      }
    }
    if (!this.actor.activeOption) {
      this.last();
    }
    this.fillOptionsMap();
    this.ensureHighlightVisible(this.optionsMap);
  }

  public next():void {
    let indexParent = this.actor.options
      .findIndex((option:SelectItem) => this.actor.activeOption.parent && this.actor.activeOption.parent.id === option.id);
    let index = this.actor.options[indexParent].children
      .findIndex((option:SelectItem) => this.actor.activeOption && this.actor.activeOption.id === option.id);
    this.actor.activeOption = this.actor.options[indexParent].children[index + 1];
    if (!this.actor.activeOption) {
      if (this.actor.options[indexParent + 1]) {
        this.actor.activeOption = this.actor.options[indexParent + 1].children[0];
      }
    }
    if (!this.actor.activeOption) {
      this.first();
    }
    this.fillOptionsMap();
    this.ensureHighlightVisible(this.optionsMap);
  }

  public filter(query:RegExp):void {
    let options:Array<SelectItem> = [];
    let optionsMap:Map<string, number> = new Map<string, number>();
    let startPos = 0;
    for (let si of this.actor.itemObjects) {
      let children:Array<SelectItem> = si.children.filter((option:SelectItem) => query.test(option.text));
      startPos = si.fillChildrenHash(optionsMap, startPos);
      if (children.length > 0) {
        let newSi = si.getSimilar();
        newSi.children = children;
        options.push(newSi);
      }
    }
    this.actor.options = options;
    if (this.actor.options.length > 0) {
      this.actor.activeOption = this.actor.options[0].children[0];
      super.ensureHighlightVisible(optionsMap);
    }
  }
}


text:
package ceylon.language;

import com.redhat.ceylon.compiler.java.metadata.Ceylon;
import com.redhat.ceylon.compiler.java.metadata.Class;
import com.redhat.ceylon.compiler.java.metadata.Defaulted;
import com.redhat.ceylon.compiler.java.metadata.Ignore;
import com.redhat.ceylon.compiler.java.metadata.Name;
import com.redhat.ceylon.compiler.java.metadata.TypeInfo;
import com.redhat.ceylon.compiler.java.runtime.model.ReifiedType;
import com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor;

@Ceylon(major = 8)
@Class(extendsType = "ceylon.language::Throwable")
@SharedAnnotation$annotation$
@NativeAnnotation$annotation$(backends={})
public class AssertionError extends java.lang.Error implements ReifiedType {

    @Ignore
    public final static TypeDescriptor $TypeDescriptor$ = TypeDescriptor.klass(AssertionError.class);

    private static final long serialVersionUID = -1790691559137471641L;

    @Ignore // JPA constructor
    protected AssertionError() {
        super();
        this.message = null;
    }

    @Ignore
    private final java.lang.String message;

    @Ignore
    public AssertionError(
            @TypeInfo("ceylon.language::String")
            @Name("message")
            java.lang.String message) {
        super(message);
        this.message = message;
    }

    @Ignore
    public static java.lang.Throwable $init$cause() {
        return null;
    }

    public AssertionError(
            @TypeInfo("ceylon.language::String")
            @Name("message")
            java.lang.String message,
            @TypeInfo("ceylon.language::Throwable?")
            @Name("cause")
            @Defaulted
            java.lang.Throwable cause) {
        super(message, cause);
        this.message = message;
    }

    @Override
    @Ignore
    public java.lang.Throwable getCause() {
        return super.getCause();
    }

    @Override
    @Ignore
    public java.lang.String getMessage() {
        return message;
    }

    @Override
    @Ignore
    public java.lang.String toString() {
        return this.getClass().getName() + " \"" + getMessage() +"\"";
    }

    @Override
    @Ignore
    public void printStackTrace() {
        super.printStackTrace();
    }

    @Ignore
    public static String $default$description(){
        return null;
    }
    @Ignore
    public static java.lang.Throwable $default$cause(String description){
        return null;
    }

    //@Override
    @Ignore
    public TypeDescriptor $getType$() {
        return $TypeDescriptor$;
    }
}


text:
package io.github.l0lkj.minigames.utils;

import lombok.Data;
import lombok.NonNull;

@Data
public abstract class ARENA {

    @NonNull
    private POSITION positionMin, positionMax, positionSpawn, positionHub;
    @NonNull
    private String name;

}


text:
package docs.home.persistence;

import com.lightbend.lagom.javadsl.persistence.AggregateEvent;
import com.lightbend.lagom.javadsl.persistence.AggregateEventTag;
import com.lightbend.lagom.serialization.Jsonable;

public class BlogEventTag {

  // #aggregate-tag
  public interface BlogEvent extends AggregateEvent<BlogEvent>, Jsonable {

    AggregateEventTag<BlogEvent> BLOG_EVENT_TAG = AggregateEventTag.of(BlogEvent.class);

    @Override
    default AggregateEventTag<BlogEvent> aggregateTag() {
      return BLOG_EVENT_TAG;
    }
  }
  // #aggregate-tag

}


text:
from django.conf import settings
from django.db import migrations, models

HELP_TEXT = ('Hold down "Control", or "Command" on a Mac,'
             'to select more than one.')

class Migration(migrations.Migration):

    dependencies = [
        ('accelerator', '0025_add_user_type_to_nav_tree_item'),
    ]

    operations = [
        migrations.AlterField(
            model_name='applicationanswer',
            name='answer_text',
            field=models.TextField(blank=True),
        ),
        migrations.AlterField(
            model_name='expertprofile',
            name='mentoring_specialties',
            field=models.ManyToManyField(
                blank=True,
                db_table='accelerator_expert_related_mentoringspecialty',
                help_text=HELP_TEXT,
                related_name='experts',
                to=settings.ACCELERATOR_MENTORINGSPECIALTIES_MODEL,
                verbose_name='Mentoring Specialties'),
        ),
    ]


text:
<?php

namespace Koine\EventManager;

trait EventManagerAwareTrait
{
    /** @var EventManagerInterface */
    private $eventManager;

    public function setEventManager(EventManagerInterface $eventManager)
    {
        $this->eventManager = $eventManager;

        return $this;
    }

    public function getEventManager()
    {
        if ($this->eventManager === null) {
            $this->eventManager = new NullEventManager();
        }

        return $this->eventManager;
    }
}


text:
'use strict';

//Setting up route
angular.module('translation').config(['$stateProvider',
	function($stateProvider) {
		// Translation state routing
		$stateProvider
		.state('translation', {
			url: '/translations/:tokenId',
			templateUrl: 'views/translation/translation.view.html'
		});
	}
]);


text:
<!DOCTYPE html>

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>mne.grand_average — MNE 0.16.1 documentation</title>
    <link rel="stylesheet" href="../_static/bootstrap-sphinx.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="../_static/gallery.css" type="text/css" />

    <link rel="shortcut icon" href="../_static/favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />

    <link rel="stylesheet" href="../_static/style.css " type="text/css" />
    <link rel="stylesheet" href="../_static/font-awesome.css" type="text/css" />
    <link rel="stylesheet" href="../_static/flag-icon.css" type="text/css" />

  <link rel="canonical" href="https://mne.tools/stable/index.html" />

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">

        </button>

        0.16.1

Install

Documentation

API

Examples

Contribute

  Site

  <button type="button" class="btn btn-primary navbar-btn dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown">
    v0.16.1

  </button>

Development

v0.16 (stable)

v0.15

v0.14

v0.13

v0.12

v0.11

<form class="navbar-form navbar-right" action="../search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

mne.grand_average

Examples using mne.grand_average

<form action="../search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

mne.grand_average¶

mne.grand_average(all_inst, interpolate_bads=True, drop_bads=True)[source]¶

Make grand average of a list evoked or AverageTFR data.

For evoked data, the function interpolates bad channels based on
interpolate_bads parameter. If interpolate_bads is True, the grand
average file will contain good channels and the bad channels interpolated
from the good MEG/EEG channels.
For AverageTFR data, the function takes the subset of channels not marked
as bad in any of the instances.

The grand_average.nave attribute will be equal to the number
of evoked datasets used to calculate the grand average.

Note: Grand average evoked should not be used for source localization.

<col class="field-name" />
<col class="field-body" />

Parameters:

all_inst : list of Evoked or AverageTFR data

The evoked datasets.

interpolate_bads : bool

If True, bad MEG and EEG channels are interpolated. Ignored for
AverageTFR.

drop_bads : bool

If True, drop all bad channels marked as bad in any data set.
If neither interpolate_bads nor drop_bads is True, in the output file,
every channel marked as bad in at least one of the input files will be
marked as bad, but no interpolation or dropping will be performed.

Returns:

grand_average : Evoked | AverageTFR

The grand average data. Same type as input.

Notes

New in version 0.11.0.

Examples using mne.grand_average¶

EEG processing and Event Related Potentials (ERPs)

GitHub

·

Mailing list

·

Gitter

·

What's new

·

Cite MNE

Back to top

© Copyright 2012-2018, MNE Developers. Last updated on 2018-06-24.


text:
module SpreeFlexiVariants
  module Generators
    class InstallGenerator < Rails::Generators::Base

      def add_javascripts
        append_file "app/assets/javascripts/spree/frontend/all.js", "//= require spree/frontend/spree_flexi_variants\n"
        append_file "app/assets/javascripts/spree/backend/all.js", "//= require spree/backend/spree_flexi_variants\n"
      end

      # def add_stylesheets
      #   inject_into_file "app/assets/stylesheets/store/all.css", " *= require store/spree-flexi-variants\\n", :before => /\\*\\//, :verbose => true
      # end

      def add_migrations
        run 'bundle exec rake railties:install:migrations FROM=spree_flexi_variants'
      end

      def run_migrations
         res = ask "Would you like to run the migrations now? [Y/n]"
         if res == "" || res.downcase == "y"
           run 'bundle exec rake db:migrate'
         else
           puts "Skipping rake db:migrate, don't forget to run it!"
         end
      end
    end
  end
end


text:
var rootDir = __dirname.split('/').slice(0, -1).join('/');

var aStream = require(rootDir),
	should = require('should'),
	fs = require('fs');

var testDir = rootDir + '/lib',
	dirFiles = [];

before(function(done){
	fs.readdir(testDir, function(err, data){
		dirFiles = data.map(function(file){
			return fs.statSync(testDir + "/" + file).size;
		})
		done();
	})
})

describe("CreateFileStreams", function() {

	it('should return buffers and finish', function(done){
		var counter = 0;

		new aStream.ReadDir(testDir)
		.pipe(new aStream.CreateFileStreams())
		.on('data', function(data){
			data.should.be.a.Buffer;
			dirFiles[0] -= data.length;
			if (dirFiles[0] === 0) dirFiles.shift();
		})
		.pipe(new aStream.WriteNull())
		.on('finish', function(){
			dirFiles.length.should.equal(0);
			done()
		})
	});

	it('should not get something and end by given no files', function(done){
		var counter = 0;

		new aStream.Array([])
		.pipe(new aStream.CreateFileStreams())
		.on('data', function(data){
			data.should.be.a.Buffer;
			counter += 1;
		})
		.pipe(new aStream.WriteNull())
		.on('finish', function(){
			counter.should.equal(0);
			done()
		})
	})
});


text:
@protocol RamblerViperModuleTransitionHandlerProtocol;

@protocol RamblerViperModuleFabricProtocol <NSObject>

- (__nullable id<RamblerViperModuleTransitionHandlerProtocol>)instantiateModuleTransitionHandler;

@end


text:
/** @module */

const CLOSE_COMMANDS = ['close', 'lock', 'thread']

function isClosePost (post) {
  return post.command != null && CLOSE_COMMANDS.indexOf(post.command) !== -1
}

/**
 * Allows moderators to close comment threads. Looks for the first comment by a
 * moderator to issue the "/thread" command, and automatically deletes all
 * non-moderator posts after it.
 */
export function attach (emitter, record) {

  emitter.on('new', (post, state) => {

    if (!post.isMod) {
      state.get().then(s => {
        if (s.closed) {
          emitter.client.del(post.id).then(() => {
            record('close-delete', { post })
          })
        }
      })
    } else if (isClosePost(post)) {
      record('close', { post })
      state.update({ closed: true })
    }

  })

}


text:
package me.zhengjie.exception.handler;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;

/**
 * @author Zheng Jie
 * @date 2018-11-23
 */
@Data
class ApiError {

    private Integer status = 400;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime timestamp;
    private String message;

    private ApiError() {
        timestamp = LocalDateTime.now();
    }

    public static ApiError error(String message){
        ApiError apiError = new ApiError();
        apiError.setMessage(message);
        return apiError;
    }

    public static ApiError error(Integer status, String message){
        ApiError apiError = new ApiError();
        apiError.setStatus(status);
        apiError.setMessage(message);
        return apiError;
    }
}


text:
<?php

namespace App\Cubemeets\Comments;

class CommentDeleter
{
    /**
     * @var \App\Cubemeets\Comments\CommentRepository
     */
    protected $comments;

    /**
     * @param \App\Cubemeets\Comments\CommentRepository $comments
     */
    public function __construct(CommentRepository $comments)
    {
        $this->comments = $comments;
    }

    public function delete($listener, $comment)
    {
        $fromCubemeet = $comment->getCubemeet();

        $this->comments->delete($comment);

        return $listener->commentDeleted($fromCubemeet);
    }
}


text:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <title>output_help (App)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />

# File bin/js-get, line 122
    def output_help
      output_version
      RDoc::usage() #exits app
    end


text:
$(".ucommentReplyBtn").click(function(){
	cid = $(this).data("cid");
	controller.postRequest('.', {ajax: 'reply_comment', cid: cid});
	return false;
});

$(".ucommentDeleteBtn").click(function () {
	cid = $(this).data("cid");
	controller.postRequest('.', {ajax: 'remove_comment', cid: cid});
	return false;
});

$(".ucommentFlagBtn").click(function () {
	cid = $(this).data("cid");
	controller.postRequest('.', {ajax: 'flag_comment', cid: cid});
	return false;
});


text:
require 'appsignal'

module Appsignal::Integrations
  module PadrinoPlugin
    def self.init
      Appsignal.logger.info("Loading Padrino (#{Padrino::VERSION}) integration")

      root             = Padrino.mounted_root
      Appsignal.config = Appsignal::Config.new(root, Padrino.env)

      Appsignal.start_logger(File.join(root, 'log'))
      Appsignal.start

      if Appsignal.active?
        Padrino.use(Appsignal::Rack::Listener)
      end
    end
  end
end

module Padrino::Routing::InstanceMethods
  alias route_without_appsignal route!

  def route!(base = settings, pass_block = nil)
    if env['sinatra.static_file']
      route_without_appsignal(base, pass_block)
    else
      payload = {
        :params  => request.params,
        :session => request.session,
        :method  => request.request_method,
        :path    => request.path
      }
      ActiveSupport::Notifications.instrument('process_action.padrino', payload) do |payload|
        begin
          route_without_appsignal(base, pass_block)
        rescue => e
          Appsignal.add_exception(e); raise e
        ensure
          payload[:action] = "#{settings.name}:#{request.controller}##{request.action}"
        end
      end
    end
  end
end

Padrino.after_load do
  Appsignal::Integrations::PadrinoPlugin.init
end


text:
"""
homeassistant.components.rollershutter.demo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Demo platform for the rollorshutter component.
"""
from homeassistant.const import EVENT_TIME_CHANGED
from homeassistant.helpers.event import track_utc_time_change
from homeassistant.components.rollershutter import RollershutterDevice

def setup_platform(hass, config, add_devices, discovery_info=None):
    """ Sets up the Demo rollershutters. """
    add_devices([
        DemoRollershutter(hass, 'Kitchen Window', 0),
        DemoRollershutter(hass, 'Living Room Window', 100),
    ])

class DemoRollershutter(RollershutterDevice):
    """ Represents a rollershutter.. """
    # pylint: disable=no-self-use

    def __init__(self, hass, name, position):
        self.hass = hass
        self._name = name
        self._position = position
        self._moving_up = True
        self._listener = None

    @property
    def name(self):
        """ Returns the name of the rollershutter. """
        return self._name

    @property
    def should_poll(self):
        """ No polling needed for a demo rollershutter. """
        return False

    @property
    def current_position(self):
        """ Returns the current position of the rollershutter. """
        return self._position

    def move_up(self, **kwargs):
        """ Move the rollershutter down. """
        if self._position == 0:
            return

        self._listen()
        self._moving_up = True

    def move_down(self, **kwargs):
        """ Move the rollershutter up. """
        if self._position == 100:
            return

        self._listen()
        self._moving_up = False

    def stop(self, **kwargs):
        """ Stop the rollershutter. """
        if self._listener is not None:
            self.hass.bus.remove_listener(EVENT_TIME_CHANGED, self._listener)
            self._listener = None

    def _listen(self):
        """ Listens for changes. """
        if self._listener is None:
            self._listener = track_utc_time_change(self.hass,
                                                   self._time_changed)

    def _time_changed(self, now):
        """ Track time changes. """
        if self._moving_up:
            self._position -= 10
        else:
            self._position += 10

        if self._position % 100 == 0:
            self.stop()

        self.update_ha_state()


text:
// test_find_location.cpp

// Copyright John Maddock 2007.
// Copyright Paul A. Bristow 2007.

// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)

// Basic sanity test for find_location function.

// Default domain error policy is
// #define BOOST_MATH_DOMAIN_ERROR_POLICY throw_on_error

#include <pch.hpp>

#include <boost/math/concepts/real_concept.hpp> // for real_concept
#include <boost/math/distributions/normal.hpp> // for normal_distribution
  using boost::math::normal; // Default type double.
  using boost::math::normal_distribution; // All floating-point types.
#include <boost/math/distributions/cauchy.hpp> // for cauchy_distribution
  using boost::math::cauchy;
#include <boost/math/distributions/pareto.hpp> // for cauchy_distribution
  using boost::math::pareto;
#include <boost/math/distributions/find_location.hpp>
  using boost::math::find_location;
  using boost::math::complement;// will be needed by users who want complement,
#include <boost/math/policies/policy.hpp>
  using boost::math::policies::policy;

#include <boost/test/test_exec_monitor.hpp> // for test_main
#include <boost/test/floating_point_comparison.hpp> // for BOOST_CHECK_CLOSE_FRACTION, BOOST_CHECK_EQUAL...

#include <iostream>
  using std::cout; using std::endl; using std::fixed;
  using std::right; using std::left; using std::showpoint;
  using std::showpos; using std::setw; using std::setprecision;

#include <limits>
  using std::numeric_limits;

template <class RealType> // Any floating-point type RealType.
void test_spots(RealType)
{ // Parameter only provides the type, float, double... value ignored.

  // Basic sanity checks, test data may be to double precision only
  // so set tolerance to 100 eps expressed as a fraction,
  // or 100 eps of type double expressed as a fraction,
  // whichever is the larger.

  RealType tolerance = (std::max)
      (boost::math::tools::epsilon<RealType>(),
      static_cast<RealType>(std::numeric_limits<double>::epsilon()));
   tolerance *= 100; // 100 eps as a fraction.

  cout << "Tolerance for type " << typeid(RealType).name()  << " is "
    << setprecision(3) << tolerance  << " (or " << tolerance * 100 << "%)." << endl;

  BOOST_CHECK_THROW( // Probability outside 0 to 1.
       find_location<normal_distribution<RealType> >(
       static_cast<RealType>(0.), static_cast<RealType>(-1.), static_cast<RealType>(0.) ),
       std::domain_error);

  normal_distribution<RealType> n; // standard N(0,1)
  BOOST_CHECK_EQUAL(n.location(), 0); // aka mean.
  BOOST_CHECK_EQUAL(n.scale(), 1); // aka standard_deviation.

   // Check for 'bad' arguments.
  BOOST_CHECK_THROW(find_location<normal>(0., -1., 0.), std::domain_error); // p below 0 to 1.
  BOOST_CHECK_THROW(find_location<normal>(0., 2., 0.), std::domain_error); // p above 0 to 1.
  BOOST_CHECK_THROW(find_location<normal>(numeric_limits<double>::infinity(), 0.5, 0.),
    std::domain_error); // z not finite.
  BOOST_CHECK_THROW(find_location<normal>(numeric_limits<double>::quiet_NaN(), -1., 0.),
    std::domain_error); // z not finite
  BOOST_CHECK_THROW(find_location<normal>(0., -1., numeric_limits<double>::quiet_NaN()),
    std::domain_error); // scale not finite

  BOOST_CHECK_THROW(find_location<normal>(complement(0., -1., 0.)), std::domain_error); // p below 0 to 1.
  BOOST_CHECK_THROW(find_location<normal>(complement(0., 2., 0.)), std::domain_error); // p above 0 to 1.
  BOOST_CHECK_THROW(find_location<normal>(complement(numeric_limits<double>::infinity(), 0.5, 0.)),
    std::domain_error); // z not finite.
  BOOST_CHECK_THROW(find_location<normal>(complement(numeric_limits<double>::quiet_NaN(), -1., 0.)),
    std::domain_error); // z not finite
  BOOST_CHECK_THROW(find_location<normal>(complement(0., -1., numeric_limits<double>::quiet_NaN())),
    std::domain_error); // scale not finite

  //// Check for ab-use with unsuitable distribution(s) when concept check implemented.
  // BOOST_CHECK_THROW(find_location<pareto>(0., 0.5, 0.), std::domain_error); // pareto can't be used with find_location.

  // Check doesn't throw when an ignore_error for domain_error policy is used.
  using boost::math::policies::policy;
  using boost::math::policies::domain_error;
  using boost::math::policies::ignore_error;

  // Define a (bad?) policy to ignore domain errors ('bad' arguments):
  typedef policy<domain_error<ignore_error> > ignore_domain_policy;
  // Using a typedef is convenient, especially if it is re-used.

  BOOST_CHECK_NO_THROW(find_location<normal>(0, -1, 1,
    ignore_domain_policy())); // probability outside [0, 1]
  BOOST_CHECK_NO_THROW(find_location<normal>(numeric_limits<double>::infinity(), -1, 1,
    ignore_domain_policy())); // z not finite.

  BOOST_CHECK_NO_THROW(find_location<normal>(complement(0, -1, 1,
    ignore_domain_policy()))); // probability outside [0, 1]
  BOOST_CHECK_NO_THROW(find_location<normal>(complement(numeric_limits<double>::infinity(), -1, 1,
    ignore_domain_policy()))); // z not finite.

  // Find location to give a probability p (0.05) of z (-2)
  RealType sd = static_cast<RealType>(1); // normal default standard deviation = 1.
  RealType z = static_cast<RealType>(-2); // z to give prob p
  RealType p = static_cast<RealType>(0.05); // only 5% will be below z
  RealType l = find_location<normal_distribution<RealType> >(z, p, sd);
  // cout << z << " " << p << " " << sd << " " << l << endl;

  normal_distribution<RealType> np05pc(l, sd); // Same standard_deviation (scale) but with mean(location) shifted.
  //  cout << "Normal distribution with mean = " << l << " has " << "fraction <= " << z << " = "  << cdf(np05pc, z) << endl;
  // Check cdf such that only fraction p really is below offset mean l.
  BOOST_CHECK_CLOSE_FRACTION(p, cdf(np05pc, z), tolerance);

  // Check that some policies can be applied (though not used here).
  l = find_location<normal_distribution<RealType> >(z, p, sd, policy<>()); // Default policy, needs using boost::math::policies::policy;
  l = find_location<normal_distribution<RealType> >(z, p, sd, boost::math::policies::policy<>()); // Default policy, fully specified.
  l = find_location<normal_distribution<RealType> >(z, p, sd, ignore_domain_policy()); // find_location with new policy, using typedef.
  l = find_location<normal_distribution<RealType> >(z, p, sd, policy<domain_error<ignore_error> >()); // New policy, without typedef.

  // Check that can use the complement version.
  RealType q = 1 - p; // complement.
  // cout << "find_location<normal_distribution<RealType> >(complement(z, q, sd)) = " << endl;
  l = find_location<normal_distribution<RealType> >(complement(z, q, sd));

  normal_distribution<RealType> np95pc(l, sd); // Same standard_deviation (scale) but with mean(location) shifted
  //  cout << "Normal distribution with mean = " << l << " has " << "fraction <= " << z << " = "  << cdf(np95pc, z) << endl;
  BOOST_CHECK_CLOSE_FRACTION(q, cdf(np95pc, z), tolerance);

} // template <class RealType>void test_spots(RealType)

int test_main(int, char* [])
{
  // Basic sanity-check spot values.

  // (Parameter value, arbitrarily zero, only communicates the floating-point type).
  test_spots(0.0F); // Test float.
  test_spots(0.0); // Test double.
  #ifndef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
    test_spots(0.0L); // Test long double.
  #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0582))
    test_spots(boost::math::concepts::real_concept(0.)); // Test real concept.
  #endif
  #else
     std::cout << "<note>The long double tests have been disabled on this platform "
        "either because the long double overloads of the usual math functions are "
        "not available at all, or because they are too inaccurate for these tests "
        "to pass.</note>" << std::cout;
  #endif
  return 0;
} // int test_main(int, char* [])

/*

Output is:

Autorun "i:\boost-06-05-03-1300\libs\math\test\Math_test\debug\test_find_location.exe"
Running 1 test case...
Tolerance for type float is 1.19e-005 (or 0.00119%).
Tolerance for type double is 2.22e-014 (or 2.22e-012%).
Tolerance for type long double is 2.22e-014 (or 2.22e-012%).
Tolerance for type class boost::math::concepts::real_concept is 2.22e-014 (or 2.22e-012%).
*** No errors detected

*/


text:
package org.springframework.ldap.pool;

import org.apache.commons.pool.KeyedObjectPool;
import org.springframework.ldap.pool.factory.PoolingContextSource;
import org.springframework.util.Assert;

import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.naming.ldap.Control;
import javax.naming.ldap.ExtendedRequest;
import javax.naming.ldap.ExtendedResponse;
import javax.naming.ldap.LdapContext;

/**
 * Used by {@link PoolingContextSource} to wrap a {@link LdapContext}, delegating most methods
 * to the underlying context. This class extends {@link DelegatingDirContext} which handles returning
 * the context to the pool on a call to {@link #close()}
 *
 * @author Eric Dalquist
 */
public class DelegatingLdapContext extends DelegatingDirContext implements LdapContext {
    private LdapContext delegateLdapContext;

    /**
     * Create a new delegating ldap context for the specified pool, context and context type.
     *
     * @param keyedObjectPool The pool the delegate context was checked out from.
     * @param delegateLdapContext The ldap context to delegate operations to.
     * @param dirContextType The type of context, used as a key for the pool.
     * @throws IllegalArgumentException if any of the arguments are null
     */
    public DelegatingLdapContext(KeyedObjectPool keyedObjectPool, LdapContext delegateLdapContext, DirContextType dirContextType) {
        super(keyedObjectPool, delegateLdapContext, dirContextType);
        Assert.notNull(delegateLdapContext, "delegateLdapContext may not be null");

        this.delegateLdapContext = delegateLdapContext;
    }

    //***** Helper Methods *****//

    /**
     * @return The direct delegate for this ldap context proxy
     */
    public LdapContext getDelegateLdapContext() {
        return this.delegateLdapContext;
    }

    // cannot return subtype in overridden method unless Java5
    public DirContext getDelegateDirContext() {
        return this.getDelegateLdapContext();
    }

    /**
     * Recursivley inspect delegates until a non-delegating ldap context is found.
     *
     * @return The innermost (real) DirContext that is being delegated to.
     */
    public LdapContext getInnermostDelegateLdapContext() {
        final LdapContext delegateLdapContext = this.getDelegateLdapContext();

        if (delegateLdapContext instanceof DelegatingLdapContext) {
            return ((DelegatingLdapContext)delegateLdapContext).getInnermostDelegateLdapContext();
        }

        return delegateLdapContext;
    }

    protected void assertOpen() throws NamingException {
        if (this.delegateLdapContext == null) {
            throw new NamingException("LdapContext is closed.");
        }

        super.assertOpen();
    }

    //***** Object methods *****//

    /**
     * @see java.lang.Object#equals(java.lang.Object)
     */
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof LdapContext)) {
            return false;
        }

        final LdapContext thisLdapContext = this.getInnermostDelegateLdapContext();
        LdapContext otherLdapContext = (LdapContext)obj;
        if (otherLdapContext instanceof DelegatingLdapContext) {
            otherLdapContext = ((DelegatingLdapContext)otherLdapContext).getInnermostDelegateLdapContext();
        }

        return thisLdapContext == otherLdapContext || (thisLdapContext != null && thisLdapContext.equals(otherLdapContext));
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    public int hashCode() {
        final LdapContext context = this.getInnermostDelegateLdapContext();
        return (context != null ? context.hashCode() : 0);
    }

    /**
     * @see java.lang.Object#toString()
     */
    public String toString() {
        final LdapContext context = this.getInnermostDelegateLdapContext();
        return (context != null ? context.toString() : "LdapContext is closed");
    }

    //***** LdapContext Interface Delegates *****//

    /**
     * @see javax.naming.ldap.LdapContext#extendedOperation(javax.naming.ldap.ExtendedRequest)
     */
    public ExtendedResponse extendedOperation(ExtendedRequest request) throws NamingException {
        this.assertOpen();
        return this.getDelegateLdapContext().extendedOperation(request);
    }

    /**
     * @see javax.naming.ldap.LdapContext#getConnectControls()
     */
    public Control[] getConnectControls() throws NamingException {
        this.assertOpen();
        return this.getDelegateLdapContext().getConnectControls();
    }

    /**
     * @see javax.naming.ldap.LdapContext#getRequestControls()
     */
    public Control[] getRequestControls() throws NamingException {
        this.assertOpen();
        return this.getDelegateLdapContext().getRequestControls();
    }

    /**
     * @see javax.naming.ldap.LdapContext#getResponseControls()
     */
    public Control[] getResponseControls() throws NamingException {
        this.assertOpen();
        return this.getDelegateLdapContext().getResponseControls();
    }

    /**
     * @see javax.naming.ldap.LdapContext#newInstance(javax.naming.ldap.Control[])
     */
    public LdapContext newInstance(Control[] requestControls) throws NamingException {
        throw new UnsupportedOperationException("Cannot call newInstance on a pooled context");
    }

    /**
     * @see javax.naming.ldap.LdapContext#reconnect(javax.naming.ldap.Control[])
     */
    public void reconnect(Control[] connCtls) throws NamingException {
        throw new UnsupportedOperationException("Cannot call reconnect on a pooled context");
    }

    /**
     * @see javax.naming.ldap.LdapContext#setRequestControls(javax.naming.ldap.Control[])
     */
    public void setRequestControls(Control[] requestControls) throws NamingException {
        throw new UnsupportedOperationException("Cannot call setRequestControls on a pooled context");
    }

    /**
     * @see DelegatingDirContext#close()
     */
    public void close() throws NamingException {
        if (this.delegateLdapContext == null) {
            return;
        }

        super.close();
        this.delegateLdapContext = null;
    }
}


text:
[LARA Plugin API](../README.md) > [ISidebarOptions](../interfaces/isidebaroptions.md)

# Interface: ISidebarOptions

## Hierarchy

**ISidebarOptions**

## Index

### Properties

* [content](isidebaroptions.md#content)
* [handle](isidebaroptions.md#handle)
* [handleColor](isidebaroptions.md#handlecolor)
* [icon](isidebaroptions.md#icon)
* [onClose](isidebaroptions.md#onclose)
* [onOpen](isidebaroptions.md#onopen)
* [padding](isidebaroptions.md#padding)
* [titleBar](isidebaroptions.md#titlebar)
* [titleBarColor](isidebaroptions.md#titlebarcolor)
* [width](isidebaroptions.md#width)

---

## Properties

###  content

**● content**: *`string` \| `HTMLElement`*

*Defined in [api/sidebar.ts:10](https://github.com/concord-consortium/lara/blob/5741bf58/lara-plugin-api-V2/src/api/sidebar.ts#L10)*

___

### `<Optional>` handle

**● handle**: *`undefined` \| `string`*

*Defined in [api/sidebar.ts:14](https://github.com/concord-consortium/lara/blob/5741bf58/lara-plugin-api-V2/src/api/sidebar.ts#L14)*

Text displayed on the sidebar handle.

___

### `<Optional>` handleColor

**● handleColor**: *`undefined` \| `string`*

*Defined in [api/sidebar.ts:15](https://github.com/concord-consortium/lara/blob/5741bf58/lara-plugin-api-V2/src/api/sidebar.ts#L15)*

___

### `<Optional>` icon

**● icon**: *`string` \| `HTMLElement`*

*Defined in [api/sidebar.ts:12](https://github.com/concord-consortium/lara/blob/5741bf58/lara-plugin-api-V2/src/api/sidebar.ts#L12)*

Icon can be 'default' (arrow) or an HTML element.

___

### `<Optional>` onClose

**● onClose**: *`undefined` \| `function`*

*Defined in [api/sidebar.ts:22](https://github.com/concord-consortium/lara/blob/5741bf58/lara-plugin-api-V2/src/api/sidebar.ts#L22)*

___

### `<Optional>` onOpen

**● onOpen**: *`undefined` \| `function`*

*Defined in [api/sidebar.ts:21](https://github.com/concord-consortium/lara/blob/5741bf58/lara-plugin-api-V2/src/api/sidebar.ts#L21)*

___

### `<Optional>` padding

**● padding**: *`undefined` \| `number`*

*Defined in [api/sidebar.ts:20](https://github.com/concord-consortium/lara/blob/5741bf58/lara-plugin-api-V2/src/api/sidebar.ts#L20)*

___

### `<Optional>` titleBar

**● titleBar**: *`undefined` \| `string`*

*Defined in [api/sidebar.ts:17](https://github.com/concord-consortium/lara/blob/5741bf58/lara-plugin-api-V2/src/api/sidebar.ts#L17)*

Title visible after sidebar is opened by user. If it's not provided, it won't be displayed at all.

___

### `<Optional>` titleBarColor

**● titleBarColor**: *`undefined` \| `string`*

*Defined in [api/sidebar.ts:18](https://github.com/concord-consortium/lara/blob/5741bf58/lara-plugin-api-V2/src/api/sidebar.ts#L18)*

___

### `<Optional>` width

**● width**: *`undefined` \| `number`*

*Defined in [api/sidebar.ts:19](https://github.com/concord-consortium/lara/blob/5741bf58/lara-plugin-api-V2/src/api/sidebar.ts#L19)*

___


text:
ezie.gui.config.bind.tool_watermark = function() {
    // we will use a selection box to allow the user to place and resize
    // the watermark where he wants it. Therefore, if a selection
    // existed, we remove it.
    ezie.gui.config.bind.tool_select_remove();

    ezie.gui.eziegui.getInstance().opts().showOpts("#optsWatermarks");
}

ezie.gui.config.bind.tool_place_watermark = function(watermark) {
    ezie.gui.config.bind.tool_select_remove();

    var img = $(watermark);
    var ratio = img.width() / img.height();

    $.log('on va se faire un ptit wm de ratio : ' + img.width() + ' / ' + img.height() + " = " + ratio);

    ezie.gui.config.bind.set_tool_select(null, {
        bgColor:     'transparent',
        aspectRatio: ratio,
        bgOpacity: 1,
        setSelect: [10, 10, img.width(), img.height()]
    }, true);

    // this is a trick/hack and it would be nice to find another
    // way of doing it.
    wm = $('').attr('src', watermark.src).css({
        width: '100%',
        height: '100%'
    });
    $('.jcrop-tracker:first').append(wm);

    ezie.gui.config.bind.tool_watermark_move();

    $.log('youpi le wm selection:) ');

}

ezie.gui.config.bind.tool_watermark_submit = function() {
    if (!ezie.gui.selection().isSelectionActive()) {
        return;
    } else {
        src = $('.jcrop-tracker:first img').attr('src');

        src = src.substr(src.lastIndexOf('/') + 1);

        ezie.ezconnect.connect.instance().action({
            'action': 'tool_watermark',
            'data': {
                'watermark_image': src
            }
        });
        ezie.gui.config.bind.tool_select_remove();

    }
}

ezie.gui.config.bind.tool_watermark_position = null;

ezie.gui.config.bind.tool_watermark_set_pos = function(button) {
    $('#optsWatermarksPositions').find('.selected').removeClass('selected');

    b = $(button);
    b.addClass('selected');

    ezie.gui.config.bind.tool_watermark_position = $('#optsWatermarksPositions button').index(button);

    if (ezie.gui.selection().isSelectionActive()) {
        // move the selection
        ezie.gui.config.bind.tool_watermark_move();
    }
}

ezie.gui.config.bind.tool_watermark_move = function() {
    if (ezie.gui.config.bind.tool_watermark_position == null) {
        return;
    }

    var img = $("#main_image");
    var sel = ezie.gui.selection().selection();

    var h_off = 10;
    var v_off = 10;

    // Positions:
    // 0 1 2
    // 3 4 5
    // 6 7 8
    var position = {};

    // JavaScript's switch is a bit buggy :('
    switch(ezie.gui.config.bind.tool_watermark_position) {
        // y
        case 0:
        case 1:
        case 2:
            position.y1 = v_off;
            break;
        case 3:
        case 4:
        case 5:
            position.y1 = img.height() / 2 - sel.h / 2;
            break;
        case 6:
        case 7:
        case 8:
            position.y1 = img.height() - sel.h - v_off;
            break;
    }

    switch(ezie.gui.config.bind.tool_watermark_position) {
        // x
        case 0:
        case 3:
        case 6:
            position.x1 = h_off;
            break;
        case 1:
        case 4:
        case 7:
            position.x1 = img.width() / 2 - sel.w / 2;
            break;
        case 2:
        case 5:
        case 8:
            position.x1 = img.width() - sel.w - h_off;
            break;
    }

    position.x2 = position.x1 + sel.w;
    position.y2 = position.y1 + sel.h;

    $.log('wm position :');
    $.log('    '+ezie.gui.config.bind.tool_watermark_position)
    $.log('sel :');
    $.log('  w, h: ' + sel.w + ', ' + sel.h);
    $.log('img :');
    $.log('  w, h: ' + img.width() + ', ' + img.height());
    $.log('position : ');
    $.log('  (x1, y1) : (' + position.x1 + ', ' + position.y1 + ')');
    $.log('  (x2, y2) : (' + position.x2 + ', ' + position.y2 + ')');
    ezie.gui.config.bind.tool_select_api.animateTo([position.x1, position.y1, position.x2, position.y2]);
}


text:
        <title>Playlist</title>
        <link rel="stylesheet" href="/playlist/static/styles.css">

                    DJ Nori wants to share a playlist with you

                    With Brave Playlist, make playlists of your favorite audio and videos and play anytime, anywhere. Even offline.

                <button id="open_button" type="button" onclick="window.brave.playlist.open('8D961994C728');">

                        Open Playlist

                </button>


text:
#ifndef __LAUNCHD_CORE_LOGIC__
#define __LAUNCHD_CORE_LOGIC__

#include "runtime.h"
#include "bootstrap.h"
#include "launch.h"
#include <xpc/private.h>

typedef struct job_s *job_t;
typedef struct jobmgr_s *jobmgr_t;

extern jobmgr_t root_jobmgr;
extern mach_port_t launchd_audit_port;
extern au_asid_t launchd_audit_session;
extern bool launchd_flat_mach_namespace;
extern bool launchd_embedded_handofgod;

void jobmgr_init(bool);
jobmgr_t jobmgr_shutdown(jobmgr_t jm);
void jobmgr_dispatch_all_semaphores(jobmgr_t jm);
void jobmgr_dispatch_all_interested(jobmgr_t jm, job_t j);
jobmgr_t jobmgr_delete_anything_with_port(jobmgr_t jm, mach_port_t port);

launch_data_t job_export_all(void);

job_t job_dispatch(job_t j, bool kickstart); /* returns j on success, NULL on job removal */
job_t job_find(jobmgr_t jm, const char *label);
job_t job_find_by_service_port(mach_port_t p);
bool job_ack_port_destruction(mach_port_t p);
bool job_is_anonymous(job_t j);
launch_data_t job_export(job_t j);
void job_stop(job_t j);
void job_checkin(job_t j);
void job_remove(job_t j);
bool job_is_god(job_t j);
job_t job_import(launch_data_t pload);
launch_data_t job_import_bulk(launch_data_t pload);
job_t job_mig_intran(mach_port_t mp);
void job_mig_destructor(job_t j);
void job_ack_no_senders(job_t j);
void job_log(job_t j, int pri, const char *msg, ...) __attribute__((format(printf, 3, 4)));
void job_set_pid_crashed(pid_t p);

bool xpc_event_demux(mach_port_t p, xpc_object_t request, xpc_object_t *reply);
bool xpc_process_demux(mach_port_t p, xpc_object_t request, xpc_object_t *reply);

#endif /* __LAUNCHD_CORE_LOGIC__ */


text:
from test import CollectorTestCase
from test import get_collector_config

from iodrivesnmp import IODriveSNMPCollector

class TestIODriveSNMPCollector(CollectorTestCase):

    def setUp(self, allowed_names=None):
        if not allowed_names:
            allowed_names = []
        config = get_collector_config('IODriveSNMPCollector', {
            'allowed_names': allowed_names,
            'interval': 1
        })
        self.collector = IODriveSNMPCollector(config, None)

    def test_import(self):
        self.assertTrue(IODriveSNMPCollector)


text:
from django.conf.urls import url
from . import views

urlpatterns = [
    url(r'^$', views.UserList.as_view(), name='user-list'),

    url(r'^(?P<user_id>\w+)/$', views.UserDetail.as_view(), name='user-detail'),
    url(r'^(?P<user_id>\w+)/nodes/$', views.UserNodes.as_view(), name='user-nodes'),

]


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Cake.Core.Diagnostics;
using Cake.Core.IO;
using Cake.Core.Scripting;

namespace Cake.Scripting.Roslyn.Nightly
{
    internal sealed class RoslynNightlyScriptSession : IScriptSession
    {
        private readonly IScriptHost _host;
        private readonly ICakeLog _log;
        private readonly HashSet<FilePath> _referencePaths;
        private readonly HashSet<Assembly> _references;
        private readonly HashSet<string> _namespaces;

        public RoslynNightlyScriptSession(IScriptHost host, ICakeLog log)
        {
            _host = host;
            _log = log;

            _referencePaths = new HashSet<FilePath>(PathComparer.Default);
            _references = new HashSet<Assembly>();
            _namespaces = new HashSet<string>(StringComparer.Ordinal);
        }

        public void AddReference(FilePath path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }
            _log.Debug("Adding reference to {0}...", path.GetFilename().FullPath);
            _referencePaths.Add(path);
        }

        public void AddReference(Assembly assembly)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }
            _log.Debug("Adding reference to {0}...", new FilePath(assembly.Location).GetFilename().FullPath);
            _references.Add(assembly);
        }

        public void ImportNamespace(string @namespace)
        {
            if (!_namespaces.Contains(@namespace))
            {
                _log.Debug("Importing namespace {0}...", @namespace);
                _namespaces.Add(@namespace);
            }
        }

        public void Execute(Script script)
        {
            // Generate the script code.
            var generator = new RoslynCodeGenerator();
            var code = generator.Generate(script);

            // Create the script options dynamically.
            var options = Microsoft.CodeAnalysis.Scripting.ScriptOptions.Default
                .AddNamespaces(_namespaces)
                .AddReferences(_references)
                .AddReferences(_referencePaths.Select(r => r.FullPath));

            _log.Debug("Compiling build script...");
            Microsoft.CodeAnalysis.Scripting.CSharp.CSharpScript.Eval(code, options, _host);
        }
    }
}