text:
using Xunit;

public class BeerSongTest
{
    [Fact]
    public void First_generic_verse()
    {
        var expected =
            "99 bottles of beer on the wall, 99 bottles of beer.\n" +
            "Take one down and pass it around, 98 bottles of beer on the wall.\n" +
            "";
        Assert.Equal(expected, BeerSong.Verse(99));
    }

    [Fact(Skip = "Remove to run test")]
    public void Last_generic_verse()
    {
        var expected =
            "3 bottles of beer on the wall, 3 bottles of beer.\n" +
            "Take one down and pass it around, 2 bottles of beer on the wall.\n" +
            "";
        Assert.Equal(expected, BeerSong.Verse(3));
    }

    [Fact(Skip = "Remove to run test")]
    public void Verse_2()
    {
        var expected =
            "2 bottles of beer on the wall, 2 bottles of beer.\n" +
            "Take one down and pass it around, 1 bottle of beer on the wall.\n" +
            "";
        Assert.Equal(expected, BeerSong.Verse(2));
    }

    [Fact(Skip = "Remove to run test")]
    public void Verse_1()
    {
        var expected =
            "1 bottle of beer on the wall, 1 bottle of beer.\n" +
            "Take it down and pass it around, no more bottles of beer on the wall.\n" +
            "";
        Assert.Equal(expected, BeerSong.Verse(1));
    }

    [Fact(Skip = "Remove to run test")]
    public void Verse_0()
    {
        var expected =
            "No more bottles of beer on the wall, no more bottles of beer.\n" +
            "Go to the store and buy some more, 99 bottles of beer on the wall.\n" +
            "";
        Assert.Equal(expected, BeerSong.Verse(0));
    }

    [Fact(Skip = "Remove to run test")]
    public void First_two_verses()
    {
        var expected =
            "99 bottles of beer on the wall, 99 bottles of beer.\n" +
            "Take one down and pass it around, 98 bottles of beer on the wall.\n" +
            "\n" +
            "98 bottles of beer on the wall, 98 bottles of beer.\n" +
            "Take one down and pass it around, 97 bottles of beer on the wall.\n" +
            "";
        Assert.Equal(expected, BeerSong.Verses(99, 98));
    }

    [Fact(Skip = "Remove to run test")]
    public void Last_three_verses()
    {
        var expected =
            "2 bottles of beer on the wall, 2 bottles of beer.\n" +
            "Take one down and pass it around, 1 bottle of beer on the wall.\n" +
            "\n" +
            "1 bottle of beer on the wall, 1 bottle of beer.\n" +
            "Take it down and pass it around, no more bottles of beer on the wall.\n" +
            "\n" +
            "No more bottles of beer on the wall, no more bottles of beer.\n" +
            "Go to the store and buy some more, 99 bottles of beer on the wall.\n" +
            "";
        Assert.Equal(expected, BeerSong.Verses(2, 0));
    }

