text:
module Funtestic
  module Helper

    def get_alternative_for_user_or_default(experiment_name, default)
      experiment = Funtestic::Experiment.find(experiment_name)
      if (experiment.present?) && ab_user[experiment.key]
        ab_user[experiment.key]
      else
        default
      end
    end

    def is_participating?(experiment_name)
      experiment = Funtestic::Experiment.find(experiment_name)

      # Return true if the user's hash has the experiment's key
      (experiment.present?) && ab_user[experiment.key]
    end

    def ab_test(metric_descriptor, control=nil, *alternatives)
      if RUBY_VERSION.match(/1\.8/) && alternatives.length.zero? && ! control.nil?
        puts 'WARNING: You should always pass the control alternative through as the second argument with any other alternatives as the third because the order of the hash is not preserved in ruby 1.8'
      end

      # Check if array is passed to ab_test: ab_test('name', ['Alt 1', 'Alt 2', 'Alt 3'])
      if control.is_a? Array and alternatives.length.zero?
        control, alternatives = control.first, control[1..-1]
      end

      begin
      experiment_name_with_version, goals = normalize_experiment(metric_descriptor)
      experiment_name = experiment_name_with_version.to_s.split(':')[0]
      experiment = Funtestic::Experiment.new(experiment_name, :alternatives => [control].compact + alternatives, :goals => goals)
      control ||= experiment.control && experiment.control.name

        ret = if Funtestic.configuration.enabled
          if (experiment.new_record?)
            call_experiment_created_hook(experiment)
          end
          experiment.save
          start_trial( Trial.new(:experiment => experiment) )
        else
          control_variable(control)
        end

      rescue => e
        raise(e) unless Funtestic.configuration.db_failover
        Funtestic.configuration.db_failover_on_db_error.call(e)

        if Funtestic.configuration.db_failover_allow_parameter_override && override_present?(experiment_name)
          ret = override_alternative(experiment_name)
        end
      ensure
        unless ret
          ret = control_variable(control)
        end
      end

      if block_given?
        if defined?(capture) # a block in a rails view
          block = Proc.new { yield(ret) }
          concat(capture(ret, &block))
          false
        else
          yield(ret)
        end
      else
        ret
      end
    end

    def attempt_for_experiment(experiment, options = {:multiple_conversion => true})
      return true unless experiment.winner.nil?
      multiple_conversion = options[:multiple_conversion]
      if !multiple_conversion && ab_user[experiment.attempt_key]
        return true
      else
        alternative_name = ab_user[experiment.key]
        trial = Trial.new(:experiment => experiment, :alternative => alternative_name, :goals => options[:goals])
        trial.attempt!
        ab_user[experiment.attempt_key] = true

        # Let the application do whatever it wants with the attempt for this alternative
        call_attempt_reported_hook Funtestic::Alternative.find_alternative_unique_id(experiment.name, alternative_name)

      end
    end

    def finish_experiment(experiment, options = {:multiple_conversion => true})
      return true unless experiment.winner.nil?
      multiple_conversion = options[:multiple_conversion]
      if !multiple_conversion  && ab_user[experiment.finished_key]
        return true
      else
        alternative_name = ab_user[experiment.key]
        trial = Trial.new(:experiment => experiment, :alternative => alternative_name, :goals => options[:goals])

        if (ab_user[experiment.finished_key] != true)
          trial.complete!
          ab_user[experiment.finished_key] = true
        else
          trial.conversion!
        end

        # Let the application do whatever it wants with the conversion for this alternative
        call_finish_reported_hook Funtestic::Alternative.find_alternative_unique_id(experiment.name, alternative_name)

      end
    end

    def track_event(experiment, event_data = {}) #event_data is hash of event name and how much incrememnt by
      return true unless experiment.winner.nil?

        alternative_name = ab_user[experiment.key]
        trial = Trial.new(:experiment => experiment, :alternative => alternative_name)
        trial.event(event_data)

    end

    def report_attempt(metric_descriptor, options = {:multiple_conversion => true})
      return if exclude_visitor? || Funtestic.configuration.disabled?
      metric_descriptor, goals = normalize_experiment(metric_descriptor)
      experiments = Metric.possible_experiments(metric_descriptor)

      if experiments.any?
        experiments.each do |experiment|
          # Make sure the user is a participant
          if ab_user[experiment.key]
            attempt_for_experiment(experiment, options.merge(:goals => goals))
          end
        end
      end
    rescue => e
      raise unless Funtestic.configuration.db_failover
      Funtestic.configuration.db_failover_on_db_error.call(e)

    end

    def track_alternative_event(experiment, alternative_name, event_data = {}) #event_data is hash of event name and how much incrememnt by
      return true unless experiment.winner.nil?

      trial = Trial.new(:experiment => experiment, :alternative => alternative_name)
      trial.event(event_data)

    end

    def finished(metric_descriptor, options = {:multiple_conversion => true})
      return if exclude_visitor? || Funtestic.configuration.disabled?
      metric_descriptor, goals = normalize_experiment(metric_descriptor)
      experiments = Metric.possible_experiments(metric_descriptor)

      if experiments.any?
        experiments.each do |experiment|
          # Make sure the user is a participant
          if ab_user[experiment.key]
            finish_experiment(experiment, options.merge(:goals => goals))
          end
        end
      end
    rescue => e
      raise unless Funtestic.configuration.db_failover
      Funtestic.configuration.db_failover_on_db_error.call(e)
    end

    def abtest_event(metric_descriptor, event_data = {})
      return if exclude_visitor? || Funtestic.configuration.disabled?
      metric_descriptor, goals = normalize_experiment(metric_descriptor)
      experiments = Metric.possible_experiments(metric_descriptor)

      if experiments.any?
        experiments.each do |experiment|
          track_event(experiment, event_data)
        end
      end
    rescue => e
      raise unless Funtestic.configuration.db_failover
      Funtestic.configuration.db_failover_on_db_error.call(e)
    end

    def abtest_event_for_alternative(experiment_name, alternative_name, event_data = {})
      return if exclude_visitor? || Funtestic.configuration.disabled?
      experiments = Metric.possible_experiments(experiment_name)

      if experiments.any? and alternative_name.present?
        track_alternative_event(experiments.first, alternative_name, event_data)
      end
    rescue => e
      raise unless Funtestic.configuration.db_failover
      Funtestic.configuration.db_failover_on_db_error.call(e)
    end

    def override_present?(experiment_name)
      defined?(params) && params[experiment_name]
    end

    def override_alternative(experiment_name)
      params[experiment_name] if override_present?(experiment_name)
    end

    def begin_experiment(experiment, alternative_name = nil)
      alternative_name ||= experiment.control.name
      ab_user[experiment.key] = alternative_name
      alternative_name
    end

    def ab_user
      @ab_user ||= Funtestic::Persistence.adapter.new(self)
    end

    def get_user_abtests_alt_ids
      # Ignore keys with ':finished'/':attempt', which mark conversions/conversion attempt, we want to only go over keys that mark participating
      # in a test
      ab_user.keys.reject { |key| key.ends_with?(':finished', ':attempt') }.map { |key| Alternative.find_alternative_unique_id(key.split(':')[0], ab_user[key]) }.join(',')
    end

    def exclude_visitor?
      instance_eval(&Funtestic.configuration.ignore_filter)
    end

    def not_allowed_to_test?(experiment_key)
      !Funtestic.configuration.allow_multiple_experiments && doing_other_tests?(experiment_key)
    end

    def doing_other_tests?(experiment_key)
      keys_without_experiment(ab_user.keys, experiment_key).length > 0
    end

    def clean_old_versions(experiment)

      # Delete old version of the current experiment
      old_versions(experiment).each do |old_key|
        ab_user.delete old_key
      end

      # Also, delete experiments which have already been deleted
      # (keeping the Funtestic cookie small if working with cookie provider)
      active_experiments = Experiment.active_experiments_names
      inactive_keys = ab_user.keys.select { |k| nil == active_experiments.detect { |exp| k.match(Regexp.new(exp))} }
      inactive_keys.each{|k| ab_user.delete k}

    end

    def old_versions(experiment)
      if experiment.version > 0
        keys = ab_user.keys.select { |k| k.match(Regexp.new(experiment.name)) }
        keys_without_experiment(keys, experiment.key)
      else
        []
      end
    end

    def is_robot?
      request.user_agent =~ Funtestic.configuration.robot_regex
    end

    def is_ignored_ip_address?
      return false if Funtestic.configuration.ignore_ip_addresses.empty?

      Funtestic.configuration.ignore_ip_addresses.each do |ip|
        return true if request.ip == ip || (ip.class == Regexp && request.ip =~ ip)
      end
      false
    end

    protected

    def normalize_experiment(metric_descriptor)
      if Hash === metric_descriptor
        experiment_name = metric_descriptor.keys.first
        goals = Array(metric_descriptor.values.first)
      else
        experiment_name = metric_descriptor
        goals = []
      end
      return experiment_name, goals
    end

    def control_variable(control)
      Hash === control ? control.keys.first : control
    end

    def start_trial(trial)
      experiment = trial.experiment
      if override_present?(experiment.name)
        ret = override_alternative(experiment.name)
        ab_user[experiment.key] = ret if Funtestic.configuration.store_override
      elsif ! experiment.winner.nil?
        ret = experiment.winner.name
      else
        clean_old_versions(experiment)
        if exclude_visitor? || not_allowed_to_test?(experiment.key)
          ret = experiment.control.name
        else
          if ab_user[experiment.key]
            ret = ab_user[experiment.key]
          else

            if experiment.max_participants > experiment.participant_count
              trial.choose!
              call_trial_choose_hook(trial)
              ret = begin_experiment(experiment, trial.alternative.name)
            elsif experiment.end_time.nil?
              # experiment.set_end_time(experiment.time_to_finish.from_now)
              experiment.set_end_time
            end

          end
        end
      end

      ret
    end

    def call_attempt_reported_hook(alternative_id)
      send(Funtestic.configuration.on_attempt_reported, alternative_id) if Funtestic.configuration.on_attempt_reported
    end

    def call_finish_reported_hook(alternative_id)
      send(Funtestic.configuration.on_finish_reported, alternative_id) if Funtestic.configuration.on_finish_reported
    end

    def call_trial_choose_hook(trial)
      send(Funtestic.configuration.on_trial_choose, trial) if Funtestic.configuration.on_trial_choose
    end

    def call_experiment_created_hook(experiment)
      send(Funtestic.configuration.on_experiment_created, experiment) if Funtestic.configuration.on_experiment_created
    end

    #def call_trial_complete_hook(trial)
    #  send(Funtestic.configuration.on_trial_complete, trial) if Funtestic.configuration.on_trial_complete
    #end

    def keys_without_experiment(keys, experiment_key)
      # Remove keys that belong to the experiment in experiment_key (ie - 'experiment_key', 'experiment_key:finished', 'experiment_key:attempt')
      keys.reject { |k| k.match(Regexp.new("^#{experiment_key}(:finished)?(:attempt)?$")) }
    end
  end
end


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/networkmanagement/v1beta1/reachability.proto

package com.google.cloud.networkmanagement.v1beta1;

public final class ReachabilityServiceProto {
  private ReachabilityServiceProto() {}

  public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {}

