text:
package jdk.internal.util.xml;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

/**
 * Basic XMLStreamWriter for writing simple XML files such as those
 * defined in java.util.Properties
 *
 * This is a subset of javax.xml.stream.XMLStreamWriter
 *
 * @author Joe Wang
 */
public  interface XMLStreamWriter {

    //Defaults the XML version to 1.0, and the encoding to utf-8
    public static final String DEFAULT_XML_VERSION = "1.0";
    public static final String DEFAULT_ENCODING = "UTF-8";
    public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;

    /**
     * Writes a start tag to the output.  All writeStartElement methods
     * open a new scope in the internal namespace context.  Writing the
     * corresponding EndElement causes the scope to be closed.
     * @param localName local name of the tag, may not be null
     * @throws XMLStreamException
     */
    public void writeStartElement(String localName) throws XMLStreamException;

    /**
     * Writes an empty element tag to the output
     * @param localName local name of the tag, may not be null
     * @throws XMLStreamException
     */
    public void writeEmptyElement(String localName) throws XMLStreamException;

    /**
     * Writes an end tag to the output relying on the internal
     * state of the writer to determine the prefix and local name
     * of the event.
     * @throws XMLStreamException
     */
    public void writeEndElement() throws XMLStreamException;

    /**
     * Closes any start tags and writes corresponding end tags.
     * @throws XMLStreamException
     */
    public void writeEndDocument() throws XMLStreamException;

    /**
     * Close this writer and free any resources associated with the
     * writer.  This must not close the underlying output stream.
     * @throws XMLStreamException
     */
    public void close() throws XMLStreamException;

    /**
     * Write any cached data to the underlying output mechanism.
     * @throws XMLStreamException
     */
    public void flush() throws XMLStreamException;

    /**
     * Writes an attribute to the output stream without
     * a prefix.
     * @param localName the local name of the attribute
     * @param value the value of the attribute
     * @throws IllegalStateException if the current state does not allow Attribute writing
     * @throws XMLStreamException
     */
    public void writeAttribute(String localName, String value)
            throws XMLStreamException;

    /**
     * Writes a CData section
     * @param data the data contained in the CData Section, may not be null
     * @throws XMLStreamException
     */
    public void writeCData(String data) throws XMLStreamException;

    /**
     * Write a DTD section.  This string represents the entire doctypedecl production
     * from the XML 1.0 specification.
     *
     * @param dtd the DTD to be written
     * @throws XMLStreamException
     */
    public void writeDTD(String dtd) throws XMLStreamException;

    /**
     * Write the XML Declaration. Defaults the XML version to 1.0, and the encoding to utf-8
     * @throws XMLStreamException
     */
    public void writeStartDocument() throws XMLStreamException;

    /**
     * Write the XML Declaration. Defaults the encoding to utf-8
     * @param version version of the xml document
     * @throws XMLStreamException
     */
    public void writeStartDocument(String version) throws XMLStreamException;

    /**
     * Write the XML Declaration.  Note that the encoding parameter does
     * not set the actual encoding of the underlying output.  That must
     * be set when the instance of the XMLStreamWriter is created using the
     * XMLOutputFactory
     * @param encoding encoding of the xml declaration
     * @param version version of the xml document
     * @throws XMLStreamException If given encoding does not match encoding
     * of the underlying stream
     */
    public void writeStartDocument(String encoding, String version)
        throws XMLStreamException;

    /**
     * Write text to the output
     * @param text the value to write
     * @throws XMLStreamException
     */
    public void writeCharacters(String text) throws XMLStreamException;

    /**
     * Write text to the output
     * @param text the value to write
     * @param start the starting position in the array
     * @param len the number of characters to write
     * @throws XMLStreamException
     */
    public void writeCharacters(char[] text, int start, int len)
        throws XMLStreamException;
}


text:
TODO: Write a gem description

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'google_intraday'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install google_intraday

## Usage

```ruby
data = GoogleIntraday::Client.fetch_6s_ticks("GOOG")
day = GoogleIntraday::Day.build(data)

day.to_csv
day.to_hash
```

## Contributing

