text:
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

var format = require('date-format');

var $ = require('../util/jquery');
var defineClass = require('../util/define-class');

var Message = defineClass({
  statics: {
    INFO: 'INFO',
    ERROR: 'ERROR',

    info: function(text) {
      return {
        type: Message.INFO,
        text: text
      };
    },

    error: function(err) {
      if (typeof err !== 'string') {
        console.error(err);
      }

      while (err.message) {
        err = err.message; //ExtensionCrashError.message.message = ...
      }

      return {
        type: Message.ERROR,
        text: err.msg || err.toString()
      };
    }
  },

  publics: {
    setType: function(type) {
      switch (type) {
        case Message.INFO:
          this.$.attr('class', 'info');
          break;
        case Message.ERROR:
          this.$.attr('class', 'error');
          break;
        default:
          throw 'Invalid message type ' + type;
      }
    },

    setText: function(text) {
      this.$text.text(text);
    },

    setHtml: function(html) {
      this.$text.html(html);
    },

    setTimestamp: function(timestamp) {
      this.timestamp = timestamp;

      var fmt;
      if (timestamp === null || timestamp === undefined) {
        fmt = '';
      } else {
        fmt = format('yyyy.MM.dd.hh.mm.ss', new Date(timestamp));
      }
      this.$timestamp.text(fmt);
      if (fmt) {
        this.$label.removeClass('no-timestamp');
      } else {
        this.$label.addClass('no-timestamp');
      }
    },

    getTimestamp: function() {
      return this.timestamp;
    },

    setSender: function(sender) {
      this.$sender.text(sender);
      if (sender) {
        this.$label.removeClass('no-sender');
      } else {
        this.$label.addClass('no-sender');
      }
    },

    setPromise: function(promise) {
      var self = this;
      if (promise) {
        promise.then(function(obj) {
          self.set(obj);
        }, function(err) {
          self.set(Message.error(err));
        });
      } else {
        this.onLowerPriority();
      }
    },

    set: function(obj) {
      if (!obj) {
        this.onLowerPriority();
        return;
      }

      if (typeof obj === 'string') {
        obj = {
          type: Message.INFO,
          text: obj
        };
      }

      this.setType(obj.type);
      this.setSender(obj.sender);
      this.setTimestamp(obj.timestamp);
      if (obj.text) {
        this.setText(obj.text);
      } else {
        this.setHtml(obj.html);
      }

      this.setPromise(obj.promise);
    }
  },

  constants: [ '$' ],
  events: {
    /**
     * Event raised when the message is no longer pending user action.
     */
    onLowerPriority: 'memory once'
  },

  init: function(initial) {
    this.$ = $('<li>')
      .append(
        this.$label = $('<span>')
          .addClass('label no-sender no-timestamp')
          .append(
            this.$sender = $('<span>').addClass('username'),
            this.$timestamp = $('<span>').addClass('timestamp')),
        this.$text = $('<span>').addClass('text'));
    if (initial) {
      this.set(initial);
    }
  }
});

module.exports = Message;


text:
require "fast_polylines"

