text:
$(document).ready(function(){
    // Bootstrap tooltip
    $(".tip").tooltip({placement: 'top', trigger: 'hover'});
    $(".tipb").tooltip({placement: 'bottom', trigger: 'hover'});
    $(".tipl").tooltip({placement: 'left', trigger: 'hover'});
    $(".tipr").tooltip({placement: 'right', trigger: 'hover'});

    if($('#main_calendar').length > 0){

        // fullcalendar
        var date = new Date();
        var d = date.getDate();
        var m = date.getMonth();
        var y = date.getFullYear();

        var calendar = $('#main_calendar').fullCalendar({
                header: {
                        left: 'prev,next',
                        center: 'title',
                        right: '',
                        right: 'month,agendaWeek,agendaDay'
                },
                selectable: true,
                selectHelper: true,
                select: function(start, end) {

                        $('#fcAddEvent').modal('show');

                        $("#fcAddEventButton").click(function(){

                            var title = $("#fcAddEventTitle").val();

                            if(title){
                                calendar.fullCalendar('renderEvent',
                                            {
                                                    title: title,
                                                    start: start,
                                                    end: end
                                            },true
                                    );
                                    notify('Fullcalendar','New Event: '+title+';
start: '+start+';
end: '+end+';');
                            }

                            $('#fcAddEvent').modal('hide');
                            $("#fcAddEventTitle").val('');
                            calendar.fullCalendar('unselect');
                        });
                },
                editable: true,
                eventDrop: function(event, delta) {
                    notify('Fullcalendar','Event: '+event.title+' = '+delta);
                },
                //eventSources: ['php/ajax_fullcalendar.php']
                events: {
                    url: "php/ajax_fullcalendar.php",
                    success: function(){
                        notify('Fullcalendar','Success ajax load');
                    }
                }
        });

    }

    // Pnotify notifier
        $.pnotify.defaults.history = false;
        $.pnotify.defaults.delay = 3000;

    // Fancybox
    if($("a.fb").length > 0){
        $("a.fb").fancybox({padding: 10,
                            'transitionIn'  : 'elastic',
                            'transitionOut' : 'elastic',
                            'speedIn'       : 600,
                            'speedOut'      : 200
                        });
    }
    // Uniform
        $("input:checkbox, input:radio").not('input.ibtn').uniform();

    // Select2
    if($(".select").length > 0){
        $(".select").select2();
        $(".select").on("change", function(e) {
            notify('Select','Value changed: '+e.val);
        });
    }
    // Tagsinput
    if($(".tags").length > 0)
        $(".tags").tagsInput({'width':'100%',
                              'height':'auto',
                              'onAddTag': function(text){
                                notify('Tags input','Added tag: '+text);
                              },
                              'onRemoveTag': function(text){
                                notify('Tags input','Removed tag: '+text);
                              }});

    // Masked input
    if($("input[class^=mask_]").length > 0){
        $("input.mask_tin").mask('99-9999999',{completed:function(){
                                                notify('Masked input','mask_tin completed');
                                              }});
        $("input.mask_ssn").mask('999-99-9999',{completed:function(){
                                                notify('Masked input','mask_ssn completed');
                                              }});
        $("input.mask_date").mask('9999-99-99',{completed:function(){
                                                notify('Masked input','mask_date completed');
                                              }});
        $("input.mask_product").mask('a*-999-a999',{completed:function(){
                                                notify('Masked input','mask_product completed');
                                              }});
        $("input.mask_phone").mask('99 (999) 999-99-99',{completed:function(){
                                                notify('Masked input','mask_phone completed');
                                              }});
        $("input.mask_phone_ext").mask('99 (999) 999-9999? x99999',{completed:function(){
                                                notify('Masked input','mask_phone_ext completed');
                                              }});
        $("input.mask_credit").mask('9999-9999-9999-9999',{completed:function(){
                                                notify('Masked input','mask_credit completed');
                                              }});
        $("input.mask_percent").mask('99%',{completed:function(){
                                                notify('Masked input','mask_percent completed');
                                              }});
    }
    // Multiselect
    if($("#ms").length > 0)
        $("#ms").multiSelect({
            afterSelect: function(value, text){
                notify('Multiselect','Selected: '+text+'['+value+']');
            },
            afterDeselect: function(value, text){
                notify('Multiselect','Deselected: '+text+'['+value+']');
            }});

    if($("#msc").length > 0){
        $("#msc").multiSelect({
            selectableHeader: "
Selectable item
",
            selectedHeader: "
Selected items
",
            afterSelect: function(value, text){
                notify('Multiselect','Selected: '+text+'['+value+']');
            },
            afterDeselect: function(value, text){
                notify('Multiselect','Deselected: '+text+'['+value+']');
            }
        });

        $("#ms_select").click(function(){
            $('#msc').multiSelect('select_all');
        });
        $("#ms_deselect").click(function(){
            $('#msc').multiSelect('deselect_all');
        });
    }

    // Breadcrumb
    if($(".breadCrumb").length > 0) $(".breadCrumb").jBreadCrumb({easing:'swing'});

    // Validation
    if($("#validate").length > 0)
        $("#validate, #validate_custom").validationEngine('attach',{promptPosition : "topLeft"});

    // Datepicker
    $(".datepicker").datepicker({dateFormat: 'yy-mm-dd'});

    if($("#datepicker").length > 0){

        $( "#datepicker" ).datepicker({dateFormat: 'yy-mm-dd',
                                       onSelect: function(date){
                                            notify('Datepicker', 'Date: '+date)
                                     }});
    }

    // Wizard
    if($("#wizard").length > 0) $('#wizard').stepy();

    if($("#wizard_validate").length > 0){

        $("#wizard_validate").validationEngine('attach',{promptPosition : "topLeft"});

        $('#wizard_validate').stepy({
            back: function(index) {
                //if(!$("#wizard_validate").validationEngine('validate')) return false; //uncomment if u need to validate on back click
            },
            next: function(index) {
                if(!$("#wizard_validate").validationEngine('validate')) return false;
            },
            finish: function(index) {
                if(!$("#wizard_validate").validationEngine('validate')) return false;
            }
        });
    }

    if($("#wizard_ajax").length > 0){

        $("#wizard_ajax").validationEngine('attach',{promptPosition : "topLeft"});

        $('#wizard_ajax').stepy({
            back: function(index) {
                return false;
            },
            next: function(index) {
                if(!$("#wizard_ajax").validationEngine('validate')) return false;

                if((index-2) == 0){
                    $.post('php/ajax_wizard.php',{login: $("#wizard_ajax input[name=login]").val(),
                                                email: $("#wizard_ajax input[name=email]").val()},
                                                function(data){
                                                        if(data == 'success')
                                                            $('#wizard_ajax').stepy('step', index);
                                                        else
                                                            $('#wizard_ajax input[name=login]').validationEngine('showPrompt', 'Response doesn\'t match', 'error','topLeft', true);
                                                });
                    return false;
                }

                if((index-2) == 1){
                    $.post('php/ajax_wizard.php',{hash: $("#wizard_ajax input[name=hash]").val()},
                                                  function(data){
                                                    if(data == 'success')
                                                        $('#wizard_ajax').stepy('step', index);
                                                    else
                                                        $('#wizard_ajax input[name=hash]').validationEngine('showPrompt', 'Response doesn\'t match', 'error','topLeft', true);
                                                  });
                    return false;
                }

            },
            finish: function(index) {
                if(!$("#wizard_ajax").validationEngine('validate')) return false;

                notify('Wizard','Form #wizard_ajax submited with:
'+$("#wizard_ajax").serialize());
            }
        });
    }

    // eof wizard

    // accordion
    if($(".accordion").length > 0) $(".accordion").accordion({heightStyle: "content"});
    // eof accordion

    // tabs
    if($(".tabs").length > 0) $(".tabs").tabs();
    // eof tabs

    // sortable
    if($("#sort_1").length > 0){
        $("#sort_1").sortable();
        $("#sort_1").disableSelection();
    }
    // eof sortable

    // selectable
    if($("#select_1").length > 0) $("#select_1").selectable();
    //eof selectable

    // progressbars
    if($("#progressbar_default").length > 0)
        $("#progressbar_default").progressbar({value: 65});

    if($("#progressbar_animated").length > 0){
        $("#progressbar_animated").progressbar({value: 0});
        $("#sAProgress").click(function(){
            $("#progressbar_animated").progressbar('destroy');
            var iNow = new Date().setTime(new Date().getTime() + 0 * 1000);
            var iEnd = new Date().setTime(new Date().getTime() + 5 * 1000);
            $("#progressbar_animated").anim_progressbar({start: iNow, finish: iEnd, interval: 1});
        });
    }

    if($("#progressbar_delay").length > 0){
        $("#progressbar_delay").progressbar({value: 0});
        $("#sWDProgress").click(function(){
            $("#progressbar_delay").progressbar('destroy');
            var iNow1 = new Date().setTime(new Date().getTime() + 3 * 1000);
            var iEnd1 = new Date().setTime(new Date().getTime() + 6 * 1000);
            $("#progressbar_delay").anim_progressbar({start: iNow1, finish: iEnd1, interval: 1});
        });
    }
    // eof progressbars

    // spinner
        $( "#spinner" ).spinner();
        $( "#spinner1" ).spinner({culture: "en-US", min: 5, max: 1000, step: 10, start: 10, numberFormat: "C"});
    // eof spinner

    // sliders
        $("#slider_1").slider({
            value: 60,
            orientation: "horizontal",
            range: "min",
            animate: true,
            slide: function( event, ui ) {
                $( "#slider_1_amount" ).html( "$" + ui.value );
            },
            stop: function( event, ui ) {
                notify('Slider','#slider_1: '+ui.value);
            }
        });

        $("#slider_2").slider({
            values: [ 17, 67 ],
            orientation: "horizontal",
            range: true,
            animate: true,
            slide: function( event, ui ) {
                $( "#slider_2_amount" ).html( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
            },
            stop: function( event, ui ) {
                notify('Slider','#slider_2: '+ui.values[0]+' - '+ui.values[ 1 ]);
            }
        });

        $("#slider_3").slider({
            orientation: "vertical",
            range: "min",
            min: 0,
            max: 100,
            value: 10,
            stop: function( event, ui ) {
                notify('Slider','#slider_3: '+ui.value);
            }
        });

        $("#slider_4").slider({
            orientation: "vertical",
            range: true,
            values: [ 17, 67 ],
            stop: function( event, ui ) {
                notify('Slider','#slider_4: '+ui.values[0]+' - '+ui.values[1]);
            }
        });

        $("#slider_5").slider({
            orientation: "vertical",
            range: "max",
            min: 1,
            max: 10,
            value: 2,
            stop: function( event, ui ) {
                notify('Slider','#slider_5: '+ui.value);
            }
        });
    // eof sliders

    // popovers

    $("#popover_top").popover({placement: 'top', title: 'Popover title', content: 'Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit.'});
    $("#popover_right").popover({placement: 'right', title: 'Popover title', content: 'Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit.'});
    $("#popover_bottom").popover({placement: 'bottom', title: 'Popover title', content: 'Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit.'});
    $("#popover_left").popover({placement: 'left', title: 'Popover title', content: 'Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit.'});

    // eof popovers

    // jQuery dialogs

        $("#jDialog_default").dialog({autoOpen: false});
        $("#jDialog_default_button").click(function(){
            $("#jDialog_default").dialog('open');
        });

        $("#jDialog_modal").dialog({autoOpen: false, modal: true});
        $("#jDialog_modal_button").click(function(){
            $("#jDialog_modal").dialog('open');
        });

        $("#jDialog_form").dialog({autoOpen: false,
                                modal: true,
                                width: 400,
                                buttons: {
                                    "Submit": function() {
                                        $( this ).dialog( "close" );
                                    },
                                    Cancel: function() {
                                        $( this ).dialog( "close" );
                                    }
        }});

        $("#jDialog_form_button").click(function(){$("#jDialog_form").dialog('open')});

    // eof dialogs

    // dataTable
        if($(".table").length > 0)
            $(".table").dataTable({bFilter: false, bInfo: false, bPaginate: false, bLengthChange: false,
                                   bSort: true,
                                   bAutoWidth: true,
                                   "aoColumnDefs": [{"bSortable": false,
                                                     "aTargets": [ -1 , 0]}]});
        if($(".fTable").length > 0)
            $(".fTable").dataTable({bSort: true,
                                    "iDisplayLength": 15, "aLengthMenu": [5,10,15,25,50,100], // can be removed for basic 10 items per page
                                    "aoColumnDefs": [{"bSortable": false,
                                                     "aTargets": [ -1 , 0]}]});

        if($(".fpTable").length > 0)
            $(".fpTable").dataTable({bSort: true,
                                     bAutoWidth: true,
                                    "iDisplayLength": 15, "aLengthMenu": [15,25,35,50,100], // can be removed for basic 10 items per page
                                    "sPaginationType": "full_numbers",
                                    "aoColumnDefs": [{"bSortable": false,
                                                     "aTargets": [ -1 , 0]}]});

        if($(".aTable").length > 0)
            $(".aTable").dataTable({bSort: true,
                                    "sPaginationType": "full_numbers",
                                    "bProcessing": true,
                                    "sAjaxSource": 'php/ajax_datatable.php'});

    // eif dataTable

    // media
    if($("#video").length > 0){
        var video = new MediaElementPlayer('#video',{
            success: function(media, node, player){
                var events = ['loadstart', 'play','pause', 'ended'];

                for (var i=0, il=events.length; i<il; i++) {
                    media.addEventListener(events[i], function(e) {
                            notify('Video','#video: '+ e.type);
                    });
                }

            }
        });

        $("#videoPlay").click(function(){
            video.play();
        });
        $("#videoPause").click(function(){
            video.pause();
        });
    }
    if($('audio').length > 0 || $('video').length > 0) $('audio,video').mediaelementplayer();
    // eof media

    //wysiwyg editor
    if($("#wysiwyg").length > 0){
        wEditor = $("#wysiwyg").cleditor({width:"100%", height:"300px"});
    }
    if($("#mail_wysiwyg").length > 0)
        m_editor = $("#mail_wysiwyg").cleditor({width:"100%", height:"100%",controls:"bold italic underline strikethrough | font size style | color highlight removeformat | bullets numbering | outdent alignleft center alignright justify"})[0].focus();

    // eof wysiwyg editor

    //syntax highlight
    if($("pre[class^=brush]").length > 0){
        SyntaxHighlighter.defaults['toolbar'] = false;
        SyntaxHighlighter.all();
    }
    //eof syntax highlight

    // easy pie chart
    if($(".epc-green").length > 0)
        $('.epc .epc-green').easyPieChart({animate: 100,barColor: '#468847',trackColor: '#FFFFFF',scaleColor: '#888888',lineWidth: '5',lineCap: 'square'});
    if($(".epc-orange").length > 0)
        $('.epc .epc-orange').easyPieChart({animate: 100, barColor: '#F89406',trackColor: '#FFFFFF',scaleColor: '#888888',lineWidth: '5',lineCap: 'square'});
    if($(".epc-red").length > 0)
        $('.epc .epc-red').easyPieChart({animate: 100,barColor: '#B94A48',trackColor: '#FFFFFF',scaleColor: '#888888',lineWidth: '5',lineCap: 'square'});
    if($(".epcm-green").length > 0)
        $('.epc .epcm-green').easyPieChart({animate: 100,barColor: '#468847',trackColor: '#FFFFFF',scaleColor: '#888888',lineWidth: '5',lineCap: 'square',size: 90});
    if($(".epcm-orange").length > 0)
        $('.epc .epcm-orange').easyPieChart({animate: 100, barColor: '#F89406',trackColor: '#FFFFFF',scaleColor: '#888888',lineWidth: '5',lineCap: 'square',size: 90});
    if($(".epcm-red").length > 0)
        $('.epc .epcm-red').easyPieChart({animate: 100,barColor: '#B94A48',trackColor: '#FFFFFF',scaleColor: '#888888',lineWidth: '5',lineCap: 'square',size: 90});

    // eof easy pie chart

    // knob circle charts
    if($(".knob").length > 0 && $.browser.version != '8.0')
        $(".knob").knob();
    else
       $(".kchart").html('doesnt supported');
    // eof knob

    // file tree
    if($("#fileTree").length > 0){
        $("#fileTree").fileTree({ root: '../../assets/filetree/', script: 'php/filetree/jqueryFileTree.php' }, function(file) {
            notify('File Tree','File: '+file);
        });
    }
    if($("#fileTree1").length > 0){
        $("#fileTree1").fileTree({ root: '../../assets/filetree/', script: 'php/filetree/jqueryFileTree.php' }, function(file) {
            notify('File Tree','File: '+file);
        });
    }
    // eof file tree

    // File uploader
    if($("#uploader_v5").length > 0){
        $("#uploader_v5").pluploadQueue({
                runtimes : 'html5',
                url : 'php/pluploader/upload.php',
                max_file_size : '1mb',
                chunk_size : '1mb',
                unique_names : true,
                dragdrop : true,
                resize : {width : 320, height : 240, quality : 100},
                filters : [
                        {title : "Image files", extensions : "jpg,gif,png"},
                        {title : "Zip files", extensions : "zip"}
                ],
                FilesAdded: function(editor,files){
                    alert(files);
                }
        });
    }
    if($("#uploader_v4").length > 0){
        $("#uploader_v4").pluploadQueue({
                runtimes : 'html4',
                url : 'php/pluploader/upload.php',
                unique_names : true,
                filters : [
                        {title : "Image files", extensions : "jpg,gif,png"},
                        {title : "Zip files", extensions : "zip"}
                ]
        });
    }
    // eof file uploader

    // sparklines

        $(".mChartBar").sparkline('html',{ enableTagOptions: true, disableHiddenCheck: true});

    // eof sparklines

    // draggable blocks //
    $( ".sortableContent .column" ).sortable({
            connectWith: ".sortableContent .column",
            items: "> .widget",
            handle: ".head",
            placeholder: "sortablePlaceholder",
            start: function(event,ui){
                $(".sortablePlaceholder").height(ui.item.height());
            },
            stop: function(event, ui){
                var sorted = '';
                $( ".sortableContent .column" ).each(function(){
                    sorted += $(this).index()+': '
                    $(this).find('.widget').each(function(){
                        sorted += '#'+$(this).attr('id')+', ';
                    });
                    sorted += ';
';
                });
                notify('Sorting', sorted);
            }

        }).disableSelection();

    // eof draggable blocks

    // slidernav
    if($(".slidernav").length > 0)
        $(".slidernav").sliderNav();

    // eof slidernav

    // isotope gallery
    if($('#isotope').length > 0)
        $('#isotope').isotope({
            itemSelector : '.item',
            layoutMode : 'fitRows'
        });

    $("#removeFilter").click(function(){
        $('#isotope').isotope({ filter: '' });
    });
    $("#filterByCity").click(function(){
        $('#isotope').isotope({ filter: '.city' });
    });
    $("#filterByNature").click(function(){
        $('#isotope').isotope({ filter: '.nature' });
    });
    $("#filterByCats").click(function(){
        $('#isotope').isotope({ filter: '.cat' });
    });
    // eof isotope gallery

    // jCrop, image cropping
    if($('#cropping').length > 0)
        $('#cropping').Jcrop({
            onSelect: function(cords){
                notify('Cropping','width: '+Math.ceil(cords.w)+'x'+Math.ceil(cords.h)+'
 Coords: x: '+Math.ceil(cords.x)+'; y: '+Math.ceil(cords.y)+'; x2: '+Math.ceil(cords.x2)+'; y2: '+Math.ceil(cords.y2));
                $('#crop_x').val(cords.x);
                $('#crop_y').val(cords.y);
                $('#crop_w').val(cords.w);
                $('#crop_h').val(cords.h);
            },
            setSelect: [ 150,50, 360,50 ],
            aspectRatio: 16 / 9
        });

    // eof jCrop
    //jNotes
    if($('.jquery-note').length > 0)
        $('.jquery-note').jQueryNotes({operator: 'php/jnotes/notes.php',allowLink: false});
    // eof jNotes

    //ibuttons
    if($('.ibtn').length > 0)
        $('.ibtn').iButton();
    // eof ibuttons

   // new selector case insensivity
        $.expr[':'].containsi = function(a, i, m) {
            return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
        };
   //
});

$(window).load(function(){

    // Gallery Grid
    if($(".gGallery").length>0){

      $('.gGallery li').wookmark({autoResize: true,
                                  offset: 5,
                                  container: $('.gGallery'),
                                  itemWidth: 110});
    }

    // custom scrollbar
    if($(".scroll").length > 0)
        $(".scroll").mCustomScrollbar();
    // eof custom scrollbar

    // Scroll up plugin
     $.scrollUp({scrollText: '^'});
    // eof scroll up plugin
});

$('.wrapper').resize(function(){

    if($("#wysiwyg").length > 0) editor.refresh();
    if($("#mail_wysiwyg").length > 0) m_editor.refresh();

});

function notify(title, text){

    $.pnotify({
        title: title,
        text: text,
        addclass: 'custom',
        hide: true,
        opacity: .8,
        nonblock: true,
        nonblock_opacity: .5
    });
}


text:
from __future__ import absolute_import

__all__ = ['build_session', 'delete', 'get', 'post', 'put']

import freight
import requests

from flask import current_app

USER_AGENT = 'freight/{version} (https://github.com/getsentry/freight)'.format(
    version=freight.VERSION,
),

def build_session():
    session = requests.Session()
    session.headers.update({'User-Agent': USER_AGENT})
    return session

def delete(*args, **kwargs):
    session = build_session()
    return session.delete(*args, **kwargs)

def get(*args, **kwargs):
    session = build_session()
    return session.get(*args, **kwargs)

def post(*args, **kwargs):
    session = build_session()
    return session.post(*args, **kwargs)

def put(*args, **kwargs):
    session = build_session()
    return session.put(*args, **kwargs)

def absolute_uri(path):
    base = current_app.config['FREIGHT_URL']
    if path.startswith(('http:', 'http:')):
        return path
    return '{}{}'.format(base, path)

redpajama_set_name: RedPajamaGithub


text:
using System.IO;
using Umbraco.Core.Models;

namespace Umbraco.Core.Persistence.Repositories
{
    public interface IUserControlRepository : IRepository<string, UserControl>
    {
        bool ValidateUserControl(UserControl userControl);
        Stream GetFileContentStream(string filepath);
        void SetFileContent(string filepath, Stream content);
        long GetFileSize(string filepath);
    }
}


text:
> An ESLint [Shareable Config](http://eslint.org/docs/developer-guide/shareable-configs) used at [M&C Saatchi London](http://mcsaatchi.com/london)

#### Install on your project
```
npm install eslint-config-mcsaatchi --save-dev
```

#### Add to your local `.eslintrc`
```json
{
  "extends": "mcsaatchi"
}
```

#### Or if you are using [ES6](http://www.ecma-international.org/ecma-262/6.0/):
```json
{
  "extends": "mcsaatchi/es6"
}
```

And don't forget to install the babel-eslint:
```
npm install babel-eslint --save-dev
```

---
You can override settings from the shareable config by adding them directly into your `.eslintrc` file.


text:
require 'rails_helper'

RSpec.describe Api::V1::EditionsController, type: :controller do

  describe '#index' do
    it 'can return editions' do
      create(:edition)
      get :index
      editions = assigns(:editions)
      expect(editions.count).to eq(1)
    end
  end

  describe '#show' do
    it 'can return a edition' do
      e = create(:edition)
      get :show, id: e.id
      edition = assigns(:edition)
      expect(edition).to eq(e)
    end
  end
end


text:
<?php

namespace Tests\AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class DefaultControllerTest extends WebTestCase
{
    public function testIndex()
    {
        $client = static::createClient();

        $crawler = $client->request('GET', '/');

        $this->assertSame(200, $client->getResponse()->getStatusCode());
    }

    public function testNew()
    {
        $client = static::createClient();

        $crawler = $client->request('GET', '/new');

        $this->assertSame(200, $client->getResponse()->getStatusCode());

        $form = $crawler->selectButton('Save')->form();
        $crawler = $client->submit($form, ['fortune' => [
            'quotes' => '<greg> hello',
        ]]);

        $this->assertSame(302, $client->getResponse()->getStatusCode());
    }
}


text:
#include <string.h>

#include "xen_internal.h"
#include <xen/api/xen_network_operations.h>
#include "xen_network_operations_internal.h"

/*
 * Maintain this in the same order as the enum declaration!
 */
static const char *lookup_table[] =
{
    "attaching",
    "undefined"
};

extern xen_network_operations_set *
xen_network_operations_set_alloc(size_t size)
{
    return calloc(1, sizeof(xen_network_operations_set) +
                  size * sizeof(enum xen_network_operations));
}

extern void
xen_network_operations_set_free(xen_network_operations_set *set)
{
    free(set);
}

const char *
xen_network_operations_to_string(enum xen_network_operations val)
{
    return lookup_table[val];
}

extern enum xen_network_operations
xen_network_operations_from_string(xen_session *session, const char *str)
{
    (void)session;
    return ENUM_LOOKUP(str, lookup_table);
}

const abstract_type xen_network_operations_abstract_type_ =
    {
        .typename = ENUM,
        .enum_marshaller =
             (const char *(*)(int))&xen_network_operations_to_string,
        .enum_demarshaller =
             (int (*)(xen_session *, const char *))&xen_network_operations_from_string
    };

const abstract_type xen_network_operations_set_abstract_type_ =
    {
        .typename = SET,
        .child = &xen_network_operations_abstract_type_
    };


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

    /// <summary>
    /// The RP custom operation error info.
    /// </summary>
    public partial class AffectedMoveResource
    {
        /// <summary>
        /// Initializes a new instance of the AffectedMoveResource class.
        /// </summary>
        public AffectedMoveResource()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the AffectedMoveResource class.
        /// </summary>
        /// <param name="id">The affected move resource id.</param>
        /// <param name="sourceId">The affected move resource source
        /// id.</param>
        /// <param name="moveResources">The affected move resources.</param>
        public AffectedMoveResource(string id = default(string), string sourceId = default(string), IList<AffectedMoveResource> moveResources = default(IList<AffectedMoveResource>))
        {
            Id = id;
            SourceId = sourceId;
            MoveResources = moveResources;
            CustomInit();
        }

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

        /// <summary>
        /// Gets the affected move resource id.
        /// </summary>
        [JsonProperty(PropertyName = "id")]
        public string Id { get; private set; }

        /// <summary>
        /// Gets the affected move resource source id.
        /// </summary>
        [JsonProperty(PropertyName = "sourceId")]
        public string SourceId { get; private set; }

        /// <summary>
        /// Gets the affected move resources.
        /// </summary>
        [JsonProperty(PropertyName = "moveResources")]
        public IList<AffectedMoveResource> MoveResources { get; private set; }

    }
}


text:
<?xml version="1.0" standalone="yes"?>
<!-- logreq request file -->
<!-- logreq version 1.0 / dtd version 1.0 -->
<!-- Do not edit this file! -->
<!DOCTYPE requests [
  <!ELEMENT requests (internal | external)*>
  <!ELEMENT internal (generic, (provides | requires)*)>
  <!ELEMENT external (generic, cmdline?, input?, output?, (provides | requires)*)>
  <!ELEMENT cmdline (binary, (option | infile | outfile)*)>
  <!ELEMENT input (file)+>
  <!ELEMENT output (file)+>
  <!ELEMENT provides (file)+>
  <!ELEMENT requires (file)+>
  <!ELEMENT generic (#PCDATA)>
  <!ELEMENT binary (#PCDATA)>
  <!ELEMENT option (#PCDATA)>
  <!ELEMENT infile (#PCDATA)>
  <!ELEMENT outfile (#PCDATA)>
  <!ELEMENT file (#PCDATA)>
  <!ATTLIST requests
    version CDATA #REQUIRED
  >
  <!ATTLIST internal
    package CDATA #REQUIRED
    priority (9) #REQUIRED
    active (0 | 1) #REQUIRED
  >
  <!ATTLIST external
    package CDATA #REQUIRED
    priority (1 | 2 | 3 | 4 | 5 | 6 | 7 | 8) #REQUIRED
    active (0 | 1) #REQUIRED
  >
  <!ATTLIST provides
    type (static | dynamic | editable) #REQUIRED
  >
  <!ATTLIST requires
    type (static | dynamic | editable) #REQUIRED
  >
  <!ATTLIST file
    type CDATA #IMPLIED
  >
]>
<requests version="1.0">
  <internal package="biblatex" priority="9" active="1">
    <generic>latex</generic>
    <provides type="dynamic">
      <file>MLPrimer--using-R.aux</file>
      <file>MLPrimer--using-R-blx.bib</file>
    </provides>
    <requires type="dynamic">
      <file>MLPrimer--using-R.bbl</file>
    </requires>
    <requires type="static">
      <file>blx-compat.def</file>
      <file>biblatex.def</file>
      <file>numeric.bbx</file>
      <file>standard.bbx</file>
      <file>numeric.cbx</file>
      <file>biblatex.cfg</file>
      <file>english.lbx</file>
    </requires>
  </internal>
  <external package="biblatex" priority="5" active="1">
    <generic>bibtex</generic>
    <cmdline>
      <binary>bibtex</binary>
      <option>-min-crossrefs 2</option>
      <infile>MLPrimer--using-R</infile>
    </cmdline>
    <input>
      <file>MLPrimer--using-R.aux</file>
    </input>
    <output>
      <file>MLPrimer--using-R.bbl</file>
    </output>
    <provides type="dynamic">
      <file>MLPrimer--using-R.bbl</file>
    </provides>
    <requires type="dynamic">
      <file>MLPrimer--using-R.aux</file>
      <file>MLPrimer--using-R-blx.bib</file>
    </requires>
    <requires type="editable">
    </requires>
    <requires type="static">
      <file>biblatex.bst</file>
    </requires>
  </external>
</requests>


text:
//
//  SteeringBehaviorObstacleAvoidance.cpp
//  NJLIGameEngine_iOS
//
//  Created by James Folk on 5/5/16.
//  Copyright © 2016 NJLIGames Ltd. All rights reserved.
//

#pragma mark Implementation

#include "SteeringBehaviorObstacleAvoidance.h"
#include "JLIFactoryTypes.h"
#include "SteeringBehaviorObstacleAvoidanceBuilder.h"
#include "World.h"

#define TAG "SteeringBehaviorObstacleAvoidance.cpp"

#define FORMATSTRING "{\"jli::SteeringBehaviorObstacleAvoidance\":[]}"
#include "JsonJLI.h"
#include "btPrint.h"

namespace njli
{
  SteeringBehaviorObstacleAvoidance::SteeringBehaviorObstacleAvoidance()
      : SteeringBehavior()
  {
  }

  SteeringBehaviorObstacleAvoidance::SteeringBehaviorObstacleAvoidance(
      const AbstractBuilder &builder)
      : SteeringBehavior(builder)
  {
  }

  SteeringBehaviorObstacleAvoidance::SteeringBehaviorObstacleAvoidance(
      const SteeringBehaviorObstacleAvoidance &copy)
      : SteeringBehavior(copy)
  {
  }

  SteeringBehaviorObstacleAvoidance::~SteeringBehaviorObstacleAvoidance() {}

  SteeringBehaviorObstacleAvoidance &SteeringBehaviorObstacleAvoidance::
  operator=(const SteeringBehaviorObstacleAvoidance &rhs)
  {
    if (this != &rhs)
      {
      }
    return *this;
  }

  s32 SteeringBehaviorObstacleAvoidance::calculateSerializeBufferSize() const
  {
    // TODO: calculateSerializeBufferSize
    return 0;
  }

  void
  SteeringBehaviorObstacleAvoidance::serialize(void *dataBuffer,
                                               btSerializer *serializer) const
  {
    // TODO: serialize
  }

  const char *SteeringBehaviorObstacleAvoidance::getClassName() const
  {
    return "SteeringBehaviorObstacleAvoidance";
  }

  s32 SteeringBehaviorObstacleAvoidance::getType() const
  {
    return SteeringBehaviorObstacleAvoidance::type();
  }

  SteeringBehaviorObstacleAvoidance::operator std::string() const
  {
    // TODO: implement to string...

    std::string s = string_format("%s", FORMATSTRING);

    JsonJLI *json = JsonJLI::create();
    s = json->parse(s.c_str());
    JsonJLI::destroy(json);

    return s;
  }

  SteeringBehaviorObstacleAvoidance **
  SteeringBehaviorObstacleAvoidance::createArray(const u32 size)
  {
    return (SteeringBehaviorObstacleAvoidance **)World::getInstance()
        ->getWorldFactory()
        ->createArray(SteeringBehaviorObstacleAvoidance::type(), size);
  }

  void SteeringBehaviorObstacleAvoidance::destroyArray(
      SteeringBehaviorObstacleAvoidance **array, const u32 size)
  {
    World::getInstance()->getWorldFactory()->destroyArray(
        (AbstractFactoryObject **)array, size);
  }

  SteeringBehaviorObstacleAvoidance *SteeringBehaviorObstacleAvoidance::create()
  {
    return dynamic_cast<SteeringBehaviorObstacleAvoidance *>(
        World::getInstance()->getWorldFactory()->create(
            SteeringBehaviorObstacleAvoidance::type()));
  }

  SteeringBehaviorObstacleAvoidance *SteeringBehaviorObstacleAvoidance::create(
      const SteeringBehaviorObstacleAvoidanceBuilder &builder)
  {
    AbstractBuilder *b = (AbstractBuilder *)&builder;

    return dynamic_cast<SteeringBehaviorObstacleAvoidance *>(
        World::getInstance()->getWorldFactory()->create(*b));
  }

  SteeringBehaviorObstacleAvoidance *SteeringBehaviorObstacleAvoidance::clone(
      const SteeringBehaviorObstacleAvoidance &object)
  {
    return dynamic_cast<SteeringBehaviorObstacleAvoidance *>(
        World::getInstance()->getWorldFactory()->clone(object, false));
  }

  SteeringBehaviorObstacleAvoidance *SteeringBehaviorObstacleAvoidance::copy(
      const SteeringBehaviorObstacleAvoidance &object)
  {
    return dynamic_cast<SteeringBehaviorObstacleAvoidance *>(
        World::getInstance()->getWorldFactory()->clone(object, true));
  }

  void SteeringBehaviorObstacleAvoidance::destroy(
      SteeringBehaviorObstacleAvoidance *object)
  {
    World::getInstance()->getWorldFactory()->destroy(object);
  }

  void SteeringBehaviorObstacleAvoidance::load(
      SteeringBehaviorObstacleAvoidance &object, lua_State *L, int index)
  {
    // Push another reference to the table on top of the stack (so we know
    // where it is, and this function can work for negative, positive and
    // pseudo indices
    lua_pushvalue(L, index);
    // stack now contains: -1 => table
    lua_pushnil(L);
    // stack now contains: -1 => nil; -2 => table
    while (lua_next(L, -2))
      {
        // stack now contains: -1 => value; -2 => key; -3 => table
        // copy the key so that lua_tostring does not modify the original
        lua_pushvalue(L, -2);
        // stack now contains: -1 => key; -2 => value; -3 => key; -4 => table
        const char *key = lua_tostring(L, -1);
        //            const char *value = lua_tostring(L, -2);
        if (lua_istable(L, -2))
          {
            SteeringBehaviorObstacleAvoidance::load(object, L, -2);
          }
        else
          {
            if (lua_isnumber(L, index))
              {
                double number = lua_tonumber(L, index);
                printf("%s => %f\n", key, number);
              }
            else if (lua_isstring(L, index))
              {
                const char *v = lua_tostring(L, index);
                printf("%s => %s\n", key, v);
              }
            else if (lua_isboolean(L, index))
              {
                bool v = lua_toboolean(L, index);
                printf("%s => %d\n", key, v);
              }
            else if (lua_isuserdata(L, index))
              {
                //                    swig_lua_userdata *usr;
                //                    swig_type_info *type;
                //                    assert(lua_isuserdata(L,index));
                //                    usr=(swig_lua_userdata*)lua_touserdata(L,index);
                //                    /* get data */
                //                    type = usr->type;
                //                    jli::AbstractFactoryObject *object =
                //                    static_cast<jli::AbstractFactoryObject*>(usr->ptr);
                //                    printf("%s => %d:%s\n", key,
                //                    object->getType(),
                //                    object->getClassName());
              }
          }
        // pop value + copy of key, leaving original key
        lua_pop(L, 2);
        // stack now contains: -1 => key; -2 => table
      }
    // stack now contains: -1 => table (when lua_next returns 0 it pops the key
    // but does not push anything.)
    // Pop table
    lua_pop(L, 1);
    // Stack is now the same as it was on entry to this function
  }

  u32 SteeringBehaviorObstacleAvoidance::type()
  {
    return JLI_OBJECT_TYPE_SteeringBehaviorObstacleAvoidance;
  }

  const btVector3 &SteeringBehaviorObstacleAvoidance::calculateForce()
  {
    SDL_assertPrint(false, "TODO");
    return *m_CurrentForce;
  }
}


text:
package Pod::Abstract::Node;
use strict;
use warnings;

use Pod::Abstract::Tree;
use Pod::Abstract::Serial;

use Scalar::Util qw(weaken);

our $VERSION = '0.20';

=head1 NAME

Pod::Abstract::Node - Pod Document Node.

=head1 SYNOPSIS

 $node->nest( @list );          # Nests list as children of $node. If they
                                # exist in a tree they will be detached.
 $node->clear;                  # Remove (detach) all children of $node
 $node->hoist;                  # Append all children of $node after $node.
 $node->detach;                 # Detaches intact subtree from parent
 $node->select( $path_exp );    # Selects the path expression under $node
 $node->select_into( $target, $path_exp );
                                # Selects into the children of the
                                # target node.  (copies)

 $node->insert_before($target); # Inserts $node in $target's tree
                                # before $target
 $node->insert_after($target);

 $node->push($target);          # Appends $target at the end of this node
 $node->unshift($target);       # Prepends $target at the start of this node

 $node->path();                 # List of nodes leading to this one
 $node->children();             # All direct child nodes of this one
 $node->next();                 # Following sibling if present
 $node->previous();             # Preceding sibling if present

 $node->duplicate();            # Duplicate node and children in a new tree.

 $node->pod;                    # Convert node back into literal POD
 $node->ptree;                  # Show visual (abbreviated) parse tree

=head1 METHODS

=for sorting

=cut

=head2 new

 my $node = Pod::Abstract::Node->new(
    type => ':text', body => 'Some text',
 );

Creates a new, unattached Node object. This is NOT the recommended way
to make nodes to add to a document, use Pod::Abstract::BuildNode for
that. There are specific rules about how data must be set up for these
nodes, and C<new> lets you ignore them.

Apart from type and body, all other hash arguments will be converted
into "params", which may be internal data or node attributes.

Type may be:

=over

=item *

A plain word, which is taken to be a command name.

=item *

C<:paragraph>, C<:text>, C<:verbatim> or <:X> (where X is an inline
format letter). These will be treated as you would expect.

=item *

C<#cut>, meaning this is literal, non-pod text.

=back

Note that these do not guarantee the resulting document structure will
match your types - types are derived from the document, not the other
way around. If your types do not match your document they will mutate
when it is reloaded.

See L<Pod::Abstract::BuildNode> if you want to make nodes easily for
creating/modifying a document tree.

=cut

sub new {
    my $class = shift;
    my %args = @_;
    my $type = $args{type};
    my $body = $args{body};
    delete $args{type};
    delete $args{body};

    my $self = bless {
        tree => Pod::Abstract::Tree->new(),
        serial => Pod::Abstract::Serial->next,
        parent => undef,
        type => $type,
        body => $body,
        params => { %args },
    }, $class;

    return $self;
}

=head2 ptree

 print $n->ptree;

Produces a formatted, readable, parse tree. Shows node types, nesting
structure, abbreviated text. Does NOT show all information, but shows
enough to help debug parsing/traversal problems.

=cut

sub ptree {
    my $self = shift;
    my $indent = shift || 0;
    my $width = 72 - $indent;

    my $type = $self->type;
    my $body = $self->body;
    if(my $body_attr = $self->param('body_attr')) {
        $body = $self->param($body_attr)->pod;
    }
    $body =~ s/[\n\t]//g if $body;

    my $r = ' ' x $indent;
    if($body) {
        $r .= substr("[$type] $body",0,$width);
    } else {
        $r .= "[$type]";
    }
    $r = sprintf("%3d %s",$self->serial, $r);
    $r .= "\n";
    my @children = $self->children;
    foreach my $c (@children) {
        $r .= $c->ptree($indent + 2);
    }
    return $r;
}

=head2 text

 print $n->text;

Returns the text subnodes only of the given node, concatenated
together - i,e, the text only with no formatting at all.

=cut

my %escapes = (
    'gt'     => '>',
    'lt'     => '<',
    'sol'    => '/',
    'verbar' => '|',
    );

sub text {
    my $self = shift;

    my $r = '';
    my $type = $self->type;
    my $body = $self->body;

    my @children = $self->children;
    if($type eq ':text') {
	    $r .= $body;
    } elsif( $type eq ':E' ) {
        my $code = '';
        foreach my $c (@children) {
            $code .= $c->text;
        }
        if($escapes{$code}) {
            $r .= $escapes{$code};
        }
        return $r;
    }

    foreach my $c (@children) {
        # Recurse into child elements, but special case :X as these are invisible.
        # This dodges past a bit of naff pod use which is in perlpod.pod - comes
        # down to how poorly defined bullet lists are.
        $r .= $c->text unless $c->type eq ':X';
    }

    return $r;
}

=head2 pod

 print $n->pod;

Returns the node (and all subnodes) formatted as POD. A newly loaded
node should produce the original POD text when pod is requested.

=cut

sub pod {
    my $self = shift;

    my $r = '';
    my $body = $self->body;
    my $type = $self->type;
    my $should_para_break = 0;
    my $p_break = $self->param('p_break');
    $p_break = "\n\n" unless defined $p_break;

    my $r_delim = undef; # Used if a interior sequence needs closing.

    if($type eq ':paragraph') {
        $should_para_break = 1;
    } elsif( $type eq ':text' or $type eq '#cut' or $type eq ':verbatim') {
        $r .= $body;
    } elsif( $type =~ m/^\:(.+)$/ ) { # Interior sequence
        my $cmd = $1;
        my $l_delim = $self->param('left_delimiter');
        $r_delim = $self->param('right_delimiter');
        $r .= "$cmd$l_delim";
    } elsif( $type eq '[ROOT]' or $type =~ m/^@/) {
        # ignore
    } else { # command
        my $body_attr = $self->param('body_attr');
        if($body_attr) {
            $body = $self->param($body_attr)->pod;
        }
        if(defined $body && $body ne '') {
            $r .= "=$type $body$p_break";
        } else {
            $r .= "=$type$p_break";
        }
    }

    my @children = $self->children;
    foreach my $c (@children) {
        $r .= $c->pod;
    }

    if($should_para_break) {
        $r .= $p_break;
    } elsif($r_delim) {
        $r .= $r_delim;
    }

    if($self->param('close_element')) {
        $r .= $self->param('close_element')->pod;
    }

    return $r;
}

=head2 select

 my @nodes = $n->select('/:paragraph[//:text =~ {TODO}]');

Select a pPath expression against this node. The above example will
select all paragraphs in the document containing 'TODO' in any of
their text nodes.

The returned values are the real nodes from the document tree, and
manipulating them will transform the document.

=cut

sub select {
    my $self = shift;
    my $path = shift;

    my $p_path = Pod::Abstract::Path->new($path);
    return $p_path->process($self);
}

=head2 select_into

 $node->select_into($target_node, $path)

As with select, this will match a pPath expression against $node - but
the resulting nodes will be copied and added as children to
$target_node. The nodes that were added will be returned as a list.

=cut

sub select_into {
    my $self = shift;
    my $target = shift;
    my $path = shift;

    my @nodes = $self->select($path);
    my @dup_nodes = map { $_->duplicate } @nodes;

    return $target->nest(@dup_nodes);
}

=head2 type

 $node->type( [ $new_type ] );

Get or set the type of the node.

=cut

sub type {
    my $self = shift;
    if(@_) {
        my $new_val = shift;
        $self->{type} = $new_val;
    }
    return $self->{type};
}

=head2 body

 $node->body( [ $new_body ] );

Get or set the node body text. This is NOT the child tree of the node,
it is the literal text as used by text/verbatim nodes.

=cut

sub body {
    my $self = shift;
    if(@_) {
        my $new_val = shift;
        $self->{body} = $new_val;
    }
    return $self->{body};
}

=head2 param

 $node->param( $p_name [, $p_value ] );

Get or set the named parameter. Any value can be used, but for
document attributes a Pod::Abstract::Node should be set.

=cut

sub param {
    my $self = shift;
    my $param_name = shift;
    if(@_) {
        my $new_val = shift;
        $self->{params}{$param_name} = $new_val;
    }
    return $self->{params}{$param_name};
}

=head2 link_info

 my $link_info = $node->link_info;

For C<:L> nodes (Links), break up the link according to the Perl Pod rules
and return a hashref containing C<text>, C<document> and C<section>.

=cut

sub link_info {
    my $self = shift;
    my $t = $self->text;
    $t =~ m/^(([^\|]*)\|)?([^\/]*)\/?(.*)$/;

    my ($text,$doc,$section) = ($2,$3,$4);
    if($doc && $doc =~ m/^.+\:$/) {
        my $url = "$doc/$section";
        return {
            url => $url,
            link_text => $text,
            text => $text || $url,
        };
    } else {
        return {
            text => $text || $doc || $section,
            link_text => $text,
            document => $doc,
            section => $section,
        };
    }
}

=cut

=head2 duplicate

 my $new_node = $node->duplicate;

Make a deep-copy of the node. The duplicate node returned has an
identical document tree, but different node identifiers.

=cut

sub duplicate {
    my $self = shift;
    my $class = ref $self;

    # Implement the new() call with all the data needed.
    my $params = $self->{params};
    my %new_params = ( );
    foreach my $param (keys %$params) {
        my $pv = $params->{$param};
        if(ref $pv && eval { $pv->can('duplicate') } ) {
            $new_params{$param} = $pv->duplicate;
        } elsif(! ref $pv) {
            $new_params{$param} = $pv;
        } else {
            die "Don't know how to copy a ", ref $pv;
        }
    }
    my $dup = $class->new(
        type => $self->type,
        body => $self->body,
        %new_params,
        );

    my @children = $self->children;
    my @dup_children = map { $_->duplicate } @children;
    $dup->nest(@dup_children);

    return $dup;
}

=head2 insert_before

 $node->insert_before($target);

Inserts $node before $target, as a sibling of $target. If $node is
already in a document tree, it will be removed from it's existing
position.

=cut

sub insert_before {
    my $self = shift;
    my $target = shift;

    my $target_tree = $target->parent->tree;
    die "Can't insert before a root node" unless $target_tree;
    if($target_tree->insert_before($target, $self)) {
        $self->parent($target->parent);
    } else {
        die "Could not insert before [$target]";
    }
}

=head2 insert_after

 $node->insert_after($target);

Inserts $node after $target, as a sibling of $target. If $node is
already in a document tree, it will be removed from it's existing
position.

=cut

sub insert_after {
    my $self = shift;
    my $target = shift;

    my $target_tree = $target->parent->tree;
    die "Can't insert after a root node" unless $target_tree;
    if($target_tree->insert_after($target, $self)) {
        $self->parent($target->parent);
    } else {
        die "Could not insert before [$target]";
    }
}

=head2 hoist

 $node->hoist;

Inserts all children of $node, in order, immediately after
$node. After this operation, $node will have no children. In pictures:

 - a
  - b
  - c
   - d
 -f

 $a->hoist; # ->

 - a
 - b
 - c
  - d
 - f

=cut

sub hoist {
    my $self = shift;
    my @children = $self->children;

    my $parent = $self->parent;

    my $target = $self;
    foreach my $n(@children) {
        $n->detach;
        $n->insert_after($target);
        $target = $n;
    }

    return scalar @children;
}

=head2 clear

 $node->clear;

Detach all children of $node. The detached nodes will be returned, and
can be safely reused, but they will no longer be in the document tree.

=cut

sub clear {
    my $self = shift;
    my @children = $self->children;

    foreach my $n (@children) {
        $n->detach;
    }

    return @children;
}

=head2 push

 $node->push($target);

Pushes $target at the end of $node's children.

=cut

sub push {
    my $self = shift;
    my $target = shift;

    my $target_tree = $self->tree;
    if($target_tree->push($target)) {
        $target->parent($self);
    } else {
        die "Could not push [$target]";
    }
}

=head2 nest

 $node->nest(@new_children);

Adds @new_children to $node's children. The new nodes will be added at
the end of any existing children. This can be considered the inverse
of hoist.

=cut

sub nest {
    my $self = shift;

    foreach my $target (@_) {
        $self->push($target);
    }

    return @_;
}

sub tree {
    my $self = shift;
    return $self->{tree};
}

=head2 unshift

 $node->unshift($target);

The reverse of push, add a node to the start of $node's children.

=cut

sub unshift {
    my $self = shift;
    my $target = shift;

    my $target_tree = $self->tree;
    if($target_tree->unshift($target)) {
        $target->parent($self);
    } else {
        die "Could not unshift [$target]";
    }
}

=head2 serial

 $node->serial;

The unique serial number of $node. This should never be modified.

=cut

sub serial {
    my $self = shift;
    return $self->{serial};
}

=head2 attached

 $node->attached;

Returns true if $node is attached to a document tree.

=cut

sub attached {
    my $self = shift;
    return defined $self->parent;
}

=head2 detach

 $node->detach;

Removes a node from it's document tree. Returns true if the node was
removed from a tree, false otherwise. After this operation, the node
will be detached.

Detached nodes can be reused safely.

=cut

sub detach {
    my $self = shift;

    if($self->parent) {
        $self->parent->tree->detach($self);
        return 1;
    } else {
        return 0;
    }
}

=head2 parent

 my $parent = $node->parent;

Returns the parent of C<$node> if available. Returns undef if no parent.

=cut

sub parent {
    my $self = shift;

    if(@_) {
        my $new_parent = shift;
        if( defined $self->{parent} &&
            $self->parent->tree->detach($self) ) {
            warn "Implicit detach when reparenting";
        }
        $self->{parent} = $new_parent;

        # Parent nodes have to be weak - otherwise we leak.
        weaken $self->{parent}
           if defined $self->{parent};
    }

    return $self->{parent};
}

=head2 parents

 my @parents = $node->parents;

Returns a list of the parents of C<$node>, including C<$node>.

=cut

sub parents {
    my $self = shift;

    my $current = $self;
    my @r = ( );
    while($current) {
        CORE::push @r, $current;
        $current = $current->parent;
    }

    return @r;
}

=head2 path_to

 my $path_to = $node->path_to;

Returns a L<ppath|Pod::Abstract::Path> expression that will lead to the
heading/item containing C<$node>, as best as is possible by named nodes.

=cut

sub path_to {
    my $self = shift;
    my @parents = reverse $self->parents;

    my $result = '';
    foreach my $p (@parents) {
        if($p->type =~ m/^head[123456]$/) {
            my $heading = $p->param('heading')->text;
            $result .= "/" . $p->{type} . "[ \@heading eq '$heading' ]"
        } elsif($p->type eq 'over') {
            $result .= "/over"
        } elsif($p->type eq 'item') {
            my $label = $p->param('label')->text;
            $result .= "/item[ \@label eq '$label' ]";
        }
    }

    return $result;
}

=cut

=head2 root

 $node->root

Find the root node for the tree holding this node - this may be the
original node if it has no parent.

=cut

sub root {
    my $n = shift;

    while(defined $n->parent) {
        $n = $n->parent;
    }

    return $n;
}

=head2 children

 my @children = $node->children;

Returns the children of the node in document order.

=cut

sub children {
    my $self = shift;
    return $self->tree->children();
}

=head2 next

 my $next = $node->next;

Returns the following sibling of $node, if one exists. If there is no
following node undef will be returned.

=cut

sub next {
    my $self = shift;
    my $parent = $self->parent;

    return undef unless $parent; # No following node for root nodes.
    return $parent->tree->index_relative($self,+1);
}

=head2 previous

 my $previous = $node->previous;

Returns the preceding sibling of $node, if one exists. If there is no
preceding node, undef will be returned.

=cut

sub previous {
    my $self = shift;
    my $parent = $self->parent;

    return undef unless $parent; # No preceding nodes for root nodes.
    return $parent->tree->index_relative($self,-1);
}

=head2 coalesce_body

 $node->coalesce_body(':verbatim');

This performs node coalescing as required by perlpodspec. Successive
verbatim nodes can be merged into a single node. This is also done
with text nodes, primarily for =begin/=end blocks.

The named node type will be merged together in the child document
wherever there are two or more successive nodes of that type. Don't
use for anything except C<:text> and C<:verbatim> nodes unless you're
really sure you know what you want.

=cut

sub coalesce_body {
    my $self = shift;
    my $node_type = shift;

    # Select all elements containing :verbatim nodes.
    my @candidates = $self->select("//[/$node_type]");
    foreach my $c (@candidates) {
        my @children = $c->children;
        my $current_start = undef;
        foreach my $n (@children) {
            if($n->type eq $node_type) {
                if(defined $current_start) {
                    my $p_break = $current_start->param('p_break');
                    $p_break = "" unless $p_break;
                    my $body_start = $current_start->body;
                    $current_start->body(
                        $body_start . $p_break . $n->body
                        );
                    $current_start->param('p_break',
                                          $n->param('p_break'));
                    $n->detach or die; # node has been appended to prev.
                } else {
                    $current_start = $n;
                }
            } else {
                $current_start = undef;
            }
        }
    }
}

=head1 AUTHOR

Ben Lilburne <bnej@mac.com>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2009 Ben Lilburne

This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

1;


text:
``` purescript
type YObject = Map String YValue
```

#### `YArray`

``` purescript
type YArray = Array YValue
```

#### `YAML`

``` purescript
data YAML :: Type
```

#### `YValue`

``` purescript
data YValue
  = YObject YObject
  | YArray YArray
  | YString String
  | YNumber Number
  | YInt Int
  | YBoolean Boolean
  | YNull
```

##### Instances
``` purescript
Show YValue
Eq YValue
```

#### `ToYAML`

``` purescript
class ToYAML a  where
  toYAML :: a -> YValue
```

##### Instances
``` purescript
ToYAML Boolean
ToYAML Int
ToYAML Number
ToYAML String
(ToYAML a) => ToYAML (Array a)
(ToYAML a) => ToYAML (Maybe a)
```

#### `Pair`

``` purescript
type Pair = Tuple String YValue
```

#### `entry`

``` purescript
entry :: forall a. ToYAML a => String -> a -> Pair
```

Helper function to create a key-value tuple for a YAML object.

`name = "Name" := "This is the name"`

#### `(:=)`

``` purescript
infixl 4 entry as :=
```

#### `object`

``` purescript
object :: Array Pair -> YValue
```

Helper function to create a YAML object.

`obj = object [ "Name" := "This is the name", "Size" := 1.5 ]`

#### `jsNull`

``` purescript
jsNull :: YAML
```

#### `objToHash`

``` purescript
objToHash :: Fn4 (YValue -> YAML) (Tuple String YValue -> String) (Tuple String YValue -> YValue) (Array (Tuple String YValue)) YAML
```

#### `valueToYAML`

``` purescript
valueToYAML :: YValue -> YAML
```

#### `toYAMLImpl`

``` purescript
toYAMLImpl :: YAML -> String
```

#### `printYAML`

``` purescript
printYAML :: forall a. ToYAML a => a -> String
```


text:
package com.voler.myapplication.mvp.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.EditText;
import android.widget.TextView;

import com.jess.arms.utils.DataHelper;
import com.jess.arms.utils.UiUtils;
import com.voler.myapplication.R;
import com.voler.myapplication.util.StringUtil;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

import static com.voler.myapplication.util.StringUtil.sha2;

/**
 * 妈妈生活圈
 * 三尺春光驱我寒,一生戎马为长安 -- 韩经录
 * Created by voler on 2016/10/20.
 */

public class RegisterActivity extends AppCompatActivity {
    @Bind(R.id.et_input_password1)
    EditText etInputPassword1;
    @Bind(R.id.et_input_password2)
    EditText etInputPassword2;
    @Bind(R.id.tv_register)
    TextView tvRegister;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        ButterKnife.bind(this);
    }

    @OnClick(R.id.tv_register)
    public void onClick() {
        String pd1 = etInputPassword1.getText().toString().trim();
        String pd2 = etInputPassword2.getText().toString().trim();
        if (pd1==null||"".equals(pd1)){
            UiUtils.makeText("请输入密码");
        }else if (!pd1.equals(pd2)){
            UiUtils.makeText("两次输入的密码不一致");
        }else {
            String myPassword = StringUtil.sha2(StringUtil.sha2(pd1) + sha2(pd1 + StringUtil.salt));
            DataHelper.SetStringSF(this,"password",myPassword);
            Intent intent=new Intent(this,RealMainActivity.class);
            startActivity(intent);
        }
    }
}


text: python3 -m pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib


text:
package ru.job4j.lambda;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;

/**.
 * A simple function is computed in a range.
 * @author Anton Vasilyuk (z241287@yandex.ru)
 * @version 0.1$
 * @since 0.1
 * 18.05.2019
 */
public class FunctionInRange {

    /**.
     * Functial method for operation with diapason numbers
     * @param start is start number
     * @param finish is finish number
     * @param op is function
     * @return list results
     */
    public List<Double> diapason(int start, int finish, Function<Double, Double> op) {
        List<Double> result = new ArrayList<>();
        for (int index = start; index <= finish; index++) {
            result.add(
                    op.apply((double) index)
            );
        }
        return result;
    }

}


text:
' Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

Imports System.Collections.Immutable
Imports System.Diagnostics
Imports System.Runtime.InteropServices
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports TypeKind = Microsoft.CodeAnalysis.TypeKind

Namespace Microsoft.CodeAnalysis.VisualBasic
    Partial Friend NotInheritable Class LocalRewriter
        Public Overrides Function VisitThrowStatement(node As BoundThrowStatement) As BoundNode

            Dim expressionOpt As BoundExpression = node.ExpressionOpt

            If expressionOpt IsNot Nothing Then
                expressionOpt = VisitExpressionNode(expressionOpt)

                If expressionOpt.Type.SpecialType = SpecialType.System_Int32 Then
                    Debug.Assert(node.Syntax.Kind = SyntaxKind.ErrorStatement, "Must be an Error statement.")
                    Dim nodeFactory As New SyntheticBoundNodeFactory(_topMethod, _currentMethodOrLambda, node.Syntax, _compilationState, _diagnostics)

                    Dim createProjectError As MethodSymbol = nodeFactory.WellKnownMember(Of MethodSymbol)(WellKnownMember.Microsoft_VisualBasic_CompilerServices_ProjectData__CreateProjectError)

                    If createProjectError IsNot Nothing Then
                        expressionOpt = New BoundCall(node.Syntax, createProjectError, Nothing, Nothing,
                                                      ImmutableArray.Create(Of BoundExpression)(expressionOpt),
                                                      Nothing, createProjectError.ReturnType)
                    End If
                End If
            End If

            Dim rewritten As BoundStatement = node.Update(expressionOpt)

            If ShouldGenerateUnstructuredExceptionHandlingResumeCode(node) Then
                rewritten = RegisterUnstructuredExceptionHandlingResumeTarget(node.Syntax, rewritten, canThrow:=True)
            End If

            If Instrument(node, rewritten) Then
                rewritten = _instrumenterOpt.InstrumentThrowStatement(node, rewritten)
            End If

            Return rewritten
        End Function
    End Class
End Namespace


text:
namespace net::nqe::internal {

CachedNetworkQuality::CachedNetworkQuality()
    : effective_connection_type_(EFFECTIVE_CONNECTION_TYPE_UNKNOWN) {}

CachedNetworkQuality::CachedNetworkQuality(
    EffectiveConnectionType effective_connection_type)
    : CachedNetworkQuality(base::TimeTicks::Now(),
                           NetworkQuality(),
                           effective_connection_type) {}

CachedNetworkQuality::CachedNetworkQuality(
    base::TimeTicks last_update_time,
    const NetworkQuality& network_quality,
    EffectiveConnectionType effective_connection_type)
    : last_update_time_(last_update_time),
      network_quality_(network_quality),
      effective_connection_type_(effective_connection_type) {}

CachedNetworkQuality::CachedNetworkQuality(const CachedNetworkQuality& other) =
    default;

CachedNetworkQuality::~CachedNetworkQuality() = default;

CachedNetworkQuality& CachedNetworkQuality::operator=(
    const CachedNetworkQuality& other) = default;

bool CachedNetworkQuality::OlderThan(
    const CachedNetworkQuality& cached_network_quality) const {
  return last_update_time_ < cached_network_quality.last_update_time_;
}

}  // namespace net::nqe::internal


text:
export class TakeValueConverter {
  toView(array, count) {
    return array.slice(0, count);
  }
}


text:
package proguard.util;

/**
 * This interface provides a method to determine whether strings match a given
 * criterion, which is specified by the implementation.
 *
 * @author Eric Lafortune
 */
public interface StringMatcher
{
    /**
     * Checks whether the given string matches.
     * @param string the string to match.
     * @return a boolean indicating whether the string matches the criterion.
     */
    public boolean matches(String string);
}


text:
classdef Updater < hgsetget
    % Updater - Class which handles all update logic for the application
    %
    %   This class is designed to handle the multiple stages of automatic
    %   updates:
    %
    %       1) Check for new release via a RESTful API
    %       2) Prompt the user to approve the update
    %       3) Download the update from the web
    %       4) Install the update into the specified directory
    %
    % USAGE:
    %   updater = Updater('URL',        url, ...
    %                     'Version',    version, ...
    %                     'InstallDir', folder)
    %
    % INPUTS:
    %   url:        String, Full URL to where the software exists (for now
    %               this is required to be a Github URL.)
    %
    %   version:    String, Version number of the current release. Can be
    %               of any form accepted by VersionNumber.
    %
    %   folder:     String, Path to the folder in which to install the
    %               update. By default this is the base directory of the
    %               installation of this file.
    %
    % OUTPUTS:
    %   updater:    Object, Handle to the Updater object which can be used
    %               by the user to actually launch the updater and perform
    %               other actions.

    properties
        URL         % Full URL to where the software exists
        Version     % Current version of the software
        Repo        % Repository name of the form: {username}/{reponame}
        API         % URL of the RESTful API for updates
        InstallDir  % Directory in which to install the data
        Config      % Configuration object to store update info
    end

    properties (Constant, Abstract)
        PATTERN     % Regex pattern used for determining updater
    end

    events
        Status      % Event fired when there is a status to report
    end

    methods
        function self = Updater(varargin)
            % Updater - Updater constructor
            %
            % USAGE:
            %   updater = Updater('URL',        url, ...
            %                     'Version',    version, ...
            %                     'InstallDir', folder)
            %
            % INPUTS:
            %   url:        String, Full URL to where the software exists
            %               (for now this is required to be a Github URL.)
            %
            %   version:    String, Version number of the current release.
            %               Can be of any form accepted by VersionNumber.
            %
            %   folder:     String, Path to the folder in which to install
            %               the update. By default this is the base
            %               directory of the installation of this file.
            %
            % OUTPUTS:
            %   updater:    Object, Handle to the Updater object which can
            %               be used by the user to actually launch the
            %               updater and perform other actions.

            inputs = plugins.Updater.parseinputs(varargin{:});
            set(self, inputs)

            % Get the project out of the URL
            self.Repo = regexp(self.URL, self.PATTERN, 'match', 'once');

            if isempty(self.Repo)
                error(sprintf('%s:UnsupportedHost', mfilename), ...
                    'URL not recognized by any registered updater');
            end
        end

        function [bool, versionNumber] = launch(self, force, varargin)
            % launch - Actually launch the updater
            %
            %   This method uses the information provided to the
            %   constructor to check for updates, prompt the user to
            %   upgrade, and perform the installation in place.
            %
            % USAGE:
            %   [success, version] = Updater.launch(force)
            %
            % INPUTS:
            %   force:      Logical, Forces the updater to perform the
            %               installation (if an update is available).
            %               Default = false.
            %
            % OUTPUTS:
            %   success:    Integer, Indicates whether the update was
            %               performed (1), whether the current version
            %               udpates should be ignored (-1), or if the
            %               update failed (0).
            %
            %   version:    String, Represents the latest release version
            %               that was found on the remote server.

            bool = false;
            versionNumber = '';

            [hasupdate, release] = self.updateAvailable(varargin{:});

            % Ignore if there are no available updates
            if ~hasupdate; return; end

            message = sprintf('Update found (%s)', char(release.Version));
            self.setStatus(message);

            versionNumber = release.Version;

            if exist('force', 'var') && force
                proceed = 'update';
            else
                proceed = self.prompt(release);
            end

            switch lower(proceed)
                case 'update'
                    folder = self.download(release);
                    bool = self.install(folder, self.InstallDir);
                case 'ignore'
                    % Notify the caller that we don't want to check
                    % automatically
                    bool = -1;
                case 'remind'
                    bool = 0;
            end
        end

        function folder = download(self, url)
            % download - Downloads the ZIP file to a temporary folder
            %
            % USAGE:
            %   folder = Updater.download(url)
            %
            % INPUTS:
            %   url:    String, URL to a zip file to be downloaded
            %
            % OUTPUTS:
            %   folder: String, Path to where the zip file was extracted.

            if isstruct(url); url = url.URL; end

            self.setStatus(sprintf('Downloading update from %s...', url));

            % Download the file
            filename = urlwrite(url, tempname);

            try  % First try to unzip it
                files = unzip(filename);
            catch ME
                if ~strcmp(ME.identifier, 'MATLAB:unzip:invalidZipFile')
                    rethrow(ME);
                end

                % If that failed, then assume it is a gzipped tarfile.
                files = gunzip(filename, tempname);

                % It is only going to contain one file
                tarfile = files{1};
                folder = fileparts(tarfile);

                % Untar everything to this folder
                files = untar(tarfile, folder);

                % Remove the tarfile
                delete(tarfile);

                % Remove the pax_global_header if present
                pgh = fullfile(folder, 'pax_global_header');
                if exist(pgh, 'file'); delete(pgh); end

                % Remove any invalid files from the list of extracted files
                files = files(cellfun(@(x)exist(x, 'file'), files) ~= 0);
            end

            % Downloaded information
            folder = basepath(files);
            delete(filename);
        end

        function bool = install(self, src, destination)
            % install - Install files from the destination into the source
            %
            % USAGE:
            %   bool = Updater.install(src, dest)
            %
            % INPUTS:
            %   src:    String, Path to where the new files to store
            %           reside.
            %
            %   dest:   String, Path to the location in which to install
            %           the files.
            %
            % OUTPUTS:
            %   bool:   Logical, Indicates whether the files were
            %           successfully installed (true) or not (false)

            try
                message = sprintf('Copying files into place (%s)...', ...
                                  destination);
                self.setStatus(message);

                % Now copy all of these to the destination directory
                util = org.apache.commons.io.FileUtils;
                util.copyDirectory(java.io.File(src), ...
                                   java.io.File(destination));

                % Now clear out the source
                rmdir(src, 's');

                % Run any post-install scripts if there are any
                install_script = fullfile(destination, 'install.m');
                if exist(install_script, 'file')
                    % Strip off the trailing file separators and determine
                    % the package name
                    pth = regexprep(destination, '[\\\/]*$', '');
                    [~, pkg] = fileparts(pth);
                    pkg = regexp(pkg, '(?<=\+).*', 'once', 'match');

                    fcn = str2func(sprintf('plugins.%s.install', pkg));
                    bool = fcn(self);
                else
                    bool = true;
                end
            catch
                bool = false;
            end
        end
    end

    methods (Access = 'public')
        function setStatus(self, message, varargin)
            % setStatus - Fires `Status` event with the supplied string
            %
            % USAGE:
            %   Updater.setStatus(message, type)
            %
            % INPUTS:
            %   message:    String, Message to set as the status
            %
            %   type:       String, Indicates category of status event.
            %               Typical categories include: INFO, WARN, DEBUG,
            %               ERROR. (Default = INFO)

            if isempty(varargin); varargin = {'INFO'}; end
            eventData = plugins.StatusEvent('', message, varargin{:});
            self.notify('Status', eventData);
        end
    end

    methods (Abstract)
        % updateAvailable - Determines whether there is an update
        %
        % USAGE:
        %   [bool, data] = Updater.updateAvailable()
        %
        % OUTPUTS:
        %   bool:   Logical, Indicates whether an update is available
        %           (true) or not (false)
        %
        %   data:   Struct, JSON response that represents the latest
        %           version.
        [bool, newest] = updateAvailable(self);

        % latestRelease - Retrieve information about the latest release
        %
        %   This will return a structure containing information about
        %   the latest STABLE release. It will not include any draft or
        %   pre-releases.
        %
        % USAGE:
        %   data = Updater.latestRelease()
        %
        % OUTPUTS:
        %   data:   struct, Structure containing the JSON response from
        %           the server.
        data = latestRelease(self);

        % readFile - Read the contents of a specific file
        %
        %   By specifying a filepath as well as a version string, it is
        %   possible to get the file contents at a specific version.
        %
        % USAGE:
        %   contents = Updater.readFile(filepath, reference)
        %
        % INPUTS:
        %   filepath:   String, Path to the file relative to the project
        %               root directory.
        %
        %   reference:  String or VersionNumber, Indicates the version to
        %               use to retrieve the file. This can be a string
        %               representation of the version of even a git branch
        %               specification ('master')
        %
        % OUTPUTS:
        %   contents:   String, Contents of the file.
        contents = readFile(self, filepath, reference);
    end

    methods (Hidden)
        function url = getURL(self, varargin)
            % getURL - Helper method for crafting an API URL
            %
            %   This method concatenates all of the inputs and appends them
            %   to the root API URL to generate a valid URL.
            %
            % USAGE:
            %   url = Updater.getURL(part1, part2, ..., partN)
            %
            % INPUTS:
            %   partN:  String, These are the parts of the URL that will
            %           be joined together to craft the URL (ala fullfile)
            %
            % OUTPUTS:
            %   url:    String, URL formed from the root API URL and the
            %           input parameters

            url = [self.API, sprintf('/%s', varargin{:})];
        end

        function [data, status] = request(self, varargin)
            % request - Make a request to the API
            %
            %   This method forms an API request and returns the JSON
            %   response from the server. If any errors occur, they are
            %   thrown by this method.
            %
            % USAGE:
            %   [data, status] = Updater.request(parts)
            %
            % INPUTS:
            %   parts:  Multiple String, this should be multilpe inputs
            %           that are all strings and will be concatenated to
            %           form a URL: i.e. Updater.request('repos', 'all')
            %           becomes https://api.github.com/repos/all
            %
            % OUTPUTS:
            %   data:   Struct or Cell Array, Data structure containing the
            %           response. If a list of values was returned, this
            %           will be a cell array of structs.
            %
            %   Status: Struct, Contains information regarding the status
            %           of the HTTP request as returned by URLREAD2

            [data, status] = urlread2(self.getURL(varargin{:}));

            if ~status.isGood
                error(sprintf('%s:APIError', mfilename), ...
                    'Message from server: "%s"', status.status.msg);
            end

            if strcmp(data, '[]')
                data = [];
            else
                data = loadjson(data);
            end
        end
    end

    methods (Static)
        function bool = prompt(release)
            % prompt - Prompt the user to update to the specified release
            %
            % USAGE:
            %   update = Updater.prompt(release)
            %
            % INPUTS:
            %   release:    Struct, Data obtained from the server about the
            %               latest release.
            %
            % OUTPUTS:
            %   update:     String, Indicates the user's selection. This
            %               can be 'update', 'remind', or 'ignore'.

            bgcolor = get(0, 'DefaultFigureColor');

            dlg = dialog( ...
                    'Position', [0 0 600 300], ...
                    'Color',    bgcolor, ...
                    'Name',     'Update Available');

            container = uiflowcontainer('v0', ...
                    'Parent',           dlg, ...
                    'BackgroundColor',  bgcolor, ...
                    'Margin',           5, ...
                    'FlowDirection',    'topdown');

            message = { ''; ...
                'An update is available';
                sprintf('Version %s', char(release.VersionString)); ''};

            h = uicontrol( ...
                    'Style',            'text', ...
                    'FontWeight',       'bold', ...
                    'Parent',           container, ...
                    'BackgroundColor',  bgcolor, ...
                    'String',           message);

            set(h, 'HeightLimits', [60 60])

            h = uicontrol( ...
                    'Style',            'text', ...
                    'Parent',           container, ...
                    'BackgroundColor',  bgcolor, ...
                    'String',           'Release Notes:', ...
                    'HorizontalAlign',  'left', ...
                    'FontSize',         8);

            set(h, 'HeightLimits', [20 20])

            changelogPanel = plugins.markdown.MarkdownPanel('Parent', container);

            hgroup = uiflowcontainer('v0', ...
                    'Parent',           container, ...
                    'FlowDirection',    'lefttoright', ...
                    'Margin',           5, ...
                    'BackgroundColor',  bgcolor);

            % Set a fixed height of the button bar
            set(hgroup, 'HeightLimits', [35 35])

            % Dialog buttons
            inputs = {'Parent', hgroup, 'BackgroundColor', bgcolor};

            % Ignore update button
            uicontrol(inputs{:}, ...
                    'String',   'Ignore this Version', ...
                    'Callback', @(s,e)set(dlg, 'UserData', 'ignore'));

            % Remind later button
            uicontrol(inputs{:}, ...
                    'String',   'Remind Me Later', ...
                    'Callback', @(s,e)set(dlg, 'UserData', 'remind'));

            % Update button
            update_button = uicontrol(inputs{:}, ...
                    'String',   'Update', ...
                    'Callback', @(s,e)set(dlg, 'UserData', 'update'));

            % Center the GUI within the user's monitor
            movegui(dlg, 'center');

            % Actually set the release notes content
            set(changelogPanel, 'Content', release.Notes);

            % Set focus to the last button
            uicontrol(update_button);

            % Modal wait until user select a button or closes window
            waitfor(dlg, 'UserData');

            if ~ishghandle(dlg)
                % Then the user closed the window
                bool = 'remind';
            else
                bool = get(dlg, 'UserData');
                delete(dlg)
            end
        end

        function inputs = parseinputs(varargin)
            % parseinputs - Method for dealing with all input arguments
            %
            %   Focuses all parsing of inputs and input validation in one
            %   place that can be called from any subclass easily.
            %
            % USAGE:
            %   inputs = Updater.parseinputs(varargin)
            %
            % OUTPUTS:
            %   inputs: Struct, Structure containing the parsed outputs

            % The base installation directory
            basedir = fullfile('..', '..', fileparts(mfilename('fullpath')));

            strcheck = @(x)ischar(x) && ~isempty(x);

            ip = inputParser();
            ip.KeepUnmatched = true;
            ip.addParamValue('URL', '', strcheck);
            ip.addParamValue('Version', '0.0', strcheck);
            ip.addParamValue('InstallDir', basedir, strcheck);
            ip.addParamValue('Config', plugins.structobj(), @isstruct);

            if nargin && isobject(varargin{1})
                warning('off', 'MATLAB:structOnObject');
                varargin{1} = struct(varargin{1});
                warning('on', 'MATLAB:structOnObject');
            end

            ip.parse(varargin{:});
            inputs = ip.Results;
        end

        function obj = create(varargin)
            % create - Static method for creating an updater instance
            %
            %   This method accepts the generic updater inputs, figures out
            %   which subclass is best for handling this data, initializes
            %   it, and returns a handle to the updater.
            %
            % USAGE:
            %   obj = Updater.create('URL', url, 'Version', version, ...
            %                        'InstallDir', install)
            %
            % INPUTS:
            %   url:        String, URL pointing to where updates can be
            %               obtained.
            %
            %   version:    String or VersionNumber, Representation of the
            %               current version to use for comparison to the
            %               version found at URL
            %
            %   install:    String, Path to where updates (if found) should
            %               be installed.
            %
            % OUTPUTS
            %   obj:        Object, This is a subclass of Updater that is
            %               specific to the URL provided.

            inputs = plugins.Updater.parseinputs(varargin{:});

            thisclass = mfilename('class');

            updaters = plugins.PluginManager.findAllPlugins(thisclass, 'plugins.updaters');

            for k = 1:numel(updaters)
                % Check to see if this updater works. We will just try to
                % construct it and if the construction succeeds, we will
                % use it.

                props = updaters(k).PropertyList;
                [~, loc] = ismember('PATTERN', {props.Name});

                pattern = props(loc).DefaultValue;

                if regexp(inputs.URL, pattern, 'match', 'once')
                    obj = feval(updaters(k).Name, inputs);
                    return;
                end
            end

            error(sprintf('%s:UnsupportedSchema', mfilename), ...
                'Unsupported URL Type');
        end

        function varargout = loadjson(varargin)
            % loadjson - Wrapper for JSONLAB loadjson
            [varargout{1:nargout}] = loadjson(varargin{:});
        end
    end
end


text:
package de.codesourcery.jasm16.compiler;

import de.codesourcery.jasm16.ast.ASTNode;
import de.codesourcery.jasm16.compiler.ICompiler.CompilerOption;
import de.codesourcery.jasm16.compiler.io.IObjectCodeWriter;
import de.codesourcery.jasm16.compiler.io.IObjectCodeWriterFactory;
import de.codesourcery.jasm16.compiler.io.IResourceResolver;

/**
 * Provides information related to the compilation unit that is currently
 * being compiled.
 *
 * @author tobias.gierke@code-sourcery.de
 */
public interface ICompilationContext extends IResourceResolver , ICompilationUnitResolver {

    /**
     * Returns the compilation unit that is currently being processed.
     * @return
     */
    public ICompilationUnit getCurrentCompilationUnit();

    /**
     * Returns the global symbol table.
     *
     * @return
     */
    public IParentSymbolTable getSymbolTable();

    public DebugInfo getDebugInfo();

    /**
     * Returns a factory for creating {@link IObjectCodeWriter} instances
     * to use when emitting object code.
     *
     *
The final compilation phase needs to invoke {@link IObjectCodeWriterFactory#closeObjectWriters()}
     * when no more object code will be generated.

     * @return
     * @see #closeObjectWriters()
     */
    public IObjectCodeWriterFactory getObjectCodeWriterFactory();

	/**
	 * Check whether a specific compiler option is enabled.
	 *
	 * @param option
	 * @return
	 */
	public boolean hasCompilerOption(CompilerOption option);

	/**
	 * Adds a marker to the current compilation unit.
	 *
	 * @param marker
	 */
	public void addMarker(IMarker marker);

    /**
     * Add a compilation error.
     *
     *
Convenience method that uses {@link ICompilationUnit#addMarker(IMarker)}
     * to add an error that encompasses a specific AST node to the current compilation unit.

     * @param message
     * @param node
     * @see ICompilationUnit#addMarker(IMarker)
     */
    public void addCompilationError(String message, ASTNode node);
}


text:
package glh

import (
	"github.com/go-gl/gl"
	"image"
	"image/draw"
	"image/png"
	"io"
)

// A 2D Texture which implements Context, so can be used as:
//   `With(texture, func() { .. textured primitives .. })`
// which sets gl.ENABLE_BIT
type Texture struct {
	gl.Texture
	W, H int
}

// Create a new texture, initialize it to have a `gl.LINEAR` filter and use
// `gl.CLAMP_TO_EDGE`.
func NewTexture(w, h int) *Texture {
	texture := &Texture{gl.GenTexture(), w, h}
	With(texture, func() {
		gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR)
		gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR)
		gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)
		gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)
		gl.TexParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_R, gl.CLAMP_TO_EDGE)
	})
	return texture
}