1. Fork it ( https://github.com/[my-github-username]/google_intraday/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

redpajama_set_name: RedPajamaGithub


text:
Miogen.require(['Component.BaseComponent',
                'Component.Textbox',
                'Component.Dropdown',
                'Component.Checkbox'], function () {

    Miogen.define('Component.DataField', Miogen.Component.BaseComponent.extend({

        field: null,
        overrideDefaultCheckbox: null,
        data: null,

        construct: function (cfg) {
            var config = {
                data: null
            };

            Miogen.mixIn(config, cfg);

            this.data = cfg.data;

            this._super(config);
        },

        build: function (cb) {
            var label, t = this, dataType, dataQuery, required, localValue;

            this.el = $('

');
            required = this.data.isRequired();
            dataType = this.data.getType();

            if (dataType !== 'boolean' || !required) {
                // Checkboxes doesn't have separate labels as it's in the control
                label = $('');
                label.text(this.data.getPrompt());
                this.el.append(label);
            }

            // If it's not a boolean and not required, set the override default checkbox
            if (dataType !== 'boolean' && !required) {
                this.overrideDefaultCheckbox = new Miogen.Component.Checkbox({
                    label: 'Override default',
                    checked: this.data.getValue() !== null
                });
                this.addComponent(this.overrideDefaultCheckbox);
            }

            switch (dataType) {
                case 'boolean': {
                    if (required) {
                        this.field = new Miogen.Component.Checkbox({
                            label: this.data.getPrompt(),
                            checked: this.data.getValue()
                        });
                    }
                    else {
                        // It's not required, so we have 3 states, Default, Yes, No
                        this.field = new Miogen.Component.Dropdown({
                            value: this.data.getValue() === null ? '' : (this.data.getValue() ? 'true' : 'false'), // Null means Default
                            options: [
                                {value: '', label: 'Default (' + (this.data.getInheritedValue(false) ? 'Yes' : 'No') + ')'},
                                {value: 'true', label: 'Yes'},
                                {value: 'false', label: 'No'}
                            ]
                        });
                    }
                    break;
                }
                case 'text': {
                    this.field = new Miogen.Component.Textbox({
                        value: this.data.getValue(),
                        disabled: this.data.isReadOnly()
                    });
                    break;
                }
                case 'numeric': {
                    // TODO: Use a number stepper and have numeric validation
                    this.field = new Miogen.Component.Textbox({
                        value: this.data.getValue(),
                        disabled: this.data.isReadOnly()
                    });
                    break;
                }
                case 'uri': {
                    this.field = new Miogen.Component.Dropdown({
                        value: this.data.getValue()
                    });
                    break;
                }
                default: {
                    this.field = new Miogen.Component.Textbox({
                        value: this.data.getValue(),
                        disabled: true
                    });
                }
            }

            Miogen.bind(t, this.field, 'onChange', function (value) {
                if (dataType === 'boolean' && !required) {
                    // It can be null, true, false
                    if (value === '') {
                        value = null;
                    }
                    else {
                        value = value === 'true';
                    }
                }
                localValue = value;
                t.data.setValue(value);
            });

            // Watch for changes to the field
            Miogen.bind(t, this.data.getItem(), 'onValueChange', function (attribute, value) {
                if (attribute === t.data.getAttribute() + '.value') {
                    if (dataType === 'boolean' && !required) {
                        // Handle the special case for booleans
                        if (value === null) {
                            value = '';
                        }
                        else {
                            value = value ? 'true' : 'false';
                        }
                    }

                    // If we have an override checkbox, make sure that is enabled before we update the display value
                    if (t.overrideDefaultCheckbox !== null) {
                        if (value === null && t.overrideDefaultCheckbox.attr('value') === true) {
                            t.overrideDefaultCheckbox.attr('value', false); // We are going back to the not overriding
                            t.field.attr('disabled', true);
                            t.field.attr('value', t.data.getInheritedValue());
                        }
                        else {
                            if (value !== null && !t.overrideDefaultCheckbox.attr('value')) {
                                // We are overriding the value
                                t.field.attr('disabled', false);
                                t.overrideDefaultCheckbox.attr('value', true);
                            }

                            // Only set the value if it's different and is not null (as the text box value will be the inherited one)
                            if (t.field.attr('value') !== value && (t.overrideDefaultCheckbox.attr('value') !== false && value !== null)) {
                                t.field.attr('value', value);
                            }
                        }
                    }
                    else {
                        if (t.field.attr('value') !== value) {
                            t.field.attr('value', value);
                        }
                    }
                }
            });

            // Bind to the override default checkbox to set the real data field to the appropriate states
            if (this.overrideDefaultCheckbox !== null) {
                localValue = this.data.getValue();
                if (this.data.getValue() === null) {
                    // Disable the field
                    this.field.attr('disabled', true);
                    this.field.attr('value', t.data.getInheritedValue());
                }

                Miogen.bind(t, this.overrideDefaultCheckbox, 'onChange', function (value) {
                    if (value) {
                        if (localValue === null) {
                            localValue = t.data.getDefaultValue(''); // Get the default value
                        }

                        t.field.attr('disabled', false);
                        t.field.attr('value', localValue);
                        t.data.setValue(localValue);
                    }
                    else {
                        t.field.attr('disabled', true);
                        t.field.attr('value', t.data.getInheritedValue());
                        t.data.setValue(null);
                    }
                });
            }

            this.addComponent(this.field);

            // See if we need to load the data
            dataQuery = this.data.getQuery();
            if (dataQuery !== null) {
                // Lookup the data
                Miogen.getViewModel().get({
                    url: dataQuery,
                    success: function (doc) {
                        $.each(doc.getItems(), function (index, item) {
                            t.field.addOption(item.getUri(), item.getField(t.data.getPromptField()).getValue());
                        });

                        t.field.build(function () {
                            cb.call(t);
                        });
                    },
                    error: function () {
                        //console.log('Unable to load data', arguments);
                    }
                });
            }
            else {
                // No query lookup, just build it
                this.field.build(function () {
                    if (t.overrideDefaultCheckbox !== null) {
                        t.overrideDefaultCheckbox.build(function () {
                            cb.call(t);
                        });
                    }
                    else {
                        cb.call(t);
                    }
                });
            }
        },

        destroy: function () {
            Miogen.unbind(this, this.field, 'onChange');
            Miogen.unbind(this, this.data.getItem(), 'onValueChange');
            this._super();
        }

    }));

});


text:
(function(){
  'use strict';

  // Prepare the 'maindata' module for subsequent registration of controllers and delegates
  angular.module('maindata', [ 'ngMaterial' ]);

})();


text:
package com.zakgof.velvetdb.serialize;

import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.util.List;

import org.mapdb.elsa.ElsaMaker;
import org.mapdb.elsa.ElsaSerializer;
import com.zakgof.db.velvet.ISerializer;
import com.zakgof.db.velvet.IUpgrader;
import com.zakgof.db.velvet.VelvetException;

public class ElsaVelvetSerializer implements ISerializer {

    private ElsaSerializer elsa;

    public ElsaVelvetSerializer() {
        this(new ElsaMaker().make());
    }

    public ElsaVelvetSerializer(ElsaSerializer elsa) {
        this.elsa = elsa;
    }

    @Override
    public <T> byte[] serialize(T object, Class<T> clazz) {
        ByteArrayOutputStream bas = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bas);
        try {
            elsa.serialize(dos, object);
        } catch (IOException e) {
            throw new VelvetException(e);
        }
        return bas.toByteArray();
    }

    @Override
    public <T> T deserialize(InputStream stream, Class<T> clazz) {
        DataInputStream in = new DataInputStream(stream);
        T object;
        try {
            object = elsa.deserialize(in);
        } catch (IOException e) {
            throw new VelvetException(e);
        }
        return object;
    }

    public ElsaSerializer getElsa() {
        return elsa;
    }

    @Override
    public void setUpgrader(IUpgrader upgrader) {
        throw new UnsupportedOperationException();
    }

    @Override
    public List<Field> getFields(Class<?> clazz) {
        throw new UnsupportedOperationException();
    }

}


text:
// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GTKMM_ABOUTDIALOG_H
#define _GTKMM_ABOUTDIALOG_H

#include <gtkmmconfig.h>

#include <glibmm.h>

#include <gtkmm/dialog.h>
//#include <glibmm/listhandle.h>

#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GtkAboutDialog GtkAboutDialog;
typedef struct _GtkAboutDialogClass GtkAboutDialogClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

namespace Gtk
{ class AboutDialog_Class; } // namespace Gtk
namespace Gtk
{

/** The AboutDialog offers a simple way to display information about a program like its logo, name, copyright,
 * website and license. It is also possible to give credits to the authors, documenters, translators and artists
 * who have worked on the program. An about dialog is typically opened when the user selects the About option
 * from the Help menu. All parts of the dialog are optional.
 *
 * About dialogs often contain links and email addresses. Gtk::AboutDialog supports this by offering global
 * hooks, which are called when the user clicks on a link or email address, see set_email_hook() and
 * set_url_hook(). Email addresses in the authors, documenters and artists properties are recognized by looking
 * for <user@host>, URLs are recognized by looking for http://url, with the URL extending to the next space,
 * tab or line break.
 *
 * An AboutDialog looks like this:
 * @image html aboutdialog1.png
 *
 * @ingroup Dialogs
 */

class AboutDialog : public Dialog
{
  public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
  typedef AboutDialog CppObjectType;
  typedef AboutDialog_Class CppClassType;
  typedef GtkAboutDialog BaseObjectType;
  typedef GtkAboutDialogClass BaseClassType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

  virtual ~AboutDialog();

#ifndef DOXYGEN_SHOULD_SKIP_THIS

private:
  friend class AboutDialog_Class;
  static CppClassType aboutdialog_class_;

  // noncopyable
  AboutDialog(const AboutDialog&);
  AboutDialog& operator=(const AboutDialog&);

protected:
  explicit AboutDialog(const Glib::ConstructParams& construct_params);
  explicit AboutDialog(GtkAboutDialog* castitem);

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
  static GType get_type()      G_GNUC_CONST;

  static GType get_base_type() G_GNUC_CONST;
#endif

  ///Provides access to the underlying C GtkObject.
  GtkAboutDialog*       gobj()       { return reinterpret_cast<GtkAboutDialog*>(gobject_); }

  ///Provides access to the underlying C GtkObject.
  const GtkAboutDialog* gobj() const { return reinterpret_cast<GtkAboutDialog*>(gobject_); }

public:
  //C++ methods used to invoke GTK+ virtual functions:

protected:
  //GTK+ Virtual Functions (override these to change behaviour):

  //Default Signal Handlers::

private:

public:
  AboutDialog();

#ifndef GTKMM_DISABLE_DEPRECATED

  /** Returns the program name displayed in the about dialog.
   *
   * @newin{2,6}
   *
   * Deprecated: 2.12: Use get_program_name() instead.
   * @return The program name. The string is owned by the about
   * dialog and must not be modified.
   */
  Glib::ustring get_name() const;
#endif // GTKMM_DISABLE_DEPRECATED

#ifndef GTKMM_DISABLE_DEPRECATED

  /** Sets the name to display in the about dialog.
   * If this is not set, it defaults to Glib::get_application_name().
   *
   * @newin{2,6}
   *
   * Deprecated: 2.12: Use set_program_name() instead.
   * @param name The program name.
   */
  void set_name(const Glib::ustring& name);
#endif // GTKMM_DISABLE_DEPRECATED

  /** Return value: The program name.
   * @return The program name.
   *
   * @newin{2,12}.
   */
  Glib::ustring get_program_name() const;

  /** Sets the name to display in the about dialog.
   * If this is not set, it defaults to Glib::get_application_name().
   *
   * @newin{2,12}
   * @param name The program name.
   */
  void set_program_name(const Glib::ustring& name);

  /** Returns the version string.
   *
   * @newin{2,6}
   * @return The version string. The string is owned by the about
   * dialog and must not be modified.
   */
  Glib::ustring get_version() const;

  /** Sets the version string to display in the about dialog.
   *
   * @newin{2,6}
   * @param version The version string.
   */
  void set_version(const Glib::ustring& version);

  /** Returns the copyright string.
   *
   * @newin{2,6}
   * @return The copyright string. The string is owned by the about
   * dialog and must not be modified.
   */
  Glib::ustring get_copyright() const;

  /** Sets the copyright string to display in the about dialog.
   * This should be a short string of one or two lines.
   *
   * @newin{2,6}
   * @param copyright (allow-none) the copyright string.
   */
  void set_copyright(const Glib::ustring& copyright);

  /** Returns the comments string.
   *
   * @newin{2,6}
   * @return The comments. The string is owned by the about
   * dialog and must not be modified.
   */
  Glib::ustring get_comments() const;

  /** Sets the comments string to display in the about dialog.
   * This should be a short string of one or two lines.
   *
   * @newin{2,6}
   * @param comments A comments string.
   */
  void set_comments(const Glib::ustring& comments);

  /** Returns the license information.
   *
   * @newin{2,6}
   * @return The license information. The string is owned by the about
   * dialog and must not be modified.
   */
  Glib::ustring get_license() const;

  /** Sets the license information to be displayed in the secondary
   * license dialog. If @a license is <tt>0</tt>, the license button is
   * hidden.
   *
   * @newin{2,6}
   * @param license The license information or <tt>0</tt>.
   */
  void set_license(const Glib::ustring& license);

  /** Returns the website URL.
   *
   * @newin{2,6}
   * @return The website URL. The string is owned by the about
   * dialog and must not be modified.
   */
  Glib::ustring get_website() const;

  /** Sets the URL to use for the website link.
   *
   * Note that that the hook functions need to be set up
   * before calling this function.
   *
   * @newin{2,6}
   * @param website A URL string starting with "http://".
   */
  void set_website(const Glib::ustring& website);

  /** Return value: The label used for the website link.
   * @return The label used for the website link.
   *
   * @newin{2,6}.
   */
  Glib::ustring get_website_label() const;

  /** Sets the label to be used for the website link.
   * It defaults to the website URL.
   *
   * @newin{2,6}
   * @param website_label The label used for the website link.
   */
  void set_website_label(const Glib::ustring& website_label);

  /** Returns the string which are displayed in the authors tab
   * of the secondary credits dialog.
   *
   * @newin{2,6}
   * @return A <tt>0</tt>-terminated string array containing
   * the authors. The array is owned by the about dialog
   * and must not be modified.
   */
  Glib::StringArrayHandle get_authors() const;

  /** Sets the strings which are displayed in the authors tab
   * of the secondary credits dialog.
   *
   * @newin{2,6}
   * @param authors A <tt>0</tt>-terminated array of strings.
   */
  void set_authors(const Glib::StringArrayHandle& authors) const;

  /** Returns the string which are displayed in the documenters
   * tab of the secondary credits dialog.
   *
   * @newin{2,6}
   * @return A <tt>0</tt>-terminated string array containing
   * the documenters. The array is owned by the about dialog
   * and must not be modified.
   */
  Glib::StringArrayHandle get_documenters() const;

  /** Sets the strings which are displayed in the documenters tab
   * of the secondary credits dialog.
   *
   * @newin{2,6}
   * @param documenters A <tt>0</tt>-terminated array of strings.
   */
  void set_documenters(const Glib::StringArrayHandle& documenters);

  /** Returns the string which are displayed in the artists tab
   * of the secondary credits dialog.
   *
   * @newin{2,6}
   * @return A <tt>0</tt>-terminated string array containing
   * the artists. The array is owned by the about dialog
   * and must not be modified.
   */
  Glib::StringArrayHandle get_artists() const;

  /** Sets the strings which are displayed in the artists tab
   * of the secondary credits dialog.
   *
   * @newin{2,6}
   * @param artists A <tt>0</tt>-terminated array of strings.
   */
  void set_artists(const Glib::StringArrayHandle& artists);

  /** Returns the translator credits string which is displayed
   * in the translators tab of the secondary credits dialog.
   *
   * @newin{2,6}
   * @return The translator credits string. The string is
   * owned by the about dialog and must not be modified.
   */
  Glib::ustring get_translator_credits() const;

  /** Sets the translator credits string which is displayed in
   * the translators tab of the secondary credits dialog.
   *
   * The intended use for this string is to display the translator
   * of the language which is currently used in the user interface.
   * Using gettext(), a simple way to achieve that is to mark the
   * string for translation:
   * |[
   * gtk_about_dialog_set_translator_credits (about, _("translator-credits"));
   * ]|
   * It is a good idea to use the customary msgid "translator-credits" for this
   * purpose, since translators will already know the purpose of that msgid, and
   * since Gtk::AboutDialog will detect if "translator-credits" is untranslated
   * and hide the tab.
   *
   * @newin{2,6}
   * @param translator_credits The translator credits.
   */
  void set_translator_credits(const Glib::ustring& translator_credits);

  /** Returns the pixbuf displayed as logo in the about dialog.
   *
   * @newin{2,6}
   * @return The pixbuf displayed as logo. The pixbuf is
   * owned by the about dialog. If you want to keep a reference
   * to it, you have to call Glib::object_ref() on it.
   */
  Glib::RefPtr<Gdk::Pixbuf> get_logo();

  /** Returns the pixbuf displayed as logo in the about dialog.
   *
   * @newin{2,6}
   * @return The pixbuf displayed as logo. The pixbuf is
   * owned by the about dialog. If you want to keep a reference
   * to it, you have to call Glib::object_ref() on it.
   */
  Glib::RefPtr<const Gdk::Pixbuf> get_logo() const;

  /** Sets the pixbuf to be displayed as logo in the about dialog.
   * If it is <tt>0</tt>, the default window icon set with
   * Gtk::Window::set_default_icon() will be used.
   *
   * @newin{2,6}
   * @param logo A Gdk::Pixbuf, or <tt>0</tt>.
   */
  void set_logo(const Glib::RefPtr<Gdk::Pixbuf>& logo);

  /** Returns the icon name displayed as logo in the about dialog.
   *
   * @newin{2,6}
   * @return The icon name displayed as logo. The string is
   * owned by the dialog. If you want to keep a reference
   * to it, you have to call Glib::strdup() on it.
   */
  Glib::ustring get_logo_icon_name() const;

  /** Sets the pixbuf to be displayed as logo in the about dialog.
   * If it is <tt>0</tt>, the default window icon set with
   * Gtk::Window::set_default_icon() will be used.
   *
   * @newin{2,6}
   * @param icon_name An icon name, or <tt>0</tt>.
   */
  void set_logo_icon_name(const Glib::ustring& icon_name);

  /** Returns whether the license text in @a about is
   * automatically wrapped.
   *
   * @newin{2,8}
   * @return <tt>true</tt> if the license text is wrapped.
   */
  bool get_wrap_license() const;

  /** Sets whether the license text in @a about is
   * automatically wrapped.
   *
   * @newin{2,8}
   * @param wrap_license Whether to wrap the license.
   */
  void set_wrap_license(bool wrap_license);

  /** For instance,
   * void on_activate_link_url(AboutDialog& about_dialog, const Glib::ustring& link);
   */
  typedef sigc::slot<void, AboutDialog& /* about_dialog */, const Glib::ustring& /* link */> SlotActivateLink;

  /** Installs a global callback to be called whenever the user activates an email link in an about dialog.
   * @param slot A function or method to call when an email link is activated.
   */
  static void set_email_hook(const SlotActivateLink& slot);

  /** Installs a global callback to be called whenever the user activates a URL link in an about dialog.
   * @param slot A function or method to call when a URL link is activated.
   */
  static void set_url_hook(const SlotActivateLink& slot);

//TODO: Deprecate this, because it conflicts with the property in GtkWidget, and has been removed in GTK+ 2.12.
//If this could not have been used without an error, then remove it:
  #ifdef GLIBMM_PROPERTIES_ENABLED
/** The name of the widget.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<Glib::ustring> property_name() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** The name of the widget.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<Glib::ustring> property_name() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** The name of the program. If this is not set, it defaults to g_get_application_name().
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<Glib::ustring> property_program_name() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** The name of the program. If this is not set, it defaults to g_get_application_name().
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<Glib::ustring> property_program_name() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** The version of the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<Glib::ustring> property_version() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** The version of the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<Glib::ustring> property_version() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** Copyright information for the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<Glib::ustring> property_copyright() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** Copyright information for the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<Glib::ustring> property_copyright() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** Comments about the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<Glib::ustring> property_comments() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** Comments about the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<Glib::ustring> property_comments() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** The URL for the link to the website of the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<Glib::ustring> property_website() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** The URL for the link to the website of the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<Glib::ustring> property_website() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** The label for the link to the website of the program. If this is not set, it defaults to the URL.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<Glib::ustring> property_website_label() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** The label for the link to the website of the program. If this is not set, it defaults to the URL.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<Glib::ustring> property_website_label() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** The license of the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<Glib::ustring> property_license() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** The license of the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<Glib::ustring> property_license() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** List of authors of the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<Glib::StringArrayHandle> property_authors() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** List of authors of the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<Glib::StringArrayHandle> property_authors() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** List of people documenting the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<Glib::StringArrayHandle> property_documenters() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** List of people documenting the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<Glib::StringArrayHandle> property_documenters() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** Credits to the translators. This string should be marked as translatable.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<Glib::StringArrayHandle> property_translator_credits() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** Credits to the translators. This string should be marked as translatable.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<Glib::StringArrayHandle> property_translator_credits() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** List of people who have contributed artwork to the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<Glib::StringArrayHandle> property_artists() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** List of people who have contributed artwork to the program.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<Glib::StringArrayHandle> property_artists() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** A logo for the about box. If this is not set, it defaults to gtk_window_get_default_icon_list().
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> > property_logo() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** A logo for the about box. If this is not set, it defaults to gtk_window_get_default_icon_list().
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gdk::Pixbuf> > property_logo() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** A named icon to use as the logo for the about box.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<Glib::ustring> property_logo_icon_name() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** A named icon to use as the logo for the about box.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<Glib::ustring> property_logo_icon_name() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

  #ifdef GLIBMM_PROPERTIES_ENABLED
/** Whether to wrap the license text.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy<bool> property_wrap_license() ;
#endif //#GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
/** Whether to wrap the license text.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
   * the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly<bool> property_wrap_license() const;
#endif //#GLIBMM_PROPERTIES_ENABLED

};

} // namespace Gtk

namespace Glib
{
  /** A Glib::wrap() method for this object.
   *
   * @param object The C instance.
   * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
   * @result A C++ instance that wraps this C instance.
   *
   * @relates Gtk::AboutDialog
   */
  Gtk::AboutDialog* wrap(GtkAboutDialog* object, bool take_copy = false);
} //namespace Glib

#endif /* _GTKMM_ABOUTDIALOG_H */


text:
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

# See: http://effbot.org/tkinterbook/menu.htm

# "Popup menu are explicitly displayed, using the post method."

# TODO: the popup menu should disapear when the user clic somewhere around...

import tkinter as tk

root = tk.Tk()

# The callback
def hello():
    print("Hello!")

# Create a popup menu
menu = tk.Menu(root, tearoff=0)
menu.add_command(label="Hello", command=hello)
menu.add_command(label="Quit", command=root.quit)

# Create a canvas
frame = tk.Frame(root, width=512, height=512)
frame.pack()

label = tk.Label(root, text="Use the mouse right button to show the popup menu")
label.pack(fill=tk.X, expand=1)

def popup(event):
    menu.post(event.x_root, event.y_root)  # Explicitely display the menu

# Attach popup to canvas
frame.bind("<Button-3>", popup)

root.mainloop()


text:
<?php

declare(strict_types=1);

namespace Kreait\Firebase\Exception\Database;

use Kreait\Firebase\Exception\DatabaseException;
use RuntimeException;

final class ApiConnectionFailed extends RuntimeException implements DatabaseException
{
}


text:
using System;
using System.Threading.Tasks;
using Orleans;
using Orleans.Streams;

namespace VoyageIntoDeadlocking.ImplicitSubscriptionsGrains
{
    [ImplicitStreamSubscription(ImplicitConstants.StreamNamespace)]
    public class ImplicitConsumerGrain : Grain, IImplicitConsumer
    {
        private bool ReceivedEvent { get; set; }

        public override async Task OnActivateAsync()
        {
            var streamProvider = GetStreamProvider(ImplicitConstants.ProviderName);
            var stream = streamProvider.GetStream<IEvent>(StreamIds.DataStreamId, ImplicitConstants.StreamNamespace);

            await stream.SubscribeAsync((@event, _) =>
                {
                    ReceivedEvent = true;
                    Console.WriteLine($"Next event received: '{@event.What}'");
                    return Task.CompletedTask;
                },
                exception =>
                {
                    Console.WriteLine($"Stream error: {exception.Message}");
                    return Task.CompletedTask;
                },
                () =>
                {
                    Console.WriteLine("Stream completed");
                    return Task.CompletedTask;
                });

            await base.OnActivateAsync();
        }

        public Task<bool> HasReceivedEvent()
        {
            return Task.FromResult(ReceivedEvent);
        }
    }
}


text:
const Canvas = require('canvas');
const Image = Canvas.Image;
const fs = require('fs');

class CanvasWriter {
    /**
     * Creates a CanvasWriter.
     * @param {Canvas} canvas Canvas to use.
     */
    constructor(canvas){
        /** Canvas of the CanvasWriter. */
        this.canvas = canvas;

        /** CanvasRenderingContext2D of the Canvas. */
        this.ctx = canvas.getContext('2d');
        this.ctx.save();

        /** The current y coord to write text on. */
        this.line = 0;

        /** The current line number. */
        this.lineNumber = 0;

        /** Text that has been written on the Canvas and the options used for them. */
        this.texts = [];
    }

    /** The first write operation on this CanvasWriter. */
    get firstWrite(){
        return this.texts[0];
    }

    /** The previous write operation on this CanvasWriter. */
    get lastWrite(){
        return this.texts.slice(-1)[0];
    }

    /** The current line count. */
    get lineCount(){
        return this.texts.length;
    }

    /** Lowest x value and highest x value in the text written. */
    get rangeX(){
        let furthest = this.texts.map(t => {
            if (t.writeOptions.rotate === 0 || !t.writeOptions.rotate) return t.x + t.measure.width;

            let pivot = 0;
            let x = t.x + t.measure.width;
            let y = t.y + t.measure.emHeightDescent;
            let angle = -t.writeOptions.rotate * Math.PI / 180;

            let rotatedX = pivot + (x - pivot) * Math.cos(angle) + (y - pivot) * Math.sin(angle);
            return rotatedX;
        }).sort((a, b) => a - b);

        return [furthest[0], furthest.slice(-1)[0]];
    }

    /** Lowest y value and highest y value in the text written. */
    get rangeY(){
        let furthest = this.texts.map(t => {
            if (t.writeOptions.rotate === 0 || !t.writeOptions.rotate) return t.y + t.measure.emHeightDescent;

            let pivot = 0;
            let x = t.x + t.measure.width;
            let y = t.y + t.measure.emHeightDescent;
            let angle = -t.writeOptions.rotate * Math.PI / 180;

            let rotatedY = pivot - (x - pivot) * Math.sin(angle) + (y - pivot) * Math.cos(angle);
            return rotatedY;
        }).sort((a, b) => a - b);

        return [furthest[0], furthest.slice(-1)[0]];
    }

    /**
     * Restores the drawing state. Recommended to use if you changed some options for other things and want to reset to default for writing text.
     * @return This CanvasWriter.
     */
    restore(){
        this.ctx.restore();
        return this;
    }

    /**
     * Draws a background.
     * @param {string|object} style Style to fill with. Can be a color, gradient, etc.
     * @return This CanvasWriter.
     */
    drawBackground(style){
        this.ctx.save();

        this.ctx.fillStyle = style;
        this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);

        this.ctx.restore();
        return this;
    }

    /**
     * Draws an image.
     * @param {Buffer} buffer A buffer.
     * @param {number} x x coordinate.
     * @param {number} y y coordinate.
     * @param {number} width The width.
     * @param {number} height The height.
     * @return This CanvasWriter.
     */
    drawImage(buffer, x, y, width, height){
        this.ctx.save();

        let image = new Image();
        image.src = buffer;
        this.ctx.drawImage(image, x, y, width, height);

        this.ctx.restore();
        return this;
    }

    /**
     * Draws a background image.
     * @param {Buffer} buffer A buffer.
     * @return This CanvasWriter.
     */
    drawBackgroundImage(buffer){
        return this.drawImage(buffer, 0, 0, this.canvas.width, this.canvas.height);
    }

    /**
     * Writes a line of text.
     * @param {string} text Text to write.
     * @param {WriteOptions} writeOptions Options for the drawing of the text.
     * @param {StrokeOptions} strokeOptions Options for the stroke of the text.
     * @return This CanvasWriter.
     */
    writeText(text, writeOptions = {}, strokeOptions){
        this.ctx.save();

        let offsetX = writeOptions.x || 5;
        let offsetY = writeOptions.y || 5;
        let breakSpacing = writeOptions.breakSpacing || 0;
        if (text !== '\n') breakSpacing = 0;

        let spacing = writeOptions.spacing || 0;
        if (this.line === 0) spacing = 0;

        this.ctx.font = writeOptions.font || '10px sans-serif';
        this.ctx.fillStyle = writeOptions.style || 'black';
        this.ctx.textAlign = writeOptions.align || 'left';
        this.ctx.globalAlpha = writeOptions.opacity || 1.0;
        this.ctx.rotate((writeOptions.rotate || 0) * Math.PI / 180);

        this.ctx.shadowColor = writeOptions.shadowColor;
        this.ctx.shadowOffsetX = writeOptions.shadowX || 0;
        this.ctx.shadowOffsetY = writeOptions.shadowY || 0;
        this.ctx.shadowBlur = writeOptions.shadowBlur || 0;

        let measure = this.ctx.measureText(text === '\n' ? '' : text);

        if (strokeOptions){
            this.ctx.strokeStyle = strokeOptions.style;
            this.ctx.lineWidth = strokeOptions.width;
            this.ctx.lineJoin = strokeOptions.join;

            let xSpace = (this.ctx.textAlign === 'center' ? 0 : measure.actualBoundingBoxLeft + this.ctx.lineWidth) + offsetX;
            let ySpace = this.line + measure.actualBoundingBoxAscent + this.ctx.lineWidth + spacing + breakSpacing + offsetY;

            this.texts.push({text, measure, line: this.line, lineNumber: this.lineNumber, x: xSpace, y: ySpace, writeOptions, strokeOptions});

            this.ctx.strokeText(text === '\n' ? '' : text, xSpace, ySpace);
            this.ctx.fillText(text === '\n' ? '' : text, xSpace, ySpace);
            this.line += measure.actualBoundingBoxAscent + measure.emHeightDescent + this.ctx.lineWidth + breakSpacing + spacing;
            this.lineNumber++;

            this.ctx.setTransform(1, 0, 0, 1, 0, 0);
            this.ctx.restore();

            return this;
        }

        let xSpace = (this.ctx.textAlign === 'center' ? 0 : measure.actualBoundingBoxLeft) + offsetX;
        let ySpace = this.line + measure.actualBoundingBoxAscent + spacing + breakSpacing + offsetY;

        this.texts.push({text, measure, line: this.line, lineNumber: this.lineNumber, x: xSpace, y: ySpace, writeOptions, strokeOptions});

        this.ctx.fillText(text === '\n' ? '' : text, xSpace, ySpace);
        this.line += measure.actualBoundingBoxAscent + measure.emHeightDescent + breakSpacing + spacing;
        this.lineNumber++;

        this.ctx.setTransform(1, 0, 0, 1, 0, 0);
        this.ctx.restore();

        return this;
    }

    /**
     * Writes multiple lines of text.
     * @param {string|Array} lines Lines to write, either in an array or separated by newlines.
     * @param {WriteOptions} writeOptions Options for the drawing of the text.
     * @param {StrokeOptions} strokeOptions Options for the stroke of the text.
     * @return This CanvasWriter.
     */
    writeLines(lines, writeOptions = {}, strokeOptions = {}){
        let texts = lines;
        if (typeof texts === 'string') texts = texts.split('\n').map(t => !t ? '' : t);

        let maxLines = writeOptions.maxLines;
        texts = texts.slice(0, maxLines);

        texts.forEach(t => this.writeText(t, writeOptions, strokeOptions));
        return this;
    }

    /**
     * Writes and wraps a line of text.
     * @param {string|Array} text Text to write.
     * @param {number} maxWidth Maximum text width.
     * @param {WriteOptions} writeOptions Options for the drawing of the text.
     * @param {StrokeOptions} strokeOptions Options for the stroke of the text.
     * @return This CanvasWriter.
     */
    writeWrapped(text, maxWidth = this.canvas.width, writeOptions = {}, strokeOptions){
        this.ctx.font = writeOptions.font || '10px sans-serif';
        let results = [];

        let reduceToFit = (text) => {
            let width = this.ctx.measureText(text).width;

            if (width > maxWidth){
                let section = text;
                let j = 1;

                while (this.ctx.measureText(section).width > maxWidth && section.length > 1){
                    section = section.slice(0, -1);
                    j += 1;
                }

                results.push(section);
                return reduceToFit(text.slice(-j + 1));
            }

            results.push(text);
        };

        reduceToFit(text);
        this.writeLines(results, writeOptions, strokeOptions);
        return this;
    }

    /**
     * Writes and wraps multiple lines of text.
     * @param {string|Array} lines Lines to write, either in an array or separated by newlines.
     * @param {number} maxWidth Maximum text width.
     * @param {WriteOptions} writeOptions Options for the drawing of the text.
     * @param {StrokeOptions} strokeOptions Options for the stroke of the text.
     * @return This CanvasWriter.
     */
    writeWrappedLines(lines, maxWidth = this.canvas.width, writeOptions = {}, strokeOptions){
        let texts = lines;
        if (typeof texts === 'string') texts = texts.split('\n').map(t => !t ? '' : t);

        texts.forEach(t => this.writeWrapped(t, maxWidth, writeOptions, strokeOptions));
        return this;
    }

    /**
     * Writes and wraps a line of text by whitespace.
     * @param {string|Array} text Text to write.
     * @param {number} maxWidth Maximum text width.
     * @param {WriteOptions} writeOptions Options for the drawing of the text.
     * @param {StrokeOptions} strokeOptions Options for the stroke of the text.
     * @return This CanvasWriter.
     */
    writeWordWrapped(text, maxWidth = this.canvas.width, writeOptions = {}, strokeOptions){
        this.ctx.font = writeOptions.font || '10px sans-serif';
        let results = [];

        let reduceToFit = (text) => {
            let width = this.ctx.measureText(text).width;

            if (width > maxWidth){
                let section = text;
                let j = 1;

                while (this.ctx.measureText(section).width > maxWidth && section.length > 1){
                    section = section.slice(0, -1);
                    j += 1;
                }

                results.push(section);
                return text.slice(-j + 1);
            }

            return text;
        };

        let splitToFit = (text) => {
            if (!text) return;

            let words = text.split(' ');
            let width = this.ctx.measureText(words.join(' ')).width;

            if (width > maxWidth){
                let section = words;
                let remainder = [];

                while (this.ctx.measureText(section.join(' ')).width > maxWidth && section.join(' ').length > 1){
                    if (section.length === 1){
                        let extra = reduceToFit(section.join(' '));
                        return splitToFit(extra + ' ' + remainder.join(' '));
                    }

                    remainder.splice(0, 0, section.pop());
                }

                results.push(section.join(' '));
                return splitToFit(remainder.join(' '));
            }

            results.push(text);
        };

        splitToFit(text);
        this.writeLines(results, writeOptions, strokeOptions);
        return this;
    }

    /**
     * Writes and wraps multiple lines of text by whitespace.
     * @param {string|Array} lines Lines to write, either in an array or separated by newlines.
     * @param {number} maxWidth Maximum text width.
     * @param {WriteOptions} writeOptions Options for the drawing of the text.
     * @param {StrokeOptions} strokeOptions Options for the stroke of the text.
     * @return This CanvasWriter.
     */
    writeWordWrappedLines(lines, maxWidth = this.canvas.width, writeOptions = {}, strokeOptions){
        let texts = lines;
        if (typeof texts === 'string') texts = texts.split('\n').map(t => !t ? '\n' : t);

        texts.forEach(t => this.writeWordWrapped(t, maxWidth, writeOptions, strokeOptions));
        return this;
    }

    /**
     * Shortcut to writeWordWrappedLines().
     * @param {string|Array} lines Lines to write, either in an array or separated by newlines.
     * @param {number} maxWidth Maximum text width.
     * @param {WriteOptions} writeOptions Options for the drawing of the text.
     * @param {StrokeOptions} strokeOptions Options for the stroke of the text.
     * @return This CanvasWriter.
     */
    write(lines, maxWidth = this.canvas.width, writeOptions = {}, strokeOptions){
        return this.writeWordWrappedLines(lines, maxWidth, writeOptions, strokeOptions);
    }

    /**
     * Checks if the text fits on the Canvas.
     * @param {string} xOrY Whether to check 'x' or 'y', leave blank for both.
     * @return Whether or not text fits.
     */
    isFitting(xOrY){
        if (xOrY === 'x') return this.rangeX[1] < this.canvas.width || this.rangeX[0] > 0;
        if (xOrY === 'y') return this.rangeY[1] < this.canvas.height || this.rangeY[0] > 0;

        return this.rangeX[1] < this.canvas.width
        || this.rangeX[0] > 0
        || this.rangeY[1] < this.canvas.height
        || this.rangeY[0] > 0;
    }

    /**
     * Clones the text drawn on the given CanvasWriter to this one.
     * @param {CanvasWriter} canvasWriter CanvasWriter to clone from.
     * @param {number} limit How many lines to clone.
     * @return This CanvasWriter.
     */
    cloneFrom(canvasWriter, limit = canvasWriter.texts.length){
        let toClone = canvasWriter.texts.slice(0, limit);

        toClone.forEach(t => {
            this.writeText(t.text, t.writeOptions, t.strokeOptions);
        });

        return this;
    }

    /**
     * Clones the text drawn on the given CanvasWriter to this one with the given options.
     * @param {CanvasWriter} canvasWriter CanvasWriter to clone from.
     * @param {number} limit How many lines to clone.
     * @param {WriteOptions} writeOptions Options for the drawing of the text.
     * @param {StrokeOptions} strokeOptions Options for the stroke of the text.
     * @return This CanvasWriter.
     */
    cloneWith(canvasWriter, limit = canvasWriter.texts.length, writeOptions, strokeOptions){
        let toClone = canvasWriter.texts.slice(0, limit);

        toClone.forEach(t => {
            this.writeText(t.text, writeOptions, strokeOptions);
        });

        return this;
    }

    /**
     * Gets the DataURL of the image.
     * @param {string} type Type of image.
     * @param {object} options Image options.
     * @return A Promise with the DataURL.
     */
    dataURL(type = 'image/png', options = {}){
        return new Promise((resolve, reject) => {
            this.canvas.toDataURL(type, options, (err, url) => {
                if (err) return reject(err);
                resolve(url);
            });
        });
    }

    /**
     * Gets the Buffer of the image.
     * @return A Promise with the Buffer.
     */
    buffer(){
        return new Promise((resolve, reject) => {
            this.canvas.toBuffer((err, buffer) => {
                if (err) return reject(err);
                resolve(buffer);
            });
        });
    }

    /**
     * Saves the Canvas as a file.
     * @param {string} path Path to save to.
     * @param {object} options Options for fs.writeFile().
     * @return A Promise with error or path.
     */
    saveFile(path, options){
        return new Promise((resolve, reject) => {
            this.buffer().then(buffer => {
                fs.writeFile(path, buffer, options, err => {
                    if (err) reject(err);
                    resolve(path);
                });
            });
        });
    }

    /**
     * toString() overwrite.
     * @return The text written on this CanvasWriter.
     */
    toString(){
        return this.texts.map(t => t.text).join('\n');
    }
}

module.exports = CanvasWriter;


text:
package io.vertx.ext.web.handler.impl;

import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.auth.User;
import io.vertx.ext.auth.otp.OtpCredentials;
import io.vertx.ext.auth.otp.OtpKey;
import io.vertx.ext.auth.otp.OtpKeyGenerator;
import io.vertx.ext.auth.otp.hotp.HotpAuth;
import io.vertx.ext.web.Route;
import io.vertx.ext.web.RoutingContext;
import io.vertx.ext.web.Session;
import io.vertx.ext.web.handler.HttpException;
import io.vertx.ext.web.handler.OtpAuthHandler;

/**
 * @author Paulo Lopes
 */
public class HotpAuthHandlerImpl extends AuthenticationHandlerImpl<HotpAuth> implements OtpAuthHandler {

  private final OtpKeyGenerator otpKeyGen;

  private String verifyUrl;
  private String issuer;
  private String label;

  // the extra routes
  private Route register = null;
  private Route verify = null;

  public HotpAuthHandlerImpl(HotpAuth totp, OtpKeyGenerator otpKeyGen) {
    super(totp, "hotp");
    this.otpKeyGen = otpKeyGen;
  }

  private static boolean matchesRoute(RoutingContext ctx, Route route) {
    if (route != null) {
      return ctx.request().method() == HttpMethod.POST && ctx.normalizedPath().equals(route.getPath());
    }
    return false;
  }

  @Override
  public void authenticate(RoutingContext ctx, Handler<AsyncResult<User>> handler) {
    if (verify == null) {
      handler.handle(Future.failedFuture(new HttpException(500, new IllegalStateException("No callback mounted!"))));
      return;
    }

    if (matchesRoute(ctx, verify)) {
      handler.handle(Future.failedFuture(new HttpException(500, new IllegalStateException("The verify callback route is shaded by the OTPAuthHandler, ensure the callback route is added BEFORE the OTPAuthHandler route!"))));
      return;
    }

    if (matchesRoute(ctx, register)) {
      handler.handle(Future.failedFuture(new HttpException(500, new IllegalStateException("The register callback route is shaded by the OTPAuthHandler, ensure the callback route is added BEFORE the OTPAuthHandler route!"))));
      return;
    }

    final User user = ctx.user();

    if (user == null) {
      handler.handle(Future.failedFuture(new HttpException(401)));
    } else {
      Boolean userOtp = user.get("mfa");
      // user hasn't 2fa yet?
      if (userOtp == null || !userOtp) {
        if (verifyUrl == null) {
          handler.handle(Future.failedFuture(new HttpException(401, "User HOTP verification missing")));
        } else {
          final Session session = ctx.session();
          if (session != null) {
            String uri = ctx.request().uri();
            session
              .put("redirect_uri", uri);
          }

          handler.handle(Future.failedFuture(new HttpException(302, verifyUrl)));
        }
      } else {
        handler.handle(Future.succeededFuture(user));
      }
    }
  }

  @Override
  public OtpAuthHandler verifyUrl(String verifyUrl) {
    this.verifyUrl = verifyUrl;
    return this;
  }

  @Override
  public OtpAuthHandler issuer(String issuer) {
    this.issuer = issuer;
    return this;
  }

  @Override
  public OtpAuthHandler label(String label) {
    this.label = label;
    return this;
  }

  @Override
  public OtpAuthHandler setupRegisterCallback(Route route) {
    this.register = route
      // force a post if otherwise
      .method(HttpMethod.POST)
      .handler(ctx -> {
        final User user = ctx.user();
        if (user == null || user.get("username") == null) {
          ctx.fail(new IllegalStateException("User object misses 'username' attribute"));
          return;
        }

        final OtpKey key = otpKeyGen.generate();
        authProvider.createAuthenticator(user.get("username"), key)
          .onFailure(ctx::fail)
          .onSuccess(authenticator ->
            ctx.json(
              new JsonObject()
                .put("issuer", issuer)
                .put("label", label)
                .put("url", authProvider.generateUri(key, issuer, user.get("username"), label))));
      });

    return this;
  }

  @Override
  public OtpAuthHandler setupCallback(Route route) {
    this.verify = route
      // force a post if otherwise
      .method(HttpMethod.POST)
      .handler(ctx -> {
        final User user = ctx.user();
        if (user == null || user.get("username") == null) {
          ctx.fail(new IllegalStateException("User object misses 'username' attribute"));
          return;
        }

        if ( ctx.request().getParam("code") == null) {
          ctx.fail(new HttpException(400, "Missing 'code' form attribute"));
          return;
        }

        authProvider.authenticate(new OtpCredentials(user.get("username"), ctx.request().getParam("code")))
          .onSuccess(newUser -> {
            user.principal().mergeIn(newUser.principal());
            user.attributes().mergeIn(newUser.attributes());
            // marker
            user.attributes().put("mfa", "hotp");
            String redirect = "/";
            final Session session = ctx.session();
            if (session != null) {
              // the user has upgraded from unauthenticated to authenticated
              // session should be upgraded as recommended by owasp
              session.regenerateId();

              String back = session.get("redirect_uri");
              if (back != null) {
                redirect = back;
              }
            }
            ctx.redirect(redirect);
          })
          .onFailure(err -> ctx.fail(401, err));
      });

    return this;
  }
}


text:
import wsgiref.handlers
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import login_required
from google.appengine.api import urlfetch
from google.appengine.api.labs import taskqueue
import re
import string
import settings
import jobs.app_store_codes
from processors import ranking_persister

class RankingsJob(webapp.RequestHandler):

	def get(self):
		for pid in settings.PRODUCTS:
			paid = settings.PRODUCTS[pid]['paid']
			iPad = settings.PRODUCTS[pid]['iPad']
			category = jobs.app_store_codes.CATEGORIES[settings.PRODUCTS[pid]['category_name']]

			if 'popId' not in category:
				new_category = {}
				if iPad:
					new_category['popId'] = 47 if paid else 44
				else:
					new_category['popId'] = 30 if paid else 27
				new_category['genreId'] = category['genreId']
				category = new_category
			# Queue requests for category rankings
			self.fetch_rankings(pid, category)

			# Queue requests for top 100 list
			if iPad:
				if paid:
					self.fetch_rankings(pid, jobs.app_store_codes.CATEGORIES['iPad Top 100 Paid'])
					# Queue requests for top grossing list
					self.fetch_rankings(pid, jobs.app_store_codes.CATEGORIES['iPad Top 100 Grossing'])
				else:
					self.fetch_rankings(pid, jobs.app_store_codes.CATEGORIES['iPad Top 100 Free'])
			else:
				if paid:
					self.fetch_rankings(pid, jobs.app_store_codes.CATEGORIES['Top 100 Paid'])
					# Queue requests for top grossing list
					self.fetch_rankings(pid, jobs.app_store_codes.CATEGORIES['Top Grossing'])
				else:
					self.fetch_rankings(pid, jobs.app_store_codes.CATEGORIES['Top 100 Free'])

	def fetch_rankings(self, pid, category):
		app_id = settings.PRODUCTS[pid]['app_id']

		# Fetch ranking in each country for the application's category
		# Break into queued tasks for offline, asychronous processing
		countries_per_task = 3
		count = 0
		store_ids_to_process = []
		for store_id in jobs.app_store_codes.COUNTRIES:
			count += 1
			store_ids_to_process.append(store_id)
			if count % countries_per_task == 0 or count == len(jobs.app_store_codes.COUNTRIES):
				# Enqueue task and reset list
				taskqueue.add(url='/jobs/pull_rankings/worker',
								method='POST',
								params={
										'pid': pid,
										'app_id': app_id,
										'store_ids': ','.join(map(str, store_ids_to_process)),
										'category_id': category['genreId'],
										'pop_id': category['popId'],
										})
				store_ids_to_process = []

	def _is_int(self, value):
		if int(value) == value:
			return True
		else:
			return False

class RankingsWorker(webapp.RequestHandler):

	def post(self):
		pid = self.request.get('pid')
		app_id = int(self.request.get('app_id'))
		store_ids = string.split(self.request.get('store_ids'), ',')
		category_id = int(self.request.get('category_id'))
		pop_id = int(self.request.get('pop_id'))

		for store_id in store_ids:
			ranking = self.category_ranking(app_id, int(store_id), category_id, pop_id)

			if ranking != None:
				# Store this ranking
				ranking_persister.persist_ranking(pid, ranking, jobs.app_store_codes.COUNTRIES[int(store_id)], self._category_name(category_id, pop_id))

	def category_ranking(self, app_id, store_id, category_id, pop_id):
		# Append the store id to the URL because GAE caches the request otherwise
		url = "http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewTop?genreId=%d&popId=%d&%d" % (category_id, pop_id, store_id)
		user_agent = "iTunes/4.2 (Macintosh; U; PPC Mac OS X 10.2"
		headers = {
					'User-Agent': user_agent,
					'X-Apple-Store-Front': "%d-1" % store_id,
					'Cache-Control': 'max-age=0',
				}
		response = urlfetch.fetch(url=url,
								method=urlfetch.GET,
								deadline=10,
								headers=headers)

		pattern = re.compile(r"buyParams=.+?Id=(\d+)")
		rankings = pattern.findall(response.content)

		rank = 0
		value = None
		for app in rankings:
			rank += 1
			if int(app) == app_id:
				value = rank
				break

		return value

	def _category_name(self, category_id, pop_id, pop_id_search=False):
		i = 0
		category_name = None
		for name, category in jobs.app_store_codes.CATEGORIES.items():
			if pop_id_search:
				if category['genreId'] == category_id and category['popId'] == pop_id:
					category_name = name
					break
			else:
				if category['genreId'] == category_id:
					i += 1
					category_name = name

		if i > 1:
			# There is more than 1 category with the same id, so differentiate by popId as well
			return self._category_name(category_id, pop_id, True)

		return category_name

def main():
	application = webapp.WSGIApplication([('/jobs/pull_rankings', RankingsJob),
											('/jobs/pull_rankings/worker', RankingsWorker)], debug=True)
	wsgiref.handlers.CGIHandler().run(application)

if __name__ == '__main__':
	main()


text:
{% load humanize %}
{% load widget_tweaks %}

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="description" content="{% block meta_description %}Welcome to FireCARES, created by the Fire Fighter Safety and Deployment Study.  Login to learn how fire department resources are deployed to match your community risks."{% endblock %}>
    <meta name="author" content="Prominent Edge LLC">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <title>{% block meta_title %}Contact Us - Thank You! · FireCARES{% endblock %}</title>
    {% include 'firestation/_favicon.html' %}

    {% include "firestation/_firecares_style.html" %}

    {% include 'google_analytics.html' %}

{% include 'firestation/_mobile_navbar.html' %}
{% include 'firestation/_mobile_search.html' %}

    <button type="button" class="navbar-toggle">
        Toggle navigation

    </button>

FireCARES

    <button type="button" class="searchForm-toggle">
        Toggle navigation

    </button>

{% include 'firestation/_navbar.html' %}

        {% block breadcrumbs %}
            Home
            Contact Us
        {% endblock %}

                {% block content %}

                                            Thanks!

                                    {% block message %}
                                        {{ message }}
                                    {% endblock %}

                {% endblock %}

{% include 'firestation/_partners.html' %}
{% include 'firestation/_footer.html' %}

{% include "firestation/_firecares_scripts.html" %}


text:
describe Nanoc::Int::ConfigLoader do
  let(:loader) { described_class.new }

  describe '#new_from_cwd' do
    subject { loader.new_from_cwd }

    context 'no config file present' do
      it 'errors' do
        expect { subject }.to raise_error(
          Nanoc::Int::ConfigLoader::NoConfigFileFoundError,
        )
      end
    end

    context 'config file present' do
      before do
        File.write('nanoc.yaml', YAML.dump(foo: 'bar'))
      end

      it 'returns a configuration' do
        expect(subject).to be_a(Nanoc::Int::Configuration)
      end

      it 'has the defaults' do
        expect(subject[:output_dir]).to eq('output')
      end

      it 'has the custom option' do
        expect(subject[:foo]).to eq('bar')
      end
    end

    context 'config file and parent present' do
      before do
        File.write('nanoc.yaml', YAML.dump(parent_config_file: 'parent.yaml'))
        File.write('parent.yaml', YAML.dump(foo: 'bar'))
      end

      it 'returns the configuration' do
        expect(subject).to be_a(Nanoc::Int::Configuration)
      end

      it 'has the defaults' do
        expect(subject[:output_dir]).to eq('output')
      end

      it 'has the custom option' do
        expect(subject[:foo]).to eq('bar')
      end

      it 'does not include parent config option' do
        expect(subject[:parent_config_file]).to be_nil
      end
    end

    context 'config file present, environment defined' do
      let(:active_env_name) { 'default' }

      let(:config) do
        {
          foo: 'bar',
          tofoo: 'bar',
          environments: {
            test: { foo: 'test-bar' },
            default: { foo: 'default-bar' },
          },
        }
      end

      before do
        File.write('nanoc.yaml', YAML.dump(config))
      end

      context 'environments feature enabled' do
        around(:each) do |example|
          Nanoc::Feature.enable(Nanoc::Feature::ENVIRONMENTS) do
            example.run
          end
        end

        before do
          expect(ENV).to receive(:fetch).with('NANOC_ENV', 'default').and_return(active_env_name)
        end

        it 'returns the configuration' do
          expect(subject).to be_a(Nanoc::Int::Configuration)
        end

        it 'has option defined not within environments' do
          expect(subject[:tofoo]).to eq('bar')
        end

        context 'current env is test' do
          let(:active_env_name) { 'test' }

          it 'has the test environment custom option' do
            expect(subject[:foo]).to eq('test-bar')
          end
        end

        it 'has the default environment custom option' do
          expect(subject[:foo]).to eq('default-bar')
        end
      end

      context 'environments feature disabled' do
        it 'returns the configuration' do
          expect(subject).to be_a(Nanoc::Int::Configuration)
        end

        it 'has option defined not within environments' do
          expect(subject[:tofoo]).to eq('bar')
        end

        context 'current env is test' do
          let(:active_env_name) { 'test' }

          it 'has the test environment custom option' do
            expect(subject[:foo]).to eq('bar')
          end
        end

        it 'has the default environment custom option' do
          expect(subject[:foo]).to eq('bar')
        end
      end
    end
  end

  describe '.cwd_is_nanoc_site? + .config_filename_for_cwd' do
    context 'no config files' do
      it 'is not considered a nanoc site dir' do
        expect(described_class.cwd_is_nanoc_site?).to eq(false)
        expect(described_class.config_filename_for_cwd).to be_nil
      end
    end

    context 'nanoc.yaml config file' do
      before do
        File.write('nanoc.yaml', 'stuff')
      end

      it 'is considered a nanoc site dir' do
        expect(described_class.cwd_is_nanoc_site?).to eq(true)
        expect(described_class.config_filename_for_cwd).to eq(File.expand_path('nanoc.yaml'))
      end
    end

    context 'config.yaml config file' do
      before do
        File.write('config.yaml', 'stuff')
      end

      it 'is considered a nanoc site dir' do
        expect(described_class.cwd_is_nanoc_site?).to eq(true)
        expect(described_class.config_filename_for_cwd).to eq(File.expand_path('config.yaml'))
      end
    end
  end

  describe '#apply_parent_config' do
    subject { loader.apply_parent_config(config, processed_paths) }

    let(:config) { Nanoc::Int::Configuration.new(hash: { foo: 'bar' }) }

    let(:processed_paths) { ['nanoc.yaml'] }

    context 'no parent_config_file' do
      it 'returns self' do
        expect(subject).to eq(config)
      end
    end

    context 'parent config file is set' do
      let(:config) do
        Nanoc::Int::Configuration.new(hash: { parent_config_file: 'foo.yaml', foo: 'bar' })
      end

      context 'parent config file is not present' do
        it 'errors' do
          expect { subject }.to raise_error(
            Nanoc::Int::ConfigLoader::NoParentConfigFileFoundError,
          )
        end
      end

      context 'parent config file is present' do
        context 'parent-child cycle' do
          before do
            File.write('foo.yaml', 'parent_config_file: bar.yaml')
            File.write('bar.yaml', 'parent_config_file: foo.yaml')
          end

          it 'errors' do
            expect { subject }.to raise_error(
              Nanoc::Int::ConfigLoader::CyclicalConfigFileError,
            )
          end
        end

        context 'self parent-child cycle' do
          before do
            File.write('foo.yaml', 'parent_config_file: foo.yaml')
          end

          it 'errors' do
            expect { subject }.to raise_error(
              Nanoc::Int::ConfigLoader::CyclicalConfigFileError,
            )
          end
        end

        context 'no parent-child cycle' do
          before do
            File.write('foo.yaml', 'animal: giraffe')
          end

          it 'returns a configuration' do
            expect(subject).to be_a(Nanoc::Int::Configuration)
          end

          it 'has no defaults (added in #new_from_cwd only)' do
            expect(subject[:output_dir]).to be_nil
          end

          it 'inherits options from parent' do
            expect(subject[:animal]).to eq('giraffe')
          end

          it 'takes options from child' do
            expect(subject[:foo]).to eq('bar')
          end

          it 'does not include parent config option' do
            expect(subject[:parent_config_file]).to be_nil
          end
        end

        context 'long parent chain' do
          before do
            File.write('foo.yaml', "parrots: 43\nparent_config_file: bar.yaml\n")
            File.write('bar.yaml', "day_one: lasers\nslugs: false\n")
          end

          it 'returns a configuration' do
            expect(subject).to be_a(Nanoc::Int::Configuration)
          end

          it 'has no defaults (added in #new_from_cwd only)' do
            expect(subject[:output_dir]).to be_nil
          end

          it 'inherits options from grandparent' do
            expect(subject[:day_one]).to eq('lasers')
            expect(subject[:slugs]).to eq(false)
          end

          it 'inherits options from parent' do
            expect(subject[:parrots]).to eq(43)
          end

          it 'takes options from child' do
            expect(subject[:foo]).to eq('bar')
          end

          it 'does not include parent config option' do
            expect(subject[:parent_config_file]).to be_nil
          end
        end
      end
    end
  end
end


text:
<?php

namespace Drupal\action\Form;

use Drupal\Core\Form\FormStateInterface;

/**
 * Provides a form for action add forms.
 *
 * @internal
 */
class ActionAddForm extends ActionFormBase {

  /**
   * {@inheritdoc}
   *
   * @param array $form
   *   An associative array containing the structure of the form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   * @param string $action_id
   *   The action ID.
   */
  public function buildForm(array $form, FormStateInterface $form_state, $action_id = NULL) {
    $this->entity->setPlugin($action_id);

    // Derive the label and type from the action definition.
    $definition = $this->entity->getPluginDefinition();
    $this->entity->set('label', $definition['label']);
    $this->entity->set('type', $definition['type']);

    return parent::buildForm($form, $form_state);
  }

}


text:
<html>
<head>
    <script>
        var require = {
            baseUrl: '/blocks',
            paths: {
                moduleRelativeBaseUrlPath: 'childBlocks/childBlock',
                moduleAbsolutePath: '/blocks/block',
                moduleRelativeTwoDotPAth: '../rootWebPathFile'
            }
        }
    </script>
</head>
</html>


text:
import React from 'react';
import MarkdownIt from 'markdown-it';

export default class Markdown extends React.Component {
  constructor(props) {
    super(props);
    this.markdown = MarkdownIt();
  }

  render() {
    return (
      <div
        className="markdown"
        dangerouslySetInnerHTML={{__html: this.markdown.render(this.props.source)}}
      />
    );
  }
}


text:
=begin
##########################################################################
#
#  INFIVERVE TECHNOLOGIES PTE LIMITED CONFIDENTIAL
#  __________________
#
#  (C) INFIVERVE TECHNOLOGIES PTE LIMITED, SINGAPORE
#  All Rights Reserved.
#  Product / Project: Flint IT Automation Platform
#  NOTICE:  All information contained herein is, and remains
#  the property of INFIVERVE TECHNOLOGIES PTE LIMITED.
#  The intellectual and technical concepts contained
#  herein are proprietary to INFIVERVE TECHNOLOGIES PTE LIMITED.
#  Dissemination of this information or any form of reproduction of this material
#  is strictly forbidden unless prior written permission is obtained
#  from INFIVERVE TECHNOLOGIES PTE LIMITED, SINGAPORE.
=end

# begin
@log.trace("Started executing 'fb-cloud:aws-ec2:operation:terminate_amazon_instance.rb' flintbit...")
begin
    # Flintbit Input Parameters
    # mandatory
    connector_name = @input.get('connector_name')	# Name of the Amazon EC2 Connector
    action = 'terminate-instances'	# Terminate Amazon EC2 instance action
    instance_id = @input.get('instance-id')	# Amazon Instance ID to terminate one or more Instances
    @access_key = @input.get('access-key')
    @secret_key = @input.get('security-key')
    # optional
    region = @input.get('region')	# Amazon EC2 region (default region is 'us-east-1')
    request_timeout = @input.get('timeout')	# Execution time of the Flintbit in milliseconds

    @log.info("Flintbit input parameters are, action : #{action} | instance_id : #{instance_id} | region : #{region}")

    connector_call = @call.connector(connector_name).set('action', action).set('access-key', @access_key).set('security-key', @secret_key)

    if connector_name.nil? || connector_name.empty?
        raise 'Please provide "Amazon EC2 connector name (connector_name)" to terminate Instance'
    end

    if instance_id.nil? || instance_id.empty?
        raise 'Please provide "Amazon instance ID (instance_id)" to terminate Instance'
    else
        connector_call.set('instance-id', instance_id)
    end

    if !region.nil? && !region.empty?
        connector_call.set('region', region)
    else
        @log.trace("Region is not provided so using default region 'us-east-1'")
    end

    if request_timeout.nil? || request_timeout.is_a?(String)
        @log.trace("Calling #{connector_name} with default timeout...")
        response = connector_call.sync
    else
        @log.trace("Calling #{connector_name} with given timeout #{request_timeout}...")
        response = connector_call.timeout(request_timeout).sync
    end

    # Amazon EC2 Connector Response Meta Parameters
    response_exitcode = response.exitcode              	          # Exit status code
    response_message = response.message                           # Execution status messages

    # Amazon EC2 Connector Response Parameters
    instances_set = response.get('terminated-instance-set') # Set of Amazon EC2 terminated instances

    if response_exitcode == 0
        @log.info("SUCCESS in executing #{connector_name} where, exitcode : #{response_exitcode} | message :  #{response_message}")
        instances_set.each do |instance_id|
            @log.info("Amazon EC2 Instance current state :  #{instance_id.get('current-state')} | previous state : #{instance_id.get('previous-state')}
        		Instance ID :    #{instance_id.get('instance-id')}")
        end
        @output.set('exit-code', 0).setraw('terminated-instances', instances_set.to_s)
    else
        @log.error("ERROR in executing #{connector_name} where, exitcode : #{response_exitcode} | message : #{response_message}")
        response=response.to_s
        if !response.empty?
        @output.set('message', response_message).set('exit-code', 1).setraw('error-details',response.to_s)
        else
        @output.set('message', response_message).set('exit-code', 1)
        end
    end
rescue Exception => e
    @log.error(e.message)
    @output.set('exit-code', 1).set('message', e.message)
end
@log.trace("Finished executing 'fb-cloud:aws-ec2:operation:terminate_amazon_instance.rb' flintbit")
# end