text:
/**
 * Extension to the standard dropdown/select and checkbox component. It enables hidding/unhidding of multiple dialog fields
 * and dialog tabs based on the selection made in the dropdown/select or on checkbox check or their combination.
 *
 * How to use:
 * - add the empty property acs-cq-dialog-dropdown-checkbox-showhide to the dropdown/select or checkbox element
 * - add the data attribute acs-cq-dialog-dropdown-checkbox-showhide-target to the dropdown/select or checkbox element,
 *   value should be the selector, usually a specific class name, to find all possible target elements that can be shown/hidden.
 * - add the target class to each target component that can be shown/hidden
 * - add the class hide to each target component to make them initially hidden
 * - add the attribute acs-dropdownshowhidetargetvalue to the target component, the value should equal the value of the select
 *   option that will unhide this element. Multiple values can be provided separated with spaces.
 * - add the attribute acs-checkboxshowhidetargetvalue to the target component, the value should equal to:
 *   'true', if the field is to be displayed when Checkbox is selected.
 *   'false', if the field is to be displayed when Checkbox is unselected.
 * - add both acs-dropdownshowhidetargetvalue and acs-checkboxshowhidetargetvalue attribute to each target component, which should be
 *   unhidden based on combination of dropdown and checkbox value.
 * - the acs-dropdownshowhidetargetvalue and/or acs-checkboxshowhidetargetvalue attribute can be added to dialog tab items to show and
 *   hide them.
 * - (optional) add css class acs-commons-field-required-allow-hidden to provided required field validation, which turns off when the field is hidden
 * - (optional) add data attribute acs-disablewhenhidden = true to disable the fields when hidden, useful when multiple fields have the same name
 *
 * - If the fields lie within a multifield
 * - add the extra empty property acs-cq-dialog-dropdown-checkbox-showhide-multifield to the dropdown/select or checkbox element
 *
 * - If a combination of multiple checkboxes is needed to determine the hiding of fields
 * - add the empty property acs-cq-dialog-combo-checkbox-showhide to the dropdown/select or checkbox element
 * - add the data attribute acs-cq-dialog-combo-checkbox-showhide-target to the dropdown/select or checkbox element,
 *   value should be the selector, usually a specific class name, to find all possible target elements that can be shown/hidden.
 * - add the target class to each target component that can be shown/hidden
 * - add the class hide to each target component to make them initially hidden
 * - add the attribute acs-combocheckboxshowhideclasses to the target component, the value should be a list of the
 *   classes that determine the hiding of this field, separated by spaces
 * - add the attribute acs-combocheckboxshowhidevalues to the target component, the value should be a list of the
 *   target values of the checkboxes that should be combined
 *   the order of both lists should be the same: the first value should correspond to the first class given
 * - add the attribute acs-combocheckboxshowhideoperator to the target component, the value should reflect the
 *   operator that is wanted, currently AND and OR are supported, OR is default and
 * - Add the attribute acs-optional when hidden to ignore required fields when the tab is hidden for those fields and set
 *   it to true as a String value like this: acs-optionalwhenhidden="true"
 */

/* global Granite, Coral, $  */
(function ($document, $) {
  'use strict';

  // when dialog gets injected
  $document.on('foundation-contentloaded', function () {
    // if there is already an initial value make sure the according target
    // element becomes visible
    $('[data-acs-cq-dialog-dropdown-checkbox-showhide]').each(function () {
      // handle Coral3 base drop-down/checkbox
      Coral.commons.ready($(this), function(element) {
        // Make sure the showhide is called at the end of the event-loop, selects in IE11 otherwise are not yet initialized
        setTimeout(function() {
          showHide(element);
        }, 0);
      });
    });

    showCorrectComboTargetElements();

  });

  $document.on('change', '[data-acs-cq-dialog-dropdown-checkbox-showhide]', function () {
    showHide($(this));
  });

  $document.on('change', '[data-acs-cq-dialog-combo-checkbox-showhide]', function () {
    showCorrectComboTargetElements();
  });

  function showHide(el) {
    // get the selector to find the target elements. it is stored as
    // data-attribute 'acsCqDialogDropdownCheckboxShowhideTarget'
    var target = el.data('acsCqDialogDropdownCheckboxShowhideTarget');
    var checkboxValue = '';
    var dropdownValue = '';

    // check if the changed element is the drop-down or the check-box
    // and get the values accordingly
    if ($(el).is('coral-select')) {
      dropdownValue = getDropdownValue(el);
      checkboxValue = getCheckboxValue(el.closest('coral-panel-content').find('coral-checkbox'));
    } else if ($(el).is('coral-checkbox')) {
      dropdownValue = getDropdownValue(el.closest('coral-panel-content').find('coral-select'));
      checkboxValue = getCheckboxValue(el);
    }

    if (typeof (el.data('acsCqDialogDropdownCheckboxShowhideMultifield')) !== 'undefined') {
      showCorrectTargetElementsBeneath(target, dropdownValue, checkboxValue, el.closest('coral-multifield-item'));
    } else {
      showCorrectTargetElementsBeneath(target, dropdownValue, checkboxValue, $(document));
    }
  }

  function getDropdownValue(dropdownElement) {
    return dropdownElement.val();
  }

  function getCheckboxValue(checkBoxElement) {
    // is check-box checked?
    var checked = checkBoxElement.prop('checked');
    // get the selected value
    // if check-box is not checked, we set the value to empty string
    return checked ? checkBoxElement.val() : '';
  }

  function showCorrectTargetElementsBeneath(target, dropdownValue, checkboxValue, $root) {
    // unhide target elements based on the target values
    $root.find(target).each(function () {
      toggleVisibilityElement($(this), !shouldBeVisible($(this), dropdownValue, checkboxValue));
    });
  }

  function showCorrectComboTargetElements() {
    $('[data-acs-combocheckboxshowhideclasses]').each(function () {
      var classes = $(this).data('acsCombocheckboxshowhideclasses').split(' ');
      var values = $(this).data('acsCombocheckboxshowhidevalues').split(' ');
      var operator = $(this).data('acsCombocheckboxshowhideoperator');
      var boolean;
      if (operator === 'AND') {
        boolean = true;
        classes.forEach(function (classvalue, index) {
          var temp = $('[data-acs-cq-dialog-combo-checkbox-showhide-target="' + classvalue + '"]');
          var checked = temp.prop('checked');
          boolean = (boolean && (checked === ('true' === values[index])));
        });
      } else {
        boolean = false;
        classes.forEach(function (classvalue, index) {
          var temp = $('[data-acs-cq-dialog-combo-checkbox-showhide-target="' + classvalue + '"]');
          var checked = temp.prop('checked');
          boolean = (boolean || (checked === ('true' === values[index])));
        });
      }
      toggleVisibilityElement($(this), !boolean);

    });
  }

  /**
   * Checks if the element should be visible based on selected dropdown value
   * and checkbox value
   */
  function shouldBeVisible($elem, dropdownValue, checkboxValue) {
    if ($elem.is('[data-acs-dropdownshowhidetargetvalue]') && $elem.is('[data-acs-checkboxshowhidetargetvalue]')) {
      return ($elem.attr('data-acs-dropdownshowhidetargetvalue').split(' ').indexOf(dropdownValue) >= 0) && $elem.attr('data-acs-checkboxshowhidetargetvalue') === checkboxValue;
    } else if ($elem.is('[data-acs-dropdownshowhidetargetvalue]')) {
      return $elem.attr('data-acs-dropdownshowhidetargetvalue').split(' ').indexOf(dropdownValue) >= 0;
    } else if ($elem.is('[data-acs-checkboxshowhidetargetvalue]')) {
      return $elem.attr('data-acs-checkboxshowhidetargetvalue') === checkboxValue;
    } else if ($elem.is('[data-acs-dropdownshowhidetargetnotvalue]')) {
      return $elem.attr('data-acs-dropdownshowhidetargetnotvalue') !== dropdownValue;
    }
    return false;
  }

  /**
   * Hides/unhides the element
   */
  function toggleVisibilityElement($elem, hide) {
    var $fieldWrapper = $elem.closest('.coral-Form-fieldwrapper');
    var tabPanel = $elem.parent().parent('coral-panel[role="region"],coral-panel[role="tabpanel"]');
    var tabLabelId = $(tabPanel).attr('aria-labelledby');
    var disable = $elem.attr('data-acs-disablewhenhidden');
    var required = $elem.attr('data-acs-optionalwhenhidden');

    if (hide) {
      // If target is a container, hides the container
      $elem.addClass('hide');
      if (!$elem.is('coral-checkbox') || ($elem.siblings('.coral-Form-fieldinfo').length > 0) || typeof ($elem.data('cqMsmLockable')) !== 'undefined') {
        // Hides the target field wrapper. Thus, hiding label, quicktip etc.
        $fieldWrapper.addClass('hide');
      }

      // hide the tab
      $('#' + tabLabelId).addClass('hide');

      //disable all input fields within the element if necessary
      if (disable === 'true') {
        $elem.find('.coral-Form-field').attr('disabled', '');
      }

      //disable validation when a tab is hidden
      if (required === 'true') {
        $elem.find('.coral-Form-field').removeAttr('required');
        $elem.find('input.coral-Form-field').attr('aria-required', 'false');
      }
    } else {
      // Unhide target container/field wrapper/tab
      $elem.removeClass('hide');
      if (!$elem.is('coral-checkbox') || ($elem.siblings('.coral-Form-fieldinfo').length > 0) || typeof ($elem.data('cqMsmLockable')) !== 'undefined') {
        $fieldWrapper.removeClass('hide');
      }
      $('#' + tabLabelId).removeClass('hide');

      //enable all input fields within the element if necessary
      if (disable === 'true') {
        $elem.find('.coral-Form-field').removeAttr('disabled');
      }

      //enable all inputfields when the tab is shown again
      if (required === 'true') {
        $elem.find('.coral-Form-field').attr('required');
        var inputField = $elem.find('input.coral-Form-field');
        $(inputField).attr('aria-required', 'true');
        $(inputField).attr('aria-invalid', 'true');
      }
    }
  }

})($(document), Granite.$);


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mycol. Pap. 128: 12 (1972)

#### Original name
Eriomycopsis englerulae Hansf.

### Remarks
null

redpajama_set_name: RedPajamaGithub


text:
#pragma once
#include "compound.hpp"

namespace z
{
	namespace util
	{
		namespace rgx
		{
			/**
			* \brief Regex rule for matching a lookbehind pattern.
			*
			* Note that lookbehind patterns must have a constant width.
			*/
			class lookbehind : public compound
			{
			public:
				/**
				* \brief Full constructor with negate option.
				* \param negate Whether to perform an inverse match.
				* \param min The minimum number of times this rule must match.
				* \param max The maximum number of times this rule can match.
				* \param greedy Whether this rule should consume input greedily.
				*/
				lookbehind(bool negate=false, int min=1, int max=1, bool greedy=true) noexcept;
				bool match(core::inputStream& stream) const noexcept;

				///If true, negates the result of lookbehind matching.
				bool negate;

				///The number of characters in the lookbehind pattern.
				size_t width;

#			ifdef DEBUG
				void print(core::outputStream& stream, int level=0) noexcept;
#			endif
			};
		}
	}
}