  public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) {
    registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry);
  }

  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_networkmanagement_v1beta1_ListConnectivityTestsRequest_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_networkmanagement_v1beta1_ListConnectivityTestsRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_networkmanagement_v1beta1_ListConnectivityTestsResponse_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_networkmanagement_v1beta1_ListConnectivityTestsResponse_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_networkmanagement_v1beta1_GetConnectivityTestRequest_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_networkmanagement_v1beta1_GetConnectivityTestRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_networkmanagement_v1beta1_CreateConnectivityTestRequest_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_networkmanagement_v1beta1_CreateConnectivityTestRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_networkmanagement_v1beta1_UpdateConnectivityTestRequest_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_networkmanagement_v1beta1_UpdateConnectivityTestRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_networkmanagement_v1beta1_DeleteConnectivityTestRequest_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_networkmanagement_v1beta1_DeleteConnectivityTestRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_networkmanagement_v1beta1_RerunConnectivityTestRequest_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_networkmanagement_v1beta1_RerunConnectivityTestRequest_fieldAccessorTable;
  static final com.google.protobuf.Descriptors.Descriptor
      internal_static_google_cloud_networkmanagement_v1beta1_OperationMetadata_descriptor;
  static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_cloud_networkmanagement_v1beta1_OperationMetadata_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
    return descriptor;
  }

  private static com.google.protobuf.Descriptors.FileDescriptor descriptor;

  static {
    java.lang.String[] descriptorData = {
      "\n9google/cloud/networkmanagement/v1beta1"
          + "/reachability.proto\022&google.cloud.networ"
          + "kmanagement.v1beta1\032\034google/api/annotati"
          + "ons.proto\032\027google/api/client.proto\032\037goog"
          + "le/api/field_behavior.proto\032>google/clou"
          + "d/networkmanagement/v1beta1/connectivity"
          + "_test.proto\032#google/longrunning/operatio"
          + "ns.proto\032 google/protobuf/field_mask.pro"
          + "to\032\037google/protobuf/timestamp.proto\"|\n\034L"
          + "istConnectivityTestsRequest\022\023\n\006parent\030\001 "
          + "\001(\tB\003\340A\002\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_toke"
          + "n\030\003 \001(\t\022\016\n\006filter\030\004 \001(\t\022\020\n\010order_by\030\005 \001("
          + "\t\"\232\001\n\035ListConnectivityTestsResponse\022K\n\tr"
          + "esources\030\001 \003(\01328.google.cloud.networkman"
          + "agement.v1beta1.ConnectivityTest\022\027\n\017next"
          + "_page_token\030\002 \001(\t\022\023\n\013unreachable\030\003 \003(\t\"/"
          + "\n\032GetConnectivityTestRequest\022\021\n\004name\030\001 \001"
          + "(\tB\003\340A\002\"\233\001\n\035CreateConnectivityTestReques"
          + "t\022\023\n\006parent\030\001 \001(\tB\003\340A\002\022\024\n\007test_id\030\002 \001(\tB"
          + "\003\340A\002\022O\n\010resource\030\003 \001(\01328.google.cloud.ne"
          + "tworkmanagement.v1beta1.ConnectivityTest"
          + "B\003\340A\002\"\246\001\n\035UpdateConnectivityTestRequest\022"
          + "4\n\013update_mask\030\001 \001(\0132\032.google.protobuf.F"
          + "ieldMaskB\003\340A\002\022O\n\010resource\030\002 \001(\01328.google"
          + ".cloud.networkmanagement.v1beta1.Connect"
          + "ivityTestB\003\340A\002\"2\n\035DeleteConnectivityTest"
          + "Request\022\021\n\004name\030\001 \001(\tB\003\340A\002\"1\n\034RerunConne"
          + "ctivityTestRequest\022\021\n\004name\030\001 \001(\tB\003\340A\002\"\326\001"
          + "\n\021OperationMetadata\022/\n\013create_time\030\001 \001(\013"
          + "2\032.google.protobuf.Timestamp\022,\n\010end_time"
          + "\030\002 \001(\0132\032.google.protobuf.Timestamp\022\016\n\006ta"
          + "rget\030\003 \001(\t\022\014\n\004verb\030\004 \001(\t\022\025\n\rstatus_detai"
          + "l\030\005 \001(\t\022\030\n\020cancel_requested\030\006 \001(\010\022\023\n\013api"
          + "_version\030\007 \001(\t2\243\r\n\023ReachabilityService\022\355"
          + "\001\n\025ListConnectivityTests\022D.google.cloud."
          + "networkmanagement.v1beta1.ListConnectivi"
          + "tyTestsRequest\032E.google.cloud.networkman"
          + "agement.v1beta1.ListConnectivityTestsRes"
          + "ponse\"G\202\323\344\223\002A\022?/v1beta1/{parent=projects"
          + "/*/locations/global}/connectivityTests\022\334"
          + "\001\n\023GetConnectivityTest\022B.google.cloud.ne"
          + "tworkmanagement.v1beta1.GetConnectivityT"
          + "estRequest\0328.google.cloud.networkmanagem"
          + "ent.v1beta1.ConnectivityTest\"G\202\323\344\223\002A\022?/v"
          + "1beta1/{name=projects/*/locations/global"
          + "/connectivityTests/*}\022\241\002\n\026CreateConnecti"
          + "vityTest\022E.google.cloud.networkmanagemen"
          + "t.v1beta1.CreateConnectivityTestRequest\032"
          + "\035.google.longrunning.Operation\"\240\001\202\323\344\223\002K\""
          + "?/v1beta1/{parent=projects/*/locations/g"
          + "lobal}/connectivityTests:\010resource\312AL\n7g"
          + "oogle.cloud.networkmanagement.v1beta1.Co"
          + "nnectivityTest\022\021OperationMetadata\022\252\002\n\026Up"
          + "dateConnectivityTest\022E.google.cloud.netw"
          + "orkmanagement.v1beta1.UpdateConnectivity"
          + "TestRequest\032\035.google.longrunning.Operati"
          + "on\"\251\001\202\323\344\223\002T2H/v1beta1/{resource.name=pro"
          + "jects/*/locations/global/connectivityTes"
          + "ts/*}:\010resource\312AL\n7google.cloud.network"
          + "management.v1beta1.ConnectivityTest\022\021Ope"
          + "rationMetadata\022\236\002\n\025RerunConnectivityTest"
          + "\022D.google.cloud.networkmanagement.v1beta"
          + "1.RerunConnectivityTestRequest\032\035.google."
          + "longrunning.Operation\"\237\001\202\323\344\223\002J\"E/v1beta1"
          + "/{name=projects/*/locations/global/conne"
          + "ctivityTests/*}:rerun:\001*\312AL\n7google.clou"
          + "d.networkmanagement.v1beta1.Connectivity"
          + "Test\022\021OperationMetadata\022\364\001\n\026DeleteConnec"
          + "tivityTest\022E.google.cloud.networkmanagem"
          + "ent.v1beta1.DeleteConnectivityTestReques"
          + "t\032\035.google.longrunning.Operation\"t\202\323\344\223\002A"
          + "*?/v1beta1/{name=projects/*/locations/gl"
          + "obal/connectivityTests/*}\312A*\n\025google.pro"
          + "tobuf.Empty\022\021OperationMetadata\032T\312A netwo"
          + "rkmanagement.googleapis.com\322A.https://ww"
          + "w.googleapis.com/auth/cloud-platformB\237\002\n"
          + "*com.google.cloud.networkmanagement.v1be"
          + "ta1B\030ReachabilityServiceProtoP\001ZWgoogle."
          + "golang.org/genproto/googleapis/cloud/net"
          + "workmanagement/v1beta1;networkmanagement"
          + "\252\002&Google.Cloud.NetworkManagement.V1Beta"
          + "1\312\002&Google\\Cloud\\NetworkManagement\\V1bet"
          + "a1\352\002)Google::Cloud::NetworkManagement::V"
          + "1beta1b\006proto3"
    };
    descriptor =
        com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
            descriptorData,
            new com.google.protobuf.Descriptors.FileDescriptor[] {
              com.google.api.AnnotationsProto.getDescriptor(),
              com.google.api.ClientProto.getDescriptor(),
              com.google.api.FieldBehaviorProto.getDescriptor(),
              com.google.cloud.networkmanagement.v1beta1.TestOuterClass.getDescriptor(),
              com.google.longrunning.OperationsProto.getDescriptor(),
              com.google.protobuf.FieldMaskProto.getDescriptor(),
              com.google.protobuf.TimestampProto.getDescriptor(),
            });
    internal_static_google_cloud_networkmanagement_v1beta1_ListConnectivityTestsRequest_descriptor =
        getDescriptor().getMessageTypes().get(0);
    internal_static_google_cloud_networkmanagement_v1beta1_ListConnectivityTestsRequest_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_networkmanagement_v1beta1_ListConnectivityTestsRequest_descriptor,
            new java.lang.String[] {
              "Parent", "PageSize", "PageToken", "Filter", "OrderBy",
            });
    internal_static_google_cloud_networkmanagement_v1beta1_ListConnectivityTestsResponse_descriptor =
        getDescriptor().getMessageTypes().get(1);
    internal_static_google_cloud_networkmanagement_v1beta1_ListConnectivityTestsResponse_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_networkmanagement_v1beta1_ListConnectivityTestsResponse_descriptor,
            new java.lang.String[] {
              "Resources", "NextPageToken", "Unreachable",
            });
    internal_static_google_cloud_networkmanagement_v1beta1_GetConnectivityTestRequest_descriptor =
        getDescriptor().getMessageTypes().get(2);
    internal_static_google_cloud_networkmanagement_v1beta1_GetConnectivityTestRequest_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_networkmanagement_v1beta1_GetConnectivityTestRequest_descriptor,
            new java.lang.String[] {
              "Name",
            });
    internal_static_google_cloud_networkmanagement_v1beta1_CreateConnectivityTestRequest_descriptor =
        getDescriptor().getMessageTypes().get(3);
    internal_static_google_cloud_networkmanagement_v1beta1_CreateConnectivityTestRequest_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_networkmanagement_v1beta1_CreateConnectivityTestRequest_descriptor,
            new java.lang.String[] {
              "Parent", "TestId", "Resource",
            });
    internal_static_google_cloud_networkmanagement_v1beta1_UpdateConnectivityTestRequest_descriptor =
        getDescriptor().getMessageTypes().get(4);
    internal_static_google_cloud_networkmanagement_v1beta1_UpdateConnectivityTestRequest_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_networkmanagement_v1beta1_UpdateConnectivityTestRequest_descriptor,
            new java.lang.String[] {
              "UpdateMask", "Resource",
            });
    internal_static_google_cloud_networkmanagement_v1beta1_DeleteConnectivityTestRequest_descriptor =
        getDescriptor().getMessageTypes().get(5);
    internal_static_google_cloud_networkmanagement_v1beta1_DeleteConnectivityTestRequest_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_networkmanagement_v1beta1_DeleteConnectivityTestRequest_descriptor,
            new java.lang.String[] {
              "Name",
            });
    internal_static_google_cloud_networkmanagement_v1beta1_RerunConnectivityTestRequest_descriptor =
        getDescriptor().getMessageTypes().get(6);
    internal_static_google_cloud_networkmanagement_v1beta1_RerunConnectivityTestRequest_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_networkmanagement_v1beta1_RerunConnectivityTestRequest_descriptor,
            new java.lang.String[] {
              "Name",
            });
    internal_static_google_cloud_networkmanagement_v1beta1_OperationMetadata_descriptor =
        getDescriptor().getMessageTypes().get(7);
    internal_static_google_cloud_networkmanagement_v1beta1_OperationMetadata_fieldAccessorTable =
        new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
            internal_static_google_cloud_networkmanagement_v1beta1_OperationMetadata_descriptor,
            new java.lang.String[] {
              "CreateTime",
              "EndTime",
              "Target",
              "Verb",
              "StatusDetail",
              "CancelRequested",
              "ApiVersion",
            });
    com.google.protobuf.ExtensionRegistry registry =
        com.google.protobuf.ExtensionRegistry.newInstance();
    registry.add(com.google.api.ClientProto.defaultHost);
    registry.add(com.google.api.FieldBehaviorProto.fieldBehavior);
    registry.add(com.google.api.AnnotationsProto.http);
    registry.add(com.google.api.ClientProto.oauthScopes);
    registry.add(com.google.longrunning.OperationsProto.operationInfo);
    com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor(
        descriptor, registry);
    com.google.api.AnnotationsProto.getDescriptor();
    com.google.api.ClientProto.getDescriptor();
    com.google.api.FieldBehaviorProto.getDescriptor();
    com.google.cloud.networkmanagement.v1beta1.TestOuterClass.getDescriptor();
    com.google.longrunning.OperationsProto.getDescriptor();
    com.google.protobuf.FieldMaskProto.getDescriptor();
    com.google.protobuf.TimestampProto.getDescriptor();
  }

  // @@protoc_insertion_point(outer_class_scope)
}

