text:
class FixesBuggyArticlesAndNotes < ActiveRecord::Migration
  def self.up
    say "Fixing contents permalinks, this may take some time"

    contents = Content.where("permalink is ? or permalink = ?", nil, '')
    contents.each do |c|
      c.set_permalink
      c.save
    end

    say "Fixes empty notes GUID"
    notes = Note.where("guid is ? or guid = ?", nil, '')
    notes.each do |n|
      n.create_guid
      n.save
    end
  end

  def self.down
    say "Nothing to do here"
  end
end


text:
package com.vangent.hieos.xutil.exception;

/**
 *
 * @author Bernie Thuman
 */
public class XMLSchemaValidatorException extends Exception {

    /**
     *
     * @param msg
     */
    public XMLSchemaValidatorException(String msg) {
        super(msg);
    }

    /**
     *
     * @param msg
     * @param cause
     */
    public XMLSchemaValidatorException(String msg, Throwable cause) {
        super(msg, cause);
    }
}

redpajama_set_name: RedPajamaGithub


text:
package com.amazon.ask.helloworld.handlers;

import com.amazon.ask.dispatcher.request.handler.HandlerInput;
import com.amazon.ask.dispatcher.request.handler.RequestHandler;
import com.amazon.ask.model.Response;

import java.util.Optional;

import static com.amazon.ask.request.Predicates.intentName;

public class HelpIntentHandler implements RequestHandler {

    @Override
    public boolean canHandle(HandlerInput input) {
        return input.matches(intentName("AMAZON.HelpIntent"));
    }

    @Override
    public Optional<Response> handle(HandlerInput input) {
        String speechText = "You can say hello to me!";
        return input.getResponseBuilder()
                .withSpeech(speechText)
                .withSimpleCard("HelloWorld", speechText)
                .withReprompt(speechText)
                .build();
    }
}


text:
using Microsoft.EntityFrameworkCore;

namespace Ornament.Uow.EF.Test.Models
{
    public class MyContext : DbContext
    {
        public MyContext(DbContextOptions opts)
            :base(opts)
        {

        }
        public DbSet<Blog> Blogs { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            var entity = modelBuilder.Entity<Blog>();
            entity.Property(b => b.Url)
                .HasColumnType("varchar(200)");
            entity.Property(b => b.BlogId);
        }
    }

    public class Blog
    {
        public int BlogId { get; set; }
        public string Url { get; set; }
    }

    public class MyEfUow : EfUow<MyContext>
    {
        public MyEfUow(MyContext context) : base(context)
        {
        }
    }
}


text:
package com.jaamsim.StringProviders;

import java.util.ArrayList;

import com.jaamsim.basicsim.Entity;
import com.jaamsim.basicsim.ErrorException;
import com.jaamsim.basicsim.JaamSimModel;
import com.jaamsim.input.ExpError;
import com.jaamsim.input.ExpEvaluator;
import com.jaamsim.input.ExpParser;
import com.jaamsim.input.ExpParser.Expression;
import com.jaamsim.input.ExpResType;
import com.jaamsim.input.ExpResult;
import com.jaamsim.input.Input;
import com.jaamsim.units.DimensionlessUnit;
import com.jaamsim.units.Unit;

public class StringProvExpression implements StringProvider {

	private final Expression exp;
	private final Entity thisEnt;
	private final Class<? extends Unit> unitType;
	private final ExpEvaluator.EntityParseContext parseContext;

	public StringProvExpression(String expString, Entity ent, Class<? extends Unit> ut) throws ExpError {
		thisEnt = ent;
		unitType = ut;
		parseContext = ExpEvaluator.getParseContext(thisEnt, expString);
		exp = ExpParser.parseExpression(parseContext, expString);
	}

	@Override
	public String getNextString(double simTime) {
		return getNextString(simTime, 1.0d, false);
	}

	@Override
	public String getNextString(double simTime, double siFactor) {
		return getNextString(simTime, siFactor, false);
	}

	@Override
	public String getNextString(double simTime, double siFactor, boolean integerValue) {
		String ret = "";
		try {
			ExpResult result = ExpEvaluator.evaluateExpression(exp, thisEnt, simTime);
			switch (result.type) {
			case STRING:
				ret = result.stringVal;
				break;
			case ENTITY:
				ret = "null";
				if (result.entVal != null)
					ret = result.entVal.getName();
				break;
			case NUMBER:
				if (result.unitType != unitType) {
					JaamSimModel simModel = thisEnt.getJaamSimModel();
					ret = result.getOutputString(simModel);
					break;
				}
				if (integerValue) {
					ret = Double.toString((int)(result.value/siFactor));
				}
				else {
					ret = Double.toString(result.value/siFactor);
				}
				break;
			case COLLECTION:
				JaamSimModel simModel = thisEnt.getJaamSimModel();
				ret = result.colVal.getOutputString(simModel);
				break;
			default:
				assert(false);
				ret = "???";
				break;
			}
		}
		catch(ExpError e) {
			throw new ErrorException(thisEnt, e);
		}
		return ret;
	}

	@Override
	public String getNextString(double simTime, String fmt, double siFactor) {
		String ret = "";
		try {
			ExpResult result = ExpEvaluator.evaluateExpression(exp, thisEnt, simTime);
			switch (result.type) {
			case STRING:
				ret = String.format(fmt, result.stringVal);  // no double quotes
				break;
			case ENTITY:
				ret = String.format(fmt, result.entVal);  // no square brackets
				break;
			case NUMBER:
				if (result.unitType != unitType) {
					if (unitType == DimensionlessUnit.class) {
						JaamSimModel simModel = thisEnt.getJaamSimModel();
						ret = String.format(fmt, result.getOutputString(simModel));
						break;
					}
					throw new ExpError(exp.source, 0, Input.EXP_ERR_UNIT,
							thisEnt.getJaamSimModel().getObjectTypeForClass(result.unitType),
							thisEnt.getJaamSimModel().getObjectTypeForClass(unitType));
				}
				ret = String.format(fmt, result.value/siFactor);
				break;
			case COLLECTION:
				JaamSimModel simModel = thisEnt.getJaamSimModel();
				ret = String.format(fmt, result.colVal.getOutputString(simModel));
				break;
			default:
				assert(false);
				ret = String.format(fmt, "???");
				break;
			}
		}
		catch(ExpError e) {
			throw new ErrorException(thisEnt, e);
		}
		return ret;
	}

	public void appendEntityReferences(ArrayList<Entity> list) {
		try {
			ExpParser.appendEntityReferences(exp, list);
		}
		catch (ExpError e) {}
	}

	@Override
	public double getNextValue(double simTime) {
		double ret = Double.NaN;
		try {
			ExpResult result = ExpEvaluator.evaluateExpression(exp, thisEnt, simTime);
			if (result.type  == ExpResType.NUMBER) {
				ret = result.value;
			}
		}
		catch(ExpError e) {
			throw new ErrorException(thisEnt, e);
		}
		return ret;
	}

	@Override
	public String toString() {
		return parseContext.getUpdatedSource();
	}

}


text:
"""HTTP requests implementation for `DataMcFly REST API`_

.. _DataMcFly REST API: http://datamcfly.com/docs/"""

from datamcflyclient.client import DataMcFlyClient


text:
package me.cvhc.equationsolver;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.support.v4.app.NavUtils;
import android.support.v7.app.ActionBar;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.MenuItem;
import android.widget.TextView;
import android.widget.Toast;

public class SettingsActivity extends AppCompatPreferenceActivity {

    @Override
    protected void onCreate(final Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        SettingsFragment fragment = new SettingsFragment();
        getFragmentManager().beginTransaction().replace(android.R.id.content, fragment).commit();
        setupActionBar();
    }

    public static class SettingsFragment extends PreferenceFragment
            implements SharedPreferences.OnSharedPreferenceChangeListener
    {
        private SharedPreferences sharedPreferences;

        private void initPreferences() {
            setPreferenceScreen(null);
            addPreferencesFromResource(R.xml.preferences);
            getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);

            Preference prefResetSettings = findPreference("pref_reset_settings");
            prefResetSettings.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
                @Override
                public boolean onPreferenceClick(Preference preference) {
                    final Context context = SettingsFragment.this.getActivity();
                    new AlertDialog.Builder(context)
                            .setTitle(R.string.pref_reset_settings)
                            .setMessage("Please confirm!")
                            .setIconAttribute(android.R.attr.alertDialogIcon)
                            .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener(){
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    if (sharedPreferences.edit().clear().commit()) {
                                        initPreferences();
                                    }
                                }
                            })
                            .setNegativeButton(android.R.string.cancel, null)
                            .show();
                    return true;
                }
            });

            Preference prefAbout = findPreference("pref_about");
            prefAbout.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
                @Override
                public boolean onPreferenceClick(Preference preference) {
                    showAbout(getActivity());
                    return true;
                }
            });

            initPrefSummary();
        }

        @Override
        public void onCreate(final Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            initPreferences();
        }

        @Override
        public void onResume() {
            super.onResume();
            getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);

        }

        @Override
        public void onPause() {
            getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
            super.onPause();
        }

        @Override
        public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
            Preference pref = findPreference(key);
            if (pref != null) {
                updatePrefSummary(pref);
            }
        }

        private void initPrefSummary() {
            sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this.getActivity());

            for (int i = 0; i < getPreferenceScreen().getPreferenceCount(); ++i) {
                Preference preference = getPreferenceScreen().getPreference(i);

                if (preference instanceof PreferenceCategory) {
                    PreferenceCategory pGrp = (PreferenceCategory) preference;
                    for (int j = 0; j < pGrp.getPreferenceCount(); j++) {
                        updatePrefSummary(pGrp.getPreference(j));
                    }
                } else {
                    updatePrefSummary(preference);
                }
            }
        }

        private void updatePrefSummary(Preference pref) {
            String key = pref.getKey();

            if (key == null) { return; };

            switch (key) {
                case "pref_plot_samples":
                    pref.setSummary(String.format(getString(R.string.pref_summary_plot_sampling_points),
                            sharedPreferences.getInt(key, 0)));
                    break;
                case "pref_default_lower_bound":
                case "pref_default_upper_bound":
                case "pref_default_bingo":
                    pref.setSummary(String.format(getString(R.string.format_bound),
                            sharedPreferences.getFloat(key, Float.NaN)));
                    break;
            }
        }
    }

    private void setupActionBar() {
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            // Show the Up button in the action bar.
            actionBar.setDisplayHomeAsUpEnabled(true);
        }
    }

    @Override
    public boolean onMenuItemSelected(int featureId, MenuItem item) {
        int id = item.getItemId();
        if (id == android.R.id.home) {
            if (!super.onMenuItemSelected(featureId, item)) {
                NavUtils.navigateUpFromSameTask(this);
            }
            return true;
        }
        return super.onMenuItemSelected(featureId, item);
    }

    private static void showAbout(Context context) {
        final String APP_WEBSITE = "http://home.ustc.edu.cn/~cvhc/EquationSolver";
        final String APP_EMAIL = "cuihao.leo+equationsolver@gmail.com";
        final String APP_INTRO =
                                "An Android app for equation solving.
" +
                                "        " +
                                "written by CUI Hao
" +
                                "        " +
                                "directed by Limin Shao";

        AlertDialog.Builder aboutDialog = new AlertDialog.Builder(context);
        aboutDialog.setTitle(getApplicationName(context));
        aboutDialog.setIcon(R.mipmap.ic_launcher);
        aboutDialog.setMessage(Html.fromHtml(APP_INTRO));

        final Context contextCopy = context;
        aboutDialog.setNegativeButton("Report Bug", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                Intent intent = new Intent(Intent.ACTION_SEND);
                intent.setType("message/rfc822");
                intent.putExtra(Intent.EXTRA_EMAIL, new String[]{APP_EMAIL});
                intent.putExtra(Intent.EXTRA_SUBJECT, "[Equation Solver] Report Bug");
                intent.putExtra(Intent.EXTRA_TEXT, "");

                try {
                    contextCopy.startActivity(Intent.createChooser(intent, "Send mail..."));
                } catch (android.content.ActivityNotFoundException ex) {
                    Toast.makeText(contextCopy, "No email clients installed.", Toast.LENGTH_SHORT).show();
                }
            }
        });

        aboutDialog.setPositiveButton("Website", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(APP_WEBSITE));
                contextCopy.startActivity(browserIntent);
            }
        });

        aboutDialog.setNeutralButton(android.R.string.ok, null);

        Dialog dialog = aboutDialog.create();
        dialog.show();

        TextView message = (TextView)dialog.findViewById(android.R.id.message);
        message.setMovementMethod(LinkMovementMethod.getInstance());
    }

    public static String getApplicationName(Context context) {
        int stringId = context.getApplicationInfo().labelRes;
        return context.getString(stringId);
    }
}