text:
import React from 'react';
import { mount } from 'enzyme';
import { noop } from 'lodash';

import { formatBytes } from '../../../helpers/format.js';

import FileListItem from './FileListItem';
import FileList from './';

let createMockFile = (name, size, mimeType) => {
  let blobName = name || 'mock.txt';
  let blobSize = size || 1024;
  let blobMimeType = mimeType || 'plain/txt';

  const range = count => {
    let output = '';
    for (let i = 0; i < count; i++) {
      output += 'a';
    }
    return output;
  };

  let blob = new Blob([range(blobSize)], { type: blobMimeType });
  blob.lastModifiedDate = new Date();
  blob.name = blobName;

  return blob;
};

const mockFiles = [
  createMockFile(
    '_89716241_thinkstockphotos-523060154.jpg',
    1024,
    'image/jpeg'
  ),
  createMockFile('funny_picture.jpg', 2048, 'image/jpeg'),
  createMockFile('photo.jpeg', 12398, 'image/jpeg')
];

describe('FileList', () => {
  it('should render a list of files if an array of files are passed to it', () => {
    let wrapper = mount(<FileList files={mockFiles} onRemoveFile={noop} />);
    expect(wrapper.find(FileListItem).length).toEqual(mockFiles.length);
  });
});

describe('FileListItem', () => {
  it('should display the file name', () => {
    let wrapper = mount(
      <FileListItem file={mockFiles[0]} index={0} onRemoveFile={noop} />
    );
    expect(wrapper.find('[data-test="itemNameText"]').text()).toEqual(mockFiles[0].name);
  });

  it('should display the size of the file', () => {
    let wrapper = mount(
      <FileListItem file={mockFiles[0]} index={0} onRemoveFile={noop} />
    );
    expect(wrapper.find('[data-test="itemFileSizeText"]').text()).toEqual(
      formatBytes(mockFiles[0].size)
    );
  });

  it('should display a remove button', () => {
    let wrapper = mount(
      <FileListItem file={mockFiles[0]} index={0} onRemoveFile={noop} />
    );
    expect(wrapper.find('button').exists()).toEqual(true);
  });

  it('onRemoveFIle should be called when the remove button is clicked', () => {
    const onRemoveFile = jest.fn();
    let removeButton = mount(
      <FileListItem file={mockFiles[0]} onRemoveFile={onRemoveFile} index={0} />
    ).find('button');
    removeButton.simulate('click');
    // Should return index 0
    expect(onRemoveFile).lastCalledWith(0);
  });
});


text: def foo(*args, **kwargs): bar(*args, **kwargs)


text:
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  _________.__                 __                .____                        .__
 /   _____/|  | _____    ____ |  | __ ___________|    |    ____   ____   ____ |  | ___.__.
 \_____  \ |  | \__  \ _/ ___\|  |/ // __ \_  __ \    |   /  _ \ / ___\ / ___\|  |<   |  |
 /        \|  |__/ __ \\  \___|    <\  ___/|  | \/    |__(  <_> ) /_/  > /_/  >  |_\___  |