    [Fact(Skip = "Remove to run test")]
    public void All_verses()
    {
        var expected =
            "99 bottles of beer on the wall, 99 bottles of beer.\n" +
            "Take one down and pass it around, 98 bottles of beer on the wall.\n" +
            "\n" +
            "98 bottles of beer on the wall, 98 bottles of beer.\n" +
            "Take one down and pass it around, 97 bottles of beer on the wall.\n" +
            "\n" +
            "97 bottles of beer on the wall, 97 bottles of beer.\n" +
            "Take one down and pass it around, 96 bottles of beer on the wall.\n" +
            "\n" +
            "96 bottles of beer on the wall, 96 bottles of beer.\n" +
            "Take one down and pass it around, 95 bottles of beer on the wall.\n" +
            "\n" +
            "95 bottles of beer on the wall, 95 bottles of beer.\n" +
            "Take one down and pass it around, 94 bottles of beer on the wall.\n" +
            "\n" +
            "94 bottles of beer on the wall, 94 bottles of beer.\n" +
            "Take one down and pass it around, 93 bottles of beer on the wall.\n" +
            "\n" +
            "93 bottles of beer on the wall, 93 bottles of beer.\n" +
            "Take one down and pass it around, 92 bottles of beer on the wall.\n" +
            "\n" +
            "92 bottles of beer on the wall, 92 bottles of beer.\n" +
            "Take one down and pass it around, 91 bottles of beer on the wall.\n" +
            "\n" +
            "91 bottles of beer on the wall, 91 bottles of beer.\n" +
            "Take one down and pass it around, 90 bottles of beer on the wall.\n" +
            "\n" +
            "90 bottles of beer on the wall, 90 bottles of beer.\n" +
            "Take one down and pass it around, 89 bottles of beer on the wall.\n" +
            "\n" +
            "89 bottles of beer on the wall, 89 bottles of beer.\n" +
            "Take one down and pass it around, 88 bottles of beer on the wall.\n" +
            "\n" +
            "88 bottles of beer on the wall, 88 bottles of beer.\n" +
            "Take one down and pass it around, 87 bottles of beer on the wall.\n" +
            "\n" +
            "87 bottles of beer on the wall, 87 bottles of beer.\n" +
            "Take one down and pass it around, 86 bottles of beer on the wall.\n" +
            "\n" +
            "86 bottles of beer on the wall, 86 bottles of beer.\n" +
            "Take one down and pass it around, 85 bottles of beer on the wall.\n" +
            "\n" +
            "85 bottles of beer on the wall, 85 bottles of beer.\n" +
            "Take one down and pass it around, 84 bottles of beer on the wall.\n" +
            "\n" +
            "84 bottles of beer on the wall, 84 bottles of beer.\n" +
            "Take one down and pass it around, 83 bottles of beer on the wall.\n" +
            "\n" +
            "83 bottles of beer on the wall, 83 bottles of beer.\n" +
            "Take one down and pass it around, 82 bottles of beer on the wall.\n" +
            "\n" +
            "82 bottles of beer on the wall, 82 bottles of beer.\n" +
            "Take one down and pass it around, 81 bottles of beer on the wall.\n" +
            "\n" +
            "81 bottles of beer on the wall, 81 bottles of beer.\n" +
            "Take one down and pass it around, 80 bottles of beer on the wall.\n" +
            "\n" +
            "80 bottles of beer on the wall, 80 bottles of beer.\n" +
            "Take one down and pass it around, 79 bottles of beer on the wall.\n" +
            "\n" +
            "79 bottles of beer on the wall, 79 bottles of beer.\n" +
            "Take one down and pass it around, 78 bottles of beer on the wall.\n" +
            "\n" +
            "78 bottles of beer on the wall, 78 bottles of beer.\n" +
            "Take one down and pass it around, 77 bottles of beer on the wall.\n" +
            "\n" +
            "77 bottles of beer on the wall, 77 bottles of beer.\n" +
            "Take one down and pass it around, 76 bottles of beer on the wall.\n" +
            "\n" +
            "76 bottles of beer on the wall, 76 bottles of beer.\n" +
            "Take one down and pass it around, 75 bottles of beer on the wall.\n" +
            "\n" +
            "75 bottles of beer on the wall, 75 bottles of beer.\n" +
            "Take one down and pass it around, 74 bottles of beer on the wall.\n" +
            "\n" +
            "74 bottles of beer on the wall, 74 bottles of beer.\n" +
            "Take one down and pass it around, 73 bottles of beer on the wall.\n" +
            "\n" +
            "73 bottles of beer on the wall, 73 bottles of beer.\n" +
            "Take one down and pass it around, 72 bottles of beer on the wall.\n" +
            "\n" +
            "72 bottles of beer on the wall, 72 bottles of beer.\n" +
            "Take one down and pass it around, 71 bottles of beer on the wall.\n" +
            "\n" +
            "71 bottles of beer on the wall, 71 bottles of beer.\n" +
            "Take one down and pass it around, 70 bottles of beer on the wall.\n" +
            "\n" +
            "70 bottles of beer on the wall, 70 bottles of beer.\n" +
            "Take one down and pass it around, 69 bottles of beer on the wall.\n" +
            "\n" +
            "69 bottles of beer on the wall, 69 bottles of beer.\n" +
            "Take one down and pass it around, 68 bottles of beer on the wall.\n" +
            "\n" +
            "68 bottles of beer on the wall, 68 bottles of beer.\n" +
            "Take one down and pass it around, 67 bottles of beer on the wall.\n" +
            "\n" +
            "67 bottles of beer on the wall, 67 bottles of beer.\n" +
            "Take one down and pass it around, 66 bottles of beer on the wall.\n" +
            "\n" +
            "66 bottles of beer on the wall, 66 bottles of beer.\n" +
            "Take one down and pass it around, 65 bottles of beer on the wall.\n" +
            "\n" +
            "65 bottles of beer on the wall, 65 bottles of beer.\n" +
            "Take one down and pass it around, 64 bottles of beer on the wall.\n" +
            "\n" +
            "64 bottles of beer on the wall, 64 bottles of beer.\n" +
            "Take one down and pass it around, 63 bottles of beer on the wall.\n" +
            "\n" +
            "63 bottles of beer on the wall, 63 bottles of beer.\n" +
            "Take one down and pass it around, 62 bottles of beer on the wall.\n" +
            "\n" +
            "62 bottles of beer on the wall, 62 bottles of beer.\n" +
            "Take one down and pass it around, 61 bottles of beer on the wall.\n" +
            "\n" +
            "61 bottles of beer on the wall, 61 bottles of beer.\n" +
            "Take one down and pass it around, 60 bottles of beer on the wall.\n" +
            "\n" +
            "60 bottles of beer on the wall, 60 bottles of beer.\n" +
            "Take one down and pass it around, 59 bottles of beer on the wall.\n" +
            "\n" +
            "59 bottles of beer on the wall, 59 bottles of beer.\n" +
            "Take one down and pass it around, 58 bottles of beer on the wall.\n" +
            "\n" +
            "58 bottles of beer on the wall, 58 bottles of beer.\n" +
            "Take one down and pass it around, 57 bottles of beer on the wall.\n" +
            "\n" +
            "57 bottles of beer on the wall, 57 bottles of beer.\n" +
            "Take one down and pass it around, 56 bottles of beer on the wall.\n" +
            "\n" +
            "56 bottles of beer on the wall, 56 bottles of beer.\n" +
            "Take one down and pass it around, 55 bottles of beer on the wall.\n" +
            "\n" +
            "55 bottles of beer on the wall, 55 bottles of beer.\n" +
            "Take one down and pass it around, 54 bottles of beer on the wall.\n" +
            "\n" +
            "54 bottles of beer on the wall, 54 bottles of beer.\n" +
            "Take one down and pass it around, 53 bottles of beer on the wall.\n" +
            "\n" +
            "53 bottles of beer on the wall, 53 bottles of beer.\n" +
            "Take one down and pass it around, 52 bottles of beer on the wall.\n" +
            "\n" +
            "52 bottles of beer on the wall, 52 bottles of beer.\n" +
            "Take one down and pass it around, 51 bottles of beer on the wall.\n" +
            "\n" +
            "51 bottles of beer on the wall, 51 bottles of beer.\n" +
            "Take one down and pass it around, 50 bottles of beer on the wall.\n" +
            "\n" +
            "50 bottles of beer on the wall, 50 bottles of beer.\n" +
            "Take one down and pass it around, 49 bottles of beer on the wall.\n" +
            "\n" +
            "49 bottles of beer on the wall, 49 bottles of beer.\n" +
            "Take one down and pass it around, 48 bottles of beer on the wall.\n" +
            "\n" +
            "48 bottles of beer on the wall, 48 bottles of beer.\n" +
            "Take one down and pass it around, 47 bottles of beer on the wall.\n" +
            "\n" +
            "47 bottles of beer on the wall, 47 bottles of beer.\n" +
            "Take one down and pass it around, 46 bottles of beer on the wall.\n" +
            "\n" +
            "46 bottles of beer on the wall, 46 bottles of beer.\n" +
            "Take one down and pass it around, 45 bottles of beer on the wall.\n" +
            "\n" +
            "45 bottles of beer on the wall, 45 bottles of beer.\n" +
            "Take one down and pass it around, 44 bottles of beer on the wall.\n" +
            "\n" +
            "44 bottles of beer on the wall, 44 bottles of beer.\n" +
            "Take one down and pass it around, 43 bottles of beer on the wall.\n" +
            "\n" +
            "43 bottles of beer on the wall, 43 bottles of beer.\n" +
            "Take one down and pass it around, 42 bottles of beer on the wall.\n" +
            "\n" +
            "42 bottles of beer on the wall, 42 bottles of beer.\n" +
            "Take one down and pass it around, 41 bottles of beer on the wall.\n" +
            "\n" +
            "41 bottles of beer on the wall, 41 bottles of beer.\n" +
            "Take one down and pass it around, 40 bottles of beer on the wall.\n" +
            "\n" +
            "40 bottles of beer on the wall, 40 bottles of beer.\n" +
            "Take one down and pass it around, 39 bottles of beer on the wall.\n" +
            "\n" +
            "39 bottles of beer on the wall, 39 bottles of beer.\n" +
            "Take one down and pass it around, 38 bottles of beer on the wall.\n" +
            "\n" +
            "38 bottles of beer on the wall, 38 bottles of beer.\n" +
            "Take one down and pass it around, 37 bottles of beer on the wall.\n" +
            "\n" +
            "37 bottles of beer on the wall, 37 bottles of beer.\n" +
            "Take one down and pass it around, 36 bottles of beer on the wall.\n" +
            "\n" +
            "36 bottles of beer on the wall, 36 bottles of beer.\n" +
            "Take one down and pass it around, 35 bottles of beer on the wall.\n" +
            "\n" +
            "35 bottles of beer on the wall, 35 bottles of beer.\n" +
            "Take one down and pass it around, 34 bottles of beer on the wall.\n" +
            "\n" +
            "34 bottles of beer on the wall, 34 bottles of beer.\n" +
            "Take one down and pass it around, 33 bottles of beer on the wall.\n" +
            "\n" +
            "33 bottles of beer on the wall, 33 bottles of beer.\n" +
            "Take one down and pass it around, 32 bottles of beer on the wall.\n" +
            "\n" +
            "32 bottles of beer on the wall, 32 bottles of beer.\n" +
            "Take one down and pass it around, 31 bottles of beer on the wall.\n" +
            "\n" +
            "31 bottles of beer on the wall, 31 bottles of beer.\n" +
            "Take one down and pass it around, 30 bottles of beer on the wall.\n" +
            "\n" +
            "30 bottles of beer on the wall, 30 bottles of beer.\n" +
            "Take one down and pass it around, 29 bottles of beer on the wall.\n" +
            "\n" +
            "29 bottles of beer on the wall, 29 bottles of beer.\n" +
            "Take one down and pass it around, 28 bottles of beer on the wall.\n" +
            "\n" +
            "28 bottles of beer on the wall, 28 bottles of beer.\n" +
            "Take one down and pass it around, 27 bottles of beer on the wall.\n" +
            "\n" +
            "27 bottles of beer on the wall, 27 bottles of beer.\n" +
            "Take one down and pass it around, 26 bottles of beer on the wall.\n" +
            "\n" +
            "26 bottles of beer on the wall, 26 bottles of beer.\n" +
            "Take one down and pass it around, 25 bottles of beer on the wall.\n" +
            "\n" +
            "25 bottles of beer on the wall, 25 bottles of beer.\n" +
            "Take one down and pass it around, 24 bottles of beer on the wall.\n" +
            "\n" +
            "24 bottles of beer on the wall, 24 bottles of beer.\n" +
            "Take one down and pass it around, 23 bottles of beer on the wall.\n" +
            "\n" +
            "23 bottles of beer on the wall, 23 bottles of beer.\n" +
            "Take one down and pass it around, 22 bottles of beer on the wall.\n" +
            "\n" +
            "22 bottles of beer on the wall, 22 bottles of beer.\n" +
            "Take one down and pass it around, 21 bottles of beer on the wall.\n" +
            "\n" +
            "21 bottles of beer on the wall, 21 bottles of beer.\n" +
            "Take one down and pass it around, 20 bottles of beer on the wall.\n" +
            "\n" +
            "20 bottles of beer on the wall, 20 bottles of beer.\n" +
            "Take one down and pass it around, 19 bottles of beer on the wall.\n" +
            "\n" +
            "19 bottles of beer on the wall, 19 bottles of beer.\n" +
            "Take one down and pass it around, 18 bottles of beer on the wall.\n" +
            "\n" +
            "18 bottles of beer on the wall, 18 bottles of beer.\n" +
            "Take one down and pass it around, 17 bottles of beer on the wall.\n" +
            "\n" +
            "17 bottles of beer on the wall, 17 bottles of beer.\n" +
            "Take one down and pass it around, 16 bottles of beer on the wall.\n" +
            "\n" +
            "16 bottles of beer on the wall, 16 bottles of beer.\n" +
            "Take one down and pass it around, 15 bottles of beer on the wall.\n" +
            "\n" +
            "15 bottles of beer on the wall, 15 bottles of beer.\n" +
            "Take one down and pass it around, 14 bottles of beer on the wall.\n" +
            "\n" +
            "14 bottles of beer on the wall, 14 bottles of beer.\n" +
            "Take one down and pass it around, 13 bottles of beer on the wall.\n" +
            "\n" +
            "13 bottles of beer on the wall, 13 bottles of beer.\n" +
            "Take one down and pass it around, 12 bottles of beer on the wall.\n" +
            "\n" +
            "12 bottles of beer on the wall, 12 bottles of beer.\n" +
            "Take one down and pass it around, 11 bottles of beer on the wall.\n" +
            "\n" +
            "11 bottles of beer on the wall, 11 bottles of beer.\n" +
            "Take one down and pass it around, 10 bottles of beer on the wall.\n" +
            "\n" +
            "10 bottles of beer on the wall, 10 bottles of beer.\n" +
            "Take one down and pass it around, 9 bottles of beer on the wall.\n" +
            "\n" +
            "9 bottles of beer on the wall, 9 bottles of beer.\n" +
            "Take one down and pass it around, 8 bottles of beer on the wall.\n" +
            "\n" +
            "8 bottles of beer on the wall, 8 bottles of beer.\n" +
            "Take one down and pass it around, 7 bottles of beer on the wall.\n" +
            "\n" +
            "7 bottles of beer on the wall, 7 bottles of beer.\n" +
            "Take one down and pass it around, 6 bottles of beer on the wall.\n" +
            "\n" +
            "6 bottles of beer on the wall, 6 bottles of beer.\n" +
            "Take one down and pass it around, 5 bottles of beer on the wall.\n" +
            "\n" +
            "5 bottles of beer on the wall, 5 bottles of beer.\n" +
            "Take one down and pass it around, 4 bottles of beer on the wall.\n" +
            "\n" +
            "4 bottles of beer on the wall, 4 bottles of beer.\n" +
            "Take one down and pass it around, 3 bottles of beer on the wall.\n" +
            "\n" +
            "3 bottles of beer on the wall, 3 bottles of beer.\n" +
            "Take one down and pass it around, 2 bottles of beer on the wall.\n" +
            "\n" +
            "2 bottles of beer on the wall, 2 bottles of beer.\n" +
            "Take one down and pass it around, 1 bottle of beer on the wall.\n" +
            "\n" +
            "1 bottle of beer on the wall, 1 bottle of beer.\n" +
            "Take it down and pass it around, no more bottles of beer on the wall.\n" +
            "\n" +
            "No more bottles of beer on the wall, no more bottles of beer.\n" +
            "Go to the store and buy some more, 99 bottles of beer on the wall.\n" +
            "";
        Assert.Equal(expected, BeerSong.Verses(99, 0));
    }
}


text:
/* globals $ */

/*
Create a function that takes a selector and:
* Finds all elements with class `button` or `content` within the provided element
  * Change the content of all `.button` elements with "hide"
* When a `.button` is clicked:
  * Find the topmost `.content` element, that is before another `.button` and:
    * If the `.content` is visible:
      * Hide the `.content`
      * Change the content of the `.button` to "show"
    * If the `.content` is hidden:
      * Show the `.content`
      * Change the content of the `.button` to "hide"
    * If there isn't a `.content` element **after the clicked `.button`** and **before other `.button`**, do nothing
* Throws if:
  * The provided ID is not a **jQuery object** or a `string`

*/