redpajama_set_name: RedPajamaGithub


text:
var App = require('app');

App.TargetCluster = DS.Model.extend({
  name: DS.attr('string'),
  execute: DS.attr('string'),
  workflow: DS.attr('string'),
  write: DS.attr('string'),
  readonly: DS.attr('string'),
  staging: DS.attr('string'),
  working: DS.attr('string'),
  temp: DS.attr('string')
});

App.TargetCluster.FIXTURES = [];


text:
[Cordova](http://cordova.apache.org/) iOS plugin exposing the full [WebRTC W3C JavaScript APIs](http://www.w3.org/TR/webrtc/).

**Yet another WebRTC SDK for iOS?**

Absolutely **not**. This plugin exposes the WebRTC W3C API for Cordova iOS apps (you know there is no WebRTC in iOS, right?), which means no need to learn "yet another WebRTC API" and no need to use a specific service/product/provider.

**Why?**

Check the [release announcement](https://eface2face.com/blog/cordova-plugin-iosrtc.html) at the [eFace2Face](https://eface2face.com) site.

**Resources:**

* [NPM package](https://www.npmjs.com/package/cordova-plugin-iosrtc).
* [Public Google Group](https://groups.google.com/forum/?hl=es#!forum/cordova-plugin-iosrtc) for questions and discussions about *cordova-plugin-iosrtc*.
* [Bug Tracker](https://github.com/eface2face/cordova-plugin-iosrtc/issues) for reporting issues and requesting new features (please don't use the bug tracker for questions or problems, use the Google Group instead).

## Installation

Within your Cordova project:

```bash
$ cordova plugin add cordova-plugin-iosrtc
```

(or add it into a `<plugin>` entry in the `config.xml` of your app).

## Building

This plugin needs [Swift](https://developer.apple.com/swift/) support so some steps are needed to get your project working with it. These steps are explained in the [Building](https://github.com/eface2face/cordova-plugin-iosrtc/blob/master/docs/Building.md) documentation, please check it.

**IMPORTANT:** It seems that the incoming [Swift 2.0](https://developer.apple.com/swift/blog/?id=29) (included in the next OS X [El Capitan](https://developer.apple.com/osx/pre-release/)) requires code changes for the plugin to compile. It will be addressed in [issue #28](https://github.com/eface2face/cordova-plugin-iosrtc/issues/28).

## Usage

The plugin exposes the `cordova.plugins.iosrtc` JavaScript namespace which contains all the WebRTC classes and functions.

```javascript
var pc = new cordova.plugins.iosrtc.RTCPeerConnection({
  iceServers: []
});

cordova.plugins.iosrtc.getUserMedia(
  // constraints
  { audio: true, video: true },
  // success callback
  function (stream) {
    console.log('got local MediaStream: ', stream);

    pc.addStream(stream);
  },
  // failure callback
  function (error) {
    console.error('getUserMedia failed: ', error);
  }
);
```

**Q:** But... wait! Does it mean that there is no `window.RTCPeerConnection` nor `navigator.getUserMedia`?

**R:** A Cordova plugin is supposed to expose its JavaScript stuff in a specific namespace and, personally, I just hate those libraries that pollute the global namespace. Said that, the plugin provides a `registerGlobals()` method, so you just need the following extra-code in your existing WebRTC app (assuming that [Cordova Device Plugin](http://plugins.cordova.io/#/package/org.apache.cordova.device) is installed):

```javascript
// Just for Cordova apps.
document.addEventListener('deviceready', function () {
  // Just for iOS devices.
  if (window.device.platform === 'iOS') {
    cordova.plugins.iosrtc.registerGlobals();
  }
});
```

And that's all. Now you have `window.RTCPeerConnection`, `navigator.getUserMedia`, etc.

**Q:** What about `<video>` elements and `video.src = URL.createObjectURL(stream)`? do I need custom HTML tags or functions to display WebRTC videos?

**R:** No. Just use an HTML video element as usual, really. The plugin will properly place a native *UIView* layer on top of it by respecting its properties such as the CSS `display`, `opacity`, `visibility`, `z-index`, `object-fit` and also horizontal mirror effect with `-webkit-transform: scaleX(-1);` or equivalent.

**Q:** Can I place HTML elements (buttons and so on) on top of active `<video>` elements?

**R:** Unfortunately not. The native *UIView* rendering the video stream is placed on top of the HTML view. :(

**Q:** What about [HTML5 video events](https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events)? Can I rely on `video.oncanplay`?

**R:** I see what you mean. As there is no real video attached to the `<video>` element, media events are artificially emitted by the plugin. The following events are emitted when the `MediaStream` attached to a video element is ready to render video: `onloadedmetadata`, `onloadeddata`, `oncanplay`, `oncanplaythrough`. So yes, you can rely on them.

**Q:** Can I read `<video>` properties such as `readyState`, `videoWidth`, etc?

Again, there is no real video attached to the `<video>` element so some peroperties are artificially set by the plugin. These are `readyState`, `videoWidth` and `videoHeight`.

**Q:** Do I need to call special methods to release/free native WebRTC objects? How are they garbage collected?

**R:** Good question. An `RTCPeerConnection` is released when `close()` is called on it, a `MediaStream` is released when all its tracks end, and other elements are garbage collected when no longer needed. Basically the same behavior as in a WebRTC capable browser.

**Q:** What about Android? Why just iOS?

**R:** In modern versions of Android the *WebView* component is based on the Chromium open source project which already includes WebRTC ([more info](https://developer.chrome.com/multidevice/webview/overview)). For older versions of Android the [CrossWalk](https://crosswalk-project.org) project provides new *WebView* versions with WebRTC support as well.

## Documentation

Read the full [documentation](https://github.com/eface2face/cordova-plugin-iosrtc/blob/master/docs/index.md) in the *docs* folder.

## Demo application

Check our [iOSRTCApp](https://github.com/eface2face/iOSRTCApp) (Google's [AppRTC](https://apprtc.appspot.com/) adapted to Cordova iOS with pure HTML5/JavaScript and *cordova-plugin-iosrtc*).

## Who Uses It

[People and companies](https://github.com/eface2face/cordova-plugin-iosrtc/blob/master/WHO_USES_IT.md) using *cordova-plugin-iosrtc*.

If you are using the plugin we would love to [heard back from you](https://github.com/eface2face/cordova-plugin-iosrtc/blob/master/WHO_USES_IT.md)!

## Known Issues

#### iOS Safari and crash on WebSocket events

Don't call plugin methods within WebSocket events (`onopen`, `onmessage`, etc). There is an issue in iOS Safari (see [issue #12](https://github.com/eface2face/cordova-plugin-iosrtc/issues/12)). Instead run a `setTimeout()` within the WebSocket event if you need to call plugin methods on it.

Or better, just load the provided [ios-websocket-hack.js](https://github.com/eface2face/cordova-plugin-iosrtc/blob/master/extra/ios-websocket-hack.js) script into your Cordova iOS app and you are done.

#### HTML5 video API

As explained above, there is no real media source attached to the `<video>` element so some [HTML5 video events](https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events) and properties are artificially emitted/set by the plugin on behalf of the video element.

Methods such as `play()`, `pause()` are not implemented. In order to pause a video just set `enabled = false` on the associated `MediaStreamTrack`.

## Changelog

(since version 1.2.8)

#### Version 1.4.1

* Release `MediaStreamRenderer` and revert `<video>` properties when the attached `MediaStream` emits "inactive" ([issue #27](https://github.com/eface2face/cordova-plugin-iosrtc/issues/27)).

#### Version 1.4.0

* Implemented some `<video>` properties such as `readyState`, `videoWidth` and `videoHeight` ([issue #25](https://github.com/eface2face/cordova-plugin-iosrtc/issues/25)).
* Building simplified for both Cordova CLI and Xcode by providing a single ["hook"]((https://github.com/eface2face/cordova-plugin-iosrtc/blob/master/extra/hooks/iosrtc-swift-support.js) the user must add into his Cordova application (check the [Building](Building.md) documentation for further details).

#### Version 1.3.3

* CSS `object-fit: none` properly implemented (don't clip the video).

#### Version 1.3.2

* CSS [object-fit](https://css-tricks.com/almanac/properties/o/object-fit/) property implemented in `<video>` elements ([issue #23](https://github.com/eface2face/cordova-plugin-iosrtc/issues/23)).

#### Version 1.3.1

* Stop "error" event propagation in `<video>` element when attaching a `MediaStream` to it ([issue #22](https://github.com/eface2face/cordova-plugin-iosrtc/issues/22)).

#### Version 1.3.0

* Plugin moved to [NPM](https://www.npmjs.com/package/cordova-plugin-iosrtc) registry and plugin ID renamed to *cordova-plugin-iosrtc*.

#### Version 1.2.8

* `iosrtc.registerGlobals()` also generates `window.webkitRTCPeerConnection` and `navigator.webkitGetUserMedia()` for backwards compatibility with WebRTC JavaScript wrappers/adapters that assume browser vendor prefixes (`webkit`, `moz`) in the underlying WebRTC API.

## Author

Iñaki Baz Castillo at [eFace2Face, inc.](https://eface2face.com)

## License

[MIT](./LICENSE) :)


text:
tableOptions = {

	switchType: function(e){

		var type = 	getObjectFromID("type");
		var ifDiv =	getObjectFromID("ifDiv");
		var acDiv =	getObjectFromID("acDiv");
		var acNote = getObjectFromID("acNote");
		var apiNote = getObjectFromID("apiNote");

		switch(type.value){

			case "0":
				ifDiv.style.display = "block";
				acDiv.style.display = "none";
				apiNote.style.display = "none";
				acNote.style.display = "none";
				break;

			case "1":
				ifDiv.style.display = "none";
				acDiv.style.display = "block";
				apiNote.style.display = "none";
				acNote.style.display = "block";
				break;

			case "2":
				ifDiv.style.display = "none";
				acDiv.style.display = "block";
				apiNote.style.display = "block";
				acNote.style.display = "none";
				break;
		}

	},//end method

	edit: function(e){

		tableOptions._tableButtonClick(e, "edit")

	}, //end method

	del: function(e){

		tableOptions._tableButtonClick(e, "delete")

	},//end method

	_tableButtonClick: function(e, thecommand){

		var id = 		getObjectFromID("id");
		var command = 	getObjectFromID("command");

		var button = e.src();

		var theid = button.id.substr(3);

		id.value = theid;
		command.value = thecommand;

		tableOptions.submitForm(e);

	}, //end method

	submitForm: function(e){

		var command = getObjectFromID("command");
		var theform = getObjectFromID("record")

		if(command.value == "add" || command.value == "update"){

			if(!validateForm(theform)){
				if(e)
					e.stop();
				return false;
			}//endif

		}//end if

		theform.submit();

	}, //end method

	cancel: function(e){

		var command = 	getObjectFromID("command");

		command.value = "cancel";

		tableOptions.submitForm(e);

	}//end method

}//end class

/* OnLoad Listner ---------------------------------------- */
/* ------------------------------------------------------- */
connect(window,"onload",function() {

	var type = getObjectFromID("type")
	connect(type, "onchange", tableOptions.switchType);

	var theForm = getObjectFromID("record");
	connect(type, "onsubmit", function(e){e.stop();});

	var delButtons = getElementsByClassName("buttonDelete");
	for(var i=0; i < delButtons.length; i++)
		connect(delButtons[i], "onclick", tableOptions.del);

	var editButtons = getElementsByClassName("buttonEdit");
	for(var i=0; i < editButtons.length; i++)
		connect(editButtons[i], "onclick", tableOptions.edit);

	var cancelButton = getObjectFromID("cancel");
	if(cancelButton)
		connect(cancelButton, "onclick", tableOptions.cancel);

	var saveButton = getObjectFromID("save");
	connect(saveButton, "onclick", tableOptions.submitForm);

	tableOptions.switchType();

});//end connect


text:
package benchhash

import (
	"github.com/zond/gotomic"
)

type GotomicMap struct {
	h *gotomic.Hash
}

func (s GotomicMap) Get(key uint32) (uint32, bool) {
	val, found := s.h.Get(gotomic.IntKey(key))
	if val == nil {
		return 0, false
	}
	return uint32(val.(gotomic.IntKey)), found
}

func (s GotomicMap) Put(key, val uint32) {
	s.h.Put(gotomic.IntKey(key), gotomic.IntKey(val))
}

func NewGotomicMap() HashMap {
	return GotomicMap{gotomic.NewHash()}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
    android:keyWidth="18%p"
    android:horizontalGap="2.2%p"
    android:verticalGap="1%p"
    android:keyHeight="7%p">

    <!--<Row>-->
        <!--<Key android:codes="55"    android:keyLabel="7" android:keyEdgeFlags="left" />-->
        <!--<Key android:codes="56"    android:keyLabel="8" />-->
        <!--<Key android:codes="57"    android:keyLabel="9" />-->
        <!--<Key android:codes="65"    android:keyLabel="A" android:popupKeyboard="@xml/popup" android:popupCharacters="aA" android:horizontalGap="6.25%p" />-->
        <!--<Key android:codes="66"    android:keyLabel="B" android:popupKeyboard="@xml/popup" android:popupCharacters="bB" />-->
        <!--<!–<Key android:codes="-5"    android:keyIcon="@drawable/sym_keyboard_delete" android:isRepeatable="true" android:horizontalGap="6.25%p" />–>-->
        <!--<!–<Key android:codes="55006" android:keyLabel="CLR" android:keyEdgeFlags="right"/>–>-->
    <!--</Row>-->
    <!--<Row>-->
        <!--<Key android:codes="52"    android:keyLabel="4" android:keyEdgeFlags="left"  />-->
        <!--<Key android:codes="53"    android:keyLabel="5" />-->
        <!--<Key android:codes="54"    android:keyLabel="6" />-->
        <!--<Key android:codes="67"    android:keyLabel="C" android:popupKeyboard="@xml/popup" android:popupCharacters="cC" android:horizontalGap="6.25%p" />-->
        <!--<Key android:codes="68"    android:keyLabel="D" android:popupKeyboard="@xml/popup" android:popupCharacters="dD" />-->
    <!--</Row>-->
    <!--<Row>-->
        <!--<Key android:codes="49"    android:keyLabel="1"  android:keyEdgeFlags="left" />-->
        <!--<Key android:codes="50"    android:keyLabel="2" />-->
        <!--<Key android:codes="51"    android:keyLabel="3" />-->
        <!--<!–<Key android:codes="69"    android:keyLabel="E" android:popupKeyboard="@xml/popup" android:popupCharacters="eE"  android:horizontalGap="6.25%p" />–>-->
        <!--<!–<!– NOTE We could add 'android:keyHeight="20%p"' to the 'E' key, so that it becomes twice as tall. We would then typically make the the 'done' key half the width (12.5%) but give it a double gap (25%) –>–>-->
        <!--<!–<Key android:codes="70"    android:keyLabel="F" android:popupKeyboard="@xml/popup" android:popupCharacters="fF" />–>-->
        <!--<Key android:codes="-5"    android:keyIcon="@drawable/sym_keyboard_delete" android:isRepeatable="true" android:horizontalGap="6.25%p" />-->
        <!--<Key android:codes="55006" android:keyLabel="CLR" android:keyEdgeFlags="right"/>-->

    <!--</Row>-->
    <!--<Row>-->
        <!--<Key android:codes="48"    android:keyLabel="0" android:keyWidth="25%p" android:horizontalGap="18%p" android:keyEdgeFlags="left" />-->
        <!--<Key android:codes="-3"    android:keyIcon="@drawable/sym_keyboard_done" android:keyWidth="25%p" android:horizontalGap="18%p" />-->

    <!--</Row>-->

    <Row>
        <Key android:codes="48"    android:keyLabel="0" android:keyEdgeFlags="left"  />
        <Key android:codes="49"    android:keyLabel="1"   />
        <Key android:codes="50"    android:keyLabel="2" />
        <Key android:codes="51"    android:keyLabel="3" />
        <Key android:codes="-5"    android:keyIcon="@drawable/sym_keyboard_delete_1" android:keyWidth="15%p" android:keyHeight="31%p" android:isRepeatable="true" />
    </Row>

    <Row>
        <Key android:codes="52"    android:keyLabel="4" android:keyEdgeFlags="left"  />
        <Key android:codes="53"    android:keyLabel="5" />
        <Key android:codes="54"    android:keyLabel="6" />
        <Key android:codes="55"    android:keyLabel="7" />

    </Row>

    <Row>
        <Key android:codes="56"    android:keyLabel="8" android:keyEdgeFlags="left" />
        <Key android:codes="57"    android:keyLabel="9" />
        <Key android:codes="65"    android:keyLabel="A" />
        <Key android:codes="66"    android:keyLabel="B" />

    </Row>

    <Row>
        <Key android:codes="67"    android:keyLabel="C" android:keyEdgeFlags="left"  />
        <Key android:codes="68"    android:keyLabel="D" />
        <Key android:codes="69"    android:keyLabel="E" />
        <Key android:codes="70"    android:keyLabel="F" />
    </Row>

    <Row>
        <Key android:codes="69"   android:keyWidth="97%p" android:keyLabel="Enter" />
    </Row>

</Keyboard>


text:
<?php
namespace User\Service\Factory;

use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\Crypt\Password\Bcrypt;

class PasswordAdapter implements FactoryInterface
{
    public function createService (ServiceLocatorInterface $serviceLocator)
    {
        $config = $serviceLocator->get('config');
        // Notice: In order for the code below to work make sure that you have copied
        // the module/Application/config/crypto.local.php.dist file to config/autoload/crypto.local.php .
        $adapter = new Bcrypt($config['bcrypt']);

        return $adapter;
    }
}


text:
layout: post
categories:
- talk
title: "Introduction to D3: Data Driven Documents"
location: "Data Potluck & Opengov Hack Night"
date: 2012-08-28
image: /images/talks/d3-presentation.jpg
description: "A 20-minute talk on
        d3,
        a JavaScript library for easily manipulating elemnts on a webpage with a variety of data formats. Given at the
        Data Potluck
        /
        Opengov Hack Night
        at
        1871.
        The video quality for this one isn't great, but you can follow along with my
        presentation notes."
link: http://www.youtube.com/watch?v=tuB3pDFYhRU#t=10m5s
tags:
 - presentation
medium: video
featured: false
published: true
---


text:
Forbid Webpack loader syntax in imports.

[Webpack](http://webpack.github.io) allows specifying the [loaders](http://webpack.github.io/docs/loaders.html) to use in the import source string using a special syntax like this:
```js
var moduleWithOneLoader = require("my-loader!./my-awesome-module");
```

This syntax is non-standard, so it couples the code to Webpack. The recommended way to specify Webpack loader configuration is in a [Webpack configuration file](http://webpack.github.io/docs/loaders.html#loaders-by-config).

## Rule Details

### Fail

```js
import myModule from 'my-loader!my-module';
import theme from 'style!css!./theme.css';

var myModule = require('my-loader!./my-module');
var theme = require('style!css!./theme.css');
```

### Pass

```js
import myModule from 'my-module';
import theme from './theme.css';

var myModule = require('my-module');
var theme = require('./theme.css');
```

## When Not To Use It

If you have a project that doesn't use Webpack you can safely disable this rule.


text:
package com.google.template.soy.types;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Interner;
import com.google.common.collect.Interners;
import com.google.template.soy.types.aggregate.ListType;
import com.google.template.soy.types.aggregate.MapType;
import com.google.template.soy.types.aggregate.RecordType;
import com.google.template.soy.types.aggregate.UnionType;
import com.google.template.soy.types.primitive.AnyType;
import com.google.template.soy.types.primitive.BoolType;
import com.google.template.soy.types.primitive.FloatType;
import com.google.template.soy.types.primitive.IntType;
import com.google.template.soy.types.primitive.NullType;
import com.google.template.soy.types.primitive.SanitizedType.AttributesType;
import com.google.template.soy.types.primitive.SanitizedType.CssType;
import com.google.template.soy.types.primitive.SanitizedType.HtmlType;
import com.google.template.soy.types.primitive.SanitizedType.JsType;
import com.google.template.soy.types.primitive.SanitizedType.TrustedResourceUriType;
import com.google.template.soy.types.primitive.SanitizedType.UriType;
import com.google.template.soy.types.primitive.StringType;
import com.google.template.soy.types.primitive.UnknownType;

import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
import java.util.Set;

import javax.inject.Inject;
import javax.inject.Singleton;

/**
 * Registry of types which can be looked up by name.
 *
 * <p> Important: Do not use outside of Soy code (treat as superpackage-private).
 *
 */
@Singleton
public final class SoyTypeRegistry {

  /** A type registry that defaults all unknown types to the 'unknown' type. */
  public static final SoyTypeRegistry DEFAULT_UNKNOWN =
      new SoyTypeRegistry(
          ImmutableSet.<SoyTypeProvider>of(
              new SoyTypeProvider() {
                @Override
                public SoyType getType(String typeName, SoyTypeRegistry typeRegistry) {
                  return UnknownType.getInstance();
                }
              }));

  // TODO(shwetakarwa): Rename consistently to use "URL".
  private static final Map<String, SoyType> BUILTIN_TYPES =
      ImmutableMap.<String, SoyType>builder()
          .put("any", AnyType.getInstance())
          .put("null", NullType.getInstance())
          .put("bool", BoolType.getInstance())
          .put("int", IntType.getInstance())
          .put("float", FloatType.getInstance())
          .put("string", StringType.getInstance())
          .put("number", SoyTypes.NUMBER_TYPE)
          .put("html", HtmlType.getInstance())
          .put("attributes", AttributesType.getInstance())
          .put("css", CssType.getInstance())
          .put("uri", UriType.getInstance())
          .put("trusted_resource_url", TrustedResourceUriType.getInstance())
          .put("js", JsType.getInstance())
          .build();

  private final ImmutableSet<SoyTypeProvider> typeProviders;
  private final Interner<ListType> listTypes = Interners.newStrongInterner();
  private final Interner<MapType> mapTypes = Interners.newStrongInterner();
  private final Interner<UnionType> unionTypes = Interners.newStrongInterner();
  private final Interner<RecordType> recordTypes = Interners.newStrongInterner();

  @Inject
  public SoyTypeRegistry(Set<SoyTypeProvider> typeProviders) {
    this.typeProviders = ImmutableSet.copyOf(typeProviders);
  }

  @VisibleForTesting
  public SoyTypeRegistry() {
    this.typeProviders = ImmutableSet.of();
  }

  /**
   * Look up a type by name. Returns null if there is no such type.
   * @param typeName The fully-qualified name of the type.
   * @return The type object, or {@code null}.
   */
  public SoyType getType(String typeName) {
    SoyType result = BUILTIN_TYPES.get(typeName);
    if (result != null) {
      return result;
    }
    for (SoyTypeProvider provider : typeProviders) {
      result = provider.getType(typeName, this);
      if (result != null) {
        return result;
      }
    }
    return null;
  }

  /**
   * Factory function which creates a list type, given an element type.
   * This folds list types with identical element types together, so asking for the same element
   * type twice will return a pointer to the same type object.
   *
   * @param elementType The element type of the list.
   * @return The list type.
   */
  public ListType getOrCreateListType(SoyType elementType) {
    return listTypes.intern(ListType.of(elementType));
  }

  /**
   * Factory function which creates a map type, given a key and value type.
   * This folds map types with identical key/value types together, so asking for the same key/value
   * type twice will return a pointer to the same type object.
   *
   * @param keyType The key type of the map.
   * @param valueType The value type of the map.
   * @return The map type.
   */
  public MapType getOrCreateMapType(SoyType keyType, SoyType valueType) {
    return mapTypes.intern(MapType.of(keyType, valueType));
  }

  /**
   * Factory function which creates a union type, given the member types.
   * This folds identical union types together.
   *
   * @param members The members of the union.
   * @return The union type.
   */
  public SoyType getOrCreateUnionType(Collection<SoyType> members) {
    SoyType type = UnionType.of(members);
    if (type instanceof UnionType) {
      type = unionTypes.intern((UnionType) type);
    }
    return type;
  }

  /**
   * Factory function which creates a union type, given the member types.
   * This folds identical union types together.
   *
   * @param members The members of the union.
   * @return The union type.
   */
  public SoyType getOrCreateUnionType(SoyType... members) {
    return getOrCreateUnionType(Arrays.asList(members));
  }

  /**
   * Factory function which creates a record type, given a map of fields.
   * This folds map types with identical key/value types together, so asking for
   * the same key/value type twice will return a pointer to the same type object.
   *
   * @param fields The map containing field names and types.
   * @return The record type.
   */
  public RecordType getOrCreateRecordType(Map<String, SoyType> fields) {
    return recordTypes.intern(RecordType.of(fields));
  }
}


text:
@implementation GCEffect

-(id) init {
	if ((self=[super init]) ) {
		_target = nil;
	}
	return self;
}

- (void)runEffectInView:(UIView *)view {
	_target = view;
}

- (void)removeEffectFromView:(UIView *)view {
	_target = view;
}

@end


text:
package com.hsjawanda.gaeobjectify.tests;

import static com.hsjawanda.gaeobjectify.repackaged.commons.lang3.StringUtils.EMPTY;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.google.common.base.Optional;
import com.hsjawanda.gaeobjectify.util.KeyValueUriInfo;
import com.hsjawanda.gaeobjectify.util.PositionalUriInfo;
import com.hsjawanda.gaeobjectify.util.PositionalUriParser;
import com.hsjawanda.gaeobjectify.util.UriParser;

/**
 * @author Harshdeep S Jawanda (hsjawanda@gmail.com)
 *
 */
public class UriParserTests {

	UriParser actionParser = UriParser.instance("/", true);

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testParseNullUri() {
		KeyValueUriInfo info = this.actionParser.parse((String) null, false);
		assertNotNull("The KeyValueUriInfo object was unexpectedly null.", info);
	}

	@Test
	public void testParseEmptyUri() {
		KeyValueUriInfo info = this.actionParser.parse(EMPTY, false);
		assertNotNull("The KeyValueUriInfo object was unexpectedly null.", info);
	}

	@Test
	public void testParseEmptyAction() {
		KeyValueUriInfo info = this.actionParser.parse("", false);
		assertNotNull("The KeyValueUriInfo object was unexpectedly null.", info);
		assertEquals(EMPTY, info.action);
	}

	@Test
	public void testParseWithTrailingSlash() {
		KeyValueUriInfo info = this.actionParser.parse("/action/", false);
		assertNotNull("The KeyValueUriInfo object was unexpectedly null.", info);
		assertEquals("action", info.action);
	}

	@Test
	public void testParseWithoutTrailingSlash() {
		KeyValueUriInfo info = this.actionParser.parse("/action", false);
		assertNotNull("The KeyValueUriInfo object was unexpectedly null.", info);
		assertEquals("action", info.action);
	}

	@Test
	public void testParseMixedCaseAction() {
		KeyValueUriInfo info = this.actionParser.parse("/ACTion", false);
		assertNotNull("The KeyValueUriInfo object was unexpectedly null.", info);
		assertEquals("ACTion", info.action);
	}

	@Test
	public void testParseMixedCaseOneKeyValue() {
		KeyValueUriInfo info = this.actionParser.parse("/ACTion/Key1/ValuE1", false);
		assertNotNull("The KeyValueUriInfo object was unexpectedly null.", info);
		assertTrue(info.containsParam("key1"));
		assertEquals("ValuE1", info.getParam("key1").orNull());
	}

	@Test
	public void testParseMixedCaseTwoKeyValue() {
		KeyValueUriInfo info = this.actionParser.parse("/ACTion/Key1/ValuE1/kEY2/VALUE2", false);
		assertNotNull("The KeyValueUriInfo object was unexpectedly null.", info);
		assertTrue(info.containsParam("key1"));
		assertTrue(info.containsParam("key2"));
		assertFalse(info.containsParam(null));
		assertEquals("VALUE2", info.getParam("key2").orNull());
	}

	@Test
	public void testParseMissingLastValue() {
		KeyValueUriInfo info = this.actionParser.parse("/ACTion/Key1/ValuE1/kEY2", false);
		assertNotNull("The KeyValueUriInfo object was unexpectedly null.", info);
		assertTrue(info.containsParam("key1"));
		assertTrue(info.containsParam("key2"));
		assertEquals(EMPTY, info.getParam("key2").orNull());
	}

	@Test
	public void testParsePositionalUri() {
		PositionalUriParser positionalParser = PositionalUriParser
				.instance("/photos/{profile}/{photoId}");
		Optional<PositionalUriInfo> info = positionalParser.parse("/photos/hsjawanda/lfauouekllfl",
				false);
		assertTrue(info.isPresent());
		assertEquals("hsjawanda", info.get().getParam("profile").get());
		assertEquals("lfauouekllfl", info.get().getParam("photoId").get());
	}

	@Test
	public void testParsePositionalUriFixedPartsOnly() {
		PositionalUriParser positionalParser = PositionalUriParser
				.instance("/photos/user/{profile}/{photoId}");
		Optional<PositionalUriInfo> info = positionalParser.parse("/photos/user/",
				true);
		assertTrue(info.isPresent());
		assertNull(info.get().getParam("profile").orNull());
		assertNull(info.get().getParam("photoId").orNull());
	}

	@Test
	public void testParsePositionalUriMismatch() {
		PositionalUriParser positionalParser = PositionalUriParser
				.instance("/photos/{profile}/{photoId}");
		Optional<PositionalUriInfo> info = positionalParser.parse("/photosa/hsjawanda/lfauouekllfl",
				false);
		assertFalse(info.isPresent());
	}

}


text:
@echo off
REM Change into the seattle_repy directory.
FOR /F "tokens=*" %%A IN ('cd') DO SET OrigDir=%%A
SET TargetPath=%~f0
SET seattle_repyDir=%TargetPath:install.bat=seattle_repy%
cd %seattle_repyDir%

install.bat %*

cd %OrigDir%


text:
'use strict';

const _ = require('lodash');
const express = require('express');
const path = require('path');
const logger = require('morgan');
const bodyParser = require('body-parser');
const multipart = require('connect-multiparty');

const routes = require('./routes/index');

const app = express();

/* eslint-disable import/no-dynamic-require, global-require */

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');

app.use(logger('dev'));
app.use(multipart());
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, '../public')));

app.use(require('./middleware/extract-client-oauth2')());

require('./middleware/oauthifizer')(app);
require('./middleware/restifizer')(app);
require('./middleware/restifizer-files')(app);

// init restifizer

app.use('/', routes);

require('./middleware/handle-errors')(app);

/* eslint-enable import/no-dynamic-require, global-require */

module.exports = app;


text:
import { moduleFor, test } from 'ember-qunit';

moduleFor('route:yarn-component-instance/info', 'Unit | Route | yarn component instance/info', {
  // Specify the other units that are required for this test.
  // needs: ['controller:foo']
});

test('it exists', function(assert) {
  let route = this.subject();
  assert.ok(route);
});


text:
Function EliminateSuffixFromLastName($LastName) {
	$temp1 = $LastName.Split(",")
	If ( $temp1.length -gt 1 ) {
		$LastName = $temp1[0]
	} Else {
		$temp2 = $LastName.Split(" ")
		If ( $temp2.length -gt 1 ) {
			$LastName = $temp2[0]
		}
	}

	return $LastName
}

#This function checks to see if a user exists.
# If it does exist, it updates it's information and moves it to the correct OU
# If it does not exist, it creates the user with the correct info and in the correct OU
Function CreateOrUpdateUsers($Users) {
	$Objs =@() #blank array to hold output for CSV
	ForEach($User in $Users){
        # If the user already exists, check for any updates and if there are any, make them
		If(dsquery user -samid $User.sAMAccountName) {
            $ComparisonUser = Get-ADUser $User.sAMAccountName -properties "*"
            If (Compare-Object -ReferenceObject $ComparisonUser -DifferenceObject $User -Property SamAccountName,GivenName,SurName,DisplayName,EmailAddress,UserPrincipalName,EmployeeId,Department,Organization,Path)
            {
			    $HashOfParameters = @{
				    Identity = $User.sAMAccountName
				    givenName = $User.givenName
				    surName = $User.surName
				    displayName = $User.displayName
				    emailAddress = $User.emailAddress
				    userPrincipalName = $User.userPrincipalName
				    employeeID = $User.employeeID
				    department = $User.department
				    organization = $User.organization
				    enable = $True
			    }
			    Set-Aduser @HashOfParameters

			    $HashOfParameters = @{
				    TargetPath = $User.path
			    }
			    Get-ADUser $User.sAMAccountName | Move-ADObject @HashOfParameters
            }

		} Else {
			#$SecurePassword = $User.password | ConvertTo-SecureString -AsPlainText -Force
			$HashOfParameters = @{
				sAMAccountName = $User.sAMAccountName
				givenName = $User.givenName
				name = $User.displayName
				surName = $User.surName
				displayName = $User.displayName
				emailAddress = $User.emailAddress
				userPrincipalName = $User.userPrincipalName
				path = $User.path
				employeeID = $User.employeeID
				department = $User.department
				organization = $User.organization
				accountPassword = $User.password | ConvertTo-SecureString -AsPlainText -Force
				enabled = $True
			}
			New-ADUser @HashOfParameters

			#Create the contents of a CSV that will be output of only the newly created users.
			#These users will need to be run through a password reset once they've been added
			#to Google Apps with Google Apps Directory Sync (GADS)
			$HashOfParameters.Add("password", $User.password)
			$Obj = New-Object -TypeName PSObject -Property $HashOfParameters
			$Objs += $Obj
			#trigger a password change so new default password is synced with Google Apps
			#won't work because user does not yet exist in google docs
			#net user $User.sAMAccountName $User.password
		}
	}
	Return $Objs
}

Function DisableUsersNotInSIS ($Users) {

}


text:
My gh-pages (blog) refer to Java - build with github pages, jekyll theme minimal mistakes

# Access here:
https://sonnyit.github.io/java/


text:
<!doctype html>

<meta content="text/html; charset=UTF-8" http-equiv="content-type" />

<title>Fobo Bootstrap Demo</title>

        <link data-lift="head" rel="stylesheet" type='text/css' href="/classpath/fobo/prettify.css">

        <link data-lift="head" rel="stylesheet" type='text/css' href="/classpath/fobo/bootstrap.css"/>
        <link data-lift="head" type="text/css" rel="stylesheet" href="/classpath/fobo/bootstrap-theme.css">
        <link data-lift="head" rel="stylesheet" href="/classpath/fobo/font-awesome.css">

		<link data-lift="head" rel="stylesheet" type='text/css' href="/resources/css/libo-app.css"/>

		 Embedding the topbar here

		   Embedding
			header section

		   Embedding
			main section

           Embedding
			demo section

           Embedding
			footer section


text:
package io.muvr.exercise

import akka.actor.{ActorLogging, Props}
import akka.contrib.pattern.ShardRegion
import akka.persistence.PersistentActor
import io.muvr.{UserId, UserMessage}

import scalaz.\/

/**
 * Companion for the ``UserExerciseProcessor`` actor. Defines the fields and messages.
 */
object UserExerciseProcessor {
  val shardName = "user-exercise-processor"
  val props: Props = Props[UserExerciseProcessor]

  val idExtractor: ShardRegion.IdExtractor = {
    case ExerciseSubmitEntireResistanceExerciseSession(userId, eres) ⇒ (userId.toString, eres)
    case ExerciseSubmitSuggestions(userId, suggestions)              ⇒ (userId.toString, suggestions)
  }

  val shardResolver: ShardRegion.ShardResolver = {
    case x: UserMessage ⇒ x.shardRegion()
  }

  /**
   * Submit the entire resistance exercise session
   *
   * @param userId the user identity
   * @param eres the entire session
   */
  case class ExerciseSubmitEntireResistanceExerciseSession(userId: UserId, eres: EntireResistanceExerciseSession) extends UserMessage

  /**
   * Submit exercise suggestions
   * @param userId the user identity
   * @param suggestions the suggestions
   */
  case class ExerciseSubmitSuggestions(userId: UserId, suggestions: Suggestions) extends UserMessage
}

/**
 * The cluster-sharded persistent actor that processes the user messages
 */
class UserExerciseProcessor extends PersistentActor with ActorLogging {
  // user reference and notifier
  private val userId = UserId(self.path.name)

  // per-user actor
  override val persistenceId: String = UserExerciseProcessorPersistenceId(userId).persistenceId

  // no recovery behaviour just yet
  override def receiveRecover: Receive = {
    case x ⇒ println(x)
  }

  // only deal with sessions
  override def receiveCommand: Receive = {
    case eres@EntireResistanceExerciseSession(id, session, examples) ⇒
      println(eres)
      persist(eres) { _ ⇒
        sender() ! \/.right(id)
      }

    case Suggestions(suggestions) ⇒
      println(s"Got $suggestions")
  }

}


text:
<resources>

    <!-- Before API 21, FloatingActionButton draws its own shadow and so takes up much more
         space. Reduce margins to get as close as possible to the desired layout. -->
    <dimen name="fab_main_margin_right">4dp</dimen>
    <dimen name="fab_main_margin_inner">0dp</dimen>
    <dimen name="fab_main_margin_bottom">0dp</dimen>
    <dimen name="fab_dialog_margin_inner">0dp</dimen>
    <dimen name="fab_dialog_margin_top">0dp</dimen>
    <dimen name="fab_dialog_margin_bottom">0dp</dimen>

    <dimen name="qr_resolution">150dp</dimen>

</resources>


text:
#ifndef WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_LINUX_VIDEO_CAPTURE_LINUX_H_
#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_LINUX_VIDEO_CAPTURE_LINUX_H_

#include <memory>

#include "webrtc/base/criticalsection.h"
#include "webrtc/base/platform_thread.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/video_capture/video_capture_impl.h"

namespace webrtc
{
namespace videocapturemodule
{
class VideoCaptureModuleV4L2: public VideoCaptureImpl
{
public:
    VideoCaptureModuleV4L2();
    virtual ~VideoCaptureModuleV4L2();
    virtual int32_t Init(const char* deviceUniqueId);
    virtual int32_t StartCapture(const VideoCaptureCapability& capability);
    virtual int32_t StopCapture();
    virtual bool CaptureStarted();
    virtual int32_t CaptureSettings(VideoCaptureCapability& settings);

private:
    enum {kNoOfV4L2Bufffers=4};

    static bool CaptureThread(void*);
    bool CaptureProcess();
    bool AllocateVideoBuffers();
    bool DeAllocateVideoBuffers();

    // TODO(pbos): Stop using unique_ptr and resetting the thread.
    std::unique_ptr<rtc::PlatformThread> _captureThread;
    rtc::CriticalSection _captureCritSect;

    int32_t _deviceId;
    int32_t _deviceFd;

    int32_t _buffersAllocatedByDevice;
    int32_t _currentWidth;
    int32_t _currentHeight;
    int32_t _currentFrameRate;
    bool _captureStarted;
    VideoType _captureVideoType;
    struct Buffer
    {
        void *start;
        size_t length;
    };
    Buffer *_pool;
};
}  // namespace videocapturemodule
}  // namespace webrtc

#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_LINUX_VIDEO_CAPTURE_LINUX_H_


text:
<?php
return [
    [
        'sectionName' => 'FakeThree module',
        'configurationView' => 'src/views/_configuration.php',
        'configurationModel' => 'fakedev\FakeThree\models\FakeConfiguration',
    ],
];


text:
These instructions are for setting up Apache to retrieve pages from Gunicorn in order to workaround mod_wsgi not working.
Note that **Gunicorn does not work on Windows** at the time of writing (October 3rd, 2016).

For nginx instructions refer to [Gunicorn's example](http://gunicorn.org/#deployment).

## Installing Gunicorn
`pip install gunicorn`

## Running Gunicorn
On Linux, make a .sh with:
```bash
#!/bin/bash
gunicorn -w 1 app:app -b 0.0.0.0:8080
```
More information on configuring Gunicorn can be found [in the documentation for Gunicorn](http://docs.gunicorn.org/en/stable/settings.html).

## Configuring Apache
We'll need to specify the directory for the `static` resources so that images and such work correctly, and are served by Apache instead of Gunicorn.
```apache
<VirtualHost oursite.com>
  LoadModule proxy_module modules/mod_proxy.so
  LoadModule proxy_http_module modules/mod_proxy_http.so

  # Tells apache where /static/ should go
  Alias /static/ /full/path/to/flask/app/static/

  # Proxy everything to gunicorn EXCEPT /static and favicon.ico
  ProxyPass /favicon.ico !
  ProxyPass /static !
  ProxyPass /stats http://oursite.com:8080/
  ProxyPassReverse /stats http://oursite.com:8080/

</VirtualHost>
```

Once this is set up, asssuming Gunicorn is running, browsing to `http://oursite.com/stats` should serve this app via Gunicorn.

# Deploying on Windows via Gevent
Since Gunicorn doesn't work for Windows, here's how to do the above with Gevent:
```
pip install gevent
```

## Running Gevent
Note: There is an example script in the repo titled `example-gevent-deploy.py` which is identical to what I have below here. Use that if you'd like.
Make a new python script at the root of the project folder.
```python
from gevent.wsgi import WSGIServer
from app import app

http_server = WSGIServer(('', 8080), app)
http_server.serve_forever()
```
For instructions on configuring the Apache reverse proxy, [see above](#Configuring Apache).


text:
using System;
using System.Xml.Serialization;
using System.Collections;
using System.Collections.Generic;
using Newtonsoft.Json;
using JdSdk.Request;
using JdSdk.Response.Price;

namespace JdSdk.Request.Price
{
    public class WarePriceGetRequest : JdRequestBase<WarePriceGetResponse>
    {
        public String SkuId
        {
            get;
            set;
        }

        public override String ApiName
        {
            get{ return "jingdong.ware.price.get"; }
        }

        protected override void PrepareParam(IDictionary<String, Object> paramters)
        {
            paramters.Add("sku_id" ,this.SkuId);
        }

    }

}


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

public class PlantProjectile : MonoBehaviour
{
    Vector2 shootPos;
    [SerializeField]
    Vector2 shootDirection;

    void Start ()
    {

    }

    void Update ()
    {
        this.transform.Translate(new Vector3(shootDirection.x, shootDirection.y, 0) * 7 * Time.deltaTime);
	}

    public void ShotDirection(Vector2 direction)
    {
        shootDirection = direction;
    }
}


text:
package treeton.gui;

import com.jgoodies.plaf.plastic.PlasticLookAndFeel;
import com.jgoodies.plaf.plastic.theme.SkyBlue;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import treeton.core.config.BasicConfiguration;
import treeton.core.config.GuiConfiguration;
import treeton.core.config.context.ContextConfiguration;
import treeton.core.config.context.ContextConfigurationXMLNoSchemaImpl;
import treeton.core.config.context.ContextException;
import treeton.core.model.TreetonModelException;
import treeton.gui.labelgen.DefaultLabelGeneratorConfiguration;
import treeton.gui.texteditor.TextEditorPanel;

import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class TextEditorApp {
    public static void main(String[] args) throws ContextException {
        (new TextEditorApp()).run(args);
    }

    public void run(String[] args) throws ContextException {
        try {
            BasicConfigurator.resetConfiguration();
            BasicConfigurator.configure();
            Logger.getRootLogger().setLevel(Level.INFO);

            BasicConfiguration.setRootURL(getClass().getResource("/resources/conf/"));
            BasicConfiguration.createInstance();
            ContextConfiguration.registerConfigurationClass(ContextConfigurationXMLNoSchemaImpl.class);
            ContextConfiguration.createInstance();
            GuiConfiguration.createInstance();
            DefaultLabelGeneratorConfiguration.getInstance().configure();
        } catch (Exception e) {
            e.printStackTrace();
        }

        setLookAndFeel();

        JFrame frame = new JFrame("Analysis results");
        TextEditorPanel panel = new TextEditorPanel(null);

        if (args.length > 1) {
            StringTokenizer tokenizer = new StringTokenizer(args[1], ";");
            Set<String> types = new HashSet<String>();

            while (tokenizer.hasMoreTokens()) {
                types.add(tokenizer.nextToken());
            }

            panel.changeTypesSelection(types);
        }

        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();

        frame.setContentPane(panel);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setResizable(true);
        frame.setBounds(0, 0, screenSize.width, screenSize.height);

        frame.setVisible(true);

        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            //
        }

        if (args.length > 0) {
            try {
                panel.importXml(new File(args[0]), true);
            } catch (Exception e) {
                e.printStackTrace();
            }

            frame.setTitle(panel.getSourceText());

            if ("/DeleteAfterLaunch".equals(args[args.length - 1])) {
                //noinspection ResultOfMethodCallIgnored
                new File(args[0]).delete();
            }
        }

        if (args.length > 2) {
            Integer focusIntervalStart = Integer.valueOf(args[2]);
            try {
                panel.scrollToPosition(focusIntervalStart);
            } catch (TreetonModelException e) {
                e.printStackTrace();
            }
        }
    }

    protected void setLookAndFeel() {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                try {
                    PlasticLookAndFeel.setMyCurrentTheme(new SkyBlue());
                    UIManager.put("jgoodies.popupDropShadowEnabled", Boolean.TRUE);
                    UIManager.setLookAndFeel(new
                            com.jgoodies.plaf.plastic.PlasticXPLookAndFeel());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    public void info(String s) {
        System.out.println("Treeton: " + s);
    }

    public void error(String s, Throwable e) {
        System.err.println("Treeton: " + s);
        e.printStackTrace();
    }
}


text:
package org.springframework.cloud.contract.verifier.builder;

import java.util.regex.Pattern;

import org.apache.commons.text.StringEscapeUtils;

interface GroovyComparisonBuilder extends ComparisonBuilder {

	ComparisonBuilder SPOCK_HTTP_INSTANCE = (GroovyComparisonBuilder) () -> SpockRestAssuredBodyParser.INSTANCE;

	ComparisonBuilder JAXRS_HTTP_INSTANCE = (GroovyComparisonBuilder) () -> JaxRsBodyParser.INSTANCE;

	ComparisonBuilder SPOCK_MESSAGING_INSTANCE = (GroovyComparisonBuilder) () -> SpockMessagingBodyParser.INSTANCE;

	@Override
	default String assertThat(String object) {
		return object;
	}

	@Override
	default String isEqualToUnquoted(String unquoted) {
		return " == " + unquoted;
	}

	@Override
	default String isEqualTo(Number number) {
		String numberString = number instanceof Long ? number.toString() + "L" : number.toString();
		return " == " + numberString;
	}

	@Override
	default String matches(String pattern) {
		return matchesEscaped(bodyParser().quotedShortText(pattern));
	}

	@Override
	default String matches(Pattern pattern) {
		String escapedPattern = StringEscapeUtils.escapeJava(pattern.pattern());
		return matchesEscaped(escapedPattern);
	}

	@Override
	default String matchesEscaped(String pattern) {
		return " ==~ java.util.regex.Pattern.compile(" + bodyParser().quotedEscapedShortText(pattern) + ")";
	}

	@Override
	default String isNotNull() {
		return " != null";
	}

}


text:
{{#user}}

Account

Password

Notifications

Goodies

Settings

			<form method="POST" action="/api/user">
				<fieldset class="fld">
					<legend>Custom URL</legend>
					<input type="text" name="handle" placeholder="e.g. john_smith_83" maxlength="18" value="{{handle}}">

http://openwhyd.org/john_smith_83

				</fieldset>
				<fieldset class="fld">
					<legend>Email</legend>
					<input type="text" name="email" placeholder="e.g. john.smith@provider.com" value="{{email}}">

				</fieldset>
				<fieldset class="fld">
					<legend>Social</legend>

					{{#pref}}

							<input type="checkbox" name="ogAdd" value="1" data-checked="{{ogAdd}}">
							Publish added tracks to Facebook

							<input type="checkbox" name="ogLik" value="1" data-checked="{{ogLik}}">
							Publish liked tracks to Facebook

					{{/pref}}
				</fieldset>
				<fieldset class="fld">
					<legend>Last.fm</legend>

							Scrobbling played tracks to your account:
							username

							Disconnect your last.fm account

				</fieldset>
				<input type="submit" class="greenButton" value="Save changes" />
			</form>
			Delete your account

			<form method="POST" action="/api/user">
				<fieldset class="fld">
					<legend>Current password:</legend>
					<input type="password" name="old" />

				</fieldset>
				<fieldset class="fld pwdRepeat nomargin">
					<legend>New password:</legend>
					<input type="password" name="new1" />

				</fieldset>
				<fieldset class="fld pwdRepeat">
					<legend>Confirm new password:</legend>
					<input type="password" name="new2" />

				</fieldset>

error

				<input type="submit" class="greenButton" value="Save changes" />
			</form>

			<form method="POST" action="/api/user">
				<fieldset class="fld">
					<legend>Send me an email when:</legend>
					{{#pref}}

						<input type="checkbox" name="emLik" value="1" data-checked="{{emLik}}">
						Someone likes one of my tracks

						<input type="checkbox" name="emAdd" value="1" data-checked="{{emAdd}}">
						Someone adds one of my tracks

						<input type="checkbox" name="emSub" value="1" data-checked="{{emSub}}">
						Someone subscribes to me

						<input type="checkbox" name="emCom" value="1" data-checked="{{emCom}}">
						Someone comments my tracks

						<input type="checkbox" name="emMen" value="1" data-checked="{{emMen}}">
						Someone mentions me in a comment

						<input type="checkbox" name="emRep" value="1" data-checked="{{emRep}}">
						Someone replies to one of your comments

How often?

						<input type="radio" name="emFreq" value="7">Weekly
						<input type="radio" name="emFreq" value="1">Daily
						<input type="radio" name="emFreq" value="0">Instantly

					{{/pref}}
				</fieldset>
				<input type="submit" class="greenButton" value="Save changes" />
			</form>

Show your music pride: you are among the best of the newest when it comes to discovering music. So share it!

1

Select your badge:

Subscribe to me on whyd

2

Copy this HTML embed code:

				<textarea readonly="readonly" onclick="this.focus();this.select();(this.innerText.createTextRange()).execCommand('Copy');"></textarea>

3

Paste it into your website to create a link to your OpenWhyd page!

{{/user}}


text:
@interface YUCIReflectedTileROICalculator : NSObject

+ (CGRect)ROIForDestinationRect:(CGRect)destRect inputImageExtent:(CGRect)inputExtent mode:(YUCIReflectedTileMode)mode;

@end


text:
<html>
<body>
	<input type="button" wicket:id="button" value="Show Modal Chart"/>
	<div wicket:id="modalWindow">MODAL WINDOW</div>
</body>

</html>


text:
package com.srch2.android.sdk.sandbox;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.srch2.android.sdk.Indexable;
import com.srch2.android.sdk.SQLiteIndexable;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;

public class DatabaseHelper extends SQLiteOpenHelper {

    public SqliteIdx idx;
    public static final String TAG = "s2sb:: Sandbox-Database";

    public SqliteIdx getIndexable() { return idx; }

    public static class SQLiteSchema {
        public static final String DATABASE_NAME = "demo";
        public static final int DATABASE_VERSION = 1; // can leave unchanging since this is just a demo
        public static final String TABLE_NAME = "company";
        public static final String COLUMN_PRIMARY_KEY = "_id";
        public static final String COLUMN_NAME = "name";
        public static final String COLUMN_AGE = "age";
        public static final String COLUMN_ADDRESS = "address";
        public static final String COLUMN_SALARY = "salary";
        public static final String COLUMN_LONGITUDE = "longitude";
        public static final String COLUMN_LATITUDE = "latitude";
    }

    public static final String getCreateTableString() {
        return "CREATE TABLE " + SQLiteSchema.TABLE_NAME + "(" +
                SQLiteSchema.COLUMN_PRIMARY_KEY + " INTEGER PRIMARY KEY NOT NULL, " +
                SQLiteSchema.COLUMN_NAME + " TEXT NOT NULL, " +
                SQLiteSchema.COLUMN_AGE + " INTEGER NOT NULL, " +
                SQLiteSchema.COLUMN_ADDRESS + " TEXT, " +
                SQLiteSchema.COLUMN_SALARY + " REAL, " +
                "Blobo BLOB, " +
                SQLiteSchema.COLUMN_LATITUDE + " REAL, " +
                SQLiteSchema.COLUMN_LONGITUDE + " REAL" +

                " )";
    }

    public DatabaseHelper(Context context) {
        super(context, SQLiteSchema.DATABASE_NAME, null, SQLiteSchema.DATABASE_VERSION); // assuming version will never change,
        SQLiteDatabase db = getReadableDatabase();

        idx = new SqliteIdx(this);

        db.close();

    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        // this method is called anytime time an operation on the database this helper backs happens if the database does not already exist
        Log.d(TAG, "onCreate");
        db.execSQL(getCreateTableString());
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // if the value of DATABASE_VERSION passed in super(context, Schema.DATABASE_NAME, null, Schema.DATABASE_VERSION);
        // in constructor is changed, this method will be called: used by the developer to dynamically change the schema if underlying data set changes
        db.execSQL("DROP TABLE IF EXISTS " + SQLiteSchema.TABLE_NAME);
        onCreate(db);
    }

    // example usage of db backed by this sqlite open helper
    public void foo() {
        // Be sure to close the database after you open it
        SQLiteDatabase db = getWritableDatabase();
        try {
            // query, insert, etc etc
        } finally {
            if (db != null) {
                db.close();
            }
        }
    }

    public void insertRecords() {
        Log.d(TAG, "insertRecords");

        SQLiteDatabase db = getReadableDatabase();

        Cursor c = db.query(SQLiteSchema.TABLE_NAME, null, null, null, null, null, null);

        int count = 0;
        if (c != null) {
            count = c.getCount();
            c.close();
            Log.d(TAG, "cursor count " + c.getCount());
        } else {
            Log.d(TAG, "something wrong!");
        }

        db.close();

        if (count == 100) {
            return;
        }

        db = getWritableDatabase();
        try {
            ContentValues cv = new ContentValues();
            for (int i = 0; i < 100; i++) {
                cv.clear();
                cv.put(SQLiteSchema.COLUMN_PRIMARY_KEY, i);
                cv.put(SQLiteSchema.COLUMN_AGE, i);
                cv.put(SQLiteSchema.COLUMN_NAME, "name " + RandomStringUtil.getRandomString(10));
                cv.put(SQLiteSchema.COLUMN_ADDRESS, "address " + RandomStringUtil.getRandomString(20));
                cv.put(SQLiteSchema.COLUMN_SALARY, (double) i);
                cv.put(SQLiteSchema.COLUMN_LATITUDE, (double) (Math.random() * 50));
                cv.put(SQLiteSchema.COLUMN_LONGITUDE, (double) (Math.random() * 50));
                db.insert(SQLiteSchema.TABLE_NAME, null, cv);
            }
        } catch (Exception e) {
            Log.d(TAG, "OOPS threw exception " + e.getClass().getSimpleName() + " " + e.getMessage());
            e.printStackTrace();
        } finally {
            if (db != null) {
                db.close();
            }
        }

        db = getReadableDatabase();

        c = db.query(SQLiteSchema.TABLE_NAME, null, null, null, null, null, null);

        if (c != null) {
            Log.d(TAG, "cursor count " + c.getCount());
            c.close();
        } else {
            Log.d(TAG, "something wrong!");
        }

        db.close();

        Log.d(TAG, "insertRecords - finished");
    }

    static public ArrayList<SearchResultsAdapter.SearchResultItem> wrap(ArrayList<JSONObject> jsonResultsToWrap) {
        ArrayList<SearchResultsAdapter.SearchResultItem> newResults = new ArrayList<SearchResultsAdapter.SearchResultItem>();
        for (JSONObject jsonObject : jsonResultsToWrap) {
            Log.d("SEARCH RESULT OBJECT", jsonObject.toString());
            SearchResultsAdapter.SearchResultItem searchResult = null;
            try {

                JSONObject originalRecord = jsonObject.getJSONObject(Indexable.SEARCH_RESULT_JSON_KEY_RECORD);

                String title = originalRecord.getString(DatabaseHelper.SQLiteSchema.COLUMN_NAME);

                Log.d("Highlight", "title is " + title);

                if (title == null) {
                    title =  "null title";
                }

                searchResult = new SearchResultsAdapter.SearchResultItem(title, " ", " ");
            } catch (JSONException oops) {
                oops.printStackTrace();
                continue;
            }

            if (searchResult != null) {
                newResults.add(searchResult);
            }
        }
        return newResults;
    }

    public static class SqliteIdx extends SQLiteIndexable {

        SQLiteOpenHelper helper;

        public SqliteIdx(SQLiteOpenHelper h) {
            helper = h;
        }

        @Override
        public String getIndexName() {
            return SQLiteSchema.TABLE_NAME;
        }

        @Override
        public SQLiteOpenHelper getSQLiteOpenHelper() {
            return helper;
        }

        @Override
        public String getTableName() {
            return SQLiteSchema.TABLE_NAME;
        }

        @Override
        public String getDatabaseName() {
            return SQLiteSchema.DATABASE_NAME;
        }

        @Override
        public String getLatitudeColumnName() {
            return SQLiteSchema.COLUMN_LATITUDE;
        }

        @Override
        public String getLongitudeColumnName() {
            return SQLiteSchema.COLUMN_LONGITUDE;
        }

        @Override
        public String getRecordBoostColumnName() {
            return SQLiteSchema.COLUMN_SALARY;
        }

        @Override
        public void onIndexReady() {
            super.onIndexReady();
        }
    }

}


text:
/* Fixes for IE 7 bugs */

.wp-editor-wrap .wp-editor-container textarea.wp-editor-area {
	width: 97%;
}

#post-body.columns-2 #postbox-container-1 {
	padding-left: 19px;
}

.welcome-panel .wp-badge {
	position: absolute;
}

.welcome-panel .welcome-panel-column {
	margin: 0 -25px 0 4%;
}

#wp-fullscreen-title {
	width: 97%;
}

#wp_mce_fullscreen_ifr {
	background-color: #f9f9f9;
}

#wp-fullscreen-tagline {
	color: #888;
	font-size: 14px;
}

#adminmenushadow {
	display: none;
}

#adminmenuback {
	left: 0;
	background-image: none;
}

#adminmenuwrap {
	position: static;
}

#adminmenu {
	position: relative;
}

#adminmenu li.wp-menu-separator,
#adminmenu li.wp-menu-separator-last {
	font-size: 1px;
	line-height: 1;
}

#adminmenu a.menu-top {
	border-bottom: 0 none;
	border-top: 1px solid #ddd;
}

#adminmenu .separator {
	font-size: 1px;
	line-height: 1px;
}

#adminmenu .wp-submenu ul {
	margin: 0;
}

.folded #adminmenu .wp-submenu ul {
	margin-left: 5px;
}

#adminmenu li.menu-top {
	margin-bottom: -2px;
}

#adminmenu li.wp-not-current-submenu:hover .wp-menu-arrow {
	display: none;
}

#wpcontent #adminmenu .wp-submenu li.wp-submenu-head {
	padding: 3px 4px 4px 10px;
	zoom: 100%;
}

.js.folded #adminmenu .menu-top {
	height: 30px;
}

.js.folded #adminmenu .wp-submenu {
	margin: -1px 0 0 0;
}

.js.folded #adminmenu li.menu-top {
	display: block;
	zoom: 100%;
}

ul#adminmenu {
	z-index: 99;
}

#adminmenu li.menu-top a.menu-top {
	min-width: auto;
	width: auto;
}

#wpcontent #adminmenu li.wp-has-current-submenu a.wp-has-submenu {
	font-style: normal;
}

#wpcontent #adminmenu .wp-submenu li {
	padding: 0;
}

#collapse-menu {
	line-height: 23px;
}

#wpadminbar .ab-comments-icon {
	padding-top: 7px;
}

table.fixed th,
table.fixed td {
	border-top: 1px solid #ddd;
}

#wpbody-content input.button,
#wpbody-content input.button-primary,
#wpbody-content input.button-secondary,
#wpbody-content input.button-highlighted {
	overflow: visible;
}

#dashboard-widgets #dashboard_quick_press form p.submit #publish {
	float: none;
}

#dashboard-widgets h3 a {
	height: 14px;
	line-height: 14px;
}

#dashboard_browser_nag {
	color: #fff;
}

#dashboard_browser_nag .browser-icon {
	position: relative;
}

.tablenav-pages .current-page {
	vertical-align: middle;
}

#wpbody-content .postbox {
	border: 1px solid #dfdfdf;
}

#wpbody-content .postbox h3 {
	margin-bottom: -1px;
}

.major-publishing-actions,
.wp-submenu,
.wp-submenu li,
.wp-menu-toggle,
#template,
#template div,
#editcat,
#addcat {
	zoom: 100%;
}

.wp-menu-arrow {
	height: 28px;
}

.submitbox {
	margin-top: 10px;
}

/* Inline Editor */
#wpbody-content .quick-edit-row-post .inline-edit-col-left {
	width: 39%;
}

#wpbody-content .inline-edit-row-post .inline-edit-col-center {
	width: 19%;
}

#wpbody-content .quick-edit-row-page .inline-edit-col-left {
	width: 49%;
}

#wpbody-content .bulk-edit-row .inline-edit-col-left {
	width: 29%;
}

.inline-edit-row p.submit {
	zoom: 100%;
}

.inline-edit-row fieldset label span.title {
	display: block;
	float: left;
	width: 5em;
}

.inline-edit-row fieldset label span.input-text-wrap {
	margin-left: 0;
	zoom: 100%;
}

#wpbody-content .inline-edit-row fieldset label span.input-text-wrap input {
	line-height: 130%;
}