describe FastPolylines do
  describe ".decode" do
    let(:points) { [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]] }
    let(:polyline) { "_p~iF~ps|U_ulLnnqC_mqNvxq`@" }
    context "with default precision" do
      it "should decode a polyline correctly" do
        expect(described_class.decode(polyline)).to eq points
      end
    end
    context "with a 6 decimals precision" do
      let(:polyline) { "_izlhA~rlgdF_{geC~ywl@_kwzCn`{nI" }
      it "should decode a polyline correctly" do
        expect(described_class.decode(polyline, 6)).to eq points
      end
    end
    context "with a 15 decimals precision" do
      it "should raise" do
        expect { described_class.decode("_kiF_kiF", 15) }.to raise_error(ArgumentError, /too high/)
      end
    end
    context "with a negative precision" do
      it "should raise" do
        expect { described_class.decode("_kiF_kiF", -rand(1..10)) }.to raise_error(ArgumentError, /negative/)
      end
    end
    context "with wrong characters" do
      it "should raise" do
        chr = "~".next
        expect { described_class.decode(chr) }.to raise_error(ArgumentError, /'#{chr}'/)
      end
    end
    context "with points that were close together" do
      let(:points) { [[41.35222, -86.04563], [41.35222, -86.04544]] }
      it "should decode a polyline correctly" do
        expect(described_class.decode("krk{FdxdlO?e@")).to eq points
      end
    end
    context "with points that cause float overflow" do
      let(:polyline) { "ahdiHsmeMHPDN|A`FVt@" }
      let(:points) { [[48.85137, 2.32682], [48.85132, 2.32673], [48.85129, 2.32665], [48.85082, 2.32552], [48.8507, 2.32525]] }
      it "should respect precision" do
        expect(described_class.decode(polyline)).to eq points
      end
    end
  end

  describe ".encode" do
    let(:points) { [[38.5, -120.2], [40.7, -120.95], [43.252, -126.453]] }
    let(:polyline) { "_p~iF~ps|U_ulLnnqC_mqNvxq`@" }
    it "should raise for invalid input" do
      expect { described_class.encode(points[0]) }.to raise_error(
        TypeError,
        "wrong argument type Float (expected Array)"
      )
      expect { described_class.encode([points]) }.to raise_error(
        ArgumentError,
        "wrong number of coordinates"
      )
      expect { described_class.encode([points[0..1]]) }.to raise_error(
        TypeError,
        "no implicit conversion to Float from Array"
      )
    end
    # The method `_polyline_encode_number("", 16)` will check for a chunk
    # of the size 32, which is the chunk size limit. This was errored due to
    # a bad sign.
    # Reported in issue #15, closed in PR #16
    context "with points close to the chunk size limit" do
      let(:points) { [[0, 0.00016]] }
      let(:polyline) { "?_@" }
      it "should encode points correctly" do
        expect(described_class.encode(points)).to eq polyline
      end
    end
    context "with default precision" do
      it "should encode points correctly" do
        expect(described_class.encode(points)).to eq polyline
      end
    end
    context "with a 6 decimals precision" do
      let(:polyline) { "_izlhA~rlgdF_{geC~ywl@_kwzCn`{nI" }
      it "should encode points correctly" do
        expect(described_class.encode(points, 6)).to eq polyline
      end
    end
    context "with points that were close together" do
      let(:points) { [[41.35222, -86.04563], [41.35222, -86.04544]] }
      it "should encode points correctly" do
        expect(described_class.encode(points)).to eq "krk{FdxdlO?e@"
      end
    end
    context "with possible rounding ambiguity" do
      let(:points) { [[39.13594499,-94.4243478], [39.13558757,-94.4243471]] }
      it "should encode points as Google API do" do
        expect(described_class.encode(points)).to eq "svzmFdgi_QdA?"
      end
    end
    context "with points out of bounds" do
      it "should raise" do
        expect { described_class.encode([[180.1, 0.0]]) }.to raise_error ArgumentError
        expect { described_class.encode([[0, 180.1]]) }.to raise_error ArgumentError
        expect { described_class.encode([[-180.1, 0.0]]) }.to raise_error ArgumentError
        expect { described_class.encode([[0, -180.1]]) }.to raise_error ArgumentError
      end
    end
    context "with a 15 decimals precision" do
      it "should raise" do
        expect { described_class.encode([[1.2, 1.2]], 15) }.to raise_error(ArgumentError, /too high/)
      end
    end
    context "with a negative precision" do
      it "should raise" do
        expect { described_class.encode([[1.2, 1.2]], -rand(1..10)) }.to raise_error(ArgumentError, /negative/)
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Laminas\Db\Sql\Predicate;

class NotIn extends In
{
    /** @var string */
    protected $specification = '%s NOT IN %s';
}


text:
<?php

	/**
	 * Initialise a session.
	 *
	 * Note: Session must be started after plugins have been loaded as some plugins provide
	 * classes which must be declared first.
	 *
	 */
	function session_init()
	{
		session_start();

		// TODO: More session code
	}

	register_event('system', 'init', 'session_init', 1);


text:
using System;
using System.IdentityModel.Selectors;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Security;
using System.Security.Cryptography.X509Certificates;
using System.Security.Principal;
using System.ServiceModel;
using System.ServiceModel.Security;

namespace SolarWinds.InformationService.Contract2
{
    [DataContract(Name = "Windows", Namespace = "http://schema.solarwinds.com/2007/08/IS")]
    public class WindowsCredential : ServiceCredentials
    {
        private String _domain;
        private String _username;
        private SecureString _password;
        private TokenImpersonationLevel _tokenImpersonationLevel = TokenImpersonationLevel.Impersonation;

        public string Domain
        {
            get { return _domain; }
            set { _domain = value; }
        }

        public string Username
        {
            get { return _username; }
            set { _username = value; }
        }

        public SecureString Password
        {
            get { return _password; }
        }

        public TokenImpersonationLevel ImpersonationLevel
        {
            get { return _tokenImpersonationLevel; }
            set { _tokenImpersonationLevel = value; }
        }

        public WindowsCredential():this(String.Empty, String.Empty, String.Empty)
        {

        }

        public WindowsCredential(string username, string password)
        {
            SetUsername(username);
            _password = SecurePassword(password);
        }

        public WindowsCredential(string domain, string username, string password)
        {
            _domain = domain;
            _username = username;
            _password = SecurePassword(password);
        }

        public WindowsCredential(String username, SecureString password)
        {
            SetUsername(username);
            _password = password;
        }

        public WindowsCredential(String domain, String username, SecureString password)
        {
            _domain = domain;
            _username = username;
            _password = password;
        }

        private void SetUsername(string username)
        {
            int index = username.IndexOf('\\');
            if(index < 0 || index == (username.Length - 1))
            {
                _username = username;
            }
            else if(index > 0)
            {
                _domain = username.Substring(0, index);
                _username = username.Substring(index + 1);
            }
        }