function solve() {

    //(function ($) {
    //    $.fn.exist = function () {
    //        return $(this).length !== 0;
    //    };

    //    $.fn.changeDisplayMode = function () {
    //        var $this = $(this);

    //        if ($this.is(':visible')) {
    //            $this.hide();
    //        } else {
    //            $this.show();
    //        }

    //        return this;
    //    };

    //    $.fn.changeShowHideState = function () {
    //        var $this = $(this);

    //        $this.each(function () {
    //            var $this = $(this);

    //            if ($this.text() === 'hide') {
    //                $this.text('show');
    //            } else if ($this.text() === 'show') {
    //                $this.text('hide');
    //            } else {
    //                //throw new Error('Element text cannot be changed!');
    //            }
    //        });

    //        return this;
    //    };

    //}(jQuery));

    return function (selector) {
        $.fn.exist = function () {
            return $(this).length !== 0;
        };

        $.fn.changeDisplayMode = function () {
            var $this = $(this);

            //if ($this.is(':visible')) {
            //    //$this.hide();
            //    $this.css('display', 'none');
            //} else {
            //    //$this.show();
            //    $this.css('display', '');
            //}

            if ($this.css('display') == 'none' ) {
                //$this.hide();
                $this.css('display', '');
            } else {
                //$this.show();
                $this.css('display', 'none');
            }

            return this;
        };

        $.fn.changeShowHideState = function () {
            var $this = $(this);

            $this.each(function () {
                var $this = $(this);

                if ($this.text() === 'hide') {
                    $this.text('show');
                } else if ($this.text() === 'show') {
                    $this.text('hide');
                } else {
                    //throw new Error('Element text cannot be changed!');
                }
            });

            return this;
        };

        var $selectedElement,
            $buttonElements;

        if (selector === undefined || (typeof selector !== 'string')) {
            throw new Error('Invalid selector!');
        }

        $selectedElement = $(selector);

        if ($selectedElement.length === 0) {
            throw new Error('No such selector!');
        }

        $buttonElements = $selectedElement.find('.button');
        $buttonElements.text('hide');

        $selectedElement.on('click', '.button', onShowHideElementClick);

        function onShowHideElementClick(ev) {
            var $this = $(this);
            $(this).changeShowHideState();
            $this.prevUntil('.content').filter('.button').changeShowHideState();
            $this.nextUntil('.content').filter('.button').changeShowHideState();
            $this.nextAll('.content:first').changeDisplayMode();
        }
    };
};

module.exports = solve;

redpajama_set_name: RedPajamaGithub


text:
var URLUtils = require('URLUtils');
var ajax = require('ajax');

var getstops = {
  parseStops : function(stops)
  {
    var stopmapping = {};
    var items = [];
    for (var i=0; i<stops.length; i++)
    {
      var stop = stops[i];
      var stopname = stop.stpnm;
      var stopid = stop.stpid;

      stopmapping[stopname] = stopid;

      // console.log('stopname: ' + stopname);

      items.push({
        title:stopname,
      });
    }
    return {items:items, stopmapping:stopmapping};
  },
  get : function(route, direction, onSuccess)
  {

    var params = {
      'rt' : route,
      'dir' : direction
    };

    ajax(
      {
        url: URLUtils.constructURL('getstops', params),
        type: 'json'
      },
      function(data)
      {
        console.log('success!');
        var stops = data['bustime-response'].stops;
        var parseStopsObj = getstops.parseStops(stops);
        var menuItems = parseStopsObj.items;
        var stopmapping = parseStopsObj.stopmapping;

        var info = {
          route: route,
          direction: direction,
          stopmapping: stopmapping
        };

        onSuccess(menuItems, info);
      }
    );
  }
};
this.exports = getstops;


text:
if defined?(ActionMailer)
  # Mailer for email notification of ActivityNotificaion.
  class ActivityNotification::Mailer < ActivityNotification.config.parent_mailer.constantize
    include ActivityNotification::Mailers::Helpers

    # Sends notification email.
    #
    # @param [Notification] notification Notification instance to send email
    # @param [Hash]         options      Options for notification email
    # @option options [String, Symbol] :fallback (:default) Fallback template to use when MissingTemplate is raised
    # @return [Mail::Message|ActionMailer::DeliveryJob] Email message or its delivery job
    def send_notification_email(notification, options = {})
      options[:fallback] ||= :default
      if options[:fallback] == :none
        options.delete(:fallback)
      end
      notification_mail(notification, options)
    end

    # Sends batch notification email.
    #
    # @param [Object]              target        Target of batch notification email
    # @param [Array<Notification>] notifications Target notifications to send batch notification email
    # @param [String]              batch_key     Key of the batch notification email
    # @param [Hash]                options       Options for notification email
    # @option options [String, Symbol] :fallback  (:batch_default) Fallback template to use when MissingTemplate is raised
    # @return [Mail::Message|ActionMailer::DeliveryJob] Email message or its delivery job
    def send_batch_notification_email(target, notifications, batch_key, options = {})
      options[:fallback] ||= :batch_default
      if options[:fallback] == :none
        options.delete(:fallback)
      end
      batch_notification_mail(target, notifications, batch_key, options)
    end

  end
end


text:
<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Distrito_Model extends CI_Model {
    private static $table_menu  = 'distrito';

    public function __construct() {
        parent :: __construct();
        $this->load->database();
    }

    public function index() {
        redirect('');
    }

    public function getDistritoAll($prov_id, $q = ''){
        $where = array('dist_estado'=>DB_ACTIVO, 'prov_id' => $prov_id);
        if($q !== ''){
            $this->db->like('dist_descripcion',$q);
        }
        $query = $this->db->order_by('dist_descripcion', 'asc');
        $query = $this->db->where($where);
        $query = $this->db->get(self::$table_menu);
        if($query->num_rows() > 0){
            return $query->result();
        }
        return null;
    }

    public function getDistritoByID($dist_id){
        $where = array('dist_estado'=>DB_ACTIVO, 'dist_id' => $dist_id);
        $query = $this->db->where($where);
        $query = $this->db->get(self::$table_menu);
        if($query->num_rows() > 0){
            return $query->row();
        }
        return null;
    }

    public function contar_estructuras_todos() {
        $this->db->where('dist_estado', DB_ACTIVO);
        return $this->db->count_all_results(self::$table_menu);
    }

    public function deleteDistritoByID($dist_id){
        $where      = array('dist_id' => $dist_id);
        $data_dist 	= array('dist_estado' => DB_INACTIVO);
        $query      = $this->db->trans_begin();
        $query      = $this->db->where($where)->update(self::$table_menu, $data_dist);
        if ($this->db->trans_status() === FALSE){
            $this->db->trans_rollback();
            return false;
        }
        $this->db->trans_commit();
        return true;
    }

    public function insert($data_dist){
        $query      = $this->db->trans_begin();
        $query      = $this->db->insert(self::$table_menu, $data_dist);
        if ($this->db->trans_status() === FALSE){
            $this->db->trans_rollback();
            return false;
        }
        $dist_id    = $this->db->insert_id();
        $this->db->trans_commit();
        return $dist_id;
    }

    public function update($data_dist, $dist_id){
        $where      = array('dist_id' => $dist_id);
        $query      = $this->db->trans_begin();
        $query      = $this->db->where($where)->update(self::$table_menu, $data_dist);
        if ($this->db->trans_status() === FALSE){
            $this->db->trans_rollback();
            return false;
        }
        $this->db->trans_commit();
        return $dist_id;
    }

}


text:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package rtt_hector_pose_estimation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.2.0 (2015-02-22)
------------------

0.1.5 (2014-10-02)
------------------

0.1.3 (2014-07-09)
------------------
* 0.1.3
* rtt_hector_pose_estimation: added missing rtt_std_msgs dependency
* rtt_hector_pose_estimation: updated CMakeLists.txt for Orocos Toolchain 2.7
* Contributors: Johannes Meyer

0.1.2 (2014-06-02)
------------------

0.1.1 (2014-03-30)
------------------
* added CATKIN_IGNORE marker to prevent rosdep errors on missing dependency rtt_nav_msgs
* hector_pose_estimation/rtt_hector_pose_estimation: removed optional usage of package hector_uav_msgs and created a separate package hector_quadrotor_pose_estimation instead
* added rtt_ros/plugin_depend tags to package.xml and removed rtt stuff from CATKIN_DEPENDS
* Contributors: Johannes Meyer


text:
static int ident=1;

@interface GameBoard ()
{
    NSMutableArray * _data;
    int _rows, _cols;
    BOOL _virtual;           // shortcut
}
@property (retain) NSMutableArray *data;
@property int rows;
@property int cols;
@property BOOL virtual;

-(GameBoard*)doClone:(BOOL)virtual;

@end

@interface GameBoard ()
-(void)privateShowHide:(BOOL)show;
-(id)initWithRows:(int)rows cols:(int)cols size:(CGSize)size origin:(CGPoint)origin
               virtual:(BOOL)virtual;
@end

@implementation GameBoard

+(GameBoard*)buildBoard:(CGSize)size origin:(CGPoint)origin {
    return [[GameBoard alloc] initWithRows:ROWS cols:COLS size:size origin:origin virtual:NO];
}

-(id)initWithRows:(int)rows cols:(int)cols size:(CGSize)size origin:(CGPoint)origin
          virtual:(BOOL)virtual
{
    if (self = [super init])
    {
        self.cols = cols;
        self.rows = rows;
        self.chipSize = size;
        self.origin = origin;

        NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:rows];
        self.data = array;

        for (int i = 0; i < rows; i++)
        {
            NSMutableArray *row = [[NSMutableArray alloc] initWithCapacity:cols];
            for (int j = 0; j < cols; j++){
                [row addObject:[Chip emptyChip:virtual]];
            }
            [array addObject:row];
            row = nil;
        }

        self.data = array;
        array = nil;

        ident = 1; //reset

        self.virtual = NO;

        [self syncBoardCells];
    }
    return self;
}
-(void)takeFrom:(GameBoard*)board
{
    [self clear];
    self.data = board.data;
    board.data = nil;
    [self syncBoardCells];
}
-(BOOL)isVirtual{
    return self.virtual;
}
-(GameBoard*)virtualClone {
    return [self doClone:YES];
}

-(GameBoard*)clone {
    return [self doClone:NO];
}
-(GameBoard*)doClone:(BOOL)virtual
{
    GameBoard *aClone = [[GameBoard alloc] initWithRows:self.rows cols:self.cols
                         size:self.chipSize origin:self.origin virtual:virtual];
    aClone.virtual = virtual;

    for (int i=0;i<ROWS;i++)
    {
        for (int j=0; j<COLS;j++)
        {
            Chip *item = [self getItemAt:i col:j];
            // these assignments shouldn't be needed
            item.row=i;
            item.col=j;
            // shallow, no images or gesture handlers
            [aClone putItemAt:[item clone:virtual] row:i col:j];
        }
    }
    return aClone;
}
+(int)safeIdent {
    return ident++;
}
// does update the chip row/col
-(void)moveItem:(Chip*)chip to:(Chip*)to
{
    BOOL virtual = [self isVirtual];

    Chip *emptyChip = [Chip emptyChip:virtual];
    emptyChip.cellBounds = chip.cellBounds;
    [emptyChip fixViewRect];

    if (!virtual)
    {
#if defined(DEBUG_BLANK_CHIP)
        [chip.imageView.superview addSubview:emptyChip.imageView];
#endif
    }

    [self replaceItem:chip with:emptyChip];

    emptyChip=nil;
    chip.cellBounds = to.cellBounds;

    if (to.imageView && !virtual) {
        chip.imageView.frame = to.imageView.frame;
    }

    [self replaceItem:to with:chip];
    [self syncBoardCells];
}