/_______  /|____(____  /\___  >__|_ \\___  >__|  |_______ \____/\___  /\___  /|____/ ____|
        \/           \/     \/     \/    \/              \/    /_____//_____/      \/

                                Using
          ______     ______     ______   __  __     __     ______
          /\  == \   /\  __ \   /\__  _\ /\ \/ /    /\ \   /\__  _\
          \ \  __<   \ \ \/\ \  \/_/\ \/ \ \  _"-.  \ \ \  \/_/\ \/
           \ \_____\  \ \_____\    \ \_\  \ \_\ \_\  \ \_\    \ \_\
            \/_____/   \/_____/     \/_/   \/_/\/_/   \/_/     \/_/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is a sample Slack Loggly bot built with Botkit.

This bot demonstrates many of the core features of Botkit:

* Connect to Slack using the real time API
* Receive messages based on "spoken" patterns
* Reply to messages
* Use the conversation system to ask questions
* Use Loggly to log messages.
* Use Loggly to search for messages

# RUN THE BOT:

  Get a Bot token from Slack:

    -> http://my.slack.com/services/new/bot

  Get a Token from Loggly:

    -> https://<your_company>.loggly.com/tokens

  Modify the /lib/botconfig.js and add your slack and loggly tokens

  Modify the options accordingly

  Run the bot from the command line:

    token=<MY SLACK TOKEN> node slackloggly_bot.js

# USE THE BOT:

  Find your bot inside Slack to send it a direct message.

  Say: "Hello"

  The bot will reply "Hello!"

  Say: "who are you?"

  The bot will tell you its name, where it is running, and for how long.

  Make sure to invite your bot into other channels using /invite @<my bot>!

  Next try to log something

  Say: "@<your_botname> log <message you want to log>"

  The bot will say the message is logged.

  Say: "@<your_botname> search <message to search for>"

# EXTEND THE BOT:

  Botkit has many features for building cool and useful bots!

  Read all about it here:

    -> http://howdy.ai/botkit
    -> http://slackerloggly.github.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

const https = require('https');
const querystring = require('querystring');
const botconfig = require('./lib/botconfig.js');

var winstonLogglyOptions = botconfig.options.WinstonLogglyOptions;
var searchOptions = botconfig.options.LogglySearchOptions;
var eventOptions = botconfig.options.LogglyEventOptions;
var slackOptions = botconfig.options.SlackOptions;
var slackToken = slackOptions.token;
if(process.env.token) {
   slackToken = process.env.token;
}
var winston = require('winston');
require('winston-loggly');

winston.add(winston.transports.Loggly, winstonLogglyOptions);

// Clean this up appropriately
if (!slackToken || slackToken == "<Enter_Your_Slack_Token>" || !winstonLogglyOptions.inputToken || winstonLogglyOptions.inputToken == "<loggly_customer_token>") {
    console.log('Error: Specify tokens in environment or fix your /lib/botconfig.js file');
    process.exit(1);
}

var Botkit = require('./lib/slackerlogglylib.js');
var os = require('os');

var controller = Botkit.slackbot({
    debug: true,
});

var bot = controller.spawn({
    token: slackToken
}).startRTM();

controller.hears(['note','^log '], 'direct_message,direct_mention,mention', function(bot, message) {

    bot.api.reactions.add({
        timestamp: message.ts,
        channel: message.channel,
        name: 'robot_face',
    }, function(err, res) {
        if (err) {
            bot.botkit.log('Failed to add emoji reaction :(', err);
        }
    });
    console.log('Logging the message', message.text);
    message.text = message.text.replace(/^log /,'')
    message.text = message.text.replace(/^note /,'')
    var dataToLog = JSON.stringify(message);
    console.log('Removed log word', dataToLog);
    winston.log('info', dataToLog);
    bot.reply(message,
            ':robot_face: I have logged your message.');
});

controller.hears(['hello', 'hi'], 'direct_message,direct_mention,mention', function(bot, message) {

    bot.api.reactions.add({
        timestamp: message.ts,
        channel: message.channel,
        name: 'robot_face',
    }, function(err, res) {
        if (err) {
            bot.botkit.log('Failed to add emoji reaction :(', err);
        }
    });

    controller.storage.users.get(message.user, function(err, user) {
        if (user && user.name) {
            bot.reply(message, 'Hello ' + user.name + '!!');
        } else {
            bot.reply(message, 'Hello.');
        }
    });
});

controller.hears(['call me (.*)', 'my name is (.*)'], 'direct_message,direct_mention,mention', function(bot, message) {
    var name = message.match[1];
    controller.storage.users.get(message.user, function(err, user) {
        if (!user) {
            user = {
                id: message.user,
            };
        }
        user.name = name;
        controller.storage.users.save(user, function(err, id) {
            bot.reply(message, 'Got it. I will call you ' + user.name + ' from now on.');
        });
    });
});

controller.hears(['what is my name', 'who am i'], 'direct_message,direct_mention,mention', function(bot, message) {

    controller.storage.users.get(message.user, function(err, user) {
        if (user && user.name) {
            bot.reply(message, 'Your name is ' + user.name);
        } else {
            bot.startConversation(message, function(err, convo) {
                if (!err) {
                    convo.say('I do not know your name yet!');
                    convo.ask('What should I call you?', function(response, convo) {
                        convo.ask('You want me to call you `' + response.text + '`?', [
                            {
                                pattern: 'yes',
                                callback: function(response, convo) {
                                    // since no further messages are queued after this,
                                    // the conversation will end naturally with status == 'completed'
                                    convo.next();
                                }
                            },
                            {
                                pattern: 'no',
                                callback: function(response, convo) {
                                    // stop the conversation. this will cause it to end with status == 'stopped'
                                    convo.stop();
                                }
                            },
                            {
                                default: true,
                                callback: function(response, convo) {
                                    convo.repeat();
                                    convo.next();
                                }
                            }
                        ]);

                        convo.next();

                    }, {'key': 'nickname'}); // store the results in a field called nickname

                    convo.on('end', function(convo) {
                        if (convo.status == 'completed') {
                            bot.reply(message, 'OK! I will update my dossier...');

                            controller.storage.users.get(message.user, function(err, user) {
                                if (!user) {
                                    user = {
                                        id: message.user,
                                    };
                                }
                                user.name = convo.extractResponse('nickname');
                                controller.storage.users.save(user, function(err, id) {
                                    bot.reply(message, 'Got it. I will call you ' + user.name + ' from now on.');
                                });
                            });

                        } else {
                            // this happens if the conversation ended prematurely for some reason
                            bot.reply(message, 'OK, nevermind!');
                        }
                    });
                }
            });
        }
    });
});

controller.hears(['shutdown'], 'direct_message,direct_mention,mention', function(bot, message) {

    bot.startConversation(message, function(err, convo) {

        convo.ask('Are you sure you want me to shutdown?', [
            {
                pattern: bot.utterances.yes,
                callback: function(response, convo) {
                    convo.say('Bye!');
                    convo.next();
                    setTimeout(function() {
                        process.exit();
                    }, 3000);
                }
            },
        {
            pattern: bot.utterances.no,
            default: true,
            callback: function(response, convo) {
                convo.say('*Phew!*');
                convo.next();
            }
        }
        ]);
    });
});

controller.hears(['uptime', 'identify yourself', 'who are you', 'what is your name'],
    'direct_message,direct_mention,mention', function(bot, message) {

        var hostname = os.hostname();
        var uptime = formatUptime(process.uptime());

        bot.reply(message,
            ':robot_face: I am a bot named <@' + bot.identity.name +
             '>. I have been running for ' + uptime + ' on ' + hostname + '.');

    });

function formatUptime(uptime) {
    var unit = 'second';
    if (uptime > 60) {
        uptime = uptime / 60;
        unit = 'minute';
    }
    if (uptime > 60) {
        uptime = uptime / 60;
        unit = 'hour';
    }
    if (uptime != 1) {
        unit = unit + 's';
    }

    uptime = uptime + ' ' + unit;
    return uptime;
}

//////// TOY STUFF

controller.hears('sysload',['direct_message,direct_mention,mention','message_received'],function(bot,message) {
    console.log(os.loadavg());
  return bot.reply(message, 'My load average is ' + os.loadavg());
});

controller.hears('systype',['direct_message,direct_mention,mention','message_received'],function(bot,message) {
   return bot.reply(message, 'My os type is ' + os.type());
});

controller.hears('sysmem',['direct_message,direct_mention,mention','message_received'],function(bot,message) {
  return bot.reply(message, 'My memory available is ' + os.freemem());
});

controller.hears('sysrel',['direct_message,direct_mention,mention','message_received'],function(bot,message) {
  return bot.reply(message, 'My os release is ' + os.release());
});

//////// LOGGLY STUFF

// Search Loggly
controller.hears(['search'], 'direct_message,direct_mention,mention', function(bot, message) {
    var searchString = message.text.replace(/^search /,'');
    var origSearchMessage = message.text.replace(/^search /,'');
    searchString = querystring.escape(searchString);
    searchOptions.path = '/apiv2/search?q=';
    searchOptions.path += searchString;
    searchOptions.path += '&from=-2h&until=now&size=10';
    console.log('Request Search Path', searchOptions);
    var req = https.request(searchOptions, (res) => {
        //console.log('statusCode: ', res.statusCode);
        //console.log('headers: ', res.headers);

        res.on('data', (d) => {
            //process.stdout.write(d);
            var searchDataResp = JSON.parse(d);
            console.log('Search Data Resp', searchDataResp);
            console.log('RSID EventID', searchDataResp.rsid.id);
            eventOptions.path = '/apiv2/events?rsid=';
            eventOptions.path += searchDataResp.rsid.id;
            console.log('Request Event Path', eventOptions);
            var req2 = https.request(eventOptions, (res) => {
                    //console.log('statusCode: ', res.statusCode);
                    //console.log('headers: ', res.headers);

                    res.on('data', (eventData) => {

                        bot.reply(message, "Events Found for '" + origSearchMessage + "'");
                        //process.stdout.write(d);
                        var eventDataResp = JSON.parse(eventData);
                        console.log('getLogglyEventData', eventDataResp);
                        var totalEvents = eventDataResp.total_events;
                        var eventsList = eventDataResp.events;
                        console.log(eventsList);

                        bot.reply(message, JSON.stringify(eventDataResp, null, 4));
                    });
            });
            req2.end();

            req2.on('error', (e) => {
                console.error(e);
            });
        });
    });
    req.end();

    req.on('error', (e) => {
        console.error(e);
    });

});

// Stream Logs to Channel Of Choice
// Using LiveTail Loggly Feature
// See the ./lib/botconfig.js liveTail
var sys = require('util');
var exec = require('child_process').exec;

function exputs(error, stdout, stderr) { console.log(error, stdout, stderr) }

controller.hears('streamlogs',['direct_message,direct_mention,mention','message_received'],function(bot,message) {
    message.text = message.text.replace(/^streamlogs/,'');
    var matchString = "";
    var matched = message.text.match(/\s-match=.*/g);
    console.log('######################\n Matched String', matched);
    var matchedString = (matched && matched[0])? matched[0] : " -match=.*";
    matchedString = matchedString.replace(/\s-ignore=.*/g,'');
    matchString = matchedString.replace(/\s-match=/,'');
    console.log('###############################\n', matchString);
    var ignored = message.text.match(/\s-ignore=.*/g);
    var ignoredString = (ignored && ignored[0])? ignored[0] : "";
    ignoredString = ignoredString.replace(/\s-match=(.*)/g,'');
    var ignorString = ignoredString.replace(/\s-ignore=/,'');

    var exMatchString = "";
    exMatchString = "-m '" + matchString + "'";
    var exIgnoreString = "";
    if(ignorString != '') {
        exIgnoreString = " -i '" + ignorString + "'";
    }
    var fullExeCmd = './tailclient-' + botconfig.options.LiveTailOptions.version + '/bin/livetail ' + exMatchString + exIgnoreString;
    console.log('#######################################\n'+fullExeCmd);
    exec(fullExeCmd, exputs);
  return bot.reply(message, 'Starting a stream on ' + message.text + fullExeCmd);
});


text:
// vim: sw=4 ts=4 et
// The idea is to have one high level
// Nitrogen object, created from NitrogenClass, that
// encapsulates everything in order to prevent collisions.

function NitrogenClass(o) {
    this.$url = document.location.href;
    this.$div = document;
    this.$anchor_root_path = document;
    this.$params = new Object();
    this.$event_queue = new Array();
    this.$event_is_running = false;
    this.$system_event_queue = new Array();
    this.$system_event_is_running = false;
    this.$system_event_obj = null;
    this.$going_away = false;
    this.$live_validation_data_field = "LV_live_validation";
    return this;
}

/*** PRIVATE METHODS ***/

NitrogenClass.prototype.$path_alias = function(path) {
    if (path === 'page') {
        return document;
    } else {
        return path;
    }
}

NitrogenClass.prototype.$anchor = function(anchor, target) {
    this.$anchor_path = this.$path_alias(anchor);
    this.$target_path = this.$path_alias(target);
}

NitrogenClass.prototype.$anchor_root = function(anchor_root) {
    this.$anchor_root_path = anchor_root;
}

NitrogenClass.prototype.$set_param = function(key, value) {
    this.$params[key] = value;
}

NitrogenClass.prototype.$destroy = function() {
    document.comet_started = false;
    this.$going_away = true;

    // Clear the system event queue and abort any pending system events.
    this.$system_event_queue = new Array();
    if( this.$system_event_obj !== null ) {
    this.$system_event_obj.abort();
    }
    this.$system_event_is_running = false;

    // Let the event loop keep running until the event queue is empty.
}

/*** EVENT QUEUE ***/

NitrogenClass.prototype.$queue_event = function(validationGroup, eventContext, extraParam, ajaxSettings) {
    // Put an event on the event_queue.
    this.$event_queue.push({
        validationGroup : validationGroup,
        eventContext    : eventContext,
        extraParam      : extraParam,
        ajaxSettings    : ajaxSettings
    });
}

NitrogenClass.prototype.$queue_system_event = function(eventContext) {
    // Put an event on the event_queue.
    this.$system_event_queue.push({
        eventContext : eventContext
    });
}

NitrogenClass.prototype.$event_loop = function() {
    // Create a local copy of this for setTimeout callbacks.
    var this2 = this;

    // If no events are running and an event is queued, then fire it.
    if (!this.$system_event_is_running && this.$system_event_queue.length > 0) {
        var o = this.$system_event_queue.shift();
        this.$do_system_event(o.eventContext);
    }

    // If no events are running and an event is queued, then fire it.
    if (!this.$event_is_running && this.$event_queue.length > 0) {
        var o = this.$event_queue.shift();
        this.$do_event(o.validationGroup, o.eventContext, o.extraParam, o.ajaxSettings);
    }

    if (this.$system_event_queue.length == 0 || this.$event_queue.length == 0) {
    if( this.$going_away ) {
        // $destroy has been called for this Nitrogen object
        // and the event queue is empty - let the event loop stop.
        return;
    }
    else {
        // No more events, sleep for 50 ms...
        setTimeout( function() { this2.$event_loop() }, 50);
        return;
    }
    }

    // Events queued, but one is running, sleep for 10 ms...
    if (this.$event_is_running || this.$system_event_is_running) {
        setTimeout( function() { this2.$event_loop() }, 10);
        return;
    }

    // Events queued, loop and grab it...
    setTimeout( function() { this2.$event_loop() }, 1);
}

/*** VALIDATE AND SERIALIZE ***/

NitrogenClass.prototype.$validate_and_serialize = function(validationGroup) {
    // Check validatation, build object of params...
    var is_valid = true,
        params= {},
        n = this;

    jQuery(":input").not(".no_postback").each(function(i) {
        var LV = Nitrogen.$get_validation(this);
        if (LV && LV.group == validationGroup && !LV.validate()) {
            // Set a flag, but keep validating to show all messages.
            is_valid = false;
        } else {
            // Skip any unchecked radio boxes.
            if ((this.type == "radio" || this.type=="checkbox") && !this.checked) return;
            params[n.$make_id(this)] = this.value;
        }
    });
    // Return the params if valid. Otherwise, return null.
    return is_valid && params || null;
}

NitrogenClass.prototype.$add_validation = function(element, args) {
    if($(element)){
        if(!$(element).data(Nitrogen.$live_validation_data_field))
            $(element).data(Nitrogen.$live_validation_data_field, new LiveValidation(element, args));
        return Nitrogen.$get_validation(element);
    } else
        return null;
}

NitrogenClass.prototype.$get_validation = function(element) {
    return $(element).data(Nitrogen.$live_validation_data_field);
}

// TODO: This needs to be made smarter. Right now, I'm pretty sure elements have
// single validation groups, while it should be a list of groups that get validated
NitrogenClass.prototype.$destroy_specific_validation = function(trigger, target) {
    var v = NitrogenClass.$get_validation(target);
    if(v.group==trigger)
        Nitrogen.$destroy_target_validation(element);
}

NitrogenClass.prototype.$destroy_target_validation = function(element) {
    var v = Nitrogen.$get_validation(element);
    if(v) {
        v.destroy();
        $(element).data(Nitrogen.$live_validation_data_field,null);
    }
}

NitrogenClass.prototype.$destroy_validation_group = function(validationGroup) {
    jQuery(":input").not(".no_postback").each(function(i) {
        var LV = Nitrogen.$get_validation(this);
        if( LV && LV.group == validationGroup) {
            Nitrogen.$destroy_target_validation(this);
        }
    });
}

NitrogenClass.prototype.$destroy_all_validation = function() {
    $("*").each(function() {
        Nitrogen.$destroy_target_validation(this);
    });
}

NitrogenClass.prototype.$make_id = function(element) {
    var a = [];
    var re = new RegExp("\.wfid_(.[^\\s]*)", "g");
    while(element && element.className) {
        var matches = element.className.match(/wfid_([^\s])+/g);
        if (matches) {
            a.unshift.apply(a, matches);
        }
        element = element.parentNode;
    }
    return a.join(".");
}

/*** AJAX METHODS ***/

NitrogenClass.prototype.$do_event = function(validationGroup, eventContext, extraParam, ajaxSettings) {
    var n = this;

    var s = jQuery.extend({
        dataType: 'text',
        cache: false,
        success: null,
        error: null
    }, ajaxSettings);

    // Flag to prevent firing multiple postbacks at the same time...
    this.$event_is_running = true;

    // Run validation...
    var validationParams = this.$validate_and_serialize(validationGroup);
    if (validationParams == null) {
        this.$event_is_running = false;
        return;
    }

    // Assemble other parameters...
    var params = jQuery.extend({}, n.$params, validationParams, { eventContext: eventContext });

    jQuery.ajax({
        url: this.$url,
        type:'post',
        data: [jQuery.param(params), extraParam || ''].join('&'),
        dataType: s.dataType,
        cache: s.cache,
        success: function(data, textStatus) {
          n.$event_is_running = false;
          typeof s.success  == 'function' && s.success(data, textStatus) || eval(data);
            },
            error: function(xmlHttpRequest, textStatus, errorThrown) {
          n.$event_is_running = false;
          typeof s.success == 'function' && s.error(xmlHttpRequest, textStatus, errorThrown);
        }
    });
}

/*** SYSTEM EVENTS (FOR ASYNC) ***/

NitrogenClass.prototype.$do_system_event = function(eventContext) {
    var n = this;
    // Flag to prevent firing multiple postbacks at the same time...
    n.$system_event_is_running = true;

    // Assemble other parameters...
    var params = jQuery.extend( {}, n.$params, { eventContext: eventContext, is_system_event: 1 });

    n.$system_event_obj = $.ajax({
           url: this.$url,
           type:'post',
           data: jQuery.param(params),
           dataType: 'text',
         cache: false,
           success: function(data, textStatus) {
            n.$system_event_is_running = false;
            n.$system_event_obj = null;
            // A system event shouldn't clobber the pageContext.
            // Easiest to cacount for it here.
            var pc = n.$params["pageContext"];
            eval(data);
            n.$set_param("pageContext", pc);
           },
           error: function(xmlHttpRequest, textStatus, errorThrown) {
            n.$system_event_is_running = false;
            n.$system_event_obj = null;
           }
       });
}

/*** FILE UPLOAD ***/
/*NitrogenClass.prototype.$upload = function(form,input) {
    // Assemble other parameters...
    form.action = this.$url;
    form.pageContext.value = this.$params["pageContext"];
    form.submit();
    form.reset();
}*/

/*** GMAIL-STYLE UPLOAD ***/

NitrogenClass.prototype.$send_pending_files = function(form,input) {
    var file=null;
    if(typeof(form.$nitrogen_pending_files)=="object")
    {
        // not a typo, doing an assignment here
        while(file=form.$nitrogen_pending_files.shift())
        {
            file.submit();
        }
    }
}

NitrogenClass.prototype.$attach_upload_handle_dragdrop = function(form,input,settings) {
    var thisNitro = this;
    if(typeof(settings)=="undefined")
        settings={};
    if(typeof(form.$nitrogen_pending_files)=="undefined")
        form.$nitrogen_pending_files = [];

    jQuery.getScript("/nitrogen/jquery.fileupload.min.js",function(){
        var dropzone = jQuery(form).children(".upload_drop");

        jQuery(input).fileupload({
            dropZone:(settings.droppable ? dropzone : null),
            singleFileUploads:true,
            sequentialUploads:true,
            url:thisNitro.$url,
            paramName:"file",
            formData: function() {
                form.elements["pageContext"].value = thisNitro.$params["pageContext"];
                var d = jQuery(form).serializeArray();
                return d;
            },
            start: function(e) {
                form.pageContext.value = thisNitro.$params["pageContext"];
                jQuery(form).children(".upload_progress").fadeIn().text("Uploading...");
            },
            progressall: function(e,data) {
                var prog = parseInt(data.loaded / data.total * 100,10);
                // TODO: Convert this to a progress bar
                // Neede to add #progress{} element to continue with that
                jQuery(form).children(".upload_progress").text(prog + "% (" + data.loaded + "/" + data.total + " bytes)");
            },
            progress: function(e,data) {
                // Single file progress
            },
            send: function(e,data) {
            },
            stop: function(e,data) {

            },
            always: function(e,data) {
            },
            fail: function(e,data, options) {
                Nitrogen.$increment_pending_upload_counter(form,-1);
            },
            add: function(e,data) {
                jQuery.each(data.files,function(i,f) {
                    // Let's add the visual list of pending files
                    jQuery(form).children(".upload_droplist")
                        .prepend(jQuery("

").attr("filename",f.name).text(f.name));
                    Nitrogen.$increment_pending_upload_counter(form,1);
                });
                if(settings.autoupload)
                    data.submit();
                else
                    form.$nitrogen_pending_files.push(data);
            },
            done: function(e,data) {
                if(typeof data.result == "string") {
                    // Good browsers will use XHR file transfers, and so this
                    // will return a string
                    var Postback = data.result;
                } else if(typeof data.result == "object") {
                    // Crappy browsers (IE9 and below) will do the transfer
                    // as with an iframe and return a document-type object
                    var Postback = data.result[0].body.innerHTML;
                } else {
                    // IE also has data.result as "undefined" on failure
                    // So let's just treat it as an empty string
                    var Postback = "";
                }

                jQuery.globalEval(Postback);
                Nitrogen.$increment_pending_upload_counter(form,-1);
            }
        })
    })
}

NitrogenClass.prototype.$increment_pending_upload_counter = function(form,incrementer) {
    var counter = $(form).data("pending_uploads");
    if(typeof(counter)=="undefined")
        counter=0;
    counter+=incrementer;
    $(form).data("pending_uploads",counter);
    if(counter==0)
    {
        jQuery(form).children(".upload_progress").fadeOut();
        Nitrogen.$alert_unfinished_files(form);
    }
}

NitrogenClass.prototype.$upload_finished = function(Name) {
    jQuery(".upload_droplist").children("li[filename=\"" + Name + "\"]")
        .css("text-decoration","line-through")
        .addClass("upload_successful")
        .fadeOut();
}

NitrogenClass.prototype.$alert_unfinished_files = function(form) {
    var files = $(form).find(".upload_droplist li:not(.upload_successful):visible");
    if(files.length > 0)
    {
        $(form).find(".upload_droplist li:not(.upload_successful)").css("color","red").fadeOut("slow");

        var filenames = $(files).get().map(function(f) { return $(f).text() }).join("\r\n");
        alert("There was an error uploading the following file(s):\r\n" + filenames + "\r\n\r\nThis is likely due to the file(s) being too large or a misconfiguration on the server");
    }
}

/*** PATH LOOKUPS ***/

function obj(path, anchor) {
    return objs(path, anchor).get(0);
}

function objs(path, anchor) {
    // Trim the path...
    path = jQuery.trim(path);

    // If no anchor is specified, then use the last anchor set...
    if (!anchor) {
        anchor = Nitrogen.$anchor_path;
    } else {
        anchor = Nitrogen.$path_alias(anchor);
    }

    // Multiple parts, so split and combine results...
    if (path.indexOf(",") != -1) {
        var paths=path.split(",");
        var a = $();
        for (var i=0; i<paths.length; i++) {
            a = a.add(objs(paths[i], anchor));
        }
        return a;
    }

    // Selector is "page", so return the document...
    if (path == "page" || path == ".page") {
    return jQuery(document);
    }

    // Replace "##" with ".wfid_"...
    path = path.replace(/##/g, '.wfid_');

    // Replace "me" with anchor...
    path = path.replace(/\bme\b/g, anchor);

    // If this is a single word, then rewrite it to a Nitrogen element id.
    if (path.indexOf(" ") == -1 && path.indexOf(".") == -1 && path.indexOf("#") == -1) {
        var results = objs(".wfid_" + path, anchor);

        // If we found results, then return them...
        if (results.length > 0) {
            return results;
        }

        // If no results, and this is not a valid HTML element name, then return. Otherwise,
        // keep trying with the assumption that this is an HTML element...
        if (results.length == 0 && jQuery.inArray(path.toLowerCase(), Nitrogen.$valid_elements) == -1) {
            return jQuery();
        }
    }

    // If path begins with "body", then try matching across the entire
    // body...
    var re = new RegExp(/^body\b/);
    if (re.test(path)) {
        return jQuery(path);
    }

    var anchor_obj = jQuery(Nitrogen.$anchor_root_path).find(anchor);
    // Find all results under the anchor...
    var results = anchor_obj.find(path);
    if (results.length > 0) {
    return results;
    }

    // If no results under the anchor, then try on each parent, moving upwards...
    var results = anchor_obj.parentsUntil( Nitrogen.$anchor_root_path );
    for (var i=0; i<results.length; i++) {
    var results2 = jQuery(results.get(i)).find(path);
    if (results2.length > 0) {
        return results2;
    }
    }

    // No results, so try in context of entire page.
    return jQuery(path);
}

NitrogenClass.prototype.$valid_elements = [
    "a", "abbr", "acronym", "address", "applet", "area", "b", "base", "basefont",
    "bdo", "big", "blockquote", "body", "br", "button", "caption", "center", "cite",
    "code", "col", "colgroup", "dd", "del", "dfn", "dir", "div", "dl", "dt", "em",
    "fieldset", "font", "form", "frame", "frameset", "h1", "h2", "h3", "h4",
    "h5", "h6", "head", "hr", "html", "i", "iframe", "img", "input", "ins", "isindex",
    "kbd", "label", "legend", "li", "link", "map", "menu", "meta", "noframes", "noscript",
    "object", "ol", "optgroup", "option", "p", "param", "pre", "q", "s", "samp", "script", "select",
    "small", "span", "strike", "strong", "style", "sub", "sup", "table", "tbody", "td", "textarea",
    "tfoot", "th", "thead", "title", "tr", "tt", "u", "ul", "var"
];

/*** EVENT WIRING ***/

NitrogenClass.prototype.$observe_event = function(anchor, path, type, func) {
    objs(path, anchor).bind(type, func);
}

/*** DYNAMIC UPDATING ***/

NitrogenClass.prototype.$update = function(anchor, path, html) {
    objs(path, anchor).html(html);
}

NitrogenClass.prototype.$replace = function(anchor, path, html) {
    objs(path, anchor).replaceWith(html);
}

NitrogenClass.prototype.$insert_top = function(anchor, path, html) {
    objs(path, anchor).prepend(html);
}

NitrogenClass.prototype.$insert_bottom = function(anchor, path, html) {
    objs(path, anchor).append(html);
}

NitrogenClass.prototype.$insert_before = function(anchor, path, html) {
    objs(path, anchor).before(html);
}

NitrogenClass.prototype.$insert_after = function(anchor, path, html) {
    objs(path, anchor).after(html);
}

NitrogenClass.prototype.$remove = function(anchor, path) {
    objs(path, anchor).remove();
}

/*** MISC ***/

NitrogenClass.prototype.$return_false = function(value, args) {
    return false;
}

NitrogenClass.prototype.$is_key_code = function(event, keyCode, shiftKey) {
    return (event && event.keyCode == keyCode && event.shiftKey == shiftKey);
}

NitrogenClass.prototype.$go_next = function(controlID) {
    var o = obj(controlID);
    if (o.focus) o.focus();
    if (o.select) o.select();
    if (o.click) o.click();
}

NitrogenClass.prototype.$disable_selection = function(element) {
    element.onselectstart = function() {
    return false;
    };
    element.unselectable = "on";
    element.style.MozUserSelect = "none";
    element.style.cursor = "default";
}

NitrogenClass.prototype.$set_value = function(anchor, element, value) {
    if (!element.id) element = objs(element);
    element.each(function(index, el) {
                     if (el.value != undefined) el.value = value;
                     else if (el.checked != undefined) el.checked = value;
                     else if (el.src != undefined) el.src = value;
                     else $(el).html(value);
                 });
}

NitrogenClass.prototype.$get_value = function(anchor, element) {
    if (!element.id) element = objs(element);
    el = element.get(0);
    if (el.value != undefined) return el.value;
    else if (el.checked != undefined) return el.checked;
    else if (el.src != undefined) return el.src;
    else return $(el).html();
}

NitrogenClass.prototype.$normalize_param = function(key, value) {
    // Create the key=value line to add.
    // Sometimes, the user will pass a bunch of params in the key field.
    var s = "";
    if (key) { s = key; }
    if (key && value) { s = key + "=" + value; }
    return key + "&" + value;
}

NitrogenClass.prototype.$encode_arguments_object = function(Obj) {
    if (! Bert) { alert("Bert.js library not included in template.") }
    var a = new Array();
    for (var i=0; i<Obj.length; i++) {
    a.push(Obj[i]);
    }
    var s = Bert.encode(a);
    return "args=" + this.$urlencode(s);
}

NitrogenClass.prototype.$urlencode = function(str) {
    return escape(str).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');
}

/*** DATE PICKER ***/

NitrogenClass.prototype.$datepicker = function(pickerObj, pickerOptions) {
    jQuery(pickerObj).datepicker(pickerOptions);
}

/*** AUTOCOMPLETE TEXTBOX ***/
NitrogenClass.prototype.$autocomplete = function(path, autocompleteOptions, enterPostbackInfo, selectPostbackInfo) {
    var n = this;
    jQuery.extend(autocompleteOptions, {
        select: function(ev, ui) {
          var item = (ui.item) && '{"id":"'+ui.item.id+'","value":"'+ui.item.value+'"}' || '';
          n.$queue_event(null, selectPostbackInfo, "select_item="+n.$urlencode(item));
        },
        source: function(req, res) {
          n.$queue_event(null, enterPostbackInfo, "search_term="+req.term, {
              dataType: 'json',
              success: function(data) {
                 res(data);
              }
          });
        }
    });
    jQuery(path).autocomplete(autocompleteOptions);
}

/*** DRAG AND DROP ***/

NitrogenClass.prototype.$draggable = function(path, dragOptions, dragTag) {
    objs(path).each(function(index, el) {
          el.$drag_tag = dragTag;
        jQuery(el).draggable(dragOptions);
    });
}

NitrogenClass.prototype.$droppable = function(path, dropOptions, dropPostbackInfo) {
    var n = this;
    dropOptions.drop = function(ev, ui) {
        var dragItem = ui.draggable[0].$drag_tag;
        n.$queue_event(null, dropPostbackInfo, "drag_item=" + dragItem);
    };
    objs(path).each(function(index, el) {
          jQuery(el).droppable(dropOptions);
    });
}

/*** SORTING ***/

NitrogenClass.prototype.$sortitem = function(el, sortTag) {
    var sortItem = obj(el);
    sortItem.$sort_tag = sortTag;
    sortItem.$drag_tag = sortTag;
}

NitrogenClass.prototype.$sortblock = function(el, sortOptions, sortPostbackInfo) {
    var n = this;
    sortOptions.update = function() {
    var sortItems = "";
    for (var i=0; i<this.childNodes.length; i++) {
        var childNode = this.childNodes[i];
        if (sortItems != "") sortItems += ",";
        if (childNode.$sort_tag) sortItems += childNode.$sort_tag;
    }
    n.$queue_event(null, sortPostbackInfo, "sort_items=" + sortItems);
    };
    objs(el).sortable(sortOptions);
}

/*** transfer content of an alien elment into a nitrogen form
 * used in src/elements/other/element_recaptcha.erl
 * ***/
NitrogenClass.prototype.$from_alien = function(nativeID) {
    var input = $("input#" + nativeID).val();
    objs(nativeID).val(input);
};

var Nitrogen = new NitrogenClass();
var page = document;
Nitrogen.$event_loop();


text:
require_relative '../spec_helper'

describe ExtractTable do

it "should create a hash: table_name => [sheet, range, number of total rows, column names]" do
input = excel_fragment 'Table.xml'
expected_output = { "FirstTable" =>	["Sheet1", "B2:C5", "1", "ColA", "ColB"] }

output = ExtractTable.extract("Sheet1", input)
output.should == expected_output
end

it "should work even when the table does not have a total row" do
input = excel_fragment 'Table2.xml'
expected_output = { "FirstTable" =>	["Sheet1", "B2:C5", "0", "ColA", "ColB"] }

output = ExtractTable.extract("Sheet1", input)
output.should == expected_output
end

end


text:
package getfieldmapping

import (
	gobytes "bytes"
	"context"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"net/url"
	"strconv"
	"strings"

	"github.com/elastic/elastic-transport-go/v8/elastictransport"
)

const (
	fieldsMask = iota + 1

	indexMask
)

// ErrBuildPath is returned in case of missing parameters within the build of the request.
var ErrBuildPath = errors.New("cannot build path, check for missing path parameters")

type GetFieldMapping struct {
	transport elastictransport.Interface

	headers http.Header
	values  url.Values
	path    url.URL

	buf *gobytes.Buffer

	paramSet int

	fields string
	index  string
}

// NewGetFieldMapping type alias for index.
type NewGetFieldMapping func(fields string) *GetFieldMapping

// NewGetFieldMappingFunc returns a new instance of GetFieldMapping with the provided transport.
// Used in the index of the library this allows to retrieve every apis in once place.
func NewGetFieldMappingFunc(tp elastictransport.Interface) NewGetFieldMapping {
	return func(fields string) *GetFieldMapping {
		n := New(tp)

		n.Fields(fields)

		return n
	}
}

// Returns mapping for one or more fields.
//
// https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-field-mapping.html
func New(tp elastictransport.Interface) *GetFieldMapping {
	r := &GetFieldMapping{
		transport: tp,
		values:    make(url.Values),
		headers:   make(http.Header),
		buf:       gobytes.NewBuffer(nil),
	}

	return r
}

// HttpRequest returns the http.Request object built from the
// given parameters.
func (r *GetFieldMapping) HttpRequest(ctx context.Context) (*http.Request, error) {
	var path strings.Builder
	var method string
	var req *http.Request

	var err error

	r.path.Scheme = "http"

	switch {
	case r.paramSet == fieldsMask:
		path.WriteString("/")
		path.WriteString("_mapping")
		path.WriteString("/")
		path.WriteString("field")
		path.WriteString("/")

		path.WriteString(r.fields)

		method = http.MethodGet
	case r.paramSet == indexMask|fieldsMask:
		path.WriteString("/")

		path.WriteString(r.index)
		path.WriteString("/")
		path.WriteString("_mapping")
		path.WriteString("/")
		path.WriteString("field")
		path.WriteString("/")

		path.WriteString(r.fields)

		method = http.MethodGet
	}

	r.path.Path = path.String()
	r.path.RawQuery = r.values.Encode()

	if r.path.Path == "" {
		return nil, ErrBuildPath
	}

	if ctx != nil {
		req, err = http.NewRequestWithContext(ctx, method, r.path.String(), r.buf)
	} else {
		req, err = http.NewRequest(method, r.path.String(), r.buf)
	}

	req.Header = r.headers.Clone()

	if req.Header.Get("Accept") == "" {
		req.Header.Set("Accept", "application/vnd.elasticsearch+json;compatible-with=8")
	}

	if err != nil {
		return req, fmt.Errorf("could not build http.Request: %w", err)
	}

	return req, nil
}

// Do runs the http.Request through the provided transport.
func (r GetFieldMapping) Do(ctx context.Context) (*http.Response, error) {
	req, err := r.HttpRequest(ctx)
	if err != nil {
		return nil, err
	}

	res, err := r.transport.Perform(req)
	if err != nil {
		return nil, fmt.Errorf("an error happened during the GetFieldMapping query execution: %w", err)
	}

	return res, nil
}

// IsSuccess allows to run a query with a context and retrieve the result as a boolean.
// This only exists for endpoints without a request payload and allows for quick control flow.
func (r GetFieldMapping) IsSuccess(ctx context.Context) (bool, error) {
	res, err := r.Do(ctx)

	if err != nil {
		return false, err
	}
	io.Copy(ioutil.Discard, res.Body)
	err = res.Body.Close()
	if err != nil {
		return false, err
	}

	if res.StatusCode >= 200 && res.StatusCode < 300 {
		return true, nil
	}

	return false, nil
}

// Header set a key, value pair in the GetFieldMapping headers map.
func (r *GetFieldMapping) Header(key, value string) *GetFieldMapping {
	r.headers.Set(key, value)

	return r
}

// Fields A comma-separated list of fields
// API Name: fields
func (r *GetFieldMapping) Fields(v string) *GetFieldMapping {
	r.paramSet |= fieldsMask
	r.fields = v

	return r
}

// Index A comma-separated list of index names
// API Name: index
func (r *GetFieldMapping) Index(v string) *GetFieldMapping {
	r.paramSet |= indexMask
	r.index = v

	return r
}

// AllowNoIndices Whether to ignore if a wildcard indices expression resolves into no concrete
// indices. (This includes `_all` string or when no indices have been specified)
// API name: allow_no_indices
func (r *GetFieldMapping) AllowNoIndices(b bool) *GetFieldMapping {
	r.values.Set("allow_no_indices", strconv.FormatBool(b))

	return r
}

// ExpandWildcards Whether to expand wildcard expression to concrete indices that are open,
// closed or both.
// API name: expand_wildcards
func (r *GetFieldMapping) ExpandWildcards(value string) *GetFieldMapping {
	r.values.Set("expand_wildcards", value)

	return r
}

// IgnoreUnavailable Whether specified concrete indices should be ignored when unavailable
// (missing or closed)
// API name: ignore_unavailable
func (r *GetFieldMapping) IgnoreUnavailable(b bool) *GetFieldMapping {
	r.values.Set("ignore_unavailable", strconv.FormatBool(b))

	return r
}

// IncludeDefaults Whether the default mapping values should be returned as well
// API name: include_defaults
func (r *GetFieldMapping) IncludeDefaults(b bool) *GetFieldMapping {
	r.values.Set("include_defaults", strconv.FormatBool(b))

	return r
}

// Local Return local information, do not retrieve the state from master node
// (default: false)
// API name: local
func (r *GetFieldMapping) Local(b bool) *GetFieldMapping {
	r.values.Set("local", strconv.FormatBool(b))

	return r
}


text:
package org.jetbrains.plugins.scala.refactoring.rename2

import org.jetbrains.plugins.scala.base.ScalaFixtureTestCase
import org.jetbrains.plugins.scala.extensions.StringExt
import org.jetbrains.plugins.scala.lang.refactoring.rename.inplace.{ScalaInplaceRenameHandler, ScalaLocalInplaceRenameHandler, ScalaMemberInplaceRenameHandler}
import org.junit.Assert

class ScalaInplaceRenameHandlerTest extends ScalaFixtureTestCase {

  private def memberHandler = new ScalaMemberInplaceRenameHandler
  private def localHandler = new ScalaLocalInplaceRenameHandler

  private def isAvailable(handler: ScalaInplaceRenameHandler): Boolean = {
    handler.isAvailable(myFixture.getElementAtCaret, myFixture.getEditor, myFixture.getFile)
  }

  private def checkIsAvailable(handler: ScalaInplaceRenameHandler): Unit = {
    Assert.assertTrue(s"$handler is not available", isAvailable(handler))
  }

  private def checkIsNotAvailable(handler: ScalaInplaceRenameHandler): Unit = {
    Assert.assertTrue(s"$handler is available", !isAvailable(handler))
  }

  private def checkIsLocalHandler(fileText: String): Unit = {
    myFixture.configureByText("dummy.scala", fileText.withNormalizedSeparator.trim)
    checkIsAvailable(localHandler)
    checkIsNotAvailable(memberHandler)
  }

  private def checkIsMemberHandler(fileText: String): Unit = {
    myFixture.configureByText("dummy.scala", fileText.withNormalizedSeparator.trim)
    checkIsAvailable(memberHandler)
    checkIsNotAvailable(localHandler)
  }

  def testLocal(): Unit = {
    checkIsLocalHandler(
      s"""
        |object Test {
        |  def foo(): Unit = {
        |    val ${CARET}x = 1
        |    x + x
        |  }
        |}
        |""".stripMargin)
  }

  def testLocalClass(): Unit = {
    checkIsLocalHandler(
      s"""object Test {
        |  def foo(): Unit = {
        |    class ${CARET}Abc
        |    class Bce extends Abc
        |  }
        |}
        |""".stripMargin)
  }

  def testClassParameter(): Unit = {
    checkIsMemberHandler(s"case class MyClass(${CARET}n: Int)")
  }

  def testParameter(): Unit = {
    checkIsMemberHandler(
      s"""
        |object Test {
        |  def foo(${CARET}bar: String): Unit = {
        |    println(bar)
        |  }
        |}
        |""".stripMargin)
  }

  def testMember(): Unit = {
    checkIsMemberHandler(
      s"""trait MyTrait {
         |  def ${CARET}doSomething: Unit
         |}
         |
         |case class MyClass(n: Int) extends MyTrait {
         |  override def doSomething: Unit = {}
         |}
         |""".stripMargin
    )
  }

  def testMemberInLocalScope(): Unit = {
    checkIsMemberHandler(
      s"""object Test {
         |
         |  def foo(): Unit = {
         |    trait MyTrait {
         |      def ${CARET}doSomething: Unit
         |    }
         |
         |    case class MyClass(n: Int) extends MyTrait {
         |      override def doSomething: Unit = {}
         |    }
         |  }
         |}""".stripMargin
    )
  }

}


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

    ///
    /// Information needed for cloning operation.
    ///
    public partial class CloningInfo
    {
        ///
        /// Initializes a new instance of the CloningInfo class.
        ///
        public CloningInfo()
        {
            CustomInit();
        }

        ///
        /// Initializes a new instance of the CloningInfo class.
        ///
        /// <param name="sourceWebAppId">ARM resource ID of the source app. App
        /// resource ID is of the form
        /// /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}
        /// for production slots and
        /// /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName}
        /// for other slots.</param>
        /// <param name="correlationId">Correlation ID of cloning operation.
        /// This ID ties multiple cloning operations
        /// together to use the same snapshot.</param>
        /// <param name="overwrite">true to overwrite
        /// destination app; otherwise, false.</param>
        /// <param name="cloneCustomHostNames">true to
        /// clone custom hostnames from source app; otherwise,
        /// false.</param>
        /// <param name="cloneSourceControl">true to
        /// clone source control from source app; otherwise,
        /// false.</param>
        /// <param name="hostingEnvironment">App Service Environment.</param>
        /// <param name="appSettingsOverrides">Application setting overrides
        /// for cloned app. If specified, these settings override the settings
        /// cloned
        /// from source app. Otherwise, application settings from source app
        /// are retained.</param>
        /// <param name="configureLoadBalancing">true
        /// to configure load balancing for source and destination app.</param>
        /// <param name="trafficManagerProfileId">ARM resource ID of the
        /// Traffic Manager profile to use, if it exists. Traffic Manager
        /// resource ID is of the form
        /// /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}.</param>
        /// <param name="trafficManagerProfileName">Name of Traffic Manager
        /// profile to create. This is only needed if Traffic Manager profile
        /// does not already exist.</param>
        public CloningInfo(string sourceWebAppId, System.Guid? correlationId = default(System.Guid?), bool? overwrite = default(bool?), bool? cloneCustomHostNames = default(bool?), bool? cloneSourceControl = default(bool?), string hostingEnvironment = default(string), IDictionary<string, string> appSettingsOverrides = default(IDictionary<string, string>), bool? configureLoadBalancing = default(bool?), string trafficManagerProfileId = default(string), string trafficManagerProfileName = default(string))
        {
            CorrelationId = correlationId;
            Overwrite = overwrite;
            CloneCustomHostNames = cloneCustomHostNames;
            CloneSourceControl = cloneSourceControl;
            SourceWebAppId = sourceWebAppId;
            HostingEnvironment = hostingEnvironment;
            AppSettingsOverrides = appSettingsOverrides;
            ConfigureLoadBalancing = configureLoadBalancing;
            TrafficManagerProfileId = trafficManagerProfileId;
            TrafficManagerProfileName = trafficManagerProfileName;
            CustomInit();
        }

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

        ///
        /// Gets or sets correlation ID of cloning operation. This ID ties
        /// multiple cloning operations
        /// together to use the same snapshot.
        ///
        [JsonProperty(PropertyName = "correlationId")]
        public System.Guid? CorrelationId { get; set; }

        ///
        /// Gets or sets &lt;code&gt;true&lt;/code&gt; to
        /// overwrite destination app; otherwise,
        /// &lt;code&gt;false&lt;/code&gt;.
        ///
        [JsonProperty(PropertyName = "overwrite")]
        public bool? Overwrite { get; set; }

        ///
        /// Gets or sets &lt;code&gt;true&lt;/code&gt; to clone
        /// custom hostnames from source app; otherwise,
        /// &lt;code&gt;false&lt;/code&gt;.
        ///
        [JsonProperty(PropertyName = "cloneCustomHostNames")]
        public bool? CloneCustomHostNames { get; set; }

        ///
        /// Gets or sets &lt;code&gt;true&lt;/code&gt; to clone
        /// source control from source app; otherwise,
        /// &lt;code&gt;false&lt;/code&gt;.
        ///
        [JsonProperty(PropertyName = "cloneSourceControl")]
        public bool? CloneSourceControl { get; set; }

        ///
        /// Gets or sets ARM resource ID of the source app. App resource ID is
        /// of the form
        /// /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}
        /// for production slots and
        /// /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/slots/{slotName}
        /// for other slots.
        ///
        [JsonProperty(PropertyName = "sourceWebAppId")]
        public string SourceWebAppId { get; set; }

        ///
        /// Gets or sets app Service Environment.
        ///
        [JsonProperty(PropertyName = "hostingEnvironment")]
        public string HostingEnvironment { get; set; }

        ///
        /// Gets or sets application setting overrides for cloned app. If
        /// specified, these settings override the settings cloned
        /// from source app. Otherwise, application settings from source app
        /// are retained.
        ///
        [JsonProperty(PropertyName = "appSettingsOverrides")]
        public IDictionary<string, string> AppSettingsOverrides { get; set; }

        ///
        /// Gets or sets &lt;code&gt;true&lt;/code&gt; to
        /// configure load balancing for source and destination app.
        ///
        [JsonProperty(PropertyName = "configureLoadBalancing")]
        public bool? ConfigureLoadBalancing { get; set; }

        ///
        /// Gets or sets ARM resource ID of the Traffic Manager profile to use,
        /// if it exists. Traffic Manager resource ID is of the form
        /// /subscriptions/{subId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/trafficManagerProfiles/{profileName}.
        ///
        [JsonProperty(PropertyName = "trafficManagerProfileId")]
        public string TrafficManagerProfileId { get; set; }

        ///
        /// Gets or sets name of Traffic Manager profile to create. This is
        /// only needed if Traffic Manager profile does not already exist.
        ///
        [JsonProperty(PropertyName = "trafficManagerProfileName")]
        public string TrafficManagerProfileName { get; set; }

        ///
        /// Validate the object.
        ///
        /// <exception cref="ValidationException">
        /// Thrown if validation fails
        /// </exception>
        public virtual void Validate()
        {
            if (SourceWebAppId == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "SourceWebAppId");
            }
        }
    }
}


text: .Treant > .node { border: solid; border-radius: 10px; vertical-align: middle }


text:
/*
 * Created by SharpDevelop.
 * User: Skrylar
 * Date: 9/30/2011
 * Time: 5:40 AM
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Runtime.InteropServices;

/* Type: ALLEGRO_DISPLAY
 *
 * "Handle" is because its a pointer to an opaque type, and we don't
 * want it conflicting with our C# wrapper.
 */
using DisplayHandle = System.IntPtr;
using EventSourceHandle = System.IntPtr;

namespace Allegro5Net.AL5
{
	public unsafe class Display
	{
		public const string LIBRARY = "allegro-5.0.dll";

		/* Possible bit combinations for the flags parameter of al_create_display. */
		public enum DisplayFlag : int
		{
			Windowed                    = 1 << 0,
			Fullscreen                  = 1 << 1,
			OpenGL                      = 1 << 2,
			Direct3dInternal            = 1 << 3,
			Resizable                   = 1 << 4,
			Noframe                     = 1 << 5,
			GenerateExposeEvents        = 1 << 6,
			Opengl_3_0                  = 1 << 7,
			OpenglForwardCompatible     = 1 << 8,
			FullscreenWindow            = 1 << 9,
			Minimized                   = 1 << 10
		}

		/* Possible parameters for al_set_display_option.
		 * Make sure to update ALLEGRO_EXTRA_DISPLAY_SETTINGS if you modify
		 * anything here.
		 */
		public enum DisplayOption : int
		{
			RedSize,
			GreenSize,
			BlueSize,
			AlphaSize,
			RedShift,
			GreenShift,
			BlueShift,
			AlphaShift,
			AccRedSize,
			AccGreenSize,
			AccBlueSize,
			AccAlphaSize,
			Stereo,
			AuxBuffers,
			ColorSize,
			DepthSize,
			StencilSize,
			SampleBuffers,
			Samples,
			RenderMethod,
			FloatColor,
			FloatDepth,
			SingleBuffer,
			SwapMethod,
			CompatibleDisplay,
			UpdateDisplayRegion,
			Vsync,
			MaxBitmapSize,
			SupportNpotBitmap,
			CanDrawIntoBitmap,
			SupportSeparateAlpha,
			DisplayOptionsCount
		};

		public enum Importance : int
		{
		   DontCare,
		   Require,
		   Suggest
		}

		public enum DisplayOrientation : int
		{
			Rotate_0_Degrees,
			Rotate_90_Degrees,
			Rotate_180_Degrees,
			Rotate_270_Degrees,
			FaceUp,
			FaceDown
		}

		/* Type: ALLEGRO_DISPLAY
		 */
		[StructLayout(LayoutKind.Sequential)]
		public struct DisplayMode
		{
		   public int Width;
		   public int Height;
		   public int Format;
		   public int RefreshRate;
		}

		/* Type: ALLEGRO_MONITOR_INFO
		 */
		[StructLayout(LayoutKind.Sequential)]
		public struct MonitorInfo
		{
		   public int X1;
		   public int Y1;
		   public int X2;
		   public int Y2;
		}

		/*enum {
		   ALLEGRO_DEFAULT_DISPLAY_ADAPTER = -1
		};*/

		[DllImport(LIBRARY, EntryPoint="al_set_new_display_refresh_rate",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void al_set_new_display_refresh_rate(int refresh_rate);
		[DllImport(LIBRARY, EntryPoint="al_set_new_display_flags",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void al_set_new_display_flags(int flags);
		[DllImport(LIBRARY, EntryPoint="al_get_new_display_refresh_rate",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern int  al_get_new_display_refresh_rate();
		[DllImport(LIBRARY, EntryPoint="al_get_new_display_flags",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern int  al_get_new_display_flags();

		[DllImport(LIBRARY, EntryPoint="al_get_display_width",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern int al_get_display_width (DisplayHandle display);
		[DllImport(LIBRARY, EntryPoint="al_get_display_height",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern int al_get_display_height(DisplayHandle display);
		[DllImport(LIBRARY, EntryPoint="al_get_display_format",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern int al_get_display_format(DisplayHandle display);
		[DllImport(LIBRARY, EntryPoint="al_get_display_refresh_rate",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern int al_get_display_refresh_rate(DisplayHandle display);
		[DllImport(LIBRARY, EntryPoint="al_get_display_flags",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern int al_get_display_flags (DisplayHandle display);
		[DllImport(LIBRARY, EntryPoint="al_toggle_display_flag",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern bool al_toggle_display_flag(DisplayHandle display, int flag, bool onoff);

		[DllImport(LIBRARY, EntryPoint="al_create_display",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern DisplayHandle al_create_display (int w, int h);
		[DllImport(LIBRARY, EntryPoint="al_destroy_display",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void             al_destroy_display(DisplayHandle display);
		[DllImport(LIBRARY, EntryPoint="al_get_current_display",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern DisplayHandle al_get_current_display ();
		[DllImport(LIBRARY, EntryPoint="al_set_target_bitmap",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void            al_set_target_bitmap(DisplayHandle bitmap);
		[DllImport(LIBRARY, EntryPoint="al_set_target_backbuffer",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void            al_set_target_backbuffer(DisplayHandle display);
		// static extern public ALLEGRO_BITMAP, al_get_backbuffe    (ALLEGRO_DISPLAY *display);
		// static extern public ALLEGRO_BITMAP, al_get_target_bitma ();

		[DllImport(LIBRARY, EntryPoint="al_acknowledge_resize",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern bool al_acknowledge_resize(DisplayHandle display);
		[DllImport(LIBRARY, EntryPoint="al_resize_display",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern bool al_resize_display    (DisplayHandle display, int width, int height);
		[DllImport(LIBRARY, EntryPoint="al_flip_display",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void al_flip_display      ();
		[DllImport(LIBRARY, EntryPoint="al_update_display_region",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void al_update_display_region(int x, int y, int width, int height);
		// static extern public bool al_is_compatible_bitmap(ALLEGRO_BITMAP *bitmap);

		[DllImport(LIBRARY, EntryPoint="al_get_num_display_modes",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern int al_get_num_display_modes();
		// AL_FUNC(ALLEGRO_DISPLAY_MODE*, al_get_display_mode, (int index,
		//        ALLEGRO_DISPLAY_MODE *mode));

		[DllImport(LIBRARY, EntryPoint="al_wait_for_vsync",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern bool al_wait_for_vsync();

		// static extern public ALLEGRO_EVENT_SOURCE al_get_display_event_source (DisplayHandle display);
		[DllImport(LIBRARY, EntryPoint="al_get_display_event_source",
		           CallingConvention=CallingConvention.Cdecl)]
		public static extern EventSourceHandle al_get_display_event_source(DisplayHandle display);

		/* Primitives */
		[DllImport(LIBRARY, EntryPoint="al_clear_to_color",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void al_clear_to_color(Color color);
		//[DllImport(LIBRARY, EntryPoint="al_draw_pixel",
		//	CallingConvention=CallingConvention.Cdecl)]
		//public static extern void al_draw_pixel(float x, float y, ALLEGRO_COLOR color);

		// static extern public void al_set_display_icon(DisplayHandle display, ALLEGRO_BITMAP *icon);

		/* Stuff for multihead/window management */
		[DllImport(LIBRARY, EntryPoint="al_get_num_video_adapters",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern int al_get_num_video_adapters();
		[DllImport(LIBRARY, EntryPoint="al_get_monitor_info",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern bool al_get_monitor_info(int adapter, MonitorInfo *info);
		[DllImport(LIBRARY, EntryPoint="al_get_new_display_adapter",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern int al_get_new_display_adapter();
		[DllImport(LIBRARY, EntryPoint="al_set_new_display_adapter",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void al_set_new_display_adapter(int adapter);
		[DllImport(LIBRARY, EntryPoint="al_set_new_window_position",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void al_set_new_window_position(int x, int y);
		[DllImport(LIBRARY, EntryPoint="al_get_new_window_position",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void al_get_new_window_position(int *x, int *y);
		[DllImport(LIBRARY, EntryPoint="al_set_window_position",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void al_set_window_position(DisplayHandle display, int x, int y);
		[DllImport(LIBRARY, EntryPoint="al_get_window_position",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void al_get_window_position(DisplayHandle display, ref int x, ref int y);

		[DllImport(LIBRARY, EntryPoint="al_set_window_title",
			CallingConvention=CallingConvention.Cdecl,
			CharSet=CharSet.Unicode)]
		public static extern void al_set_window_title(DisplayHandle display,
			[MarshalAs(UnmanagedType.LPStr)] string title);

		/* Defined in display_settings.c */
		[DllImport(LIBRARY, EntryPoint="al_set_new_display_option",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void al_set_new_display_option(int option, int value, Importance importance);
		[DllImport(LIBRARY, EntryPoint="al_get_new_display_option",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern int al_get_new_display_option(int option, Importance *importance);
		[DllImport(LIBRARY, EntryPoint="al_reset_new_display_options",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void al_reset_new_display_options();
		[DllImport(LIBRARY, EntryPoint="al_get_display_option",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern int al_get_display_option(DisplayHandle display, int option);

		/*Deferred drawing*/
		[DllImport(LIBRARY, EntryPoint="al_hold_bitmap_drawing",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern void al_hold_bitmap_drawing(bool hold);
		[DllImport(LIBRARY, EntryPoint="al_is_bitmap_drawing_held",
			CallingConvention=CallingConvention.Cdecl)]
		public static extern bool al_is_bitmap_drawing_held();
	}
}


text:
package com.example.android.miwok;

import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;

/**
 * Created by Administrator on 2017/2/26.
 */

public class PharassAdapter extends ArrayAdapter<Pharass> {
    public PharassAdapter(Context context, ArrayList<Pharass> pharassArrayList){
        super(context, 0, pharassArrayList);
    }

    @NonNull
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View listItemView = convertView;
        //convertView is null
        if (listItemView == null){
            //Use LayoutInflater to convent a view
            listItemView = LayoutInflater.from(getContext()).inflate(R.layout.pharass_e_m, parent, false);
        }

        TextView pharassOfdefault = (TextView)listItemView.findViewById(R.id.pharass_english);
        TextView pharassOfMiwok = (TextView)listItemView.findViewById(R.id.pharass_miwok);

        //get the currentItemView
        Pharass pharass = getItem(position);

        pharassOfdefault.setText(pharass.getDefaultOfPharass());
        pharassOfMiwok.setText(pharass.getMiwokOfPharass());

        ImageView imageView = (ImageView)listItemView.findViewById(R.id.pharass_of_images);

        if (pharass.hasImage()){
            imageView.setImageResource(pharass.getPharassOfImageId());
        }else {
            imageView.setVisibility(View.GONE);
        }

        return listItemView;
    }
}


text:
export const registry = {};

export function registerElementCSS(tagName, content) {
  registry[tagName] = content;
}


text:
WTIME
=====
CLI Time Tracking

Originally from wtime.sf.net:
Copyright (c) MMV-MMVI Jan Podrouzek <jan.podrouzek@gmail.com>


text:
FROM ubuntu

RUN apt-get update && apt-get install -y python

# Comments below a RUN
#Comment without a leading space

CMD bash


text:
import django.contrib.postgres.fields
from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('chamber_of_deputies', '0006_change_on_delete_social_media_to_set_null'),
    ]

    operations = [
        migrations.AlterField(
            model_name='reimbursement',
            name='document_id',
            field=models.IntegerField(db_index=True, verbose_name='Número do Reembolso'),
        ),
        migrations.AlterField(
            model_name='reimbursement',
            name='issue_date',
            field=models.DateField(blank=True, db_index=True, null=True, verbose_name='Data de Emissão'),
        ),
        migrations.AlterField(
            model_name='reimbursement',
            name='numbers',
            field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=128, verbose_name='Números dos Ressarcimentos'), default=list, size=None),
        ),
        migrations.AlterField(
            model_name='reimbursement',
            name='supplier',
            field=models.CharField(max_length=256, verbose_name='Fornecedor'),
        ),
    ]


text:
#pragma once

#include "FiniteStateMachine.h"
#include "StateOperation.h"
#include <string>
#include <iostream>
#include <fstream>
#include "StateTypes.h"
#include <list>

#include "FSMExport.h"

using namespace std;

namespace mystatemachine
{

class FSMExport FiniteStateMachineBuilder
{
protected:
	FiniteStateMachine* _destination;

private:

	typedef enum{
		LEVEL_0,
		LEVEL_1,
		LEVEL_2,
		LEVEL_3,
		LEVEL_4
	}Level;

	typedef struct{
		std::string xmi_type;
		std::string xmi_id;
		std::string name;
	}Package;

	typedef struct{
		std::string xmi_type;
		std::string xmi_id;
		std::string name;
		std::string toSubvertex;
	}EntryFunction;

	typedef struct{
		std::string xmi_type;
		std::string xmi_id;
		std::string name;
		std::string toSubvertex;
	}ExitFunction;

	typedef struct{
		std::string xmi_type;
		std::string xmi_id;
		std::string name;
		std::string toSubvertex;
	}DoFunction;

	typedef struct{
		std::string annotatedElement; // ID des Subvertex, den dieser Kommentar zugeordnet ist
		std::string xmi_id;
		std::string body;
	}OwnedComment;

	typedef struct Subvertex{
		std::string xmi_type;
		std::string xmi_id;
		std::string name;
		std::string visibility;
		std::string outgoing;
		std::string incoming;
	};

	//  <trigger xmi:id="_14_0_888026c_1232699038635_228333_708" name="" visibility="public" event="_14_0_888026c_1232699246834_791001_724"/>
	typedef struct{
		std::string xmi_id;
		std::string name;
		std::string event;
	}Trigger;

	typedef struct{
		std::string xmi_id;
		std::string name;
		std::string target;
		std::string source;
		Trigger		trigger;
	}Transitions;

	//  <changeExpression xmi:type="uml:OpaqueExpression" xmi:id="_14_0_888026c_1232699251505_856729_725" name="">
	typedef struct{
		std::string xmi_type;
		std::string xmi_id;
		std::string name;
		std::string body;
		std::string	package; // Gibt an, zu welchem Packet dieser Ausdruck gehört
	}ChangeExpression;

	typedef struct{
		std::string xmi_type;
		std::string xmi_id;
		std::string name;
	}AnyChangeExpression;

	typedef struct {
		std::string name; // ID des Subvertex, den dieser Kommentar zugeordnet ist
		std::string xmi_id;
		std::string visibility;
		std::string xmi_type;
		std::string	value;
		std::string	ownerFunction; // Function, dem das Attribug zugeordet ist.
	}OwnedAttribute;

	std::list<Package>			_packages;
	std::list<Subvertex>		_states;
	std::list<Transitions>		_transitions;
	std::list<ChangeExpression>	_expressions;
	std::list<EntryFunction>	_entryfunctions;
	std::list<ExitFunction>		_exitfunctions;
	std::list<OwnedComment>		_owndedComments;
	std::list<DoFunction>		_doFunctions;
	std::list<OwnedAttribute>	_attributes;
	std::list<AnyChangeExpression>	_anyExpressions;

	std::string				_currentPackageID;
	std::string				_currentSubvertexID;
	std::string				_currentFunctionID;

	Level					_currentLevel;

	///////////////////////////////////////////////////////////////////////
	// XML-Kram
	int findPackage(std::string inStr, std::string diagrammName);

	int getElement(std::string inStr);

	bool getSubvertex(std::string inStr);

	bool getTransition(std::string inStr);

	int getSubElement(std::string inStr);

	int getSubSubElement(std::string inStr);

	bool getTrigger(std::string inStr);

	bool getEntry(std::string inStr);

	bool getExit(std::string inStr);

	bool getDoActivity(std::string inStr);

	bool getOwnedComment(std::string inStr);

	bool getPackage(std::string inStr);

	bool getChangeExpression(std::string inStr);

	bool getOwnedAttribute(std::string inStr);

	bool getDefaultValue(std::string inStr);

	bool getAnyReceiveEvent(std::string inStr);

	// Gibt zurück, ob ein Element beendet ist oder nicht
	bool isEndOfElement(std::string inStr);

	/* Liefert die Attribute eines Elementes zurück
	 @param inStr - die aus der Datei gelesene Zeile
	 @param attribute - Bezeichnung des Attributes, nachdem gesucht wird
	 @return - den Wert des Attributes als String
	 */
	std::string getAttribute(std::string inStr, std::string attribute);

	/////////////////////////////////////////////////////////////////////////
	// Zu erstelen des Zustandsautomaten
	bool createAutomat(FiniteStateMachine* destination);

	std::string getStateType(std::string id);

	std::string getState(std::string id);

	/*
	 Gibt die Entry Function zu einem Zustand State zurück.
	 Ist keine vorhanden kommt eine Leerer String zurück
	 */
	std::string getEntryFunction(std::string stateID);

	/*
	 Gibt die ID der Entry Function zu einem Zustand State zurück.
	 Ist keine ID vorhanden kommt eine Leerer String zurück
	 */
	std::string getEntryFunctionID(std::string stateID);

	/*
	 Gibt die Exit Function zu einem Zustand State zurück.
	 Ist keine vorhanden kommt eine Leerer String zurück
	 */
	std::string getExitFunction(std::string stateID);

	/*
	 Gibt die ID der Exit Function zu einem Zustand State zurück.
	 Ist keine vorhanden kommt eine Leerer String zurück
	 */
	std::string getExitFunctionID(std::string stateID);

	/*
	 Gibt die Do Function zu einem Zustand State zurück.
	 Ist keine vorhanden kommt eine Leerer String zurück
	 */
	std::string getDoFunction(std::string stateID);

	/*
	 Gibt die ID einer Do Function zu einem Zustand State zurück.
	 Ist keine vorhanden kommt eine Leerer String zurück
	 */
	std::string getDoFunctionID(std::string stateID);

	/*
	 Gibt eine Liste mit allen Attributen einer Funktion zurück
	 */
	StateFunctionAttributeList getAttributesOfFunction(std::string functionID);

	/*
	 Gibt den Kommentar zu einem Zustand zurück.
	 Ein leeren String, falls kein Kommentar vorhanden ist.
	 */
	std::string getComment(std::string stateID);

	/*
	 Liefert die Transitionen zu einem Zustand
	 @param string id - String mit der ID des Zustands, zu dem die Transitionen gesucht werden.
	 @param String mit dem ID des Zustandes, zudem die Transition erfolgt
	 */
	std::string getTransitionOperation(std::string id);

	/////////////////////////////////////////////////////////////////////////
	// Diese Funktion verbindet die Funktionen mit den Zustandsautomenten
	virtual void setFunction(std::string stateName, std::string functionname, std::string parameter1, StateFunctionAttributeList attribute_list, StateOperationType type);

public:
	FiniteStateMachineBuilder();

	/*
	 Erstellt eine Zustandsmaschine auf Basis eines UML 2.0 Zustandsdiagramms.
	 @param umlfile - string mit dem Filenamen des UML 2.0 Files
	 @param diagrammname - Name des UML 2.0 Diagramms, indem das Zustandsmodell enthalten ist
	 @param destination - Poiner einer FiniteStateMachine, in der das Diagramm erstellt werden soll
	*/
	bool build(std::string umlfile, std::string diagrammname, FiniteStateMachine* destination);

};

}


text:
package ru.rzaharov.models;

import lombok.Data;

import javax.persistence.*;

@Entity(name = "roless")
@Data
public class Role {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private int id;

    @Column(name = "role")
    private String role;

}


text:
"""Additional help about CRC32C and installing crcmod."""

from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals

from gslib.help_provider import HelpProvider

_DETAILED_HELP_TEXT = ("""
OVERVIEW
  Google Cloud Storage provides a cyclic redundancy check (CRC) header that
  allows clients to verify the integrity of object contents. For non-composite
  objects Google Cloud Storage also provides an MD5 header to allow clients to
  verify object integrity, but for composite objects only the CRC is available.
  gsutil automatically performs integrity checks on all uploads and downloads.
  Additionally, you can use the ``gsutil hash`` command to calculate a CRC for
  any local file.

  The CRC variant used by Google Cloud Storage is called CRC32C (Castagnoli),
  which is not available in the standard Python distribution. The implementation
  of CRC32C used by gsutil is provided by a third-party Python module called
  `crcmod <https://pypi.python.org/pypi/crcmod>`_.

  The crcmod module contains a pure-Python implementation of CRC32C, but using
  it results in very poor performance. A Python C extension is also provided by
  crcmod, which requires compiling into a binary module for use. gsutil ships
  with a precompiled crcmod C extension for macOS; for other platforms, see
  the installation instructions below.

  At the end of each copy operation, the ``gsutil cp`` and ``gsutil rsync``
  commands validate that the checksum of the source file/object matches the
  checksum of the destination file/object. If the checksums do not match,
  gsutil will delete the invalid copy and print a warning message. This very
  rarely happens, but if it does, please contact gs-team@google.com.

CONFIGURATION
  To determine if the compiled version of crcmod is available in your Python
  environment, you can inspect the output of the ``gsutil version`` command for
  the "compiled crcmod" entry:

    $ gsutil version -l
    ...
    compiled crcmod: True
    ...

  If your crcmod library is compiled to a native binary, this value will be
  True. If using the pure-Python version, the value will be False.

  To control gsutil's behavior in response to crcmod's status, you can set the
  "check_hashes" configuration variable. For details on this variable, see the
  surrounding comments in your boto configuration file. If "check_hashes"
  is not present in your configuration file, rerun ``gsutil config`` to
  regenerate the file.

INSTALLATION
  These installation instructions assume that:

  -  You have ``pip`` installed. Consult the `pip installation instructions
     <https://pip.pypa.io/en/stable/installing/>`_ for details on how
     to install ``pip``.
  -  Your installation of ``pip`` can be found in your ``PATH`` environment
     variable. If it cannot, you may need to replace ``pip`` in the commands
     below with the full path to the executable.
  -  You are installing the crcmod package for use with your system installation
     of Python, and thus use the ``sudo`` command. If installing crcmod for a
     different Python environment (e.g. in a virtualenv), you should omit
     ``sudo`` from the commands below.

  CentOS, RHEL, and Fedora
  ------------------------

  Note that CentOS 6 and similar variants use Python 2.6 by default, which will
  not run gsutil. To enable Python 2.7 and compile/install crcmod on CentOS 6:

    sudo su  # Run as root; need shell session with Python 2.7 enabled
    yum install gcc python-devel python-setuptools redhat-rpm-config
    source /opt/rh/python27/enable  # Make default `python` executable use 2.7.X
    python -m pip install -U pip  # Upgrade old default version of pip
    python -m pip uninstall crcmod
    python -m pip install --no-cache-dir -U crcmod
    exit  # Exit su session

  To compile and install crcmod on OS versions that use Python 2.7 by default:

    sudo yum install gcc python-devel python-setuptools redhat-rpm-config
    sudo pip uninstall crcmod
    sudo pip install --no-cache-dir -U crcmod

  Debian and Ubuntu
  -----------------

  To compile and install crcmod:

    sudo apt-get install gcc python-dev python-setuptools
    sudo pip uninstall crcmod
    sudo pip install --no-cache-dir -U crcmod

  Enterprise SUSE
  -----------------

  To compile and install crcmod:

    sudo zypper install gcc python-devel
    sudo pip uninstall crcmod
    sudo pip install --no-cache-dir -U crcmod

  macOS
  -----

  gsutil distributes a pre-compiled version of crcmod for macOS, so you shouldn't
  need to compile and install it yourself. If for some reason the pre-compiled
  version is not being detected, please let the Google Cloud Storage team know
  (see ``gsutil help support``).

  To compile manually on macOS, you will first need to install
  `XCode <https://developer.apple.com/xcode/>`_ and then run:

    sudo pip install -U crcmod

  Windows
  -------

  An installer is available for the compiled version of crcmod from the Python
  Package Index (PyPi) at the following URL:

  https://pypi.python.org/pypi/crcmod/1.7

  MSI installers are available for the 32-bit versions of Python 2.7.
  Make sure to install to a 32-bit Python directory. If you're using 64-bit
  Python it won't work with 32-bit crcmod, and instead you'll need to install
  32-bit Python in order to use crcmod.

  Note: If you have installed crcmod and gsutil hasn't detected it, it may have
  been installed to the wrong directory. It should be located at
  <python_dir>\\files\\Lib\\site-packages\\crcmod\\

  In some cases the installer will incorrectly install to
  <python_dir>\\Lib\\site-packages\\crcmod\\

  Manually copying the crcmod directory to the correct location should resolve
  the issue.
""")

class CommandOptions(HelpProvider):
  """Additional help about CRC32C and installing crcmod."""

  # Help specification. See help_provider.py for documentation.
  help_spec = HelpProvider.HelpSpec(
      help_name='crc32c',
      help_name_aliases=['crc32', 'crc', 'crcmod'],
      help_type='additional_help',
      help_one_line_summary='CRC32C and Installing crcmod',
      help_text=_DETAILED_HELP_TEXT,
      subcommand_help_text={},
  )


text:
namespace MvcApp.Services.Contracts
{
    using System.Linq;

    using MvcApp.Data.Models;

    public interface IDirectorsService
    {
        Director GetById(int directorId);

        IQueryable<Director> GetAll();

        int SaveChanges();
    }
}