// Initialize texture storage. _REQUIRED_ before using it as a framebuffer target.
func (t *Texture) Init() {
	With(t, func() {
		// generate base level storage
		gl.TexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, t.W, t.H, 0, gl.RGBA, gl.UNSIGNED_BYTE, nil)
		// generate required number of mipmaps given texture dimensions
		gl.GenerateMipmap(gl.TEXTURE_2D)
	})
}

func (b Texture) Enter() {
	gl.PushAttrib(gl.ENABLE_BIT)
	gl.Enable(gl.TEXTURE_2D)
	b.Bind(gl.TEXTURE_2D)
}
func (b Texture) Exit() {
	b.Unbind(gl.TEXTURE_2D)
	gl.PopAttrib()
}

// Return the OpenGL texture as a golang `image.RGBA`
func (t *Texture) AsImage() *image.RGBA {
	rgba := image.NewRGBA(image.Rect(0, 0, t.W, t.H))
	With(t, func() {
		// TODO: check internal format (with GetIntegerv?)
		gl.GetTexImage(gl.TEXTURE_2D, 0, gl.RGBA, gl.UNSIGNED_BYTE, rgba.Pix)
	})
	return rgba
}

func (t *Texture) FromImageRGBA(rgba *image.RGBA, level int) {
	With(t, func() {
		gl.TexImage2D(gl.TEXTURE_2D, level, gl.RGBA,
			rgba.Bounds().Dx(), rgba.Bounds().Dy(),
			0, gl.RGBA, gl.UNSIGNED_BYTE, rgba.Pix)
	})
}

// Initialize this texture with image data from `im`. Note: copies the texture
// if it isn't in RGBA format. This can happen if you load from png files.
func (t *Texture) FromImage(im image.Image, level int) {
	switch trueim := im.(type) {
	case *image.RGBA:
		t.FromImageRGBA(trueim, level)

	default:
		copy := image.NewRGBA(trueim.Bounds())
		draw.Draw(copy, trueim.Bounds(), trueim, image.Pt(0, 0), draw.Src)
		t.FromImageRGBA(copy, level)
	}
}

func (t *Texture) FromPngReader(in io.Reader, level int) error {
	im, err := png.Decode(in)
	if err != nil {
		return err
	}
	t.FromImage(im, level)
	return nil
}


text:
using System;

namespace VelcroPhysics.Shared.Optimization
{
    public interface IPoolable<T> : IDisposable where T : IPoolable<T>
    {
        void Reset();

        Pool<T> Pool { set; }
    }
}


text:
a:hover { cursor: pointer; }

.table > tbody > tr > td { vertical-align: middle; }


text:
const {basename} = require('path')

module.exports = {
  process(src, filename, config, options) {
    return 'module.exports = ' + JSON.stringify(basename(filename)) + ';'
  },
}