// brute force - does NOT update the chip row/col!
-(void)replaceItem:(Chip*)oldItem with:(Chip*)newItem
{
    NSMutableArray *aRow = (NSMutableArray *)[self.data objectAtIndex:oldItem.row];
    [aRow replaceObjectAtIndex:oldItem.col withObject:newItem];
}

-(void)syncBoardCells
{
    for (int i=0;i<ROWS;i++)
    {
        for (int j=0; j<COLS;j++)
        {
            Chip *item = [self getItemAt:i col:j];
            item.row=i;
            item.col=j;
        }
    }
}

// do something stupid, crash
-(void)putItemAt:(Chip *)item row:(int)row col:(int)col
{
    NSMutableArray *aRow = (NSMutableArray *)[self.data objectAtIndex:row];
    [aRow replaceObjectAtIndex:col withObject:item];
}

-(Chip *)getItemAt:(int)row col:(int)col
{
    if (row < 0 || row >= ROWS || col < 0 || col >= COLS){
        return nil;
    }
    return [(NSArray *)[self.data objectAtIndex:row] objectAtIndex:col];
}

-(CGPoint)locationFromChip:(Chip*)chip;
{
    for (int i = 0; i < self.rows; i++)
    {
        for (int j = 0; j < self.cols; j++)
        {
            Chip *item = [self getItemAt:i col:j];
            if (item.ident == chip.ident) {
                return CGPointMake(i, j);
            }
        }
    }
    return CGPointMake(-1,-1);
}

// using cell size, find out what rect this intersects and return the item
-(Chip *)getItemByPt:(CGPoint)pt
{
    //normalize as if grid at 0,0 and find hit
    int row = (pt.y-self.origin.y)/self.chipSize.height;
    int col = (pt.x-self.origin.x)/self.chipSize.width;

    if (row < 0 || row >= self.rows){
        return nil;
    }
    if (col < 0 || col >= self.cols){
        return nil;
    }

    return [self getItemAt:row col:col];
}
-(Chip *)getItemByIdent:(int)ident
{
    if (ident != -1)
    {
        if (self.data)
        {
            for (int row=0; row < self.rows; row++)
            {
                for (int col=0; col < self.cols;col++)
                {
                    Chip *chip = (Chip *)[self getItemAt:row col:col];
                    if (chip && chip.ident==ident){
                        return chip;
                    }
                }
            }
        }
    }
    return nil;
}

// 1 chip's bounds in a list
-(NSArray *)getChipOutline:(Chip*)chip {
    return [NSArray arrayWithObject:[NSValue valueWithCGRect:chip.cellBounds]];
}
-(NSArray *)getChipOutlines
{
    NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:self.rows*self.cols];
    if (self.data)
    {
        for (int row=0; row < self.rows; row++)
        {
            for (int col=0; col < self.cols;col++)
            {
                Chip *chip = (Chip *)[self getItemAt:row col:col];
                [array addObject:[NSValue valueWithCGRect:chip.cellBounds]];
            }
        }
    }
    return (NSArray*)array;
}

-(void)privateShowHide:(BOOL)hide
{
    if (self.data)
    {
        for (int i = 0; i < self.rows; i++)
        {
            for (int j = 0; j < self.cols; j++)
            {
                Chip *item = [self getItemAt:i col:j];
                if (item) {
                    [item hideChip:hide];
                }
            }
        }
    }
}
-(void)hide {
    [self privateShowHide:YES];
}
-(void)unHide {
    [self privateShowHide:NO];
}

-(void)clear
{
    if (self.data)
    {
        for (int i = 0; i < self.rows; i++)
        {
            for (int j = 0; j < self.cols; j++)
            {
                Chip *item = [self getItemAt:i col:j];
                if (item) {
                    [item removeFromBoard];
                }
            }
        }

        for (int row=self.rows-1; row > -1; row--)
        {
            NSMutableArray *aRow = (NSMutableArray *)[self.data objectAtIndex:row];
            for (int col=0; col < self.cols;col++) {
                [aRow removeLastObject];
            }
            [self.data removeLastObject];
        }

        self.data = nil;
    }
}

// don't forget to call clear before this
-(void) dealloc {
    [self clear];
}
@end


text:
using UmbracoVault.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;

namespace ReferenceWebsite.Models
{
    [UmbracoEntity(AutoMap=true)]
    public class GenericContent
    {
        public string Content { get; set; }
    }
}


text:
ACCEPTED

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

#### Published in
in Yoshimura & Elix, J. Hattori bot. Lab. 74: 288 (1992)

#### Original name
Anzia minor Yoshim.

### Remarks
null


text:
require 'ostruct'
require 'forwardable'
require 'awesome_print'
require 'fancy-open-struct/version'

class FancyOpenStruct < OpenStruct

  extend Forwardable

  hash_methods = Hash.instance_methods(false) - (Hash.instance_methods(false) & OpenStruct.instance_methods(false)) - [:[], :[]=]
  def_instance_delegators :@table, *hash_methods

  def initialize(hash=nil, args={})
    @recurse_over_arrays = args.fetch(:recurse_over_arrays, false)
    @table = {}
    if hash
      for k, v in hash
        @table[k.to_sym] = v
        new_ostruct_member(k)
      end
    end
    @sub_elements = {}
  end

  def to_h
    @table.dup.update(@sub_elements) do |k, oldval, newval|
      if newval.kind_of?(self.class)
        newval.to_h
      elsif newval.kind_of?(Array)
        newval.map { |a| a.kind_of?(self.class) ? a.to_h : a }
      else
        newval
      end
    end
  end

  alias_method :to_hash, :to_h

  def debug_inspect(options = {})
    # Refer to the "Awesome Print" gem documentation for information about which options are available
    # The awesome_print gem can be found at https://rubygems.org/gems/awesome_print
    ap(@table, options)
  end

  # Hash getter method which translates the key to a Symbol
  def [](key)
    key = key.to_sym unless key.kind_of? Symbol
    @table[key]
  end

  # Hash setter method which translates the key to a Symbol and also creates
  # a getter method (OpenStruct member) for accessing the key/value later via dot syntax
  def []=(key, value)
    key = key.to_sym unless key.kind_of? Symbol
    modifiable[new_ostruct_member(key)] = value
    build_sub_elements_key_cache(key)
  end

  private

  def new_ostruct_member(name)
    name = name.to_sym
    unless self.respond_to?(name)
      define_singleton_method name do
        value = @table[name]
        if value.is_a?(Hash)
          @sub_elements[name] ||= self.class.new(value, :recurse_over_arrays => @recurse_over_arrays)
        elsif value.is_a?(Array) and @recurse_over_arrays
          @sub_elements[name] ||= recurse_over_array value
        else
          value
        end
      end
      define_singleton_method("#{name}=") do |x|
        modifiable[name] = x
        build_sub_elements_key_cache(name)
      end
      define_singleton_method("#{name}_as_a_hash") { @table[name] }
    end
    name
  end

  def build_sub_elements_key_cache(name)
    value = @table[name]
    if value.is_a?(Hash)
      @sub_elements[name] = self.class.new(value, :recurse_over_arrays => @recurse_over_arrays)
    elsif value.is_a?(Array) and @recurse_over_arrays
      @sub_elements[name] = recurse_over_array value
    else
      @sub_elements[name] = value
    end
  end

  def recurse_over_array(array)
    array.map do |a|
      if a.is_a? Hash
        self.class.new(a, :recurse_over_arrays => true)
      elsif a.is_a? Array
        recurse_over_array a
      else
        a
      end
    end
  end

  # Dynamically handle any attempts to get or set values via dot syntax
  # if the OpenStruct member methods haven't already been created
  def method_missing(mid, *args) # :nodoc:
    mname = mid.id2name
    len = args.length
    if mname.chomp!('=')
      raise ArgumentError, "wrong number of arguments (#{len} for 1)", caller(1) if len != 1
      # Set up an instance method to point to the key/value in the table and set the value
      modifiable[new_ostruct_member(mname.to_sym)] = args[0]
      build_sub_elements_key_cache(mname.to_sym)
      @table[mname.to_sym]
    elsif @table.has_key?(mid)
      # The table has apparently been modified externally, so we need to set up
      # an instance method to point to the key/value in the table.
      new_ostruct_member(mname.to_sym)
      build_sub_elements_key_cache(mname.to_sym)
      self.send(mid)
    else
      nil
    end
  end
end


text:
package com.tuenti.smsradar;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;

import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import android.content.Context;
import android.content.SharedPreferences;

/**
 * Test created to check the correctness of SharedPreferencesSmsStorage.
 *
 * @author Pedro Vicente Gómez Sánchez <pgomez@tuenti.com>
 * @author Manuel Peinado <mpeinado@tuenti.com>
 */
@RunWith(RobolectricTestRunner.class)
public class SharedPreferencesSmsStorageTest {

	private static final String SHARED_PREFERENCES_PATH = "path";
	private static final int DEFAULT_VALUE = -1;
	private static final int ANY_SMS_ID = 1;

	private SharedPreferencesSmsStorage smsStorage;
	private SharedPreferences sharedPreferences;

	@Before
	public void setUp() {
		initializeSmsStorage();
	}

	@After
	public void tearDown() {
		sharedPreferences.edit().clear().commit();
	}

	@Test
	public void shouldReturnDefaultValueIfHadNotBeenEditedPreviously() {
		assertEquals(DEFAULT_VALUE, smsStorage.getLastSmsIntercepted());
	}

	@Test
	public void shouldUpdateLastSmsInterceptedId() {
		smsStorage.updateLastSmsIntercepted(ANY_SMS_ID);

		assertEquals(ANY_SMS_ID, smsStorage.getLastSmsIntercepted());
	}

	@Test
	public void shouldReturnTrueIfIsTheFirstSmsIntercepted() {
		assertTrue(smsStorage.isFirstSmsIntercepted());
	}

	private void initializeSmsStorage() {
		sharedPreferences = Robolectric.application.getSharedPreferences(SHARED_PREFERENCES_PATH,
				Context.MODE_PRIVATE);
		smsStorage = new SharedPreferencesSmsStorage(sharedPreferences);
	}

}


text:
package hex.rulefit;

import hex.genmodel.algos.tree.SharedTreeSubgraph;
import hex.tree.SharedTreeModel;
import hex.tree.gbm.GBM;
import hex.tree.gbm.GBMModel;
import hex.tree.isofor.IsolationForest;
import hex.tree.isofor.IsolationForestModel;
import org.junit.BeforeClass;
import org.junit.Test;
import water.Scope;
import water.TestUtil;
import water.fvec.Frame;