#wpbody-content .inline-edit-row .input-text-wrap input {
	width: 95%;
}

#wpbody-content .inline-edit-row .input-text-wrap input.inline-edit-password-input {
	width: 8em;
}
/* end Inline Editor */

#titlediv #title {
	width: 98%;
}

a.button {
	line-height: 1.4em;
	margin: 1px;
	padding: 2px 6px;
}

#screen-options-wrap {
	overflow: hidden;
}

#the-comment-list .comment-item,
#post-status-info,
#wpwrap,
#wrap,
#postdivrich,
#postdiv,
#poststuff,
.metabox-holder,
#titlediv,
#post-body,
#editorcontainer,
.tablenav,
.widget-liquid-left,
.widget-liquid-right,
#widgets-left,
.widgets-sortables,
#dragHelper,
.widget .widget-top,
.widget,
.widget-control-actions,
.tagchecklist,
#col-container,
#col-left,
#col-right,
.fileedit-sub {
	display: block;
	zoom: 100%;
}

p.search-box {
	position: static;
	float: right;
	margin: -3px 0 4px;
}

#editorcontainer #content {
	overflow: auto;
	margin: auto;
	width: 98%;
}

form#template div {
	width: 100%;
}

.wp-editor-container .quicktags-toolbar input {
	overflow: visible;
	padding: 0 4px;
}