        public override CredentialType CredentialType
        {
            get { return CredentialType.Windows; }
        }

        private static SecureString SecurePassword(String password)
        {
            SecureString pass = new SecureString();
            foreach(char c in password)
            {
                pass.AppendChar(c);
            }

            return pass;
        }

        public override void ApplyTo(ChannelFactory channelFactory)
        {
            if (!String.IsNullOrEmpty(Domain))
            {
                channelFactory.Credentials.Windows.ClientCredential.Domain = Domain;
                string host = channelFactory.Endpoint.Address.Uri.Host;
                if (String.IsNullOrEmpty(host) || host.Equals("localhost", StringComparison.OrdinalIgnoreCase))
                    host = Environment.MachineName;

                channelFactory.Endpoint.Address = new EndpointAddress(channelFactory.Endpoint.Address.Uri,
                                                                      EndpointIdentity.CreateSpnIdentity("HOST/" + host));
            }

            if (!String.IsNullOrEmpty(Username))
            {
                channelFactory.Credentials.Windows.ClientCredential.UserName = Username;
            }

            if (_password.Length > 0)
                channelFactory.Credentials.Windows.ClientCredential.Password = GetPassword();

            channelFactory.Credentials.Windows.AllowedImpersonationLevel = _tokenImpersonationLevel;
            channelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.Custom;

            X509ChainPolicy chainPolicy = new X509ChainPolicy();
            chainPolicy.VerificationFlags = X509VerificationFlags.AllowUnknownCertificateAuthority | X509VerificationFlags.IgnoreNotTimeValid;
            channelFactory.Credentials.ServiceCertificate.Authentication.CustomCertificateValidator = X509CertificateValidator.CreateChainTrustValidator(true, chainPolicy);
        }

        public string GetPassword()
        {
            IntPtr bstr = IntPtr.Zero;
            string insecureString;

            try
            {
                bstr = Marshal.SecureStringToBSTR(_password);
                insecureString = Marshal.PtrToStringBSTR(bstr);
            }
            catch
            {
                insecureString = String.Empty;
            }
            finally
            {
                if (bstr != IntPtr.Zero)
                {
                    Marshal.ZeroFreeBSTR(bstr);
                }
            }

            return insecureString;
        }

        protected override void Dispose(bool disposing)
        {
            if(_password != null)
            {
                _password.Dispose();
                _password = null;
            }

            base.Dispose(disposing);
        }
    }
}


text:
import pygame
from pygame.locals import *
import res

def backdoor(): # bypass version check error (debug & testing only!)
    a, b, c = None, None, None
    for event in pygame.event.get(KEYUP):
        if event.key == K_w:
            a = True
        elif event.key == K_u:
            b = True
        elif event.key == K_g:
            c = True
    if a and b and c:
        return True     # W, U, and G released on same frame
    return False

def forKeyPress():
    forQuit()
    for event in pygame.event.get([KEYDOWN, KEYUP]):
        if event.type == KEYDOWN:
            continue # removes keydowns from queue
        return event.key    # returns keyup key
    return None # returns a None object if no keydown or keyup events

def forQuit():
    for event in pygame.event.get(QUIT):
        res.terminate()
    for event in pygame.event.get(KEYUP):
        if event.key == K_ESCAPE:
            res.terminate()
        pygame.event.post(event) # put other KEYUPs back if not ESC


text:
path=/home/rewrite/Documents

for f in $( ls $path ); do
  echo $f
done


text:
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { Observable } from 'rxjs';
import { ApiRequestStatus } from '../../../../../framework/client/rpc';
import { GetBackendAppAssetsAction, RemoveBackendAppAssetAction } from '../../../actions';
import { getBackendAppAssets, getBackendAppAssetsStatus } from '../../../console.state';
import { AppAsset } from '../../../interfaces';

@Component({
  selector: 'rcc-backend-resources',
  changeDetection: ChangeDetectionStrategy.OnPush,
  templateUrl: 'resources.component.html',
})
export class BackendResourcesComponent implements OnInit {
  appAssets$: Observable<AppAsset[]>;
  status$: Observable<ApiRequestStatus>;

  constructor(private store: Store) {
  }

  ngOnInit() {
    this.store.dispatch(new GetBackendAppAssetsAction());
    this.appAssets$ = this.store.select(getBackendAppAssets);
    this.status$ = this.store.select(getBackendAppAssetsStatus);
  }

  removeAsset(asset: AppAsset) {
    this.store.dispatch(new RemoveBackendAppAssetAction(asset));
  }
}


text:
Changelog
=========

0.3.0 (unreleased)
------------------

Features
^^^^^^^^
* security-setup: add additional confirmation prompt for password #173

Fixes
^^^^^
* Note Vagrant provider requirement #170

0.2.0 (04-10-2015)
------------------

Features
^^^^^^^^