import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import static hex.tree.TreeUtils.getResponseLevelIndex;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

public class RuleFitUtilsTest extends TestUtil {

    @BeforeClass public static void setup() { stall_till_cloudsize(1); }

    @Test
    public void testConditionAndRule() {
        try {
            Scope.enter();
            final Frame fr = parseTestFile("./smalldata/gbm_test/titanic.csv");
            Scope.track(fr);

            Condition condition = new Condition(0, Condition.Type.Numerical, Condition.Operator.GreaterThanOrEqual, 2, null, null, "pclass", false );
            final Frame fr2 = RulefitTestUtils.transform(fr, condition);
            Scope.track(fr2);

            assertEquals(1,fr2.numCols());
            assertEquals(fr.numRows(),fr2.numRows());
            assertEquals(0,fr2.vec(0).at8(322));
            assertEquals(1,fr2.vec(0).at8(323));

            Condition condition2 = new Condition(13, Condition.Type.Categorical, Condition.Operator.In, 0, new String[] {fr.vec(13).stringAt(20)/*"New York  NY"*/, fr.vec(13).stringAt(0)/*"St Louis  MO"*/}, new int[] {(int)fr.vec(13).at(20)/*236*/, (int)fr.vec(13).at(0)/*308*/},"home.dest", false);
            final Frame fr3 = RulefitTestUtils.transform(fr, condition2);
            Scope.track(fr3);

            assertEquals(1,fr3.numCols());
            assertEquals(fr.numRows(),fr3.numRows());
            assertEquals(1,fr3.vec(0).at8(0));
            assertEquals(1,fr3.vec(0).at8(5));
            assertEquals(0,fr3.vec(0).at8(4));

            assertFalse(condition.equals(condition2));
            Condition condition3 = new Condition(13, Condition.Type.Categorical, Condition.Operator.In, 0, new String[] {fr.vec(13).stringAt(20)/*"New York  NY"*/, fr.vec(13).stringAt(0)/*"St Louis  MO"*/}, new int[] {(int)fr.vec(13).at(20)/*236*/, (int)fr.vec(13).at(0)/*308*/},"home.dest", false);
            assertTrue(condition2.equals(condition3));

            Rule rule = new Rule(new Condition[]{condition, condition2}, 0.3456, "somevarname");
            final Frame fr4 = RulefitTestUtils.transform(fr, rule);
            Scope.track(fr4);

            assertEquals(fr4.vec(0).at(0), fr2.vec(0).at(0)*fr3.vec(0).at(0), 1e-8);
            assertEquals(fr4.vec(0).at(5), fr2.vec(0).at(5)*fr3.vec(0).at(5),1e-8);
            assertEquals(fr4.vec(0).at(4), fr2.vec(0).at(4)*fr3.vec(0).at(4),1e-8);
            assertEquals(fr4.vec(0).at(322), fr2.vec(0).at(322)*fr3.vec(0).at(322),1e-8);
            assertEquals(fr4.vec(0).at(323), fr2.vec(0).at(323)*fr3.vec(0).at(323),1e-8);

            Rule rule2 = new Rule(new Condition[]{condition, condition3}, 0.3456, "somevarname");
            assertTrue(rule.equals(rule2));
            Rule rule3 = new Rule(new Condition[]{condition, condition3}, 0.3456, "somedifferentvarname");
            assertTrue(rule.equals(rule3));
            Rule rule4 = new Rule(new Condition[]{condition, condition}, 0.3456, "somevarname");
            assertFalse(rule.equals(rule4));
        } finally {
            Scope.exit();
        }
    }

    @Test
    public void extractRulesFromTreeFromModelTestNumerical() {
        try {
            Scope.enter();
            String[] expectedFileNames = new String[2];
            expectedFileNames[0]="Tree1.png";
            expectedFileNames[1]="Tree0.png";
            Frame train = Scope.track(parseTestFile("smalldata/extdata/prostate.csv"));

            GBMModel.GBMParameters p = new GBMModel.GBMParameters();
            p._train = train._key;
            p._response_column = "CAPSULE";
            p._ignored_columns = new String[]{"ID"};
            p._seed = 1;
            p._ntrees = 2;
            p._max_depth = 3;

            final GBMModel gbm = new GBM(p).trainModel().get();
            Scope.track_generic(gbm);

            final SharedTreeModel.SharedTreeOutput sharedTreeOutput = gbm._output;
            final int treeClass = getResponseLevelIndex(null, sharedTreeOutput);
            SharedTreeSubgraph sharedTreeSubgraph = gbm.getSharedTreeSubgraph(0, treeClass);
            Set<Rule> treeRules =  Rule.extractRulesFromTree(sharedTreeSubgraph, 0, null);
            assertEquals(treeRules.size(), 8);

            Condition condition1 = new Condition(6, Condition.Type.Numerical, Condition.Operator.GreaterThanOrEqual, 6.5, null, null,"GLEASON", false);
            Condition condition2 = new Condition(4, Condition.Type.Numerical, Condition.Operator.LessThan, 14.730077743530273, null, null, "PSA", false);
            Condition condition3 = new Condition(2, Condition.Type.Numerical, Condition.Operator.GreaterThanOrEqual, 2.5, null, null,"DPROS", false);
            Condition[] conditions = new Condition[] {condition1, condition2, condition3};

            final Rule rule = new Rule(conditions, 0.032236840575933456, "M0T0N20");
            assertTrue(treeRules.contains(rule));

            condition1 = new Condition(6, Condition.Type.Numerical, Condition.Operator.LessThan, 6.5, null, null,"GLEASON", true);
            condition2 = new Condition(2, Condition.Type.Numerical, Condition.Operator.GreaterThanOrEqual, 2.5, null, null, "DPROS", false);
            condition3 = new Condition(4, Condition.Type.Numerical, Condition.Operator.GreaterThanOrEqual, 6.6455078125, null, null,"PSA", false);
            conditions = new Condition[] {condition1, condition2, condition3};

            final Rule rule2 = new Rule(conditions, 0.012861842289566994, "M0T0N18");
            assertTrue(treeRules.contains(rule2));

            List<Rule> wholeModelRules = Rule.extractRulesListFromModel(gbm, 0, 1);
            assertEquals(wholeModelRules.size(), 16);

        } finally {
            Scope.exit();
        }
    }

    @Test
    public void extractRulesFromTreeFromModelTesCategorical() {
        try {
            Scope.enter();
            Frame train = Scope.track(parseTestFile("smalldata/testng/airlines.csv"));

            IsolationForestModel.IsolationForestParameters p = new IsolationForestModel.IsolationForestParameters();
            p._train = train._key;
            p._seed = 0xFEED;
            p._ntrees = 1;
            p._max_depth = 3;
            p._ignored_columns = new String[] { "Origin", "Dest", "IsDepDelayed" };

            final IsolationForestModel isofor = new IsolationForest(p).trainModel().get();
            Scope.track_generic(isofor);

            final SharedTreeModel.SharedTreeOutput sharedTreeOutput = isofor._output;
            final int treeClass = getResponseLevelIndex(null, sharedTreeOutput);
            SharedTreeSubgraph sharedTreeSubgraph = isofor.getSharedTreeSubgraph(0, treeClass);
            Set<Rule> treeRules =  Rule.extractRulesFromTree(sharedTreeSubgraph, 0, null);
            assertEquals(treeRules.size(), 8);

            List<String> languageRules = treeRules.stream().map(it -> it.generateLanguageRule()).sorted().collect(Collectors.toList());
            // Note: this hard-coded list of expected rules is sensitive to changes in the upstream algo
            List<String> expectedRules = Arrays.asList(
                    "(Distance < 211.5) & (fYear in {f1987, f1988, f1989, f1990, f1991, f1992, f1993} or fYear is NA)",
                    "(Distance < 211.5) & (fYear in {f1994, f1995, f1996, f1997, f1998, f1999, f2000})",
                    "(Distance < 348.5) & (Distance >= 211.5 or Distance is NA) & (fYear in {f1992, f1993, f1994, f1995, f1996, f1997, f1998, f1999, f2000} or fYear is NA)",
                    "(Distance >= 348.5 or Distance is NA) & (fYear in {f1992, f1993, f1994, f1995, f1996, f1997, f1998, f1999, f2000} or fYear is NA)",
                    "(fDayOfWeek in {f1, f2, f3, f4} or fDayOfWeek is NA) & (fYear in {f1989, f1990, f1991, f1992, f1993, f1994, f1995, f1996, f1997, f1998, f1999, f2000})",
                    "(fDayOfWeek in {f5, f6, f7}) & (fYear in {f1989, f1990, f1991, f1992, f1993, f1994, f1995, f1996, f1997, f1998, f1999, f2000})",
                    "(fYear in {f1987})",
                    "(fYear in {f1988})"
            );
            assertEquals(expectedRules, languageRules);

            List<Rule> wholeModelRules = Rule.extractRulesListFromModel(isofor, 0, 1);
            assertEquals(wholeModelRules.size(), 8);

        } finally {
            Scope.exit();
        }
    }