#poststuff h2 {
	font-size: 1.6em;
}

#bh {
	margin: 7px 10px 0 0;
	float: right;
}

/* without this dashboard widgets appear in one column for some screen widths */
div#dashboard-widgets {
	padding-right: 1px;
}

.tagchecklist span, .tagchecklist span a {
	display: inline-block;
	display: block;
}

.tagchecklist span a {
	margin: 4px 0 0 -9px;
}

.tablenav .button-secondary,
.nav .button-secondary {
	padding-top: 2px;
	padding-bottom: 2px;
}

.tablenav select {
	font-size: 13px;
	display: inline-block;
	vertical-align: top;
	margin-top: 2px;
}

.tablenav .actions select {
	width: 155px;
}

table.ie-fixed {
	table-layout: fixed;
}

.widefat tr, .widefat th {
	margin-bottom: 0;
	border-spacing: 0;
}

.widefat th input {
	margin: 0 0 0 5px;
}

.widefat .check-column {
	padding: 6px 0 2px;
}

.widefat tbody th.check-column {
	padding: 4px 0 22px;
}

.widefat {
	empty-cells: show;
	border-collapse: collapse;
}

.tablenav a.button-secondary {
	display: inline-block;
	padding: 2px 5px;
}

.inactive-sidebar .widgets-sortables {
	padding-bottom: 8px;
}