* Security added across the board
* Moved consul out of docker #66
* Added authentication & ssl support for marathon #67
* Add mesos-authentication #45
* Add haproxy role to dynamically configure haproxy from consul. #42
* Add TLS to consul #46
* Add basic ACL support to Consul
* Add consul agent_token support
* Add Haproxy container #42, #48
* Add authentication setup script #65
* Add Zookeeper authentication and ACLs for mesos #86
* Add nginx proxy to authentiate consul UI
* Removed hardcoding of marathon to 0.7.6
* Move consul to install via rpm #90
* auth-setup: openssl has to prompt user #99
* Ease of use enhancements for security-setup #109
* Need to update example/hello-world to support Marathon auth #112
* Automatically redirect http requests to https #113
* security-setup refinements #128
* Use Centos docker package #141
* Move openstack security group to a variable #155

Fixes
^^^^^
* Mesos & Marathon consul registration do not survive reboot #16
* Set preference for virtualbox provider for owners of vmware_fusion #73
* Fix consul clients #30
* Remove consul-ui from agent nodes #93
* OpenSSL certificate fixes #95
* Fix ansible inventory metadata #96
* Deprecated checkpoint flag prevents mesos-slave startup #105
* Consul UI unavailable #111
* Networkmanager removing 127.0.0.1 from /etc/resolv.conf #122
* Consul "Failed connect to 127.0.0.1:8080; Connection refused" #131
* Remove duplicate definition of marathon_servers #101
* Running reboot-hosts.yml causes consul to lose quorum #132
* Missing or incorrect information in getting started documents #133
* Numerous other bug fixes
* Docker fails to start when using latest Docker RPM without latest CentOS7 updates #161
* Fix documentation for security group ports #154
* Security-setup script hangs on low entropy linux hosts due to /dev/random bug #153

0.1.0 (03-02-2015)
------------------

- Initial release.

Ansible Roles
^^^^^^^^^^^^^

* Add common role for timezones, users and resolv.conf
* Add consul role
* Add dnsmasq role
* Add registrator role
* Add mesos-leader role
* Add mesos-follower role
* Add marathon role
* Add zookeeper role
* Add documentation

Ansible Playbooks
^^^^^^^^^^^^^^^^^

* Add consul-join-wan
* Add destroy-hosts
* Add provision-consul-gossip-key
* Add provision-hosts
* Add provision-nova-key
* Add reboot-hosts
* Add show-containers
* Add show-package-drift
* Add show-uptime
* Add trace-consul-wan-traffic
* Add upgrade-packages


text:
require 'set'
require 'brakeman/processors/alias_processor'
require 'brakeman/processors/lib/render_helper'
require 'brakeman/tracker'

#Processes aliasing in templates.
#Handles calls to +render+.
class Brakeman::TemplateAliasProcessor < Brakeman::AliasProcessor
  include Brakeman::RenderHelper

  FORM_METHODS = Set[:form_for, :remote_form_for, :form_remote_for]

  def initialize tracker, template, called_from = nil
    super tracker
    @template = template
    @called_from = called_from
  end

  #Process template
  def process_template name, args
    if @called_from
      unless @called_from.grep(/Template:#{name}$/).empty?
        Brakeman.debug "Skipping circular render from #{@template[:name]} to #{name}"
        return
      end

      super name, args, @called_from + ["Template:#{@template[:name]}"]
    else
      super name, args, ["Template:#{@template[:name]}"]
    end
  end

  #Determine template name
  def template_name name
    if !name.to_s.include?('/') && @template[:name].to_s.include?('/')
      name = "#{@template[:name].to_s.match(/^(.*\/).*$/)[1]}#{name}"
    end
    name
  end

  UNKNOWN_MODEL_CALL = Sexp.new(:call, Sexp.new(:const, Brakeman::Tracker::UNKNOWN_MODEL), :new)
  FORM_BUILDER_CALL = Sexp.new(:call, Sexp.new(:const, :FormBuilder), :new)

  #Looks for form methods and iterating over collections of Models
  def process_call_with_block exp
    process_default exp

    call = exp.block_call

    if call? call
      target = call.target
      method = call.method
      arg = exp.block_args.first_param
      block = exp.block

      #Check for e.g. Model.find.each do ... end
      if method == :each and arg and block and model = get_model_target(target)
        if arg.is_a? Symbol
          if model == target.target
            env[Sexp.new(:lvar, arg)] = Sexp.new(:call, model, :new)
          else
            env[Sexp.new(:lvar, arg)] = UNKNOWN_MODEL_CALL
          end

          process block if sexp? block
        end
      elsif FORM_METHODS.include? method
        if arg.is_a? Symbol
          env[Sexp.new(:lvar, arg)] = FORM_BUILDER_CALL

          process block if sexp? block
        end
      end
    end

    exp
  end

  alias process_iter process_call_with_block

  #Checks if +exp+ is a call to Model.all or Model.find*
  def get_model_target exp
    if call? exp
      target = exp.target

      if exp.method == :all or exp.method.to_s[0,4] == "find"
        models = Set.new @tracker.models.keys
        name = class_name target
        return target if models.include?(name)
      end

      return get_model_target(target)
    end

    false
  end

  #Ignore `<<` calls on template variables which are used by the templating
  #library (HAML, ERB, etc.)
  def find_push_target exp
    if sexp? exp
      if exp.node_type == :lvar and (exp.value == :_buf or exp.value == :_erbout)
        return nil
      elsif exp.node_type == :ivar and exp.value == :@output_buffer
        return nil
      elsif exp.node_type == :call and call? exp.target and
        exp.target.method == :_hamlout and exp.method == :buffer

        return nil
      end
    end

    super
  end
end


text:
<?php

namespace Proyecto\PrincipalBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * CmsArticle
 *
 * @ORM\Table(name="cms_date")
 * @ORM\Entity
 */
class CmsDate
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var \CmsArticle
     *
     * @ORM\ManyToOne(targetEntity="CmsArticle")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="article", referencedColumnName="id")
     * })
     */
    private $article;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date", type="datetime", nullable=false)
     */
    private $date;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set article
     *
     * @param \Proyecto\PrincipalBundle\Entity\CmsArticle $article
     * @return CmsDate
     */
    public function setArticle(\Proyecto\PrincipalBundle\Entity\CmsArticle $article = null)
    {
        $this->article = $article;

        return $this;
    }

    /**
     * Get article
     *
     * @return \Proyecto\PrincipalBundle\Entity\CmsArticle
     */
    public function getArticle()
    {
        return $this->article;
    }

    /**
     * Set date
     *
     * @param \DateTime $date
     * @return CmsDate
     */
    public function setDate($date)
    {
        $this->date = $date;

        return $this;
    }

    /**
     * Get date
     *
     * @return \DateTime
     */
    public function getDate()
    {
        return $this->date;
    }
}