    @Test
    public void deduplicateRulesTest() {
        try {
            Scope.enter();
            double original_r1_coef_value = 4.0;
            double original_r4_coef_value = 3.0;

            Condition conditionr11 = new Condition(6, Condition.Type.Numerical, Condition.Operator.LessThan, 6.5, null, null,"PSA", true);
            Condition conditionr12 = new Condition(6, Condition.Type.Numerical, Condition.Operator.LessThan, 14.730077743530273, null, null, "PSA", false);
            Condition conditionr13 = new Condition(2, Condition.Type.Numerical, Condition.Operator.GreaterThanOrEqual, 2.5, null, null,"DPROS", false);
            Condition[] conditions1 = new Condition[] {conditionr11, conditionr12, conditionr13};

            Rule rule1 = new Rule(conditions1, 0.032236840575933456, "somevarname1");
            rule1.coefficient = original_r1_coef_value;

            Condition conditionr21 = new Condition(6, Condition.Type.Categorical, Condition.Operator.In, -1, new String[] {"ABC", "AAA"}, new int[] {2, 6},"PSA", true);
            Condition conditionr22 = new Condition(6, Condition.Type.Categorical, Condition.Operator.In, -1,  new String[] { "CCC", "BBB", "AAA"}, new int[] {1, 3, 6}, "PSA", false);
            Condition conditionr23 = new Condition(2, Condition.Type.Numerical, Condition.Operator.GreaterThanOrEqual, 2.5, null, null,"DPROS", false);
            Condition[] conditions2 = new Condition[] {conditionr21, conditionr22, conditionr23};

            Rule rule2 = new Rule(conditions2, 0.032236840575933456, "somevarname2");

            Condition condition31 = new Condition(6, Condition.Type.Numerical, Condition.Operator.GreaterThanOrEqual, 6.5, null, null,"PSA", true);
            Condition condition32 = new Condition(6, Condition.Type.Numerical, Condition.Operator.GreaterThanOrEqual, 14.730077743530273, null, null, "PSA", false);
            Condition condition33 = new Condition(2, Condition.Type.Numerical, Condition.Operator.LessThan, 2.5, null, null,"DPROS", false);
            Condition[] conditions3 = new Condition[] {condition31, condition32, condition33};

            Rule rule3 = new Rule(conditions3, 0.032236840575933456, "somevarname3");

            Condition conditionr41 = new Condition(6, Condition.Type.Numerical, Condition.Operator.LessThan, 6.5, null, null,"PSA", true);
            Condition conditionr42 = new Condition(6, Condition.Type.Numerical, Condition.Operator.LessThan, 14.730077743530273, null, null, "PSA", false);
            Condition conditionr43 = new Condition(2, Condition.Type.Numerical, Condition.Operator.GreaterThanOrEqual, 2.5, null, null,"DPROS", false);
            Condition[] conditions4 = new Condition[] {conditionr41, conditionr42, conditionr43};

            Rule rule4 = new Rule(conditions4, 10.23, "somevarname4");
            rule4.coefficient = original_r4_coef_value;

            Rule[] rulesToDeduplicate = new Rule[] {rule1, rule2, rule3, rule4};

            Rule[] deduplicatedRules = RuleFitUtils.deduplicateRules(rulesToDeduplicate, true);

            assertEquals(3, deduplicatedRules.length);

            Rule deduplicatedRule = Arrays.asList(deduplicatedRules).stream()
                    .filter(rule -> rule.coefficient != 0.0)
                    .findAny()
                    .orElse(null);

            assertEquals(deduplicatedRule.coefficient, original_r1_coef_value + original_r4_coef_value, 0.0);
            assertEquals("somevarname1, somevarname4", deduplicatedRule.varName);

        } finally {
            Scope.exit();
        }
    }

    @Test
    public void testReadRuleId() {
        String ruleId = "M1T10N8";
        assertEquals(RuleFitUtils.readRuleId(ruleId), ruleId);

        ruleId = "M1T10N8, M1T29N8";
        assertEquals(RuleFitUtils.readRuleId(ruleId), "M1T10N8");

        ruleId = "M3T15N9_0, M5T15N14_0, M4T15N11_0, M8T15N19_0";
        assertEquals(RuleFitUtils.readRuleId(ruleId), "M3T15N9_0");

        ruleId = "M6T10N36_0";
        assertEquals(RuleFitUtils.readRuleId(ruleId), "M6T10N36_0");
    }

}


text:
/* ###
 * IP: GHIDRA
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ghidra.feature.vt.gui.provider.impliedmatches;

import ghidra.feature.vt.api.main.*;
import ghidra.feature.vt.gui.plugin.VTController;
import ghidra.feature.vt.gui.plugin.VTControllerListener;
import ghidra.feature.vt.gui.util.MatchInfo;
import ghidra.framework.model.DomainObjectChangedEvent;
import ghidra.framework.options.Options;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitorAdapter;

import java.util.Collection;
import java.util.List;

public class MatchStatusUpdaterAssociationHook implements AssociationHook, VTControllerListener {

	private VTController controller;
	private VTSession session;

	public MatchStatusUpdaterAssociationHook(VTController controller) {
		this.controller = controller;
		setSession(controller.getSession());
		controller.addListener(this);
	}

	@Override
	public void associationAccepted(VTAssociation association) {
		updateMarkupStatus(association);
	}

	@Override
	public void associationCleared(VTAssociation association) {
		association.setMarkupStatus(new VTAssociationMarkupStatus());
	}

	@Override
	public void markupItemStatusChanged(VTMarkupItem markupItem) {
		controller.markupItemStatusChanged(markupItem);
		updateMarkupStatus(markupItem.getAssociation());
	}

	public void sessionChanged(VTSession newSession) {
		setSession(newSession);
	}

	private void setSession(VTSession session) {
		if (this.session != null) {
			this.session.removeAssociationHook(this);
		}
		this.session = session;
		if (this.session != null) {
			this.session.addAssociationHook(this);
		}
	}

	private void updateMarkupStatus(VTAssociation association) {
		List<VTMatch> matches = association.getSession().getMatches(association);
		if (matches.isEmpty()) {
			return;
		}

		// changed getting markup items from a matchInfo to using the association directly.
		// The matchInfo way sets the destination addresses which is expensive.  Going directly to
		// the association should be quicker. The only thing we care about concerning the markup
		// items is their status, therefor it doesn't matter that the destination address may not be
		// set, which is required to apply them.

//		MatchInfo matchInfo = controller.getMatchInfo(matches.get(0));
//		Collection<VTMarkupItem> markupItems =
//			matchInfo.getAppliableMarkupItems(TaskMonitorAdapter.DUMMY_MONITOR);

		Collection<VTMarkupItem> markupItems;
		try {
			markupItems =
				matches.get(0).getAssociation().getMarkupItems(TaskMonitorAdapter.DUMMY_MONITOR);
			VTAssociationMarkupStatus markupItemsStatus = getAppliedMarkupStatus(markupItems);
			association.setMarkupStatus(markupItemsStatus);
		}
		catch (CancelledException e) {
			// can't happen since we used a Dummy monitor
		}

	}

	private VTAssociationMarkupStatus getAppliedMarkupStatus(Collection<VTMarkupItem> markupItems) {
		int appliedCount = 0;
		int rejectedCount = 0;
		int unappliedCount = 0;
		int dontKnowCount = 0;
		int dontCareCount = 0;
		int errorCount = 0;
		if (markupItems != null) {
			for (VTMarkupItem markupItem : markupItems) {
				VTMarkupItemStatus status = markupItem.getStatus();
				switch (status) {
					case ADDED:
					case REPLACED:
						appliedCount++;
						break;
					case FAILED_APPLY:
						errorCount++;
						break;
					case DONT_KNOW:
						dontKnowCount++;
						break;
					case REJECTED:
						rejectedCount++;
						break;
					case UNAPPLIED:
						unappliedCount++;
						break;
					case DONT_CARE:
						dontCareCount++;
						break;
					case SAME:
						break;
					case CONFLICT:
						break;
				}
			}
		}
		return new VTAssociationMarkupStatus(unappliedCount > 0, appliedCount > 0,
			rejectedCount > 0, dontCareCount > 0, dontKnowCount > 0, errorCount > 0);
	}

	@Override
	public void disposed() {
		// don't care
	}

	@Override
	public void markupItemSelected(VTMarkupItem markupItem) {
		// don't care
	}

	@Override
	public void matchSelected(MatchInfo matchInfo) {
		// don't care
	}

	@Override
	public void optionsChanged(Options options) {
		// don't care
	}

	@Override
	public void sessionUpdated(DomainObjectChangedEvent ev) {
		// don't care
	}
}


text:
'use strict';

const models = require('../models');
const Setting = models.Setting;
const errors = require('./util').errors;
const notify = require('../lib/notify');
const accessLib = require('../lib/access');

function mapSettingsList(settings) {
  var ret = {};

  for (var i = 0; i < settings.length; i++) {
    ret[settings[i].key] = {
      key: settings[i].key,
      description: settings[i].description,
      value: settings[i].value,
      valueType: settings[i].valueType
    };
  }

  return ret;
}

exports.get = function(req, res, next) {
  Setting.findAll()
    .then(mapSettingsList)
    .then((results) => {
      res.status(200).json(results);
    })
    .catch((err) => {
      next(err);
    });
};

exports.set = function(req, res, next) {
  const fromUser = accessLib.getRequestUser(req);
  if (!req.body.settings || typeof(req.body.settings) !== 'object') {
    return next(
      errors.extraValidationProblem('settings', req.body.settings,
        'must be a key value map.'));
  }
  Setting.setSettings(req.body.settings)
    .then(mapSettingsList)
    .then((results) => {
      // Do not wait for email sent.
      res.status(200).json(results);

      notify.sendAdminNotification('settings-updated', {
        setBy: fromUser,
        results: results
      });
    })
    .catch((err) => {
      next(err);
    });
};


text:
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():

    return dict(initial_formation="template5", checking_point=1, faild_point=100000, path_list=[
		[TestAction.create_mini_vm, 'vm1', 'data_volume=true', 'cluster=cluster2'],
		[TestAction.create_mini_vm, 'vm2', 'cluster=cluster1'],
		[TestAction.create_vm_backup, 'vm2', 'vm2-backup1'],
		[TestAction.create_mini_vm, 'vm3', 'cluster=cluster2', 'flag=thin'],
		[TestAction.migrate_vm, 'vm2'],
		[TestAction.poweroff_only, 'cluster=cluster2'],
		[TestAction.create_volume, 'volume2', 'cluster=cluster2', 'flag=scsi'],
		[TestAction.attach_volume, 'vm3', 'volume2'],
		[TestAction.delete_volume, 'volume2'],
		[TestAction.add_image, 'image1', 'root', 'http://172.20.1.28/mirror/diskimages/centos_vdbench.qcow2'],
		[TestAction.delete_vm_backup, 'vm2-backup1'],
		[TestAction.delete_image, 'image1'],
		[TestAction.expunge_image, 'image1'],
		[TestAction.create_volume, 'volume3', 'cluster=cluster2', 'flag=scsi'],
		[TestAction.attach_volume, 'vm3', 'volume3'],
		[TestAction.start_vm, 'vm3'],
		[TestAction.create_volume_backup, 'volume3', 'volume3-backup2'],
		[TestAction.stop_vm, 'vm3'],
		[TestAction.destroy_vm, 'vm1'],
		[TestAction.poweroff_only, 'cluster=cluster1'],
		[TestAction.resize_volume, 'vm3', 5*1024*1024],
		[TestAction.detach_volume, 'volume3'],
		[TestAction.create_volume, 'volume4', 'cluster=cluster1', 'flag=thin,scsi'],
		[TestAction.start_vm, 'vm2'],
		[TestAction.create_vm_backup, 'vm2', 'vm2-backup3'],
		[TestAction.stop_vm, 'vm2'],
		[TestAction.use_vm_backup, 'vm2-backup3'],
		[TestAction.create_mini_vm, 'vm4', 'network=random', 'cluster=cluster1'],
		[TestAction.expunge_volume, 'volume2'],
		[TestAction.destroy_vm, 'vm3'],
		[TestAction.create_mini_vm, 'vm5', 'cluster=cluster2'],
		[TestAction.attach_volume, 'vm5', 'volume3'],
		[TestAction.create_volume_backup, 'volume3', 'volume3-backup4'],
		[TestAction.resize_volume, 'vm5', 5*1024*1024],
		[TestAction.poweroff_only, 'cluster=cluster2'],
		[TestAction.use_vm_backup, 'vm2-backup3'],
])

'''
The final status:
Running:['vm4']
Stopped:['vm2', 'vm5']
Enadbled:['volume3-backup2', 'vm2-backup3', 'volume3-backup4']
attached:['volume3']
Detached:['auto-volume1', 'volume4']
Deleted:['vm1', 'vm3', 'vm2-backup1']
Expunged:['volume2', 'image1']
Ha:[]
Group:
	vm_backup1:['vm2-backup3']---vm2@
'''


text:
package org.mvnsearch.totp;

import org.junit.Assert;
import org.junit.Test;

/**
 * totp test
 *
 * @author linux_china
 */