#available-widgets .widget-holder {
	padding-bottom: 65px;
}

#widgets-left .inactive {
	padding-bottom: 10px;
}

.widget-liquid-right .widget,
.inactive-sidebar .widget {
	position: relative;
}

#wpcontent .button-primary-disabled {
	color: #9FD0D5;
	background: #298CBA;
}

#wpcontent #ajax-loading,
#wpcontent .ajax-loading {
	vertical-align: baseline;
}

#the-comment-list .unapproved tr,
#the-comment-list .unapproved td {
	background-color: #ffffe0;
}

.imgedit-submit {
	width: 300px;
}

#nav-menus-frame,
#wpbody,
.menu li {
	zoom: 100%;
}

#update-nav-menu #post-body {
	overflow:hidden;
}

.menu li {
	min-width: 100%;
}

.menu li.sortable-placeholder {
	min-width: 400px;
}

.about-wrap img.element-screenshot {
	padding: 2px;
}

.about-wrap .feature-section img,
.about-wrap .feature-section .image-mask {
	border-width: 1px;
	border-style: solid;
}

.about-wrap .feature-section.three-col img {
	margin-left: 0;
}

.available-theme {
	display: inline;
}

.available-theme ul {
	margin: 0;
}

.about-wrap .three-col-images img {
	margin: 0 0.6% 10px;
}