text:
package com.dungeonstory.ui.view;

import com.vaadin.navigator.View;

public interface CrudView<T> extends View {

    public void entrySaved(T entity);
    public void entryReset(T entity);
    public void entrySelected(T entity);
    public void deleteSelected(T entity);
}


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>Rivas & Fregoso</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link href='https://fonts.googleapis.com/css?family=Cabin:400,700' rel='stylesheet' type='text/css'>
        <link href='https://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="css/normalize.css">
        <link rel="stylesheet" href="css/main.css">

Nosotros

Servicios

Bolsa

Contacto

                            Somos una firma mexicana de contadores públicos y consultores

                            Destacada por su liderazgo en la prestación de servicios integrales y personalizados a las empresas privadas y a sus propietarios en nuestro país.

Derecho Laboral

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptates consequuntur dolorem aut provident, repellendus!

Derecho Penal

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Officia quia sint accusamus, alias magni ratione magnam!

Derecho Civil

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui, libero hic est consequuntur.


text:
package io.groundhog.capture;

import io.groundhog.har.HttpArchive;

import com.google.common.base.Optional;
import com.google.common.net.HostAndPort;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponse;

import java.util.Collection;
import java.util.Collections;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * @author Danny Thomas
 * @since 1.0
 */
public class DefaultCaptureRequest implements CaptureRequest {
  private final long startedDateTime;
  private final HttpRequest request;
  private final HttpResponse response;

  public DefaultCaptureRequest(long startedDateTime, HttpRequest request, HttpResponse response) {
    this.startedDateTime = startedDateTime;
    this.request = checkNotNull(request);
    this.response = checkNotNull(response);
  }

  @Override
  public long getStartedDateTime() {
    return startedDateTime;
  }

  @Override
  public HttpRequest getRequest() {
    return request;
  }

  @Override
  public HttpResponse getResponse() {
    return response;
  }

  @Override
  public Collection<HttpArchive.Param> getParams() {
    return Collections.emptyList();
  }

  @Override
  public String getContent() {
    return "";
  }
}


text:
package org.iamlionheart.phonebook;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class MainController {
	@Autowired
	private PhoneListingDAO doa;

	@RequestMapping(value = "/", method = RequestMethod.GET)
	public String showFullListing(ModelMap model) {
		model.addAttribute("phonebook", doa.getAllListings());
		return "listing";

	}
}


text:
// <copyright file="DiceResultConverter.cs" company="DarthPedro">
// Copyright (c) 2017 DarthPedro. All rights reserved.
// </copyright>

//-----------------------------------------------------------------------
// Assembly         : OnePlat.DiceNotation
// Author           : DarthPedro
// Created          : 8/28/2017
//
// Last Modified By : DarthPedro
// Last Modified On : 8/28/2017
//-----------------------------------------------------------------------
// <summary>
//       This project is licensed under the MIT license.
//
//       OnePlat.DiceNotation is an open source project that parses,
//  evalutes, and rolls dice that conform to the defined Dice notiation.
//  This notation is usable in any form of random dice games and role-playing
//  games like D&D and d20.
// </summary>
//-----------------------------------------------------------------------
using System;