public class TOTPTest {
    String randomCode = "1234567";

    @Test
    public void testGenerateUrl() throws Exception {
        System.out.println(TOTP.getAuthUrl("libing.chen@gmail.com", "mvnsearch", randomCode));
    }

    @Test
    public void testCheckCode() throws Exception {
        Assert.assertTrue(TOTP.checkCode(randomCode, 672468));
    }
}


text:
package org.dynmap.bukkitbridge;

import java.util.logging.Logger;

import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.dynmap.DynmapAPI;
import org.dynmap.DynmapCommonAPI;
import org.dynmap.DynmapCommonAPIListener;
import org.dynmap.DynmapWebChatEvent;
import org.dynmap.bukkitbridge.permissions.BukkitPermissions;
import org.dynmap.bukkitbridge.permissions.GroupManagerPermissions;
import org.dynmap.bukkitbridge.permissions.PEXPermissions;
import org.dynmap.markers.MarkerAPI;
import org.dynmap.permissions.PermissionsHandler;

public class DynmapCBBridgePlugin extends JavaPlugin implements DynmapAPI {
    public static Logger log;
    private DynmapCommonAPI commonapi;
    private boolean disableChatHandling = false;
    private boolean wasDisabled = false;
    private class OurAPIListener extends DynmapCommonAPIListener {
        @Override
        public void apiEnabled(DynmapCommonAPI api) {
            commonapi = api;
            PermissionsHandler ph = PEXPermissions.create();
            if (ph == null)
                ph = GroupManagerPermissions.create();
            if (ph == null)
                ph = BukkitPermissions.create();
            PermissionsHandler.setHandler(ph);
            wasDisabled = commonapi.setDisableChatToWebProcessing(true);
        }
        @Override
        public void apiDisabled(DynmapCommonAPI api) {
            commonapi = null;
        }
        @Override
        public boolean webChatEvent(String src, String name, String msg) {
            DynmapWebChatEvent evt = new DynmapWebChatEvent(src, name, msg);
            getServer().getPluginManager().callEvent(evt);
            return ((evt.isCancelled() == false) && (evt.isProcessed() == false));
        }
    }
    private OurAPIListener apilisten = new OurAPIListener();

    @Override
    public void onLoad() {
        log = this.getLogger();
    }

    @Override
    public void onDisable() {
        if ((commonapi != null) && (!wasDisabled)) {
            commonapi.setDisableChatToWebProcessing(false);
        }
    }

    @Override
    public void onEnable() {
        log.info("Dynmap CraftBukkit-to_Forge Bridge, version " + this.getDescription().getVersion());
        DynmapCommonAPIListener.register(apilisten);

        this.getServer().getPluginManager().registerEvents(new Listener() {
            @EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
            public void onPlayerChat(AsyncPlayerChatEvent evt) {
                final Player p = evt.getPlayer();
                final String msg = evt.getMessage();
                getServer().getScheduler().scheduleSyncDelayedTask(DynmapCBBridgePlugin.this, new Runnable() {
                    public void run() {
                        if ((commonapi != null) && (!disableChatHandling)) {
                            commonapi.postPlayerMessageToWeb(p.getName(), p.getDisplayName(), msg);
                        }
                    }
                });
            }
            @EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
            public void onPlayerJoin(PlayerJoinEvent evt) {
                final Player p = evt.getPlayer();
                // Give other handlers a change to prep player (nicknames and such from Essentials)
                getServer().getScheduler().scheduleSyncDelayedTask(DynmapCBBridgePlugin.this, new Runnable() {
                    @Override
                    public void run() {
                        if ((commonapi != null) && (!disableChatHandling)) {
                            commonapi.postPlayerJoinQuitToWeb(p.getName(), p.getDisplayName(), true);
                        }
                    }
                }, 2);
            }
            @EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
            public void onPlayerQuit(PlayerQuitEvent evt) {
                Player p = evt.getPlayer();
                if ((commonapi != null) && (!disableChatHandling)) {
                    commonapi.postPlayerJoinQuitToWeb(p.getName(), p.getDisplayName(), false);
                }
            }
            @EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled=true)
            public void onSignChange(SignChangeEvent evt) {
                if (commonapi != null) {
                    Block b = evt.getBlock();
                    Location l = b.getLocation();
                    String[] lines = evt.getLines();    /* Note: changes to this change event - intentional */
                    Player p = evt.getPlayer();
                    String pid = null;
                    if (p != null) pid = p.getName();
                    commonapi.processSignChange(b.getType().name(), l.getWorld().getName(), l.getBlockX(), l.getBlockY(), l.getBlockZ(), lines, pid);
                }
            }
         }, this);

        log.info("DynmapCBBridge enabled");
    }

    @Override
    public MarkerAPI getMarkerAPI() {
        if (commonapi == null)
            return null;
        else
            return commonapi.getMarkerAPI();
    }

    @Override
    public boolean markerAPIInitialized() {
        if (commonapi == null)
            return false;
        else
            return commonapi.markerAPIInitialized();
    }

    @Override
    public boolean sendBroadcastToWeb(String sender, String msg) {
        if (commonapi == null)
            return false;
        else
            return commonapi.sendBroadcastToWeb(sender, msg);
    }

    @Override
    public int triggerRenderOfVolume(String wid, int minx, int miny, int minz,
            int maxx, int maxy, int maxz) {
        if (commonapi == null)
            return 0;
        else
            return commonapi.triggerRenderOfVolume(wid, minx, miny, minz, maxx, maxy, maxz);
    }

    @Override
    public int triggerRenderOfBlock(String wid, int x, int y, int z) {
        if (commonapi == null)
            return 0;
        else
            return commonapi.triggerRenderOfBlock(wid, x, y, z);
    }

    @Override
    public void setPauseFullRadiusRenders(boolean dopause) {
        if (commonapi == null)
            return;
        else
            commonapi.setPauseFullRadiusRenders(dopause);
    }

    @Override
    public boolean getPauseFullRadiusRenders() {
        if (commonapi == null)
            return false;
        else
            return commonapi.getPauseFullRadiusRenders();
    }

    @Override
    public void setPauseUpdateRenders(boolean dopause) {
        if (commonapi == null)
            return;
        else
            commonapi.setPauseUpdateRenders(dopause);
    }

    @Override
    public boolean getPauseUpdateRenders() {
        if (commonapi == null)
            return false;
        else
            return commonapi.getPauseUpdateRenders();
    }

    @Override
    public void setPlayerVisiblity(String player, boolean is_visible) {
        if (commonapi == null)
            return;
        else
            commonapi.setPlayerVisiblity(player, is_visible);
    }

    @Override
    public boolean getPlayerVisbility(String player) {
        if (commonapi == null)
            return false;
        else
            return commonapi.getPlayerVisbility(player);
    }

    @Override
    public void assertPlayerInvisibility(String player, boolean is_invisible,
            String plugin_id) {
        if (commonapi == null)
            return;
        else
            commonapi.assertPlayerInvisibility(player, is_invisible, plugin_id);
    }

    @Override
    public void assertPlayerVisibility(String player, boolean is_visible,
            String plugin_id) {
        if (commonapi == null)
            return;
        else
            commonapi.assertPlayerVisibility(player, is_visible, plugin_id);
    }

    @Override
    public void postPlayerMessageToWeb(String playerid, String playerdisplay,
            String message) {
        if (commonapi == null)
            return;
        else
            commonapi.postPlayerMessageToWeb(playerid, playerdisplay, message);
    }

    @Override
    public void postPlayerJoinQuitToWeb(String playerid, String playerdisplay,
            boolean isjoin) {
        if (commonapi == null)
            return;
        else
            commonapi.postPlayerJoinQuitToWeb(playerid, playerdisplay, isjoin);
    }

    @Override
    public String getDynmapCoreVersion() {
        if (commonapi == null)
            return "?";
        else
            return commonapi.getDynmapCoreVersion();
    }

    @Override
    public boolean setDisableChatToWebProcessing(boolean disable) {
        boolean prev = disableChatHandling;
        disableChatHandling = disable;
        return prev;
    }

    @Override
    public boolean testIfPlayerVisibleToPlayer(String player,
            String player_to_see) {
        if (commonapi == null)
            return false;
        else
            return commonapi.testIfPlayerVisibleToPlayer(player, player_to_see);
    }

    @Override
    public boolean testIfPlayerInfoProtected() {
        if (commonapi == null)
            return false;
        else
            return commonapi.testIfPlayerInfoProtected();
    }

    @Override
    public int triggerRenderOfVolume(Location l0, Location l1) {
        if(commonapi == null) return 0;
        int x0 = l0.getBlockX(), y0 = l0.getBlockY(), z0 = l0.getBlockZ();
        int x1 = l1.getBlockX(), y1 = l1.getBlockY(), z1 = l1.getBlockZ();

        return commonapi.triggerRenderOfVolume(l0.getWorld().getName(), Math.min(x0, x1), Math.min(y0, y1),
                Math.min(z0, z1), Math.max(x0, x1), Math.max(y0, y1), Math.max(z0, z1));
    }

    @Override
    public void setPlayerVisiblity(Player player, boolean is_visible) {
        if(commonapi == null) return;
        commonapi.setPlayerVisiblity(player.getName(), is_visible);
    }

    @Override
    public boolean getPlayerVisbility(Player player) {
        if(commonapi == null) return false;
        return commonapi.getPlayerVisbility(player.getName());
    }

    @Override
    public void postPlayerMessageToWeb(Player player, String message) {
        if(commonapi == null) return;
        commonapi.postPlayerMessageToWeb(player.getName(), player.getDisplayName(), message);
    }

    @Override
    public void postPlayerJoinQuitToWeb(Player player, boolean isjoin) {
        if(commonapi == null) return;
        commonapi.postPlayerJoinQuitToWeb(player.getName(), player.getDisplayName(), isjoin);
    }

    @Override
    public String getDynmapVersion() {
        if(commonapi == null) return "?";
        return commonapi.getDynmapCoreVersion();
    }

    @Override
    public void assertPlayerInvisibility(Player player, boolean is_invisible,
            Plugin plugin) {
        if(commonapi == null) return;
        commonapi.assertPlayerInvisibility(player.getName(), is_invisible, plugin.getDescription().getName());
    }

    @Override
    public void assertPlayerVisibility(Player player, boolean is_visible,
            Plugin plugin) {
        if(commonapi == null) return;
        commonapi.assertPlayerVisibility(player.getName(), is_visible, plugin.getDescription().getName());
    }

	@Override
    public void processSignChange(String material, String world, int x, int y, int z, String[] lines, String playerid) {
        if(commonapi == null) return;
        commonapi.processSignChange(material, world, x, y, z, lines, playerid);
	}

}