.about-wrap .three-col-images .last-feature,
.about-wrap .three-col-images .first-feature {
	float: none;
}

/* IE6 leftovers */
* html .row-actions {
	visibility: visible;
}

* html div.widget-liquid-left,
* html div.widget-liquid-right {
	display: block;
	position: relative;
}

* html #editorcontainer {
	padding: 0;
}

* html #poststuff h2 {
	margin-left: 0;
}

* html .stuffbox,
* html .stuffbox input,
* html .stuffbox textarea {
	border: 1px solid #DFDFDF;
}

* html .feature-filter .feature-group li {
	width: 145px;
}

* html .widget-top .widget-title-action a {
	background: url("../images/menu-bits.gif?ver=20100610") no-repeat scroll 0 -110px;
}

* html div.widget-liquid-left {
	width: 99%;
}

* html .widgets-sortables {
	height: 50px;
}

* html a#content_resize {
	right: -2px;
}

* html .widget-title h4 {
	width: 205px;
}

* html #removing-widget .in-widget-title {
	display: none;
}

* html .media-item .pinkynail {
	height: 32px;
	width: 40px;
}

* html .describe .field input.text,
* html .describe .field textarea {
	width: 440px;
}

* html input {
	border: 1px solid #dfdfdf;
}

* html .meta-box-sortables .postbox .handlediv {
	background: transparent url(../images/menu-bits-vs.gif) no-repeat scroll left -111px;
}