namespace OnePlat.DiceNotation.Converters
{
    /// <summary>
    /// Value converter to change a DiceResult into a display string.
    /// </summary>
    public class DiceResultConverter
    {
        /// <summary>
        /// Converts the DiceResult into a string respresentation.
        /// </summary>
        /// <param name="value">value to convert</param>
        /// <param name="targetType">target type of the conversion</param>
        /// <param name="parameter">converter parameter</param>
        /// <param name="language">language</param>
        /// <returns>Converted value.</returns>
        public virtual object Convert(object value, Type targetType, object parameter, string language)
        {
            if (targetType != typeof(string))
            {
                throw new ArgumentException("Unexpected type passed to converter.", nameof(targetType));
            }

            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            DiceResult dr = value as DiceResult;
            if (dr == null)
            {
                throw new ArgumentException("Object not of type DiceResult.", nameof(value));
            }

            return string.Format("{0} ({1})", dr.Value, dr.DiceExpression);
        }

        /// <summary>
        /// Converts back from string representation to a DiceResult.
        /// </summary>
        /// <param name="value">value to convert</param>
        /// <param name="targetType">target type of the conversion</param>
        /// <param name="parameter">converter parameter</param>
        /// <param name="language">language</param>
        /// <returns>Converted value.</returns>
        public virtual object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            // the reverse conversion is not supported.
            throw new NotSupportedException();
        }
    }
}