text:
/**
 * Created by ismailsunni on 4/9/15.
 */
// Variables
var map;

function show_map(context) {
    'use strict';
    $('#navigationbar').css('height', window.innerHeight * 0.1);
    $('#map').css('height', window.innerHeight * 0.9);
    if ('bounds' in context){
        if (map){
            map.fitBounds(context['bounds']);
        }else{
            map = L.map('map').fitBounds(context['bounds']);
        }
    }else if(('lat' in context) && ('lng' in context)){
        if (map){
            map.setView([context['lat'], context['lng']], 11);
        }else{
            map = L.map('map').setView([context['lat'], context['lng']], 11);
        }
    }
    else{
        if (map){
            map.setView([33.3, 44.3], 6);
        }else{
            map = L.map('map').setView([33.3, 44.3], 6);
        }
    }
    L.tileLayer('http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg', {
        attribution: 'Tiles by MapQuest — Map data © OpenStreetMap contributors, CC-BY-SA',
        subdomains: '1234'
    }).addTo(map);

}

function set_offset() {
    'use strict';
    var navbar, navbar_height, map, content, map_offset, content_offset;
    navbar = $('.navbar');
    navbar_height = navbar.height();
    map = $('#map');
    content = $('#content');

    if (map.length) {
        map_offset = map.offset();
        map.offset({top: navbar_height, left: map_offset.left});
    }
    if (content.length) {
        content_offset = content.offset();
        content.offset({top: navbar_height, left: content_offset.left});
    }
}

function toggle_side_panel() {
    'use strict';
    var map_div = $('#map'),
        side_panel = $('#side_panel'),
        show_hide_div = $('#show_hide');
    /* hide */
    if (side_panel.is(":visible")) {
        show_hide_div.removeClass('glyphicon-chevron-right');
        show_hide_div.addClass('glyphicon-chevron-left');
        side_panel.removeClass('col-lg-4');
        side_panel.hide();
        map_div.removeClass('col-lg-8');
        map_div.addClass('col-lg-12');
        map.invalidateSize();
    } else { /* show */
        show_hide_div.addClass('glyphicon-chevron-right');
        show_hide_div.removeClass('glyphicon-chevron-left');
        side_panel.addClass('col-lg-4');
        side_panel.show();
        map_div.removeClass('col-lg-12');
        map_div.addClass('col-lg-8');
        map.invalidateSize();
    }
}

function getCookie(name) {
    var cookieValue = null;
    if (document.cookie && document.cookie != '') {
        var cookies = document.cookie.split(';');
        for (var i = 0; i < cookies.length; i++) {
            var cookie = jQuery.trim(cookies[i]);
            // Does this cookie string begin with the name we want?
            if (cookie.substring(0, name.length + 1) == (name + '=')) {
                cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                break;
            }
        }
    }
    return cookieValue;
}

function wrap_number(number, min_value, max_value){
    var delta = max_value - min_value;
    if (number == max_value){
        return max_value;
    }else{
        return ((number - min_value) % delta + delta) % delta + min_value;
    }

}


text:
<?php

namespace Symfony\Component\Cache\Tests\Adapter;

use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\Adapter\PhpFilesAdapter;

/**
 * @group time-sensitive
 */
class PhpFilesAdapterTest extends AdapterTestCase
{
    protected $skippedTests = [
        'testDefaultLifeTime' => 'PhpFilesAdapter does not allow configuring a default lifetime.',
    ];

    public function createCachePool()
    {
        return new PhpFilesAdapter('sf-cache');
    }

    public static function tearDownAfterClass()
    {
        FilesystemAdapterTest::rmdir(sys_get_temp_dir().'/symfony-cache');
    }

    protected function isPruned(CacheItemPoolInterface $cache, $name)
    {
        $getFileMethod = (new \ReflectionObject($cache))->getMethod('getFile');
        $getFileMethod->setAccessible(true);

        return !file_exists($getFileMethod->invoke($cache, $name));
    }
}


text:
if(manifest && manifest.permissions && manifest.permissions.indexOf('tabs') != -1) {

  OEX.tabGroups = OEX.tabGroups || OEX.bgProcess.opera.extension.tabGroups;

}


text:
r"""
This code was generated by
\ / _    _  _|   _  _
 | (_)\/(_)(_|\/| |(/_  v1.0.0
      /       /
"""

from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response

class SessionTestCase(IntegrationTestCase):

    def test_fetch_request(self):
        self.holodeck.mock(Response(500, ''))

        with self.assertRaises(TwilioException):
            self.client.messaging.v1.sessions(sid="CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()

        self.holodeck.assert_has_request(Request(
            'get',
            'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
        ))

    def test_fetch_response(self):
        self.holodeck.mock(Response(
            200,
            '''
            {
                "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "messaging_service_sid": "MG80af39294fe338b3848294685d097e04",
                "friendly_name": "friendly_name",
                "attributes": "{ \\"foo\\": \\"bar\\" }",
                "date_created": "2015-12-16T22:18:37Z",
                "date_updated": "2015-12-16T22:18:38Z",
                "created_by": "creator",
                "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "links": {
                    "participants": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
                    "messages": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages",
                    "webhooks": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks"
                }
            }
            '''
        ))

        actual = self.client.messaging.v1.sessions(sid="CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()

        self.assertIsNotNone(actual)

    def test_delete_request(self):
        self.holodeck.mock(Response(500, ''))

        with self.assertRaises(TwilioException):
            self.client.messaging.v1.sessions(sid="CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete()

        self.holodeck.assert_has_request(Request(
            'delete',
            'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
        ))

    def test_delete_response(self):
        self.holodeck.mock(Response(
            204,
            None,
        ))

        actual = self.client.messaging.v1.sessions(sid="CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete()

        self.assertTrue(actual)

    def test_create_request(self):
        self.holodeck.mock(Response(500, ''))

        with self.assertRaises(TwilioException):
            self.client.messaging.v1.sessions.create(messaging_service_sid="messaging_service_sid")

        values = {'MessagingServiceSid': "messaging_service_sid", }

        self.holodeck.assert_has_request(Request(
            'post',
            'https://messaging.twilio.com/v1/Sessions',
            data=values,
        ))

    def test_create_response(self):
        self.holodeck.mock(Response(
            201,
            '''
            {
                "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "messaging_service_sid": "MG80af39294fe338b3848294685d097e04",
                "friendly_name": "friendly_name",
                "attributes": "{ \\"foo\\": \\"bar\\" }",
                "date_created": "2015-12-16T22:18:37Z",
                "date_updated": "2015-12-16T22:18:38Z",
                "created_by": "creator",
                "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "links": {
                    "participants": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
                    "messages": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages",
                    "webhooks": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks"
                }
            }
            '''
        ))

        actual = self.client.messaging.v1.sessions.create(messaging_service_sid="messaging_service_sid")

        self.assertIsNotNone(actual)

    def test_update_request(self):
        self.holodeck.mock(Response(500, ''))

        with self.assertRaises(TwilioException):
            self.client.messaging.v1.sessions(sid="CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update()

        self.holodeck.assert_has_request(Request(
            'post',
            'https://messaging.twilio.com/v1/Sessions/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
        ))

    def test_update_response(self):
        self.holodeck.mock(Response(
            200,
            '''
            {
                "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "messaging_service_sid": "MG80af39294fe338b3848294685d097e04",
                "friendly_name": "friendly_name",
                "attributes": "{ \\"foo\\": \\"bar\\" }",
                "date_created": "2015-12-16T22:18:37Z",
                "date_updated": "2015-12-16T22:18:38Z",
                "created_by": "creator",
                "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "links": {
                    "participants": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
                    "messages": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages",
                    "webhooks": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks"
                }
            }
            '''
        ))

        actual = self.client.messaging.v1.sessions(sid="CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").update()

        self.assertIsNotNone(actual)

    def test_list_request(self):
        self.holodeck.mock(Response(500, ''))

        with self.assertRaises(TwilioException):
            self.client.messaging.v1.sessions.list()

        self.holodeck.assert_has_request(Request(
            'get',
            'https://messaging.twilio.com/v1/Sessions',
        ))

    def test_read_full_response(self):
        self.holodeck.mock(Response(
            200,
            '''
            {
                "sessions": [
                    {
                        "sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "messaging_service_sid": "MG80af39294fe338b3848294685d097e04",
                        "friendly_name": "friendly_name",
                        "attributes": "{ \\"foo\\": \\"bar\\" }",
                        "date_created": "2015-12-16T22:18:37Z",
                        "date_updated": "2015-12-16T22:18:38Z",
                        "created_by": "creator",
                        "url": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "links": {
                            "participants": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
                            "messages": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages",
                            "webhooks": "https://messaging.twilio.com/v1/Sessions/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Webhooks"
                        }
                    }
                ],
                "meta": {
                    "page": 0,
                    "page_size": 50,
                    "first_page_url": "https://messaging.twilio.com/v1/Sessions?PageSize=50&Page=0",
                    "previous_page_url": null,
                    "url": "https://messaging.twilio.com/v1/Sessions?PageSize=50&Page=0",
                    "next_page_url": null,
                    "key": "sessions"
                }
            }
            '''
        ))

        actual = self.client.messaging.v1.sessions.list()

        self.assertIsNotNone(actual)


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

namespace Plainion.Wiki.Auditing
{
    public interface IAuditingLog
    {
        IEnumerable<IAuditingAction> Actions { get; }

        void Log( IAuditingAction action );
    }
}


text:
namespace _1.Logger.Models
{
    using System;
    using Interfaces;

    public class ConsoleAppender : Appender
    {
        public ConsoleAppender(ILayout layout) : base(layout)
        {
        }

        public override void Append(string datetime, string reportLevel, string message)
        {
            if (this.IsMessageValidLevel(reportLevel))
            {
                Console.WriteLine(this.Layout.FormatReport(datetime, reportLevel, message));
                this.MessagesCount++;
            }
        }
    }
}