* html .edit-box {
	display: inline;
}

* html .postbox-container .meta-box-sortables {
	height: 300px;
}

* html #wpbody-content #screen-options-link-wrap {
	display: inline-block;
	width: 150px;
	text-align: center;
}

* html #wpbody-content #contextual-help-link-wrap {
	display: inline-block;
	width: 100px;
	text-align: center;
}

* html #adminmenu {
	margin-left: -80px;
}

* html .folded #adminmenu {
	margin-left: -22px;
}

* html #wpcontent #adminmenu li.menu-top {
	display: inline;
	padding: 0;
	margin: 0;
}

* html #footer {
	margin: 0;
}

* html #wpcontent #adminmenu .wp-menu-open .wp-menu-toggle {
	background: none;
}

* html #wpcontent #adminmenu .wp-has-submenu .wp-menu-toggle {
	background: url(../images/menu-bits.gif?ver=20100610) no-repeat scroll left -109px;
}

* html #wpcontent #adminmenu li.wp-has-current-submenu .wp-menu-toggle {
	background: url(../images/menu-bits.gif?ver=20100610) no-repeat scroll left -206px;
}

* html #adminmenu div.wp-menu-image {
	height: 29px;
}


text:
package com.amazonaws.services.iot.model;

import java.io.Serializable;
import com.amazonaws.AmazonWebServiceRequest;

/**
 *

 * The input for the DescribeThing operation.
 *

 */
public class DescribeThingRequest extends AmazonWebServiceRequest implements
        Serializable, Cloneable {

    /**
     *

     * The name of the thing.
     *

     */
    private String thingName;

    /**
     *

     * The name of the thing.
     *

     *
     * @param thingName
     *        The name of the thing.
     */
    public void setThingName(String thingName) {
        this.thingName = thingName;
    }

    /**
     *

     * The name of the thing.
     *

     *
     * @return The name of the thing.
     */
    public String getThingName() {
        return this.thingName;
    }

    /**
     *

     * The name of the thing.
     *

     *
     * @param thingName
     *        The name of the thing.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public DescribeThingRequest withThingName(String thingName) {
        setThingName(thingName);
        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getThingName() != null)
            sb.append("ThingName: " + getThingName());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof DescribeThingRequest == false)
            return false;
        DescribeThingRequest other = (DescribeThingRequest) obj;
        if (other.getThingName() == null ^ this.getThingName() == null)
            return false;
        if (other.getThingName() != null
                && other.getThingName().equals(this.getThingName()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode
                + ((getThingName() == null) ? 0 : getThingName().hashCode());
        return hashCode;
    }

    @Override
    public DescribeThingRequest clone() {
        return (DescribeThingRequest) super.clone();
    }
}


text:
 require 'tc_helper.rb'

 class TestNumDataSource < Test::Unit::TestCase

  def setup
    @data_source = Axlsx::NumDataSource.new :data => ["1", "2", "3"]
  end

  def test_to_xml_string_strLit
    str = '<?xml version="1.0" encoding="UTF-8"?>'
    str << '<c:chartSpace xmlns:c="' << Axlsx::XML_NS_C << '">'
    str << @data_source.to_xml_string
    doc = Nokogiri::XML(str)
    assert_equal(doc.xpath("//c:val").size, 1)
  end

 end