text:
module Azure::RecoveryServicesSiteRecovery::Mgmt::V2016_08_10
  module Models
    #
    # This class represents a task which is actually a workflow so that one can
    # navigate to its individual drill down.
    #
    class JobTaskDetails < TaskTypeDetails

      include MsRestAzure

      def initialize
        @instanceType = "JobTaskDetails"
      end

      attr_accessor :instanceType

      # @return [JobEntity] The job entity.
      attr_accessor :job_task

      #
      # Mapper for JobTaskDetails class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'JobTaskDetails',
          type: {
            name: 'Composite',
            class_name: 'JobTaskDetails',
            model_properties: {
              instanceType: {
                client_side_validation: true,
                required: true,
                serialized_name: 'instanceType',
                type: {
                  name: 'String'
                }
              },
              job_task: {
                client_side_validation: true,
                required: false,
                serialized_name: 'jobTask',
                type: {
                  name: 'Composite',
                  class_name: 'JobEntity'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
const path = require("path")
const mockSpawn = require("mock-spawn")
const assert = require("assert")
const child_process = require("child_process")
const { detectVirtualEnv, sanitizeConfig, detectPipEnv, replacePipEnvPathVar } = require("../lib/utils")

const venvFixturesDir = path.join(__dirname, "fixtures", "venv")

describe("detectVirtualEnv", () => {
  it("detects no virtual env when there isn't any", () => {
    waitsForPromise(() => {
      return detectVirtualEnv(path.join(venvFixturesDir, "none")).then((venv) => {
        expect(venv).toBeUndefined()
      })
    })
  })

  it("detects a Unix virtual env at the root", () => {
    const projectPath = path.join(venvFixturesDir, "unix")
    waitsForPromise(() => {
      return detectVirtualEnv(projectPath).then((venv) => {
        expect(venv).toEqual(projectPath)
      })
    })
  })

  it("detects a Windows virtual env at the root", () => {
    const projectPath = path.join(venvFixturesDir, "windows")
    waitsForPromise(() => {
      return detectVirtualEnv(projectPath).then((venv) => {
        expect(venv).toEqual(projectPath)
      })
    })
  })

  it("detects a Unix virtual env in a subdirectory", () => {
    const projectPath = path.join(venvFixturesDir, "unix-subdir")
    const venvPath = path.join(projectPath, "venv")
    waitsForPromise(() => {
      return detectVirtualEnv(projectPath).then((venv) => {
        expect(venv).toEqual(venvPath)
      })
    })
  })

  it("detects a Windows virtual env in a subdirectory", () => {
    const projectPath = path.join(venvFixturesDir, "windows-subdir")
    const venvPath = path.join(projectPath, "venv")
    waitsForPromise(() => {
      return detectVirtualEnv(projectPath).then((venv) => {
        expect(venv).toEqual(venvPath)
      })
    })
  })
})

describe("detect PipEnv", () => {
  const spawn = mockSpawn()
  child_process.spawn = spawn
  spawn.sequence.add(function (cb) {
    this.emit("error", new Error("spawn ENOENT"))
    setTimeout(function () {
      return cb(8)
    }, 10)
  })
  it("with no pipenv", () => {
    waitsForPromise(() => {
      return detectPipEnv("/home/mock_pipenv").then((venv) => {
        expect(venv).toBeNull()
        assert.equal("pipenv", spawn.calls[0].command)
        assert.deepEqual(["--venv"], spawn.calls[0].args)
      })
    })
  })

  it("with Unix pipenv", () => {
    spawn.sequence.add(spawn.simple(1, "/home/tvallois/.local/share/virtualenvs/unix-XZE001N_"))
    waitsForPromise(() => {
      return detectPipEnv("/home/mock_pipenv").then((venv) => {
        expect(venv).toBe("/home/tvallois/.local/share/virtualenvs/unix-XZE001N_")
        assert.equal("pipenv", spawn.calls[1].command)
        assert.deepEqual(["--venv"], spawn.calls[1].args)
      })
    })
  })

  it("with Windows pipenv", () => {
    spawn.sequence.add(spawn.simple(1, "C:\\Program Files\\tvallois\\virtualenvs\\windows-XZE001N_"))
    waitsForPromise(() => {
      return detectPipEnv("C:\\Program Files\\mock_pipenv").then((venv) => {
        expect(venv).toBe("C:\\Program Files\\tvallois\\virtualenvs\\windows-XZE001N_")
        assert.equal("pipenv", spawn.calls[2].command)
        assert.deepEqual(["--venv"], spawn.calls[2].args)
      })
    })
  })
})

describe("replacePipEnvPathVar", () => {
  it("replace $PIPENV_PATH", () => {
    expect(
      replacePipEnvPathVar("$PIPENV_PATH/bin/python", "/home/tvallois/.local/share/virtualenvs/unix-XZE001N_")
    ).toEqual("/home/tvallois/.local/share/virtualenvs/unix-XZE001N_/bin/python")
  })

  it("no $PIPENV_PATH", () => {
    expect(replacePipEnvPathVar("python", "/home/tvallois/.local/share/virtualenvs/unix-XZE001N_")).toEqual("python")
  })
})

describe("sanitizeConfig", () => {
  it("converts 'null' to null", () => {
    const config = {
      ropeFolder: "null",
      extensionModules: ["numpy", "pandas"],
    }
    expect(sanitizeConfig(config)).toEqual({
      ropeFolder: null,
      extensionModules: ["numpy", "pandas"],
    })
  })

  it("doesn't change object", () => {
    const config = {
      ropeFolder: ".ropeproject",
      extensionModules: ["numpy", "pandas"],
    }
    expect(sanitizeConfig(config)).toEqual(config)
  })
})


text:
class UserObserver < ActiveRecord::Observer
  def before_create record
    record.roles += %w( seller ) if record.email =~ /@(.+\.)*(uchicago\.edu|uchospitals\.edu|chicagobooth\.edu)\z/i
  end
end


text:
// Class header file.
#include "PrintWriter.hpp"

#include "DOMStringHelper.hpp"
#include "XalanUnicode.hpp"

XALAN_CPP_NAMESPACE_BEGIN

const XalanDOMChar  PrintWriter::s_trueString[] =
{
    XalanUnicode::charLetter_t,
    XalanUnicode::charLetter_r,
    XalanUnicode::charLetter_u,
    XalanUnicode::charLetter_e,
    0
};

const XalanDOMChar  PrintWriter::s_falseString[] =
{
    XalanUnicode::charLetter_f,
    XalanUnicode::charLetter_a,
    XalanUnicode::charLetter_l,
    XalanUnicode::charLetter_s,
    XalanUnicode::charLetter_e,
    0
};

const XalanDOMChar  PrintWriter::s_newlineString[] =
{
    XalanUnicode::charLF,
    0
};

PrintWriter::PrintWriter( bool  fAutoFlush, MemoryManager& theManager) :
    Writer(),
    m_fAutoFlush(fAutoFlush),
    m_memoryManager(theManager)
{
}

PrintWriter::~PrintWriter()
{
}

XALAN_CPP_NAMESPACE_END


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

  var ChildNodeInterface = scope.ChildNodeInterface;
  var GetElementsByInterface = scope.GetElementsByInterface;
  var Node = scope.wrappers.Node;
  var ParentNodeInterface = scope.ParentNodeInterface;
  var SelectorsInterface = scope.SelectorsInterface;
  var addWrapNodeListMethod = scope.addWrapNodeListMethod;
  var mixin = scope.mixin;
  var registerWrapper = scope.registerWrapper;
  var wrappers = scope.wrappers;

  var shadowRootTable = new SideTable();
  var OriginalElement = window.Element;

  var originalMatches =
      OriginalElement.prototype.matches ||
      OriginalElement.prototype.mozMatchesSelector ||
      OriginalElement.prototype.msMatchesSelector ||
      OriginalElement.prototype.webkitMatchesSelector;

  function Element(node) {
    Node.call(this, node);
  }
  Element.prototype = Object.create(Node.prototype);
  mixin(Element.prototype, {
    createShadowRoot: function() {
      var newShadowRoot = new wrappers.ShadowRoot(this);
      shadowRootTable.set(this, newShadowRoot);

      scope.getRendererForHost(this);

      this.invalidateShadowRenderer(true);

      return newShadowRoot;
    },

    get shadowRoot() {
      return shadowRootTable.get(this) || null;
    },

    setAttribute: function(name, value) {
      this.impl.setAttribute(name, value);
      // This is a bit agressive. We need to invalidate if it affects
      // the rendering content[select] or if it effects the value of a content
      // select.
      this.invalidateShadowRenderer();
    },

    matches: function(selector) {
      return originalMatches.call(this.impl, selector);
    }
  });

  if (OriginalElement.prototype.webkitCreateShadowRoot) {
    Element.prototype.webkitCreateShadowRoot =
        Element.prototype.createShadowRoot;
  }

  mixin(Element.prototype, ChildNodeInterface);
  mixin(Element.prototype, GetElementsByInterface);
  mixin(Element.prototype, ParentNodeInterface);
  mixin(Element.prototype, SelectorsInterface);

  registerWrapper(OriginalElement, Element);

  scope.wrappers.Element = Element;
})(this.ShadowDOMPolyfill);


text:
<?php

namespace CatchyIO\SymfonyBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class CatchyIOSymfonyBundle extends Bundle
{
}


text:
<?php

namespace Bankiru\Seo\Tests\Unit\Normalizer;

use Bankiru\Seo\Destination\Normalizer\StringifyNormalizer;

class StringifyNormalizerTest extends AbstractNormalizerTest
{

    public function getValidSubjects()
    {
        return [
            'Valid subject' => ['test', new StringableMock('test')],
        ];
    }

    public function getInvalidSubjects()
    {
        return [
            'Invalid subject' => [[]],
        ];
    }

    /** {@inheritdoc} */
    protected function createNormalizer()
    {
        return new StringifyNormalizer();
    }
}


text:
package com.sebastian_daschner.jaxrs_analyzer.analysis.results;

import com.sebastian_daschner.jaxrs_analyzer.model.results.ClassResult;
import com.sebastian_daschner.jaxrs_analyzer.model.results.MethodResult;
import com.sebastian_daschner.jaxrs_analyzer.utils.StringUtils;

import java.util.*;
import java.util.stream.Collectors;

/**
 * Normalizes the JAX-RS paths.
 *
 * @author Sebastian Daschner
 */
final class PathNormalizer {

    private PathNormalizer() {
        throw new UnsupportedOperationException();
    }

    /**
     * Returns the normalized application path found in any of the given class results.
     *
     * @return The base URI of the application
     */
    static String getApplicationPath(final Set<ClassResult> classResults) {
        return classResults.stream().map(ClassResult::getApplicationPath).filter(Objects::nonNull)
                .map(PathNormalizer::normalize).findAny().orElse("");
    }

    /**
     * Returns the normalized path (without forward-slashes at the beginning or the end) of the given method result
     * including all parent class resources.
     *
     * @param methodResult The method result
     * @return The normalized full path of the method
     */
    static String getPath(final MethodResult methodResult) {
        final List<String> paths = determinePaths(methodResult);

        return paths.stream().map(PathNormalizer::normalize).collect(Collectors.joining("/"));
    }

    /**
     * Determines all single paths of the method result recursively. All parent class and method results are analyzed as well.
     *
     * @param methodResult The method result
     * @return All single path pieces
     */
    private static List<String> determinePaths(final MethodResult methodResult) {
        final List<String> paths = new LinkedList<>();
        MethodResult currentMethod = methodResult;

        while (true) {
            addNonBlank(currentMethod.getPath(), paths);
            final ClassResult parentClass = currentMethod.getParentResource();

            if (parentClass == null)
                break;

            currentMethod = parentClass.getParentSubResourceLocator();
            if (currentMethod == null) {
                addNonBlank(parentClass.getResourcePath(), paths);
                break;
            }
        }

        Collections.reverse(paths);
        return paths;
    }

    /**
     * Adds the string to the list if it is not blank.
     *
     * @param string  The string to add
     * @param strings The list
     */
    private static void addNonBlank(final String string, final List<String> strings) {
        if (!StringUtils.isBlank(string) && !"/".equals(string))
            strings.add(string);
    }

    /**
     * Normalizes the given path, i.e. trims leading or trailing forward-slashes and removes path parameter matchers.
     *
     * @param path The path to normalize
     * @return The normalized path
     */
    private static String normalize(final String path) {
        final StringBuilder builder = new StringBuilder(path);

        int index = 0;
        int colonIndex = -1;
        char current = 0;
        char last;

        while ((index > -1) && (index < builder.length())) {
            last = current;
            current = builder.charAt(index);

            switch (current) {
                case '}':
                    if (last == '\\')
                        break;
                    if (colonIndex != -1) {
                        builder.delete(colonIndex, index);
                        index = colonIndex;
                        colonIndex = -1;
                    }
                    break;
                case ':':
                    if (colonIndex == -1) {
                        colonIndex = index;
                    }
                    break;
            }

            if ((index == 0 || index == builder.length() - 1) && current == '/') {
                builder.deleteCharAt(index);
                if (index == builder.length()) {
                    // check again for path end
                    index--;
                }
            } else {
                index++;
            }
        }

        return builder.toString();
    }

}