text:
package eu.motogymkhana.competition.adapter;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;

import javax.inject.Inject;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import eu.motogymkhana.competition.Constants;
import eu.motogymkhana.competition.R;
import eu.motogymkhana.competition.activity.RiderNewUpdateActivity;
import eu.motogymkhana.competition.activity.RiderViewActivity;
import eu.motogymkhana.competition.api.ResponseHandler;
import eu.motogymkhana.competition.api.response.UpdateRiderResponse;
import eu.motogymkhana.competition.dao.TimesDao;
import eu.motogymkhana.competition.log.LogProvider;
import eu.motogymkhana.competition.model.Bib;
import eu.motogymkhana.competition.model.Gender;
import eu.motogymkhana.competition.model.Rider;
import eu.motogymkhana.competition.model.RiderNumberComparator;
import eu.motogymkhana.competition.model.Times;
import eu.motogymkhana.competition.notify.Notifier;
import eu.motogymkhana.competition.prefs.MyPreferences;
import eu.motogymkhana.competition.rider.GetRidersCallback;
import eu.motogymkhana.competition.rider.RiderManager;
import eu.motogymkhana.competition.round.RoundManager;
import toothpick.Scope;
import toothpick.Toothpick;

/**
 * created by Christine
 * adapter for the rider registration list fragment
 */
public class RiderRegistrationListAdapter extends BaseAdapter {

    protected static final int RIDERTIMES = 101;
    private static final String LOGTAG = RiderRegistrationListAdapter.class.getSimpleName();
    private final Scope scope;

    @Inject
    protected MyPreferences prefs;

    private List<Rider> riders = new ArrayList<Rider>();
    private LayoutInflater inflater;
    private volatile boolean sorted = false;
    private volatile boolean registration = false;
    private volatile boolean result = false;

    private Activity activity;

    private RiderManager riderManager;

    @Inject
    protected RoundManager roundManager;

    @Inject
    protected TimesDao timesDao;

    private Notifier notifier;
    private String femaleText;

    private ChangeListener changeListener = new ChangeListener() {

        @Override
        public void notifyDataChanged() {
            riderManager.getRiders(getRidersCallback);
        }
    };

    GetRidersCallback getRidersCallback = new GetRidersCallback() {

        @Override
        public void onSuccess(Collection<Rider> collection) {
            setRiders(collection);
        }

        @Override
        public void onError(String error) {
            LogProvider.getLogger().e(LOGTAG, error);
        }
    };

    private ResponseHandler setRegisteredResponseHandler = new ResponseHandler() {

        @Override
        public void onSuccess(Object object) {
            Rider updatedRider = ((UpdateRiderResponse) object).getRider();
            try {
                riderManager.store(updatedRider);
            } catch (SQLException e) {
                e.printStackTrace();
            }
            notifier.notifyDataChanged();
        }

        @Override
        public void onException(Exception e) {

        }

        @Override
        public void onError(int statusCode, String string) {

        }
    };

    private ResponseHandler updateRiderResponseHandler = new ResponseHandler() {

        @Override
        public void onSuccess(Object object) {
            try {
                riderManager.store(((UpdateRiderResponse) object).getRider());
                riderManager.getRiders(getRidersCallback);
            } catch (SQLException e) {
                e.printStackTrace();
            }
            notifier.notifyDataChanged();
        }

        @Override
        public void onException(Exception e) {

        }

        @Override
        public void onError(int statusCode, String string) {

        }
    };

    @Inject
    public RiderRegistrationListAdapter(Activity activity, final RiderManager riderManager, Notifier notifier) {

        scope = Toothpick.openScopes(Constants.DEFAULT_SCOPE, this);
        Toothpick.inject(this, scope);

        this.riderManager = riderManager;
        this.notifier = notifier;
        this.activity = activity;

        inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        riderManager.getRiders(getRidersCallback);
        notifier.registerRiderResultListener(changeListener);
        femaleText = activity.getResources().getString(R.string.female_sign);
    }

    @Override
    public int getCount() {
        return riders.size();
    }

    @Override
    public Object getItem(int position) {
        return riders.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {

        convertView = inflater.inflate(R.layout.rider_registration_list_row, null);

        final ProgressBar progressBar = (ProgressBar) convertView.findViewById(R.id.progress_bar);
        progressBar.setVisibility(View.GONE);

        long roundDate = prefs.getDate();

        final Rider rider = riders.get(position);

        if(rider == null){
            return convertView;
        }

        Times riderTimes = rider.getEUTimes(roundDate);

        ((LinearLayout) convertView.findViewById(R.id.rider_layout)).setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {

                Intent intent = new Intent(activity, RiderViewActivity.class);
                intent.putExtra(RiderViewActivity.RIDER_ID, rider.getRiderId());

                activity.startActivity(intent);
            }
        });

        ((TextView) convertView.findViewById(R.id.first_name)).setText(rider.getFirstName());
        ((TextView) convertView.findViewById(R.id.last_name)).setText(rider.getLastName());
        ((TextView) convertView.findViewById(R.id.ridernumber)).setText(rider.getRiderNumberString());

        if (rider.getCountry() != null) {
            ((TextView) convertView.findViewById(R.id.country)).setText(rider.getNationality().name());
        }

        if (rider.getBib() == null) {
            rider.setBib(Bib.Y);
        }

        TextView startNumber = (TextView) convertView.findViewById(R.id.startnumber);
        LinearLayout startNumberLayout = (LinearLayout) convertView.findViewById(R.id.startnumber_layout);
        ImageView editView = (ImageView) convertView.findViewById(R.id.edit);

        startNumber.setText(riderTimes != null ? Integer.toString(riderTimes.getStartNumber()) : "");
        startNumberLayout.setBackgroundColor(rider.getBibColor());

        editView.setVisibility(View.VISIBLE);
        editView.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {

                Intent intent = new Intent(activity, RiderNewUpdateActivity.class);
                intent.putExtra(RiderNewUpdateActivity.RIDER_ID, rider.getRiderId());
                activity.startActivity(intent);
            }
        });

        CheckBox isDayRider = (CheckBox) convertView.findViewById(R.id.day_rider_box);
        isDayRider.setVisibility(View.VISIBLE);
        isDayRider.setChecked(rider.isDayRider());

        ((TextView) convertView.findViewById(R.id.gender)).setText(rider.getGender() == Gender.F ? femaleText : "");

        CheckBox isRegistered = (CheckBox) convertView.findViewById(R.id.registered_box);
        isRegistered.setVisibility(View.VISIBLE);
        isRegistered.setChecked(riderTimes != null && riderTimes.isRegistered());

        isRegistered.setOnCheckedChangeListener(new OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

                try {
                    riderManager.setRegistered(rider, isChecked, setRegisteredResponseHandler);
                    progressBar.setVisibility(View.VISIBLE);
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        });

        isDayRider.setOnCheckedChangeListener(new OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

                rider.setDayRider(isChecked);

                riderManager.update(rider, updateRiderResponseHandler);
            }
        });

        return convertView;
    }

    public void setRegistration() {
        registration = true;
        notifyDataSetChanged();
    }

    private void setRiders(Collection<Rider> riders) {

        if (riders != null) {
            this.riders.clear();
            this.riders.addAll(riders);
        } else {
            this.riders = new ArrayList<Rider>();
        }

        if (this.riders.size() > 0) {
            Collections.sort(this.riders, new RiderNumberComparator());
        }

        activity.runOnUiThread(new Runnable() {

            @Override
            public void run() {
                notifyDataSetChanged();
            }
        });
    }
}


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('employees', '0007_employee_caffe'),
    ]

    operations = [
        migrations.AlterField(
            model_name='employee',
            name='favorite_coffee',
            field=models.CharField(blank=True, max_length=50),
        ),
        migrations.AlterField(
            model_name='employee',
            name='telephone_number',
            field=models.CharField(blank=True, max_length=20),
        ),
    ]

redpajama_set_name: RedPajamaGithub


text:
/**
 * Created by Stef van den Berg
 * on 09/04/14
 *
 * This plugin is created to show a large preview of an image with html description
 *
 * Settings:
 *
 *  labelNext:  label that is set for the next tag
 *  labelPrevious:  label that is set for the previous tag
 *  labelClose:  label that is set for the close tag
 *  labelNext:  label that is set for the next tag
 *  labelSlideStart:  label that is set for the start slide show tag
 *  labelSlideStop:  label that is set for the stop slide show tag
 *  slideShowRepeat:  Repeat the slide show when true, Stop at last slide when false
 *  slideShowTime:  Pause between the slides in ms
 *  totalAnimationTime: Duration off the show animation in ms
 */