text:
'use strict';

/*
 *
 * Abstract super class for components using echarts
 *
 */
import _ from 'lodash';
import React, { PropTypes, Component } from 'react';
import echarts from 'echarts';

import { addEvent, removeEvent } from '../../utils/eventUtils';

class BaseEchart extends Component {

    constructor(props) {
        super(props);

        this._resizeHandler = () => this.resize(); // bind "this", store for disposing
        this.defaultOptions = {};
    }

    initChart() {
        const { options = {} } = this.props;
        const defaultOptions = _.cloneDeep(this.defaultOptions || {}); // copy to avoid changes
        const chartDom = this.chartDom;

        if (!chartDom) {
            return;
        }

        let myChart = this.myChart;
        if (!myChart) {
            myChart = this.myChart = echarts.init(chartDom);
            addEvent(window, 'resize', this._resizeHandler);
        }

        myChart.setOption(_.assign(defaultOptions, options));
    }

    resize() {
        let myChart = this.myChart;
        if (myChart) {
            myChart.resize();
        }
    }

    componentDidMount() {
        this.initChart();
    }

    componentDidUpdate() {
        this.initChart();
    }

    componentWillUnmount() {
        const myChart = this.myChart;
        if (myChart) {
            removeEvent(window, 'resize', this._resizeHandler);  // memory leak?
            myChart.dispose();
        }
    }

    render() {
        const { width = "100%", height = "100%" } = this.props;
        return
 this.chartDom = chartDom } style={ { width, height } }>

    }
}

BaseEchart.propTypes = {
    options: PropTypes.object.isRequired,
    width: PropTypes.string,
    height: PropTypes.string
};

export default BaseEchart;


text:
#include "EfiSpec.h"
#include EFI_PROTOCOL_DEFINITION (EdidOverride)

EFI_GUID  gEfiEdidOverrideProtocolGuid = EFI_EDID_OVERRIDE_PROTOCOL_GUID;

EFI_GUID_STRING(&gEfiEdidOverrideProtocolGuid, "EFI EDID Override Protocol", "UEFI EDID Override Protocol");


text:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
             xmlns:g="urn:import:com.google.gwt.user.client.ui"
             xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
             xmlns:c="urn:import:com.google.gwt.user.cellview.client"
             xmlns:w="urn:import:org.kie.dockerui.client.widgets"
    >

  <ui:with field="i18n" type="org.kie.dockerui.client.resources.i18n.Constants"/>

  <ui:style type="org.kie.dockerui.client.views.ImagesView.ImagesViewStyle">
    .mainPanel {

    }

    .imagesPanel {

    }

    .imagesList {
        max-width: 1800px;
    }

    .loadingPanel {

    }

    .calendarPanel {
      font-size: small;
      float: right;
      margin-right: 10px;
    }

    .calendar {
      margin-left: 20px;
    }

    .refreshButton {
      float: right;
      margin-right: 20px;;
    }

    .headerPanel {
      width: 100%;
    }
    .calendarButton {
        float: right;
    }
  </ui:style>

  <g:FlowPanel addStyleNames="{style.mainPanel} " ui:field="mainPanel" >

    <w:TimeoutPopupPanel ui:field="loadingPanel" autoHideEnabled="false" modal="true" glassEnabled="true" addStyleNames="{style.loadingPanel} ">
      <g:HTML text="{i18n.loading}..."/>
    </w:TimeoutPopupPanel>

    <w:TimeoutPopupPanel ui:field="pullPanel" autoHideEnabled="true" modal="true" glassEnabled="true" addStyleNames="{style.loadingPanel} ">
      <g:HTML text="{i18n.pullCommand}"/>

        <g:HTML ui:field="pullText"/>

    </w:TimeoutPopupPanel>

    <g:HorizontalPanel addStyleNames="{style.headerPanel}">
      <g:cell width="80%">

      </g:cell>
      <g:cell width="20%">

        <g:FlowPanel addStyleNames="{style.headerPanel}">

          <g:DisclosurePanel ui:field="calendarDisclosurePanel" addStyleNames="{style.calendarPanel} " open="false" animationEnabled="true">
            <g:customHeader>

            </g:customHeader>
            <g:FlowPanel ui:field="calendarPanel">

            </g:FlowPanel>
          </g:DisclosurePanel>

        </g:FlowPanel>

      </g:cell>
    </g:HorizontalPanel>

    <g:VerticalPanel>

      <g:HTMLPanel ui:field="imagesPanel" addStyleNames="{style.imagesPanel} ">

              <c:SimplePager ui:field='pager'/>

      </g:HTMLPanel>

    </g:VerticalPanel>

  </g:FlowPanel>

</ui:UiBinder>


text:
package com.publicuhc.uhcaddons.playerheads;

import org.bukkit.inventory.*;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class BukkitRecipeChecker implements RecipeChecker
{
    @Override
    public boolean areEqual(Recipe recipe1, Recipe recipe2)
    {
        if(recipe1 == recipe2) {
            return true; // if they're the same instance (or both null) then they're equal.
        }

        if(recipe1 == null || recipe2 == null) {
            return false; // if only one of them is null then they're surely not equal.
        }

        if(!recipe1.getResult().equals(recipe2.getResult())) {
            return false; // if results don't match then they're not equal.
        }

        return match(recipe1, recipe2); // now check if ingredients match
    }

    @Override
    public boolean areSimilar(Recipe recipe1, Recipe recipe2)
    {
        if(recipe1 == recipe2) {
            return true; // if they're the same instance (or both null) then they're equal.
        }

        if(recipe1 == null || recipe2 == null) {
            return false; // if only one of them is null then they're surely not equal.
        }

        return match(recipe1, recipe2); // now check if ingredients match
    }

    private boolean match(Recipe recipe1, Recipe recipe2)
    {
        if(recipe1 instanceof ShapedRecipe) {
            if(!(recipe2 instanceof ShapedRecipe)) {
                return false; // if other recipe is not the same type then they're not equal.
            }

            ShapedRecipe r1 = (ShapedRecipe) recipe1;
            ShapedRecipe r2 = (ShapedRecipe) recipe2;

            // convert both shapes and ingredient maps to common ItemStack array.
            ItemStack[] matrix1 = shapeToMatrix(r1.getShape(), r1.getIngredientMap());
            ItemStack[] matrix2 = shapeToMatrix(r2.getShape(), r2.getIngredientMap());

            if(!Arrays.equals(matrix1, matrix2)) // compare arrays and if they don't match run another check with one shape mirrored.
            {
                mirrorMatrix(matrix1);

                return Arrays.equals(matrix1, matrix2);
            }

            return true; // ingredients match.
        } else if(recipe1 instanceof ShapelessRecipe) {
            if(!(recipe2 instanceof ShapelessRecipe)) {
                return false; // if other recipe is not the same type then they're not equal.
            }

            ShapelessRecipe r1 = (ShapelessRecipe) recipe1;
            ShapelessRecipe r2 = (ShapelessRecipe) recipe2;

            // get copies of the ingredient lists
            List<ItemStack> find = r1.getIngredientList();
            List<ItemStack> compare = r2.getIngredientList();

            if(find.size() != compare.size()) {
                return false; // if they don't have the same amount of ingredients they're not equal.
            }

            for(ItemStack item : compare) {
                if(!find.remove(item)) {
                    return false; // if ingredient wasn't removed (not found) then they're not equal.
                }
            }

            return find.isEmpty(); // if there are any ingredients not removed then they're not equal.
        } else if(recipe1 instanceof FurnaceRecipe) {
            if(!(recipe2 instanceof FurnaceRecipe)) {
                return false; // if other recipe is not the same type then they're not equal.
            }

            FurnaceRecipe r1 = (FurnaceRecipe) recipe1;
            FurnaceRecipe r2 = (FurnaceRecipe) recipe2;

            //return (r1.getInput().equals(r2.getInput())); // TODO use this when furnace data PR is pulled
            return r1.getInput().getTypeId() == r2.getInput().getTypeId();
        } else {
            throw new IllegalArgumentException("Unsupported recipe type: '" + recipe1 + "', update this class!");
        }
    }

    private ItemStack[] shapeToMatrix(String[] shape, Map<Character, ItemStack> map)
    {
        ItemStack[] matrix = new ItemStack[9];
        int slot = 0;

        for(int r = 0; r < shape.length; r++) {
            for(char col : shape[r].toCharArray()) {
                matrix[slot] = map.get(col);
                slot++;
            }

            slot = ((r + 1) * 3);
        }

        return matrix;
    }

    private void mirrorMatrix(ItemStack[] matrix)
    {
        ItemStack tmp;

        for(int r = 0; r < 3; r++) {
            tmp = matrix[(r * 3)];
            matrix[(r * 3)] = matrix[(r * 3) + 2];
            matrix[(r * 3) + 2] = tmp;
        }
    }
}


text:
// Verophyle.Regexp Copyright © Verophyle Informatics 2018

using System;
using System.Collections.Generic;

namespace Verophyle.Regexp
{
    public interface IInputMatcher<T>
    {
        IEnumerable<IInputSet<T>> GetSetsThatMatch(T input);
        IInputSet<T> GetNewSetFromCodes(IEnumerable<int> codes);
    }

    namespace InputSet
    {
        public abstract class InputMatcher<T> : IInputMatcher<T>
        {
            protected readonly IDictionary<T, IInputSet<T>> setsByInput = new Dictionary<T, IInputSet<T>>();
            protected DotSet<T> dotClass = null;

            public InputMatcher(IEnumerable<IInputSet<T>> inputSets)
            {
                foreach (var inputSet in inputSets)
                {
                    var ds = inputSet as DotSet<T>;

                    if (ds != null)
                    {
                        if (dotClass == null)
                            dotClass = ds;
                        else
                            throw new Exception("You cannot have more than one dot input class in an input set matcher.");
                    }

                    foreach (var input in inputSet.Inputs)
                    {
                        if (setsByInput.ContainsKey(input))
                            throw new Exception("Input classes that are processed by an input set matcher need to be disjoint.");
                        setsByInput[input] = inputSet;
                    }
                }
            }

            public abstract IInputSet<T> GetNewSetFromCodes(IEnumerable<int> codes);

            public virtual IEnumerable<IInputSet<T>> GetSetsThatMatch(T input)
            {
                IInputSet<T> result;
                if (setsByInput.TryGetValue(input, out result))
                    yield return result;
                if (dotClass != null)
                    yield return dotClass;
            }
        }
    }
}


text:
<?php defined('C5_EXECUTE') or die("Access Denied."); ?>

	<?php ob_start(); ?>
	<?php echo Loader::element('permission/help');?>
	<?php $help = ob_get_contents(); ?>
	<?php ob_end_clean(); ?>

	<?php echo Loader::helper('concrete/dashboard')->getDashboardPaneHeaderWrapper(t('User Permissions'), $help, 'span8 offset2', false)?>
	<form method="post" action="<?php echo $this->action('save')?>">
	<?php echo Loader::helper('validation/token')->output('save_permissions')?>

	<?php
	$tp = new TaskPermission();
	if ($tp->canAccessTaskPermissions()) { ?>
		<?php Loader::element('permission/lists/user')?>
	<?php } else { ?>

<?php echo t('You cannot access task permissions.')?>

	<?php } ?>

		<a href="<?php echo $this->url('/dashboard/system/permissions/users')?>" class="btn"><?php echo t('Cancel')?>
		<button type="submit" value="<?php echo t('Save')?>" class="btn primary ccm-button-right"><?php echo t('Save')?> </button>

	</form>
	<?php echo Loader::helper('concrete/dashboard')->getDashboardPaneFooterWrapper(false)?>


text:
/*
 ONOS GUI -- Widget -- Chart Service
 */
(function () {
    'use strict';

    // injected references
    // fs -> FnService
    // wss -> WebSocketService
    // ls -> LoadingService
    var $log, $interval, $timeout, fs, wss, ls;

    // constants
    var refreshInterval = 2000;

    // example params to buildChart:
    // {
    //    scope: $scope,     <- controller scope
    //    tag: 'device',     <- chart identifier
    //    respCb: respCb,    <- websocket response callback (optional)
    //    query: params      <- query parameters in URL (optional)
    // }
    //          Note: query is always an object (empty or containing properties)
    //                 it comes from $location.search()
    function buildChart(o) {
        var handlers = {},
            root = o.tag + 's',
            req = o.tag + 'DataRequest',
            resp = o.tag + 'DataResponse',
            onResp = fs.isF(o.respCb),
            oldChartData = [],
            refreshPromise;

        o.scope.chartData = [];
        o.scope.changedData = [];
        o.scope.reqParams = o.reqParams || {};
        o.scope.autoRefresh = true;
        o.scope.autoRefreshTip = 'Toggle auto refresh';

        // === websocket functions ===
        // response
        function respCb(data) {
            ls.stop();
            o.scope.chartData = data[root];
            o.scope.annots = data.annots;
            onResp && onResp();

            // check if data changed
            if (!angular.equals(o.scope.chartData, oldChartData)) {
                o.scope.changedData = [];
                // only refresh the chart if there are new changes
                if (oldChartData.length) {
                    angular.forEach(o.scope.chartData, function (item) {
                        if (!fs.containsObj(oldChartData, item)) {
                            o.scope.changedData.push(item);
                        }
                    });
                }
                angular.copy(o.scope.chartData, oldChartData);
            }
            o.scope.$apply();
        }
        handlers[resp] = respCb;
        wss.bindHandlers(handlers);

        // request
        function requestCb(params) {
            var p = angular.extend({}, params, o.query);
            if (wss.isConnected()) {
                wss.sendEvent(req, p);
                ls.start();
            }
        }
        o.scope.requestCallback = requestCb;

        // === autoRefresh functions ===
        function fetchDataIfNotWaiting() {
            if (!ls.waiting()) {
                if (fs.debugOn('widget')) {
                    $log.debug('Refreshing ' + root + ' page');
                }
                requestCb(o.scope.reqParams);
            }
        }

        function startRefresh() {
            refreshPromise = $interval(fetchDataIfNotWaiting, refreshInterval);
        }

        function stopRefresh() {
            if (refreshPromise) {
                $interval.cancel(refreshPromise);
                refreshPromise = null;
            }
        }

        function toggleRefresh() {
            o.scope.autoRefresh = !o.scope.autoRefresh;
            o.scope.autoRefresh ? startRefresh() : stopRefresh();
        }
        o.scope.toggleRefresh = toggleRefresh;

        // === Cleanup on destroyed scope ===
        o.scope.$on('$destroy', function () {
            wss.unbindHandlers(handlers);
            stopRefresh();
            ls.stop();
        });

        requestCb(o.scope.reqParams);
        startRefresh();
    }

    angular.module('onosWidget')
        .factory('ChartBuilderService',
        ['$log', '$interval', '$timeout', 'FnService', 'WebSocketService',
            'LoadingService',

            function (_$log_, _$interval_, _$timeout_, _fs_, _wss_, _ls_) {
                $log = _$log_;
                $interval = _$interval_;
                $timeout = _$timeout_;
                fs = _fs_;
                wss = _wss_;
                ls = _ls_;

                return {
                    buildChart: buildChart
                };
            }]);
}());


text:
<!DOCTYPE html>

<meta charset="UTF-8">

<title>README - Locuser</title>

<link href="./css/fonts.css" rel="stylesheet">
<link href="./css/rdoc.css" rel="stylesheet">

    Home

    Pages
    Classes
    Methods

  <form action="#" method="get" accept-charset="utf-8">

      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">

  </form>

Pages

README

Locuser¶ ↑

This project rocks and uses MIT-LICENSE.

Validate

Generated by RDoc 4.2.0.

Based on Darkfish by Michael Granger.


text:
'use strict';

//Budgets service used to communicate Budgets REST endpoints
angular.module('budgets').factory('Budgets', ['$resource',
	function($resource) {
		return $resource('budgets/:budgetId', { budgetId: '@_id'
		}, {
			update: {
				method: 'PUT'
			}
		});
	}
]);


text:
/*!
 * Module dependencies.
 */

var PhoneGapBuild = require('./phonegap-build');

/*!
 * Expose the package library.
 */

module.exports = new PhoneGapBuild();


text:
<?php

namespace Riimu\Kit\BaseConversion;

class ReplaceConverter implements Converter
{
    /** @var NumberBase Number base used by provided numbers */
    private $source;

    /** @var NumberBase Number base used by returned numbers */
    private $target;

    /** @var ReplaceConverter Converter used to convert into common root base */
    private $sourceConverter;

    /** @var ReplaceConverter Converter used to convert from common root base */
    private $targetConverter;

    /** @var array<string,string> String replacement table for converting numbers */
    private $conversionTable;

    /**
     * Create new instance of ReplaceConverter.
     *
     * ReplaceConverter only supports number base combinations that have a
     * common root or if the target base is nth root of the source base. In
     * addition, due to using string replacement, any number base that has
     * conflicting string digits are not supported.
     *
     * @param NumberBase $source Number base used by the provided numbers
     * @param NumberBase $target Number base used by the returned numbers
     * @throws InvalidNumberBaseException If the number bases are not supported
     */
    public function __construct(NumberBase $source, NumberBase $target)
    {
        $root = $this->getRoot($source, $target);

        if ($root !== $source->getRadix() && $root !== $target->getRadix()) {
            $proxy = new NumberBase($root);
            $this->sourceConverter = new self($source, $proxy);
            $this->targetConverter = new self($proxy, $target);
        } else {
            $this->source = $source;
            $this->target = $target;
            $this->conversionTable = $this->buildConversionTable();
        }
    }

    /**
     * Determines the common root for the number bases.
     * @param NumberBase $source Number base used by the provided numbers
     * @param NumberBase $target Number base used by the returned numbers
     * @return int The common root for the number bases
     * @throws InvalidNumberBaseException If the number bases are not supported
     */
    private function getRoot(NumberBase $source, NumberBase $target)
    {
        if ($source->hasStringConflict() || $target->hasStringConflict()) {
            throw new InvalidNumberBaseException('Number bases do not support string presentation');
        }

        $root = $source->findCommonRadixRoot($target);

        if ($root === false) {
            throw new InvalidNumberBaseException('No common root exists between number bases');
        }

        return $root;
    }

    /**
     * Creates string replacement table between source base and target base.
     * @return array<string,string> String replacement table for converting numbers
     */
    private function buildConversionTable()
    {
        if ($this->source->getRadix() > $this->target->getRadix()) {
            return $this->createTable($this->source->getDigitList(), $this->target->getDigitList());
        }

        return array_flip($this->createTable($this->target->getDigitList(), $this->source->getDigitList()));
    }

    /**
     * Creates a conversion table between two lists of digits.
     * @param string[] $source Digits for the number base with larger number of digits
     * @param string[] $target Digits for the number base with smaller number of digits
     * @return array<string,string> String replacement table for converting numbers
     */
    private function createTable($source, $target)
    {
        $last = count($target) - 1;
        $size = (int) log(count($source), count($target));
        $number = array_fill(0, $size, $target[0]);
        $next = array_fill(0, $size, 0);
        $limit = count($source);
        $table = [$source[0] => implode('', $number)];

        for ($i = 1; $i < $limit; $i++) {
            for ($j = $size - 1; $next[$j] === $last; $j--) {
                $number[$j] = $target[0];
                $next[$j] = 0;
            }

            $number[$j] = $target[++$next[$j]];
            $table[$source[$i]] = implode('', $number);
        }

        return $table;
    }

    public function setPrecision($precision)
    {
        // Replace converter always converts accurately
    }

    public function convertInteger(array $number)
    {
        return $this->convert($number, false);
    }

    public function convertFractions(array $number)
    {
        return $this->convert($number, true);
    }

    /**
     * Converts the digits from source base to target base.
     * @param array $number The digits to convert
     * @param bool $fractions True if converting fractions, false if not
     * @return array The digits converted to target base
     */
    private function convert(array $number, $fractions = false)
    {
        if (!isset($this->conversionTable)) {
            return $this->targetConverter->replace(
                $this->sourceConverter->replace($number, $fractions),
                $fractions
            );
        }

        return $this->replace($number, $fractions);
    }

    /**
     * Replace digits using string replacement.
     * @param array $number The digits to convert
     * @param bool $fractions True if converting fractions, false if not
     * @return array The digits converted to target base
     */
    private function replace(array $number, $fractions = false)
    {
        return $this->zeroTrim($this->target->splitString(strtr(implode('', $this->zeroPad(
            $this->source->canonizeDigits($number),
            $fractions
        )), $this->conversionTable)), $fractions);
    }

    /**
     * Pads the digits to correct count for string replacement.
     * @param array $number Array of digits to pad
     * @param bool $right True to pad from right, false to pad from left
     * @return array Padded array of digits
     */
    private function zeroPad(array $number, $right)
    {
        $log = (int) log($this->target->getRadix(), $this->source->getRadix());

        if ($log > 1 && count($number) % $log) {
            $pad = count($number) + ($log - count($number) % $log);
            $number = array_pad($number, $right ? $pad : -$pad, $this->source->getDigit(0));
        }

        return $number;
    }

    /**
     * Trims extraneous zeroes from the digit list.
     * @param array $number Array of digits to trim
     * @param bool $right True to trim from right, false to trim from left
     * @return array Trimmed array of digits
     */
    private function zeroTrim(array $number, $right)
    {
        $zero = $this->target->getDigit(0);

        while (($right ? end($number) : reset($number)) === $zero) {
            unset($number[key($number)]);
        }

        return empty($number) ? [$zero] : array_values($number);
    }
}


text:
class OrbitVersion {
 public:
  static std::string GetVersion();
  static void CheckForUpdate();
  static void CheckForUpdateThread();
  static bool IsDev();

  static bool s_NeedsUpdate;
  static std::string s_LatestVersion;
};


text:
PDI=GEN001810
BADSKELACL=$( getfacl -R --skip-base --absolute-names /etc/skel | grep file| awk '{print $3}' )
#Start-Lockdown

for file in $BADSKELACL
  do
    setfacl --remove-all $file
done


text:
module.exports = TapConsumer

// pipe a stream into this that's emitting tap-formatted data,
// and it'll emit "data" events with test objects or comment strings
// and an "end" event with the final results.

var yamlish = require("yamlish")
  , Results = require("tap-results")
  , inherits = require("inherits")

TapConsumer.decode = TapConsumer.parse = function (str) {
  var tc = new TapConsumer
    , list = []
  tc.on("data", function (res) {
    list.push(res)
  })
  tc.end(str)
  tc.results.list = list
  return tc.results
}

inherits(TapConsumer, require("stream").Stream)
function TapConsumer () {
  if (!(this instanceof TapConsumer)) {
    return new TapConsumer
  }

  TapConsumer.super.call(this)
  this.results = new Results
  this.readable = this.writable = true

  this.on("data", function (res) {
    if (typeof res === "object") this.results.add(res)
  })

  this._plan = null
  this._buffer = ""
  this._indent = []
  this._current = null
  this._actualCount = 0
  this._passed = []
  this._failed = []
  //console.error("TapConsumer ctor done")
}