(function ( $ ) {

    $.fn.descBox = function(options) {

        return this.each(function() {
            var _settings = $.extend({
                collection: false,
                labelNext: 'Next',
                labelPrevious: 'Previous',
                labelClose: 'Close',
                labelSlideStart: 'Start slideshow',
                labelSlideStop: 'Stop slideshow',
                slideShowStarted: false,
                slideShowElement: null,
                slideShowCollectionName: '',
                slideShowInterval: null,
                slideShowRepeat: true,
                slideShowTime: 3500,
                totalAnimationTime: 500
            }, options || {});

            var $self = $(this);

            var collectionName = $self.attr('data-preview');
            var $collection = $('[data-preview=' + collectionName + ']');
            var isCollection = ($collection.length > 1);

            $self.on('click', function() {
                var $self = $(this);
                var description = $self.find('.desc-description').html();
                var title = $self.find('.desc-title').html();
                var $image = $self.find('.desc-image');

                createMask();
                createImage($image.attr('src'), title, description, isCollection, collectionName, $self);
            });

            function createMask() {
                var $document = $('body');
                if ($document.find('.desc-mask').length == 0) {
                    $document.append('

' + _settings.labelClose + '

');

                    var $maskClose = $('.desc-close');
                    $maskClose.on('click', function() {
                        var $self = $(this);
                        var $mask = $self.parent('.desc-mask');
                        var $preview = $('.desc-preview');
                        var $previewDesc = $('.desc-preview-description');
                        var $previewBackground = $('.desc-preview-background');
                        $previewBackground.remove();
                        $preview.remove();
                        $mask.remove();
                        $previewDesc.remove();
                        if (_settings.slideShowInterval != null) {
                            window.clearInterval(_settings.slideShowInterval);
                        }
                    });
                }
            }

            function createImage(imageSrc, title, description, isCollection, collectionName, $current) {
                var $document = $('body');
                if ($document.find('.desc-preview').length == 0) {
                    $document.append('

');
                    $document.append('

')
                    var $preview = $('.desc-preview');
                    $preview.append('');
                    var $image = $('.desc-img-responsive');
                    $image.css({ opacity: 0 });
                    var screenWidth = $document.width();
                    var screenHeight = $document.height();
                    var imageWidth = Math.ceil(($image.width() / screenWidth) * 100) + 5;
                    var imageHeight = Math.ceil(($image.height() / screenHeight) * 100) + 10;
                    var $previewBackground = $('.desc-preview-background');
                    $previewBackground.animate({ width: imageWidth + '%', height: imageHeight + '%', left: '10%'}, ((_settings.totalAnimationTime / 100) * 50), function() {
                        $document.append('

');
                        var $previewDesc = $('.desc-preview-description');
                        $previewDesc.css({ opacity: 0 });
                        $previewDesc.html('
' + title + '
' + description);
                        if (isCollection) {
                            previousInCollection(collectionName, $current);
                            nextInCollection(collectionName, $current);
                            var labelSlideshow = (_settings.slideShowStarted) ? _settings.labelSlideStop : _settings.labelSlideStart;
                            $previewDesc.append('
' + labelSlideshow + '
');
                            var $slideshow = $('.desc-preview-slide');
                            if (_settings.slideShowStarted) {
                                $slideshow.off('click');
                                $slideshow.on('click', function() {
                                    stopSlideshow();
                                });
                            } else {
                                var $slideshow = $('.desc-preview-slide');
                                $slideshow.off('click');
                                $slideshow.on('click', function() {
                                    startSlideshow(collectionName, $current);
                                });
                            }
                        }
                        $previewDesc.animate({ opacity: 1 }, ((_settings.totalAnimationTime / 100) *25), function() {
                            $image.animate({ opacity: 1}, ((_settings.totalAnimationTime / 100) * 25));
                        });
                    });
                }
            }

            function nextInCollection(collectionName, $current) {
                var $nextElement = $current.next('[data-preview=' + collectionName + ']');
                if ($nextElement.length != 0) {
                    var $previewDesc = $('.desc-preview-description');
                    $previewDesc.append('
' + _settings.labelNext + '
');
                    var $nextDesc = $('.desc-arrow-next');
                    $nextDesc.on('click', function() {
                        var $mask = $('.desc-mask');
                        var $preview = $('.desc-preview');
                        var $previewDesc = $('.desc-preview-description');
                        var $previewBackground = $('.desc-preview-background');
                        $previewBackground.remove();
                        $preview.remove();
                        $mask.remove();
                        $previewDesc.remove();
                        if (_settings.slideShowInterval != null) {
                            stopSlideshow();
                        }
                        createMask();
                        createImage($nextElement.find('.desc-image').attr('src'), $nextElement.find('.desc-title').html(), $nextElement.find('.desc-description').html(), true, collectionName, $nextElement);
                    });
                }
            }

            function previousInCollection(collectionName, $current) {
                var $previousElement = $current.prev('[data-preview=' + collectionName + ']');
                if ($previousElement.length != 0) {
                    var $previewDesc = $('.desc-preview-description');
                    $previewDesc.append('
' + _settings.labelPrevious + '
');
                    var $previousDesc = $('.desc-arrow-previous');
                    $previousDesc.on('click', function() {
                        var $mask = $('.desc-mask');
                        var $preview = $('.desc-preview');
                        var $previewDesc = $('.desc-preview-description');
                        var $previewBackground = $('.desc-preview-background');
                        $previewBackground.remove();
                        $preview.remove();
                        $mask.remove();
                        $previewDesc.remove();
                        if (_settings.slideShowInterval != null) {
                            stopSlideshow();
                        }
                        createMask();
                        createImage($previousElement.find('.desc-image').attr('src'), $previousElement.find('.desc-title').html(), $previousElement.find('.desc-description').html(), isCollection, collectionName, $previousElement);
                    });
                }
            }

            function startSlideshow(collectionName, $current) {
                var $slideShowLabel = $('.desc-preview-slide');
                $slideShowLabel.off('click');
                $slideShowLabel.on('click', function() {
                    stopSlideshow();
                });
                $slideShowLabel.text(_settings.labelSlideStop);
                _settings.slideShowStarted = true;
                _settings.slideShowElement = $current.get(0);
                _settings.slideShowCollectionName = collectionName;
                _settings.slideShowInterval = setInterval(function() {
                    var $element = null;
                    var $nextElement = $(_settings.slideShowElement).next('[data-preview=' + _settings.slideShowCollectionName + ']');
                    if ($nextElement.length != 0) {
                        $element = $nextElement;
                    } else {
                        if (_settings.slideShowRepeat) {
                            var $firstElement = $('[data-preview=' + _settings.slideShowCollectionName + ']').eq(0);
                            _settings.slideShowElement = $firstElement;
                            $element = $firstElement;
                        } else {
                            stopSlideshow();
                            var $labelSlideshow = $('.desc-preview-slide');
                            $labelSlideshow.remove();
                        }
                    }
                    if ($element != null) {
                        _settings.slideShowElement = $element.get(0);
                        var $mask = $('.desc-mask');
                        var $preview = $('.desc-preview');
                        var $previewDesc = $('.desc-preview-description');
                        var $previewBackground = $('.desc-preview-background');
                        $previewBackground.remove();
                        $preview.remove();
                        $mask.remove();
                        $previewDesc.remove();
                        createMask();
                        createImage($element.find('.desc-image').attr('src'), $element.find('.desc-title').html(), $element.find('.desc-description').html(), true, _settings.slideShowCollectionName, $element);
                    }
                }, _settings.slideShowTime);
            }

            function stopSlideshow() {
                window.clearInterval(_settings.slideShowInterval);

                _settings.slideShowStarted = false;
                _settings.slideShowCollectionName = '';
                _settings.slideShowInterval = null;
                _settings.slideShowElement = null;

                var $mask = $('.desc-mask');
                var $preview = $('.desc-preview');
                var $previewDesc = $('.desc-preview-description');
                var $previewBackground = $('.desc-preview-background');
                $previewBackground.remove();
                $preview.remove();
                $mask.remove();
                $previewDesc.remove();
            }
        });
    };

    $.fn.descBox.defaultSettings = {

    };
}( jQuery ));


text:
using namespace arangodb::aql;

namespace {
arangodb::velocypack::StringRef const filterKey("filter");
arangodb::velocypack::StringRef const producesResultKey("producesResult");
}

DocumentProducingNode::DocumentProducingNode(Variable const* outVariable)
    : _outVariable(outVariable),
      _count(false) {
  TRI_ASSERT(_outVariable != nullptr);
}

DocumentProducingNode::DocumentProducingNode(ExecutionPlan* plan,
                                             arangodb::velocypack::Slice slice)
    : _outVariable(Variable::varFromVPack(plan->getAst(), slice, "outVariable")),
      _projections(arangodb::aql::Projections::fromVelocyPack(slice)),
      _count(false) {
  TRI_ASSERT(_outVariable != nullptr);

  VPackSlice p = slice.get(::filterKey);
  if (!p.isNone()) {
    Ast* ast = plan->getAst();
    // new AstNode is memory-managed by the Ast
    setFilter(std::make_unique<Expression>(ast, ast->createNode(p)));
  }

  _count = arangodb::basics::VelocyPackHelper::getBooleanValue(slice, "count", false);
}

void DocumentProducingNode::cloneInto(ExecutionPlan* plan, DocumentProducingNode& c) const {
  if (_filter != nullptr) {
    c.setFilter(std::unique_ptr<Expression>(_filter->clone(plan->getAst())));
  }
  c.copyCountFlag(this);
}

void DocumentProducingNode::toVelocyPack(arangodb::velocypack::Builder& builder,
                                         unsigned flags) const {
  builder.add(VPackValue("outVariable"));
  _outVariable->toVelocyPack(builder);

  _projections.toVelocyPack(builder);

  if (_filter != nullptr) {
    builder.add(VPackValuePair(::filterKey.data(), ::filterKey.size(), VPackValueType::String));
    _filter->toVelocyPack(builder, flags);
  }

  // "producesResult" is read by AQL explainer. don't remove it!
  builder.add("count", VPackValue(doCount()));
  if (doCount()) {
    TRI_ASSERT(_filter == nullptr);
    builder.add(::producesResultKey, VPackValue(false));
  } else {
    builder.add(::producesResultKey, VPackValue(_filter != nullptr || dynamic_cast<ExecutionNode const*>(this)->isVarUsedLater(_outVariable)));
  }
}

Variable const* DocumentProducingNode::outVariable() const {
  return _outVariable;
}

/// @brief remember the condition to execute for early filtering
void DocumentProducingNode::setFilter(std::unique_ptr<Expression> filter) {
  _filter = std::move(filter);
}

arangodb::aql::Projections const& DocumentProducingNode::projections() const noexcept {
  return _projections;
}

arangodb::aql::Projections& DocumentProducingNode::projections() noexcept {
  return _projections;
}

void DocumentProducingNode::setProjections(arangodb::aql::Projections projections) {
  _projections = std::move(projections);
}

bool DocumentProducingNode::doCount() const {
  return _count && (_filter == nullptr);
}


text:
from google.cloud.source_context import gapic_version as package_version

__version__ = package_version.__version__

from google.cloud.source_context_v1.types.source_context import (
    AliasContext,
    CloudRepoSourceContext,
    CloudWorkspaceId,
    CloudWorkspaceSourceContext,
    ExtendedSourceContext,
    GerritSourceContext,
    GitSourceContext,
    ProjectRepoId,
    RepoId,
    SourceContext,
)

__all__ = (
    "AliasContext",
    "CloudRepoSourceContext",
    "CloudWorkspaceId",
    "CloudWorkspaceSourceContext",
    "ExtendedSourceContext",
    "GerritSourceContext",
    "GitSourceContext",
    "ProjectRepoId",
    "RepoId",
    "SourceContext",
)


text:
require "rake/file_utils"

module Rake
  #
  # FileUtilsExt provides a custom version of the FileUtils methods
  # that respond to the <tt>verbose</tt> and <tt>nowrite</tt>
  # commands.
  #
  module FileUtilsExt
    include FileUtils

    class << self
      attr_accessor :verbose_flag, :nowrite_flag
    end

    DEFAULT = Object.new

    FileUtilsExt.verbose_flag = DEFAULT
    FileUtilsExt.nowrite_flag = false

    FileUtils.commands.each do |name|
      opts = FileUtils.options_of name
      default_options = []
      if opts.include?("verbose")
        default_options << ":verbose => FileUtilsExt.verbose_flag"
      end
      if opts.include?("noop")
        default_options << ":noop => FileUtilsExt.nowrite_flag"
      end

      next if default_options.empty?
      module_eval(<<-EOS, __FILE__, __LINE__ + 1)
      def #{name}( *args, &block )
        super(
          *rake_merge_option(args,
            #{default_options.join(', ')}
            ), &block)
      end
      EOS
    end

    # Get/set the verbose flag controlling output from the FileUtils
    # utilities.  If verbose is true, then the utility method is
    # echoed to standard output.
    #
    # Examples:
    #    verbose              # return the current value of the
    #                         # verbose flag
    #    verbose(v)           # set the verbose flag to _v_.
    #    verbose(v) { code }  # Execute code with the verbose flag set
    #                         # temporarily to _v_.  Return to the
    #                         # original value when code is done.
    def verbose(value=nil)
      oldvalue = FileUtilsExt.verbose_flag
      FileUtilsExt.verbose_flag = value unless value.nil?
      if block_given?
        begin
          yield
        ensure
          FileUtilsExt.verbose_flag = oldvalue
        end
      end
      FileUtilsExt.verbose_flag
    end

    # Get/set the nowrite flag controlling output from the FileUtils
    # utilities.  If verbose is true, then the utility method is
    # echoed to standard output.
    #
    # Examples:
    #    nowrite              # return the current value of the
    #                         # nowrite flag
    #    nowrite(v)           # set the nowrite flag to _v_.
    #    nowrite(v) { code }  # Execute code with the nowrite flag set
    #                         # temporarily to _v_. Return to the
    #                         # original value when code is done.
    def nowrite(value=nil)
      oldvalue = FileUtilsExt.nowrite_flag
      FileUtilsExt.nowrite_flag = value unless value.nil?
      if block_given?
        begin
          yield
        ensure
          FileUtilsExt.nowrite_flag = oldvalue
        end
      end
      oldvalue
    end

    # Use this function to prevent potentially destructive ruby code
    # from running when the :nowrite flag is set.
    #
    # Example:
    #
    #   when_writing("Building Project") do
    #     project.build
    #   end
    #
    # The following code will build the project under normal
    # conditions. If the nowrite(true) flag is set, then the example
    # will print:
    #
    #      DRYRUN: Building Project
    #
    # instead of actually building the project.
    #
    def when_writing(msg=nil)
      if FileUtilsExt.nowrite_flag
        $stderr.puts "DRYRUN: #{msg}" if msg
      else
        yield
      end
    end

    # Merge the given options with the default values.
    def rake_merge_option(args, defaults)
      if Hash === args.last
        defaults.update(args.last)
        args.pop
      end
      args.push defaults
      args
    end

    # Send the message to the default rake output (which is $stderr).
    def rake_output_message(message)
      $stderr.puts(message)
    end

    # Check that the options do not contain options not listed in
    # +optdecl+.  An ArgumentError exception is thrown if non-declared
    # options are found.
    def rake_check_options(options, *optdecl)
      h = options.dup
      optdecl.each do |name|
        h.delete name
      end
      raise ArgumentError, "no such option: #{h.keys.join(' ')}" unless
        h.empty?
    end

    extend self
  end
end


text:
import pprint

from pysellus.interfaces import AbstractIntegration

class TerminalIntegration(AbstractIntegration):
    def on_next(self, message):
        print('Assert error: in {0} -> {1}'.format(
            message['test_name'],
            message['expect_function']
        ))
        print('Got:')
        pprint.pprint(message['element'])

    def on_error(self, error_message):
        print('Runtime Error: In {0} -> {1}'.format(
            error_message['test_name'],
            error_message['expect_function']
        ))
        print('Got:')
        pprint.pprint(error_message['error'])

    def on_completed(self):
        print("All tests done.")


text:
package memoryscraper

import (
	"context"
	"testing"

	"github.com/stretchr/testify/assert"
	"go.opentelemetry.io/collector/component/componenttest"
)

func TestCreateDefaultConfig(t *testing.T) {
	factory := &Factory{}
	cfg := factory.CreateDefaultConfig()
	assert.IsType(t, &Config{}, cfg)
}

func TestCreateMetricsScraper(t *testing.T) {
	factory := &Factory{}
	cfg := &Config{}

	scraper, err := factory.CreateMetricsScraper(context.Background(), componenttest.NewNopReceiverCreateSettings(), cfg)

	assert.NoError(t, err)
	assert.NotNil(t, scraper)
}


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

namespace ViewModels
{
    public class Page3ViewModel : BaseViewModel
    {
        public string Page3Text
        {
            get { return "Hello, world!\nSent from my iPage 3..."; }
        }
    }
}


text:
./vendor/easyengine/site-command/ci/add-test-certs.sh > /dev/null

for repo in "$(find vendor/easyengine -type d -name 'features')"; do
	rsync -a --delete $repo/ features > /dev/null
	echo "Running tests for $repo"
	sudo ./vendor/bin/behat
done


text:
<?php

namespace CM\Test\Url;

use CMTest_TH;
use CMTest_TestCase;
use CM\Url\BaseUrl;
use CM\Url\RouteUrl;

class RouteUrlTest extends CMTest_TestCase {

    public function tearDown() {
        CMTest_TH::clearEnv();
    }

    public function testCreate() {
        $url = RouteUrl::create('some-action');
        $this->assertSame('/some-action', (string) $url);

        $url = RouteUrl::create('some-action', ['foo' => 'bar']);
        $this->assertSame('/some-action?foo=bar', (string) $url);

        $environment = $this->createEnvironment();
        $url = RouteUrl::create('some-action', ['foo' => 'bar'], $environment);
        $this->assertSame('http://www.example.com/some-action?foo=bar', (string) $url);

        $environment = $this->createEnvironment(null, null, 'de');
        $url = RouteUrl::create('some-action', ['foo' => 'bar'], $environment);
        $this->assertSame('http://www.example.com/some-action/de?foo=bar', (string) $url);
    }
}


text:
package com.sparkling.test.euromoney.semantic.repo;

import java.util.List;

import com.sparkling.test.euromoney.semantic.exception.SparqlException;

public interface SparqlRepo {

	/**
	 * Queries a SPARQL endpoint for all range literal values, given a domain and a property label
	 * @param domain The label of the resource we are enquiring about
	 * @param predicate The label of the property of the resource we are enquiring about
	 * @param language The language of the domain and predicate name label
	 * @return A list of literal values of all values of the property of the resource
	 * we are enquiring about.
	 * @throws SparqlException
	 */
	public abstract List<String> findLiteralProperty(String domain,
			String predicate, String language) throws SparqlException;

}


text:
namespace aliyun {
struct RamGetPolicyVersionRequestType {
  std::string policy_type;
  std::string policy_name;
  std::string version_id;
};
struct RamGetPolicyVersionPolicyVersionType {
  std::string version_id;
  bool is_default_version;
  std::string policy_document;
  std::string create_date;
};
struct RamGetPolicyVersionResponseType {
  RamGetPolicyVersionPolicyVersionType policy_version;
};
} // end namespace
#endif


text:
package com.genymobile.pr;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * To work on unit tests, switch the Test Artifact in the Build Variants view.
 */
public class ExampleUnitTest {
    @Test
    public void addition_isCorrect() throws Exception {
        assertEquals(4, 2 + 2);
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="
		http://maven.apache.org/POM/4.0.0
		http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>be.fluid-it.mvn.cd.it</groupId>
    <artifactId>sample-service-parent</artifactId>
    <version>3.4-SNAPSHOT</version>
    <relativePath>../sample-service-parent/pom.xml</relativePath>
  </parent>

  <artifactId>sample-service-sample-module</artifactId>

  <dependencies>
    <dependency>
      <groupId>be.fluid-it.mvn.cd.it</groupId>
      <artifactId>sample-library</artifactId>
    </dependency>
  </dependencies>

</project>


text:
using System;
using System.Text;
using System.IO;

namespace GodLesZ.Library.Network.Packets {

	public class PacketReader : IDisposable {
		protected byte[] mData;
		protected int mSize;
		protected int mIndex;

		public byte[] Buf {
			get { return mData; }
		}

		public int Size {
			get { return mSize; }
		}

		public short PacketID {
			get;
			protected set;
		}

		public short PacketLength {
			get;
			protected set;
		}

		public int CurrentPosition {
			get { return mIndex; }
			protected set { mIndex = value; }
		}

        public PacketReader(byte[] data)
            : this(data, data.Length, 0, false, false) {
        }

        public PacketReader(byte[] data, int size, int startIndex)
            : this(data, size, startIndex, false, false) {
        }

		public PacketReader(byte[] data, int size, int startIndex, bool readPacketId)
			: this(data, size, startIndex, readPacketId, false) {
		}

		public PacketReader(byte[] data, int size, int startIndex, bool readPacketId, bool readPacketLength) {
			mData = data;
			mSize = size;
			mIndex = startIndex;

			if (readPacketId == true) {
				PacketID = ReadInt16();
			}
			if (readPacketLength == true) {
				PacketLength = ReadInt16();
			}
		}

		public int Seek(int offset, SeekOrigin origin) {
			switch (origin) {
				case SeekOrigin.Begin:
					mIndex = offset;
					break;
				case SeekOrigin.Current:
					mIndex += offset;
					break;
				case SeekOrigin.End:
					mIndex = mSize - offset;
					break;
			}

			return mIndex;
		}

		public bool IsSafeChar(int c) {
			// @TODO: rly need this range? [replace <int c> with <byte c> if not]
			return (c >= 32 && c < 65534);
		}

		public int ReadInt32() {
			if ((mIndex + 4) > mSize)
				return 0;

			int i = BitConverter.ToInt32(mData, mIndex);
			mIndex += 4;
			return i;
		}

		public short ReadInt16() {
			if ((mIndex + 2) > mSize)
				return 0;

			short i = BitConverter.ToInt16(mData, mIndex);
			mIndex += 2;
			return i;
		}

        public byte ReadByte() {
            if ((mIndex + 1) > mSize)
                return 0;

            byte b = mData[mIndex];
            mIndex++;
            return b;
        }

        public byte[] ReadBytes(int len) {
            if ((mIndex + len) > mSize)
                return new byte[]{};

            var buf = new Byte[len];
            Buffer.BlockCopy(mData, mIndex, buf, 0, buf.Length);
            mIndex += buf.Length;
            return buf;
        }

		public uint ReadUInt32() {
			if ((mIndex + 4) > mSize)
				return 0;

			uint i = BitConverter.ToUInt32(mData, mIndex);
			mIndex += 4;
			return i;
		}

		public ushort ReadUInt16() {
			if ((mIndex + 2) > mSize)
				return 0;

			ushort i = BitConverter.ToUInt16(mData, mIndex);
			mIndex += 2;
			return i;
		}

		public sbyte ReadSByte() {
			return (sbyte)ReadByte();
		}

		public bool ReadBoolean() {
			return (ReadByte() > 0);
		}

		public string ReadString() {
			// find leading \0 or end of stream
			int i = mIndex;
			while (i < mSize && mData[i++] > 0)
				;

			int stringLength = (i - mIndex);
			if (stringLength == 0) {
				return "";
			}
			string s = Encoding.Default.GetString(mData, mIndex, stringLength).TrimEnd('\0');
			mIndex += stringLength;
			return s;
		}

		public string ReadString(int fixedLength) {
			int stringLength = Math.Min(fixedLength, (mSize - mIndex));
			if (stringLength == 0) {
				return "";
			}

			string s = Encoding.Default.GetString(mData, mIndex, stringLength);
			int trailingZero = s.IndexOf('\0');
			if (trailingZero != -1) {
				if (trailingZero == 0) {
					return "";
				}
				s = s.Substring(0, trailingZero);
			}
			mIndex += stringLength;
			return s;
		}

		/// <summary>
		/// Führt anwendungsspezifische Aufgaben durch, die mit der Freigabe, der Zurückgabe oder dem Zurücksetzen von nicht verwalteten Ressourcen zusammenhängen.
		/// </summary>
		/// <filterpriority>2</filterpriority>
		public void Dispose() {
			mData = null;
		}

	}

}


text:
case platform
when 'fedora', 'redhat', 'centos' # :pragma-foodcritic: ~FC024 - won't fix this
  default['openstack']['db']['platform']['mysql_python_packages'] = ['MySQL-python']
  default['openstack']['db']['platform']['postgresql_python_packages'] = ['python-psycopg2']
when 'suse'
  default['openstack']['db']['platform']['mysql_python_packages'] = ['python-mysql']
  default['openstack']['db']['platform']['postgresql_python_packages'] = ['python-psycopg2']
when 'ubuntu'
  default['openstack']['db']['platform']['mysql_python_packages'] = ['python-mysqldb']
  default['openstack']['db']['platform']['postgresql_python_packages'] = ['python-psycopg2']
end


text:
<rss>
<channel>
    <title>Test title</title>
    <description>This is a feed description</description>
    <link>http://www.google.com</link>
    <item>
        <title>Item title</title>
        <description>This is an item description</description>
        <link>http://www.google.com</link>
        <pubDate>Fri, 01 Jan 2016 00:00:00 +0000</pubDate>
        <guid>test-id-1</guid>
    </item>
    <item>
        <title>Item title 2</title>
        <description>This is a second item description</description>
        <link>http://www.google.se</link>
        <pubDate>Sat, 02 Jan 2016 00:00:00 +0000</pubDate>
        <guid>test-id-2</guid>
    </item>
    <item>
        <title>Item title 3</title>
        <description>This is a third item description</description>
        <link>http://www.google.org</link>
        <pubDate>Sun, 03 Jan 2016 00:00:00 +0000</pubDate>
        <guid>test-id-3</guid>
    </item>
</channel>
</rss>


text:
/*
 * A factory that returns an object used in our form engine directive
 * that stores references to individual form field partials
 */

angular.module('myApp.services', []).factory('formInputLookup', [
  function () {
    'use strict';

    /* Store a reference to our input templates */
    var baseDirectivePath = '/js/directives/form-engine/templates';

    /* Return an object that holds a key to each form input that could make up a HTML form */
    return {
      "text" : baseDirectivePath + '/text-ptl.html',
      "select" : baseDirectivePath + '/select-ptl.html',
      "textarea" : baseDirectivePath + '/textarea-ptl.html'
    };

  }]);


text:
#ifndef _GAME_H
#define _GAME_H

#include <netinet/in.h>

#define SNAKE_NAME_LEN 16
#define MAX_PLAYERS 16
#define GAME_SPEED 200000

#define TOP 'T'
#define LEFT 'L'
#define DOWN 'D'
#define RIGHT 'R'
#define NONE 'N'

#define C_RED 50
#define C_GREEN 51
#define C_BLUE 52
#define C_BROWN 53
#define C_YELLOW 54
#define C_ORANGE 55
#define C_PURPLE 56
#define C_BLACK 57
#define C_GREY 58

/**
 * Stores one connection info when requesting new thread.
 */
struct con_info {
   int uid;        // user ID
   in_addr_t addr;
   in_port_t port;
};

extern in_port_t sport; /**< server port */
extern struct in_addr saddress;  /**< address in network byte order */
extern int server_sockfd;  /**< server socket */

void want_move(int id, int dir);
void want_new_player(char *name, int color, in_addr_t address, uint16_t port);
void want_rem_player(int id);
void want_start(int id);
void want_be_alive(int id);

#endif


text:
/*
https://sqlperformance.com/2019/10/t-sql-queries/overlooked-t-sql-gems
*/

SELECT string, leading_slash_count, trailing_slash_count,
    STUFF(STUFF(string, LEN(string) - trailing_slash_count + 1,
trailing_slash_count, ''), 1, leading_slash_count, '') AS new_string
FROM ( VALUES
        (CAST('//\\ remove leading and trailing backward (\) and forward (/) slashes \\//' AS varchar(200))),
        ('//\\**remove leading and trailing backward (\) and forward (/) slashes**\\//')
) AS test_data(string)
CROSS APPLY (
SELECT PATINDEX('%[^/\]%', string) - 1 AS leading_slash_count,
        PATINDEX('%[^/\]%', REVERSE(string)) - 1 AS trailing_slash_count
) AS ca1;


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>SuperLU: SRC/zlangs.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

SuperLU
    5.2.0

Main Page

Data Structures

Files

File List

Globals

SRC

Functions

zlangs.c File Reference

Returns the value of the one norm.
More...

#include <math.h>

#include "slu_zdefs.h"

Include dependency graph for zlangs.c:

<map name="SRC_2zlangs_8c" id="SRC_2zlangs_8c">
<area shape="rect" id="node3" href="slu__zdefs_8h.html" title="Header file for real operations. " alt="" coords="341,80,429,107"/><area shape="rect" id="node9" href="slu__Cnames_8h.html" title="Macros defining how C routines will be called. " alt="" coords="332,155,439,181"/><area shape="rect" id="node10" href="supermatrix_8h.html" title="Defines matrix types. " alt="" coords="463,155,564,181"/><area shape="rect" id="node11" href="slu__util_8h.html" title="Utility header file. " alt="" coords="143,155,216,181"/><area shape="rect" id="node14" href="slu__dcomplex_8h.html" title="Header file for complex operations. " alt="" coords="589,155,701,181"/><area shape="rect" id="node13" href="superlu__enum__consts_8h.html" title="enum constants header file " alt="" coords="131,229,289,256"/></map>

Functions

double 	zlangs (char *norm, SuperMatrix *A)

Detailed Description

Copyright (c) 2003, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from U.S. Dept. of Energy)

All rights reserved.

The source code is distributed under BSD license, see the file License.txt at the top-level directory.

– SuperLU routine (version 2.0) –
Univ. of California Berkeley, Xerox Palo Alto Research Center,
and Lawrence Berkeley National Lab.
November 15, 1997

Modified from lapack routine ZLANGE

Function Documentation

          double zlangs
          (
          char *
          norm,

          SuperMatrix *
          A

          )

Purpose

  ZLANGS returns the value of the one norm, or the Frobenius norm, or
  the infinity norm, or the element of largest absolute value of a
  real matrix A.

Description

  ZLANGE returns the value

     ZLANGE = ( max(abs(A(i,j))), NORM = 'M' or 'm'
              (
              ( norm1(A),         NORM = '1', 'O' or 'o'
              (
              ( normI(A),         NORM = 'I' or 'i'
              (
              ( normF(A),         NORM = 'F', 'f', 'E' or 'e'

  where  norm1  denotes the  one norm of a matrix (maximum column sum),
  normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
  normF  denotes the  Frobenius norm of a matrix (square root of sum of
  squares).  Note that  max(abs(A(i,j)))  is not a  matrix norm.

Arguments

  NORM    (input) CHARACTER*1
          Specifies the value to be returned in ZLANGE as described above.
  A       (input) SuperMatrix*
          The M by N sparse matrix A.

Here is the call graph for this function:

<map name="zlangs_8c_a37d1ec3ddab88e8c46872c5795ea5ada_cgraph" id="zlangs_8c_a37d1ec3ddab88e8c46872c5795ea5ada_cgraph">
<area shape="rect" id="node2" href="dcomplex_8c.html#af701b1c549ee8dcf6767742a91681b55" title="Returns sqrt(z.r^2 + z.i^2) " alt="" coords="115,5,173,32"/></map>

<address class="footer">
Generated on Fri Apr 8 2016 18:40:08 for SuperLU by

 1.8.6
</address>


text:
package org.apache.axis2.jaxws.context.sei;

import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Logger;

@WebServiceClient(name = "MessageContextService",
                  targetNamespace = "http://context.jaxws.axis2.apache.org/",
                  wsdlLocation = "MessageContext.wsdl")
public class MessageContextService
        extends Service {

    private final static URL MESSAGECONTEXTSERVICE_WSDL_LOCATION;
    private final static Logger logger = Logger.getLogger(org.apache.axis2.jaxws.context.sei.MessageContextService.class.getName());

    private static String wsdlLocation = "/src/test/java/org/apache/axis2/jaxws/context/META-INF/MessageContext.wsdl";

    static {
        URL url = null;
        try {
            try {
                String baseDir = new File(System.getProperty("basedir", ".")).getCanonicalPath();
                wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
            } catch (Exception e) {
                e.printStackTrace();
            }
            File file = new File(wsdlLocation);
            url = file.toURI().toURL();
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
        MESSAGECONTEXTSERVICE_WSDL_LOCATION = url;
    }

    public MessageContextService(URL wsdlLocation, QName serviceName) {
        super(wsdlLocation, serviceName);
    }

    public MessageContextService() {
        super(MESSAGECONTEXTSERVICE_WSDL_LOCATION, new QName("http://context.jaxws.axis2.apache.org/", "MessageContextService"));
    }

    /**
     * @return returns MessageContext
     */
    @WebEndpoint(name = "MessageContextPort")
    public MessageContext getMessageContextPort() {
        return super.getPort(new QName("http://context.jaxws.axis2.apache.org/", "MessageContextPort"), MessageContext.class);
    }

    /**
     * @param features A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.  Supported features not in the features parameter will have their default values.
     * @return returns MessageContext
     */
    @WebEndpoint(name = "MessageContextPort")
    public MessageContext getMessageContextPort(WebServiceFeature... features) {
        return super.getPort(new QName("http://context.jaxws.axis2.apache.org/", "MessageContextPort"), MessageContext.class, features);
    }

}


text:
namespace IPC {
namespace internal {

MachPortAttachmentMac::MachPortAttachmentMac(mach_port_t mach_port)
    : mach_port_(mach_port), owns_mach_port_(true) {
  if (mach_port != MACH_PORT_NULL) {
    kern_return_t kr = mach_port_mod_refs(mach_task_self(), mach_port,
                                          MACH_PORT_RIGHT_SEND, 1);
    MACH_LOG_IF(ERROR, kr != KERN_SUCCESS, kr)
        << "MachPortAttachmentMac mach_port_mod_refs";
  }
}
MachPortAttachmentMac::MachPortAttachmentMac(mach_port_t mach_port,
                                             FromWire from_wire)
    : mach_port_(mach_port), owns_mach_port_(true) {}

MachPortAttachmentMac::MachPortAttachmentMac(const WireFormat& wire_format)
    : BrokerableAttachment(wire_format.attachment_id),
      mach_port_(static_cast<mach_port_t>(wire_format.mach_port)),
      owns_mach_port_(true) {}

MachPortAttachmentMac::~MachPortAttachmentMac() {
  if (mach_port_ != MACH_PORT_NULL && owns_mach_port_) {
    kern_return_t kr = mach_port_mod_refs(mach_task_self(), mach_port_,
                                          MACH_PORT_RIGHT_SEND, -1);
    MACH_LOG_IF(ERROR, kr != KERN_SUCCESS, kr)
        << "~MachPortAttachmentMac mach_port_mod_refs";
  }
}

MachPortAttachmentMac::BrokerableType MachPortAttachmentMac::GetBrokerableType()
    const {
  return MACH_PORT;
}

MachPortAttachmentMac::WireFormat MachPortAttachmentMac::GetWireFormat(
    const base::ProcessId& destination) const {
  return WireFormat(static_cast<uint32_t>(mach_port_), destination,
                    GetIdentifier());
}

}  // namespace internal
}  // namespace IPC


text:
package org.jolokia.osgi.bundle;

import org.apache.felix.http.jetty.internal.JettyActivator;
import org.jolokia.osgi.JolokiaActivator;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

/**
 * Activator for activation the embedded jolokia agent as well
 * as the Aries JMX bundle. So it's an aggregat activator.
 *
 * It also registers an (arbitrary) MBeanServer if not already
 * an MBeanServer is registered. This service is required by Aries JMX.

 * @author roland
 * @since Jan 9, 2010
 */
public class Activator implements BundleActivator {

    // Jolokia Activator
    private JolokiaActivator jolokiaActivator;

    // Felix Jetty Activator
    private JettyActivator felixHttpWebActivator;

    /**
     * No-arg constructor
     */
    public Activator() {
        jolokiaActivator = new JolokiaActivator();
        felixHttpWebActivator = new JettyActivator();
    }

    /** {@inheritDoc} */
    @SuppressWarnings("PMD.SignatureDeclareThrowsException")
    public void start(BundleContext pContext) throws Exception {
        felixHttpWebActivator.start(pContext);
        jolokiaActivator.start(pContext);
    }

    /** {@inheritDoc} */
    @SuppressWarnings("PMD.SignatureDeclareThrowsException")
    public void stop(BundleContext pContext) throws Exception {
        jolokiaActivator.stop(pContext);
        felixHttpWebActivator.stop(pContext);
    }

}


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

namespace Simple.OData.Client.Extensions
{
    static class DictionaryExtensions
    {
        private static readonly Dictionary<Type, ConstructorInfo> _constructors = new Dictionary<Type, ConstructorInfo>();

        internal static Func<IDictionary<string, object>, ODataEntry> CreateDynamicODataEntry { get; set; }

        public static T ToObject<T>(this IDictionary<string, object> source,
            string dynamicPropertiesContainerName = null, bool dynamicObject = false)
            where T : class
        {
            if (source == null)
                return default(T);
            if (typeof(IDictionary<string, object>).IsTypeAssignableFrom(typeof(T)))
                return source as T;
            if (typeof(T) == typeof(ODataEntry))
                return CreateODataEntry(source, dynamicObject) as T;
            if (typeof(T) == typeof(string) || typeof(T).IsValue())
                throw new InvalidOperationException(
                    string.Format("Unable to convert structural data to {0}.", typeof(T).Name));

            return (T)ToObject(source, typeof(T), CreateInstance<T>, dynamicPropertiesContainerName, dynamicObject);
        }

        public static object ToObject(this IDictionary<string, object> source, Type type, string dynamicPropertiesContainerName = null)
        {
            var ctor = type.GetDefaultConstructor();
            if (ctor == null && !CustomConverters.HasConverter(type))
            {
                throw new InvalidOperationException(
                    string.Format("Unable to create an instance of type {0} that does not have a default constructor.", type.Name));
            }

            return ToObject(source, type, () => ctor.Invoke(new object[] { }), dynamicPropertiesContainerName, false);
        }

        private static object ToObject(this IDictionary<string, object> source, Type type, Func<object> instanceFactory,
            string dynamicPropertiesContainerName, bool dynamicObject)
        {
            if (source == null)
                return null;
            if (typeof(IDictionary<string, object>).IsTypeAssignableFrom(type))
                return source;
            if (type == typeof(ODataEntry))
                return CreateODataEntry(source, dynamicObject);

            if (CustomConverters.HasConverter(type))
            {
                return CustomConverters.Convert(source, type);
            }

            var instance = instanceFactory();

            IDictionary<string, object> dynamicProperties = null;
            if (!string.IsNullOrEmpty(dynamicPropertiesContainerName))
            {
                dynamicProperties = CreateDynamicPropertiesContainer(type, instance, dynamicPropertiesContainerName);
            }

            foreach (var item in source)
            {
                var property = FindMatchingProperty(type, item);

                if (property != null && property.CanWrite && !property.IsNotMapped())
                {
                    if (item.Value != null)
                        property.SetValue(instance, ConvertValue(property.PropertyType, item.Value), null);
                }
                else if (dynamicProperties != null)
                {
                    dynamicProperties.Add(item.Key, item.Value);
                }
            }

            return instance;
        }

        private static PropertyInfo FindMatchingProperty(Type type, KeyValuePair<string, object> item)
        {
            var property = type.GetAnyProperty(item.Key) ??
                type.GetAllProperties().FirstOrDefault(x => x.GetMappedName() == item.Key);

            if (property == null && item.Key == FluentCommand.AnnotationsLiteral)
            {
                property = type.GetAllProperties().FirstOrDefault(x => x.PropertyType == typeof(ODataEntryAnnotations));
            }

            return property;
        }

        private static object ConvertValue(Type type, object itemValue)
        {
            return IsCollectionType(type, itemValue)
                ? ConvertCollection(type, itemValue)
                : ConvertSingle(type, itemValue);
        }

        private static bool IsCollectionType(Type type, object itemValue)
        {
            return
                (type.IsArray || type.IsGeneric() &&
                typeof(System.Collections.IEnumerable).IsTypeAssignableFrom(type)) &&
                (itemValue as System.Collections.IEnumerable) != null;
        }

        private static bool IsCompoundType(Type type)
        {
            return !type.IsValue() && !type.IsArray && type != typeof(string);
        }

        private static object ConvertEnum(Type type, object itemValue)
        {
            if (itemValue == null)
                return null;

            var stringValue = itemValue.ToString();
            int intValue;
            if (int.TryParse(stringValue, out intValue))
            {
                object result;
                Utils.TryConvert(intValue, type, out result);
                return result;
            }
            else
            {
                return Enum.Parse(type, stringValue, false);
            }
        }

        private static object ConvertSingle(Type type, object itemValue)
        {
            return type == typeof(ODataEntryAnnotations)
                ? itemValue
                : IsCompoundType(type)
                    ? itemValue.ToDictionary().ToObject(type)
                    : type.IsEnumType()
                        ? ConvertEnum(type, itemValue)
                        : itemValue;
        }

        private static object ConvertCollection(Type type, object itemValue)
        {
            var elementType = type.IsArray
                ? type.GetElementType()
                : type.IsGeneric() && type.GetGenericTypeArguments().Length == 1
                    ? type.GetGenericTypeArguments()[0]
                    : null;

            if (elementType == null)
                return null;

            var count = (itemValue as System.Collections.IEnumerable).Cast<object>().Count();
            var arrayValue = Array.CreateInstance(elementType, count);

            count = 0;
            foreach (var item in (itemValue as System.Collections.IEnumerable))
            {
                (arrayValue as Array).SetValue(ConvertSingle(elementType, item), count++);
            }

            if (type.IsArray || type.IsTypeAssignableFrom(arrayValue.GetType()))
            {
                return arrayValue;
            }
            else
            {
                var typedef = typeof(IEnumerable<>);
                var enumerableType = typedef.MakeGenericType(elementType);
                var ctor = type.GetDeclaredConstructors().FirstOrDefault(
                    x => x.GetParameters().Length == 1 && x.GetParameters().First().ParameterType == enumerableType);
                return ctor != null
                    ? ctor.Invoke(new object[] { arrayValue })
                    : null;
            }
        }

        public static IDictionary<string, object> ToDictionary(this object source)
        {
            if (source == null)
                return new Dictionary<string, object>();
            if (source is IDictionary<string, object>)
                return source as IDictionary<string, object>;
            if (source is ODataEntry)
                return (Dictionary<string, object>)(source as ODataEntry);

            var properties = Utils.GetMappedProperties(source.GetType());
            return properties.ToDictionary
            (
                x => x.GetMappedName(),
                x => x.GetValue(source, null)
            );
        }

        private static T CreateInstance<T>()
            where T : class
        {
            ConstructorInfo ctor = null;

            if (!_constructors.TryGetValue(typeof(T), out ctor))
            {
                if (typeof(T) == typeof(IDictionary<string, object>))
                {
                    return new Dictionary<string, object>() as T;
                }
                else
                {
                    ctor = typeof(T).GetDefaultConstructor();
                    if (ctor != null)
                    {
                        lock (_constructors)
                        {
                            if (!_constructors.ContainsKey(typeof(T)))
                                _constructors.Add(typeof(T), ctor);
                        }
                    }
                }
            }

            if (ctor == null)
            {
                throw new InvalidOperationException(
                    string.Format("Unable to create an instance of type {0} that does not have a default constructor.", typeof(T).Name));
            }

            return ctor.Invoke(new object[] { }) as T;
        }

        private static ODataEntry CreateODataEntry(IDictionary<string, object> source, bool dynamicObject = false)
        {
            return dynamicObject && CreateDynamicODataEntry != null ?
                CreateDynamicODataEntry(source) :
                new ODataEntry(source);
        }

        private static IDictionary<string, object> CreateDynamicPropertiesContainer(
            Type type, object instance, string dynamicPropertiesContainerName)
        {
            var property = type.GetAnyProperty(dynamicPropertiesContainerName);

            if (property == null)
                throw new ArgumentException(string.Format("Type {0} does not have property {1} ",
                    type, dynamicPropertiesContainerName));

            if (!typeof(IDictionary<string, object>).IsTypeAssignableFrom(property.PropertyType))
                throw new InvalidOperationException(
                    string.Format("Property {0} must implement IDictionary<string,object> interface",
                    dynamicPropertiesContainerName));

            var dynamicProperties = new Dictionary<string, object>();
            property.SetValue(instance, dynamicProperties, null);
            return dynamicProperties;
        }
    }
}


text:
from django.test import TransactionTestCase

from poznaj.points.tests.factories import PointFactory
from poznaj.stories.tests.factories import StoryFactory

class TestStoryModelMethods(TransactionTestCase):

    def test_get_all_points(self):
        point = PointFactory()
        story = StoryFactory.create()
        story.points = (point,)
        story.save()
        with self.assertNumQueries(1):
            self.assertQuerysetEqual(story.get_all_points(), ['<Point: {}>'.format(str(point))])


text:
/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */
#pragma once
#include <vector>
#include <map>
#include <sstream>
#include <string>
#include "ifcpp/model/GlobalDefines.h"
#include "ifcpp/model/BasicTypes.h"
#include "ifcpp/model/BuildingObject.h"
#include "IfcRepresentation.h"
namespace IFC4X3
{
	class IFCQUERY_EXPORT IfcShapeAspect;
	//ENTITY
	class IFCQUERY_EXPORT IfcShapeModel : public IfcRepresentation
	{
	public:
		IfcShapeModel() = default;
		IfcShapeModel( int id );
		virtual shared_ptr<BuildingObject> getDeepCopy( BuildingCopyOptions& options );
		virtual void getStepLine( std::stringstream& stream ) const;
		virtual void getStepParameter( std::stringstream& stream, bool is_select_type = false ) const;
		virtual void readStepArguments( const std::vector<std::string>& args, const std::map<int,shared_ptr<BuildingEntity> >& map, std::stringstream& errorStream );
		virtual void setInverseCounterparts( shared_ptr<BuildingEntity> ptr_self );
		virtual uint8_t getNumAttributes() const { return 4; }
		virtual void getAttributes( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const;
		virtual void getAttributesInverse( std::vector<std::pair<std::string, shared_ptr<BuildingObject> > >& vec_attributes ) const;
		virtual void unlinkFromInverseCounterparts();
		virtual uint32_t classID() const { return 3982875396; }

		// IfcRepresentation -----------------------------------------------------------
		// attributes:
		//  shared_ptr<IfcRepresentationContext>					m_ContextOfItems;
		//  shared_ptr<IfcLabel>									m_RepresentationIdentifier;	//optional
		//  shared_ptr<IfcLabel>									m_RepresentationType;		//optional
		//  std::vector<shared_ptr<IfcRepresentationItem> >			m_Items;
		// inverse attributes:
		//  std::vector<weak_ptr<IfcRepresentationMap> >			m_RepresentationMap_inverse;
		//  std::vector<weak_ptr<IfcPresentationLayerAssignment> >	m_LayerAssignments_inverse;
		//  std::vector<weak_ptr<IfcProductRepresentation> >		m_OfProductRepresentation_inverse;

		// IfcShapeModel -----------------------------------------------------------
		// inverse attributes:
		std::vector<weak_ptr<IfcShapeAspect> >					m_OfShapeAspect_inverse;
	};
}


text:
package storage

import (
	"errors"
	"fmt"
	"sort"

	"github.com/docker/distribution/context"
	storageDriver "github.com/docker/distribution/registry/storage/driver"
)

// ErrSkipDir is used as a return value from onFileFunc to indicate that
// the directory named in the call is to be skipped. It is not returned
// as an error by any function.
var ErrSkipDir = errors.New("skip this directory")

// WalkFn is called once per file by Walk
// If the returned error is ErrSkipDir and fileInfo refers
// to a directory, the directory will not be entered and Walk
// will continue the traversal.  Otherwise Walk will return
type WalkFn func(fileInfo storageDriver.FileInfo) error

// Walk traverses a filesystem defined within driver, starting
// from the given path, calling f on each file
func Walk(ctx context.Context, driver storageDriver.StorageDriver, from string, f WalkFn) error {
	children, err := driver.List(ctx, from)
	if err != nil {
		return err
	}
	sort.Stable(sort.StringSlice(children))
	for _, child := range children {
		// TODO(stevvooe): Calling driver.Stat for every entry is quite
		// expensive when running against backends with a slow Stat
		// implementation, such as s3. This is very likely a serious
		// performance bottleneck.
		fileInfo, err := driver.Stat(ctx, child)
		if err != nil {
			return err
		}
		err = f(fileInfo)
		skipDir := (err == ErrSkipDir)
		if err != nil && !skipDir {
			return err
		}

		if fileInfo.IsDir() && !skipDir {
			if err := Walk(ctx, driver, child, f); err != nil {
				return err
			}
		}
	}
	return nil
}

// pushError formats an error type given a path and an error
// and pushes it to a slice of errors
func pushError(errors []error, path string, err error) []error {
	return append(errors, fmt.Errorf("%s: %s", path, err))
}


text:
<!DOCTYPE HTML>

    <meta charset='utf-8'>
    <title>Demo for ok-phone.js</title>

    <link rel="stylesheet" type="text/css" href="../min.css/ok-phone.min.css">

Demo for ok-phone.js

ok-phone

A pure JavaScript (no dependencies) solution to make HTML phone inputs self-validating

Usage

Include ok-phone.js anywhere in your page, it runs on load.

Add CSS class 'js-ok-phone' to all phone inputs you want validated.

Optionally include ok-phone.css (or its contents) in your styles.

Support

Tested successfully in FireFox Win/Mac.

Tested successfully in Chrome Win/Mac.

Tested successfully in Safari Win/Mac.

Tested successfully in Internet Explorer 8.

License

Released under MIT license, see included file LICENSE
        or http://opensource.org/licenses/MIT

    <form action="#">

Basic Usage

The basic phone validation functionality can be added simply by
            including ok-phone.js anywhere in your document and
            adding CSS class 'js-ok-phone' or type 'phone' to all inputs
            you want validating. It works like this:

            <input type="text" class="js-ok-phone"
                          value="201.555.1212">
                class="js-ok-phone"

            <input type="tel"
                          value="(201)555-1212">
                type="tel"

Stricter / Looser Usage

By default, phone numbers are validated in a loose NANPA
            format. A short list of rules is checked. Phones can be
            validated against a looser or stricter format. To accept letters
            for phonewords, add CSS class 'js-ok-phone-wordy' to the
            input. Likewise, to enforce known area codes, apply css class
            'js-ok-phone-strict' to the input. When using strict
            testing, it is important to frequently update the list of area
            codes.

            <input type="text" class="js-ok-phone-strict"
                          value="2234567890">
                class="js-ok-phone-strict"

            <input type="text" class="js-ok-phone-wordy"
                          value="1-800-generic">
                class="js-ok-phone-wordy"

Styling Errors

Inputs with invalid phones can be styled by applying styles to the
            error class. By default this class is 'js-ok-phone-error'.

            <input type="text" value="123456"
                          class="js-ok-phone js-ok-phone-error bold">
                .js-ok-phone-error {
                font-weight: bold; border: 2px dashed red;
                }

            <input type="text" value="9110123456"
                          class="js-ok-phone js-ok-phone-error italic">
                .js-ok-phone-error {
                font-style: italic; border: 2px dotted darkred;
                }

    </form>


text:
package nom.bdezonia.zorbage.algebra;

/**
 *
 * @author Barry DeZonia
 *
 */
public interface Constructible1dDouble<U>
{
	U construct(double d1);
}


text:
extern "C" {
#endif

//  @generated
// --------------------------------------------------------------------------
// clang-format off
//  Generated section start.
// --------------------------------------------------------------------------

//
//  Handle 'buffer' context.
//
typedef struct vsc_buffer_t vsc_buffer_t;

//
//  Return size of 'vsc_buffer_t'.
//
VSC_PUBLIC size_t
vsc_buffer_ctx_size(void);

//
//  Perform initialization of pre-allocated context.
//
VSC_PUBLIC void
vsc_buffer_init(vsc_buffer_t *self);

//
//  Release all inner resources including class dependencies.
//
VSC_PUBLIC void
vsc_buffer_cleanup(vsc_buffer_t *self);

//
//  Allocate context and perform it's initialization.
//
VSC_PUBLIC vsc_buffer_t *
vsc_buffer_new(void);

//
//  Perform initialization of pre-allocated context.
//  Allocate inner buffer of given capacity.
//
VSC_PUBLIC void
vsc_buffer_init_with_capacity(vsc_buffer_t *self, size_t capacity);

//
//  Allocate class context and perform it's initialization.
//  Allocate inner buffer of given capacity.
//
VSC_PUBLIC vsc_buffer_t *
vsc_buffer_new_with_capacity(size_t capacity);

//
//  Perform initialization of pre-allocated context.
//  Allocate inner buffer buffer as copy of given data.
//
VSC_PUBLIC void
vsc_buffer_init_with_data(vsc_buffer_t *self, vsc_data_t data);

//
//  Allocate class context and perform it's initialization.
//  Allocate inner buffer buffer as copy of given data.
//
VSC_PUBLIC vsc_buffer_t *
vsc_buffer_new_with_data(vsc_data_t data);

//
//  Release all inner resources and deallocate context if needed.
//  It is safe to call this method even if the context was statically allocated.
//
VSC_PUBLIC void
vsc_buffer_delete(vsc_buffer_t *self);

//
//  Delete given context and nullifies reference.
//  This is a reverse action of the function 'vsc_buffer_new ()'.
//
VSC_PUBLIC void
vsc_buffer_destroy(vsc_buffer_t **self_ref);

//
//  Copy given class context by increasing reference counter.
//
VSC_PUBLIC vsc_buffer_t *
vsc_buffer_shallow_copy(vsc_buffer_t *self);

//
//  Returns true if buffer has no data written.
//
VSC_PUBLIC bool
vsc_buffer_is_empty(const vsc_buffer_t *self);

//
//  Returns true if buffer written data is located at the buffer ending.
//
VSC_PUBLIC bool
vsc_buffer_is_reverse(const vsc_buffer_t *self);

//
//  Return true if buffers are equal.
//
VSC_PUBLIC bool
vsc_buffer_equal(const vsc_buffer_t *self, const vsc_buffer_t *rhs);

//
//  Perform constant-time buffers comparison.
//  The time depends on the given length but not on the buffer data.
//  Return true if given buffers are equal.
//
VSC_PUBLIC bool
vsc_buffer_secure_equal(const vsc_buffer_t *self, const vsc_buffer_t *rhs);

//
//  Allocates inner buffer with a given capacity.
//  Precondition: buffer is initialized.
//  Precondition: buffer does not hold any bytes.
//  Postcondition: inner buffer is allocated.
//
VSC_PUBLIC void
vsc_buffer_alloc(vsc_buffer_t *self, size_t capacity);

//
//  Release inner buffer.
//
VSC_PUBLIC void
vsc_buffer_release(vsc_buffer_t *self);

//
//  Use given data as output buffer.
//  Client side is responsible for data deallocation.
//  Precondition: buffer is initialized.
//  Precondition: buffer does not hold any bytes.
//
VSC_PUBLIC void
vsc_buffer_use(vsc_buffer_t *self, byte *bytes, size_t bytes_len);

//
//  Use given data as output buffer.
//  Buffer is responsible for data deallocation.
//  Precondition: buffer is initialized.
//  Precondition: buffer does not hold any bytes.
//
VSC_PUBLIC void
vsc_buffer_take(vsc_buffer_t *self, byte *bytes, size_t bytes_len, vsc_dealloc_fn dealloc_cb);

//
//  Tell buffer that it holds sensitive that must be erased
//  in a secure manner during destruction.
//
VSC_PUBLIC void
vsc_buffer_make_secure(vsc_buffer_t *self);

//
//  Change the way buffer content is interpreted.
//
//  If true - assume that written data is located at the buffer ending.
//  If false - assume that written data is located at the buffer beginning.
//
//  Note, that buffer is not empty and if new mode differs then data
//  will be moved to the appropriate place.
//
VSC_PUBLIC void
vsc_buffer_switch_reverse_mode(vsc_buffer_t *self, bool is_reverse);

//
//  Returns true if buffer full.
//
VSC_PUBLIC bool
vsc_buffer_is_full(const vsc_buffer_t *self);

//
//  Returns true if buffer is configured and has valid internal states.
//
VSC_PUBLIC bool
vsc_buffer_is_valid(const vsc_buffer_t *self);

//
//  Returns underlying buffer bytes.
//
VSC_PUBLIC const byte *
vsc_buffer_bytes(const vsc_buffer_t *self);

//
//  Returns underlying buffer bytes as object.
//
VSC_PUBLIC vsc_data_t
vsc_buffer_data(const vsc_buffer_t *self);

//
//  Returns buffer capacity.
//
VSC_PUBLIC size_t
vsc_buffer_capacity(const vsc_buffer_t *self);

//
//  Returns buffer length - length of bytes actually used.
//
VSC_PUBLIC size_t
vsc_buffer_len(const vsc_buffer_t *self);

//
//  Returns length of the bytes that are not in use yet.
//
VSC_PUBLIC size_t
vsc_buffer_unused_len(const vsc_buffer_t *self);

//
//  Returns writable pointer to the buffer first element.
//
VSC_PUBLIC byte *
vsc_buffer_begin(vsc_buffer_t *self);

//
//  Returns pointer to the first unused byte in the buffer.
//
VSC_PUBLIC byte *
vsc_buffer_unused_bytes(vsc_buffer_t *self);

//
//  Increase used bytes by given length.
//
VSC_PUBLIC void
vsc_buffer_inc_used(vsc_buffer_t *self, size_t len);

//
//  Decrease used bytes by given length.
//
VSC_PUBLIC void
vsc_buffer_dec_used(vsc_buffer_t *self, size_t len);

//
//  Copy data to the buffer.
//
VSC_PUBLIC void
vsc_buffer_write_data(vsc_buffer_t *self, vsc_data_t data);

//
//  Copy data to the buffer and reallocate if needed by coping.
//
//  Precondition: buffer should be an owner of the bytes.
//
//  Note, this operation can be slow if copy operation occurred.
//  Note, buffer capacity is doubled.
//
VSC_PUBLIC void
vsc_buffer_append_data(vsc_buffer_t *self, vsc_data_t data);

//
//  Reset to the initial state.
//  After reset inner buffer can be re-used.
//
VSC_PUBLIC void
vsc_buffer_reset(vsc_buffer_t *self);

//
//  Zeroing buffer in secure manner.
//  And reset it to the initial state.
//
VSC_PUBLIC void
vsc_buffer_erase(vsc_buffer_t *self);

// --------------------------------------------------------------------------
//  Generated section end.
// clang-format on
// --------------------------------------------------------------------------
//  @end

#ifdef __cplusplus
}
#endif

//  @footer
#endif // VSC_BUFFER_H_INCLUDED
//  @end


text:
/** @file
    @brief Test Implementation

    @date 2015

    @author
    Sensics, Inc.
    <http://sensics.com/osvr>

*/

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

// Internal Includes
#include <osvr/ClientKit/Context.h>

// Library/third-party includes
// - none

// Standard includes
#include "gtest/gtest.h"

TEST(SequentialClient, TwoContexts) {
    {
        osvr::clientkit::ClientContext firstContext(
            "com.osvr.test.firstContext");
    }
    {
        osvr::clientkit::ClientContext secondContext(
            "com.osvr.test.secondContext");
    }
}


text:
require 'eb_ruby_client/support/resource'

module EbRubyClient
  module Resource
    class Address
      include EbRubyClient::Support::Resource

      attr_accessor :address_1, :address_2, :city,
        :region, :postal_code, :country, :country_name,
        :latitude, :longitude

      def initialize(data)
        set_attributes(data)
      end

      def to_data
        data = {
          "address_1" => address_1,
          "country" => country,
        }

        data["address_2"] = address_2 if address_2
        data["city"] = city if city
        data["region"] = region if region
        data["postal_code"] = postal_code if postal_code

        data
      end
    end
  end
end


text:
#pragma once

#include <random>

#include <sched.h>
#include "../src/common.h"
#include <map>
#include <cmath>
#include <cstring>
#include <string>

void PrintTestName(const char *name);
void SleepFor(uint64_t sleep_ms);
int GetThreadAffinity();
void PinToCore(size_t core_id);
uint64_t GetCoreNum();

// Template function to launch threads
// This does not define anything but to specify a template so it is
// OK to put it here
template <typename Fn, typename... Args>
void StartThreads(uint64_t num_threads, Fn &&fn, Args &&... args) {
  std::vector<std::thread> thread_list;

  // Launch a group of threads
  for(uint64_t thread_id = 0;thread_id < num_threads;thread_id++) {
    thread_list.push_back(std::thread(fn, thread_id, args...));
  }

  // Join the threads with the main thread
  for(uint64_t thread_id = 0;thread_id < num_threads;thread_id++) {
    thread_list[thread_id].join();
  }

  return;
}

/*
 * class Random - A random number generator
 *
 * This generator is a template class letting users to choose the number
 *
 * Note that this object uses C++11 library generator which is slow, and super
 * non-scalable. For
 */
template <typename IntType,
          IntType lower,
          IntType upper>
class Random {
 private:
  std::random_device device;
  std::default_random_engine engine;
  std::uniform_int_distribution<IntType> dist;

 public:

  /*
   * Constructor - Initialize random seed and distribution object
   */
  Random() :
    device{},
    engine{device()},
    dist{lower, upper}
  {}

  /*
   * Get() - Get a random number of specified type
   */
  inline IntType Get() {
    return dist(engine);
  }

  /*
   * operator() - Grammar sugar
   */
  inline IntType operator()() {
    return Get();
  }
};

/*
 * class Timer - Measures time usage for testing purpose
 */
class Timer {
 private:
  std::chrono::time_point<std::chrono::system_clock> start;
  std::chrono::time_point<std::chrono::system_clock> end;

 public:

  /*
   * Constructor
   *
   * It takes an argument, which denotes whether the timer should start
   * immediately. By default it is true
   */
  Timer(bool start = true) :
    start{},
    end{} {
    if(start == true) {
      Start();
    }

    return;
  }

  /*
   * Start() - Starts timer until Stop() is called
   *
   * Calling this multiple times without stopping it first will reset and
   * restart
   */
  inline void Start() {
    start = std::chrono::system_clock::now();

    return;
  }

  /*
   * Stop() - Stops timer and returns the duration between the previous Start()
   *          and the current Stop()
   *
   * Return value is represented in double, and is seconds elapsed between
   * the last Start() and this Stop()
   */
  inline double Stop() {
    end = std::chrono::system_clock::now();

    return GetInterval();
  }

  /*
   * GetInterval() - Returns the length of the time interval between the latest
   *                 Start() and Stop()
   */
  inline double GetInterval() const {
    std::chrono::duration<double> elapsed_seconds = end - start;
    return elapsed_seconds.count();
  }
};

/*
 * class SimpleInt64Random - Simple paeudo-random number generator
 *
 * This generator does not have any performance bottlenect even under
 * multithreaded environment, since it only uses local states. It hashes
 * a given integer into a value between 0 - UINT64T_MAX, and in order to derive
 * a number inside range [lower bound, upper bound) we should do a mod and
 * addition
 *
 * This function's hash method takes a seed for generating a hashing value,
 * together with a salt which is used to distinguish different callers
 * (e.g. threads). Each thread has a thread ID passed in the inlined hash
 * method (so it does not pose any overhead since it is very likely to be
 * optimized as a register resident variable). After hashing finishes we just
 * normalize the result which is evenly distributed between 0 and UINT64_T MAX
 * to make it inside the actual range inside template argument (since the range
 * is specified as template arguments, they could be unfold as constants during
 * compilation)
 *
 * Please note that here upper is not inclusive (i.e. it will not appear as the
 * random number)
 */
template <uint64_t lower = 0UL, uint64_t upper = UINT64_MAX>
class SimpleInt64Random {
 public:

  /*
   * operator()() - Mimics function call
   *
   * Note that this function must be denoted as const since in STL all
   * hashers are stored as a constant object
   */
  inline uint64_t operator()(uint64_t value, uint64_t salt) const {
    //
    // The following code segment is copied from MurmurHash3, and is used
    // as an answer on the Internet:
    // http://stackoverflow.com/questions/5085915/what-is-the-best-hash-
    //   function-for-uint64-t-keys-ranging-from-0-to-its-max-value
    //
    // For small values this does not actually have any effect
    // since after ">> 33" all its bits are zeros
    //value ^= value >> 33;
    value += salt;
    value *= 0xff51afd7ed558ccd;
    value ^= value >> 33;
    value += salt;
    value *= 0xc4ceb9fe1a85ec53;
    value ^= value >> 33;

    return lower + value % (upper - lower);
  }
};

/*
 * class Argv - Process argument vector of a C program
 *
 * Three classes of options:
 *   1. Short option, i.e. begins with '-' followed by a single character
 *      optionally with '=' followed by a string
 *   2. Long option, i.e. begins with "--" followed by a string
 *      optionally with '=' followed by a string
 *
 * Both 1 and 2 will be stored in a std::map for key and value retrival
 * and option key is string, option value is empty string if does not exist,
 * or the string value if there is a value
 *
 *   3. Argument, i.e. without "--" and "-".
 *
 * The last type of argument will be stored in std::vector in the order
 * they appear in the argument list
 */
class Argv {
 private:
  // This is the map for string key and value
  std::map<std::string, std::string> kv_map;

  // This is the array for string values
  std::vector<std::string> arg_list;

 private:

  /*
   * AnalyzeArguments() - Analyze arguments in argv and dispatch them into
   *                      either key-value pairs or argument values
   *
   * The return value is a pair indicating whether the construction has
   * succeeded or not. The second argument is a string telling the reason
   * for a failed construction
   */
  std::pair<bool, const char *> AnalyzeArguments(int argc, char **argv) {
    for(int i = 0;i < argc;i++) {
      char *s = argv[i];
      int len = strlen(s);
      assert(len >= 1);

      // -- without anything means all following are argument values
      if((len == 2) && (s[0] == '-') && s[1] == '-') {
        for(int j = i + 1;j < argc;j++) {
          // Construct string object in place
          arg_list.emplace_back(argv[j]);
        }

        break;
      }

      if(s[0] == '-') {
        char *key, *value;

        if(len == 1) {
          return std::make_pair(false, "Unknown switch: -");
        } else if(s[1] == '-') {
          // We have processed '--' and '-' case
          // Now we know this is a string with prefix '--' and there is at
          // least one char after '--'
          key = s + 2;
          assert(*key != '\0');

          // Advance value until we see nil or '='
          // This makes --= a valid switch (empty string key and empty value)
          value = s + 2;
        } else {
          key = s + 1;
          value = s + 1;
        }

        while((*value != '=') && (*value != '\0')) {
          value++;
        }

        // If there is a value then cut the value;
        // otehrwise use empty as value
        if(*value == '=') {
          // This delimits key and value
          *value = '\0';
          value++;
        }

        // 1. If "key=" then key is key and value is empty string
        // 2. If "key" then key is key and value is empty string
        // 3. If "key=value" then key is key and value is value
        kv_map[std::string{key}] = std::string{value};
      } else {
        arg_list.emplace_back(s);
      } // s[0] == '-'
    } // loop through all arguments

    return std::make_pair(true, "");
  }

 public:
  Argv(int argc, char **argv) {
    assert(argc > 0);
    assert(argv != nullptr);

    // Always ignore the first argument
    auto ret = AnalyzeArguments(argc - 1, argv + 1);
    if(ret.first == false) {
      throw ret.second;
    }

    return;
  }

  /*
   * Exists() - Whetehr a key exists
   *
   * This could either be used for switches, i.e. --key or -key
   * or with key-value pairs, i.e. --key=value or -key=value which just
   * ignores the value
   */
  bool Exists(const std::string &key) {
    return GetValue(key) != nullptr;
  }

  /*
   * GetValue() - Returns the value of the key
   *
   * If key does not exist return nullptr
   * If there is no value then there the returned string is empty string
   * pointer
   */
  std::string *GetValue(const std::string &key) {
    auto it = kv_map.find(key);

    if(it == kv_map.end()) {
      return nullptr;
    } else {
      return &it->second;
    }
  }

  /*
   * GetValueAsUL() - This function returns value as a unsigned long integer
   *                  the length of which is platform dependent
   *
   * Whether the value is correctly parsed or not depends on the input. This
   * function checks correctness by:
   *   1. Call std::atoul() to convert the number in a local buffer
   *   2. Call std::to_string() to cast it back to string and check against
   *      the stored string object. If they are not equivalent then we
   *      know the digits are not parsed correctly
   *
   * This function takes a pointer argument pointing to the value that
   * will be modified if the argument value is found and is legal.
   * The return value is true if either the argument value is not found
   * or it is found and legal. If the value is found but illegal then
   * return value is false
   *
   * This function is not thread-safe since it uses global variable
   */
  bool GetValueAsUL(const std::string &key,
                    unsigned long *result_p) {
    const std::string *value = GetValue(key);

    // Not found: not modified, return true
    if(value == nullptr) {
      return true;
    }

    unsigned long result;

    // Convert string to number; cathing std::invalid_argumrnt to deal with
    // invalid format
    try {
      result = std::stoul(*value);
    } catch(...) {
      return false;
    }

    *result_p = result;

    // Found: Modified, return true
    return true;
  }

  /*
   * GetKVMap() - Returns the key value map
   */
  const std::map<std::string, std::string> &GetKVMap() const {
    return kv_map;
  }

  /*
   * GetArgList() - Returns the argument list
   */
  const std::vector<std::string> &GetArgList() const {
    return arg_list;
  }
 };


text:
require 'spec_helper'

describe EventImage do
  pending "add some examples to (or delete) #{__FILE__}"
end


text:
local Action = require(script.Parent.Parent.Action)

return Action("ServerScriptsUpdateSearchFilter", function(searchTerm, filterTypes)
	return {
		searchTerm = searchTerm,
		filterTypes = filterTypes
	}
end)


text:
package com.fasterxml.jackson.databind.ser.impl;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.ser.BeanPropertyFilter;
import com.fasterxml.jackson.databind.ser.BeanPropertyWriter;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public abstract class SimpleBeanPropertyFilter
  implements BeanPropertyFilter
{
  public static SimpleBeanPropertyFilter filterOutAllExcept(Set<String> paramSet)
  {
    return new FilterExceptFilter(paramSet);
  }

  public static SimpleBeanPropertyFilter filterOutAllExcept(String[] paramArrayOfString)
  {
    HashSet localHashSet = new HashSet(paramArrayOfString.length);
    Collections.addAll(localHashSet, paramArrayOfString);
    return new FilterExceptFilter(localHashSet);
  }

  public static SimpleBeanPropertyFilter serializeAllExcept(Set<String> paramSet)
  {
    return new SerializeExceptFilter(paramSet);
  }

  public static SimpleBeanPropertyFilter serializeAllExcept(String[] paramArrayOfString)
  {
    HashSet localHashSet = new HashSet(paramArrayOfString.length);
    Collections.addAll(localHashSet, paramArrayOfString);
    return new SerializeExceptFilter(localHashSet);
  }

  public void depositSchemaProperty(BeanPropertyWriter paramBeanPropertyWriter, JsonObjectFormatVisitor paramJsonObjectFormatVisitor, SerializerProvider paramSerializerProvider)
  {
    if (include(paramBeanPropertyWriter))
      paramBeanPropertyWriter.depositSchemaProperty(paramJsonObjectFormatVisitor);
  }

  public void depositSchemaProperty(BeanPropertyWriter paramBeanPropertyWriter, ObjectNode paramObjectNode, SerializerProvider paramSerializerProvider)
  {
    if (include(paramBeanPropertyWriter))
      paramBeanPropertyWriter.depositSchemaProperty(paramObjectNode, paramSerializerProvider);
  }

  protected abstract boolean include(BeanPropertyWriter paramBeanPropertyWriter);

  public void serializeAsField(Object paramObject, JsonGenerator paramJsonGenerator, SerializerProvider paramSerializerProvider, BeanPropertyWriter paramBeanPropertyWriter)
  {
    if (include(paramBeanPropertyWriter))
      paramBeanPropertyWriter.serializeAsField(paramObject, paramJsonGenerator, paramSerializerProvider);
  }

  public static class FilterExceptFilter extends SimpleBeanPropertyFilter
    implements Serializable
  {
    private static final long serialVersionUID = 1L;
    protected final Set<String> _propertiesToInclude;

    public FilterExceptFilter(Set<String> paramSet)
    {
      this._propertiesToInclude = paramSet;
    }

    protected boolean include(BeanPropertyWriter paramBeanPropertyWriter)
    {
      return this._propertiesToInclude.contains(paramBeanPropertyWriter.getName());
    }
  }

  public static class SerializeExceptFilter extends SimpleBeanPropertyFilter
  {
    protected final Set<String> _propertiesToExclude;

    public SerializeExceptFilter(Set<String> paramSet)
    {
      this._propertiesToExclude = paramSet;
    }

    protected boolean include(BeanPropertyWriter paramBeanPropertyWriter)
    {
      return !this._propertiesToExclude.contains(paramBeanPropertyWriter.getName());
    }
  }
}

/* Location:           /Users/vikas/Documents/Mhacks_Real_app/classes-dex2jar.jar
 * Qualified Name:     com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter
 * JD-Core Version:    0.6.2
 */


text:
helpers do

  def current_user
    if session[:username]
      @current_user ||= User.find_by_username(session[:username])
    end
  end

  def auth(user)
    params[:password] == user.password if user
  end

  def logged_in?
    !current_user.nil?
  end
end


text:
(function($){
  $.fn.auto_assemble = function(listing, error_list, permalink) {
    var assembler = new Assembler();

    var change_handler = function() {
      var errors = assembler.assemble($(this).val());

      if (errors) {
        $(error_list).empty();
        for (var i = 0; i < errors.length; ++i) {
          $(error_list).append('<li>' + errors[i] + '</li>');
        }
      }

      if (listing) {
        $(listing).set_listing(assembler.get_listing());
      }

      if (permalink) {
        var code = encodeURIComponent($(this).val());
        $(permalink).attr('href', '?code=' + code);
      }
    };
    $(this).change(change_handler);

    var timer = null;
    $(this).keyup(function() {
        var me = this;
        var args = arguments;

        if (timer) {
          clearTimeout(timer);
        }

        timer = setTimeout(function() {
            change_handler.apply(me, args);
            timer = null;
          }, 500);
      });
  };
})(jQuery);


text:
<?php

class SpiderableBehavior extends Behavior
{
    // default parameters value
    protected $parameters = array(
        'parent'    => null,
        'bookstore_type_column' => 'bookstore_type',
        'spidered_column' => 'spidered_at',
        'shallow_spidered_column' => 'shallow_spidered_at',
        'touched_column'  => 'touched',
        'id_column'       => 'b_id',
        'id_size'         => 255
    );

    /**
     * Add the create_column and update_columns to the current table
     */
    public function modifyTable()
    {
        $this->getTable()->setBaseClass('Spiderable');

        if ($this->getParameter('parent') !== null) {
            $parent = $this->getParameter('parent');
            $this->getTable()->addColumn(array(
                'name' => "{$parent}_id",
                'required' => true,
                'type' => 'INTEGER',
            ));

            $fk = new ForeignKey();
            $fk->setForeignTableCommonName($parent);
            $fk->setOnDelete('CASCADE');
            $fk->setOnUpdate(null);
            $fk->addReference(array(
                'local' => "{$parent}_id",
                'foreign' => 'id'
            ));
            $this->getTable()->addForeignKey($fk);
        }

        if (!$this->getTable()->containsColumn($this->getParameter('spidered_column'))) {
            $this->getTable()->addColumn(array(
                'name' => $this->getParameter('spidered_column'),
                'type' => 'TIMESTAMP',
            ));
        }

        if (!$this->getTable()->containsColumn($this->getParameter('shallow_spidered_column'))) {
            $this->getTable()->addColumn(array(
                'name' => $this->getParameter('shallow_spidered_column'),
                'type' => 'TIMESTAMP'
            ));
        }

        if (!$this->getTable()->containsColumn($this->getParameter('touched_column'))) {
            $this->getTable()->addColumn(array(
                'name' => $this->getParameter('touched_column'),
                'type' => 'BOOLEAN',
            ));
        }

        if (!$this->getTable()->containsColumn($this->getParameter('id_column'))) {
            $this->getTable()->addColumn(array(
                'name' => $this->getParameter('id_column'),
                'type' => 'VARCHAR',
                'size' => $this->getParameter('id_size')
            ));
        }

        if (!$this->getTable()->containsColumn($this->getParameter('bookstore_type_column'))) {
            $this->getTable()->addColumn(array(
                'name' => $this->getParameter('bookstore_type_column'),
                'type' => 'VARCHAR',
                'size' => 32
            ));
        }
    }

    /**
     * Get the setter of one of the columns of the behavior
     *
     * @param     string $column One of the behavior colums, 'create_column' or 'update_column'
     * @return    string The related setter, 'setCreatedOn' or 'setUpdatedOn'
     */
    protected function getColumnSetter($column)
    {
        return 'set' . $this->getColumnForParameter($column)->getPhpName();
    }

    protected function getColumnConstant($columnName, $builder)
    {
        return $builder->getColumnConstant($this->getColumnForParameter($columnName));
    }

    /**
     * Add code in ObjectBuilder::preInsert
     *
     * @return    string The code to put at the hook
     */
    public function preInsert($builder)
    {
        return "if (!\$this->isColumnModified(" . $this->getColumnConstant('spidered_column', $builder) . ")) {
            \$this->" . $this->getColumnSetter('spidered_column') . "(NULL);
    }";
    }

    public function objectMethods($builder)
    {
        return "

    /**
     * Set the spidered time to the current time
     *
     * @return     " . $builder->getStubObjectBuilder()->getClassname() . " The current object (for fluent API support)
     */
    public function setSpidered()
    {
        \$this->" .$this->getColumnSetter('spidered_column') . "(time());
        return \$this;
    }
    ";
    }

    public function queryMethods($builder)
    {
    }
}


text:
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title></title>
  </head>
  <body>
    frame3.html
    <input id="polo-text" placeholder="Marco reply" /><br />

    <input id="popup-message" />
    <button id="send">Send popup a message</button>

    <script src="/js/test-app.js"></script>
    <script>
      var bus = new Framebus();

      document.querySelector("#send").addEventListener("click", function () {
        bus.emit("message", {
          message: document.querySelector("#popup-message").value,
        });
      });

      bus.on("Marco", function (data, reply) {
        var polo = document.getElementById("polo-text").value;
        app.printToDOM(data.message);
        reply({
          message: polo,
        });
      });
    </script>
  </body>
</html>


text:
import { CustomReporterResult } from "../../custom-reporter-result";
import { DisplayProcessor } from "../display-processor";
export declare class SpecPrefixesProcessor extends DisplayProcessor {
    displaySuccessfulSpec(spec: CustomReporterResult, log: String): String;
    displayFailedSpec(spec: CustomReporterResult, log: String): String;
    displayPendingSpec(spec: CustomReporterResult, log: String): String;
}