TapConsumer.prototype.bailedOut = false

TapConsumer.prototype.write = function (chunk) {
  if (!this.writable) this.emit("error", new Error("not writable"))
  if (this.bailedOut) return true

  this._buffer = this._buffer + chunk
  // split it up into lines.
  var lines = this._buffer.split(/\r?\n/)
  // ignore the last line, since it might be incomplete.
  this._buffer = lines.pop()

  for (var i = 0, l = lines.length; i < l; i ++) {
    //console.error([i, li


text:
<TITLE>Review for James and the Giant Peach (1996)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

James and the Giant Peach (1996)

reviewed by
Tim Voon

                     JAMES AND THE GIANT PEACH 1996
                      A film review by Timothy Voon
                       Copyright 1997 Timothy Voon
                        1 :-(  for too much peach

Cast: Paul Terry, Joanna Lumley, Miriam Margoyles, Pete Postlethwaite;
and the voices of Richard Dreyfuss, Susan Sarandon, Simon Callow, David
Thewlis, and Jane Leeves Director: Henry Selick Producers: Denise Di
Novi and Tim Burton Screenplay: Karey Kirkpatrick, Jonathan Roberts, and
Steve Bloom based on the book by Roald Dahl

As a great fan of any Roald Dahl work and adaptation to screen, I was
greatly disappointed with the results of 'James', when compared to the
other recent adaptation of 'Matilda'. Perhaps the stick-like animated
figures used for the most part of this movie, was what I found the most
annoying and dissatisfying. One would expect Burton and Dahl to go hand
in hand, as one has a tendency to paint dark moodiness and quirkiness
into his characters and movies, whilst the other had an unhappy
childhood which is reflected in the penniless 'Charlie', the
disadvantaged 'Matilda' and the orphaned 'James'. However, this union is
not to be.

'The Nightmare Before Christmas' effects on 'James' elegantly highlights
Dahl's darker side, but somehow mutates that fine connection between
fantasy and reality which makes Dahl believable and likeable. The
cartoon stick figures have made this movie pure fantasy, and even a
child with the greatest imagination will have great difficulty putting
'James' into perspective when compared to 'Charlie' or 'Matilda'. Then
again this is one of Dahl's taller tales, I mean - giant, flying
rhinoceroses swallowing parents, flying to New York on a giant peach
pulled by 100 seagulls, and magical green crocodile tongues - really! I
have to admit that when I read the novel as a child, I believed every
word and remain to this day fascinated by the story of 'James'. Then
again a child's imagination is so much more creative and magical than
anything Hollywood could ever offer.

So I was disappointed by the look and portrayal of this story. 45
minutes into the movie I felt like ripping Mr Centipedes legs off, I
wanted to divide Earth Worm into quarters, there was an incredible urge
to grind Mrs Ladybug beneath my heels, followed by the desire to swat Mr
Grasshopper and to 'Mortein' Ms Spider. I couldn't remember so much
bickering aboard the crew of the Giant Peach. James looked anorexic and
anaemic, and I had an incredible urge to insert a peripheral venous
catheter and transfuse the poor lad with blood and parenteral nutrition.

THE SICK BOY AND JAMES by TMT Voon

Unwell,  I watched 'James' with a raging fever,
I had taken the day off to help the clouded mind recover,
Perhaps against my better judgement,
I thought 'James' would be the best medicine.
So my analysis may appear virally septic,
But I really did feel that 'James' would make me feel better,
Instead I needed peaceful slumber,
For watching this movie sure made me despise it.

Timothy Voon
e-mail: stirling@netlink.com.au

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
<?php

/*
* <auto-generated>
*     This code was generated by a Codezu.
*
*     Changes to this file may cause incorrect behavior and will be lost if
*     the code is regenerated.
* </auto-generated>
*/

namespace Mozu\Api\Contracts\PricingRuntime;

/**
*	Properties of a line item in an order that is subject to tax.
*/
class TaxableLineItem
{
	/**
	*Unique identifier of the source product property. For a product field it will be the name of the field. For a product attribute it will be the Attribute FQN.
	*/
	public $id;

	/**
	*Indicates if the item is subject to taxation, used by products, options, extras, cart and order items, line items, and wish lists. If true, the entity is subject to tax based on the relevant tax rate and rules.
	*/
	public $isTaxable;

	/**
	*The sale price of the line item in the order.
	*/
	public $lineItemPrice;

	/**
	*Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only.
	*/
	public $productCode;

	/**
	*The name of the product that represents a line item in a taxable order or product bundle.
	*/
	public $productName;

	/**
	*The specified quantity of objects and items. This property is used for numerous object types including products, options, components within a product bundle, cart and order items, returned items, shipping line items, items in a digital product. and items associated with types and reservations.
	*/
	public $quantity;

	/**
	*The reason description for an action, including item return, coupon not valid, and item is taxed.
	*/
	public $reason;

	/**
	*The calculated monetary amount of shipping for a line items within and an entire order.
	*/
	public $shippingAmount;

	/**
	*For configurable products, the unique identifier of the product variation that has been selected.
	*/
	public $variantProductCode;

	/**
	*Properties of the product that represents the line item in the order.
	*/
	public $productProperties;

}

?>


text:
'use strict';

describe('slugifyFilter', function () {

  var filter;

  beforeEach(module('a8m.slugify'));

  beforeEach(inject(function ($filter) {
    filter = $filter('slugify');
  }));

  it('should get a string with no replacer and replace spaces with dash(-)', function() {
    expect(filter('a a')).toEqual('a-a');
    expect(filter('foo bar baz')).toEqual('foo-bar-baz');
    expect(filter('Lorem ipsum dolor sit amet')).toEqual('lorem-ipsum-dolor-sit-amet');
  });

  it('should get a string with replacer and replace spaces with it', function() {
    expect(filter('a a', 1)).toEqual('a1a');
    expect(filter('foo bar baz', '!')).toEqual('foo!bar!baz');
    expect(filter('lorem ipsum dolor sit amet', ' ')).toEqual('lorem ipsum dolor sit amet');
    expect(filter('Lorem ipsum dolor sit amet', '-')).toEqual('lorem-ipsum-dolor-sit-amet');
    expect(filter('Lorem ipsum dolor sit amet', '')).toEqual('loremipsumdolorsitamet');
  });

  it('should get a !string and not touch it', function() {
    expect(filter({})).toEqual({});
    expect(filter([])).toEqual([]);
    expect(filter(1)).toEqual(1);
    expect(filter(!1)).toBeFalsy();
  });

});


text:
package gherkin

import (
	"strings"

	"github.com/muhqu/go-gherkin/events"
)

type GherkinParser interface {
	WithLogFn(LogFn)
	WithEventProcessor(EventProcessor)
	Init()
	Parse() error
	Execute()
}

func NewGherkinParser(content string) GherkinParser {
	if !strings.HasSuffix(content, "\n") {
		content = content + "\n"
	}

	return &gherkinPegWrapper{gp: &gherkinPeg{Buffer: content}}
}

type gherkinPegWrapper struct {
	gp *gherkinPeg
}

func (gpw *gherkinPegWrapper) WithLogFn(logFn LogFn) {
	gpw.gp.logFn = logFn
}

func (gpw *gherkinPegWrapper) WithEventProcessor(ep EventProcessor) {
	gpw.gp.eventProcessors = append(gpw.gp.eventProcessors, ep)
}

func (gpw *gherkinPegWrapper) Init() {
	gpw.gp.Init()
}

func (gpw *gherkinPegWrapper) Parse() error {
	return gpw.gp.Parse()
}

func (gpw *gherkinPegWrapper) Execute() {
	gpw.gp.Execute()
}

// ----------------------------------------

type EventProcessor interface {
	ProcessEvent(GherkinEvent)
}

type EventProcessorFn func(GherkinEvent)

func (fn EventProcessorFn) ProcessEvent(e GherkinEvent) {
	fn(e)
}

type GherkinEvent events.Event

// ----------------------------------------

type gherkinPegBase struct {
	logFn           LogFn
	eventProcessors []EventProcessor
}

// ----------------------------------------

type LogFn func(msg string, args ...interface{})

func (gp *gherkinPegBase) log(msg string, args ...interface{}) {
	if gp.logFn != nil {
		gp.logFn(msg, args...)
	}
}

func (gp *gherkinPegBase) emit(e GherkinEvent) {
	for _, ep := range gp.eventProcessors {
		ep.ProcessEvent(e)
	}
}

func (gp *gherkinPegBase) beginFeature(title, description string, tags []string) {
	gp.log("BeginFeature: %#v: %#v tags:%+v", title, description, tags)
	gp.emit(&events.FeatureEvent{title, description, tags})
}
func (gp *gherkinPegBase) endFeature() {
	gp.log("EndFeature")
	gp.emit(&events.FeatureEndEvent{})
}

func (gp *gherkinPegBase) beginBackground(title, description string, tags []string) {
	gp.log("BeginBackground: %#v: %#v tags:%+v", title, description, tags)
	gp.emit(&events.BackgroundEvent{title, description, tags})
}
func (gp *gherkinPegBase) endBackground() {
	gp.log("EndBackground")
	gp.emit(&events.BackgroundEndEvent{})
}

func (gp *gherkinPegBase) beginScenario(title, description string, tags []string) {
	gp.log("BeginScenario: %#v: %#v tags:%+v", title, description, tags)
	gp.emit(&events.ScenarioEvent{title, description, tags})
}
func (gp *gherkinPegBase) endScenario() {
	gp.log("EndScenario")
	gp.emit(&events.ScenarioEndEvent{})
}

func (gp *gherkinPegBase) beginOutline(title, description string, tags []string) {
	gp.log("BeginOutline: %#v: %#v tags:%+v", title, description, tags)
	gp.emit(&events.OutlineEvent{title, description, tags})
}
func (gp *gherkinPegBase) endOutline() {
	gp.log("EndOutline")
	gp.emit(&events.OutlineEndEvent{})
}

func (gp *gherkinPegBase) beginOutlineExamples(title string) {
	gp.log("BeginOutlineExamples")
	gp.emit(&events.OutlineExamplesEvent{title})
}
func (gp *gherkinPegBase) endOutlineExamples() {
	gp.log("EndOutlineExamples")
	gp.emit(&events.OutlineExamplesEndEvent{})
}

func (gp *gherkinPegBase) beginStep(stepType, name string) {
	gp.log("BeginStep: %#v: %#v", stepType, name)
	gp.emit(&events.StepEvent{stepType, name})
}
func (gp *gherkinPegBase) endStep() {
	gp.log("EndStep")
	gp.emit(&events.StepEndEvent{})
}

func (gp *gherkinPegBase) beginPyString(indent string) {
	width := len(trimNL(indent))
	gp.log("BeginPyString: indent=%d", width)
	gp.emit(&events.PyStringEvent{indent})
}
func (gp *gherkinPegBase) bufferPyString(line string) {
	gp.log("BufferPyString: %#v", line)
	gp.emit(&events.PyStringLineEvent{line})
	/*
		indent := gp.pyString.indent
		prefix, suffix := line[:indent], line[indent:]
		newline := trimLeadingWS(prefix) + suffix
		//gp.log("BufferPyString: PREFIX: '%#v' SUFFIX: '%#v' LINE: '%#v'", prefix, suffix, newline)
		gp.pyString.lines = append(gp.pyString.lines, newline)
	*/
}
func (gp *gherkinPegBase) endPyString() {
	gp.log("EndPyString")
	gp.emit(&events.PyStringEndEvent{})
}

func (gp *gherkinPegBase) beginTable() {
	gp.log("BeginTable")
	gp.emit(&events.TableEvent{})
}
func (gp *gherkinPegBase) beginTableRow() {
	gp.log("BeginTableRow")
	gp.emit(&events.TableRowEvent{})
}
func (gp *gherkinPegBase) beginTableCell() {
	gp.log("BeginTableCell")
}
func (gp *gherkinPegBase) endTableCell(buf string) {
	gp.log("EndTableCell: %#v", buf)
	gp.emit(&events.TableCellEvent{buf})
}
func (gp *gherkinPegBase) endTableRow() {
	gp.log("EndTableRow")
	gp.emit(&events.TableRowEndEvent{})
}
func (gp *gherkinPegBase) endTable() {
	gp.log("EndTable")
	gp.emit(&events.TableEndEvent{})
}

func (gp *gherkinPegBase) triggerComment(comment string) {
	gp.log("triggerComment")
	gp.emit(&events.CommentEvent{comment})
}
func (gp *gherkinPegBase) triggerBlankLine() {
	gp.log("triggerBlankLine")
	gp.emit(&events.BlankLineEvent{})
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Orion Viewer - pdf, djvu, xps and cbz file viewer for android devices
  ~
  ~ Copyright (C) 2011-2013  Michael Bogdanov & Co
  ~
  ~ This program is free software: you can redistribute it and/or modify
  ~ it under the terms of the GNU General Public License as published by
  ~ the Free Software Foundation, either version 3 of the License, or
  ~ (at your option) any later version.
  ~
  ~ This program is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~ GNU General Public License for more details.
  ~
  ~ You should have received a copy of the GNU General Public License
  ~ along with this program.  If not, see <http://www.gnu.org/licenses/>.
  -->

<!--Author: Alberto Pettarin-->
<resources>
    <string name="action_none">Nessuna</string>
    <string name="action_menu">Menu</string>
    <string name="action_next_page">Pagina successiva</string>
    <string name="action_prev_page">Pagina precedente</string>
    <string name="action_first_page">Prima pagina</string>
    <string name="action_last_page">Ultima pagina</string>
    <string name="action_crop_page">Ritaglia</string>
    <string name="action_zoom_page">Zoom</string>
    <string name="action_rotation_page">Ruota</string>
    <string name="action_options_page">Opzioni</string>
    <string name="action_goto_page">Vai a</string>
    <string name="action_dictionary">Apri dizionario</string>
    <string name="action_open">Apri libro</string>
    <string name="action_outline">@string/menu_outline_text</string>
    <string name="action_add_bookmark">Aggiungi segnalibro</string>
    <string name="action_open_bookmarks">Apri segnalibri</string>

    <string name="action_crop_left">Ritaglia margine sinistro</string>
    <string name="action_crop_right">Ritaglia margine destro</string>
    <string name="action_crop_top">Ritaglia margine superiore</string>
    <string name="action_crop_bottom">Ritaglia margine inferiore</string>

    <string name="action_uncrop_left">Aumenta margine sinistro</string>
    <string name="action_uncrop_right">Aumenta margine destro</string>
    <string name="action_uncrop_top">Aumenta margine superiore</string>
    <string name="action_uncrop_bottom">Aumenta margine inferiore</string>
    <string name="action_inverse_crops">Scambia ritaglia/aumenta margine</string>
    <string name="action_switch_long_crop">Scambia ritaglio grande/piccolo</string>

    <string name="action_next_10">Avanti 10 pagine</string>
    <string name="action_prev_10">Indietro 10 pagine</string>

    <string name="action_rotate_90">Ruota -/+90 gradi</string>
    <string name="action_rotate_270">Ruota -/+270 gradi</string>

    <string name="action_select_text">@string/menu_select_text</string>
</resources>


text:
<?php

namespace Knp\Component\Pager\Event\Subscriber\Filtration;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Knp\Component\Pager\Event\ItemsEvent;

class PropelQuerySubscriber implements EventSubscriberInterface
{
    public function items(ItemsEvent $event)
    {
        $query = $event->target;
        if ($query instanceof \ModelCriteria) {
            if (!empty($_GET[$event->options['filterFieldParameterName']])
                && !empty($_GET[$event->options['filterValueParameterName']])) {

                $value   = $_GET[$event->options['filterValueParameterName']];
                $columns = $_GET[$event->options['filterFieldParameterName']];

                if (isset($event->options['filterFieldWhitelist'])) {
                    if (!in_array($_GET[$event->options['filterFieldParameterName']], $event->options['filterFieldWhitelist'])) {
                        throw new \UnexpectedValueException("Cannot sort by: [{$_GET[$event->options['filterFieldParameterName']]}] this field is not in whitelist");
                    }
                }

                $criteria = \Criteria::EQUAL;
                if (false !== strpos($value, '*')) {
                    $value = str_replace('*', '%', $value);
                    $criteria = \Criteria::LIKE;
                }

                foreach ((array) $columns as $column) {
                    if (false !== strpos($column, '.')) {
                        $query->where($column . $criteria . '?', $value);
                    } else {
                        $query->{'filterBy' . $column}($value, $criteria);
                    }
                }
            }
        }
    }

    public static function getSubscribedEvents()
    {
        return array(
            'knp_pager.items' => array('items', 0)
        );
    }
}


text:
package org.puc.rio.war;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Random;

import org.puc.rio.war.client.Client;
import org.puc.rio.war.model.Card;
import org.puc.rio.war.model.Continent;
import org.puc.rio.war.model.Deck;
import org.puc.rio.war.model.Map;
import org.puc.rio.war.model.MessageFactory;
import org.puc.rio.war.model.Player;
import org.puc.rio.war.model.Territory;
import org.puc.rio.war.model.TerritoryCard;
import org.puc.rio.war.model.WarState;
import org.puc.rio.war.model.WarState.TurnState;
import org.puc.rio.war.objective.ConquerContinentsObjective;
import org.puc.rio.war.objective.ConquerTerritoriesObjective;
import org.puc.rio.war.objective.DestroyPlayerObjective;
import org.puc.rio.war.objective.WarObjective;
import org.puc.rio.war.serialize.WarDeserializer;
import org.puc.rio.war.serialize.WarSerializer;
import org.puc.rio.war.viewcontroller.WarFrame;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class WarGame {

	private static WarGame instance;

	private WarFrame warFrame;
	private WarState warState = null;
	private Client client;
	private String myName;
	private List<String> playerNames = new ArrayList<String>(3);
	public final String SERVER_IP = "127.0.0.1";

	private WarGame() {
		this.warFrame = new WarFrame();
	}

	public static WarGame getInstance() {
		if (WarGame.instance == null) {
			WarGame.instance = new WarGame();
		}
		return WarGame.instance;
	}

	public Client getClient() {
		if (this.client == null) {
			try {
				this.client = new Client(SERVER_IP);
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return this.client;
	}
	public void loadGame(String jsonData) {
		GsonBuilder gsonBuilder = new GsonBuilder();
		gsonBuilder.registerTypeAdapter(WarState.class, new WarDeserializer());
		Gson gson = gsonBuilder.create();
		this.warState = gson.fromJson(jsonData, WarState.class);
		for (Player p : this.getState().getPlayers()) {
			for (Card c : p.getCards()) {
				this.getState().getDeck().removeCard(c);
			}
		}
		this.getState().getDeck().addJoker(2);
		this.getState().getDeck().shuffle();
		this.getMap().calculateNeighbors();
		this.getWarFrame().startGame();
		this.getState().addObserver(this.getWarFrame().getMapPanel());
		this.getState().addObserver(this.getWarFrame().getUIPanel());
		if (this.getCurrentPlayer().getCards().size() >= 5) {
			this.showCards(true);
		}
	}

	public void startGame(List<String> names) {
		/* Randomize player order */
		this.warState = new WarState(new Map(), new Deck(), names);
		Util.loadTerritories(this.getState().getMap(), this.getState().getDeck());
		this.getState().getDeck().addJoker(2);
		this.getState().getDeck().shuffle();
		this.giveAwayTerritories();
		this.getMap().calculateNeighbors();
		this.giveObjectiveToPlayers();
		this.getCurrentPlayer().giveArmies(WarLogic.calculateArmiesToGain(this.getMap(), this.getCurrentPlayer()));
		this.getWarFrame().startGame();
		this.getState().addObserver(this.getWarFrame().getMapPanel());
		this.getState().addObserver(this.getWarFrame().getUIPanel());
	}

	/* Wargame is a facade, no-one should be able to access the state */
	private WarState getState() {
		return this.warState;
	}

	public List<Player> getPlayers() {
		return this.getState().getPlayers();
	}

	public Player getPlayerByName(String name) {
		for (Player p : this.getPlayers()) {
			if (p.getName().equals(name)) {
				return p;
			}
		}
		return null;
	}

	public Map getMap() {
		return this.getState().getMap();
	}

	public Deck getDeck() {
		return this.getState().getDeck();
	}

	public Player getCurrentPlayer() {
		return this.getState().getCurrentPlayer();
	}

	public int getCurrentPlayerIndex() {
		return this.getState().getCurrentPlayerIndex();
	}

	public TurnState getTurnState() {
		return this.getState().getCurrentTurnState();
	}

	public boolean isAttacking() {
		return this.getTurnState().equals(TurnState.ATTACKING);
	}

	public boolean isMoving() {
		return this.getTurnState().equals(TurnState.MOVING_ARMIES);
	}

	public boolean isPlacing() {
		return this.getTurnState().equals(TurnState.PLACING_NEW_ARMIES);
	}

	public WarFrame getWarFrame() {
		return this.warFrame;
	}

	public int getCardExchangeArmyCount() {
		return this.getState().getCardExchangeArmyCount();
	}

	public void focusPopupIfExists() {
		if (warFrame.hasPopupActive()) {
			warFrame.focusPopup();
		}
	}

	private void incrementCardExchangeArmyCount() {
		this.getState()
				.setCardExchangeArmyCount(this.getCardExchangeArmyCount() + WarLogic.CARD_EXCHANGE_ARMY_INCREMENT);
	}

	private void giveAwayTerritories() {
		List<Integer> indexes = new ArrayList<Integer>();
		Iterator<Player> pi = this.getPlayers().iterator();
		for (int i = 0; i < this.getMap().getTerritories().size(); i++) {
			indexes.add(i);
		}
		Collections.shuffle(indexes);
		for (Integer i : indexes) {
			if (!pi.hasNext()) {
				pi = this.getPlayers().iterator(); // loop back
			}
			Player p = pi.next();
			Territory t = this.getMap().getTerritories().get(i);
			t.setOwnerName(p.getName());
		}
	}

	private void giveObjectiveToPlayers() {
		List<WarObjective> objectives = new ArrayList<WarObjective>();
		objectives.add(new ConquerTerritoriesObjective(18, 2));
		objectives.add(new ConquerTerritoriesObjective(24, 1));
		objectives.add(new ConquerContinentsObjective(Continent.EUROPE, Continent.OCEANIA, false));
		objectives.add(new ConquerContinentsObjective(Continent.ASIA, Continent.SOUTH_AMERICA, false));
		objectives.add(new ConquerContinentsObjective(Continent.EUROPE, Continent.SOUTH_AMERICA, true));
		objectives.add(new ConquerContinentsObjective(Continent.ASIA, Continent.AFRICA, false));
		objectives.add(new ConquerContinentsObjective(Continent.NORTH_AMERICA, Continent.AFRICA, false));
		objectives.add(new ConquerContinentsObjective(Continent.NORTH_AMERICA, Continent.OCEANIA, false));

		for (Player p : this.getPlayers()) {
			objectives.add(new DestroyPlayerObjective(p.getName()));
		}

		Random r = new Random();
		for (Player p : this.getPlayers()) {
			int index = 0;
			WarObjective objective;
			do {
				index = r.nextInt(objectives.size());
				objective = objectives.get(index);
				/* Disallow player having to destroy himself */
			} while (objective instanceof DestroyPlayerObjective
					&& ((DestroyPlayerObjective) objective).getTargetPlayerName().equals(p.getName()));
			p.setObjective(objective);
			/* Disallow duplicate objectives */
			objectives.remove(index);
		}
	}

	/* Event handlers */
	public void nextTurn() {
		/* Do nothing when a pop up is active */
		if (this.getWarFrame().hasPopupActive()) {
			this.getWarFrame().focusPopup();
			return;
		}
		Player winner = this.checkWinner();
		if (winner != null) {
			this.endGameSequence(winner);
			return;
		}
		if (this.getState().conqueredThisTurn()) {
			this.giveCardToPlayer(this.getCurrentPlayer());
		}
		this.getMap().resetMovableArmiesCount();
		this.getState().nextTurn();
		this.getState().getCurrentPlayer()
				.giveArmies(WarLogic.calculateArmiesToGain(this.getMap(), getState().getCurrentPlayer()));
		if (this.getCurrentPlayer().getCards().size() >= 5) {
			this.showCards(true);
		}
		WarSerializer ws = new WarSerializer();
		this.getClient().sendMessage(MessageFactory.stateMessage(ws.serialize(this.getState(), null, null).toString()));

		/* if player is out of the game */
		if (this.getMap().getTerritoriesByOwner(this.getCurrentPlayer()).size() == 0) {
			this.nextTurn();
		}
		this.getState().notifyObservers();
	}

	public void actionPerformed() {
		/* Do nothing when a pop up is active */
		if (this.getWarFrame().hasPopupActive()) {
			this.getWarFrame().focusPopup();
			return;
		}
		switch (this.getTurnState()) {
		case ATTACKING:
			this.getState().startMovingArmies();
			break;
		case MOVING_ARMIES:
			this.getState().clearSelections();
			break;
		case PLACING_NEW_ARMIES:
			if (this.getSelectedTerritory() != null) {
				this.getWarFrame().spawnChooseNumberFrame(this.getCurrentPlayer().getUnplacedArmies(),
						String.format("How many do you want to place in %s?", this.getSelectedTerritory().getName()));
			}
			break;
		default:
			break;
		}
		this.getState().notifyObservers();
	}

	public void selectTerritory(Territory t) {
		/* Do nothing when a pop up is active */
		if (this.getWarFrame().hasPopupActive()) {
			getWarFrame().focusPopup();
			return;
		}
		switch (this.getTurnState()) {
		case ATTACKING:
			if (this.getSelectedTerritory() == null) {
				/* Select territory to attack from */
				if (t.getOwnerName().equals(this.getCurrentPlayer().getName())) {
					this.warState.selectTerritory(t);
				}
			} else {
				/* Select another territory */
				if (t.getOwnerName().equals(this.getCurrentPlayer().getName())) {
					this.warState.selectTerritory(t);
					/* Select territory to attack */
				} else if (this.getSelectedTerritory().canAttack(t)) {
					this.getState().targetTerritory(t);
					this.getWarFrame().spawnChooseNumberFrame(this.getSelectedTerritory().getAtackableArmyCount(),
							String.format("How many to attack from %s to %s with?",
									this.getSelectedTerritory().getName(), this.getTargetedTerritory().getName()));
				}
			}
			break;
		case MOVING_ARMIES:
			if (t.getOwnerName().equals(this.getCurrentPlayer().getName())) {
				/* select territory */
				if (this.getSelectedTerritory() == null) {
					this.warState.selectTerritory(t);
					/* select another owned territory */
				} else if (!this.getSelectedTerritory().canMoveTo(t)) {
					this.warState.selectTerritory(t);
					/* target owned territory */
				} else {
					this.warState.targetTerritory(t);
					this.getWarFrame().spawnChooseNumberFrame(this.getSelectedTerritory().getMoveableArmyCount(),
							String.format("How many to move from %s to %s?", this.getSelectedTerritory().getName(),
									this.getTargetedTerritory().getName()));
				}
			}
			break;
		case PLACING_NEW_ARMIES:
			if (t.getOwnerName().equals(this.getCurrentPlayer().getName())) {
				this.getState().selectTerritory(t);
			}
			break;
		default:
			break;
		}
		this.getState().notifyObservers();
	}

	public void selectNumber(int number) {
		switch (this.getTurnState()) {
		case ATTACKING:
			/* already conquered and moving armies */
			if (this.getSelectedTerritory().getOwnerName().equals(this.getTargetedTerritory().getOwnerName())) {
				this.getMap().moveArmies(this.getSelectedTerritory(), this.getTargetedTerritory(), number - 1, true);
				Player winner = this.checkWinner();
				if (winner != null) {
					this.endGameSequence(winner);
					return;
				}
				if (this.getState().getCanStealCardsFrom() != null) {
					if (this.getCurrentPlayer().getCards().size() < 5) {
						Player destroyedPlayer = this.getPlayerByName(this.getState().getCanStealCardsFrom());
						this.getWarFrame().spawnCardSelectionFrame(destroyedPlayer,
								5 - this.getCurrentPlayer().getCards().size(), false);
					}
				}
			} else {
				this.getWarFrame().spawnAttackFrame(this.getSelectedTerritory(), this.getTargetedTerritory(), number);
			}
			break;
		case MOVING_ARMIES:
			this.getMap().moveArmies(this.getSelectedTerritory(), this.getTargetedTerritory(), number, false);
			this.getState().clearSelections();
			break;
		case PLACING_NEW_ARMIES:
			this.getCurrentPlayer().removeArmies(number);
			this.warState.getSelectedTerritory().addArmies(number);
			if (this.getCurrentPlayer().getUnplacedArmies() <= 0) {
				this.warState.startAttacking();
			}
			break;
		default:
			break;
		}
		this.getState().notifyObservers();
	}

	public void attackResult(int[] losses) {
		if (this.isAttacking()) {
			this.getSelectedTerritory().removeArmies(losses[0]);
			this.getTargetedTerritory().removeArmies(losses[1]);

			/* attacker conquered */
			if (this.getTargetedTerritory().getArmyCount() == 0) {
				/* Is last territory */
				Player owner = this.getPlayerByName(this.getTargetedTerritory().getOwnerName());
				if (this.getMap().getTerritoriesByOwner(owner).size() == 1) {
					this.getState().setCanStealCardsFrom(owner.getName());
				}
				int maxToMove = this.getMap().conquerTerritory(this.getSelectedTerritory(),
						this.getTargetedTerritory());
				this.getState().setConqueredThisTurn();
				Player winner = this.checkWinner();
				if (winner != null) {
					this.endGameSequence(winner);
					return;
				}
				this.warFrame.spawnChooseNumberFrame(maxToMove, String.format("How many armies to move from %s to %s?",
						this.getSelectedTerritory().getName(), this.getTargetedTerritory().getName()));
			}
		}
		this.getState().notifyObservers();
	}

	public void showObjective() {
		/* Do nothing when a pop up is active */
		if (this.getWarFrame().hasPopupActive()) {
			getWarFrame().focusPopup();
			return;
		}
		this.getWarFrame().spawnTextFrame(this.getCurrentPlayer().getObjective().getDescription());
	}

	public void exchangeCards(List<Card> selectedCards) {
		/* receiving cards */
		if (this.isPlacing()) {
			for (Card c : selectedCards) {
				this.getCurrentPlayer().removeCard(c);
				/* Give extra armies to the territory of the card */
				if (c instanceof TerritoryCard) {
					TerritoryCard tc = (TerritoryCard) c;
					if (tc.getTerritory().getOwnerName().equals(this.getCurrentPlayer().getName())) {
						tc.getTerritory().addArmies(WarLogic.ARMIES_TO_GAIN_FROM_TERRITORY_CARD);
					}
				}
			}
			this.getCurrentPlayer().giveArmies(this.getState().getCardExchangeArmyCount());
			this.incrementCardExchangeArmyCount();
			/* Taking cards from player */
		} else {
			for (Card c : selectedCards) {
				Player loser = this.getPlayerByName(this.getState().getCanStealCardsFrom());
				loser.removeCard(c);
				this.getCurrentPlayer().addCard(c);
			}
		}
		this.getState().notifyObservers();
	}

	/* End event handlers */

	public Territory getTargetedTerritory() {
		return this.warState.getTargetedTerritory();
	}

	public Territory getSelectedTerritory() {
		return this.warState.getSelectedTerritory();
	}

	public void giveCardToPlayer(Player p) {
		Card c = this.getDeck().takeCard();
		p.addCard(c);
	}

	public void receiveCardFromPlayer(Player p, TerritoryCard c) {
		p.removeCard(c);
		this.getDeck().returnCard(c);
	}

	public Player checkWinner() {
		for (Player p : this.getPlayers()) {
			if (p.isVictorious()) {
				return p;
			}
		}
		return null;
	}

	private void endGameSequence(Player p) {
		System.out.println("GAME FINISHED");
		System.out.println("Winner is " + p.getName() + " " + p.getObjective().getDescription());
		this.getWarFrame().getUIPanel().showGameEndedPanel(p);
		this.getState().notifyObservers();
	}

	public void showCards(boolean forcedToExchange) {
		this.getWarFrame().spawnCardSelectionFrame(this.getCurrentPlayer(), 3, forcedToExchange);
	}

	public void addPlayer(String name, boolean self) {
		this.playerNames.add(name);
		if (self) {
			this.getClient().sendMessage(MessageFactory.nameMessage(name));
			this.myName = name;
		}
		// first player starts game
		System.out.println("Added player: " + name);
		if (this.playerNames.size() >= WarLogic.MIN_PLAYERS) {
			System.out.println("Have " + WarLogic.MIN_PLAYERS + " players, starting game");
			WarGame.getInstance().startGame(this.playerNames);
			WarSerializer ws = new WarSerializer();
			this.getClient().sendMessage(MessageFactory.stateMessage(ws.serialize(this.getState(), null, null).toString()));
		}
	}

	public boolean isMyTurn() {
		return this.myName.equals(this.getState().getCurrentPlayer().getName());
	}

	public boolean hasStarted() {
		return this.warState != null;
	}

}


text:
A minimal screensaver displaying the current date and time.

There are two versions, *default* and *soft*:

![default](/previews/preview_default.png?raw=true)
![soft](/previews/preview_soft.png?raw=true)

## Installation:
In order to use .html files as screensavers, you will need a third party tool. Consider downloading [HTML Screensaver.](http://myweb.tiscali.co.uk/djmclean/htmlscreensaver.html)

### Soft edition:
You can activate soft edition in **action.js** by setting `SOFT_EDITION = true`;

## American Date Format:
In **action.js**, replace
```javascript
write("DateText", day + "/" + month + "/" + year);
```
with
```javascript
write("DateText", month + "/" + day + "/" + year);
```

## Language support:
Please edit `names` in **action.js**.

Have fun!


text:
package kafka

// Automatically generate error codes from librdkafka
// See README for instructions
//go:generate $GOPATH/bin/go_rdkafka_generr generated_errors.go

/*
#include <stdlib.h>
#include "select_rdkafka.h"
*/
import "C"

import (
	"fmt"
	"unsafe"
)

// Error provides a Kafka-specific error container
type Error struct {
	code             ErrorCode
	str              string
	fatal            bool
	retriable        bool
	txnRequiresAbort bool
}

func newError(code C.rd_kafka_resp_err_t) (err Error) {
	return Error{code: ErrorCode(code)}
}

// NewError creates a new Error.
func NewError(code ErrorCode, str string, fatal bool) (err Error) {
	return Error{code: code, str: str, fatal: fatal}
}

func newErrorFromString(code ErrorCode, str string) (err Error) {
	return Error{code: code, str: str}
}

func newErrorFromCString(code C.rd_kafka_resp_err_t, cstr *C.char) (err Error) {
	var str string
	if cstr != nil {
		str = C.GoString(cstr)
	} else {
		str = ""
	}
	return Error{code: ErrorCode(code), str: str}
}

func newCErrorFromString(code C.rd_kafka_resp_err_t, str string) (err Error) {
	return newErrorFromString(ErrorCode(code), str)
}

// newErrorFromCError creates a new Error instance and destroys
// the passed cError.
func newErrorFromCErrorDestroy(cError *C.rd_kafka_error_t) Error {
	defer C.rd_kafka_error_destroy(cError)
	return Error{
		code:             ErrorCode(C.rd_kafka_error_code(cError)),
		str:              C.GoString(C.rd_kafka_error_string(cError)),
		fatal:            cint2bool(C.rd_kafka_error_is_fatal(cError)),
		retriable:        cint2bool(C.rd_kafka_error_is_retriable(cError)),
		txnRequiresAbort: cint2bool(C.rd_kafka_error_txn_requires_abort(cError)),
	}
}

// Error returns a human readable representation of an Error
// Same as Error.String()
func (e Error) Error() string {
	return e.String()
}

// String returns a human readable representation of an Error
func (e Error) String() string {
	var errstr string
	if len(e.str) > 0 {
		errstr = e.str
	} else {
		errstr = e.code.String()
	}

	if e.IsFatal() {
		return fmt.Sprintf("Fatal error: %s", errstr)
	}

	return errstr
}

// Code returns the ErrorCode of an Error
func (e Error) Code() ErrorCode {
	return e.code
}

// IsFatal returns true if the error is a fatal error.
// A fatal error indicates the client instance is no longer operable and
// should be terminated. Typical causes include non-recoverable
// idempotent producer errors.
func (e Error) IsFatal() bool {
	return e.fatal
}

// IsRetriable returns true if the operation that caused this error
// may be retried.
// This flag is currently only set by the Transactional producer API.
func (e Error) IsRetriable() bool {
	return e.retriable
}

// TxnRequiresAbort returns true if the error is an abortable transaction error
// that requires the application to abort the current transaction with
// AbortTransaction() and start a new transaction with BeginTransaction()
// if it wishes to proceed with transactional operations.
// This flag is only set by the Transactional producer API.
func (e Error) TxnRequiresAbort() bool {
	return e.txnRequiresAbort
}

// getFatalError returns an Error object if the client instance has raised a fatal error, else nil.
func getFatalError(H Handle) error {
	cErrstr := (*C.char)(C.malloc(C.size_t(512)))
	defer C.free(unsafe.Pointer(cErrstr))

	cErr := C.rd_kafka_fatal_error(H.gethandle().rk, cErrstr, 512)
	if int(cErr) == 0 {
		return nil
	}

	err := newErrorFromCString(cErr, cErrstr)
	err.fatal = true

	return err
}

// testFatalError triggers a fatal error in the underlying client.
// This is to be used strictly for testing purposes.
func testFatalError(H Handle, code ErrorCode, str string) ErrorCode {
	return ErrorCode(C.rd_kafka_test_fatal_error(H.gethandle().rk, C.rd_kafka_resp_err_t(code), C.CString(str)))
}


text:
OBJECT makeProcedure( OBJECT parameters, OBJECT body, OBJECT env );
#define isCompoundProcedure( exp ) isTaggedList( exp, "procedure" )
#define procedureParameters( p ) second(p)
#define procedureBody( p ) third(p)
#define procedureEnvironment( p ) fourth(p)

// environments

#define enclosingEnvironment(env) cdr(env)
#define firstFrame(env) car(env)
#define theEmptyEnvironment _NULL
#define isEmptyEnvironment(env) isNull(env)

// bindings

inline OBJECT makeBinding( OBJECT var, OBJECT val );
inline OBJECT bindingVariable( OBJECT list );
inline OBJECT bindingValue(OBJECT list);
OBJECT bindingSearch( OBJECT var, OBJECT list );
#define setBindingValue( binding, val ) setcar( cdr(binding), val )

// frames

OBJECT makeFrame( OBJECT variables, OBJECT values );
#define frameVariables( frame ) map(bindingVariables, cdr(frame))
#define frameValues( frame ) map(bindingValues, cdr(frame))
inline void addBindingToFrame( OBJECT var, OBJECT val, OBJECT frame );
#define findInFrame( var, frame ) bindingSearch( var, cdr(frame) )

// drop a frame,
OBJECT extendEnvironment( OBJECT vars, OBJECT vals, OBJECT baseEnv );
// name rule
OBJECT 	lookupVariableValue( OBJECT var, OBJECT env );
OBJECT setVariableValue( OBJECT var, OBJECT val, OBJECT env );
OBJECT defineVariable( OBJECT var, OBJECT val, OBJECT env );
// primitive procedures
#define isPrimitiveProcedure( proc ) isTaggedList( proc, "primitive" )
OBJECT primitiveProcedures();
#define primitiveProcedureNames() primitiveProcedures()
OBJECT primitiveProcedureObjects();
OBJECT applyPrimitiveProcedure( OBJECT proc, OBJECT args );
#define getPrimitiveProcedureName( proc ) cadr(proc)

//used to initialize the environment
OBJECT setupEnvironment();

#endif //_ENVIRONMENT_H_


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

namespace Argus.Data.Range
{
    //*********************************************************************************************************************
    //
    //         Namespace:  Range
    //      Organization:  http://www.blakepell.com
    //      Initial Date:  06/26/2012
    //      Last Updated:  04/08/2016
    //     Programmer(s):  Blake Pell, blakepell@hotmail.com
    //
    //*********************************************************************************************************************

    /// <summary>
    /// The base class for all ranges.  This implements the functionality for the properties and sets up the methods that must be
    /// overridden to use.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <remarks></remarks>
    public abstract class RangeBase<T> : IRange<T> where T : IComparable
    {
        protected RangeBase(T start, T end)
        {
            this.Start = start;
            this.End = end;
        }

        public abstract List<T> ToList();

        public T Start { get; set; }
        public T End { get; set; }

    }

}


text:
namespace onnxruntime {
namespace test {

class GraphTransformationTests : public ::testing::Test {
 protected:
  GraphTransformationTests() {
    logger_ = DefaultLoggingManager().CreateLogger("GraphTransformationTests");
  }

  std::unique_ptr<logging::Logger> logger_;
};

}  // namespace test
}  // namespace onnxruntime


text:
require 'mattock'

module Mattock
  class TarballTask < Rake::FileCommandTask
    setting :compression, :auto
    setting :compression_flag, nil
    setting :exclude_vcs, true

    dir(:unpacked_parent, dir(:unpacked_dir))
    dir(:archive_parent, path(:archive))

    setting :basename, nil
    setting :extension, "tbz"

    def default_configuration
      super
      self.compression_flag ||=
        case compression
        when :auto
          "--auto-compress"
        when :gzip
          "--gzip"
        when :bzip, :bzip2
          "--bzip2"
        when :xz
          "--xz"
        when :lzip
          "--lzip"
        when :lzma
          "--lzma"
        when :lzop
          "--lzop"
        when :compress
          "--compress"
        else
          ""
        end

      self.basename = name
    end

    def resolve_configuration
      extension.sub(/[.]$/,'')

      unpacked_parent.absolute_path ||= absolute_path
      archive_parent.absolute_path ||= absolute_path

      unless basename.nil?
        unpacked_dir.relative_path ||= basename
        archive.relative_path ||= [basename, extension].join(".")
      end

      resolve_paths
      super
    end

    def action_flag(string)
      case string
      when "c", /create/
        "--create"
      when "x", /extract/
        "--extract"
      when "d", /compare/
        "--compare"
      else
        string
      end
    end

    def add_options(tar)
      tar.options << "--files-from=" + listfile
    end

    def tar_command(action, verbose = true, &block)
      tar_command_without_directory(action, verbose) do |tar|
        tar.options << "--directory="+unpacked_dir.absolute_path
        yield tar if block_given?
      end
    end

    def tar_command_without_directory(action, verbose = true)
      command = cmd("tar") do |tar|
        tar.options << action
        tar.options << "--verbose" if verbose
        tar.options << compression_flag
        tar.options << "--file="+archive.absolute_path
        tar.options << "--exclude-vcs" if exclude_vcs
        yield(tar) if block_given?
      end
      return command
    end
  end

  class PackTarballTask < TarballTask
    default_taskname :pack_tarball
    path :listfile

    def command
      tar_command("--create") do |tar|
        tar.options << "--files-from="+listfile.absolute_path
      end
    end

    def define
      super
      if prerequisite_tasks.empty?
        enhance(source_files)
      end
    end
  end

  class ArchiveListTask < Rake::FileTask
    dir(:unpacked_dir)
    setting(:source_files)

    def needed?
      return true if super
      #the existing state of the file maps to the contents of the file
      return (File::read(name) == file_list)
    end

    def file_list
      @file_list ||=
        begin
          source_files.map do |path|
            Pathname.new(path)
          end.find_all do |pathname|
            not (pathname.directory? and not pathname.children.empty?)
          end.map do |pathname|
            pathname.relative_path_from unpacked_dir.pathname
          end
        end
    end

    def action(args)
      File::open(name, "w") do |list|
        list.write(file_list.join("\n"))
      end
    end
  end

  class UnpackTarballTask < TarballTask
    default_taskname :unpack_tarball

    def command
      (cmd("mkdir", "-p", unpacked_dir.absolute_path) & tar_command("--extract")) #ok
    end

    def target_files
      FileList[tar_command_without_directory("--list", false).run.stdout.split.map do |path|
        unpacked_dir.pathname.join(path).to_s
      end]
    end

    def create_target_dependencies
      target_files.each do |path|
        ::Rake::FileTask.define_task(path => name)
      end
    end

    def needed?
      return true if super
      if File::exists?(archive_path.absolute_path)
        return !(tar_command("--compare")).succeeds?
      end
      return true
    end
  end

  class PackTarball < Tasklib
    default_namespace :pack

    dir(:unpacked_dir)

    dir(:marshalling,
       path(:listfile),
       path(:archive))

    setting :basename, nil
    setting :extension, "tbz"
    setting :source_files
    setting :source_pattern, "**/*"
    setting :exclude_patterns, ['**/*.sw[^f]'] #ok

    def resolve_configuration
      listfile.relative_path ||= "#{basename}.list"
      unless basename.nil?
        self.unpacked_dir.relative_path ||= basename
        self.archive.relative_path ||= [basename, extension].join(".")
      end

      resolve_paths

      self.source_files ||=
        begin
          pattern = File::join(unpacked_dir.absolute_path, source_pattern)
          list = FileList[pattern]
          exclude_patterns.each do |pattern|
            list.exclude(pattern)
          end
          list
        end

      super
    end

    def define
      super
      in_namespace do
        ArchiveListTask.define_task(listfile.absolute_path => [::Rake.application.rakefile, marshalling.absolute_path] + source_files) do |task|
          copy_settings_to(task)
        end

        PackTarballTask.define_task(archive.absolute_path => listfile.absolute_path) do |task|
          copy_settings_to(task)
        end
        task archive.absolute_path => ::Rake.application.rakefile unless ::Rake.application.rakefile.nil?
      end
    end
  end

  class UnpackTarballs < Tasklib
    class RemoveFilesNotInArchives < TarballTask
      dir :unpacked_dir

      setting :archive_paths
      setting :file_list

      attr_accessor :stray_files

      def resolve_configuration
        resolve_paths

        super
      end

      def stray_files
        @stray_files ||=
          begin
            archive_paths.each do |archive_path|
              list_process = tar_command("--list")
              if list_process.succeeds?
                self.archive_files += list_process.stdout.lines.to_a.map{|line| line.chomp}
              end
            end
            archive_files.map!{|path| File::expand_path(path, target_dir)}

            self.stray_files = file_list - archive_files
            stray_files.delete_if{|path| File::directory?(path)}
            unsafe_cleanup = stray_files.find_all do |path|
              %r{\A/} =~ path and not %r{\A#{File::expand_path(target_dir)}} =~ path
            end
            raise "Unsafe stray cleanup: #{unsafe_cleanup.inspect}" unless unsafe_cleanup.empty?
            stray_files
          end
      end

      def needed?
        stray_files.any? do |path|
          File.exists?(path)
        end
      end

      def command
        cmd("rm", "-f", *stray_files)
      end
    end

    default_namespace :unpack

    setting :archive_paths, []
    setting :archive_path, nil

    dir :unpacked_dir
    setting :target_pattern, "**/*"
    setting :file_list

    def resolve_configuration
      unless archive_path.nil?
        archive_paths << archive_path
      end

      resolve_paths

      self.file_list ||= FileList[File::join(File::expand_path(target_dir),target_pattern)]

      super
    end

    def define
      in_namespace do
        archive_paths.each do |archive|
          UnpackTarballTask.define_task(archive) do |unpack|
            copy_settings_to(unpack)
            unpack.archive_path.absolute_path = archive
          end
        end

        if file_list.empty?
          task :unpack => archive_paths
        else
          RemoveFilesNotInArchives.define_task(:remove_strays => archive_paths) do |remove_strays|
            copy_settings_to(remove_strays)
          end

          task :unpack => file_list
          file_list.each do |path|
            file path => :remove_strays
          end
        end
      end

      task namespace_name => self[:unpack]
    end
  end

  UnpackTarball = UnpackTarballs
end


text:
class CommentsController < ApplicationController
	before_filter :authenticate_user!, only: [:create, :upvote]
	before_action :set_post

	def create
		comment = @post.comments.create(comment_params.merge(user_id: current_user.id))
		respond_with @post, comment
	end

	def upvote
		comment = @post.comments.find(params[:id])
		comment.increment!(:upvotes)

		respond_with @post, comment
	end

	private

	def set_post
		@post = Post.find params[:post_id]
	end

	def comment_params
		params.require(:comment).permit(:body)
	end
end


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<title></title>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="search.css"/>

Loading...

  fromAxisRot
  Quaternion

  fromColumnMajorArray

    Matrix3::fromColumnMajorArray()
    Matrix4::fromColumnMajorArray()

  fromEulerAngles
  Quaternion

  fromMatrix

    Quaternion::fromMatrix(const Matrix4< T > &m)
    Quaternion::fromMatrix(const Matrix3< T > &m)

  fromOde
  Matrix3

  fromRowMajorArray

    Matrix3::fromRowMajorArray()
    Matrix4::fromRowMajorArray()

Searching...

No Matches


text:
<?php
/*
  Plugin Name: Example Plugin (Sunrise)
  Plugin URI: http://anovladimir.me/sunrise/
  Version: 7.0.0
  Description: Options Pages Framework
  Author: Vladimir Anokhin
  Author URI: http://anovladimir.me/
  Text Domain: plugin-example
  Domain Path: /languages
  License: MIT
 */

require_once 'sunrise.php';

/**
 * Initialize example plugin
 */
function plugin_example_init() {

	// Make plugin available for translation, you can change /languages/ to your .mo-files folder name
	load_plugin_textdomain( 'plugin-example', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );

	// Initialize Sunrise
	$admin = new Sunrise7( array(
			// Sunrise file path
			'file' => __FILE__,
			// Plugin slug (should be equal to plugin directory name)
			'slug' => 'plugin-example',
			// Plugin prefix
			'prefix' => 'plugin_example_',
			// Plugin textdomain
			'textdomain' => 'plugin-example',
			// Custom CSS assets folder
			'css' => '',
			// Custom JS assets folder
			'js' => '',
		) );

	// Prepare array with options
	$options = array(

		// Open tab: Regular fields
		array(
			'type' => 'opentab',
			'name' => __( 'Regular fields', 'plugin-example' ),
		),

		// Text field
		array(
			'id'      => 'text_field_id',
			'type'    => 'text',
			'default' => 'Default value',
			'name'    => __( 'Text field', 'plugin-example' ),
			'desc'    => __( 'Text field description', 'plugin-example' ),
		),

		// Textarea
		array(
			'id'      => 'textarea_id',
			'type'    => 'textarea',
			'default' => 'Default value',
			'rows'    => 10,
			'name'    => __( 'Textarea', 'plugin-example' ),
			'desc'    => __( 'Textarea description', 'plugin-example' ),
		),

		// Checkbox
		array(
			'id'      => 'checkbox_id',
			'type'    => 'checkbox',
			'default' => 'on',
			'name'    => __( 'Checkbox', 'plugin-example' ),
			'desc'    => __( 'Checkbox description', 'plugin-example' ),
			'label'   => __( 'Enabled', 'plugin-example' ),
		),

		// Select (dropdown list)
		array(
			'id'      => 'select_id',
			'type'    => 'select',
			'default' => 'option-1',
			'name'    => __( 'Select', 'plugin-example' ),
			'desc'    => __( 'Select description', 'plugin-example' ),
			'options' => array(
				array(
					'value' => 'option-1',
					'label'  => __( 'Option 1', 'plugin-example' ),
				),
				array(
					'value' => 'option-2',
					'label'  => __( 'Option 2', 'plugin-example' ),
				),
				array(
					'value' => 'option-3',
					'label'  => __( 'Option 3', 'plugin-example' ),
				),
			),
		),

		// Multi-select (dropdown list with multiple choices)
		array(
			'id'      => 'multi_select_id',
			'type'    => 'select',
			'default' => array( 'option-1', 'option-2' ),
			'name'    => __( 'Multi-select', 'plugin-example' ),
			'desc'    => __( 'Multi-select description', 'plugin-example' ),
			'options' => array(
				array(
					'value' => 'option-1',
					'label'  => __( 'Option 1', 'plugin-example' ),
				),
				array(
					'value' => 'option-2',
					'label'  => __( 'Option 2', 'plugin-example' ),
				),
				array(
					'value' => 'option-3',
					'label'  => __( 'Option 3', 'plugin-example' ),
				)
			),
			'multiple' => true,
			'size' => 4,
		),

		// Radio buttons
		array(
			'id'      => 'radio_id',
			'type'    => 'radio',
			'default' => 'option-1',
			'name'    => __( 'Radio', 'plugin-example' ),
			'desc'    => __( 'Radio description', 'plugin-example' ),
			'options' => array(
				array(
					'value' => 'option-1',
					'label'  => __( 'Option 1', 'plugin-example' ),
				),
				array(
					'value' => 'option-2',
					'label'  => __( 'Option 2', 'plugin-example' ),
				),
				array(
					'value' => 'option-3',
					'label'  => __( 'Option 3', 'plugin-example' ),
				)
			)
		),

		// Number picker
		array(
			'id'      => 'number_field_id',
			'type'    => 'number',
			'default' => 10,
			'name'    => __( 'Number', 'plugin-example' ),
			'desc'    => __( 'Number field description', 'plugin-example' ),
			'min'     => 0,
			'max'     => 20,
			'step'    => 1,
		),

		// Close tab: Regular fields
		array(
			'type' => 'closetab',
		),

		// Open tab: Extra fields
		array(
			'type' => 'opentab',
			'name' => __( 'Extra fields', 'plugin-example' ),
		),

		// Media (text field with Media library button)
		array(
			'id'      => 'media_field_id',
			'type'    => 'media',
			'default' => '',
			'name'    => __( 'Media', 'plugin-example' ),
			'desc'    => __( 'Media field description', 'plugin-example' ),
		),

		// Color picker
		array(
			'id'      => 'color_field_id',
			'type'    => 'color',
			'default' => '#0099ff',
			'name'    => __( 'Color', 'plugin-example' ),
			'desc'    => __( 'Color field description', 'plugin-example' ),
		),

		// Size picker
		array(
			'id'      => 'size_field_id',
			'type'    => 'size',
			'default' => array( 0 => '20', 1 => 'px' ),
			'name'    => __( 'Size', 'plugin-example' ),
			'desc'    => __( 'Size field description', 'plugin-example' ),
			'units'   => array( 'px', 'em', '%' ),
			'min'     => 0,
			'max'     => 200,
			'step'    => 10,
		),

		// Checkbox group
		array(
			'id'      => 'checkbox_group_id',
			'type'    => 'checkbox_group',
			'default' => array(
				'checkbox-1' => 'on',
				'checkbox-2' => 'on',
			),
			'name'    => __( 'Checkbox group', 'plugin-example' ),
			'desc'    => __( 'Checkbox group description', 'plugin-example' ),
			'options' => array(
				array(
					'id'    => 'checkbox-1',
					'label' => __( 'Checkbox 1', 'plugin-example' ),
				),
				array(
					'id'    => 'checkbox-2',
					'label' => __( 'Checkbox 2', 'plugin-example' ),
				),
				array(
					'id'    => 'checkbox-3',
					'label' => __( 'Checkbox 3', 'plugin-example' ),
				)
			),
			'multiple' => true,
			'size' => 4,
		),

		// Custom HTML content
		array(
			'type'    => 'html',
			'content' => '
HTML field type

Paragraph tag
',
		),

		// Custom title
		array(
			'type' => 'title',
			'name' => __( 'Title field', 'plugin-example' ),
		),

		// Image radio
		array(
			'id'      => 'image_radio_id',
			'type'    => 'image_radio',
			'default' => 'option-1',
			'name'    => __( 'Image radio', 'plugin-example' ),
			'desc'    => __( 'Image radio description', 'plugin-example' ),
			'options' => array(
				array(
					'value' => 'option-1',
					'label' => __( 'Option 1', 'plugin-example' ),
					'image' => 'http://lorempixel.com/120/90/food/1/',
				),
				array(
					'value' => 'option-2',
					'label' => __( 'Option 2', 'plugin-example' ),
					'image' => 'http://lorempixel.com/120/90/food/2/',
				),
				array(
					'value' => 'option-3',
					'label' => __( 'Option 3', 'plugin-example' ),
					'image' => 'http://lorempixel.com/120/90/food/3/',
				),
			),
		),

		// Close tab: Extra fields
		array(
			'type' => 'closetab',
		)
	);

	// Add top-level menu (like Dashboard -> Comments)
	$admin->add_menu( array(
			// Settings page <title>
			'page_title' => __( 'Example Plugin Settings', 'plugin-example' ),
			// Menu title, will be shown in left dashboard menu
			'menu_title' => __( 'Example Plugin', 'plugin-example' ),
			// Minimal user capability to access this page
			'capability' => 'manage_options',
			// Unique page slug
			'slug' => 'plugin-example-settings',
			// Add here your custom icon url, or use [dashicons](https://developer.wordpress.org/resource/dashicons/)
			// 'icon_url' => admin_url( 'images/wp-logo.png' ),
			'icon_url' => 'dashicons-wordpress',
			// Menu position from 80 to <infinity>, you can use decimals
			'position' => '91.1',
			// Array with options available on this page
			'options' => $options,
		) );

	// Add sub-menu (like Dashboard -> Settings -> Permalinks)
	$admin->add_submenu( array(
			// Settings page <title>
			'page_title' => __( 'Example Plugin Settings', 'plugin-example' ),
			// Menu title, will be shown in left dashboard menu
			'menu_title' => __( 'Page 2', 'plugin-example' ),
			// Unique page slug, you can use here the slug of parent page, which you've already created
			'slug' => 'plugin-example-settings-2',
			// Slug of the parent page (see above)
			'parent_slug' => 'plugin-example-settings',
			// Array with options available on this page
			'options' => $options,
		) );

	// Add another sub-menu (like Dashboard -> Settings -> Permalinks)
	$admin->add_submenu( array(
			// Settings page <title>
			'page_title' => __( 'Example Plugin Settings', 'plugin-example' ),
			// Menu title, will be shown in left dashboard menu
			'menu_title' => __( 'Page 3', 'plugin-example' ),
			// Unique page slug, you can use here the slug of parent page, which you've already created
			'slug' => 'plugin-example-settings-3',
			// Slug of the parent page (see above)
			'parent_slug' => 'plugin-example-settings',
			// Array with options available on this page
			'options' => $options,
		) );
}

// Hook to plugins_loaded
add_action( 'plugins_loaded', 'plugin_example_init' );